jt3d.es.js 5.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430744317443274433744347443574436744377443874439744407444174442744437444474445744467444774448744497445074451744527445374454744557445674457744587445974460744617446274463744647446574466744677446874469744707447174472744737447474475744767447774478744797448074481744827448374484744857448674487744887448974490744917449274493744947449574496744977449874499745007450174502745037450474505745067450774508745097451074511745127451374514745157451674517745187451974520745217452274523745247452574526745277452874529745307453174532745337453474535745367453774538745397454074541745427454374544745457454674547745487454974550745517455274553745547455574556745577455874559745607456174562745637456474565745667456774568745697457074571745727457374574745757457674577745787457974580745817458274583745847458574586745877458874589745907459174592745937459474595745967459774598745997460074601746027460374604746057460674607746087460974610746117461274613746147461574616746177461874619746207462174622746237462474625746267462774628746297463074631746327463374634746357463674637746387463974640746417464274643746447464574646746477464874649746507465174652746537465474655746567465774658746597466074661746627466374664746657466674667746687466974670746717467274673746747467574676746777467874679746807468174682746837468474685746867468774688746897469074691746927469374694746957469674697746987469974700747017470274703747047470574706747077470874709747107471174712747137471474715747167471774718747197472074721747227472374724747257472674727747287472974730747317473274733747347473574736747377473874739747407474174742747437474474745747467474774748747497475074751747527475374754747557475674757747587475974760747617476274763747647476574766747677476874769747707477174772747737477474775747767477774778747797478074781747827478374784747857478674787747887478974790747917479274793747947479574796747977479874799748007480174802748037480474805748067480774808748097481074811748127481374814748157481674817748187481974820748217482274823748247482574826748277482874829748307483174832748337483474835748367483774838748397484074841748427484374844748457484674847748487484974850748517485274853748547485574856748577485874859748607486174862748637486474865748667486774868748697487074871748727487374874748757487674877748787487974880748817488274883748847488574886748877488874889748907489174892748937489474895748967489774898748997490074901749027490374904749057490674907749087490974910749117491274913749147491574916749177491874919749207492174922749237492474925749267492774928749297493074931749327493374934749357493674937749387493974940749417494274943749447494574946749477494874949749507495174952749537495474955749567495774958749597496074961749627496374964749657496674967749687496974970749717497274973749747497574976749777497874979749807498174982749837498474985749867498774988749897499074991749927499374994749957499674997749987499975000750017500275003750047500575006750077500875009750107501175012750137501475015750167501775018750197502075021750227502375024750257502675027750287502975030750317503275033750347503575036750377503875039750407504175042750437504475045750467504775048750497505075051750527505375054750557505675057750587505975060750617506275063750647506575066750677506875069750707507175072750737507475075750767507775078750797508075081750827508375084750857508675087750887508975090750917509275093750947509575096750977509875099751007510175102751037510475105751067510775108751097511075111751127511375114751157511675117751187511975120751217512275123751247512575126751277512875129751307513175132751337513475135751367513775138751397514075141751427514375144751457514675147751487514975150751517515275153751547515575156751577515875159751607516175162751637516475165751667516775168751697517075171751727517375174751757517675177751787517975180751817518275183751847518575186751877518875189751907519175192751937519475195751967519775198751997520075201752027520375204752057520675207752087520975210752117521275213752147521575216752177521875219752207522175222752237522475225752267522775228752297523075231752327523375234752357523675237752387523975240752417524275243752447524575246752477524875249752507525175252752537525475255752567525775258752597526075261752627526375264752657526675267752687526975270752717527275273752747527575276752777527875279752807528175282752837528475285752867528775288752897529075291752927529375294752957529675297752987529975300753017530275303753047530575306753077530875309753107531175312753137531475315753167531775318753197532075321753227532375324753257532675327753287532975330753317533275333753347533575336753377533875339753407534175342753437534475345753467534775348753497535075351753527535375354753557535675357753587535975360753617536275363753647536575366753677536875369753707537175372753737537475375753767537775378753797538075381753827538375384753857538675387753887538975390753917539275393753947539575396753977539875399754007540175402754037540475405754067540775408754097541075411754127541375414754157541675417754187541975420754217542275423754247542575426754277542875429754307543175432754337543475435754367543775438754397544075441754427544375444754457544675447754487544975450754517545275453754547545575456754577545875459754607546175462754637546475465754667546775468754697547075471754727547375474754757547675477754787547975480754817548275483754847548575486754877548875489754907549175492754937549475495754967549775498754997550075501755027550375504755057550675507755087550975510755117551275513755147551575516755177551875519755207552175522755237552475525755267552775528755297553075531755327553375534755357553675537755387553975540755417554275543755447554575546755477554875549755507555175552755537555475555755567555775558755597556075561755627556375564755657556675567755687556975570755717557275573755747557575576755777557875579755807558175582755837558475585755867558775588755897559075591755927559375594755957559675597755987559975600756017560275603756047560575606756077560875609756107561175612756137561475615756167561775618756197562075621756227562375624756257562675627756287562975630756317563275633756347563575636756377563875639756407564175642756437564475645756467564775648756497565075651756527565375654756557565675657756587565975660756617566275663756647566575666756677566875669756707567175672756737567475675756767567775678756797568075681756827568375684756857568675687756887568975690756917569275693756947569575696756977569875699757007570175702757037570475705757067570775708757097571075711757127571375714757157571675717757187571975720757217572275723757247572575726757277572875729757307573175732757337573475735757367573775738757397574075741757427574375744757457574675747757487574975750757517575275753757547575575756757577575875759757607576175762757637576475765757667576775768757697577075771757727577375774757757577675777757787577975780757817578275783757847578575786757877578875789757907579175792757937579475795757967579775798757997580075801758027580375804758057580675807758087580975810758117581275813758147581575816758177581875819758207582175822758237582475825758267582775828758297583075831758327583375834758357583675837758387583975840758417584275843758447584575846758477584875849758507585175852758537585475855758567585775858758597586075861758627586375864758657586675867758687586975870758717587275873758747587575876758777587875879758807588175882758837588475885758867588775888758897589075891758927589375894758957589675897758987589975900759017590275903759047590575906759077590875909759107591175912759137591475915759167591775918759197592075921759227592375924759257592675927759287592975930759317593275933759347593575936759377593875939759407594175942759437594475945759467594775948759497595075951759527595375954759557595675957759587595975960759617596275963759647596575966759677596875969759707597175972759737597475975759767597775978759797598075981759827598375984759857598675987759887598975990759917599275993759947599575996759977599875999760007600176002760037600476005760067600776008760097601076011760127601376014760157601676017760187601976020760217602276023760247602576026760277602876029760307603176032760337603476035760367603776038760397604076041760427604376044760457604676047760487604976050760517605276053760547605576056760577605876059760607606176062760637606476065760667606776068760697607076071760727607376074760757607676077760787607976080760817608276083760847608576086760877608876089760907609176092760937609476095760967609776098760997610076101761027610376104761057610676107761087610976110761117611276113761147611576116761177611876119761207612176122761237612476125761267612776128761297613076131761327613376134761357613676137761387613976140761417614276143761447614576146761477614876149761507615176152761537615476155761567615776158761597616076161761627616376164761657616676167761687616976170761717617276173761747617576176761777617876179761807618176182761837618476185761867618776188761897619076191761927619376194761957619676197761987619976200762017620276203762047620576206762077620876209762107621176212762137621476215762167621776218762197622076221762227622376224762257622676227762287622976230762317623276233762347623576236762377623876239762407624176242762437624476245762467624776248762497625076251762527625376254762557625676257762587625976260762617626276263762647626576266762677626876269762707627176272762737627476275762767627776278762797628076281762827628376284762857628676287762887628976290762917629276293762947629576296762977629876299763007630176302763037630476305763067630776308763097631076311763127631376314763157631676317763187631976320763217632276323763247632576326763277632876329763307633176332763337633476335763367633776338763397634076341763427634376344763457634676347763487634976350763517635276353763547635576356763577635876359763607636176362763637636476365763667636776368763697637076371763727637376374763757637676377763787637976380763817638276383763847638576386763877638876389763907639176392763937639476395763967639776398763997640076401764027640376404764057640676407764087640976410764117641276413764147641576416764177641876419764207642176422764237642476425764267642776428764297643076431764327643376434764357643676437764387643976440764417644276443764447644576446764477644876449764507645176452764537645476455764567645776458764597646076461764627646376464764657646676467764687646976470764717647276473764747647576476764777647876479764807648176482764837648476485764867648776488764897649076491764927649376494764957649676497764987649976500765017650276503765047650576506765077650876509765107651176512765137651476515765167651776518765197652076521765227652376524765257652676527765287652976530765317653276533765347653576536765377653876539765407654176542765437654476545765467654776548765497655076551765527655376554765557655676557765587655976560765617656276563765647656576566765677656876569765707657176572765737657476575765767657776578765797658076581765827658376584765857658676587765887658976590765917659276593765947659576596765977659876599766007660176602766037660476605766067660776608766097661076611766127661376614766157661676617766187661976620766217662276623766247662576626766277662876629766307663176632766337663476635766367663776638766397664076641766427664376644766457664676647766487664976650766517665276653766547665576656766577665876659766607666176662766637666476665766667666776668766697667076671766727667376674766757667676677766787667976680766817668276683766847668576686766877668876689766907669176692766937669476695766967669776698766997670076701767027670376704767057670676707767087670976710767117671276713767147671576716767177671876719767207672176722767237672476725767267672776728767297673076731767327673376734767357673676737767387673976740767417674276743767447674576746767477674876749767507675176752767537675476755767567675776758767597676076761767627676376764767657676676767767687676976770767717677276773767747677576776767777677876779767807678176782767837678476785767867678776788767897679076791767927679376794767957679676797767987679976800768017680276803768047680576806768077680876809768107681176812768137681476815768167681776818768197682076821768227682376824768257682676827768287682976830768317683276833768347683576836768377683876839768407684176842768437684476845768467684776848768497685076851768527685376854768557685676857768587685976860768617686276863768647686576866768677686876869768707687176872768737687476875768767687776878768797688076881768827688376884768857688676887768887688976890768917689276893768947689576896768977689876899769007690176902769037690476905769067690776908769097691076911769127691376914769157691676917769187691976920769217692276923769247692576926769277692876929769307693176932769337693476935769367693776938769397694076941769427694376944769457694676947769487694976950769517695276953769547695576956769577695876959769607696176962769637696476965769667696776968769697697076971769727697376974769757697676977769787697976980769817698276983769847698576986769877698876989769907699176992769937699476995769967699776998769997700077001770027700377004770057700677007770087700977010770117701277013770147701577016770177701877019770207702177022770237702477025770267702777028770297703077031770327703377034770357703677037770387703977040770417704277043770447704577046770477704877049770507705177052770537705477055770567705777058770597706077061770627706377064770657706677067770687706977070770717707277073770747707577076770777707877079770807708177082770837708477085770867708777088770897709077091770927709377094770957709677097770987709977100771017710277103771047710577106771077710877109771107711177112771137711477115771167711777118771197712077121771227712377124771257712677127771287712977130771317713277133771347713577136771377713877139771407714177142771437714477145771467714777148771497715077151771527715377154771557715677157771587715977160771617716277163771647716577166771677716877169771707717177172771737717477175771767717777178771797718077181771827718377184771857718677187771887718977190771917719277193771947719577196771977719877199772007720177202772037720477205772067720777208772097721077211772127721377214772157721677217772187721977220772217722277223772247722577226772277722877229772307723177232772337723477235772367723777238772397724077241772427724377244772457724677247772487724977250772517725277253772547725577256772577725877259772607726177262772637726477265772667726777268772697727077271772727727377274772757727677277772787727977280772817728277283772847728577286772877728877289772907729177292772937729477295772967729777298772997730077301773027730377304773057730677307773087730977310773117731277313773147731577316773177731877319773207732177322773237732477325773267732777328773297733077331773327733377334773357733677337773387733977340773417734277343773447734577346773477734877349773507735177352773537735477355773567735777358773597736077361773627736377364773657736677367773687736977370773717737277373773747737577376773777737877379773807738177382773837738477385773867738777388773897739077391773927739377394773957739677397773987739977400774017740277403774047740577406774077740877409774107741177412774137741477415774167741777418774197742077421774227742377424774257742677427774287742977430774317743277433774347743577436774377743877439774407744177442774437744477445774467744777448774497745077451774527745377454774557745677457774587745977460774617746277463774647746577466774677746877469774707747177472774737747477475774767747777478774797748077481774827748377484774857748677487774887748977490774917749277493774947749577496774977749877499775007750177502775037750477505775067750777508775097751077511775127751377514775157751677517775187751977520775217752277523775247752577526775277752877529775307753177532775337753477535775367753777538775397754077541775427754377544775457754677547775487754977550775517755277553775547755577556775577755877559775607756177562775637756477565775667756777568775697757077571775727757377574775757757677577775787757977580775817758277583775847758577586775877758877589775907759177592775937759477595775967759777598775997760077601776027760377604776057760677607776087760977610776117761277613776147761577616776177761877619776207762177622776237762477625776267762777628776297763077631776327763377634776357763677637776387763977640776417764277643776447764577646776477764877649776507765177652776537765477655776567765777658776597766077661776627766377664776657766677667776687766977670776717767277673776747767577676776777767877679776807768177682776837768477685776867768777688776897769077691776927769377694776957769677697776987769977700777017770277703777047770577706777077770877709777107771177712777137771477715777167771777718777197772077721777227772377724777257772677727777287772977730777317773277733777347773577736777377773877739777407774177742777437774477745777467774777748777497775077751777527775377754777557775677757777587775977760777617776277763777647776577766777677776877769777707777177772777737777477775777767777777778777797778077781777827778377784777857778677787777887778977790777917779277793777947779577796777977779877799778007780177802778037780477805778067780777808778097781077811778127781377814778157781677817778187781977820778217782277823778247782577826778277782877829778307783177832778337783477835778367783777838778397784077841778427784377844778457784677847778487784977850778517785277853778547785577856778577785877859778607786177862778637786477865778667786777868778697787077871778727787377874778757787677877778787787977880778817788277883778847788577886778877788877889778907789177892778937789477895778967789777898778997790077901779027790377904779057790677907779087790977910779117791277913779147791577916779177791877919779207792177922779237792477925779267792777928779297793077931779327793377934779357793677937779387793977940779417794277943779447794577946779477794877949779507795177952779537795477955779567795777958779597796077961779627796377964779657796677967779687796977970779717797277973779747797577976779777797877979779807798177982779837798477985779867798777988779897799077991779927799377994779957799677997779987799978000780017800278003780047800578006780077800878009780107801178012780137801478015780167801778018780197802078021780227802378024780257802678027780287802978030780317803278033780347803578036780377803878039780407804178042780437804478045780467804778048780497805078051780527805378054780557805678057780587805978060780617806278063780647806578066780677806878069780707807178072780737807478075780767807778078780797808078081780827808378084780857808678087780887808978090780917809278093780947809578096780977809878099781007810178102781037810478105781067810778108781097811078111781127811378114781157811678117781187811978120781217812278123781247812578126781277812878129781307813178132781337813478135781367813778138781397814078141781427814378144781457814678147781487814978150781517815278153781547815578156781577815878159781607816178162781637816478165781667816778168781697817078171781727817378174781757817678177781787817978180781817818278183781847818578186781877818878189781907819178192781937819478195781967819778198781997820078201782027820378204782057820678207782087820978210782117821278213782147821578216782177821878219782207822178222782237822478225782267822778228782297823078231782327823378234782357823678237782387823978240782417824278243782447824578246782477824878249782507825178252782537825478255782567825778258782597826078261782627826378264782657826678267782687826978270782717827278273782747827578276782777827878279782807828178282782837828478285782867828778288782897829078291782927829378294782957829678297782987829978300783017830278303783047830578306783077830878309783107831178312783137831478315783167831778318783197832078321783227832378324783257832678327783287832978330783317833278333783347833578336783377833878339783407834178342783437834478345783467834778348783497835078351783527835378354783557835678357783587835978360783617836278363783647836578366783677836878369783707837178372783737837478375783767837778378783797838078381783827838378384783857838678387783887838978390783917839278393783947839578396783977839878399784007840178402784037840478405784067840778408784097841078411784127841378414784157841678417784187841978420784217842278423784247842578426784277842878429784307843178432784337843478435784367843778438784397844078441784427844378444784457844678447784487844978450784517845278453784547845578456784577845878459784607846178462784637846478465784667846778468784697847078471784727847378474784757847678477784787847978480784817848278483784847848578486784877848878489784907849178492784937849478495784967849778498784997850078501785027850378504785057850678507785087850978510785117851278513785147851578516785177851878519785207852178522785237852478525785267852778528785297853078531785327853378534785357853678537785387853978540785417854278543785447854578546785477854878549785507855178552785537855478555785567855778558785597856078561785627856378564785657856678567785687856978570785717857278573785747857578576785777857878579785807858178582785837858478585785867858778588785897859078591785927859378594785957859678597785987859978600786017860278603786047860578606786077860878609786107861178612786137861478615786167861778618786197862078621786227862378624786257862678627786287862978630786317863278633786347863578636786377863878639786407864178642786437864478645786467864778648786497865078651786527865378654786557865678657786587865978660786617866278663786647866578666786677866878669786707867178672786737867478675786767867778678786797868078681786827868378684786857868678687786887868978690786917869278693786947869578696786977869878699787007870178702787037870478705787067870778708787097871078711787127871378714787157871678717787187871978720787217872278723787247872578726787277872878729787307873178732787337873478735787367873778738787397874078741787427874378744787457874678747787487874978750787517875278753787547875578756787577875878759787607876178762787637876478765787667876778768787697877078771787727877378774787757877678777787787877978780787817878278783787847878578786787877878878789787907879178792787937879478795787967879778798787997880078801788027880378804788057880678807788087880978810788117881278813788147881578816788177881878819788207882178822788237882478825788267882778828788297883078831788327883378834788357883678837788387883978840788417884278843788447884578846788477884878849788507885178852788537885478855788567885778858788597886078861788627886378864788657886678867788687886978870788717887278873788747887578876788777887878879788807888178882788837888478885788867888778888788897889078891788927889378894788957889678897788987889978900789017890278903789047890578906789077890878909789107891178912789137891478915789167891778918789197892078921789227892378924789257892678927789287892978930789317893278933789347893578936789377893878939789407894178942789437894478945789467894778948789497895078951789527895378954789557895678957789587895978960789617896278963789647896578966789677896878969789707897178972789737897478975789767897778978789797898078981789827898378984789857898678987789887898978990789917899278993789947899578996789977899878999790007900179002790037900479005790067900779008790097901079011790127901379014790157901679017790187901979020790217902279023790247902579026790277902879029790307903179032790337903479035790367903779038790397904079041790427904379044790457904679047790487904979050790517905279053790547905579056790577905879059790607906179062790637906479065790667906779068790697907079071790727907379074790757907679077790787907979080790817908279083790847908579086790877908879089790907909179092790937909479095790967909779098790997910079101791027910379104791057910679107791087910979110791117911279113791147911579116791177911879119791207912179122791237912479125791267912779128791297913079131791327913379134791357913679137791387913979140791417914279143791447914579146791477914879149791507915179152791537915479155791567915779158791597916079161791627916379164791657916679167791687916979170791717917279173791747917579176791777917879179791807918179182791837918479185791867918779188791897919079191791927919379194791957919679197791987919979200792017920279203792047920579206792077920879209792107921179212792137921479215792167921779218792197922079221792227922379224792257922679227792287922979230792317923279233792347923579236792377923879239792407924179242792437924479245792467924779248792497925079251792527925379254792557925679257792587925979260792617926279263792647926579266792677926879269792707927179272792737927479275792767927779278792797928079281792827928379284792857928679287792887928979290792917929279293792947929579296792977929879299793007930179302793037930479305793067930779308793097931079311793127931379314793157931679317793187931979320793217932279323793247932579326793277932879329793307933179332793337933479335793367933779338793397934079341793427934379344793457934679347793487934979350793517935279353793547935579356793577935879359793607936179362793637936479365793667936779368793697937079371793727937379374793757937679377793787937979380793817938279383793847938579386793877938879389793907939179392793937939479395793967939779398793997940079401794027940379404794057940679407794087940979410794117941279413794147941579416794177941879419794207942179422794237942479425794267942779428794297943079431794327943379434794357943679437794387943979440794417944279443794447944579446794477944879449794507945179452794537945479455794567945779458794597946079461794627946379464794657946679467794687946979470794717947279473794747947579476794777947879479794807948179482794837948479485794867948779488794897949079491794927949379494794957949679497794987949979500795017950279503795047950579506795077950879509795107951179512795137951479515795167951779518795197952079521795227952379524795257952679527795287952979530795317953279533795347953579536795377953879539795407954179542795437954479545795467954779548795497955079551795527955379554795557955679557795587955979560795617956279563795647956579566795677956879569795707957179572795737957479575795767957779578795797958079581795827958379584795857958679587795887958979590795917959279593795947959579596795977959879599796007960179602796037960479605796067960779608796097961079611796127961379614796157961679617796187961979620796217962279623796247962579626796277962879629796307963179632796337963479635796367963779638796397964079641796427964379644796457964679647796487964979650796517965279653796547965579656796577965879659796607966179662796637966479665796667966779668796697967079671796727967379674796757967679677796787967979680796817968279683796847968579686796877968879689796907969179692796937969479695796967969779698796997970079701797027970379704797057970679707797087970979710797117971279713797147971579716797177971879719797207972179722797237972479725797267972779728797297973079731797327973379734797357973679737797387973979740797417974279743797447974579746797477974879749797507975179752797537975479755797567975779758797597976079761797627976379764797657976679767797687976979770797717977279773797747977579776797777977879779797807978179782797837978479785797867978779788797897979079791797927979379794797957979679797797987979979800798017980279803798047980579806798077980879809798107981179812798137981479815798167981779818798197982079821798227982379824798257982679827798287982979830798317983279833798347983579836798377983879839798407984179842798437984479845798467984779848798497985079851798527985379854798557985679857798587985979860798617986279863798647986579866798677986879869798707987179872798737987479875798767987779878798797988079881798827988379884798857988679887798887988979890798917989279893798947989579896798977989879899799007990179902799037990479905799067990779908799097991079911799127991379914799157991679917799187991979920799217992279923799247992579926799277992879929799307993179932799337993479935799367993779938799397994079941799427994379944799457994679947799487994979950799517995279953799547995579956799577995879959799607996179962799637996479965799667996779968799697997079971799727997379974799757997679977799787997979980799817998279983799847998579986799877998879989799907999179992799937999479995799967999779998799998000080001800028000380004800058000680007800088000980010800118001280013800148001580016800178001880019800208002180022800238002480025800268002780028800298003080031800328003380034800358003680037800388003980040800418004280043800448004580046800478004880049800508005180052800538005480055800568005780058800598006080061800628006380064800658006680067800688006980070800718007280073800748007580076800778007880079800808008180082800838008480085800868008780088800898009080091800928009380094800958009680097800988009980100801018010280103801048010580106801078010880109801108011180112801138011480115801168011780118801198012080121801228012380124801258012680127801288012980130801318013280133801348013580136801378013880139801408014180142801438014480145801468014780148801498015080151801528015380154801558015680157801588015980160801618016280163801648016580166801678016880169801708017180172801738017480175801768017780178801798018080181801828018380184801858018680187801888018980190801918019280193801948019580196801978019880199802008020180202802038020480205802068020780208802098021080211802128021380214802158021680217802188021980220802218022280223802248022580226802278022880229802308023180232802338023480235802368023780238802398024080241802428024380244802458024680247802488024980250802518025280253802548025580256802578025880259802608026180262802638026480265802668026780268802698027080271802728027380274802758027680277802788027980280802818028280283802848028580286802878028880289802908029180292802938029480295802968029780298802998030080301803028030380304803058030680307803088030980310803118031280313803148031580316803178031880319803208032180322803238032480325803268032780328803298033080331803328033380334803358033680337803388033980340803418034280343803448034580346803478034880349803508035180352803538035480355803568035780358803598036080361803628036380364803658036680367803688036980370803718037280373803748037580376803778037880379803808038180382803838038480385803868038780388803898039080391803928039380394803958039680397803988039980400804018040280403804048040580406804078040880409804108041180412804138041480415804168041780418804198042080421804228042380424804258042680427804288042980430804318043280433804348043580436804378043880439804408044180442804438044480445804468044780448804498045080451804528045380454804558045680457804588045980460804618046280463804648046580466804678046880469804708047180472804738047480475804768047780478804798048080481804828048380484804858048680487804888048980490804918049280493804948049580496804978049880499805008050180502805038050480505805068050780508805098051080511805128051380514805158051680517805188051980520805218052280523805248052580526805278052880529805308053180532805338053480535805368053780538805398054080541805428054380544805458054680547805488054980550805518055280553805548055580556805578055880559805608056180562805638056480565805668056780568805698057080571805728057380574805758057680577805788057980580805818058280583805848058580586805878058880589805908059180592805938059480595805968059780598805998060080601806028060380604806058060680607806088060980610806118061280613806148061580616806178061880619806208062180622806238062480625806268062780628806298063080631806328063380634806358063680637806388063980640806418064280643806448064580646806478064880649806508065180652806538065480655806568065780658806598066080661806628066380664806658066680667806688066980670806718067280673806748067580676806778067880679806808068180682806838068480685806868068780688806898069080691806928069380694806958069680697806988069980700807018070280703807048070580706807078070880709807108071180712807138071480715807168071780718807198072080721807228072380724807258072680727807288072980730807318073280733807348073580736807378073880739807408074180742807438074480745807468074780748807498075080751807528075380754807558075680757807588075980760807618076280763807648076580766807678076880769807708077180772807738077480775807768077780778807798078080781807828078380784807858078680787807888078980790807918079280793807948079580796807978079880799808008080180802808038080480805808068080780808808098081080811808128081380814808158081680817808188081980820808218082280823808248082580826808278082880829808308083180832808338083480835808368083780838808398084080841808428084380844808458084680847808488084980850808518085280853808548085580856808578085880859808608086180862808638086480865808668086780868808698087080871808728087380874808758087680877808788087980880808818088280883808848088580886808878088880889808908089180892808938089480895808968089780898808998090080901809028090380904809058090680907809088090980910809118091280913809148091580916809178091880919809208092180922809238092480925809268092780928809298093080931809328093380934809358093680937809388093980940809418094280943809448094580946809478094880949809508095180952809538095480955809568095780958809598096080961809628096380964809658096680967809688096980970809718097280973809748097580976809778097880979809808098180982809838098480985809868098780988809898099080991809928099380994809958099680997809988099981000810018100281003810048100581006810078100881009810108101181012810138101481015810168101781018810198102081021810228102381024810258102681027810288102981030810318103281033810348103581036810378103881039810408104181042810438104481045810468104781048810498105081051810528105381054810558105681057810588105981060810618106281063810648106581066810678106881069810708107181072810738107481075810768107781078810798108081081810828108381084810858108681087810888108981090810918109281093810948109581096810978109881099811008110181102811038110481105811068110781108811098111081111811128111381114811158111681117811188111981120811218112281123811248112581126811278112881129811308113181132811338113481135811368113781138811398114081141811428114381144811458114681147811488114981150811518115281153811548115581156811578115881159811608116181162811638116481165811668116781168811698117081171811728117381174811758117681177811788117981180811818118281183811848118581186811878118881189811908119181192811938119481195811968119781198811998120081201812028120381204812058120681207812088120981210812118121281213812148121581216812178121881219812208122181222812238122481225812268122781228812298123081231812328123381234812358123681237812388123981240812418124281243812448124581246812478124881249812508125181252812538125481255812568125781258812598126081261812628126381264812658126681267812688126981270812718127281273812748127581276812778127881279812808128181282812838128481285812868128781288812898129081291812928129381294812958129681297812988129981300813018130281303813048130581306813078130881309813108131181312813138131481315813168131781318813198132081321813228132381324813258132681327813288132981330813318133281333813348133581336813378133881339813408134181342813438134481345813468134781348813498135081351813528135381354813558135681357813588135981360813618136281363813648136581366813678136881369813708137181372813738137481375813768137781378813798138081381813828138381384813858138681387813888138981390813918139281393813948139581396813978139881399814008140181402814038140481405814068140781408814098141081411814128141381414814158141681417814188141981420814218142281423814248142581426814278142881429814308143181432814338143481435814368143781438814398144081441814428144381444814458144681447814488144981450814518145281453814548145581456814578145881459814608146181462814638146481465814668146781468814698147081471814728147381474814758147681477814788147981480814818148281483814848148581486814878148881489814908149181492814938149481495814968149781498814998150081501815028150381504815058150681507815088150981510815118151281513815148151581516815178151881519815208152181522815238152481525815268152781528815298153081531815328153381534815358153681537815388153981540815418154281543815448154581546815478154881549815508155181552815538155481555815568155781558815598156081561815628156381564815658156681567815688156981570815718157281573815748157581576815778157881579815808158181582815838158481585815868158781588815898159081591815928159381594815958159681597815988159981600816018160281603816048160581606816078160881609816108161181612816138161481615816168161781618816198162081621816228162381624816258162681627816288162981630816318163281633816348163581636816378163881639816408164181642816438164481645816468164781648816498165081651816528165381654816558165681657816588165981660816618166281663816648166581666816678166881669816708167181672816738167481675816768167781678816798168081681816828168381684816858168681687816888168981690816918169281693816948169581696816978169881699817008170181702817038170481705817068170781708817098171081711817128171381714817158171681717817188171981720817218172281723817248172581726817278172881729817308173181732817338173481735817368173781738817398174081741817428174381744817458174681747817488174981750817518175281753817548175581756817578175881759817608176181762817638176481765817668176781768817698177081771817728177381774817758177681777817788177981780817818178281783817848178581786817878178881789817908179181792817938179481795817968179781798817998180081801818028180381804818058180681807818088180981810818118181281813818148181581816818178181881819818208182181822818238182481825818268182781828818298183081831818328183381834818358183681837818388183981840818418184281843818448184581846818478184881849818508185181852818538185481855818568185781858818598186081861818628186381864818658186681867818688186981870818718187281873818748187581876818778187881879818808188181882818838188481885818868188781888818898189081891818928189381894818958189681897818988189981900819018190281903819048190581906819078190881909819108191181912819138191481915819168191781918819198192081921819228192381924819258192681927819288192981930819318193281933819348193581936819378193881939819408194181942819438194481945819468194781948819498195081951819528195381954819558195681957819588195981960819618196281963819648196581966819678196881969819708197181972819738197481975819768197781978819798198081981819828198381984819858198681987819888198981990819918199281993819948199581996819978199881999820008200182002820038200482005820068200782008820098201082011820128201382014820158201682017820188201982020820218202282023820248202582026820278202882029820308203182032820338203482035820368203782038820398204082041820428204382044820458204682047820488204982050820518205282053820548205582056820578205882059820608206182062820638206482065820668206782068820698207082071820728207382074820758207682077820788207982080820818208282083820848208582086820878208882089820908209182092820938209482095820968209782098820998210082101821028210382104821058210682107821088210982110821118211282113821148211582116821178211882119821208212182122821238212482125821268212782128821298213082131821328213382134821358213682137821388213982140821418214282143821448214582146821478214882149821508215182152821538215482155821568215782158821598216082161821628216382164821658216682167821688216982170821718217282173821748217582176821778217882179821808218182182821838218482185821868218782188821898219082191821928219382194821958219682197821988219982200822018220282203822048220582206822078220882209822108221182212822138221482215822168221782218822198222082221822228222382224822258222682227822288222982230822318223282233822348223582236822378223882239822408224182242822438224482245822468224782248822498225082251822528225382254822558225682257822588225982260822618226282263822648226582266822678226882269822708227182272822738227482275822768227782278822798228082281822828228382284822858228682287822888228982290822918229282293822948229582296822978229882299823008230182302823038230482305823068230782308823098231082311823128231382314823158231682317823188231982320823218232282323823248232582326823278232882329823308233182332823338233482335823368233782338823398234082341823428234382344823458234682347823488234982350823518235282353823548235582356823578235882359823608236182362823638236482365823668236782368823698237082371823728237382374823758237682377823788237982380823818238282383823848238582386823878238882389823908239182392823938239482395823968239782398823998240082401824028240382404824058240682407824088240982410824118241282413824148241582416824178241882419824208242182422824238242482425824268242782428824298243082431824328243382434824358243682437824388243982440824418244282443824448244582446824478244882449824508245182452824538245482455824568245782458824598246082461824628246382464824658246682467824688246982470824718247282473824748247582476824778247882479824808248182482824838248482485824868248782488824898249082491824928249382494824958249682497824988249982500825018250282503825048250582506825078250882509825108251182512825138251482515825168251782518825198252082521825228252382524825258252682527825288252982530825318253282533825348253582536825378253882539825408254182542825438254482545825468254782548825498255082551825528255382554825558255682557825588255982560825618256282563825648256582566825678256882569825708257182572825738257482575825768257782578825798258082581825828258382584825858258682587825888258982590825918259282593825948259582596825978259882599826008260182602826038260482605826068260782608826098261082611826128261382614826158261682617826188261982620826218262282623826248262582626826278262882629826308263182632826338263482635826368263782638826398264082641826428264382644826458264682647826488264982650826518265282653826548265582656826578265882659826608266182662826638266482665826668266782668826698267082671826728267382674826758267682677826788267982680826818268282683826848268582686826878268882689826908269182692826938269482695826968269782698826998270082701827028270382704827058270682707827088270982710827118271282713827148271582716827178271882719827208272182722827238272482725827268272782728827298273082731827328273382734827358273682737827388273982740827418274282743827448274582746827478274882749827508275182752827538275482755827568275782758827598276082761827628276382764827658276682767827688276982770827718277282773827748277582776827778277882779827808278182782827838278482785827868278782788827898279082791827928279382794827958279682797827988279982800828018280282803828048280582806828078280882809828108281182812828138281482815828168281782818828198282082821828228282382824828258282682827828288282982830828318283282833828348283582836828378283882839828408284182842828438284482845828468284782848828498285082851828528285382854828558285682857828588285982860828618286282863828648286582866828678286882869828708287182872828738287482875828768287782878828798288082881828828288382884828858288682887828888288982890828918289282893828948289582896828978289882899829008290182902829038290482905829068290782908829098291082911829128291382914829158291682917829188291982920829218292282923829248292582926829278292882929829308293182932829338293482935829368293782938829398294082941829428294382944829458294682947829488294982950829518295282953829548295582956829578295882959829608296182962829638296482965829668296782968829698297082971829728297382974829758297682977829788297982980829818298282983829848298582986829878298882989829908299182992829938299482995829968299782998829998300083001830028300383004830058300683007830088300983010830118301283013830148301583016830178301883019830208302183022830238302483025830268302783028830298303083031830328303383034830358303683037830388303983040830418304283043830448304583046830478304883049830508305183052830538305483055830568305783058830598306083061830628306383064830658306683067830688306983070830718307283073830748307583076830778307883079830808308183082830838308483085830868308783088830898309083091830928309383094830958309683097830988309983100831018310283103831048310583106831078310883109831108311183112831138311483115831168311783118831198312083121831228312383124831258312683127831288312983130831318313283133831348313583136831378313883139831408314183142831438314483145831468314783148831498315083151831528315383154831558315683157831588315983160831618316283163831648316583166831678316883169831708317183172831738317483175831768317783178831798318083181831828318383184831858318683187831888318983190831918319283193831948319583196831978319883199832008320183202832038320483205832068320783208832098321083211832128321383214832158321683217832188321983220832218322283223832248322583226832278322883229832308323183232832338323483235832368323783238832398324083241832428324383244832458324683247832488324983250832518325283253832548325583256832578325883259832608326183262832638326483265832668326783268832698327083271832728327383274832758327683277832788327983280832818328283283832848328583286832878328883289832908329183292832938329483295832968329783298832998330083301833028330383304833058330683307833088330983310833118331283313833148331583316833178331883319833208332183322833238332483325833268332783328833298333083331833328333383334833358333683337833388333983340833418334283343833448334583346833478334883349833508335183352833538335483355833568335783358833598336083361833628336383364833658336683367833688336983370833718337283373833748337583376833778337883379833808338183382833838338483385833868338783388833898339083391833928339383394833958339683397833988339983400834018340283403834048340583406834078340883409834108341183412834138341483415834168341783418834198342083421834228342383424834258342683427834288342983430834318343283433834348343583436834378343883439834408344183442834438344483445834468344783448834498345083451834528345383454834558345683457834588345983460834618346283463834648346583466834678346883469834708347183472834738347483475834768347783478834798348083481834828348383484834858348683487834888348983490834918349283493834948349583496834978349883499835008350183502835038350483505835068350783508835098351083511835128351383514835158351683517835188351983520835218352283523835248352583526835278352883529835308353183532835338353483535835368353783538835398354083541835428354383544835458354683547835488354983550835518355283553835548355583556835578355883559835608356183562835638356483565835668356783568835698357083571835728357383574835758357683577835788357983580835818358283583835848358583586835878358883589835908359183592835938359483595835968359783598835998360083601836028360383604836058360683607836088360983610836118361283613836148361583616836178361883619836208362183622836238362483625836268362783628836298363083631836328363383634836358363683637836388363983640836418364283643836448364583646836478364883649836508365183652836538365483655836568365783658836598366083661836628366383664836658366683667836688366983670836718367283673836748367583676836778367883679836808368183682836838368483685836868368783688836898369083691836928369383694836958369683697836988369983700837018370283703837048370583706837078370883709837108371183712837138371483715837168371783718837198372083721837228372383724837258372683727837288372983730837318373283733837348373583736837378373883739837408374183742837438374483745837468374783748837498375083751837528375383754837558375683757837588375983760837618376283763837648376583766837678376883769837708377183772837738377483775837768377783778837798378083781837828378383784837858378683787837888378983790837918379283793837948379583796837978379883799838008380183802838038380483805838068380783808838098381083811838128381383814838158381683817838188381983820838218382283823838248382583826838278382883829838308383183832838338383483835838368383783838838398384083841838428384383844838458384683847838488384983850838518385283853838548385583856838578385883859838608386183862838638386483865838668386783868838698387083871838728387383874838758387683877838788387983880838818388283883838848388583886838878388883889838908389183892838938389483895838968389783898838998390083901839028390383904839058390683907839088390983910839118391283913839148391583916839178391883919839208392183922839238392483925839268392783928839298393083931839328393383934839358393683937839388393983940839418394283943839448394583946839478394883949839508395183952839538395483955839568395783958839598396083961839628396383964839658396683967839688396983970839718397283973839748397583976839778397883979839808398183982839838398483985839868398783988839898399083991839928399383994839958399683997839988399984000840018400284003840048400584006840078400884009840108401184012840138401484015840168401784018840198402084021840228402384024840258402684027840288402984030840318403284033840348403584036840378403884039840408404184042840438404484045840468404784048840498405084051840528405384054840558405684057840588405984060840618406284063840648406584066840678406884069840708407184072840738407484075840768407784078840798408084081840828408384084840858408684087840888408984090840918409284093840948409584096840978409884099841008410184102841038410484105841068410784108841098411084111841128411384114841158411684117841188411984120841218412284123841248412584126841278412884129841308413184132841338413484135841368413784138841398414084141841428414384144841458414684147841488414984150841518415284153841548415584156841578415884159841608416184162841638416484165841668416784168841698417084171841728417384174841758417684177841788417984180841818418284183841848418584186841878418884189841908419184192841938419484195841968419784198841998420084201842028420384204842058420684207842088420984210842118421284213842148421584216842178421884219842208422184222842238422484225842268422784228842298423084231842328423384234842358423684237842388423984240842418424284243842448424584246842478424884249842508425184252842538425484255842568425784258842598426084261842628426384264842658426684267842688426984270842718427284273842748427584276842778427884279842808428184282842838428484285842868428784288842898429084291842928429384294842958429684297842988429984300843018430284303843048430584306843078430884309843108431184312843138431484315843168431784318843198432084321843228432384324843258432684327843288432984330843318433284333843348433584336843378433884339843408434184342843438434484345843468434784348843498435084351843528435384354843558435684357843588435984360843618436284363843648436584366843678436884369843708437184372843738437484375843768437784378843798438084381843828438384384843858438684387843888438984390843918439284393843948439584396843978439884399844008440184402844038440484405844068440784408844098441084411844128441384414844158441684417844188441984420844218442284423844248442584426844278442884429844308443184432844338443484435844368443784438844398444084441844428444384444844458444684447844488444984450844518445284453844548445584456844578445884459844608446184462844638446484465844668446784468844698447084471844728447384474844758447684477844788447984480844818448284483844848448584486844878448884489844908449184492844938449484495844968449784498844998450084501845028450384504845058450684507845088450984510845118451284513845148451584516845178451884519845208452184522845238452484525845268452784528845298453084531845328453384534845358453684537845388453984540845418454284543845448454584546845478454884549845508455184552845538455484555845568455784558845598456084561845628456384564845658456684567845688456984570845718457284573845748457584576845778457884579845808458184582845838458484585845868458784588845898459084591845928459384594845958459684597845988459984600846018460284603846048460584606846078460884609846108461184612846138461484615846168461784618846198462084621846228462384624846258462684627846288462984630846318463284633846348463584636846378463884639846408464184642846438464484645846468464784648846498465084651846528465384654846558465684657846588465984660846618466284663846648466584666846678466884669846708467184672846738467484675846768467784678846798468084681846828468384684846858468684687846888468984690846918469284693846948469584696846978469884699847008470184702847038470484705847068470784708847098471084711847128471384714847158471684717847188471984720847218472284723847248472584726847278472884729847308473184732847338473484735847368473784738847398474084741847428474384744847458474684747847488474984750847518475284753847548475584756847578475884759847608476184762847638476484765847668476784768847698477084771847728477384774847758477684777847788477984780847818478284783847848478584786847878478884789847908479184792847938479484795847968479784798847998480084801848028480384804848058480684807848088480984810848118481284813848148481584816848178481884819848208482184822848238482484825848268482784828848298483084831848328483384834848358483684837848388483984840848418484284843848448484584846848478484884849848508485184852848538485484855848568485784858848598486084861848628486384864848658486684867848688486984870848718487284873848748487584876848778487884879848808488184882848838488484885848868488784888848898489084891848928489384894848958489684897848988489984900849018490284903849048490584906849078490884909849108491184912849138491484915849168491784918849198492084921849228492384924849258492684927849288492984930849318493284933849348493584936849378493884939849408494184942849438494484945849468494784948849498495084951849528495384954849558495684957849588495984960849618496284963849648496584966849678496884969849708497184972849738497484975849768497784978849798498084981849828498384984849858498684987849888498984990849918499284993849948499584996849978499884999850008500185002850038500485005850068500785008850098501085011850128501385014850158501685017850188501985020850218502285023850248502585026850278502885029850308503185032850338503485035850368503785038850398504085041850428504385044850458504685047850488504985050850518505285053850548505585056850578505885059850608506185062850638506485065850668506785068850698507085071850728507385074850758507685077850788507985080850818508285083850848508585086850878508885089850908509185092850938509485095850968509785098850998510085101851028510385104851058510685107851088510985110851118511285113851148511585116851178511885119851208512185122851238512485125851268512785128851298513085131851328513385134851358513685137851388513985140851418514285143851448514585146851478514885149851508515185152851538515485155851568515785158851598516085161851628516385164851658516685167851688516985170851718517285173851748517585176851778517885179851808518185182851838518485185851868518785188851898519085191851928519385194851958519685197851988519985200852018520285203852048520585206852078520885209852108521185212852138521485215852168521785218852198522085221852228522385224852258522685227852288522985230852318523285233852348523585236852378523885239852408524185242852438524485245852468524785248852498525085251852528525385254852558525685257852588525985260852618526285263852648526585266852678526885269852708527185272852738527485275852768527785278852798528085281852828528385284852858528685287852888528985290852918529285293852948529585296852978529885299853008530185302853038530485305853068530785308853098531085311853128531385314853158531685317853188531985320853218532285323853248532585326853278532885329853308533185332853338533485335853368533785338853398534085341853428534385344853458534685347853488534985350853518535285353853548535585356853578535885359853608536185362853638536485365853668536785368853698537085371853728537385374853758537685377853788537985380853818538285383853848538585386853878538885389853908539185392853938539485395853968539785398853998540085401854028540385404854058540685407854088540985410854118541285413854148541585416854178541885419854208542185422854238542485425854268542785428854298543085431854328543385434854358543685437854388543985440854418544285443854448544585446854478544885449854508545185452854538545485455854568545785458854598546085461854628546385464854658546685467854688546985470854718547285473854748547585476854778547885479854808548185482854838548485485854868548785488854898549085491854928549385494854958549685497854988549985500855018550285503855048550585506855078550885509855108551185512855138551485515855168551785518855198552085521855228552385524855258552685527855288552985530855318553285533855348553585536855378553885539855408554185542855438554485545855468554785548855498555085551855528555385554855558555685557855588555985560855618556285563855648556585566855678556885569855708557185572855738557485575855768557785578855798558085581855828558385584855858558685587855888558985590855918559285593855948559585596855978559885599856008560185602856038560485605856068560785608856098561085611856128561385614856158561685617856188561985620856218562285623856248562585626856278562885629856308563185632856338563485635856368563785638856398564085641856428564385644856458564685647856488564985650856518565285653856548565585656856578565885659856608566185662856638566485665856668566785668856698567085671856728567385674856758567685677856788567985680856818568285683856848568585686856878568885689856908569185692856938569485695856968569785698856998570085701857028570385704857058570685707857088570985710857118571285713857148571585716857178571885719857208572185722857238572485725857268572785728857298573085731857328573385734857358573685737857388573985740857418574285743857448574585746857478574885749857508575185752857538575485755857568575785758857598576085761857628576385764857658576685767857688576985770857718577285773857748577585776857778577885779857808578185782857838578485785857868578785788857898579085791857928579385794857958579685797857988579985800858018580285803858048580585806858078580885809858108581185812858138581485815858168581785818858198582085821858228582385824858258582685827858288582985830858318583285833858348583585836858378583885839858408584185842858438584485845858468584785848858498585085851858528585385854858558585685857858588585985860858618586285863858648586585866858678586885869858708587185872858738587485875858768587785878858798588085881858828588385884858858588685887858888588985890858918589285893858948589585896858978589885899859008590185902859038590485905859068590785908859098591085911859128591385914859158591685917859188591985920859218592285923859248592585926859278592885929859308593185932859338593485935859368593785938859398594085941859428594385944859458594685947859488594985950859518595285953859548595585956859578595885959859608596185962859638596485965859668596785968859698597085971859728597385974859758597685977859788597985980859818598285983859848598585986859878598885989859908599185992859938599485995859968599785998859998600086001860028600386004860058600686007860088600986010860118601286013860148601586016860178601886019860208602186022860238602486025860268602786028860298603086031860328603386034860358603686037860388603986040860418604286043860448604586046860478604886049860508605186052860538605486055860568605786058860598606086061860628606386064860658606686067860688606986070860718607286073860748607586076860778607886079860808608186082860838608486085860868608786088860898609086091860928609386094860958609686097860988609986100861018610286103861048610586106861078610886109861108611186112861138611486115861168611786118861198612086121861228612386124861258612686127861288612986130861318613286133861348613586136861378613886139861408614186142861438614486145861468614786148861498615086151861528615386154861558615686157861588615986160861618616286163861648616586166861678616886169861708617186172861738617486175861768617786178861798618086181861828618386184861858618686187861888618986190861918619286193861948619586196861978619886199862008620186202862038620486205862068620786208862098621086211862128621386214862158621686217862188621986220862218622286223862248622586226862278622886229862308623186232862338623486235862368623786238862398624086241862428624386244862458624686247862488624986250862518625286253862548625586256862578625886259862608626186262862638626486265862668626786268862698627086271862728627386274862758627686277862788627986280862818628286283862848628586286862878628886289862908629186292862938629486295862968629786298862998630086301863028630386304863058630686307863088630986310863118631286313863148631586316863178631886319863208632186322863238632486325863268632786328863298633086331863328633386334863358633686337863388633986340863418634286343863448634586346863478634886349863508635186352863538635486355863568635786358863598636086361863628636386364863658636686367863688636986370863718637286373863748637586376863778637886379863808638186382863838638486385863868638786388863898639086391863928639386394863958639686397863988639986400864018640286403864048640586406864078640886409864108641186412864138641486415864168641786418864198642086421864228642386424864258642686427864288642986430864318643286433864348643586436864378643886439864408644186442864438644486445864468644786448864498645086451864528645386454864558645686457864588645986460864618646286463864648646586466864678646886469864708647186472864738647486475864768647786478864798648086481864828648386484864858648686487864888648986490864918649286493864948649586496864978649886499865008650186502865038650486505865068650786508865098651086511865128651386514865158651686517865188651986520865218652286523865248652586526865278652886529865308653186532865338653486535865368653786538865398654086541865428654386544865458654686547865488654986550865518655286553865548655586556865578655886559865608656186562865638656486565865668656786568865698657086571865728657386574865758657686577865788657986580865818658286583865848658586586865878658886589865908659186592865938659486595865968659786598865998660086601866028660386604866058660686607866088660986610866118661286613866148661586616866178661886619866208662186622866238662486625866268662786628866298663086631866328663386634866358663686637866388663986640866418664286643866448664586646866478664886649866508665186652866538665486655866568665786658866598666086661866628666386664866658666686667866688666986670866718667286673866748667586676866778667886679866808668186682866838668486685866868668786688866898669086691866928669386694866958669686697866988669986700867018670286703867048670586706867078670886709867108671186712867138671486715867168671786718867198672086721867228672386724867258672686727867288672986730867318673286733867348673586736867378673886739867408674186742867438674486745867468674786748867498675086751867528675386754867558675686757867588675986760867618676286763867648676586766867678676886769867708677186772867738677486775867768677786778867798678086781867828678386784867858678686787867888678986790867918679286793867948679586796867978679886799868008680186802868038680486805868068680786808868098681086811868128681386814868158681686817868188681986820868218682286823868248682586826868278682886829868308683186832868338683486835868368683786838868398684086841868428684386844868458684686847868488684986850868518685286853868548685586856868578685886859868608686186862868638686486865868668686786868868698687086871868728687386874868758687686877868788687986880868818688286883868848688586886868878688886889868908689186892868938689486895868968689786898868998690086901869028690386904869058690686907869088690986910869118691286913869148691586916869178691886919869208692186922869238692486925869268692786928869298693086931869328693386934869358693686937869388693986940869418694286943869448694586946869478694886949869508695186952869538695486955869568695786958869598696086961869628696386964869658696686967869688696986970869718697286973869748697586976869778697886979869808698186982869838698486985869868698786988869898699086991869928699386994869958699686997869988699987000870018700287003870048700587006870078700887009870108701187012870138701487015870168701787018870198702087021870228702387024870258702687027870288702987030870318703287033870348703587036870378703887039870408704187042870438704487045870468704787048870498705087051870528705387054870558705687057870588705987060870618706287063870648706587066870678706887069870708707187072870738707487075870768707787078870798708087081870828708387084870858708687087870888708987090870918709287093870948709587096870978709887099871008710187102871038710487105871068710787108871098711087111871128711387114871158711687117871188711987120871218712287123871248712587126871278712887129871308713187132871338713487135871368713787138871398714087141871428714387144871458714687147871488714987150871518715287153871548715587156871578715887159871608716187162871638716487165871668716787168871698717087171871728717387174871758717687177871788717987180871818718287183871848718587186871878718887189871908719187192871938719487195871968719787198871998720087201872028720387204872058720687207872088720987210872118721287213872148721587216872178721887219872208722187222872238722487225872268722787228872298723087231872328723387234872358723687237872388723987240872418724287243872448724587246872478724887249872508725187252872538725487255872568725787258872598726087261872628726387264872658726687267872688726987270872718727287273872748727587276872778727887279872808728187282872838728487285872868728787288872898729087291872928729387294872958729687297872988729987300873018730287303873048730587306873078730887309873108731187312873138731487315873168731787318873198732087321873228732387324873258732687327873288732987330873318733287333873348733587336873378733887339873408734187342873438734487345873468734787348873498735087351873528735387354873558735687357873588735987360873618736287363873648736587366873678736887369873708737187372873738737487375873768737787378873798738087381873828738387384873858738687387873888738987390873918739287393873948739587396873978739887399874008740187402874038740487405874068740787408874098741087411874128741387414874158741687417874188741987420874218742287423874248742587426874278742887429874308743187432874338743487435874368743787438874398744087441874428744387444874458744687447874488744987450874518745287453874548745587456874578745887459874608746187462874638746487465874668746787468874698747087471874728747387474874758747687477874788747987480874818748287483874848748587486874878748887489874908749187492874938749487495874968749787498874998750087501875028750387504875058750687507875088750987510875118751287513875148751587516875178751887519875208752187522875238752487525875268752787528875298753087531875328753387534875358753687537875388753987540875418754287543875448754587546875478754887549875508755187552875538755487555875568755787558875598756087561875628756387564875658756687567875688756987570875718757287573875748757587576875778757887579875808758187582875838758487585875868758787588875898759087591875928759387594875958759687597875988759987600876018760287603876048760587606876078760887609876108761187612876138761487615876168761787618876198762087621876228762387624876258762687627876288762987630876318763287633876348763587636876378763887639876408764187642876438764487645876468764787648876498765087651876528765387654876558765687657876588765987660876618766287663876648766587666876678766887669876708767187672876738767487675876768767787678876798768087681876828768387684876858768687687876888768987690876918769287693876948769587696876978769887699877008770187702877038770487705877068770787708877098771087711877128771387714877158771687717877188771987720877218772287723877248772587726877278772887729877308773187732877338773487735877368773787738877398774087741877428774387744877458774687747877488774987750877518775287753877548775587756877578775887759877608776187762877638776487765877668776787768877698777087771877728777387774877758777687777877788777987780877818778287783877848778587786877878778887789877908779187792877938779487795877968779787798877998780087801878028780387804878058780687807878088780987810878118781287813878148781587816878178781887819878208782187822878238782487825878268782787828878298783087831878328783387834878358783687837878388783987840878418784287843878448784587846878478784887849878508785187852878538785487855878568785787858878598786087861878628786387864878658786687867878688786987870878718787287873878748787587876878778787887879878808788187882878838788487885878868788787888878898789087891878928789387894878958789687897878988789987900879018790287903879048790587906879078790887909879108791187912879138791487915879168791787918879198792087921879228792387924879258792687927879288792987930879318793287933879348793587936879378793887939879408794187942879438794487945879468794787948879498795087951879528795387954879558795687957879588795987960879618796287963879648796587966879678796887969879708797187972879738797487975879768797787978879798798087981879828798387984879858798687987879888798987990879918799287993879948799587996879978799887999880008800188002880038800488005880068800788008880098801088011880128801388014880158801688017880188801988020880218802288023880248802588026880278802888029880308803188032880338803488035880368803788038880398804088041880428804388044880458804688047880488804988050880518805288053880548805588056880578805888059880608806188062880638806488065880668806788068880698807088071880728807388074880758807688077880788807988080880818808288083880848808588086880878808888089880908809188092880938809488095880968809788098880998810088101881028810388104881058810688107881088810988110881118811288113881148811588116881178811888119881208812188122881238812488125881268812788128881298813088131881328813388134881358813688137881388813988140881418814288143881448814588146881478814888149881508815188152881538815488155881568815788158881598816088161881628816388164881658816688167881688816988170881718817288173881748817588176881778817888179881808818188182881838818488185881868818788188881898819088191881928819388194881958819688197881988819988200882018820288203882048820588206882078820888209882108821188212882138821488215882168821788218882198822088221882228822388224882258822688227882288822988230882318823288233882348823588236882378823888239882408824188242882438824488245882468824788248882498825088251882528825388254882558825688257882588825988260882618826288263882648826588266882678826888269882708827188272882738827488275882768827788278882798828088281882828828388284882858828688287882888828988290882918829288293882948829588296882978829888299883008830188302883038830488305883068830788308883098831088311883128831388314883158831688317883188831988320883218832288323883248832588326883278832888329883308833188332883338833488335883368833788338883398834088341883428834388344883458834688347883488834988350883518835288353883548835588356883578835888359883608836188362883638836488365883668836788368883698837088371883728837388374883758837688377883788837988380883818838288383883848838588386883878838888389883908839188392883938839488395883968839788398883998840088401884028840388404884058840688407884088840988410884118841288413884148841588416884178841888419884208842188422884238842488425884268842788428884298843088431884328843388434884358843688437884388843988440884418844288443884448844588446884478844888449884508845188452884538845488455884568845788458884598846088461884628846388464884658846688467884688846988470884718847288473884748847588476884778847888479884808848188482884838848488485884868848788488884898849088491884928849388494884958849688497884988849988500885018850288503885048850588506885078850888509885108851188512885138851488515885168851788518885198852088521885228852388524885258852688527885288852988530885318853288533885348853588536885378853888539885408854188542885438854488545885468854788548885498855088551885528855388554885558855688557885588855988560885618856288563885648856588566885678856888569885708857188572885738857488575885768857788578885798858088581885828858388584885858858688587885888858988590885918859288593885948859588596885978859888599886008860188602886038860488605886068860788608886098861088611886128861388614886158861688617886188861988620886218862288623886248862588626886278862888629886308863188632886338863488635886368863788638886398864088641886428864388644886458864688647886488864988650886518865288653886548865588656886578865888659886608866188662886638866488665886668866788668886698867088671886728867388674886758867688677886788867988680886818868288683886848868588686886878868888689886908869188692886938869488695886968869788698886998870088701887028870388704887058870688707887088870988710887118871288713887148871588716887178871888719887208872188722887238872488725887268872788728887298873088731887328873388734887358873688737887388873988740887418874288743887448874588746887478874888749887508875188752887538875488755887568875788758887598876088761887628876388764887658876688767887688876988770887718877288773887748877588776887778877888779887808878188782887838878488785887868878788788887898879088791887928879388794887958879688797887988879988800888018880288803888048880588806888078880888809888108881188812888138881488815888168881788818888198882088821888228882388824888258882688827888288882988830888318883288833888348883588836888378883888839888408884188842888438884488845888468884788848888498885088851888528885388854888558885688857888588885988860888618886288863888648886588866888678886888869888708887188872888738887488875888768887788878888798888088881888828888388884888858888688887888888888988890888918889288893888948889588896888978889888899889008890188902889038890488905889068890788908889098891088911889128891388914889158891688917889188891988920889218892288923889248892588926889278892888929889308893188932889338893488935889368893788938889398894088941889428894388944889458894688947889488894988950889518895288953889548895588956889578895888959889608896188962889638896488965889668896788968889698897088971889728897388974889758897688977889788897988980889818898288983889848898588986889878898888989889908899188992889938899488995889968899788998889998900089001890028900389004890058900689007890088900989010890118901289013890148901589016890178901889019890208902189022890238902489025890268902789028890298903089031890328903389034890358903689037890388903989040890418904289043890448904589046890478904889049890508905189052890538905489055890568905789058890598906089061890628906389064890658906689067890688906989070890718907289073890748907589076890778907889079890808908189082890838908489085890868908789088890898909089091890928909389094890958909689097890988909989100891018910289103891048910589106891078910889109891108911189112891138911489115891168911789118891198912089121891228912389124891258912689127891288912989130891318913289133891348913589136891378913889139891408914189142891438914489145891468914789148891498915089151891528915389154891558915689157891588915989160891618916289163891648916589166891678916889169891708917189172891738917489175891768917789178891798918089181891828918389184891858918689187891888918989190891918919289193891948919589196891978919889199892008920189202892038920489205892068920789208892098921089211892128921389214892158921689217892188921989220892218922289223892248922589226892278922889229892308923189232892338923489235892368923789238892398924089241892428924389244892458924689247892488924989250892518925289253892548925589256892578925889259892608926189262892638926489265892668926789268892698927089271892728927389274892758927689277892788927989280892818928289283892848928589286892878928889289892908929189292892938929489295892968929789298892998930089301893028930389304893058930689307893088930989310893118931289313893148931589316893178931889319893208932189322893238932489325893268932789328893298933089331893328933389334893358933689337893388933989340893418934289343893448934589346893478934889349893508935189352893538935489355893568935789358893598936089361893628936389364893658936689367893688936989370893718937289373893748937589376893778937889379893808938189382893838938489385893868938789388893898939089391893928939389394893958939689397893988939989400894018940289403894048940589406894078940889409894108941189412894138941489415894168941789418894198942089421894228942389424894258942689427894288942989430894318943289433894348943589436894378943889439894408944189442894438944489445894468944789448894498945089451894528945389454894558945689457894588945989460894618946289463894648946589466894678946889469894708947189472894738947489475894768947789478894798948089481894828948389484894858948689487894888948989490894918949289493894948949589496894978949889499895008950189502895038950489505895068950789508895098951089511895128951389514895158951689517895188951989520895218952289523895248952589526895278952889529895308953189532895338953489535895368953789538895398954089541895428954389544895458954689547895488954989550895518955289553895548955589556895578955889559895608956189562895638956489565895668956789568895698957089571895728957389574895758957689577895788957989580895818958289583895848958589586895878958889589895908959189592895938959489595895968959789598895998960089601896028960389604896058960689607896088960989610896118961289613896148961589616896178961889619896208962189622896238962489625896268962789628896298963089631896328963389634896358963689637896388963989640896418964289643896448964589646896478964889649896508965189652896538965489655896568965789658896598966089661896628966389664896658966689667896688966989670896718967289673896748967589676896778967889679896808968189682896838968489685896868968789688896898969089691896928969389694896958969689697896988969989700897018970289703897048970589706897078970889709897108971189712897138971489715897168971789718897198972089721897228972389724897258972689727897288972989730897318973289733897348973589736897378973889739897408974189742897438974489745897468974789748897498975089751897528975389754897558975689757897588975989760897618976289763897648976589766897678976889769897708977189772897738977489775897768977789778897798978089781897828978389784897858978689787897888978989790897918979289793897948979589796897978979889799898008980189802898038980489805898068980789808898098981089811898128981389814898158981689817898188981989820898218982289823898248982589826898278982889829898308983189832898338983489835898368983789838898398984089841898428984389844898458984689847898488984989850898518985289853898548985589856898578985889859898608986189862898638986489865898668986789868898698987089871898728987389874898758987689877898788987989880898818988289883898848988589886898878988889889898908989189892898938989489895898968989789898898998990089901899028990389904899058990689907899088990989910899118991289913899148991589916899178991889919899208992189922899238992489925899268992789928899298993089931899328993389934899358993689937899388993989940899418994289943899448994589946899478994889949899508995189952899538995489955899568995789958899598996089961899628996389964899658996689967899688996989970899718997289973899748997589976899778997889979899808998189982899838998489985899868998789988899898999089991899928999389994899958999689997899988999990000900019000290003900049000590006900079000890009900109001190012900139001490015900169001790018900199002090021900229002390024900259002690027900289002990030900319003290033900349003590036900379003890039900409004190042900439004490045900469004790048900499005090051900529005390054900559005690057900589005990060900619006290063900649006590066900679006890069900709007190072900739007490075900769007790078900799008090081900829008390084900859008690087900889008990090900919009290093900949009590096900979009890099901009010190102901039010490105901069010790108901099011090111901129011390114901159011690117901189011990120901219012290123901249012590126901279012890129901309013190132901339013490135901369013790138901399014090141901429014390144901459014690147901489014990150901519015290153901549015590156901579015890159901609016190162901639016490165901669016790168901699017090171901729017390174901759017690177901789017990180901819018290183901849018590186901879018890189901909019190192901939019490195901969019790198901999020090201902029020390204902059020690207902089020990210902119021290213902149021590216902179021890219902209022190222902239022490225902269022790228902299023090231902329023390234902359023690237902389023990240902419024290243902449024590246902479024890249902509025190252902539025490255902569025790258902599026090261902629026390264902659026690267902689026990270902719027290273902749027590276902779027890279902809028190282902839028490285902869028790288902899029090291902929029390294902959029690297902989029990300903019030290303903049030590306903079030890309903109031190312903139031490315903169031790318903199032090321903229032390324903259032690327903289032990330903319033290333903349033590336903379033890339903409034190342903439034490345903469034790348903499035090351903529035390354903559035690357903589035990360903619036290363903649036590366903679036890369903709037190372903739037490375903769037790378903799038090381903829038390384903859038690387903889038990390903919039290393903949039590396903979039890399904009040190402904039040490405904069040790408904099041090411904129041390414904159041690417904189041990420904219042290423904249042590426904279042890429904309043190432904339043490435904369043790438904399044090441904429044390444904459044690447904489044990450904519045290453904549045590456904579045890459904609046190462904639046490465904669046790468904699047090471904729047390474904759047690477904789047990480904819048290483904849048590486904879048890489904909049190492904939049490495904969049790498904999050090501905029050390504905059050690507905089050990510905119051290513905149051590516905179051890519905209052190522905239052490525905269052790528905299053090531905329053390534905359053690537905389053990540905419054290543905449054590546905479054890549905509055190552905539055490555905569055790558905599056090561905629056390564905659056690567905689056990570905719057290573905749057590576905779057890579905809058190582905839058490585905869058790588905899059090591905929059390594905959059690597905989059990600906019060290603906049060590606906079060890609906109061190612906139061490615906169061790618906199062090621906229062390624906259062690627906289062990630906319063290633906349063590636906379063890639906409064190642906439064490645906469064790648906499065090651906529065390654906559065690657906589065990660906619066290663906649066590666906679066890669906709067190672906739067490675906769067790678906799068090681906829068390684906859068690687906889068990690906919069290693906949069590696906979069890699907009070190702907039070490705907069070790708907099071090711907129071390714907159071690717907189071990720907219072290723907249072590726907279072890729907309073190732907339073490735907369073790738907399074090741907429074390744907459074690747907489074990750907519075290753907549075590756907579075890759907609076190762907639076490765907669076790768907699077090771907729077390774907759077690777907789077990780907819078290783907849078590786907879078890789907909079190792907939079490795907969079790798907999080090801908029080390804908059080690807908089080990810908119081290813908149081590816908179081890819908209082190822908239082490825908269082790828908299083090831908329083390834908359083690837908389083990840908419084290843908449084590846908479084890849908509085190852908539085490855908569085790858908599086090861908629086390864908659086690867908689086990870908719087290873908749087590876908779087890879908809088190882908839088490885908869088790888908899089090891908929089390894908959089690897908989089990900909019090290903909049090590906909079090890909909109091190912909139091490915909169091790918909199092090921909229092390924909259092690927909289092990930909319093290933909349093590936909379093890939909409094190942909439094490945909469094790948909499095090951909529095390954909559095690957909589095990960909619096290963909649096590966909679096890969909709097190972909739097490975909769097790978909799098090981909829098390984909859098690987909889098990990909919099290993909949099590996909979099890999910009100191002910039100491005910069100791008910099101091011910129101391014910159101691017910189101991020910219102291023910249102591026910279102891029910309103191032910339103491035910369103791038910399104091041910429104391044910459104691047910489104991050910519105291053910549105591056910579105891059910609106191062910639106491065910669106791068910699107091071910729107391074910759107691077910789107991080910819108291083910849108591086910879108891089910909109191092910939109491095910969109791098910999110091101911029110391104911059110691107911089110991110911119111291113911149111591116911179111891119911209112191122911239112491125911269112791128911299113091131911329113391134911359113691137911389113991140911419114291143911449114591146911479114891149911509115191152911539115491155911569115791158911599116091161911629116391164911659116691167911689116991170911719117291173911749117591176911779117891179911809118191182911839118491185911869118791188911899119091191911929119391194911959119691197911989119991200912019120291203912049120591206912079120891209912109121191212912139121491215912169121791218912199122091221912229122391224912259122691227912289122991230912319123291233912349123591236912379123891239912409124191242912439124491245912469124791248912499125091251912529125391254912559125691257912589125991260912619126291263912649126591266912679126891269912709127191272912739127491275912769127791278912799128091281912829128391284912859128691287912889128991290912919129291293912949129591296912979129891299913009130191302913039130491305913069130791308913099131091311913129131391314913159131691317913189131991320913219132291323913249132591326913279132891329913309133191332913339133491335913369133791338913399134091341913429134391344913459134691347913489134991350913519135291353913549135591356913579135891359913609136191362913639136491365913669136791368913699137091371913729137391374913759137691377913789137991380913819138291383913849138591386913879138891389913909139191392913939139491395913969139791398913999140091401914029140391404914059140691407914089140991410914119141291413914149141591416914179141891419914209142191422914239142491425914269142791428914299143091431914329143391434914359143691437914389143991440914419144291443914449144591446914479144891449914509145191452914539145491455914569145791458914599146091461914629146391464914659146691467914689146991470914719147291473914749147591476914779147891479914809148191482914839148491485914869148791488914899149091491914929149391494914959149691497914989149991500915019150291503915049150591506915079150891509915109151191512915139151491515915169151791518915199152091521915229152391524915259152691527915289152991530915319153291533915349153591536915379153891539915409154191542915439154491545915469154791548915499155091551915529155391554915559155691557915589155991560915619156291563915649156591566915679156891569915709157191572915739157491575915769157791578915799158091581915829158391584915859158691587915889158991590915919159291593915949159591596915979159891599916009160191602916039160491605916069160791608916099161091611916129161391614916159161691617916189161991620916219162291623916249162591626916279162891629916309163191632916339163491635916369163791638916399164091641916429164391644916459164691647916489164991650916519165291653916549165591656916579165891659916609166191662916639166491665916669166791668916699167091671916729167391674916759167691677916789167991680916819168291683916849168591686916879168891689916909169191692916939169491695916969169791698916999170091701917029170391704917059170691707917089170991710917119171291713917149171591716917179171891719917209172191722917239172491725917269172791728917299173091731917329173391734917359173691737917389173991740917419174291743917449174591746917479174891749917509175191752917539175491755917569175791758917599176091761917629176391764917659176691767917689176991770917719177291773917749177591776917779177891779917809178191782917839178491785917869178791788917899179091791917929179391794917959179691797917989179991800918019180291803918049180591806918079180891809918109181191812918139181491815918169181791818918199182091821918229182391824918259182691827918289182991830918319183291833918349183591836918379183891839918409184191842918439184491845918469184791848918499185091851918529185391854918559185691857918589185991860918619186291863918649186591866918679186891869918709187191872918739187491875918769187791878918799188091881918829188391884918859188691887918889188991890918919189291893918949189591896918979189891899919009190191902919039190491905919069190791908919099191091911919129191391914919159191691917919189191991920919219192291923919249192591926919279192891929919309193191932919339193491935919369193791938919399194091941919429194391944919459194691947919489194991950919519195291953919549195591956919579195891959919609196191962919639196491965919669196791968919699197091971919729197391974919759197691977919789197991980919819198291983919849198591986919879198891989919909199191992919939199491995919969199791998919999200092001920029200392004920059200692007920089200992010920119201292013920149201592016920179201892019920209202192022920239202492025920269202792028920299203092031920329203392034920359203692037920389203992040920419204292043920449204592046920479204892049920509205192052920539205492055920569205792058920599206092061920629206392064920659206692067920689206992070920719207292073920749207592076920779207892079920809208192082920839208492085920869208792088920899209092091920929209392094920959209692097920989209992100921019210292103921049210592106921079210892109921109211192112921139211492115921169211792118921199212092121921229212392124921259212692127921289212992130921319213292133921349213592136921379213892139921409214192142921439214492145921469214792148921499215092151921529215392154921559215692157921589215992160921619216292163921649216592166921679216892169921709217192172921739217492175921769217792178921799218092181921829218392184921859218692187921889218992190921919219292193921949219592196921979219892199922009220192202922039220492205922069220792208922099221092211922129221392214922159221692217922189221992220922219222292223922249222592226922279222892229922309223192232922339223492235922369223792238922399224092241922429224392244922459224692247922489224992250922519225292253922549225592256922579225892259922609226192262922639226492265922669226792268922699227092271922729227392274922759227692277922789227992280922819228292283922849228592286922879228892289922909229192292922939229492295922969229792298922999230092301923029230392304923059230692307923089230992310923119231292313923149231592316923179231892319923209232192322923239232492325923269232792328923299233092331923329233392334923359233692337923389233992340923419234292343923449234592346923479234892349923509235192352923539235492355923569235792358923599236092361923629236392364923659236692367923689236992370923719237292373923749237592376923779237892379923809238192382923839238492385923869238792388923899239092391923929239392394923959239692397923989239992400924019240292403924049240592406924079240892409924109241192412924139241492415924169241792418924199242092421924229242392424924259242692427924289242992430924319243292433924349243592436924379243892439924409244192442924439244492445924469244792448924499245092451924529245392454924559245692457924589245992460924619246292463924649246592466924679246892469924709247192472924739247492475924769247792478924799248092481924829248392484924859248692487924889248992490924919249292493924949249592496924979249892499925009250192502925039250492505925069250792508925099251092511925129251392514925159251692517925189251992520925219252292523925249252592526925279252892529925309253192532925339253492535925369253792538925399254092541925429254392544925459254692547925489254992550925519255292553925549255592556925579255892559925609256192562925639256492565925669256792568925699257092571925729257392574925759257692577925789257992580925819258292583925849258592586925879258892589925909259192592925939259492595925969259792598925999260092601926029260392604926059260692607926089260992610926119261292613926149261592616926179261892619926209262192622926239262492625926269262792628926299263092631926329263392634926359263692637926389263992640926419264292643926449264592646926479264892649926509265192652926539265492655926569265792658926599266092661926629266392664926659266692667926689266992670926719267292673926749267592676926779267892679926809268192682926839268492685926869268792688926899269092691926929269392694926959269692697926989269992700927019270292703927049270592706927079270892709927109271192712927139271492715927169271792718927199272092721927229272392724927259272692727927289272992730927319273292733927349273592736927379273892739927409274192742927439274492745927469274792748927499275092751927529275392754927559275692757927589275992760927619276292763927649276592766927679276892769927709277192772927739277492775927769277792778927799278092781927829278392784927859278692787927889278992790927919279292793927949279592796927979279892799928009280192802928039280492805928069280792808928099281092811928129281392814928159281692817928189281992820928219282292823928249282592826928279282892829928309283192832928339283492835928369283792838928399284092841928429284392844928459284692847928489284992850928519285292853928549285592856928579285892859928609286192862928639286492865928669286792868928699287092871928729287392874928759287692877928789287992880928819288292883928849288592886928879288892889928909289192892928939289492895928969289792898928999290092901929029290392904929059290692907929089290992910929119291292913929149291592916929179291892919929209292192922929239292492925929269292792928929299293092931929329293392934929359293692937929389293992940929419294292943929449294592946929479294892949929509295192952929539295492955929569295792958929599296092961929629296392964929659296692967929689296992970929719297292973929749297592976929779297892979929809298192982929839298492985929869298792988929899299092991929929299392994929959299692997929989299993000930019300293003930049300593006930079300893009930109301193012930139301493015930169301793018930199302093021930229302393024930259302693027930289302993030930319303293033930349303593036930379303893039930409304193042930439304493045930469304793048930499305093051930529305393054930559305693057930589305993060930619306293063930649306593066930679306893069930709307193072930739307493075930769307793078930799308093081930829308393084930859308693087930889308993090930919309293093930949309593096930979309893099931009310193102931039310493105931069310793108931099311093111931129311393114931159311693117931189311993120931219312293123931249312593126931279312893129931309313193132931339313493135931369313793138931399314093141931429314393144931459314693147931489314993150931519315293153931549315593156931579315893159931609316193162931639316493165931669316793168931699317093171931729317393174931759317693177931789317993180931819318293183931849318593186931879318893189931909319193192931939319493195931969319793198931999320093201932029320393204932059320693207932089320993210932119321293213932149321593216932179321893219932209322193222932239322493225932269322793228932299323093231932329323393234932359323693237932389323993240932419324293243932449324593246932479324893249932509325193252932539325493255932569325793258932599326093261932629326393264932659326693267932689326993270932719327293273932749327593276932779327893279932809328193282932839328493285932869328793288932899329093291932929329393294932959329693297932989329993300933019330293303933049330593306933079330893309933109331193312933139331493315933169331793318933199332093321933229332393324933259332693327933289332993330933319333293333933349333593336933379333893339933409334193342933439334493345933469334793348933499335093351933529335393354933559335693357933589335993360933619336293363933649336593366933679336893369933709337193372933739337493375933769337793378933799338093381933829338393384933859338693387933889338993390933919339293393933949339593396933979339893399934009340193402934039340493405934069340793408934099341093411934129341393414934159341693417934189341993420934219342293423934249342593426934279342893429934309343193432934339343493435934369343793438934399344093441934429344393444934459344693447934489344993450934519345293453934549345593456934579345893459934609346193462934639346493465934669346793468934699347093471934729347393474934759347693477934789347993480934819348293483934849348593486934879348893489934909349193492934939349493495934969349793498934999350093501935029350393504935059350693507935089350993510935119351293513935149351593516935179351893519935209352193522935239352493525935269352793528935299353093531935329353393534935359353693537935389353993540935419354293543935449354593546935479354893549935509355193552935539355493555935569355793558935599356093561935629356393564935659356693567935689356993570935719357293573935749357593576935779357893579935809358193582935839358493585935869358793588935899359093591935929359393594935959359693597935989359993600936019360293603936049360593606936079360893609936109361193612936139361493615936169361793618936199362093621936229362393624936259362693627936289362993630936319363293633936349363593636936379363893639936409364193642936439364493645936469364793648936499365093651936529365393654936559365693657936589365993660936619366293663936649366593666936679366893669936709367193672936739367493675936769367793678936799368093681936829368393684936859368693687936889368993690936919369293693936949369593696936979369893699937009370193702937039370493705937069370793708937099371093711937129371393714937159371693717937189371993720937219372293723937249372593726937279372893729937309373193732937339373493735937369373793738937399374093741937429374393744937459374693747937489374993750937519375293753937549375593756937579375893759937609376193762937639376493765937669376793768937699377093771937729377393774937759377693777937789377993780937819378293783937849378593786937879378893789937909379193792937939379493795937969379793798937999380093801938029380393804938059380693807938089380993810938119381293813938149381593816938179381893819938209382193822938239382493825938269382793828938299383093831938329383393834938359383693837938389383993840938419384293843938449384593846938479384893849938509385193852938539385493855938569385793858938599386093861938629386393864938659386693867938689386993870938719387293873938749387593876938779387893879938809388193882938839388493885938869388793888938899389093891938929389393894938959389693897938989389993900939019390293903939049390593906939079390893909939109391193912939139391493915939169391793918939199392093921939229392393924939259392693927939289392993930939319393293933939349393593936939379393893939939409394193942939439394493945939469394793948939499395093951939529395393954939559395693957939589395993960939619396293963939649396593966939679396893969939709397193972939739397493975939769397793978939799398093981939829398393984939859398693987939889398993990939919399293993939949399593996939979399893999940009400194002940039400494005940069400794008940099401094011940129401394014940159401694017940189401994020940219402294023940249402594026940279402894029940309403194032940339403494035940369403794038940399404094041940429404394044940459404694047940489404994050940519405294053940549405594056940579405894059940609406194062940639406494065940669406794068940699407094071940729407394074940759407694077940789407994080940819408294083940849408594086940879408894089940909409194092940939409494095940969409794098940999410094101941029410394104941059410694107941089410994110941119411294113941149411594116941179411894119941209412194122941239412494125941269412794128941299413094131941329413394134941359413694137941389413994140941419414294143941449414594146941479414894149941509415194152941539415494155941569415794158941599416094161941629416394164941659416694167941689416994170941719417294173941749417594176941779417894179941809418194182941839418494185941869418794188941899419094191941929419394194941959419694197941989419994200942019420294203942049420594206942079420894209942109421194212942139421494215942169421794218942199422094221942229422394224942259422694227942289422994230942319423294233942349423594236942379423894239942409424194242942439424494245942469424794248942499425094251942529425394254942559425694257942589425994260942619426294263942649426594266942679426894269942709427194272942739427494275942769427794278942799428094281942829428394284942859428694287942889428994290942919429294293942949429594296942979429894299943009430194302943039430494305943069430794308943099431094311943129431394314943159431694317943189431994320943219432294323943249432594326943279432894329943309433194332943339433494335943369433794338943399434094341943429434394344943459434694347943489434994350943519435294353943549435594356943579435894359943609436194362943639436494365943669436794368943699437094371943729437394374943759437694377943789437994380943819438294383943849438594386943879438894389943909439194392943939439494395943969439794398943999440094401944029440394404944059440694407944089440994410944119441294413944149441594416944179441894419944209442194422944239442494425944269442794428944299443094431944329443394434944359443694437944389443994440944419444294443944449444594446944479444894449944509445194452944539445494455944569445794458944599446094461944629446394464944659446694467944689446994470944719447294473944749447594476944779447894479944809448194482944839448494485944869448794488944899449094491944929449394494944959449694497944989449994500945019450294503945049450594506945079450894509945109451194512945139451494515945169451794518945199452094521945229452394524945259452694527945289452994530945319453294533945349453594536945379453894539945409454194542945439454494545945469454794548945499455094551945529455394554945559455694557945589455994560945619456294563945649456594566945679456894569945709457194572945739457494575945769457794578945799458094581945829458394584945859458694587945889458994590945919459294593945949459594596945979459894599946009460194602946039460494605946069460794608946099461094611946129461394614946159461694617946189461994620946219462294623946249462594626946279462894629946309463194632946339463494635946369463794638946399464094641946429464394644946459464694647946489464994650946519465294653946549465594656946579465894659946609466194662946639466494665946669466794668946699467094671946729467394674946759467694677946789467994680946819468294683946849468594686946879468894689946909469194692946939469494695946969469794698946999470094701947029470394704947059470694707947089470994710947119471294713947149471594716947179471894719947209472194722947239472494725947269472794728947299473094731947329473394734947359473694737947389473994740947419474294743947449474594746947479474894749947509475194752947539475494755947569475794758947599476094761947629476394764947659476694767947689476994770947719477294773947749477594776947779477894779947809478194782947839478494785947869478794788947899479094791947929479394794947959479694797947989479994800948019480294803948049480594806948079480894809948109481194812948139481494815948169481794818948199482094821948229482394824948259482694827948289482994830948319483294833948349483594836948379483894839948409484194842948439484494845948469484794848948499485094851948529485394854948559485694857948589485994860948619486294863948649486594866948679486894869948709487194872948739487494875948769487794878948799488094881948829488394884948859488694887948889488994890948919489294893948949489594896948979489894899949009490194902949039490494905949069490794908949099491094911949129491394914949159491694917949189491994920949219492294923949249492594926949279492894929949309493194932949339493494935949369493794938949399494094941949429494394944949459494694947949489494994950949519495294953949549495594956949579495894959949609496194962949639496494965949669496794968949699497094971949729497394974949759497694977949789497994980949819498294983949849498594986949879498894989949909499194992949939499494995949969499794998949999500095001950029500395004950059500695007950089500995010950119501295013950149501595016950179501895019950209502195022950239502495025950269502795028950299503095031950329503395034950359503695037950389503995040950419504295043950449504595046950479504895049950509505195052950539505495055950569505795058950599506095061950629506395064950659506695067950689506995070950719507295073950749507595076950779507895079950809508195082950839508495085950869508795088950899509095091950929509395094950959509695097950989509995100951019510295103951049510595106951079510895109951109511195112951139511495115951169511795118951199512095121951229512395124951259512695127951289512995130951319513295133951349513595136951379513895139951409514195142951439514495145951469514795148951499515095151951529515395154951559515695157951589515995160951619516295163951649516595166951679516895169951709517195172951739517495175951769517795178951799518095181951829518395184951859518695187951889518995190951919519295193951949519595196951979519895199952009520195202952039520495205952069520795208952099521095211952129521395214952159521695217952189521995220952219522295223952249522595226952279522895229952309523195232952339523495235952369523795238952399524095241952429524395244952459524695247952489524995250952519525295253952549525595256952579525895259952609526195262952639526495265952669526795268952699527095271952729527395274952759527695277952789527995280952819528295283952849528595286952879528895289952909529195292952939529495295952969529795298952999530095301953029530395304953059530695307953089530995310953119531295313953149531595316953179531895319953209532195322953239532495325953269532795328953299533095331953329533395334953359533695337953389533995340953419534295343953449534595346953479534895349953509535195352953539535495355953569535795358953599536095361953629536395364953659536695367953689536995370953719537295373953749537595376953779537895379953809538195382953839538495385953869538795388953899539095391953929539395394953959539695397953989539995400954019540295403954049540595406954079540895409954109541195412954139541495415954169541795418954199542095421954229542395424954259542695427954289542995430954319543295433954349543595436954379543895439954409544195442954439544495445954469544795448954499545095451954529545395454954559545695457954589545995460954619546295463954649546595466954679546895469954709547195472954739547495475954769547795478954799548095481954829548395484954859548695487954889548995490954919549295493954949549595496954979549895499955009550195502955039550495505955069550795508955099551095511955129551395514955159551695517955189551995520955219552295523955249552595526955279552895529955309553195532955339553495535955369553795538955399554095541955429554395544955459554695547955489554995550955519555295553955549555595556955579555895559955609556195562955639556495565955669556795568955699557095571955729557395574955759557695577955789557995580955819558295583955849558595586955879558895589955909559195592955939559495595955969559795598955999560095601956029560395604956059560695607956089560995610956119561295613956149561595616956179561895619956209562195622956239562495625956269562795628956299563095631956329563395634956359563695637956389563995640956419564295643956449564595646956479564895649956509565195652956539565495655956569565795658956599566095661956629566395664956659566695667956689566995670956719567295673956749567595676956779567895679956809568195682956839568495685956869568795688956899569095691956929569395694956959569695697956989569995700957019570295703957049570595706957079570895709957109571195712957139571495715957169571795718957199572095721957229572395724957259572695727957289572995730957319573295733957349573595736957379573895739957409574195742957439574495745957469574795748957499575095751957529575395754957559575695757957589575995760957619576295763957649576595766957679576895769957709577195772957739577495775957769577795778957799578095781957829578395784957859578695787957889578995790957919579295793957949579595796957979579895799958009580195802958039580495805958069580795808958099581095811958129581395814958159581695817958189581995820958219582295823958249582595826958279582895829958309583195832958339583495835958369583795838958399584095841958429584395844958459584695847958489584995850958519585295853958549585595856958579585895859958609586195862958639586495865958669586795868958699587095871958729587395874958759587695877958789587995880958819588295883958849588595886958879588895889958909589195892958939589495895958969589795898958999590095901959029590395904959059590695907959089590995910959119591295913959149591595916959179591895919959209592195922959239592495925959269592795928959299593095931959329593395934959359593695937959389593995940959419594295943959449594595946959479594895949959509595195952959539595495955959569595795958959599596095961959629596395964959659596695967959689596995970959719597295973959749597595976959779597895979959809598195982959839598495985959869598795988959899599095991959929599395994959959599695997959989599996000960019600296003960049600596006960079600896009960109601196012960139601496015960169601796018960199602096021960229602396024960259602696027960289602996030960319603296033960349603596036960379603896039960409604196042960439604496045960469604796048960499605096051960529605396054960559605696057960589605996060960619606296063960649606596066960679606896069960709607196072960739607496075960769607796078960799608096081960829608396084960859608696087960889608996090960919609296093960949609596096960979609896099961009610196102961039610496105961069610796108961099611096111961129611396114961159611696117961189611996120961219612296123961249612596126961279612896129961309613196132961339613496135961369613796138961399614096141961429614396144961459614696147961489614996150961519615296153961549615596156961579615896159961609616196162961639616496165961669616796168961699617096171961729617396174961759617696177961789617996180961819618296183961849618596186961879618896189961909619196192961939619496195961969619796198961999620096201962029620396204962059620696207962089620996210962119621296213962149621596216962179621896219962209622196222962239622496225962269622796228962299623096231962329623396234962359623696237962389623996240962419624296243962449624596246962479624896249962509625196252962539625496255962569625796258962599626096261962629626396264962659626696267962689626996270962719627296273962749627596276962779627896279962809628196282962839628496285962869628796288962899629096291962929629396294962959629696297962989629996300963019630296303963049630596306963079630896309963109631196312963139631496315963169631796318963199632096321963229632396324963259632696327963289632996330963319633296333963349633596336963379633896339963409634196342963439634496345963469634796348963499635096351963529635396354963559635696357963589635996360963619636296363963649636596366963679636896369963709637196372963739637496375963769637796378963799638096381963829638396384963859638696387963889638996390963919639296393963949639596396963979639896399964009640196402964039640496405964069640796408964099641096411964129641396414964159641696417964189641996420964219642296423964249642596426964279642896429964309643196432964339643496435964369643796438964399644096441964429644396444964459644696447964489644996450964519645296453964549645596456964579645896459964609646196462964639646496465964669646796468964699647096471964729647396474964759647696477964789647996480964819648296483964849648596486964879648896489964909649196492964939649496495964969649796498964999650096501965029650396504965059650696507965089650996510965119651296513965149651596516965179651896519965209652196522965239652496525965269652796528965299653096531965329653396534965359653696537965389653996540965419654296543965449654596546965479654896549965509655196552965539655496555965569655796558965599656096561965629656396564965659656696567965689656996570965719657296573965749657596576965779657896579965809658196582965839658496585965869658796588965899659096591965929659396594965959659696597965989659996600966019660296603966049660596606966079660896609966109661196612966139661496615966169661796618966199662096621966229662396624966259662696627966289662996630966319663296633966349663596636966379663896639966409664196642966439664496645966469664796648966499665096651966529665396654966559665696657966589665996660966619666296663966649666596666966679666896669966709667196672966739667496675966769667796678966799668096681966829668396684966859668696687966889668996690966919669296693966949669596696966979669896699967009670196702967039670496705967069670796708967099671096711967129671396714967159671696717967189671996720967219672296723967249672596726967279672896729967309673196732967339673496735967369673796738967399674096741967429674396744967459674696747967489674996750967519675296753967549675596756967579675896759967609676196762967639676496765967669676796768967699677096771967729677396774967759677696777967789677996780967819678296783967849678596786967879678896789967909679196792967939679496795967969679796798967999680096801968029680396804968059680696807968089680996810968119681296813968149681596816968179681896819968209682196822968239682496825968269682796828968299683096831968329683396834968359683696837968389683996840968419684296843968449684596846968479684896849968509685196852968539685496855968569685796858968599686096861968629686396864968659686696867968689686996870968719687296873968749687596876968779687896879968809688196882968839688496885968869688796888968899689096891968929689396894968959689696897968989689996900969019690296903969049690596906969079690896909969109691196912969139691496915969169691796918969199692096921969229692396924969259692696927969289692996930969319693296933969349693596936969379693896939969409694196942969439694496945969469694796948969499695096951969529695396954969559695696957969589695996960969619696296963969649696596966969679696896969969709697196972969739697496975969769697796978969799698096981969829698396984969859698696987969889698996990969919699296993969949699596996969979699896999970009700197002970039700497005970069700797008970099701097011970129701397014970159701697017970189701997020970219702297023970249702597026970279702897029970309703197032970339703497035970369703797038970399704097041970429704397044970459704697047970489704997050970519705297053970549705597056970579705897059970609706197062970639706497065970669706797068970699707097071970729707397074970759707697077970789707997080970819708297083970849708597086970879708897089970909709197092970939709497095970969709797098970999710097101971029710397104971059710697107971089710997110971119711297113971149711597116971179711897119971209712197122971239712497125971269712797128971299713097131971329713397134971359713697137971389713997140971419714297143971449714597146971479714897149971509715197152971539715497155971569715797158971599716097161971629716397164971659716697167971689716997170971719717297173971749717597176971779717897179971809718197182971839718497185971869718797188971899719097191971929719397194971959719697197971989719997200972019720297203972049720597206972079720897209972109721197212972139721497215972169721797218972199722097221972229722397224972259722697227972289722997230972319723297233972349723597236972379723897239972409724197242972439724497245972469724797248972499725097251972529725397254972559725697257972589725997260972619726297263972649726597266972679726897269972709727197272972739727497275972769727797278972799728097281972829728397284972859728697287972889728997290972919729297293972949729597296972979729897299973009730197302973039730497305973069730797308973099731097311973129731397314973159731697317973189731997320973219732297323973249732597326973279732897329973309733197332973339733497335973369733797338973399734097341973429734397344973459734697347973489734997350973519735297353973549735597356973579735897359973609736197362973639736497365973669736797368973699737097371973729737397374973759737697377973789737997380973819738297383973849738597386973879738897389973909739197392973939739497395973969739797398973999740097401974029740397404974059740697407974089740997410974119741297413974149741597416974179741897419974209742197422974239742497425974269742797428974299743097431974329743397434974359743697437974389743997440974419744297443974449744597446974479744897449974509745197452974539745497455974569745797458974599746097461974629746397464974659746697467974689746997470974719747297473974749747597476974779747897479974809748197482974839748497485974869748797488974899749097491974929749397494974959749697497974989749997500975019750297503975049750597506975079750897509975109751197512975139751497515975169751797518975199752097521975229752397524975259752697527975289752997530975319753297533975349753597536975379753897539975409754197542975439754497545975469754797548975499755097551975529755397554975559755697557975589755997560975619756297563975649756597566975679756897569975709757197572975739757497575975769757797578975799758097581975829758397584975859758697587975889758997590975919759297593975949759597596975979759897599976009760197602976039760497605976069760797608976099761097611976129761397614976159761697617976189761997620976219762297623976249762597626976279762897629976309763197632976339763497635976369763797638976399764097641976429764397644976459764697647976489764997650976519765297653976549765597656976579765897659976609766197662976639766497665976669766797668976699767097671976729767397674976759767697677976789767997680976819768297683976849768597686976879768897689976909769197692976939769497695976969769797698976999770097701977029770397704977059770697707977089770997710977119771297713977149771597716977179771897719977209772197722977239772497725977269772797728977299773097731977329773397734977359773697737977389773997740977419774297743977449774597746977479774897749977509775197752977539775497755977569775797758977599776097761977629776397764977659776697767977689776997770977719777297773977749777597776977779777897779977809778197782977839778497785977869778797788977899779097791977929779397794977959779697797977989779997800978019780297803978049780597806978079780897809978109781197812978139781497815978169781797818978199782097821978229782397824978259782697827978289782997830978319783297833978349783597836978379783897839978409784197842978439784497845978469784797848978499785097851978529785397854978559785697857978589785997860978619786297863978649786597866978679786897869978709787197872978739787497875978769787797878978799788097881978829788397884978859788697887978889788997890978919789297893978949789597896978979789897899979009790197902979039790497905979069790797908979099791097911979129791397914979159791697917979189791997920979219792297923979249792597926979279792897929979309793197932979339793497935979369793797938979399794097941979429794397944979459794697947979489794997950979519795297953979549795597956979579795897959979609796197962979639796497965979669796797968979699797097971979729797397974979759797697977979789797997980979819798297983979849798597986979879798897989979909799197992979939799497995979969799797998979999800098001980029800398004980059800698007980089800998010980119801298013980149801598016980179801898019980209802198022980239802498025980269802798028980299803098031980329803398034980359803698037980389803998040980419804298043980449804598046980479804898049980509805198052980539805498055980569805798058980599806098061980629806398064980659806698067980689806998070980719807298073980749807598076980779807898079980809808198082980839808498085980869808798088980899809098091980929809398094980959809698097980989809998100981019810298103981049810598106981079810898109981109811198112981139811498115981169811798118981199812098121981229812398124981259812698127981289812998130981319813298133981349813598136981379813898139981409814198142981439814498145981469814798148981499815098151981529815398154981559815698157981589815998160981619816298163981649816598166981679816898169981709817198172981739817498175981769817798178981799818098181981829818398184981859818698187981889818998190981919819298193981949819598196981979819898199982009820198202982039820498205982069820798208982099821098211982129821398214982159821698217982189821998220982219822298223982249822598226982279822898229982309823198232982339823498235982369823798238982399824098241982429824398244982459824698247982489824998250982519825298253982549825598256982579825898259982609826198262982639826498265982669826798268982699827098271982729827398274982759827698277982789827998280982819828298283982849828598286982879828898289982909829198292982939829498295982969829798298982999830098301983029830398304983059830698307983089830998310983119831298313983149831598316983179831898319983209832198322983239832498325983269832798328983299833098331983329833398334983359833698337983389833998340983419834298343983449834598346983479834898349983509835198352983539835498355983569835798358983599836098361983629836398364983659836698367983689836998370983719837298373983749837598376983779837898379983809838198382983839838498385983869838798388983899839098391983929839398394983959839698397983989839998400984019840298403984049840598406984079840898409984109841198412984139841498415984169841798418984199842098421984229842398424984259842698427984289842998430984319843298433984349843598436984379843898439984409844198442984439844498445984469844798448984499845098451984529845398454984559845698457984589845998460984619846298463984649846598466984679846898469984709847198472984739847498475984769847798478984799848098481984829848398484984859848698487984889848998490984919849298493984949849598496984979849898499985009850198502985039850498505985069850798508985099851098511985129851398514985159851698517985189851998520985219852298523985249852598526985279852898529985309853198532985339853498535985369853798538985399854098541985429854398544985459854698547985489854998550985519855298553985549855598556985579855898559985609856198562985639856498565985669856798568985699857098571985729857398574985759857698577985789857998580985819858298583985849858598586985879858898589985909859198592985939859498595985969859798598985999860098601986029860398604986059860698607986089860998610986119861298613986149861598616986179861898619986209862198622986239862498625986269862798628986299863098631986329863398634986359863698637986389863998640986419864298643986449864598646986479864898649986509865198652986539865498655986569865798658986599866098661986629866398664986659866698667986689866998670986719867298673986749867598676986779867898679986809868198682986839868498685986869868798688986899869098691986929869398694986959869698697986989869998700987019870298703987049870598706987079870898709987109871198712987139871498715987169871798718987199872098721987229872398724987259872698727987289872998730987319873298733987349873598736987379873898739987409874198742987439874498745987469874798748987499875098751987529875398754987559875698757987589875998760987619876298763987649876598766987679876898769987709877198772987739877498775987769877798778987799878098781987829878398784987859878698787987889878998790987919879298793987949879598796987979879898799988009880198802988039880498805988069880798808988099881098811988129881398814988159881698817988189881998820988219882298823988249882598826988279882898829988309883198832988339883498835988369883798838988399884098841988429884398844988459884698847988489884998850988519885298853988549885598856988579885898859988609886198862988639886498865988669886798868988699887098871988729887398874988759887698877988789887998880988819888298883988849888598886988879888898889988909889198892988939889498895988969889798898988999890098901989029890398904989059890698907989089890998910989119891298913989149891598916989179891898919989209892198922989239892498925989269892798928989299893098931989329893398934989359893698937989389893998940989419894298943989449894598946989479894898949989509895198952989539895498955989569895798958989599896098961989629896398964989659896698967989689896998970989719897298973989749897598976989779897898979989809898198982989839898498985989869898798988989899899098991989929899398994989959899698997989989899999000990019900299003990049900599006990079900899009990109901199012990139901499015990169901799018990199902099021990229902399024990259902699027990289902999030990319903299033990349903599036990379903899039990409904199042990439904499045990469904799048990499905099051990529905399054990559905699057990589905999060990619906299063990649906599066990679906899069990709907199072990739907499075990769907799078990799908099081990829908399084990859908699087990889908999090990919909299093990949909599096990979909899099991009910199102991039910499105991069910799108991099911099111991129911399114991159911699117991189911999120991219912299123991249912599126991279912899129991309913199132991339913499135991369913799138991399914099141991429914399144991459914699147991489914999150991519915299153991549915599156991579915899159991609916199162991639916499165991669916799168991699917099171991729917399174991759917699177991789917999180991819918299183991849918599186991879918899189991909919199192991939919499195991969919799198991999920099201992029920399204992059920699207992089920999210992119921299213992149921599216992179921899219992209922199222992239922499225992269922799228992299923099231992329923399234992359923699237992389923999240992419924299243992449924599246992479924899249992509925199252992539925499255992569925799258992599926099261992629926399264992659926699267992689926999270992719927299273992749927599276992779927899279992809928199282992839928499285992869928799288992899929099291992929929399294992959929699297992989929999300993019930299303993049930599306993079930899309993109931199312993139931499315993169931799318993199932099321993229932399324993259932699327993289932999330993319933299333993349933599336993379933899339993409934199342993439934499345993469934799348993499935099351993529935399354993559935699357993589935999360993619936299363993649936599366993679936899369993709937199372993739937499375993769937799378993799938099381993829938399384993859938699387993889938999390993919939299393993949939599396993979939899399994009940199402994039940499405994069940799408994099941099411994129941399414994159941699417994189941999420994219942299423994249942599426994279942899429994309943199432994339943499435994369943799438994399944099441994429944399444994459944699447994489944999450994519945299453994549945599456994579945899459994609946199462994639946499465994669946799468994699947099471994729947399474994759947699477994789947999480994819948299483994849948599486994879948899489994909949199492994939949499495994969949799498994999950099501995029950399504995059950699507995089950999510995119951299513995149951599516995179951899519995209952199522995239952499525995269952799528995299953099531995329953399534995359953699537995389953999540995419954299543995449954599546995479954899549995509955199552995539955499555995569955799558995599956099561995629956399564995659956699567995689956999570995719957299573995749957599576995779957899579995809958199582995839958499585995869958799588995899959099591995929959399594995959959699597995989959999600996019960299603996049960599606996079960899609996109961199612996139961499615996169961799618996199962099621996229962399624996259962699627996289962999630996319963299633996349963599636996379963899639996409964199642996439964499645996469964799648996499965099651996529965399654996559965699657996589965999660996619966299663996649966599666996679966899669996709967199672996739967499675996769967799678996799968099681996829968399684996859968699687996889968999690996919969299693996949969599696996979969899699997009970199702997039970499705997069970799708997099971099711997129971399714997159971699717997189971999720997219972299723997249972599726997279972899729997309973199732997339973499735997369973799738997399974099741997429974399744997459974699747997489974999750997519975299753997549975599756997579975899759997609976199762997639976499765997669976799768997699977099771997729977399774997759977699777997789977999780997819978299783997849978599786997879978899789997909979199792997939979499795997969979799798997999980099801998029980399804998059980699807998089980999810998119981299813998149981599816998179981899819998209982199822998239982499825998269982799828998299983099831998329983399834998359983699837998389983999840998419984299843998449984599846998479984899849998509985199852998539985499855998569985799858998599986099861998629986399864998659986699867998689986999870998719987299873998749987599876998779987899879998809988199882998839988499885998869988799888998899989099891998929989399894998959989699897998989989999900999019990299903999049990599906999079990899909999109991199912999139991499915999169991799918999199992099921999229992399924999259992699927999289992999930999319993299933999349993599936999379993899939999409994199942999439994499945999469994799948999499995099951999529995399954999559995699957999589995999960999619996299963999649996599966999679996899969999709997199972999739997499975999769997799978999799998099981999829998399984999859998699987999889998999990999919999299993999949999599996999979999899999100000100001100002100003100004100005100006100007100008100009100010100011100012100013100014100015100016100017100018100019100020100021100022100023100024100025100026100027100028100029100030100031100032100033100034100035100036100037100038100039100040100041100042100043100044100045100046100047100048100049100050100051100052100053100054100055100056100057100058100059100060100061100062100063100064100065100066100067100068100069100070100071100072100073100074100075100076100077100078100079100080100081100082100083100084100085100086100087100088100089100090100091100092100093100094100095100096100097100098100099100100100101100102100103100104100105100106100107100108100109100110100111100112100113100114100115100116100117100118100119100120100121100122100123100124100125100126100127100128100129100130100131100132100133100134100135100136100137100138100139100140100141100142100143100144100145100146100147100148100149100150100151100152100153100154100155100156100157100158100159100160100161100162100163100164100165100166100167100168100169100170100171100172100173100174100175100176100177100178100179100180100181100182100183100184100185100186100187100188100189100190100191100192100193100194100195100196100197100198100199100200100201100202100203100204100205100206100207100208100209100210100211100212100213100214100215100216100217100218100219100220100221100222100223100224100225100226100227100228100229100230100231100232100233100234100235100236100237100238100239100240100241100242100243100244100245100246100247100248100249100250100251100252100253100254100255100256100257100258100259100260100261100262100263100264100265100266100267100268100269100270100271100272100273100274100275100276100277100278100279100280100281100282100283100284100285100286100287100288100289100290100291100292100293100294100295100296100297100298100299100300100301100302100303100304100305100306100307100308100309100310100311100312100313100314100315100316100317100318100319100320100321100322100323100324100325100326100327100328100329100330100331100332100333100334100335100336100337100338100339100340100341100342100343100344100345100346100347100348100349100350100351100352100353100354100355100356100357100358100359100360100361100362100363100364100365100366100367100368100369100370100371100372100373100374100375100376100377100378100379100380100381100382100383100384100385100386100387100388100389100390100391100392100393100394100395100396100397100398100399100400100401100402100403100404100405100406100407100408100409100410100411100412100413100414100415100416100417100418100419100420100421100422100423100424100425100426100427100428100429100430100431100432100433100434100435100436100437100438100439100440100441100442100443100444100445100446100447100448100449100450100451100452100453100454100455100456100457100458100459100460100461100462100463100464100465100466100467100468100469100470100471100472100473100474100475100476100477100478100479100480100481100482100483100484100485100486100487100488100489100490100491100492100493100494100495100496100497100498100499100500100501100502100503100504100505100506100507100508100509100510100511100512100513100514100515100516100517100518100519100520100521100522100523100524100525100526100527100528100529100530100531100532100533100534100535100536100537100538100539100540100541100542100543100544100545100546100547100548100549100550100551100552100553100554100555100556100557100558100559100560100561100562100563100564100565100566100567100568100569100570100571100572100573100574100575100576100577100578100579100580100581100582100583100584100585100586100587100588100589100590100591100592100593100594100595100596100597100598100599100600100601100602100603100604100605100606100607100608100609100610100611100612100613100614100615100616100617100618100619100620100621100622100623100624100625100626100627100628100629100630100631100632100633100634100635100636100637100638100639100640100641100642100643100644100645100646100647100648100649100650100651100652100653100654100655100656100657100658100659100660100661100662100663100664100665100666100667100668100669100670100671100672100673100674100675100676100677100678100679100680100681100682100683100684100685100686100687100688100689100690100691100692100693100694100695100696100697100698100699100700100701100702100703100704100705100706100707100708100709100710100711100712100713100714100715100716100717100718100719100720100721100722100723100724100725100726100727100728100729100730100731100732100733100734100735100736100737100738100739100740100741100742100743100744100745100746100747100748100749100750100751100752100753100754100755100756100757100758100759100760100761100762100763100764100765100766100767100768100769100770100771100772100773100774100775100776100777100778100779100780100781100782100783100784100785100786100787100788100789100790100791100792100793100794100795100796100797100798100799100800100801100802100803100804100805100806100807100808100809100810100811100812100813100814100815100816100817100818100819100820100821100822100823100824100825100826100827100828100829100830100831100832100833100834100835100836100837100838100839100840100841100842100843100844100845100846100847100848100849100850100851100852100853100854100855100856100857100858100859100860100861100862100863100864100865100866100867100868100869100870100871100872100873100874100875100876100877100878100879100880100881100882100883100884100885100886100887100888100889100890100891100892100893100894100895100896100897100898100899100900100901100902100903100904100905100906100907100908100909100910100911100912100913100914100915100916100917100918100919100920100921100922100923100924100925100926100927100928100929100930100931100932100933100934100935100936100937100938100939100940100941100942100943100944100945100946100947100948100949100950100951100952100953100954100955100956100957100958100959100960100961100962100963100964100965100966100967100968100969100970100971100972100973100974100975100976100977100978100979100980100981100982100983100984100985100986100987100988100989100990100991100992100993100994100995100996100997100998100999101000101001101002101003101004101005101006101007101008101009101010101011101012101013101014101015101016101017101018101019101020101021101022101023101024101025101026101027101028101029101030101031101032101033101034101035101036101037101038101039101040101041101042101043101044101045101046101047101048101049101050101051101052101053101054101055101056101057101058101059101060101061101062101063101064101065101066101067101068101069101070101071101072101073101074101075101076101077101078101079101080101081101082101083101084101085101086101087101088101089101090101091101092101093101094101095101096101097101098101099101100101101101102101103101104101105101106101107101108101109101110101111101112101113101114101115101116101117101118101119101120101121101122101123101124101125101126101127101128101129101130101131101132101133101134101135101136101137101138101139101140101141101142101143101144101145101146101147101148101149101150101151101152101153101154101155101156101157101158101159101160101161101162101163101164101165101166101167101168101169101170101171101172101173101174101175101176101177101178101179101180101181101182101183101184101185101186101187101188101189101190101191101192101193101194101195101196101197101198101199101200101201101202101203101204101205101206101207101208101209101210101211101212101213101214101215101216101217101218101219101220101221101222101223101224101225101226101227101228101229101230101231101232101233101234101235101236101237101238101239101240101241101242101243101244101245101246101247101248101249101250101251101252101253101254101255101256101257101258101259101260101261101262101263101264101265101266101267101268101269101270101271101272101273101274101275101276101277101278101279101280101281101282101283101284101285101286101287101288101289101290101291101292101293101294101295101296101297101298101299101300101301101302101303101304101305101306101307101308101309101310101311101312101313101314101315101316101317101318101319101320101321101322101323101324101325101326101327101328101329101330101331101332101333101334101335101336101337101338101339101340101341101342101343101344101345101346101347101348101349101350101351101352101353101354101355101356101357101358101359101360101361101362101363101364101365101366101367101368101369101370101371101372101373101374101375101376101377101378101379101380101381101382101383101384101385101386101387101388101389101390101391101392101393101394101395101396101397101398101399101400101401101402101403101404101405101406101407101408101409101410101411101412101413101414101415101416101417101418101419101420101421101422101423101424101425101426101427101428101429101430101431101432101433101434101435101436101437101438101439101440101441101442101443101444101445101446101447101448101449101450101451101452101453101454101455101456101457101458101459101460101461101462101463101464101465101466101467101468101469101470101471101472101473101474101475101476101477101478101479101480101481101482101483101484101485101486101487101488101489101490101491101492101493101494101495101496101497101498101499101500101501101502101503101504101505101506101507101508101509101510101511101512101513101514101515101516101517101518101519101520101521101522101523101524101525101526101527101528101529101530101531101532101533101534101535101536101537101538101539101540101541101542101543101544101545101546101547101548101549101550101551101552101553101554101555101556101557101558101559101560101561101562101563101564101565101566101567101568101569101570101571101572101573101574101575101576101577101578101579101580101581101582101583101584101585101586101587101588101589101590101591101592101593101594101595101596101597101598101599101600101601101602101603101604101605101606101607101608101609101610101611101612101613101614101615101616101617101618101619101620101621101622101623101624101625101626101627101628101629101630101631101632101633101634101635101636101637101638101639101640101641101642101643101644101645101646101647101648101649101650101651101652101653101654101655101656101657101658101659101660101661101662101663101664101665101666101667101668101669101670101671101672101673101674101675101676101677101678101679101680101681101682101683101684101685101686101687101688101689101690101691101692101693101694101695101696101697101698101699101700101701101702101703101704101705101706101707101708101709101710101711101712101713101714101715101716101717101718101719101720101721101722101723101724101725101726101727101728101729101730101731101732101733101734101735101736101737101738101739101740101741101742101743101744101745101746101747101748101749101750101751101752101753101754101755101756101757101758101759101760101761101762101763101764101765101766101767101768101769101770101771101772101773101774101775101776101777101778101779101780101781101782101783101784101785101786101787101788101789101790101791101792101793101794101795101796101797101798101799101800101801101802101803101804101805101806101807101808101809101810101811101812101813101814101815101816101817101818101819101820101821101822101823101824101825101826101827101828101829101830101831101832101833101834101835101836101837101838101839101840101841101842101843101844101845101846101847101848101849101850101851101852101853101854101855101856101857101858101859101860101861101862101863101864101865101866101867101868101869101870101871101872101873101874101875101876101877101878101879101880101881101882101883101884101885101886101887101888101889101890101891101892101893101894101895101896101897101898101899101900101901101902101903101904101905101906101907101908101909101910101911101912101913101914101915101916101917101918101919101920101921101922101923101924101925101926101927101928101929101930101931101932101933101934101935101936101937101938101939101940101941101942101943101944101945101946101947101948101949101950101951101952101953101954101955101956101957101958101959101960101961101962101963101964101965101966101967101968101969101970101971101972101973101974101975101976101977101978101979101980101981101982101983101984101985101986101987101988101989101990101991101992101993101994101995101996101997101998101999102000102001102002102003102004102005102006102007102008102009102010102011102012102013102014102015102016102017102018102019102020102021102022102023102024102025102026102027102028102029102030102031102032102033102034102035102036102037102038102039102040102041102042102043102044102045102046102047102048102049102050102051102052102053102054102055102056102057102058102059102060102061102062102063102064102065102066102067102068102069102070102071102072102073102074102075102076102077102078102079102080102081102082102083102084102085102086102087102088102089102090102091102092102093102094102095102096102097102098102099102100102101102102102103102104102105102106102107102108102109102110102111102112102113102114102115102116102117102118102119102120102121102122102123102124102125102126102127102128102129102130102131102132102133102134102135102136102137102138102139102140102141102142102143102144102145102146102147102148102149102150102151102152102153102154102155102156102157102158102159102160102161102162102163102164102165102166102167102168102169102170102171102172102173102174102175102176102177102178102179102180102181102182102183102184102185102186102187102188102189102190102191102192102193102194102195102196102197102198102199102200102201102202102203102204102205102206102207102208102209102210102211102212102213102214102215102216102217102218102219102220102221102222102223102224102225102226102227102228102229102230102231102232102233102234102235102236102237102238102239102240102241102242102243102244102245102246102247102248102249102250102251102252102253102254102255102256102257102258102259102260102261102262102263102264102265102266102267102268102269102270102271102272102273102274102275102276102277102278102279102280102281102282102283102284102285102286102287102288102289102290102291102292102293102294102295102296102297102298102299102300102301102302102303102304102305102306102307102308102309102310102311102312102313102314102315102316102317102318102319102320102321102322102323102324102325102326102327102328102329102330102331102332102333102334102335102336102337102338102339102340102341102342102343102344102345102346102347102348102349102350102351102352102353102354102355102356102357102358102359102360102361102362102363102364102365102366102367102368102369102370102371102372102373102374102375102376102377102378102379102380102381102382102383102384102385102386102387102388102389102390102391102392102393102394102395102396102397102398102399102400102401102402102403102404102405102406102407102408102409102410102411102412102413102414102415102416102417102418102419102420102421102422102423102424102425102426102427102428102429102430102431102432102433102434102435102436102437102438102439102440102441102442102443102444102445102446102447102448102449102450102451102452102453102454102455102456102457102458102459102460102461102462102463102464102465102466102467102468102469102470102471102472102473102474102475102476102477102478102479102480102481102482102483102484102485102486102487102488102489102490102491102492102493102494102495102496102497102498102499102500102501102502102503102504102505102506102507102508102509102510102511102512102513102514102515102516102517102518102519102520102521102522102523102524102525102526102527102528102529102530102531102532102533102534102535102536102537102538102539102540102541102542102543102544102545102546102547102548102549102550102551102552102553102554102555102556102557102558102559102560102561102562102563102564102565102566102567102568102569102570102571102572102573102574102575102576102577102578102579102580102581102582102583102584102585102586102587102588102589102590102591102592102593102594102595102596102597102598102599102600102601102602102603102604102605102606102607102608102609102610102611102612102613102614102615102616102617102618102619102620102621102622102623102624102625102626102627102628102629102630102631102632102633102634102635102636102637102638102639102640102641102642102643102644102645102646102647102648102649102650102651102652102653102654102655102656102657102658102659102660102661102662102663102664102665102666102667102668102669102670102671102672102673102674102675102676102677102678102679102680102681102682102683102684102685102686102687102688102689102690102691102692102693102694102695102696102697102698102699102700102701102702102703102704102705102706102707102708102709102710102711102712102713102714102715102716102717102718102719102720102721102722102723102724102725102726102727102728102729102730102731102732102733102734102735102736102737102738102739102740102741102742102743102744102745102746102747102748102749102750102751102752102753102754102755102756102757102758102759102760102761102762102763102764102765102766102767102768102769102770102771102772102773102774102775102776102777102778102779102780102781102782102783102784102785102786102787102788102789102790102791102792102793102794102795102796102797102798102799102800102801102802102803102804102805102806102807102808102809102810102811102812102813102814102815102816102817102818102819102820102821102822102823102824102825102826102827102828102829102830102831102832102833102834102835102836102837102838102839102840102841102842102843102844102845102846102847102848102849102850102851102852102853102854102855102856102857102858102859102860102861102862102863102864102865102866102867102868102869102870102871102872102873102874102875102876102877102878102879102880102881102882102883102884102885102886102887102888102889102890102891102892102893102894102895102896102897102898102899102900102901102902102903102904102905102906102907102908102909102910102911102912102913102914102915102916102917102918102919102920102921102922102923102924102925102926102927102928102929102930102931102932102933102934102935102936102937102938102939102940102941102942102943102944102945102946102947102948102949102950102951102952102953102954102955102956102957102958102959102960102961102962102963102964102965102966102967102968102969102970102971102972102973102974102975102976102977102978102979102980102981102982102983102984102985102986102987102988102989102990102991102992102993102994102995102996102997102998102999103000103001103002103003103004103005103006103007103008103009103010103011103012103013103014103015103016103017103018103019103020103021103022103023103024103025103026103027103028103029103030103031103032103033103034103035103036103037103038103039103040103041103042103043103044103045103046103047103048103049103050103051103052103053103054103055103056103057103058103059103060103061103062103063103064103065103066103067103068103069103070103071103072103073103074103075103076103077103078103079103080103081103082103083103084103085103086103087103088103089103090103091103092103093103094103095103096103097103098103099103100103101103102103103103104103105103106103107103108103109103110103111103112103113103114103115103116103117103118103119103120103121103122103123103124103125103126103127103128103129103130103131103132103133103134103135103136103137103138103139103140103141103142103143103144103145103146103147103148103149103150103151103152103153103154103155103156103157103158103159103160103161103162103163103164103165103166103167103168103169103170103171103172103173103174103175103176103177103178103179103180103181103182103183103184103185103186103187103188103189103190103191103192103193103194103195103196103197103198103199103200103201103202103203103204103205103206103207103208103209103210103211103212103213103214103215103216103217103218103219103220103221103222103223103224103225103226103227103228103229103230103231103232103233103234103235103236103237103238103239103240103241103242103243103244103245103246103247103248103249103250103251103252103253103254103255103256103257103258103259103260103261103262103263103264103265103266103267103268103269103270103271103272103273103274103275103276103277103278103279103280103281103282103283103284103285103286103287103288103289103290103291103292103293103294103295103296103297103298103299103300103301103302103303103304103305103306103307103308103309103310103311103312103313103314103315103316103317103318103319103320103321103322103323103324103325103326103327103328103329103330103331103332103333103334103335103336103337103338103339103340103341103342103343103344103345103346103347103348103349103350103351103352103353103354103355103356103357103358103359103360103361103362103363103364103365103366103367103368103369103370103371103372103373103374103375103376103377103378103379103380103381103382103383103384103385103386103387103388103389103390103391103392103393103394103395103396103397103398103399103400103401103402103403103404103405103406103407103408103409103410103411103412103413103414103415103416103417103418103419103420103421103422103423103424103425103426103427103428103429103430103431103432103433103434103435103436103437103438103439103440103441103442103443103444103445103446103447103448103449103450103451103452103453103454103455103456103457103458103459103460103461103462103463103464103465103466103467103468103469103470103471103472103473103474103475103476103477103478103479103480103481103482103483103484103485103486103487103488103489103490103491103492103493103494103495103496103497103498103499103500103501103502103503103504103505103506103507103508103509103510103511103512103513103514103515103516103517103518103519103520103521103522103523103524103525103526103527103528103529103530103531103532103533103534103535103536103537103538103539103540103541103542103543103544103545103546103547103548103549103550103551103552103553103554103555103556103557103558103559103560103561103562103563103564103565103566103567103568103569103570103571103572103573103574103575103576103577103578103579103580103581103582103583103584103585103586103587103588103589103590103591103592103593103594103595103596103597103598103599103600103601103602103603103604103605103606103607103608103609103610103611103612103613103614103615103616103617103618103619103620103621103622103623103624103625103626103627103628103629103630103631103632103633103634103635103636103637103638103639103640103641103642103643103644103645103646103647103648103649103650103651103652103653103654103655103656103657103658103659103660103661103662103663103664103665103666103667103668103669103670103671103672103673103674103675103676103677103678103679103680103681103682103683103684103685103686103687103688103689103690103691103692103693103694103695103696103697103698103699103700103701103702103703103704103705103706103707103708103709103710103711103712103713103714103715103716103717103718103719103720103721103722103723103724103725103726103727103728103729103730103731103732103733103734103735103736103737103738103739103740103741103742103743103744103745103746103747103748103749103750103751103752103753103754103755103756103757103758103759103760103761103762103763103764103765103766103767103768103769103770103771103772103773103774103775103776103777103778103779103780103781103782103783103784103785103786103787103788103789103790103791103792103793103794103795103796103797103798103799103800103801103802103803103804103805103806103807103808103809103810103811103812103813103814103815103816103817103818103819103820103821103822103823103824103825103826103827103828103829103830103831103832103833103834103835103836103837103838103839103840103841103842103843103844103845103846103847103848103849103850103851103852103853103854103855103856103857103858103859103860103861103862103863103864103865103866103867103868103869103870103871103872103873103874103875103876103877103878103879103880103881103882103883103884103885103886103887103888103889103890103891103892103893103894103895103896103897103898103899103900103901103902103903103904103905103906103907103908103909103910103911103912103913103914103915103916103917103918103919103920103921103922103923103924103925103926103927103928103929103930103931103932103933103934103935103936103937103938103939103940103941103942103943103944103945103946103947103948103949103950103951103952103953103954103955103956103957103958103959103960103961103962103963103964103965103966103967103968103969103970103971103972103973103974103975103976103977103978103979103980103981103982103983103984103985103986103987103988103989103990103991103992103993103994103995103996103997103998103999104000104001104002104003104004104005104006104007104008104009104010104011104012104013104014104015104016104017104018104019104020104021104022104023104024104025104026104027104028104029104030104031104032104033104034104035104036104037104038104039104040104041104042104043104044104045104046104047104048104049104050104051104052104053104054104055104056104057104058104059104060104061104062104063104064104065104066104067104068104069104070104071104072104073104074104075104076104077104078104079104080104081104082104083104084104085104086104087104088104089104090104091104092104093104094104095104096104097104098104099104100104101104102104103104104104105104106104107104108104109104110104111104112104113104114104115104116104117104118104119104120104121104122104123104124104125104126104127104128104129104130104131104132104133104134104135104136104137104138104139104140104141104142104143104144104145104146104147104148104149104150104151104152104153104154104155104156104157104158104159104160104161104162104163104164104165104166104167104168104169104170104171104172104173104174104175104176104177104178104179104180104181104182104183104184104185104186104187104188104189104190104191104192104193104194104195104196104197104198104199104200104201104202104203104204104205104206104207104208104209104210104211104212104213104214104215104216104217104218104219104220104221104222104223104224104225104226104227104228104229104230104231104232104233104234104235104236104237104238104239104240104241104242104243104244104245104246104247104248104249104250104251104252104253104254104255104256104257104258104259104260104261104262104263104264104265104266104267104268104269104270104271104272104273104274104275104276104277104278104279104280104281104282104283104284104285104286104287104288104289104290104291104292104293104294104295104296104297104298104299104300104301104302104303104304104305104306104307104308104309104310104311104312104313104314104315104316104317104318104319104320104321104322104323104324104325104326104327104328104329104330104331104332104333104334104335104336104337104338104339104340104341104342104343104344104345104346104347104348104349104350104351104352104353104354104355104356104357104358104359104360104361104362104363104364104365104366104367104368104369104370104371104372104373104374104375104376104377104378104379104380104381104382104383104384104385104386104387104388104389104390104391104392104393104394104395104396104397104398104399104400104401104402104403104404104405104406104407104408104409104410104411104412104413104414104415104416104417104418104419104420104421104422104423104424104425104426104427104428104429104430104431104432104433104434104435104436104437104438104439104440104441104442104443104444104445104446104447104448104449104450104451104452104453104454104455104456104457104458104459104460104461104462104463104464104465104466104467104468104469104470104471104472104473104474104475104476104477104478104479104480104481104482104483104484104485104486104487104488104489104490104491104492104493104494104495104496104497104498104499104500104501104502104503104504104505104506104507104508104509104510104511104512104513104514104515104516104517104518104519104520104521104522104523104524104525104526104527104528104529104530104531104532104533104534104535104536104537104538104539104540104541104542104543104544104545104546104547104548104549104550104551104552104553104554104555104556104557104558104559104560104561104562104563104564104565104566104567104568104569104570104571104572104573104574104575104576104577104578104579104580104581104582104583104584104585104586104587104588104589104590104591104592104593104594104595104596104597104598104599104600104601104602104603104604104605104606104607104608104609104610104611104612104613104614104615104616104617104618104619104620104621104622104623104624104625104626104627104628104629104630104631104632104633104634104635104636104637104638104639104640104641104642104643104644104645104646104647104648104649104650104651104652104653104654104655104656104657104658104659104660104661104662104663104664104665104666104667104668104669104670104671104672104673104674104675104676104677104678104679104680104681104682104683104684104685104686104687104688104689104690104691104692104693104694104695104696104697104698104699104700104701104702104703104704104705104706104707104708104709104710104711104712104713104714104715104716104717104718104719104720104721104722104723104724104725104726104727104728104729104730104731104732104733104734104735104736104737104738104739104740104741104742104743104744104745104746104747104748104749104750104751104752104753104754104755104756104757104758104759104760104761104762104763104764104765104766104767104768104769104770104771104772104773104774104775104776104777104778104779104780104781104782104783104784104785104786104787104788104789104790104791104792104793104794104795104796104797104798104799104800104801104802104803104804104805104806104807104808104809104810104811104812104813104814104815104816104817104818104819104820104821104822104823104824104825104826104827104828104829104830104831104832104833104834104835104836104837104838104839104840104841104842104843104844104845104846104847104848104849104850104851104852104853104854104855104856104857104858104859104860104861104862104863104864104865104866104867104868104869104870104871104872104873104874104875104876104877104878104879104880104881104882104883104884104885104886104887104888104889104890104891104892104893104894104895104896104897104898104899104900104901104902104903104904104905104906104907104908104909104910104911104912104913104914104915104916104917104918104919104920104921104922104923104924104925104926104927104928104929104930104931104932104933104934104935104936104937104938104939104940104941104942104943104944104945104946104947104948104949104950104951104952104953104954104955104956104957104958104959104960104961104962104963104964104965104966104967104968104969104970104971104972104973104974104975104976104977104978104979104980104981104982104983104984104985104986104987104988104989104990104991104992104993104994104995104996104997104998104999105000105001105002105003105004105005105006105007105008105009105010105011105012105013105014105015105016105017105018105019105020105021105022105023105024105025105026105027105028105029105030105031105032105033105034105035105036105037105038105039105040105041105042105043105044105045105046105047105048105049105050105051105052105053105054105055105056105057105058105059105060105061105062105063105064105065105066105067105068105069105070105071105072105073105074105075105076105077105078105079105080105081105082105083105084105085105086105087105088105089105090105091105092105093105094105095105096105097105098105099105100105101105102105103105104105105105106105107105108105109105110105111105112105113105114105115105116105117105118105119105120105121105122105123105124105125105126105127105128105129105130105131105132105133105134105135105136105137105138105139105140105141105142105143105144105145105146105147105148105149105150105151105152105153105154105155105156105157105158105159105160105161105162105163105164105165105166105167105168105169105170105171105172105173105174105175105176105177105178105179105180105181105182105183105184105185105186105187105188105189105190105191105192105193105194105195105196105197105198105199105200105201105202105203105204105205105206105207105208105209105210105211105212105213105214105215105216105217105218105219105220105221105222105223105224105225105226105227105228105229105230105231105232105233105234105235105236105237105238105239105240105241105242105243105244105245105246105247105248105249105250105251105252105253105254105255105256105257105258105259105260105261105262105263105264105265105266105267105268105269105270105271105272105273105274105275105276105277105278105279105280105281105282105283105284105285105286105287105288105289105290105291105292105293105294105295105296105297105298105299105300105301105302105303105304105305105306105307105308105309105310105311105312105313105314105315105316105317105318105319105320105321105322105323105324105325105326105327105328105329105330105331105332105333105334105335105336105337105338105339105340105341105342105343105344105345105346105347105348105349105350105351105352105353105354105355105356105357105358105359105360105361105362105363105364105365105366105367105368105369105370105371105372105373105374105375105376105377105378105379105380105381105382105383105384105385105386105387105388105389105390105391105392105393105394105395105396105397105398105399105400105401105402105403105404105405105406105407105408105409105410105411105412105413105414105415105416105417105418105419105420105421105422105423105424105425105426105427105428105429105430105431105432105433105434105435105436105437105438105439105440105441105442105443105444105445105446105447105448105449105450105451105452105453105454105455105456105457105458105459105460105461105462105463105464105465105466105467105468105469105470105471105472105473105474105475105476105477105478105479105480105481105482105483105484105485105486105487105488105489105490105491105492105493105494105495105496105497105498105499105500105501105502105503105504105505105506105507105508105509105510105511105512105513105514105515105516105517105518105519105520105521105522105523105524105525105526105527105528105529105530105531105532105533105534105535105536105537105538105539105540105541105542105543105544105545105546105547105548105549105550105551105552105553105554105555105556105557105558105559105560105561105562105563105564105565105566105567105568105569105570105571105572105573105574105575105576105577105578105579105580105581105582105583105584105585105586105587105588105589105590105591105592105593105594105595105596105597105598105599105600105601105602105603105604105605105606105607105608105609105610105611105612105613105614105615105616105617105618105619105620105621105622105623105624105625105626105627105628105629105630105631105632105633105634105635105636105637105638105639105640105641105642105643105644105645105646105647105648105649105650105651105652105653105654105655105656105657105658105659105660105661105662105663105664105665105666105667105668105669105670105671105672105673105674105675105676105677105678105679105680105681105682105683105684105685105686105687105688105689105690105691105692105693105694105695105696105697105698105699105700105701105702105703105704105705105706105707105708105709105710105711105712105713105714105715105716105717105718105719105720105721105722105723105724105725105726105727105728105729105730105731105732105733105734105735105736105737105738105739105740105741105742105743105744105745105746105747105748105749105750105751105752105753105754105755105756105757105758105759105760105761105762105763105764105765105766105767105768105769105770105771105772105773105774105775105776105777105778105779105780105781105782105783105784105785105786105787105788105789105790105791105792105793105794105795105796105797105798105799105800105801105802105803105804105805105806105807105808105809105810105811105812105813105814105815105816105817105818105819105820105821105822105823105824105825105826105827105828105829105830105831105832105833105834105835105836105837105838105839105840105841105842105843105844105845105846105847105848105849105850105851105852105853105854105855105856105857105858105859105860105861105862105863105864105865105866105867105868105869105870105871105872105873105874105875105876105877105878105879105880105881105882105883105884105885105886105887105888105889105890105891105892105893105894105895105896105897105898105899105900105901105902105903105904105905105906105907105908105909105910105911105912105913105914105915105916105917105918105919105920105921105922105923105924105925105926105927105928105929105930105931105932105933105934105935105936105937105938105939105940105941105942105943105944105945105946105947105948105949105950105951105952105953105954105955105956105957105958105959105960105961105962105963105964105965105966105967105968105969105970105971105972105973105974105975105976105977105978105979105980105981105982105983105984105985105986105987105988105989105990105991105992105993105994105995105996105997105998105999106000106001106002106003106004106005106006106007106008106009106010106011106012106013106014106015106016106017106018106019106020106021106022106023106024106025106026106027106028106029106030106031106032106033106034106035106036106037106038106039106040106041106042106043106044106045106046106047106048106049106050106051106052106053106054106055106056106057106058106059106060106061106062106063106064106065106066106067106068106069106070106071106072106073106074106075106076106077106078106079106080106081106082106083106084106085106086106087106088106089106090106091106092106093106094106095106096106097106098106099106100106101106102106103106104106105106106106107106108106109106110106111106112106113106114106115106116106117106118106119106120106121106122106123106124106125106126106127106128106129106130106131106132106133106134106135106136106137106138106139106140106141106142106143106144106145106146106147106148106149106150106151106152106153106154106155106156106157106158106159106160106161106162106163106164106165106166106167106168106169106170106171106172106173106174106175106176106177106178106179106180106181106182106183106184106185106186106187106188106189106190106191106192106193106194106195106196106197106198106199106200106201106202106203106204106205106206106207106208106209106210106211106212106213106214106215106216106217106218106219106220106221106222106223106224106225106226106227106228106229106230106231106232106233106234106235106236106237106238106239106240106241106242106243106244106245106246106247106248106249106250106251106252106253106254106255106256106257106258106259106260106261106262106263106264106265106266106267106268106269106270106271106272106273106274106275106276106277106278106279106280106281106282106283106284106285106286106287106288106289106290106291106292106293106294106295106296106297106298106299106300106301106302106303106304106305106306106307106308106309106310106311106312106313106314106315106316106317106318106319106320106321106322106323106324106325106326106327106328106329106330106331106332106333106334106335106336106337106338106339106340106341106342106343106344106345106346106347106348106349106350106351106352106353106354106355106356106357106358106359106360106361106362106363106364106365106366106367106368106369106370106371106372106373106374106375106376106377106378106379106380106381106382106383106384106385106386106387106388106389106390106391106392106393106394106395106396106397106398106399106400106401106402106403106404106405106406106407106408106409106410106411106412106413106414106415106416106417106418106419106420106421106422106423106424106425106426106427106428106429106430106431106432106433106434106435106436106437106438106439106440106441106442106443106444106445106446106447106448106449106450106451106452106453106454106455106456106457106458106459106460106461106462106463106464106465106466106467106468106469106470106471106472106473106474106475106476106477106478106479106480106481106482106483106484106485106486106487106488106489106490106491106492106493106494106495106496106497106498106499106500106501106502106503106504106505106506106507106508106509106510106511106512106513106514106515106516106517106518106519106520106521106522106523106524106525106526106527106528106529106530106531106532106533106534106535106536106537106538106539106540106541106542106543106544106545106546106547106548106549106550106551106552106553106554106555106556106557106558106559106560106561106562106563106564106565106566106567106568106569106570106571106572106573106574106575106576106577106578106579106580106581106582106583106584106585106586106587106588106589106590106591106592106593106594106595106596106597106598106599106600106601106602106603106604106605106606106607106608106609106610106611106612106613106614106615106616106617106618106619106620106621106622106623106624106625106626106627106628106629106630106631106632106633106634106635106636106637106638106639106640106641106642106643106644106645106646106647106648106649106650106651106652106653106654106655106656106657106658106659106660106661106662106663106664106665106666106667106668106669106670106671106672106673106674106675106676106677106678106679106680106681106682106683106684106685106686106687106688106689106690106691106692106693106694106695106696106697106698106699106700106701106702106703106704106705106706106707106708106709106710106711106712106713106714106715106716106717106718106719106720106721106722106723106724106725106726106727106728106729106730106731106732106733106734106735106736106737106738106739106740106741106742106743106744106745106746106747106748106749106750106751106752106753106754106755106756106757106758106759106760106761106762106763106764106765106766106767106768106769106770106771106772106773106774106775106776106777106778106779106780106781106782106783106784106785106786106787106788106789106790106791106792106793106794106795106796106797106798106799106800106801106802106803106804106805106806106807106808106809106810106811106812106813106814106815106816106817106818106819106820106821106822106823106824106825106826106827106828106829106830106831106832106833106834106835106836106837106838106839106840106841106842106843106844106845106846106847106848106849106850106851106852106853106854106855106856106857106858106859106860106861106862106863106864106865106866106867106868106869106870106871106872106873106874106875106876106877106878106879106880106881106882106883106884106885106886106887106888106889106890106891106892106893106894106895106896106897106898106899106900106901106902106903106904106905106906106907106908106909106910106911106912106913106914106915106916106917106918106919106920106921106922106923106924106925106926106927106928106929106930106931106932106933106934106935106936106937106938106939106940106941106942106943106944106945106946106947106948106949106950106951106952106953106954106955106956106957106958106959106960106961106962106963106964106965106966106967106968106969106970106971106972106973106974106975106976106977106978106979106980106981106982106983106984106985106986106987106988106989106990106991106992106993106994106995106996106997106998106999107000107001107002107003107004107005107006107007107008107009107010107011107012107013107014107015107016107017107018107019107020107021107022107023107024107025107026107027107028107029107030107031107032107033107034107035107036107037107038107039107040107041107042107043107044107045107046107047107048107049107050107051107052107053107054107055107056107057107058107059107060107061107062107063107064107065107066107067107068107069107070107071107072107073107074107075107076107077107078107079107080107081107082107083107084107085107086107087107088107089107090107091107092107093107094107095107096107097107098107099107100107101107102107103107104107105107106107107107108107109107110107111107112107113107114107115107116107117107118107119107120107121107122107123107124107125107126107127107128107129107130107131107132107133107134107135107136107137107138107139107140107141107142107143107144107145107146107147107148107149107150107151107152107153107154107155107156107157107158107159107160107161107162107163107164107165107166107167107168107169107170107171107172107173107174107175107176107177107178107179107180107181107182107183107184107185107186107187107188107189107190107191107192107193107194107195107196107197107198107199107200107201107202107203107204107205107206107207107208107209107210107211107212107213107214107215107216107217107218107219107220107221107222107223107224107225107226107227107228107229107230107231107232107233107234107235107236107237107238107239107240107241107242107243107244107245107246107247107248107249107250107251107252107253107254107255107256107257107258107259107260107261107262107263107264107265107266107267107268107269107270107271107272107273107274107275107276107277107278107279107280107281107282107283107284107285107286107287107288107289107290107291107292107293107294107295107296107297107298107299107300107301107302107303107304107305107306107307107308107309107310107311107312107313107314107315107316107317107318107319107320107321107322107323107324107325107326107327107328107329107330107331107332107333107334107335107336107337107338107339107340107341107342107343107344107345107346107347107348107349107350107351107352107353107354107355107356107357107358107359107360107361107362107363107364107365107366107367107368107369107370107371107372107373107374107375107376107377107378107379107380107381107382107383107384107385107386107387107388107389107390107391107392107393107394107395107396107397107398107399107400107401107402107403107404107405107406107407107408107409107410107411107412107413107414107415107416107417107418107419107420107421107422107423107424107425107426107427107428107429107430107431107432107433107434107435107436107437107438107439107440107441107442107443107444107445107446107447107448107449107450107451107452107453107454107455107456107457107458107459107460107461107462107463107464107465107466107467107468107469107470107471107472107473107474107475107476107477107478107479107480107481107482107483107484107485107486107487107488107489107490107491107492107493107494107495107496107497107498107499107500107501107502107503107504107505107506107507107508107509107510107511107512107513107514107515107516107517107518107519107520107521107522107523107524107525107526107527107528107529107530107531107532107533107534107535107536107537107538107539107540107541107542107543107544107545107546107547107548107549107550107551107552107553107554107555107556107557107558107559107560107561107562107563107564107565107566107567107568107569107570107571107572107573107574107575107576107577107578107579107580107581107582107583107584107585107586107587107588107589107590107591107592107593107594107595107596107597107598107599107600107601107602107603107604107605107606107607107608107609107610107611107612107613107614107615107616107617107618107619107620107621107622107623107624107625107626107627107628107629107630107631107632107633107634107635107636107637107638107639107640107641107642107643107644107645107646107647107648107649107650107651107652107653107654107655107656107657107658107659107660107661107662107663107664107665107666107667107668107669107670107671107672107673107674107675107676107677107678107679107680107681107682107683107684107685107686107687107688107689107690107691107692107693107694107695107696107697107698107699107700107701107702107703107704107705107706107707107708107709107710107711107712107713107714107715107716107717107718107719107720107721107722107723107724107725107726107727107728107729107730107731107732107733107734107735107736107737107738107739107740107741107742107743107744107745107746107747107748107749107750107751107752107753107754107755107756107757107758107759107760107761107762107763107764107765107766107767107768107769107770107771107772107773107774107775107776107777107778107779107780107781107782107783107784107785107786107787107788107789107790107791107792107793107794107795107796107797107798107799107800107801107802107803107804107805107806107807107808107809107810107811107812107813107814107815107816107817107818107819107820107821107822107823107824107825107826107827107828107829107830107831107832107833107834107835107836107837107838107839107840107841107842107843107844107845107846107847107848107849107850107851107852107853107854107855107856107857107858107859107860107861107862107863107864107865107866107867107868107869107870107871107872107873107874107875107876107877107878107879107880107881107882107883107884107885107886107887107888107889107890107891107892107893107894107895107896107897107898107899107900107901107902107903107904107905107906107907107908107909107910107911107912107913107914107915107916107917107918107919107920107921107922107923107924107925107926107927107928107929107930107931107932107933107934107935107936107937107938107939107940107941107942107943107944107945107946107947107948107949107950107951107952107953107954107955107956107957107958107959107960107961107962107963107964107965107966107967107968107969107970107971107972107973107974107975107976107977107978107979107980107981107982107983107984107985107986107987107988107989107990107991107992107993107994107995107996107997107998107999108000108001108002108003108004108005108006108007108008108009108010108011108012108013108014108015108016108017108018108019108020108021108022108023108024108025108026108027108028108029108030108031108032108033108034108035108036108037108038108039108040108041108042108043108044108045108046108047108048108049108050108051108052108053108054108055108056108057108058108059108060108061108062108063108064108065108066108067108068108069108070108071108072108073108074108075108076108077108078108079108080108081108082108083108084108085108086108087108088108089108090108091108092108093108094108095108096108097108098108099108100108101108102108103108104108105108106108107108108108109108110108111108112108113108114108115108116108117108118108119108120108121108122108123108124108125108126108127108128108129108130108131108132108133108134108135108136108137108138108139108140108141108142108143108144108145108146108147108148108149108150108151108152108153108154108155108156108157108158108159108160108161108162108163108164108165108166108167108168108169108170108171108172108173108174108175108176108177108178108179108180108181108182108183108184108185108186108187108188108189108190108191108192108193108194108195108196108197108198108199108200108201108202108203108204108205108206108207108208108209108210108211108212108213108214108215108216108217108218108219108220108221108222108223108224108225108226108227108228108229108230108231108232108233108234108235108236108237108238108239108240108241108242108243108244108245108246108247108248108249108250108251108252108253108254108255108256108257108258108259108260108261108262108263108264108265108266108267108268108269108270108271108272108273108274108275108276108277108278108279108280108281108282108283108284108285108286108287108288108289108290108291108292108293108294108295108296108297108298108299108300108301108302108303108304108305108306108307108308108309108310108311108312108313108314108315108316108317108318108319108320108321108322108323108324108325108326108327108328108329108330108331108332108333108334108335108336108337108338108339108340108341108342108343108344108345108346108347108348108349108350108351108352108353108354108355108356108357108358108359108360108361108362108363108364108365108366108367108368108369108370108371108372108373108374108375108376108377108378108379108380108381108382108383108384108385108386108387108388108389108390108391108392108393108394108395108396108397108398108399108400108401108402108403108404108405108406108407108408108409108410108411108412108413108414108415108416108417108418108419108420108421108422108423108424108425108426108427108428108429108430108431108432108433108434108435108436108437108438108439108440108441108442108443108444108445108446108447108448108449108450108451108452108453108454108455108456108457108458108459108460108461108462108463108464108465108466108467108468108469108470108471108472108473108474108475108476108477108478108479108480108481108482108483108484108485108486108487108488108489108490108491108492108493108494108495108496108497108498108499108500108501108502108503108504108505108506108507108508108509108510108511108512108513108514108515108516108517108518108519108520108521108522108523108524108525108526108527108528108529108530108531108532108533108534108535108536108537108538108539108540108541108542108543108544108545108546108547108548108549108550108551108552108553108554108555108556108557108558108559108560108561108562108563108564108565108566108567108568108569108570108571108572108573108574108575108576108577108578108579108580108581108582108583108584108585108586108587108588108589108590108591108592108593108594108595108596108597108598108599108600108601108602108603108604108605108606108607108608108609108610108611108612108613108614108615108616108617108618108619108620108621108622108623108624108625108626108627108628108629108630108631108632108633108634108635108636108637108638108639108640108641108642108643108644108645108646108647108648108649108650108651108652108653108654108655108656108657108658108659108660108661108662108663108664108665108666108667108668108669108670108671108672108673108674108675108676108677108678108679108680108681108682108683108684108685108686108687108688108689108690108691108692108693108694108695108696108697108698108699108700108701108702108703108704108705108706108707108708108709108710108711108712108713108714108715108716108717108718108719108720108721108722108723108724108725108726108727108728108729108730108731108732108733108734108735108736108737108738108739108740108741108742108743108744108745108746108747108748108749108750108751108752108753108754108755108756108757108758108759108760108761108762108763108764108765108766108767108768108769108770108771108772108773108774108775108776108777108778108779108780108781108782108783108784108785108786108787108788108789108790108791108792108793108794108795108796108797108798108799108800108801108802108803108804108805108806108807108808108809108810108811108812108813108814108815108816108817108818108819108820108821108822108823108824108825108826108827108828108829108830108831108832108833108834108835108836108837108838108839108840108841108842108843108844108845108846108847108848108849108850108851108852108853108854108855108856108857108858108859108860108861108862108863108864108865108866108867108868108869108870108871108872108873108874108875108876108877108878108879108880108881108882108883108884108885108886108887108888108889108890108891108892108893108894108895108896108897108898108899108900108901108902108903108904108905108906108907108908108909108910108911108912108913108914108915108916108917108918108919108920108921108922108923108924108925108926108927108928108929108930108931108932108933108934108935108936108937108938108939108940108941108942108943108944108945108946108947108948108949108950108951108952108953108954108955108956108957108958108959108960108961108962108963108964108965108966108967108968108969108970108971108972108973108974108975108976108977108978108979108980108981108982108983108984108985108986108987108988108989108990108991108992108993108994108995108996108997108998108999109000109001109002109003109004109005109006109007109008109009109010109011109012109013109014109015109016109017109018109019109020109021109022109023109024109025109026109027109028109029109030109031109032109033109034109035109036109037109038109039109040109041109042109043109044109045109046109047109048109049109050109051109052109053109054109055109056109057109058109059109060109061109062109063109064109065109066109067109068109069109070109071109072109073109074109075109076109077109078109079109080109081109082109083109084109085109086109087109088109089109090109091109092109093109094109095109096109097109098109099109100109101109102109103109104109105109106109107109108109109109110109111109112109113109114109115109116109117109118109119109120109121109122109123109124109125109126109127109128109129109130109131109132109133109134109135109136109137109138109139109140109141109142109143109144109145109146109147109148109149109150109151109152109153109154109155109156109157109158109159109160109161109162109163109164109165109166109167109168109169109170109171109172109173109174109175109176109177109178109179109180109181109182109183109184109185109186109187109188109189109190109191109192109193109194109195109196109197109198109199109200109201109202109203109204109205109206109207109208109209109210109211109212109213109214109215109216109217109218109219109220109221109222109223109224109225109226109227109228109229109230109231109232109233109234109235109236109237109238109239109240109241109242109243109244109245109246109247109248109249109250109251109252109253109254109255109256109257109258109259109260109261109262109263109264109265109266109267109268109269109270109271109272109273109274109275109276109277109278109279109280109281109282109283109284109285109286109287109288109289109290109291109292109293109294109295109296109297109298109299109300109301109302109303109304109305109306109307109308109309109310109311109312109313109314109315109316109317109318109319109320109321109322109323109324109325109326109327109328109329109330109331109332109333109334109335109336109337109338109339109340109341109342109343109344109345109346109347109348109349109350109351109352109353109354109355109356109357109358109359109360109361109362109363109364109365109366109367109368109369109370109371109372109373109374109375109376109377109378109379109380109381109382109383109384109385109386109387109388109389109390109391109392109393109394109395109396109397109398109399109400109401109402109403109404109405109406109407109408109409109410109411109412109413109414109415109416109417109418109419109420109421109422109423109424109425109426109427109428109429109430109431109432109433109434109435109436109437109438109439109440109441109442109443109444109445109446109447109448109449109450109451109452109453109454109455109456109457109458109459109460109461109462109463109464109465109466109467109468109469109470109471109472109473109474109475109476109477109478109479109480109481109482109483109484109485109486109487109488109489109490109491109492109493109494109495109496109497109498109499109500109501109502109503109504109505109506109507109508109509109510109511109512109513109514109515109516109517109518109519109520109521109522109523109524109525109526109527109528109529109530109531109532109533109534109535109536109537109538109539109540109541109542109543109544109545109546109547109548109549109550109551109552109553109554109555109556109557109558109559109560109561109562109563109564109565109566109567109568109569109570109571109572109573109574109575109576109577109578109579109580109581109582109583109584109585109586109587109588109589109590109591109592109593109594109595109596109597109598109599109600109601109602109603109604109605109606109607109608109609109610109611109612109613109614109615109616109617109618109619109620109621109622109623109624109625109626109627109628109629109630109631109632109633109634109635109636109637109638109639109640109641109642109643109644109645109646109647109648109649109650109651109652109653109654109655109656109657109658109659109660109661109662109663109664109665109666109667109668109669109670109671109672109673109674109675109676109677109678109679109680109681109682109683109684109685109686109687109688109689109690109691109692109693109694109695109696109697109698109699109700109701109702109703109704109705109706109707109708109709109710109711109712109713109714109715109716109717109718109719109720109721109722109723109724109725109726109727109728109729109730109731109732109733109734109735109736109737109738109739109740109741109742109743109744109745109746109747109748109749109750109751109752109753109754109755109756109757109758109759109760109761109762109763109764109765109766109767109768109769109770109771109772109773109774109775109776109777109778109779109780109781109782109783109784109785109786109787109788109789109790109791109792109793109794109795109796109797109798109799109800109801109802109803109804109805109806109807109808109809109810109811109812109813109814109815109816109817109818109819109820109821109822109823109824109825109826109827109828109829109830109831109832109833109834109835109836109837109838109839109840109841109842109843109844109845109846109847109848109849109850109851109852109853109854109855109856109857109858109859109860109861109862109863109864109865109866109867109868109869109870109871109872109873109874109875109876109877109878109879109880109881109882109883109884109885109886109887109888109889109890109891109892109893109894109895109896109897109898109899109900109901109902109903109904109905109906109907109908109909109910109911109912109913109914109915109916109917109918109919109920109921109922109923109924109925109926109927109928109929109930109931109932109933109934109935109936109937109938109939109940109941109942109943109944109945109946109947109948109949109950109951109952109953109954109955109956109957109958109959109960109961109962109963109964109965109966109967109968109969109970109971109972109973109974109975109976109977109978109979109980109981109982109983109984109985109986109987109988109989109990109991109992109993109994109995109996109997109998109999110000110001110002110003110004110005110006110007110008110009110010110011110012110013110014110015110016110017110018110019110020110021110022110023110024110025110026110027110028110029110030110031110032110033110034110035110036110037110038110039110040110041110042110043110044110045110046110047110048110049110050110051110052110053110054110055110056110057110058110059110060110061110062110063110064110065110066110067110068110069110070110071110072110073110074110075110076110077110078110079110080110081110082110083110084110085110086110087110088110089110090110091110092110093110094110095110096110097110098110099110100110101110102110103110104110105110106110107110108110109110110110111110112110113110114110115110116110117110118110119110120110121110122110123110124110125110126110127110128110129110130110131110132110133110134110135110136110137110138110139110140110141110142110143110144110145110146110147110148110149110150110151110152110153110154110155110156110157110158110159110160110161110162110163110164110165110166110167110168110169110170110171110172110173110174110175110176110177110178110179110180110181110182110183110184110185110186110187110188110189110190110191110192110193110194110195110196110197110198110199110200110201110202110203110204110205110206110207110208110209110210110211110212110213110214110215110216110217110218110219110220110221110222110223110224110225110226110227110228110229110230110231110232110233110234110235110236110237110238110239110240110241110242110243110244110245110246110247110248110249110250110251110252110253110254110255110256110257110258110259110260110261110262110263110264110265110266110267110268110269110270110271110272110273110274110275110276110277110278110279110280110281110282110283110284110285110286110287110288110289110290110291110292110293110294110295110296110297110298110299110300110301110302110303110304110305110306110307110308110309110310110311110312110313110314110315110316110317110318110319110320110321110322110323110324110325110326110327110328110329110330110331110332110333110334110335110336110337110338110339110340110341110342110343110344110345110346110347110348110349110350110351110352110353110354110355110356110357110358110359110360110361110362110363110364110365110366110367110368110369110370110371110372110373110374110375110376110377110378110379110380110381110382110383110384110385110386110387110388110389110390110391110392110393110394110395110396110397110398110399110400110401110402110403110404110405110406110407110408110409110410110411110412110413110414110415110416110417110418110419110420110421110422110423110424110425110426110427110428110429110430110431110432110433110434110435110436110437110438110439110440110441110442110443110444110445110446110447110448110449110450110451110452110453110454110455110456110457110458110459110460110461110462110463110464110465110466110467110468110469110470110471110472110473110474110475110476110477110478110479110480110481110482110483110484110485110486110487110488110489110490110491110492110493110494110495110496110497110498110499110500110501110502110503110504110505110506110507110508110509110510110511110512110513110514110515110516110517110518110519110520110521110522110523110524110525110526110527110528110529110530110531110532110533110534110535110536110537110538110539110540110541110542110543110544110545110546110547110548110549110550110551110552110553110554110555110556110557110558110559110560110561110562110563110564110565110566110567110568110569110570110571110572110573110574110575110576110577110578110579110580110581110582110583110584110585110586110587110588110589110590110591110592110593110594110595110596110597110598110599110600110601110602110603110604110605110606110607110608110609110610110611110612110613110614110615110616110617110618110619110620110621110622110623110624110625110626110627110628110629110630110631110632110633110634110635110636110637110638110639110640110641110642110643110644110645110646110647110648110649110650110651110652110653110654110655110656110657110658110659110660110661110662110663110664110665110666110667110668110669110670110671110672110673110674110675110676110677110678110679110680110681110682110683110684110685110686110687110688110689110690110691110692110693110694110695110696110697110698110699110700110701110702110703110704110705110706110707110708110709110710110711110712110713110714110715110716110717110718110719110720110721110722110723110724110725110726110727110728110729110730110731110732110733110734110735110736110737110738110739110740110741110742110743110744110745110746110747110748110749110750110751110752110753110754110755110756110757110758110759110760110761110762110763110764110765110766110767110768110769110770110771110772110773110774110775110776110777110778110779110780110781110782110783110784110785110786110787110788110789110790110791110792110793110794110795110796110797110798110799110800110801110802110803110804110805110806110807110808110809110810110811110812110813110814110815110816110817110818110819110820110821110822110823110824110825110826110827110828110829110830110831110832110833110834110835110836110837110838110839110840110841110842110843110844110845110846110847110848110849110850110851110852110853110854110855110856110857110858110859110860110861110862110863110864110865110866110867110868110869110870110871110872110873110874110875110876110877110878110879110880110881110882110883110884110885110886110887110888110889110890110891110892110893110894110895110896110897110898110899110900110901110902110903110904110905110906110907110908110909110910110911110912110913110914110915110916110917110918110919110920110921110922110923110924110925110926110927110928110929110930110931110932110933110934110935110936110937110938110939110940110941110942110943110944110945110946110947110948110949110950110951110952110953110954110955110956110957110958110959110960110961110962110963110964110965110966110967110968110969110970110971110972110973110974110975110976110977110978110979110980110981110982110983110984110985110986110987110988110989110990110991110992110993110994110995110996110997110998110999111000111001111002111003111004111005111006111007111008111009111010111011111012111013111014111015111016111017111018111019111020111021111022111023111024111025111026111027111028111029111030111031111032111033111034111035111036111037111038111039111040111041111042111043111044111045111046111047111048111049111050111051111052111053111054111055111056111057111058111059111060111061111062111063111064111065111066111067111068111069111070111071111072111073111074111075111076111077111078111079111080111081111082111083111084111085111086111087111088111089111090111091111092111093111094111095111096111097111098111099111100111101111102111103111104111105111106111107111108111109111110111111111112111113111114111115111116111117111118111119111120111121111122111123111124111125111126111127111128111129111130111131111132111133111134111135111136111137111138111139111140111141111142111143111144111145111146111147111148111149111150111151111152111153111154111155111156111157111158111159111160111161111162111163111164111165111166111167111168111169111170111171111172111173111174111175111176111177111178111179111180111181111182111183111184111185111186111187111188111189111190111191111192111193111194111195111196111197111198111199111200111201111202111203111204111205111206111207111208111209111210111211111212111213111214111215111216111217111218111219111220111221111222111223111224111225111226111227111228111229111230111231111232111233111234111235111236111237111238111239111240111241111242111243111244111245111246111247111248111249111250111251111252111253111254111255111256111257111258111259111260111261111262111263111264111265111266111267111268111269111270111271111272111273111274111275111276111277111278111279111280111281111282111283111284111285111286111287111288111289111290111291111292111293111294111295111296111297111298111299111300111301111302111303111304111305111306111307111308111309111310111311111312111313111314111315111316111317111318111319111320111321111322111323111324111325111326111327111328111329111330111331111332111333111334111335111336111337111338111339111340111341111342111343111344111345111346111347111348111349111350111351111352111353111354111355111356111357111358111359111360111361111362111363111364111365111366111367111368111369111370111371111372111373111374111375111376111377111378111379111380111381111382111383111384111385111386111387111388111389111390111391111392111393111394111395111396111397111398111399111400111401111402111403111404111405111406111407111408111409111410111411111412111413111414111415111416111417111418111419111420111421111422111423111424111425111426111427111428111429111430111431111432111433111434111435111436111437111438111439111440111441111442111443111444111445111446111447111448111449111450111451111452111453111454111455111456111457111458111459111460111461111462111463111464111465111466111467111468111469111470111471111472111473111474111475111476111477111478111479111480111481111482111483111484111485111486111487111488111489111490111491111492111493111494111495111496111497111498111499111500111501111502111503111504111505111506111507111508111509111510111511111512111513111514111515111516111517111518111519111520111521111522111523111524111525111526111527111528111529111530111531111532111533111534111535111536111537111538111539111540111541111542111543111544111545111546111547111548111549111550111551111552111553111554111555111556111557111558111559111560111561111562111563111564111565111566111567111568111569111570111571111572111573111574111575111576111577111578111579111580111581111582111583111584111585111586111587111588111589111590111591111592111593111594111595111596111597111598111599111600111601111602111603111604111605111606111607111608111609111610111611111612111613111614111615111616111617111618111619111620111621111622111623111624111625111626111627111628111629111630111631111632111633111634111635111636111637111638111639111640111641111642111643111644111645111646111647111648111649111650111651111652111653111654111655111656111657111658111659111660111661111662111663111664111665111666111667111668111669111670111671111672111673111674111675111676111677111678111679111680111681111682111683111684111685111686111687111688111689111690111691111692111693111694111695111696111697111698111699111700111701111702111703111704111705111706111707111708111709111710111711111712111713111714111715111716111717111718111719111720111721111722111723111724111725111726111727111728111729111730111731111732111733111734111735111736111737111738111739111740111741111742111743111744111745111746111747111748111749111750111751111752111753111754111755111756111757111758111759111760111761111762111763111764111765111766111767111768111769111770111771111772111773111774111775111776111777111778111779111780111781111782111783111784111785111786111787111788111789111790111791111792111793111794111795111796111797111798111799111800111801111802111803111804111805111806111807111808111809111810111811111812111813111814111815111816111817111818111819111820111821111822111823111824111825111826111827111828111829111830111831111832111833111834111835111836111837111838111839111840111841111842111843111844111845111846111847111848111849111850111851111852111853111854111855111856111857111858111859111860111861111862111863111864111865111866111867111868111869111870111871111872111873111874111875111876111877111878111879111880111881111882111883111884111885111886111887111888111889111890111891111892111893111894111895111896111897111898111899111900111901111902111903111904111905111906111907111908111909111910111911111912111913111914111915111916111917111918111919111920111921111922111923111924111925111926111927111928111929111930111931111932111933111934111935111936111937111938111939111940111941111942111943111944111945111946111947111948111949111950111951111952111953111954111955111956111957111958111959111960111961111962111963111964111965111966111967111968111969111970111971111972111973111974111975111976111977111978111979111980111981111982111983111984111985111986111987111988111989111990111991111992111993111994111995111996111997111998111999112000112001112002112003112004112005112006112007112008112009112010112011112012112013112014112015112016112017112018112019112020112021112022112023112024112025112026112027112028112029112030112031112032112033112034112035112036112037112038112039112040112041112042112043112044112045112046112047112048112049112050112051112052112053112054112055112056112057112058112059112060112061112062112063112064112065112066112067112068112069112070112071112072112073112074112075112076112077112078112079112080112081112082112083112084112085112086112087112088112089112090112091112092112093112094112095112096112097112098112099112100112101112102112103112104112105112106112107112108112109112110112111112112112113112114112115112116112117112118112119112120112121112122112123112124112125112126112127112128112129112130112131112132112133112134112135112136112137112138112139112140112141112142112143112144112145112146112147112148112149112150112151112152112153112154112155112156112157112158112159112160112161112162112163112164112165112166112167112168112169112170112171112172112173112174112175112176112177112178112179112180112181112182112183112184112185112186112187112188112189112190112191112192112193112194112195112196112197112198112199112200112201112202112203112204112205112206112207112208112209112210112211112212112213112214112215112216112217112218112219112220112221112222112223112224112225112226112227112228112229112230112231112232112233112234112235112236112237112238112239112240112241112242112243112244112245112246112247112248112249112250112251112252112253112254112255112256112257112258112259112260112261112262112263112264112265112266112267112268112269112270112271112272112273112274112275112276112277112278112279112280112281112282112283112284112285112286112287112288112289112290112291112292112293112294112295112296112297112298112299112300112301112302112303112304112305112306112307112308112309112310112311112312112313112314112315112316112317112318112319112320112321112322112323112324112325112326112327112328112329112330112331112332112333112334112335112336112337112338112339112340112341112342112343112344112345112346112347112348112349112350112351112352112353112354112355112356112357112358112359112360112361112362112363112364112365112366112367112368112369112370112371112372112373112374112375112376112377112378112379112380112381112382112383112384112385112386112387112388112389112390112391112392112393112394112395112396112397112398112399112400112401112402112403112404112405112406112407112408112409112410112411112412112413112414112415112416112417112418112419112420112421112422112423112424112425112426112427112428112429112430112431112432112433112434112435112436112437112438112439112440112441112442112443112444112445112446112447112448112449112450112451112452112453112454112455112456112457112458112459112460112461112462112463112464112465112466112467112468112469112470112471112472112473112474112475112476112477112478112479112480112481112482112483112484112485112486112487112488112489112490112491112492112493112494112495112496112497112498112499112500112501112502112503112504112505112506112507112508112509112510112511112512112513112514112515112516112517112518112519112520112521112522112523112524112525112526112527112528112529112530112531112532112533112534112535112536112537112538112539112540112541112542112543112544112545112546112547112548112549112550112551112552112553112554112555112556112557112558112559112560112561112562112563112564112565112566112567112568112569112570112571112572112573112574112575112576112577112578112579112580112581112582112583112584112585112586112587112588112589112590112591112592112593112594112595112596112597112598112599112600112601112602112603112604112605112606112607112608112609112610112611112612112613112614112615112616112617112618112619112620112621112622112623112624112625112626112627112628112629112630112631112632112633112634112635112636112637112638112639112640112641112642112643112644112645112646112647112648112649112650112651112652112653112654112655112656112657112658112659112660112661112662112663112664112665112666112667112668112669112670112671112672112673112674112675112676112677112678112679112680112681112682112683112684112685112686112687112688112689112690112691112692112693112694112695112696112697112698112699112700112701112702112703112704112705112706112707112708112709112710112711112712112713112714112715112716112717112718112719112720112721112722112723112724112725112726112727112728112729112730112731112732112733112734112735112736112737112738112739112740112741112742112743112744112745112746112747112748112749112750112751112752112753112754112755112756112757112758112759112760112761112762112763112764112765112766112767112768112769112770112771112772112773112774112775112776112777112778112779112780112781112782112783112784112785112786112787112788112789112790112791112792112793112794112795112796112797112798112799112800112801112802112803112804112805112806112807112808112809112810112811112812112813112814112815112816112817112818112819112820112821112822112823112824112825112826112827112828112829112830112831112832112833112834112835112836112837112838112839112840112841112842112843112844112845112846112847112848112849112850112851112852112853112854112855112856112857112858112859112860112861112862112863112864112865112866112867112868112869112870112871112872112873112874112875112876112877112878112879112880112881112882112883112884112885112886112887112888112889112890112891112892112893112894112895112896112897112898112899112900112901112902112903112904112905112906112907112908112909112910112911112912112913112914112915112916112917112918112919112920112921112922112923112924112925112926112927112928112929112930112931112932112933112934112935112936112937112938112939112940112941112942112943112944112945112946112947112948112949112950112951112952112953112954112955112956112957112958112959112960112961112962112963112964112965112966112967112968112969112970112971112972112973112974112975112976112977112978112979112980112981112982112983112984112985112986112987112988112989112990112991112992112993112994112995112996112997112998112999113000113001113002113003113004113005113006113007113008113009113010113011113012113013113014113015113016113017113018113019113020113021113022113023113024113025113026113027113028113029113030113031113032113033113034113035113036113037113038113039113040113041113042113043113044113045113046113047113048113049113050113051113052113053113054113055113056113057113058113059113060113061113062113063113064113065113066113067113068113069113070113071113072113073113074113075113076113077113078113079113080113081113082113083113084113085113086113087113088113089113090113091113092113093113094113095113096113097113098113099113100113101113102113103113104113105113106113107113108113109113110113111113112113113113114113115113116113117113118113119113120113121113122113123113124113125113126113127113128113129113130113131113132113133113134113135113136113137113138113139113140113141113142113143113144113145113146113147113148113149113150113151113152113153113154113155113156113157113158113159113160113161113162113163113164113165113166113167113168113169113170113171113172113173113174113175113176113177113178113179113180113181113182113183113184113185113186113187113188113189113190113191113192113193113194113195113196113197113198113199113200113201113202113203113204113205113206113207113208113209113210113211113212113213113214113215113216113217113218113219113220113221113222113223113224113225113226113227113228113229113230113231113232113233113234113235113236113237113238113239113240113241113242113243113244113245113246113247113248113249113250113251113252113253113254113255113256113257113258113259113260113261113262113263113264113265113266113267113268113269113270113271113272113273113274113275113276113277113278113279113280113281113282113283113284113285113286113287113288113289113290113291113292113293113294113295113296113297113298113299113300113301113302113303113304113305113306113307113308113309113310113311113312113313113314113315113316113317113318113319113320113321113322113323113324113325113326113327113328113329113330113331113332113333113334113335113336113337113338113339113340113341113342113343113344113345113346113347113348113349113350113351113352113353113354113355113356113357113358113359113360113361113362113363113364113365113366113367113368113369113370113371113372113373113374113375113376113377113378113379113380113381113382113383113384113385113386113387113388113389113390113391113392113393113394113395113396113397113398113399113400113401113402113403113404113405113406113407113408113409113410113411113412113413113414113415113416113417113418113419113420113421113422113423113424113425113426113427113428113429113430113431113432113433113434113435113436113437113438113439113440113441113442113443113444113445113446113447113448113449113450113451113452113453113454113455113456113457113458113459113460113461113462113463113464113465113466113467113468113469113470113471113472113473113474113475113476113477113478113479113480113481113482113483113484113485113486113487113488113489113490113491113492113493113494113495113496113497113498113499113500113501113502113503113504113505113506113507113508113509113510113511113512113513113514113515113516113517113518113519113520113521113522113523113524113525113526113527113528113529113530113531113532113533113534113535113536113537113538113539113540113541113542113543113544113545113546113547113548113549113550113551113552113553113554113555113556113557113558113559113560113561113562113563113564113565113566113567113568113569113570113571113572113573113574113575113576113577113578113579113580113581113582113583113584113585113586113587113588113589113590113591113592113593113594113595113596113597113598113599113600113601113602113603113604113605113606113607113608113609113610113611113612113613113614113615113616113617113618113619113620113621113622113623113624113625113626113627113628113629113630113631113632113633113634113635113636113637113638113639113640113641113642113643113644113645113646113647113648113649113650113651113652113653113654113655113656113657113658113659113660113661113662113663113664113665113666113667113668113669113670113671113672113673113674113675113676113677113678113679113680113681113682113683113684113685113686113687113688113689113690113691113692113693113694113695113696113697113698113699113700113701113702113703113704113705113706113707113708113709113710113711113712113713113714113715113716113717113718113719113720113721113722113723113724113725113726113727113728113729113730113731113732113733113734113735113736113737113738113739113740113741113742113743113744113745113746113747113748113749113750113751113752113753113754113755113756113757113758113759113760113761113762113763113764113765113766113767113768113769113770113771113772113773113774113775113776113777113778113779113780113781113782113783113784113785113786113787113788113789113790113791113792113793113794113795113796113797113798113799113800113801113802113803113804113805113806113807113808113809113810113811113812113813113814113815113816113817113818113819113820113821113822113823113824113825113826113827113828113829113830113831113832113833113834113835113836113837113838113839113840113841113842113843113844113845113846113847113848113849113850113851113852113853113854113855113856113857113858113859113860113861113862113863113864113865113866113867113868113869113870113871113872113873113874113875113876113877113878113879113880113881113882113883113884113885113886113887113888113889113890113891113892113893113894113895113896113897113898113899113900113901113902113903113904113905113906113907113908113909113910113911113912113913113914113915113916113917113918113919113920113921113922113923113924113925113926113927113928113929113930113931113932113933113934113935113936113937113938113939113940113941113942113943113944113945113946113947113948113949113950113951113952113953113954113955113956113957113958113959113960113961113962113963113964113965113966113967113968113969113970113971113972113973113974113975113976113977113978113979113980113981113982113983113984113985113986113987113988113989113990113991113992113993113994113995113996113997113998113999114000114001114002114003114004114005114006114007114008114009114010114011114012114013114014114015114016114017114018114019114020114021114022114023114024114025114026114027114028114029114030114031114032114033114034114035114036114037114038114039114040114041114042114043114044114045114046114047114048114049114050114051114052114053114054114055114056114057114058114059114060114061114062114063114064114065114066114067114068114069114070114071114072114073114074114075114076114077114078114079114080114081114082114083114084114085114086114087114088114089114090114091114092114093114094114095114096114097114098114099114100114101114102114103114104114105114106114107114108114109114110114111114112114113114114114115114116114117114118114119114120114121114122114123114124114125114126114127114128114129114130114131114132114133114134114135114136114137114138114139114140114141114142114143114144114145114146114147114148114149114150114151114152114153114154114155114156114157114158114159114160114161114162114163114164114165114166114167114168114169114170114171114172114173114174114175114176114177114178114179114180114181114182114183114184114185114186114187114188114189114190114191114192114193114194114195114196114197114198114199114200114201114202114203114204114205114206114207114208114209114210114211114212114213114214114215114216114217114218114219114220114221114222114223114224114225114226114227114228114229114230114231114232114233114234114235114236114237114238114239114240114241114242114243114244114245114246114247114248114249114250114251114252114253114254114255114256114257114258114259114260114261114262114263114264114265114266114267114268114269114270114271114272114273114274114275114276114277114278114279114280114281114282114283114284114285114286114287114288114289114290114291114292114293114294114295114296114297114298114299114300114301114302114303114304114305114306114307114308114309114310114311114312114313114314114315114316114317114318114319114320114321114322114323114324114325114326114327114328114329114330114331114332114333114334114335114336114337114338114339114340114341114342114343114344114345114346114347114348114349114350114351114352114353114354114355114356114357114358114359114360114361114362114363114364114365114366114367114368114369114370114371114372114373114374114375114376114377114378114379114380114381114382114383114384114385114386114387114388114389114390114391114392114393114394114395114396114397114398114399114400114401114402114403114404114405114406114407114408114409114410114411114412114413114414114415114416114417114418114419114420114421114422114423114424114425114426114427114428114429114430114431114432114433114434114435114436114437114438114439114440114441114442114443114444114445114446114447114448114449114450114451114452114453114454114455114456114457114458114459114460114461114462114463114464114465114466114467114468114469114470114471114472114473114474114475114476114477114478114479114480114481114482114483114484114485114486114487114488114489114490114491114492114493114494114495114496114497114498114499114500114501114502114503114504114505114506114507114508114509114510114511114512114513114514114515114516114517114518114519114520114521114522114523114524114525114526114527114528114529114530114531114532114533114534114535114536114537114538114539114540114541114542114543114544114545114546114547114548114549114550114551114552114553114554114555114556114557114558114559114560114561114562114563114564114565114566114567114568114569114570114571114572114573114574114575114576114577114578114579114580114581114582114583114584114585114586114587114588114589114590114591114592114593114594114595114596114597114598114599114600114601114602114603114604114605114606114607114608114609114610114611114612114613114614114615114616114617114618114619114620114621114622114623114624114625114626114627114628114629114630114631114632114633114634114635114636114637114638114639114640114641114642114643114644114645114646114647114648114649114650114651114652114653114654114655114656114657114658114659114660114661114662114663114664114665114666114667114668114669114670114671114672114673114674114675114676114677114678114679114680114681114682114683114684114685114686114687114688114689114690114691114692114693114694114695114696114697114698114699114700114701114702114703114704114705114706114707114708114709114710114711114712114713114714114715114716114717114718114719114720114721114722114723114724114725114726114727114728114729114730114731114732114733114734114735114736114737114738114739114740114741114742114743114744114745114746114747114748114749114750114751114752114753114754114755114756114757114758114759114760114761114762114763114764114765114766114767114768114769114770114771114772114773114774114775114776114777114778114779114780114781114782114783114784114785114786114787114788114789114790114791114792114793114794114795114796114797114798114799114800114801114802114803114804114805114806114807114808114809114810114811114812114813114814114815114816114817114818114819114820114821114822114823114824114825114826114827114828114829114830114831114832114833114834114835114836114837114838114839114840114841114842114843114844114845114846114847114848114849114850114851114852114853114854114855114856114857114858114859114860114861114862114863114864114865114866114867114868114869114870114871114872114873114874114875114876114877114878114879114880114881114882114883114884114885114886114887114888114889114890114891114892114893114894114895114896114897114898114899114900114901114902114903114904114905114906114907114908114909114910114911114912114913114914114915114916114917114918114919114920114921114922114923114924114925114926114927114928114929114930114931114932114933114934114935114936114937114938114939114940114941114942114943114944114945114946114947114948114949114950114951114952114953114954114955114956114957114958114959114960114961114962114963114964114965114966114967114968114969114970114971114972114973114974114975114976114977114978114979114980114981114982114983114984114985114986114987114988114989114990114991114992114993114994114995114996114997114998114999115000115001115002115003115004115005115006115007115008115009115010115011115012115013115014115015115016115017115018115019115020115021115022115023115024115025115026115027115028115029115030115031115032115033115034115035115036115037115038115039115040115041115042115043115044115045115046115047115048115049115050115051115052115053115054115055115056115057115058115059115060115061115062115063115064115065115066115067115068115069115070115071115072115073115074115075115076115077115078115079115080115081115082115083115084115085115086115087115088115089115090115091115092115093115094115095115096115097115098115099115100115101115102115103115104115105115106115107115108115109115110115111115112115113115114115115115116115117115118115119115120115121115122115123115124115125115126115127115128115129115130115131115132115133115134115135115136115137115138115139115140115141115142115143115144115145115146115147115148115149115150115151115152115153115154115155115156115157115158115159115160115161115162115163115164115165115166115167115168115169115170115171115172115173115174115175115176115177115178115179115180115181115182115183115184115185115186115187115188115189115190115191115192115193115194115195115196115197115198115199115200115201115202115203115204115205115206115207115208115209115210115211115212115213115214115215115216115217115218115219115220115221115222115223115224115225115226115227115228115229115230115231115232115233115234115235115236115237115238115239115240115241115242115243115244115245115246115247115248115249115250115251115252115253115254115255115256115257115258115259115260115261115262115263115264115265115266115267115268115269115270115271115272115273115274115275115276115277115278115279115280115281115282115283115284115285115286115287115288115289115290115291115292115293115294115295115296115297115298115299115300115301115302115303115304115305115306115307115308115309115310115311115312115313115314115315115316115317115318115319115320115321115322115323115324115325115326115327115328115329115330115331115332115333115334115335115336115337115338115339115340115341115342115343115344115345115346115347115348115349115350115351115352115353115354115355115356115357115358115359115360115361115362115363115364115365115366115367115368115369115370115371115372115373115374115375115376115377115378115379115380115381115382115383115384115385115386115387115388115389115390115391115392115393115394115395115396115397115398115399115400115401115402115403115404115405115406115407115408115409115410115411115412115413115414115415115416115417115418115419115420115421115422115423115424115425115426115427115428115429115430115431115432115433115434115435115436115437115438115439115440115441115442115443115444115445115446115447115448115449115450115451115452115453115454115455115456115457115458115459115460115461115462115463115464115465115466115467115468115469115470115471115472115473115474115475115476115477115478115479115480115481115482115483115484115485115486115487115488115489115490115491115492115493115494115495115496115497115498115499115500115501115502115503115504115505115506115507115508115509115510115511115512115513115514115515115516115517115518115519115520115521115522115523115524115525115526115527115528115529115530115531115532115533115534115535115536115537115538115539115540115541115542115543115544115545115546115547115548115549115550115551115552115553115554115555115556115557115558115559115560115561115562115563115564115565115566115567115568115569115570115571115572115573115574115575115576115577115578115579115580115581115582115583115584115585115586115587115588115589115590115591115592115593115594115595115596115597115598115599115600115601115602115603115604115605115606115607115608115609115610115611115612115613115614115615115616115617115618115619115620115621115622115623115624115625115626115627115628115629115630115631115632115633115634115635115636115637115638115639115640115641115642115643115644115645115646115647115648115649115650115651115652115653115654115655115656115657115658115659115660115661115662115663115664115665115666115667115668115669115670115671115672115673115674115675115676115677115678115679115680115681115682115683115684115685115686115687115688115689115690115691115692115693115694115695115696115697115698115699115700115701115702115703115704115705115706115707115708115709115710115711115712115713115714115715115716115717115718115719115720115721115722115723115724115725115726115727115728115729115730115731115732115733115734115735115736115737115738115739115740115741115742115743115744115745115746115747115748115749115750115751115752115753115754115755115756115757115758115759115760115761115762115763115764115765115766115767115768115769115770115771115772115773115774115775115776115777115778115779115780115781115782115783115784115785115786115787115788115789115790115791115792115793115794115795115796115797115798115799115800115801115802115803115804115805115806115807115808115809115810115811115812115813115814115815115816115817115818115819115820115821115822115823115824115825115826115827115828115829115830115831115832115833115834115835115836115837115838115839115840115841115842115843115844115845115846115847115848115849115850115851115852115853115854115855115856115857115858115859115860115861115862115863115864115865115866115867115868115869115870115871115872115873115874115875115876115877115878115879115880115881115882115883115884115885115886115887115888115889115890115891115892115893115894115895115896115897115898115899115900115901115902115903115904115905115906115907115908115909115910115911115912115913115914115915115916115917115918115919115920115921115922115923115924115925115926115927115928115929115930115931115932115933115934115935115936115937115938115939115940115941115942115943115944115945115946115947115948115949115950115951115952115953115954115955115956115957115958115959115960115961115962115963115964115965115966115967115968115969115970115971115972115973115974115975115976115977115978115979115980115981115982115983115984115985115986115987115988115989115990115991115992115993115994115995115996115997115998115999116000116001116002116003116004116005116006116007116008116009116010116011116012116013116014116015116016116017116018116019116020116021116022116023116024116025116026116027116028116029116030116031116032116033116034116035116036116037116038116039116040116041116042116043116044116045116046116047116048116049116050116051116052116053116054116055116056116057116058116059116060116061116062116063116064116065116066116067116068116069116070116071116072116073116074116075116076116077116078116079116080116081116082116083116084116085116086116087116088116089116090116091116092116093116094116095116096116097116098116099116100116101116102116103116104116105116106116107116108116109116110116111116112116113116114116115116116116117116118116119116120116121116122116123116124116125116126116127116128116129116130116131116132116133116134116135116136116137116138116139116140116141116142116143116144116145116146116147116148116149116150116151116152116153116154116155116156116157116158116159116160116161116162116163116164116165116166116167116168116169116170116171116172116173116174116175116176116177116178116179116180116181116182116183116184116185116186116187116188116189116190116191116192116193116194116195116196116197116198116199116200116201116202116203116204116205116206116207116208116209116210116211116212116213116214116215116216116217116218116219116220116221116222116223116224116225116226116227116228116229116230116231116232116233116234116235116236116237116238116239116240116241116242116243116244116245116246116247116248116249116250116251116252116253116254116255116256116257116258116259116260116261116262116263116264116265116266116267116268116269116270116271116272116273116274116275116276116277116278116279116280116281116282116283116284116285116286116287116288116289116290116291116292116293116294116295116296116297116298116299116300116301116302116303116304116305116306116307116308116309116310116311116312116313116314116315116316116317116318116319116320116321116322116323116324116325116326116327116328116329116330116331116332116333116334116335116336116337116338116339116340116341116342116343116344116345116346116347116348116349116350116351116352116353116354116355116356116357116358116359116360116361116362116363116364116365116366116367116368116369116370116371116372116373116374116375116376116377116378116379116380116381116382116383116384116385116386116387116388116389116390116391116392116393116394116395116396116397116398116399116400116401116402116403116404116405116406116407116408116409116410116411116412116413116414116415116416116417116418116419116420116421116422116423116424116425116426116427116428116429116430116431116432116433116434116435116436116437116438116439116440116441116442116443116444116445116446116447116448116449116450116451116452116453116454116455116456116457116458116459116460116461116462116463116464116465116466116467116468116469116470116471116472116473116474116475116476116477116478116479116480116481116482116483116484116485116486116487116488116489116490116491116492116493116494116495116496116497116498116499116500116501116502116503116504116505116506116507116508116509116510116511116512116513116514116515116516116517116518116519116520116521116522116523116524116525116526116527116528116529116530116531116532116533116534116535116536116537116538116539116540116541116542116543116544116545116546116547116548116549116550116551116552116553116554116555116556116557116558116559116560116561116562116563116564116565116566116567116568116569116570116571116572116573116574116575116576116577116578116579116580116581116582116583116584116585116586116587116588116589116590116591116592116593116594116595116596116597116598116599116600116601116602116603116604116605116606116607116608116609116610116611116612116613116614116615116616116617116618116619116620116621116622116623116624116625116626116627116628116629116630116631116632116633116634116635116636116637116638116639116640116641116642116643116644116645116646116647116648116649116650116651116652116653116654116655116656116657116658116659116660116661116662116663116664116665116666116667116668116669116670116671116672116673116674116675116676116677116678116679116680116681116682116683116684116685116686116687116688116689116690116691116692116693116694116695116696116697116698116699116700116701116702116703116704116705116706116707116708116709116710116711116712116713116714116715116716116717116718116719116720116721116722116723116724116725116726116727116728116729116730116731116732116733116734116735116736116737116738116739116740116741116742116743116744116745116746116747116748116749116750116751116752116753116754116755116756116757116758116759116760116761116762116763116764116765116766116767116768116769116770116771116772116773116774116775116776116777116778116779116780116781116782116783116784116785116786116787116788116789116790116791116792116793116794116795116796116797116798116799116800116801116802116803116804116805116806116807116808116809116810116811116812116813116814116815116816116817116818116819116820116821116822116823116824116825116826116827116828116829116830116831116832116833116834116835116836116837116838116839116840116841116842116843116844116845116846116847116848116849116850116851116852116853116854116855116856116857116858116859116860116861116862116863116864116865116866116867116868116869116870116871116872116873116874116875116876116877116878116879116880116881116882116883116884116885116886116887116888116889116890116891116892116893116894116895116896116897116898116899116900116901116902116903116904116905116906116907116908116909116910116911116912116913116914116915116916116917116918116919116920116921116922116923116924116925116926116927116928116929116930116931116932116933116934116935116936116937116938116939116940116941116942116943116944116945116946116947116948116949116950116951116952116953116954116955116956116957116958116959116960116961116962116963116964116965116966116967116968116969116970116971116972116973116974116975116976116977116978116979116980116981116982116983116984116985116986116987116988116989116990116991116992116993116994116995116996116997116998116999117000117001117002117003117004117005117006117007117008117009117010117011117012117013117014117015117016117017117018117019117020117021117022117023117024117025117026117027117028117029117030117031117032117033117034117035117036117037117038117039117040117041117042117043117044117045117046117047117048117049117050117051117052117053117054117055117056117057117058117059117060117061117062117063117064117065117066117067117068117069117070117071117072117073117074117075117076117077117078117079117080117081117082117083117084117085117086117087117088117089117090117091117092117093117094117095117096117097117098117099117100117101117102117103117104117105117106117107117108117109117110117111117112117113117114117115117116117117117118117119117120117121117122117123117124117125117126117127117128117129117130117131117132117133117134117135117136117137117138117139117140117141117142117143117144117145117146117147117148117149117150117151117152117153117154117155117156117157117158117159117160117161117162117163117164117165117166117167117168117169117170117171117172117173117174117175117176117177117178117179117180117181117182117183117184117185117186117187117188117189117190117191117192117193117194117195117196117197117198117199117200117201117202117203117204117205117206117207117208117209117210117211117212117213117214117215117216117217117218117219117220117221117222117223117224117225117226117227117228117229117230117231117232117233117234117235117236117237117238117239117240117241117242117243117244117245117246117247117248117249117250117251117252117253117254117255117256117257117258117259117260117261117262117263117264117265117266117267117268117269117270117271117272117273117274117275117276117277117278117279117280117281117282117283117284117285117286117287117288117289117290117291117292117293117294117295117296117297117298117299117300117301117302117303117304117305117306117307117308117309117310117311117312117313117314117315117316117317117318117319117320117321117322117323117324117325117326117327117328117329117330117331117332117333117334117335117336117337117338117339117340117341117342117343117344117345117346117347117348117349117350117351117352117353117354117355117356117357117358117359117360117361117362117363117364117365117366117367117368117369117370117371117372117373117374117375117376117377117378117379117380117381117382117383117384117385117386117387117388117389117390117391117392117393117394117395117396117397117398117399117400117401117402117403117404117405117406117407117408117409117410117411117412117413117414117415117416117417117418117419117420117421117422117423117424117425117426117427117428117429117430117431117432117433117434117435117436117437117438117439117440117441117442117443117444117445117446117447117448117449117450117451117452117453117454117455117456117457117458117459117460117461117462117463117464117465117466117467117468117469117470117471117472117473117474117475117476117477117478117479117480117481117482117483117484117485117486117487117488117489117490117491117492117493117494117495117496117497117498117499117500117501117502117503117504117505117506117507117508117509117510117511117512117513117514117515117516117517117518117519117520117521117522117523117524117525117526117527117528117529117530117531117532117533117534117535117536117537117538117539117540117541117542117543117544117545117546117547117548117549117550117551117552117553117554117555117556117557117558117559117560117561117562117563117564117565117566117567117568117569117570117571117572117573117574117575117576117577117578117579117580117581117582117583117584117585117586117587117588117589117590117591117592117593117594117595117596117597117598117599117600117601117602117603117604117605117606117607117608117609117610117611117612117613117614117615117616117617117618117619117620117621117622117623117624117625117626117627117628117629117630117631117632117633117634117635117636117637117638117639117640117641117642117643117644117645117646117647117648117649117650117651117652117653117654117655117656117657117658117659117660117661117662117663117664117665117666117667117668117669117670117671117672117673117674117675117676117677117678117679117680117681117682117683117684117685117686117687117688117689117690117691117692117693117694117695117696117697117698117699117700117701117702117703117704117705117706117707117708117709117710117711117712117713117714117715117716117717117718117719117720117721117722117723117724117725117726117727117728117729117730117731117732117733117734117735117736117737117738117739117740117741117742117743117744117745117746117747117748117749117750117751117752117753117754117755117756117757117758117759117760117761117762117763117764117765117766117767117768117769117770117771117772117773117774117775117776117777117778117779117780117781117782117783117784117785117786117787117788117789117790117791117792117793117794117795117796117797117798117799117800117801117802117803117804117805117806117807117808117809117810117811117812117813117814117815117816117817117818117819117820117821117822117823117824117825117826117827117828117829117830117831117832117833117834117835117836117837117838117839117840117841117842117843117844117845117846117847117848117849117850117851117852117853117854117855117856117857117858117859117860117861117862117863117864117865117866117867117868117869117870117871117872117873117874117875117876117877117878117879117880117881117882117883117884117885117886117887117888117889117890117891117892117893117894117895117896117897117898117899117900117901117902117903117904117905117906117907117908117909117910117911117912117913117914117915117916117917117918117919117920117921117922117923117924117925117926117927117928117929117930117931117932117933117934117935117936117937117938117939117940117941117942117943117944117945117946117947117948117949117950117951117952117953117954117955117956117957117958117959117960117961117962117963117964117965117966117967117968117969117970117971117972117973117974117975117976117977117978117979117980117981117982117983117984117985117986117987117988117989117990117991117992117993117994117995117996117997117998117999118000118001118002118003118004118005118006118007118008118009118010118011118012118013118014118015118016118017118018118019118020118021118022118023118024118025118026118027118028118029118030118031118032118033118034118035118036118037118038118039118040118041118042118043118044118045118046118047118048118049118050118051118052118053118054118055118056118057118058118059118060118061118062118063118064118065118066118067118068118069118070118071118072118073118074118075118076118077118078118079118080118081118082118083118084118085118086118087118088118089118090118091118092118093118094118095118096118097118098118099118100118101118102118103118104118105118106118107118108118109118110118111118112118113118114118115118116118117118118118119118120118121118122118123118124118125118126118127118128118129118130118131118132118133118134118135118136118137118138118139118140118141118142118143118144118145118146118147118148118149118150118151118152118153118154118155118156118157118158118159118160118161118162118163118164118165118166118167118168118169118170118171118172118173118174118175118176118177118178118179118180118181118182118183118184118185118186118187118188118189118190118191118192118193118194118195118196118197118198118199118200118201118202118203118204118205118206118207118208118209118210118211118212118213118214118215118216118217118218118219118220118221118222118223118224118225118226118227118228118229118230118231118232118233118234118235118236118237118238118239118240118241118242118243118244118245118246118247118248118249118250118251118252118253118254118255118256118257118258118259118260118261118262118263118264118265118266118267118268118269118270118271118272118273118274118275118276118277118278118279118280118281118282118283118284118285118286118287118288118289118290118291118292118293118294118295118296118297118298118299118300118301118302118303118304118305118306118307118308118309118310118311118312118313118314118315118316118317118318118319118320118321118322118323118324118325118326118327118328118329118330118331118332118333118334118335118336118337118338118339118340118341118342118343118344118345118346118347118348118349118350118351118352118353118354118355118356118357118358118359118360118361118362118363118364118365118366118367118368118369118370118371118372118373118374118375118376118377118378118379118380118381118382118383118384118385118386118387118388118389118390118391118392118393118394118395118396118397118398118399118400118401118402118403118404118405118406118407118408118409118410118411118412118413118414118415118416118417118418118419118420118421118422118423118424118425118426118427118428118429118430118431118432118433118434118435118436118437118438118439118440118441118442118443118444118445118446118447118448118449118450118451118452118453118454118455118456118457118458118459118460118461118462118463118464118465118466118467118468118469118470118471118472118473118474118475118476118477118478118479118480118481118482118483118484118485118486118487118488118489118490118491118492118493118494118495118496118497118498118499118500118501118502118503118504118505118506118507118508118509118510118511118512118513118514118515118516118517118518118519118520118521118522118523118524118525118526118527118528118529118530118531118532118533118534118535118536118537118538118539118540118541118542118543118544118545118546118547118548118549118550118551118552118553118554118555118556118557118558118559118560118561118562118563118564118565118566118567118568118569118570118571118572118573118574118575118576118577118578118579118580118581118582118583118584118585118586118587118588118589118590118591118592118593118594118595118596118597118598118599118600118601118602118603118604118605118606118607118608118609118610118611118612118613118614118615118616118617118618118619118620118621118622118623118624118625118626118627118628118629118630118631118632118633118634118635118636118637118638118639118640118641118642118643118644118645118646118647118648118649118650118651118652118653118654118655118656118657118658118659118660118661118662118663118664118665118666118667118668118669118670118671118672118673118674118675118676118677118678118679118680118681118682118683118684118685118686118687118688118689118690118691118692118693118694118695118696118697118698118699118700118701118702118703118704118705118706118707118708118709118710118711118712118713118714118715118716118717118718118719118720118721118722118723118724118725118726118727118728118729118730118731118732118733118734118735118736118737118738118739118740118741118742118743118744118745118746118747118748118749118750118751118752118753118754118755118756118757118758118759118760118761118762118763118764118765118766118767118768118769118770118771118772118773118774118775118776118777118778118779118780118781118782118783118784118785118786118787118788118789118790118791118792118793118794118795118796118797118798118799118800118801118802118803118804118805118806118807118808118809118810118811118812118813118814118815118816118817118818118819118820118821118822118823118824118825118826118827118828118829118830118831118832118833118834118835118836118837118838118839118840118841118842118843118844118845118846118847118848118849118850118851118852118853118854118855118856118857118858118859118860118861118862118863118864118865118866118867118868118869118870118871118872118873118874118875118876118877118878118879118880118881118882118883118884118885118886118887118888118889118890118891118892118893118894118895118896118897118898118899118900118901118902118903118904118905118906118907118908118909118910118911118912118913118914118915118916118917118918118919118920118921118922118923118924118925118926118927118928118929118930118931118932118933118934118935118936118937118938118939118940118941118942118943118944118945118946118947118948118949118950118951118952118953118954118955118956118957118958118959118960118961118962118963118964118965118966118967118968118969118970118971118972118973118974118975118976118977118978118979118980118981118982118983118984118985118986118987118988118989118990118991118992118993118994118995118996118997118998118999119000119001119002119003119004119005119006119007119008119009119010119011119012119013119014119015119016119017119018119019119020119021119022119023119024119025119026119027119028119029119030119031119032119033119034119035119036119037119038119039119040119041119042119043119044119045119046119047119048119049119050119051119052119053119054119055119056119057119058119059119060119061119062119063119064119065119066119067119068119069119070119071119072119073119074119075119076119077119078119079119080119081119082119083119084119085119086119087119088119089119090119091119092119093119094119095119096119097119098119099119100119101119102119103119104119105119106119107119108119109119110119111119112119113119114119115119116119117119118119119119120119121119122119123119124119125119126119127119128119129119130119131119132119133119134119135119136119137119138119139119140119141119142119143119144119145119146119147119148119149119150119151119152119153119154119155119156119157119158119159119160119161119162119163119164119165119166119167119168119169119170119171119172119173119174119175119176119177119178119179119180119181119182119183119184119185119186119187119188119189119190119191119192119193119194119195119196119197119198119199119200119201119202119203119204119205119206119207119208119209119210119211119212119213119214119215119216119217119218119219119220119221119222119223119224119225119226119227119228119229119230119231119232119233119234119235119236119237119238119239119240119241119242119243119244119245119246119247119248119249119250119251119252119253119254119255119256119257119258119259119260119261119262119263119264119265119266119267119268119269119270119271119272119273119274119275119276119277119278119279119280119281119282119283119284119285119286119287119288119289119290119291119292119293119294119295119296119297119298119299119300119301119302119303119304119305119306119307119308119309119310119311119312119313119314119315119316119317119318119319119320119321119322119323119324119325119326119327119328119329119330119331119332119333119334119335119336119337119338119339119340119341119342119343119344119345119346119347119348119349119350119351119352119353119354119355119356119357119358119359119360119361119362119363119364119365119366119367119368119369119370119371119372119373119374119375119376119377119378119379119380119381119382119383119384119385119386119387119388119389119390119391119392119393119394119395119396119397119398119399119400119401119402119403119404119405119406119407119408119409119410119411119412119413119414119415119416119417119418119419119420119421119422119423119424119425119426119427119428119429119430119431119432119433119434119435119436119437119438119439119440119441119442119443119444119445119446119447119448119449119450119451119452119453119454119455119456119457119458119459119460119461119462119463119464119465119466119467119468119469119470119471119472119473119474119475119476119477119478119479119480119481119482119483119484119485119486119487119488119489119490119491119492119493119494119495119496119497119498119499119500119501119502119503119504119505119506119507119508119509119510119511119512119513119514119515119516119517119518119519119520119521119522119523119524119525119526119527119528119529119530119531119532119533119534119535119536119537119538119539119540119541119542119543119544119545119546119547119548119549119550119551119552119553119554119555119556119557119558119559119560119561119562119563119564119565119566119567119568119569119570119571119572119573119574119575119576119577119578119579119580119581119582119583119584119585119586119587119588119589119590119591119592119593119594119595119596119597119598119599119600119601119602119603119604119605119606119607119608119609119610119611119612119613119614119615119616119617119618119619119620119621119622119623119624119625119626119627119628119629119630119631119632119633119634119635119636119637119638119639119640119641119642119643119644119645119646119647119648119649119650119651119652119653119654119655119656119657119658119659119660119661119662119663119664119665119666119667119668119669119670119671119672119673119674119675119676119677119678119679119680119681119682119683119684119685119686119687119688119689119690119691119692119693119694119695119696119697119698119699119700119701119702119703119704119705119706119707119708119709119710119711119712119713119714119715119716119717119718119719119720119721119722119723119724119725119726119727119728119729119730119731119732119733119734119735119736119737119738119739119740119741119742119743119744119745119746119747119748119749119750119751119752119753119754119755119756119757119758119759119760119761119762119763119764119765119766119767119768119769119770119771119772119773119774119775119776119777119778119779119780119781119782119783119784119785119786119787119788119789119790119791119792119793119794119795119796119797119798119799119800119801119802119803119804119805119806119807119808119809119810119811119812119813119814119815119816119817119818119819119820119821119822119823119824119825119826119827119828119829119830119831119832119833119834119835119836119837119838119839119840119841119842119843119844119845119846119847119848119849119850119851119852119853119854119855119856119857119858119859119860119861119862119863119864119865119866119867119868119869119870119871119872119873119874119875119876119877119878119879119880119881119882119883119884119885119886119887119888119889119890119891119892119893119894119895119896119897119898119899119900119901119902119903119904119905119906119907119908119909119910119911119912119913119914119915119916119917119918119919119920119921119922119923119924119925119926119927119928119929119930119931119932119933119934119935119936119937119938119939119940119941119942119943119944119945119946119947119948119949119950119951119952119953119954119955119956119957119958119959119960119961119962119963119964119965119966119967119968119969119970119971119972119973119974119975119976119977119978119979119980119981119982119983119984119985119986119987119988119989119990119991119992119993119994119995119996119997119998119999120000120001120002120003120004120005120006120007120008120009120010120011120012120013120014120015120016120017120018120019120020120021120022120023120024120025120026120027120028120029120030120031120032120033120034120035120036120037120038120039120040120041120042120043120044120045120046120047120048120049120050120051120052120053120054120055120056120057120058120059120060120061120062120063120064120065120066120067120068120069120070120071120072120073120074120075120076120077120078120079120080120081120082120083120084120085120086120087120088120089120090120091120092120093120094120095120096120097120098120099120100120101120102120103120104120105120106120107120108120109120110120111120112120113120114120115120116120117120118120119120120120121120122120123120124120125120126120127120128120129120130120131120132120133120134120135120136120137120138120139120140120141120142120143120144120145120146120147120148120149120150120151120152120153120154120155120156120157120158120159120160120161120162120163120164120165120166120167120168120169120170120171120172120173120174120175120176120177120178120179120180120181120182120183120184120185120186120187120188120189120190120191120192120193120194120195120196120197120198120199120200120201120202120203120204120205120206120207120208120209120210120211120212120213120214120215120216120217120218120219120220120221120222120223120224120225120226120227120228120229120230120231120232120233120234120235120236120237120238120239120240120241120242120243120244120245120246120247120248120249120250120251120252120253120254120255120256120257120258120259120260120261120262120263120264120265120266120267120268120269120270120271120272120273120274120275120276120277120278120279120280120281120282120283120284120285120286120287120288120289120290120291120292120293120294120295120296120297120298120299120300120301120302120303120304120305120306120307120308120309120310120311120312120313120314120315120316120317120318120319120320120321120322120323120324120325120326120327120328120329120330120331120332120333120334120335120336120337120338120339120340120341120342120343120344120345120346120347120348120349120350120351120352120353120354120355120356120357120358120359120360120361120362120363120364120365120366120367120368120369120370120371120372120373120374120375120376120377120378120379120380120381120382120383120384120385120386120387120388120389120390120391120392120393120394120395120396120397120398120399120400120401120402120403120404120405120406120407120408120409120410120411120412120413120414120415120416120417120418120419120420120421120422120423120424120425120426120427120428120429120430120431120432120433120434120435120436120437120438120439120440120441120442120443120444120445120446120447120448120449120450120451120452120453120454120455120456120457120458120459120460120461120462120463120464120465120466120467120468120469120470120471120472120473120474120475120476120477120478120479120480120481120482120483120484120485120486120487120488120489120490120491120492120493120494120495120496120497120498120499120500120501120502120503120504120505120506120507120508120509120510120511120512120513120514120515120516120517120518120519120520120521120522120523120524120525120526120527120528120529120530120531120532120533120534120535120536120537120538120539120540120541120542120543120544120545120546120547120548120549120550120551120552120553120554120555120556120557120558120559120560120561120562120563120564120565120566120567120568120569120570120571120572120573120574120575120576120577120578120579120580120581120582120583120584120585120586120587120588120589120590120591120592120593120594120595120596120597120598120599120600120601120602120603120604120605120606120607120608120609120610120611120612120613120614120615120616120617120618120619120620120621120622120623120624120625120626120627120628120629120630120631120632120633120634120635120636120637120638120639120640120641120642120643120644120645120646120647120648120649120650120651120652120653120654120655120656120657120658120659120660120661120662120663120664120665120666120667120668120669120670120671120672120673120674120675120676120677120678120679120680120681120682120683120684120685120686120687120688120689120690120691120692120693120694120695120696120697120698120699120700120701120702120703120704120705120706120707120708120709120710120711120712120713120714120715120716120717120718120719120720120721120722120723120724120725120726120727120728120729120730120731120732120733120734120735120736120737120738120739120740120741120742120743120744120745120746120747120748120749120750120751120752120753120754120755120756120757120758120759120760120761120762120763120764120765120766120767120768120769120770120771120772120773120774120775120776120777120778120779120780120781120782120783120784120785120786120787120788120789120790120791120792120793120794120795120796120797120798120799120800120801120802120803120804120805120806120807120808120809120810120811120812120813120814120815120816120817120818120819120820120821120822120823120824120825120826120827120828120829120830120831120832120833120834120835120836120837120838120839120840120841120842120843120844120845120846120847120848120849120850120851120852120853120854120855120856120857120858120859120860120861120862120863120864120865120866120867120868120869120870120871120872120873120874120875120876120877120878120879120880120881120882120883120884120885120886120887120888120889120890120891120892120893120894120895120896120897120898120899120900120901120902120903120904120905120906120907120908120909120910120911120912120913120914120915120916120917120918120919120920120921120922120923120924120925120926120927120928120929120930120931120932120933120934120935120936120937120938120939120940120941120942120943120944120945120946120947120948120949120950120951120952120953120954120955120956120957120958120959120960120961120962120963120964120965120966120967120968120969120970120971120972120973120974120975120976120977120978120979120980120981120982120983120984120985120986120987120988120989120990120991120992120993120994120995120996120997120998120999121000121001121002121003121004121005121006121007121008121009121010121011121012121013121014121015121016121017121018121019121020121021121022121023121024121025121026121027121028121029121030121031121032121033121034121035121036121037121038121039121040121041121042121043121044121045121046121047121048121049121050121051121052121053121054121055121056121057121058121059121060121061121062121063121064121065121066121067121068121069121070121071121072121073121074121075121076121077121078121079121080121081121082121083121084121085121086121087121088121089121090121091121092121093121094121095121096121097121098121099121100121101121102121103121104121105121106121107121108121109121110121111121112121113121114121115121116121117121118121119121120121121121122121123121124121125121126121127121128121129121130121131121132121133121134121135121136121137121138121139121140121141121142121143121144121145121146121147121148121149121150121151121152121153121154121155121156121157121158121159121160121161121162121163121164121165121166121167121168121169121170121171121172121173121174121175121176121177121178121179121180121181121182121183121184121185121186121187121188121189121190121191121192121193121194121195121196121197121198121199121200121201121202121203121204121205121206121207121208121209121210121211121212121213121214121215121216121217121218121219121220121221121222121223121224121225121226121227121228121229121230121231121232121233121234121235121236121237121238121239121240121241121242121243121244121245121246121247121248121249121250121251121252121253121254121255121256121257121258121259121260121261121262121263121264121265121266121267121268121269121270121271121272121273121274121275121276121277121278121279121280121281121282121283121284121285121286121287121288121289121290121291121292121293121294121295121296121297121298121299121300121301121302121303121304121305121306121307121308121309121310121311121312121313121314121315121316121317121318121319121320121321121322121323121324121325121326121327121328121329121330121331121332121333121334121335121336121337121338121339121340121341121342121343121344121345121346121347121348121349121350121351121352121353121354121355121356121357121358121359121360121361121362121363121364121365121366121367121368121369121370121371121372121373121374121375121376121377121378121379121380121381121382121383121384121385121386121387121388121389121390121391121392121393121394121395121396121397121398121399121400121401121402121403121404121405121406121407121408121409121410121411121412121413121414121415121416121417121418121419121420121421121422121423121424121425121426121427121428121429121430121431121432121433121434121435121436121437121438121439121440121441121442121443121444121445121446121447121448121449121450121451121452121453121454121455121456121457121458121459121460121461121462121463121464121465121466121467121468121469121470121471121472121473121474121475121476121477121478121479121480121481121482121483121484121485121486121487121488121489121490121491121492121493121494121495121496121497121498121499121500121501121502121503121504121505121506121507121508121509121510121511121512121513121514121515121516121517121518121519121520121521121522121523121524121525121526121527121528121529121530121531121532121533121534121535121536121537121538121539121540121541121542121543121544121545121546121547121548121549121550121551121552121553121554121555121556121557121558121559121560121561121562121563121564121565121566121567121568121569121570121571121572121573121574121575121576121577121578121579121580121581121582121583121584121585121586121587121588121589121590121591121592121593121594121595121596121597121598121599121600121601121602121603121604121605121606121607121608121609121610121611121612121613121614121615121616121617121618121619121620121621121622121623121624121625121626121627121628121629121630121631121632121633121634121635121636121637121638121639121640121641121642121643121644121645121646121647121648121649121650121651121652121653121654121655121656121657121658121659121660121661121662121663121664121665121666121667121668121669121670121671121672121673121674121675121676121677121678121679121680121681121682121683121684121685121686121687121688121689121690121691121692121693121694121695121696121697121698121699121700121701121702121703121704121705121706121707121708121709121710121711121712121713121714121715121716121717121718121719121720121721121722121723121724121725121726121727121728121729121730121731121732121733121734121735121736121737121738121739121740121741121742121743121744121745121746121747121748121749121750121751121752121753121754121755121756121757121758121759121760121761121762121763121764121765121766121767121768121769121770121771121772121773121774121775121776121777121778121779121780121781121782121783121784121785121786121787121788121789121790121791121792121793121794121795121796121797121798121799121800121801121802
  1. var __defProp = Object.defineProperty;
  2. var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  3. var __publicField = (obj, key, value) => {
  4. __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
  5. return value;
  6. };
  7. import { getCurrentScope, onScopeDispose, unref, getCurrentInstance, onMounted, nextTick, ref, readonly, watch, openBlock, createElementBlock, createElementVNode, warn, computed as computed$1, watchEffect, onBeforeUnmount, inject, isRef, shallowRef, onBeforeMount, provide, defineComponent, renderSlot, mergeProps, toRef, onUnmounted, useAttrs as useAttrs$1, useSlots, withDirectives, createCommentVNode, Fragment, normalizeClass, createBlock, withCtx, resolveDynamicComponent, withModifiers, createVNode, toDisplayString, normalizeStyle, vShow, Transition, reactive, onUpdated, cloneVNode, Text as Text$1, Comment as Comment$1, Teleport, onDeactivated, vModelRadio, createTextVNode, toRefs, toHandlers, withKeys, renderList, h, createSlots, toRaw as toRaw$1, triggerRef, resolveComponent, resolveDirective, vModelText, defineCustomElement } from "vue";
  8. const CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz".split("");
  9. class Util {
  10. static uuid(prefix = "D") {
  11. let uuid = [];
  12. uuid[8] = uuid[13] = uuid[18] = uuid[23] = "-";
  13. uuid[14] = "4";
  14. let r2;
  15. for (let i2 = 0; i2 < 36; i2++) {
  16. if (!uuid[i2]) {
  17. r2 = 0 | Math.random() * 16;
  18. uuid[i2] = CHARS[i2 == 19 ? r2 & 3 | 8 : r2];
  19. }
  20. }
  21. return prefix + "-" + uuid.join("");
  22. }
  23. static merge(dest, ...sources) {
  24. let i2, j, len, src;
  25. for (j = 0, len = sources.length; j < len; j++) {
  26. src = sources[j];
  27. for (i2 in src) {
  28. dest[i2] = src[i2];
  29. }
  30. }
  31. return dest;
  32. }
  33. static trim(str) {
  34. return str.trim ? str.trim() : str.replace(/^\s+|\s+$/g, "");
  35. }
  36. static splitWords(str) {
  37. return this.trim(str).split(/\s+/);
  38. }
  39. static setOptions(obj, options2) {
  40. if (!obj.hasOwnProperty("options")) {
  41. obj.options = obj.options ? create(obj.options) : {};
  42. }
  43. for (var i2 in options2) {
  44. obj.options[i2] = options2[i2];
  45. }
  46. return obj.options;
  47. }
  48. static checkPosition(position2) {
  49. return position2 && position2.hasOwnProperty("_lng") && position2.hasOwnProperty("_lat") && position2.hasOwnProperty("_alt");
  50. }
  51. static checkPositions(positions) {
  52. return positions && (typeof positions === "string" || Array.isArray(positions));
  53. }
  54. static checkViewer(viewer2) {
  55. return viewer2 && viewer2.delegate && viewer2.canvas;
  56. }
  57. }
  58. class DomUtil {
  59. static get(id) {
  60. return typeof id === "string" ? document.getElementById(id) : id;
  61. }
  62. static getStyle(el, style) {
  63. var value = el.style[style] || el.currentStyle && el.currentStyle[style];
  64. if ((!value || value === "auto") && document.defaultView) {
  65. var css = document.defaultView.getComputedStyle(el, null);
  66. value = css ? css[style] : null;
  67. }
  68. return value === "auto" ? null : value;
  69. }
  70. static create(tagName, className, container) {
  71. var el = document.createElement(tagName);
  72. el.className = className || "";
  73. if (container) {
  74. container.appendChild(el);
  75. }
  76. return el;
  77. }
  78. static remove(el) {
  79. var parent = el.parentNode;
  80. if (parent) {
  81. parent.removeChild(el);
  82. }
  83. }
  84. static empty(el) {
  85. while (el.firstChild) {
  86. el.removeChild(el.firstChild);
  87. }
  88. }
  89. hasClass(el, name) {
  90. if (el.classList !== void 0) {
  91. return el.classList.contains(name);
  92. }
  93. var className = getClass(el);
  94. return className.length > 0 && new RegExp("(^|\\s)" + name + "(\\s|$)").test(className);
  95. }
  96. static addClass(el, name) {
  97. if (el.classList !== void 0) {
  98. let classes = Util.splitWords(name);
  99. for (let i2 = 0, len = classes.length; i2 < len; i2++) {
  100. el.classList.add(classes[i2]);
  101. }
  102. } else if (!this.hasClass(el, name)) {
  103. let className = this.getClass(el);
  104. this.setClass(el, (className ? className + " " : "") + name);
  105. }
  106. }
  107. static removeClass(el, name) {
  108. if (el.classList !== void 0) {
  109. el.classList.remove(name);
  110. } else {
  111. this.setClass(
  112. el,
  113. Util.trim(
  114. (" " + this.getClass(el) + " ").replace(" " + name + " ", " ")
  115. )
  116. );
  117. }
  118. }
  119. static setClass(el, name) {
  120. if (el.className.baseVal === void 0) {
  121. el.className = name;
  122. } else {
  123. el.className.baseVal = name;
  124. }
  125. }
  126. static getClass(el) {
  127. if (el.correspondingElement) {
  128. el = el.correspondingElement;
  129. }
  130. return el.className.baseVal === void 0 ? el.className : el.className.baseVal;
  131. }
  132. static createSvg(width2, height2, path, container) {
  133. let svg = document.createElementNS("http://www.w3.org/2000/svg", "svg:svg");
  134. svg.setAttribute("class", "svg-path");
  135. svg.setAttribute("width", width2);
  136. svg.setAttribute("height", height2);
  137. svg.setAttribute("viewBox", `0 0 ${width2} ${height2}`);
  138. let pathEl = document.createElementNS("http://www.w3.org/2000/svg", "path");
  139. pathEl.setAttribute("d", path);
  140. svg.appendChild(pathEl);
  141. if (container) {
  142. container.appendChild(svg);
  143. }
  144. return svg;
  145. }
  146. }
  147. var StatusBar$1 = "";
  148. class StatusBar {
  149. constructor(viewer2) {
  150. if (!viewer2)
  151. throw new Error("viewer is required!");
  152. this._viewer = viewer2;
  153. this._show = false;
  154. this._handler;
  155. this._posX;
  156. this._posY;
  157. this._posZ;
  158. this._cameraHeight;
  159. this._pitch;
  160. this._heading;
  161. this._scale;
  162. this.initListener();
  163. }
  164. get params() {
  165. return {
  166. posX: this._posX,
  167. posY: this._posY,
  168. posZ: this._posZ,
  169. cameraHeight: this._cameraHeight,
  170. pitch: this._pitch,
  171. heading: this._heading,
  172. scale: this._scale
  173. };
  174. }
  175. get statusDom() {
  176. let innerHtml = `
  177. <span class="status-scale">
  178. \u6BD4\u4F8B\u5C3A\uFF1A
  179. <span class="scale-border">
  180. ${this._scale}
  181. </span>
  182. </span>
  183. <span class="status-position">
  184. <span id="status_spaceInfo">\u7A7A\u95F4\u4FE1\u606F</span>
  185. \u5237\u5E27\u7387\uFF1A<span id="status_ms"></span>|<span id="status_fps"></span>
  186. </span>
  187. `;
  188. return innerHtml;
  189. }
  190. get show() {
  191. return this._show;
  192. }
  193. set show(bool) {
  194. bool ? this.createStatusBar() : this.removeStatusBar();
  195. this._show = bool;
  196. }
  197. initListener() {
  198. const $this = this;
  199. const scene = this._viewer.scene;
  200. this._scaleListener = function() {
  201. let width2 = scene.canvas.clientWidth;
  202. let height2 = scene.canvas.clientHeight;
  203. let left = scene.camera.getPickRay(
  204. new Cesium.Cartesian2(width2 / 2 | 0, height2 - 1)
  205. );
  206. let right = scene.camera.getPickRay(
  207. new Cesium.Cartesian2(1 + width2 / 2 | 0, height2 - 1)
  208. );
  209. let globe = scene.globe;
  210. let leftPosition = globe.pick(left, scene);
  211. let rightPosition = globe.pick(right, scene);
  212. if (leftPosition && rightPosition) {
  213. let geodesic = new Cesium.EllipsoidGeodesic();
  214. let leftCartographic = globe.ellipsoid.cartesianToCartographic(leftPosition);
  215. let rightCartographic = globe.ellipsoid.cartesianToCartographic(rightPosition);
  216. geodesic.setEndPoints(leftCartographic, rightCartographic);
  217. let distance2 = geodesic.surfaceDistance;
  218. let curScaleNum = $this.closest(distance2 / 10);
  219. if (curScaleNum < 1) {
  220. $this._scale = curScaleNum * 1e3 + "m";
  221. } else {
  222. $this._scale = curScaleNum + "km";
  223. }
  224. }
  225. document.getElementsByClassName("scale-border")[0].innerText = $this._scale;
  226. if (document.getElementsByClassName("cesium-performanceDisplay-ms").length > 0) {
  227. document.getElementById("status_ms").innerText = document.getElementsByClassName("cesium-performanceDisplay-ms")[0].innerText;
  228. }
  229. if (document.getElementsByClassName("cesium-performanceDisplay-fps").length > 0) {
  230. document.getElementById("status_fps").innerText = document.getElementsByClassName("cesium-performanceDisplay-fps")[0].innerText;
  231. }
  232. };
  233. }
  234. createStatusBar() {
  235. const _delegate = this._viewer;
  236. this.initHandler(_delegate);
  237. this.initScale(_delegate, true);
  238. this._domContainer = DomUtil.create(
  239. "div",
  240. "lk-status-bar",
  241. document.getElementById(this._viewer._container.id)
  242. );
  243. this._domContainer.innerHTML = this.statusDom;
  244. }
  245. removeStatusBar() {
  246. this.initScale(this._viewer, false);
  247. if (this._handler) {
  248. this._handler.destroy();
  249. }
  250. if (this._domContainer) {
  251. DomUtil.remove(this._domContainer);
  252. }
  253. }
  254. initHandler(viewer2) {
  255. const $this = this;
  256. this._handler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  257. const mouseOverHandler = function(movement) {
  258. let loc2 = $this._getScreenClickPositionAndHeight(movement.endPosition);
  259. if (!Cesium.defined(loc2))
  260. return;
  261. if (!loc2.lng)
  262. return;
  263. $this._posX = loc2.lng.toFixed(8);
  264. $this._posY = loc2.lat.toFixed(8);
  265. $this._posZ = loc2.height.toFixed(2);
  266. document.getElementById("status_spaceInfo").innerHTML = `
  267. <span>\u7ECF\u5EA6\uFF1A${$this._posX}</span>
  268. <span>\u7EAC\u5EA6\uFF1A${$this._posY}</span>
  269. <span>\u9AD8\u5EA6\uFF1A${$this._posZ}</span>
  270. `;
  271. };
  272. this._handler.setInputAction(
  273. mouseOverHandler,
  274. Cesium.ScreenSpaceEventType.MOUSE_MOVE
  275. );
  276. }
  277. initScale(viewer2, bool) {
  278. const scene = viewer2.scene;
  279. bool ? scene.postRender.addEventListener(this._scaleListener) : scene.postRender.removeEventListener(this._scaleListener);
  280. }
  281. closest(num) {
  282. const scaleList = [
  283. 1e-3,
  284. 2e-3,
  285. 3e-3,
  286. 5e-3,
  287. 0.01,
  288. 0.015,
  289. 0.02,
  290. 0.025,
  291. 0.03,
  292. 0.035,
  293. 0.04,
  294. 0.045,
  295. 0.05,
  296. 0.06,
  297. 0.07,
  298. 0.08,
  299. 0.09,
  300. 0.1,
  301. 0.12,
  302. 0.15,
  303. 0.2,
  304. 0.25,
  305. 0.3,
  306. 0.5,
  307. 1,
  308. 2,
  309. 3,
  310. 5,
  311. 10,
  312. 15,
  313. 20,
  314. 25,
  315. 30,
  316. 35,
  317. 40,
  318. 45,
  319. 50,
  320. 60,
  321. 70,
  322. 80,
  323. 90,
  324. 100,
  325. 120,
  326. 150,
  327. 200,
  328. 250,
  329. 300,
  330. 500,
  331. 1e3,
  332. 2e3,
  333. 5e3,
  334. 1e4,
  335. 1e5,
  336. 5e5,
  337. 1e6
  338. ];
  339. let ret = scaleList[0];
  340. let distance2 = Math.abs(ret - num);
  341. for (let i2 = 1; i2 < scaleList.length; i2++) {
  342. let newDistance = Math.abs(scaleList[i2] - num);
  343. if (newDistance < distance2) {
  344. distance2 = newDistance;
  345. ret = scaleList[i2];
  346. }
  347. }
  348. return ret;
  349. }
  350. _getScreenClickPositionAndHeight(screenPoint) {
  351. var lng = void 0, lat = void 0, height2 = void 0;
  352. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  353. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  354. if (position2) {
  355. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  356. cartographic = Cesium.Cartographic.fromCartesian(position2);
  357. var feature2 = this._viewer.scene.pick(screenPoint);
  358. if (feature2 === void 0 && Cesium.defined(cartographic)) {
  359. lng = this._arcToDegree(cartographic.longitude);
  360. lat = this._arcToDegree(cartographic.latitude);
  361. height2 = cartographic.height;
  362. } else {
  363. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  364. if (Cesium.defined(cartesian)) {
  365. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  366. if (Cesium.defined(cartographic)) {
  367. lng = this._arcToDegree(cartographic.longitude);
  368. lat = this._arcToDegree(cartographic.latitude);
  369. height2 = cartographic.height;
  370. }
  371. }
  372. }
  373. }
  374. return {
  375. lng,
  376. lat,
  377. height: height2
  378. };
  379. }
  380. _arcToDegree(arc) {
  381. return arc / Math.PI * 180;
  382. }
  383. }
  384. var base = "";
  385. class jtMap3d {
  386. constructor(options2) {
  387. if (!Cesium.defined(options2) || !Cesium.defined(options2.container)) {
  388. throw new Cesium.DeveloperError("options.container is required.");
  389. }
  390. Cesium.Ion.defaultAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiIxNzM5YjQ3MC03YmMxLTRmMjAtOTk4Yi0yNDMyMDZlOTQzYTYiLCJpZCI6NTU5MjAsImlhdCI6MTYyNDI0NTM5NX0.diydVWFzw5C5rQlHaFYkdDJoSorcdex81KpWcntyICo";
  391. this._viewer = this._initMap(options2);
  392. this._imageryLayers = this._viewer.imageryLayers;
  393. this._primitives = this._viewer.scene.primitives;
  394. this._entities = this._viewer.entities;
  395. this._dataSources = this._viewer.dataSources;
  396. this._defaultSkyBox = this._viewer.scene.skyBox;
  397. this.statusBar = new StatusBar(this._viewer);
  398. console.log(Cesium.buildModuleUrl.getCesiumBaseUrl());
  399. }
  400. _initMap(options2) {
  401. let viewer2 = new Cesium.Viewer(options2.container, {
  402. animation: true,
  403. timeline: true,
  404. shadows: false,
  405. shouldAnimate: true,
  406. baseLayerPicker: false,
  407. navigationHelpButton: false,
  408. homeButton: false,
  409. fullscreenButton: false,
  410. sceneModePicker: false,
  411. scene3DOnly: true,
  412. infoBox: false,
  413. clampToGround: true,
  414. geocoder: false,
  415. selectionIndicator: false,
  416. contextOptions: {
  417. webgl: {
  418. alpha: true,
  419. depth: true,
  420. stencil: true,
  421. antialias: true,
  422. premultipliedAlpha: true,
  423. preserveDrawingBuffer: true,
  424. failIfMajorPerformanceCaveat: true
  425. }
  426. }
  427. });
  428. viewer2._cesiumWidget._creditContainer.style.display = "none";
  429. viewer2.scene.globe.show = true;
  430. viewer2.scene.globe.depthTestAgainstTerrain = true;
  431. viewer2.scene.globe.enableLighting = false;
  432. viewer2.scene.requestRenderMode = false;
  433. viewer2.scene.debugShowFramesPerSecond = true;
  434. viewer2.scene.skyAtmosphere.show = false;
  435. viewer2.scene.skyBox.show = true;
  436. viewer2.scene.sun.show = true;
  437. viewer2.scene.moon.show = false;
  438. viewer2.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  439. viewer2.animation.viewModel.dateFormatter = localeDateTimeFormatter;
  440. viewer2.animation.viewModel.timeFormatter = localeTimeFormatter;
  441. viewer2.timeline.makeLabel = localeDateTimeFormatter;
  442. function localeDateTimeFormatter(datetime, viewModel, ignoredate) {
  443. var julianDT = new Cesium.JulianDate();
  444. Cesium.JulianDate.addHours(datetime, 8, julianDT);
  445. var gregorianDT = Cesium.JulianDate.toGregorianDate(julianDT);
  446. var objDT;
  447. if (ignoredate) {
  448. objDT = "";
  449. } else {
  450. objDT = new Date(gregorianDT.year, gregorianDT.month - 1, gregorianDT.day);
  451. objDT = gregorianDT.year + "-" + objDT.toLocaleString("zh-cn", {
  452. month: "short"
  453. }).split("\u6708").join("-") + gregorianDT.day + " ";
  454. if (viewModel || gregorianDT.hour + gregorianDT.minute === 0) {
  455. return objDT;
  456. }
  457. }
  458. let hour, minute, second;
  459. if (gregorianDT.hour < 10) {
  460. hour = `0${gregorianDT.hour}`;
  461. } else {
  462. hour = gregorianDT.hour;
  463. }
  464. if (gregorianDT.minute < 10) {
  465. minute = `0${gregorianDT.minute}`;
  466. } else {
  467. minute = gregorianDT.minute;
  468. }
  469. if (gregorianDT.second < 10) {
  470. second = `0${gregorianDT.second}`;
  471. } else {
  472. second = gregorianDT.second;
  473. }
  474. return objDT + hour + ":" + minute + ":" + second;
  475. }
  476. function localeTimeFormatter(time, viewModel) {
  477. return localeDateTimeFormatter(time, viewModel, true);
  478. }
  479. return viewer2;
  480. }
  481. _setView(options2) {
  482. if (!Cesium.defined(options2.longitude) && !Cesium.defined(options2.latitude)) {
  483. throw new Cesium.DeveloperError("longitude and latitude are required.");
  484. }
  485. Cesium.Check.typeOf.number("longitude", options2.longitude);
  486. Cesium.Check.typeOf.number("latitude", options2.latitude);
  487. this._viewer.camera.setView({
  488. destination: Cesium.Cartesian3.fromDegrees(
  489. options2.longitude,
  490. options2.latitude,
  491. options2.height
  492. ),
  493. orientation: {
  494. heading: Cesium.Math.toRadians(Cesium.defaultValue(options2.heading, 0)),
  495. pitch: Cesium.Math.toRadians(Cesium.defaultValue(options2.pitch, -90)),
  496. roll: options2.roll
  497. }
  498. });
  499. }
  500. _getChinaPostion() {
  501. return Cesium.Cartesian3.fromDegrees(116.435314, 40.960521, 1e7);
  502. }
  503. }
  504. Object.assign(jtMap3d.prototype, {
  505. flytoChina() {
  506. this._viewer.camera.flyTo({
  507. destination: this._getChinaPostion(),
  508. duration: 3
  509. });
  510. },
  511. setViewChina: function() {
  512. this._setView({
  513. longitude: 103.84,
  514. latitude: 31.15,
  515. height: 24e6,
  516. heading: 0,
  517. pitch: -90,
  518. roll: 0
  519. });
  520. },
  521. fullMap: function(options2) {
  522. return new Promise((resolve2, reject2) => {
  523. let _self = this;
  524. this._entities.removeById("fullMapRectangle");
  525. options2.isRemove = Cesium.defaultValue(options2.isRemove, true);
  526. options2.duration = Cesium.defaultValue(options2.duration, 3);
  527. options2.heading = Cesium.defaultValue(options2.heading, 0);
  528. options2.pitch = Cesium.defaultValue(options2.pitch, -90);
  529. options2.range = Cesium.defaultValue(options2.range, 0);
  530. var rectangle = Cesium.Rectangle.fromDegrees(
  531. options2.west,
  532. options2.south,
  533. options2.east,
  534. options2.north
  535. );
  536. var fullMapEntity = this._entities.add({
  537. id: "fullMapRectangle",
  538. name: "fullMapRectangle",
  539. rectangle: {
  540. coordinates: rectangle,
  541. material: Cesium.Color.GREEN.withAlpha(0),
  542. height: 10,
  543. outline: false
  544. }
  545. });
  546. var flyPromise = this._viewer.flyTo(fullMapEntity, {
  547. duration: options2.duration,
  548. offset: {
  549. heading: Cesium.Math.toRadians(options2.heading),
  550. pitch: Cesium.Math.toRadians(options2.pitch),
  551. range: options2.range
  552. }
  553. });
  554. flyPromise.then(function(flyPromise2) {
  555. if (flyPromise2) {
  556. if (options2.isRemove) {
  557. fullMapEntity && (_self._entities.remove(fullMapEntity), fullMapEntity = null);
  558. }
  559. resolve2(true);
  560. }
  561. }).catch(function(error) {
  562. console.log(error);
  563. });
  564. });
  565. },
  566. setMapNorth() {
  567. let viewer2 = this._viewer;
  568. let pitch = Cesium.Math.toDegrees(viewer2.camera.pitch).toFixed(0);
  569. var center2 = viewer2.camera.pickEllipsoid(new Cesium.Cartesian2(viewer2.canvas.clientWidth / 2, viewer2.canvas.clientHeight / 2));
  570. var curPosition = Cesium.Ellipsoid.WGS84.cartesianToCartographic(center2);
  571. let centerX = curPosition.longitude * 180 / Math.PI;
  572. let centerY = curPosition.latitude * 180 / Math.PI;
  573. let cameraPointX = viewer2.camera.positionCartographic.longitude * 180 / Math.PI;
  574. let cameraPointY = viewer2.camera.positionCartographic.latitude * 180 / Math.PI;
  575. let cameraPointZ = viewer2.camera.positionCartographic.height.toFixed(0);
  576. var satrt = Cesium.Cartographic.fromDegrees(cameraPointX, cameraPointY, cameraPointZ);
  577. var end = Cesium.Cartographic.fromDegrees(centerX, centerY, 0);
  578. var geodesic = new Cesium.EllipsoidGeodesic();
  579. geodesic.setEndPoints(satrt, end);
  580. var distance2 = geodesic.surfaceDistance;
  581. let range3 = Math.sqrt(Math.pow(distance2, 2) + Math.pow(cameraPointZ - 0, 2));
  582. if (this.centerEntity) {
  583. viewer2.entities.remove(this.centerEntity);
  584. }
  585. this.centerEntity = viewer2.entities.add({
  586. position: Cesium.Cartesian3.fromDegrees(centerX, centerY, 0),
  587. point: {
  588. color: Cesium.Color.RED,
  589. pixelSize: 1
  590. }
  591. });
  592. let offset = new Cesium.HeadingPitchRange(Cesium.Math.toRadians(0), Cesium.Math.toRadians(pitch), range3);
  593. viewer2.zoomTo(this.centerEntity, offset);
  594. },
  595. setMapSpinByPoint(points2, options2) {
  596. let viewer2 = this._viewer;
  597. if (!Cesium.defined(points2)) {
  598. throw new Cesium.DeveloperError("points is required.");
  599. }
  600. options2 = options2 || {};
  601. options2.speed = Cesium.defaultValue(options2.speed, 30);
  602. var position2 = points2;
  603. if (points2 instanceof Cesium.Cartesian3) {
  604. position2 = points2;
  605. } else {
  606. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  607. }
  608. var entity = viewer2.entities.add(
  609. new Cesium.Entity({
  610. point: new Cesium.PointGraphics({
  611. color: new Cesium.Color(1, 1, 0),
  612. pixelSize: 6,
  613. outlineColor: new Cesium.Color(0, 1, 1)
  614. }),
  615. position: position2
  616. })
  617. );
  618. var angle = 360 / options2.speed;
  619. var initialHeading = viewer2.camera.heading;
  620. var pitch = viewer2.camera.pitch;
  621. if (options2.pitch) {
  622. pitch = Cesium.Math.toRadians(options2.pitch);
  623. }
  624. var distance2 = viewer2.camera.positionCartographic.height;
  625. if (options2.height) {
  626. distance2 = options2.height;
  627. }
  628. var startTime = Cesium.JulianDate.fromDate(new Date());
  629. viewer2.clock.startTime = startTime.clone();
  630. viewer2.clock.currentTime = startTime.clone();
  631. viewer2.clock.clockRange = Cesium.ClockRange.CLAMPED;
  632. viewer2.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK;
  633. var Exection = function TimeExecution() {
  634. var delTime = Cesium.JulianDate.secondsDifference(viewer2.clock.currentTime, viewer2.clock.startTime);
  635. var heading = Cesium.Math.toRadians(delTime * angle) + initialHeading;
  636. viewer2.scene.camera.setView({
  637. destination: position2,
  638. orientation: {
  639. heading,
  640. pitch
  641. }
  642. });
  643. viewer2.scene.camera.moveBackward(distance2);
  644. if (Cesium.JulianDate.compare(viewer2.clock.currentTime, viewer2.clock.stopTime) >= 0) {
  645. viewer2.clock.onTick.removeEventListener(Exection);
  646. }
  647. var handler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  648. handler.setInputAction(function(click) {
  649. viewer2.clock.onTick.removeEventListener(Exection);
  650. viewer2.entities.remove(entity);
  651. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  652. };
  653. viewer2.clock.onTick.addEventListener(Exection);
  654. }
  655. });
  656. const BD_FACTOR = 3.141592653589793 * 3e3 / 180;
  657. const PI = 3.141592653589793;
  658. const RADIUS = 6378245;
  659. const EE = 0.006693421622965943;
  660. class CoordTransform {
  661. static BD09ToGCJ02(lng, lat) {
  662. let x = +lng - 65e-4;
  663. let y = +lat - 6e-3;
  664. let z = Math.sqrt(x * x + y * y) - 2e-5 * Math.sin(y * BD_FACTOR);
  665. let theta = Math.atan2(y, x) - 3e-6 * Math.cos(x * BD_FACTOR);
  666. let gg_lng = z * Math.cos(theta);
  667. let gg_lat = z * Math.sin(theta);
  668. return [gg_lng, gg_lat];
  669. }
  670. static GCJ02ToBD09(lng, lat) {
  671. lat = +lat;
  672. lng = +lng;
  673. let z = Math.sqrt(lng * lng + lat * lat) + 2e-5 * Math.sin(lat * BD_FACTOR);
  674. let theta = Math.atan2(lat, lng) + 3e-6 * Math.cos(lng * BD_FACTOR);
  675. let bd_lng = z * Math.cos(theta) + 65e-4;
  676. let bd_lat = z * Math.sin(theta) + 6e-3;
  677. return [bd_lng, bd_lat];
  678. }
  679. static WGS84ToGCJ02(lng, lat) {
  680. lat = +lat;
  681. lng = +lng;
  682. if (this.out_of_china(lng, lat)) {
  683. return [lng, lat];
  684. } else {
  685. let d2 = this.delta(lng, lat);
  686. return [lng + d2[0], lat + d2[1]];
  687. }
  688. }
  689. static GCJ02ToWGS84(lng, lat) {
  690. lat = +lat;
  691. lng = +lng;
  692. if (this.out_of_china(lng, lat)) {
  693. return [lng, lat];
  694. } else {
  695. let d2 = this.delta(lng, lat);
  696. let mgLng = lng + d2[0];
  697. let mgLat = lat + d2[1];
  698. return [lng * 2 - mgLng, lat * 2 - mgLat];
  699. }
  700. }
  701. static delta(lng, lat) {
  702. let dLng = this.transformLng(lng - 105, lat - 35);
  703. let dLat = this.transformLat(lng - 105, lat - 35);
  704. const radLat = lat / 180 * PI;
  705. let magic = Math.sin(radLat);
  706. magic = 1 - EE * magic * magic;
  707. const sqrtMagic = Math.sqrt(magic);
  708. dLng = dLng * 180 / (RADIUS / sqrtMagic * Math.cos(radLat) * PI);
  709. dLat = dLat * 180 / (RADIUS * (1 - EE) / (magic * sqrtMagic) * PI);
  710. return [dLng, dLat];
  711. }
  712. static transformLng(lng, lat) {
  713. lat = +lat;
  714. lng = +lng;
  715. let ret = 300 + lng + 2 * lat + 0.1 * lng * lng + 0.1 * lng * lat + 0.1 * Math.sqrt(Math.abs(lng));
  716. ret += (20 * Math.sin(6 * lng * PI) + 20 * Math.sin(2 * lng * PI)) * 2 / 3;
  717. ret += (20 * Math.sin(lng * PI) + 40 * Math.sin(lng / 3 * PI)) * 2 / 3;
  718. ret += (150 * Math.sin(lng / 12 * PI) + 300 * Math.sin(lng / 30 * PI)) * 2 / 3;
  719. return ret;
  720. }
  721. static transformLat(lng, lat) {
  722. lat = +lat;
  723. lng = +lng;
  724. let ret = -100 + 2 * lng + 3 * lat + 0.2 * lat * lat + 0.1 * lng * lat + 0.2 * Math.sqrt(Math.abs(lng));
  725. ret += (20 * Math.sin(6 * lng * PI) + 20 * Math.sin(2 * lng * PI)) * 2 / 3;
  726. ret += (20 * Math.sin(lat * PI) + 40 * Math.sin(lat / 3 * PI)) * 2 / 3;
  727. ret += (160 * Math.sin(lat / 12 * PI) + 320 * Math.sin(lat * PI / 30)) * 2 / 3;
  728. return ret;
  729. }
  730. static out_of_china(lng, lat) {
  731. lat = +lat;
  732. lng = +lng;
  733. return !(lng > 73.66 && lng < 135.05 && lat > 3.86 && lat < 53.55);
  734. }
  735. static getCatesian3FromPX(viewer2, px) {
  736. let picks = viewer2.scene.drillPick(px);
  737. let cartesian = null;
  738. let isOn3dtiles = false, isOnTerrain = false;
  739. for (let i2 in picks) {
  740. let pick = picks[i2];
  741. if (pick && pick.primitive instanceof Cesium.Cesium3DTileFeature || pick && pick.primitive instanceof Cesium.Cesium3DTileset || pick && pick.primitive instanceof Cesium.Model) {
  742. isOn3dtiles = true;
  743. }
  744. if (isOn3dtiles) {
  745. viewer2.scene.pick(px);
  746. cartesian = viewer2.scene.pickPosition(px);
  747. if (cartesian) {
  748. let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  749. if (cartographic.height < 0)
  750. cartographic.height = 0;
  751. let lon = Cesium.Math.toDegrees(cartographic.longitude), lat = Cesium.Math.toDegrees(cartographic.latitude), height2 = cartographic.height;
  752. cartesian = this.transformWGS84ToCartesian({
  753. lng: lon,
  754. lat,
  755. alt: height2
  756. });
  757. }
  758. }
  759. }
  760. let boolTerrain = viewer2.terrainProvider instanceof Cesium.EllipsoidTerrainProvider;
  761. if (!isOn3dtiles && !boolTerrain) {
  762. let ray = viewer2.scene.camera.getPickRay(px);
  763. if (!ray)
  764. return null;
  765. cartesian = viewer2.scene.globe.pick(ray, viewer2.scene);
  766. isOnTerrain = true;
  767. }
  768. if (!isOn3dtiles && !isOnTerrain && boolTerrain) {
  769. cartesian = viewer2.scene.camera.pickEllipsoid(
  770. px,
  771. viewer2.scene.globe.ellipsoid
  772. );
  773. }
  774. if (cartesian) {
  775. let position2 = this.transformCartesianToWGS84(cartesian);
  776. if (position2.alt < 0) {
  777. cartesian = this.transformWGS84ToCartesian(position2, 0.1);
  778. }
  779. return cartesian;
  780. }
  781. return false;
  782. }
  783. static transformWGS84ToCartesian(position2, alt) {
  784. return position2 ? Cesium.Cartesian3.fromDegrees(
  785. position2.lng || position2.lon,
  786. position2.lat,
  787. position2.alt = alt || position2.alt,
  788. Cesium.Ellipsoid.WGS84
  789. ) : Cesium.Cartesian3.ZERO;
  790. }
  791. static transformCartesianToWGS84(cartesian) {
  792. let ellipsoid = Cesium.Ellipsoid.WGS84;
  793. let cartographic = ellipsoid.cartesianToCartographic(cartesian);
  794. return {
  795. lng: Cesium.Math.toDegrees(cartographic.longitude),
  796. lat: Cesium.Math.toDegrees(cartographic.latitude),
  797. alt: cartographic.height
  798. };
  799. }
  800. static Cartesian3ListToWGS84(cartesianList) {
  801. let ellipsoid = Cesium.Ellipsoid.WGS84;
  802. let result = [];
  803. for (let index2 = 0; index2 < cartesianList.length; index2++) {
  804. const cartesian = cartesianList[index2];
  805. let cartographic = ellipsoid.cartesianToCartographic(cartesian);
  806. result.push({
  807. lng: Cesium.Math.toDegrees(cartographic.longitude),
  808. lat: Cesium.Math.toDegrees(cartographic.latitude),
  809. alt: cartographic.height
  810. });
  811. }
  812. return result;
  813. }
  814. static Degrees2DMS(value) {
  815. let degrees = Math.floor(value);
  816. let rem = (value - degrees) * 60;
  817. let minutes = Math.floor(rem);
  818. let _second = (rem - minutes) * 60;
  819. let seconds = Math.round(_second);
  820. var _radians = Cesium.Math.toRadians(value);
  821. var _degrees = Cesium.Math.toDegrees(value);
  822. console.log(_radians);
  823. console.log(_degrees);
  824. let DMS = {
  825. degrees,
  826. minutes,
  827. seconds
  828. };
  829. return DMS;
  830. }
  831. static DMS2Degrees(DMS) {
  832. let _double = parseFloat(DMS.degrees) + parseFloat(DMS.minutes) / 60 + parseFloat(DMS.seconds) / 3600;
  833. return parseFloat(_double).toFixed(6);
  834. }
  835. static _cartesian3ToGeo(position2) {
  836. let g = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  837. return {
  838. longitude: Cesium.Math.toDegrees(g.longitude),
  839. latitude: Cesium.Math.toDegrees(g.latitude),
  840. height: g.height
  841. };
  842. }
  843. static _arcToDegree(arc) {
  844. return arc / Math.PI * 180;
  845. }
  846. static _getScreenClickPositionAndHeight(viewer2, screenPoint) {
  847. this._viewer = viewer2;
  848. var lng = void 0, lat = void 0, height2 = void 0;
  849. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  850. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  851. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  852. var feature2 = this._viewer.scene.pick(screenPoint);
  853. if (feature2 == void 0) {
  854. lng = this._arcToDegree(cartographic.longitude);
  855. lat = this._arcToDegree(cartographic.latitude);
  856. height2 = cartographic.height;
  857. } else {
  858. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  859. if (Cesium.defined(cartesian)) {
  860. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  861. lng = this._arcToDegree(cartographic.longitude);
  862. lat = this._arcToDegree(cartographic.latitude);
  863. height2 = cartographic.height;
  864. }
  865. }
  866. return {
  867. lng,
  868. lat,
  869. height: height2
  870. };
  871. }
  872. static _transfromFromScreenPoint(viewer2, screenPosition) {
  873. let location = this._getScreenClickPositionAndHeight(viewer2, screenPosition);
  874. var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
  875. return {
  876. gLocation: location,
  877. sLocation: cartesian
  878. };
  879. }
  880. }
  881. class PolylineDirectionMaterialProperty {
  882. constructor(options2) {
  883. this.defaultColor = new Cesium.Color(255 / 255, 0, 0, 0);
  884. options2 = options2 || {};
  885. options2.isImageAlpha = Cesium.defaultValue(options2.isImageAlpha, true);
  886. options2.imgUrl = Cesium.defaultValue(options2.imgUrl, "jt3dSDK/imgs/polylinematerial/spriteline1.png");
  887. options2.duration = Cesium.defaultValue(options2.duration, 3e3);
  888. options2.count = Cesium.defaultValue(options2.count, 1);
  889. options2.direction = Cesium.defaultValue(options2.direction, "horizontal");
  890. options2.order = Cesium.defaultValue(options2.order, "-");
  891. if (options2.isImageAlpha) {
  892. options2.color = this.defaultColor;
  893. } else {
  894. if (options2.color instanceof Array) {
  895. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  896. } else if (typeof options2.color === "string") {
  897. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  898. } else {
  899. options2.color = this.defaultColor;
  900. }
  901. }
  902. this._definitionChanged = new Cesium.Event();
  903. this._color = void 0;
  904. this._image = void 0;
  905. this.color = options2.color;
  906. this.image = options2.imgUrl;
  907. this._isImageAlpha = options2.isImageAlpha;
  908. this._duration = options2.duration;
  909. this._count = options2.count;
  910. this._direction = options2.direction;
  911. this._order = options2.order;
  912. this._time = performance.now();
  913. this.addMaterial();
  914. }
  915. addMaterial() {
  916. Cesium.Material.PolylineTrailType = "PolylineTrail";
  917. Cesium.Material.Polylineimage = "images/colors.png";
  918. if (this._direction === "vertical") {
  919. if (this._isImageAlpha) {
  920. Cesium.Material.PolylineTrailSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = repeat * materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.t " + this._order + " time), st.s));\n material.alpha = colorImage.a;\n material.diffuse = colorImage.rgb* 1.5 ;\n return material;\n }";
  921. } else {
  922. Cesium.Material.PolylineTrailSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = repeat * materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.t " + this._order + " time), st.s));\n material.alpha = colorImage.a * color.a;\n material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\n return material;\n }";
  923. }
  924. } else if (this._direction === "horizontal") {
  925. if (this._isImageAlpha) {
  926. Cesium.Material.PolylineTrailSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = repeat * materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.s " + this._order + " time), st.t));\n material.alpha = colorImage.a;\n material.diffuse = colorImage.rgb * 1.5 ;\n return material;\n }";
  927. } else {
  928. Cesium.Material.PolylineTrailSource = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = repeat * materialInput.st;\n vec4 colorImage = texture2D(image, vec2(fract(st.s " + this._order + " time), st.t));\n material.alpha = colorImage.a * color.a;\n material.diffuse = max(color.rgb * material.alpha * 3.0, color.rgb);\n return material;\n }";
  929. }
  930. }
  931. Cesium.Material._materialCache.addMaterial(Cesium.Material.PolylineTrailType, {
  932. fabric: {
  933. type: Cesium.Material.PolylineTrailType,
  934. uniforms: {
  935. color: new Cesium.Color(1, 0, 0, 0.5),
  936. image: Cesium.Material.Polylineimage,
  937. time: 0,
  938. repeat: new Cesium.Cartesian2(5, 1),
  939. order: "-"
  940. },
  941. source: Cesium.Material.PolylineTrailSource
  942. },
  943. translucent: function(material) {
  944. return true;
  945. }
  946. });
  947. }
  948. }
  949. PolylineDirectionMaterialProperty.prototype.getType = function(time) {
  950. return "PolylineTrail";
  951. };
  952. PolylineDirectionMaterialProperty.prototype.getValue = function(time, result) {
  953. if (!Cesium.defined(result)) {
  954. result = {};
  955. }
  956. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, this.defaultColor, result.color);
  957. result.image = Cesium.Property.getValueOrUndefined(this._image, time);
  958. result.time = (performance.now() - this._time) % this._duration / this._duration;
  959. result.repeat = new Cesium.Cartesian2(this._count, 1);
  960. result.order = this._order;
  961. return result;
  962. };
  963. PolylineDirectionMaterialProperty.prototype.equals = function(other) {
  964. return this === other || other instanceof PolylineDirectionMaterialProperty && Cesium.Property.equals(this._color, other._color);
  965. };
  966. Object.defineProperties(PolylineDirectionMaterialProperty.prototype, {
  967. isConstant: {
  968. get: function() {
  969. return false;
  970. }
  971. },
  972. definitionChanged: {
  973. get: function() {
  974. return this._definitionChanged;
  975. }
  976. },
  977. color: Cesium.createPropertyDescriptor("color"),
  978. image: Cesium.createPropertyDescriptor("image")
  979. });
  980. class WallMaterialProperty$1 {
  981. constructor(viewer2, options2) {
  982. this._viewer = viewer2;
  983. options2 = options2 || {};
  984. this._definitionChanged = new Cesium.Event();
  985. this._color = void 0;
  986. this.color = options2.color || Cesium.Color.BLUE;
  987. this.duration = options2.duration || 1e3;
  988. this.count = options2.duration || 1;
  989. this.direction = options2.duration || "vertical";
  990. this.order = options2.duration || "-";
  991. this.trailImage = Cesium.defaultValue(options2.trailImage, "jt3dSDK/imgs/wallmaterial/wl.png");
  992. this._time = new Date().getTime();
  993. this._materialTypeName = "WallMaterial" + this._guid();
  994. this._param = {
  995. color: this.color._value.toCssColorString(),
  996. image: this.trailImage,
  997. duration: this.duration,
  998. count: this.count,
  999. direction: this.direction,
  1000. order: this.order
  1001. };
  1002. Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
  1003. fabric: {
  1004. type: this._materialTypeName,
  1005. uniforms: {
  1006. time: -20,
  1007. color: new Cesium.Color(1, 0, 0, 0.5),
  1008. image: options2.trailImage
  1009. },
  1010. source: this._getDirectionWallShader(options2.param)
  1011. },
  1012. translucent: function(material) {
  1013. return true;
  1014. }
  1015. });
  1016. }
  1017. _guid() {
  1018. function S4() {
  1019. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  1020. }
  1021. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  1022. }
  1023. getType(time) {
  1024. return this._materialTypeName;
  1025. }
  1026. getValue(time, result) {
  1027. if (!Cesium.defined(result)) {
  1028. result = {};
  1029. }
  1030. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
  1031. result.image = this.trailImage;
  1032. if (this.duration) {
  1033. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  1034. }
  1035. this._viewer.scene.requestRender();
  1036. return result;
  1037. }
  1038. equals(other) {
  1039. return this === other || other instanceof WallMaterialProperty$1 && Cesium.Property.equals(this._color, other._color) && other._param.order === this._param.order && other._param.count === this._param.count && other._param.direction === this._param.direction && other.duration === this.duration;
  1040. }
  1041. _getDirectionWallShader(options2) {
  1042. let op = Cesium.defaultValue(options2, {});
  1043. let count = op.count !== void 0 && typeof op.count === "number" && op.count > 0 ? op.count : 1;
  1044. let direction = op.direction === "horizontal" ? "horizontal" : "vertical";
  1045. let order = op.order === "+" ? "+" : "-";
  1046. this._param.count = count;
  1047. this._param.direction = direction;
  1048. this._param.order = order;
  1049. let materail = "";
  1050. materail += "czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n";
  1051. if (direction === "vertical") {
  1052. materail += " vec4 colorImage = texture2D(image,vec2(st.s,fract(float(" + count + ")*st.t " + order + " time)));\n";
  1053. } else if (direction === "horizontal") {
  1054. materail += " vec4 colorImage = texture2D(image, vec2(fract(float(" + count + ")*st.s " + order + " time), st.t));\n";
  1055. }
  1056. materail += " vec4 fragColor;\n fragColor.rgb = color.rgb / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.alpha = colorImage.a * color.a;\n material.diffuse = color.rgb;\n material.emission = fragColor.rgb;\n return material;\n}";
  1057. return materail;
  1058. }
  1059. }
  1060. Object.defineProperties(WallMaterialProperty$1.prototype, {
  1061. isConstant: {
  1062. get: function() {
  1063. return false;
  1064. }
  1065. },
  1066. definitionChanged: {
  1067. get: function() {
  1068. return this._definitionChanged;
  1069. }
  1070. },
  1071. color: Cesium.createPropertyDescriptor("color")
  1072. });
  1073. class LoadMapData {
  1074. constructor(viewer2) {
  1075. if (!viewer2)
  1076. throw new Cesium.DeveloperError("no viewer object!");
  1077. this._viewer = viewer2;
  1078. }
  1079. _addImageryProvider(id, provider) {
  1080. window[id] = this._viewer.imageryLayers.addImageryProvider(provider);
  1081. }
  1082. _removeImageryProvider(serviceId) {
  1083. this._viewer.imageryLayers.remove(window[serviceId]);
  1084. window[serviceId] = null;
  1085. }
  1086. _addTerrainProvider(provider) {
  1087. this._viewer.terrainProvider = provider;
  1088. }
  1089. _setEllipsoidTerrain() {
  1090. this._viewer.terrainProvider = new Cesium.EllipsoidTerrainProvider({});
  1091. }
  1092. _addScenePrimitives(scenePrimitives) {
  1093. this._viewer.scene.primitives.add(scenePrimitives);
  1094. }
  1095. _removeScenePrimitives(serviceId) {
  1096. this._viewer.scene.primitives.remove(window[serviceId]);
  1097. window[serviceId] = null;
  1098. }
  1099. _guid() {
  1100. function S4() {
  1101. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  1102. }
  1103. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  1104. }
  1105. _transformProjection(provider) {
  1106. let webMercatorTilingScheme = provider.tilingScheme;
  1107. let projection = webMercatorTilingScheme._projection;
  1108. projection.x_project = projection.project;
  1109. projection.project = function(cartographic) {
  1110. let point2;
  1111. return point2 = CoordTransform.WGS84ToGCJ02(
  1112. Cesium.Math.toDegrees(cartographic.longitude),
  1113. Cesium.Math.toDegrees(cartographic.latitude)
  1114. ), projection.x_project(
  1115. new Cesium.Cartographic(
  1116. Cesium.Math.toRadians(point2[0]),
  1117. Cesium.Math.toRadians(point2[1])
  1118. )
  1119. );
  1120. };
  1121. projection.x_unproject = projection.unproject;
  1122. projection.unproject = function(cartesian) {
  1123. let point2, cartographic = projection.x_unproject(cartesian);
  1124. return point2 = CoordTransform.GCJ02ToWGS84(
  1125. Cesium.Math.toDegrees(cartographic.longitude),
  1126. Cesium.Math.toDegrees(cartographic.latitude)
  1127. ), new Cesium.Cartographic(
  1128. Cesium.Math.toRadians(point2[0]),
  1129. Cesium.Math.toRadians(point2[1])
  1130. );
  1131. };
  1132. return provider;
  1133. }
  1134. }
  1135. Object.assign(LoadMapData.prototype, {
  1136. addTerrain(options2) {
  1137. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  1138. throw new Cesium.DeveloperError("options.url is required.");
  1139. }
  1140. let _ConstructorOptions = {
  1141. url: options2.url
  1142. };
  1143. if (options2.requestVertexNormals) {
  1144. _ConstructorOptions.requestVertexNormals = options2.requestVertexNormals;
  1145. } else {
  1146. _ConstructorOptions.requestVertexNormals = false;
  1147. }
  1148. if (options2.requestWaterMask) {
  1149. _ConstructorOptions.requestWaterMask = options2.requestWaterMask;
  1150. } else {
  1151. _ConstructorOptions.requestWaterMask = false;
  1152. }
  1153. var terrainProvider = new Cesium.CesiumTerrainProvider(_ConstructorOptions);
  1154. this._addTerrainProvider(terrainProvider);
  1155. this.setTerrainExaggeration(options2);
  1156. },
  1157. addMapboxLayer(options2, callSuccess) {
  1158. if (!Cesium.defined(options2) || !Cesium.defined(options2.styleId)) {
  1159. throw new Cesium.DeveloperError("options.styleId is required.");
  1160. }
  1161. if (!Cesium.defined(options2.accessToken)) {
  1162. throw new Cesium.DeveloperError("options.accessToken is required.");
  1163. }
  1164. options2.id = options2.id || this._guid();
  1165. var imageryProvider = new Cesium.MapboxStyleImageryProvider({
  1166. url: options2.url,
  1167. username: options2.username,
  1168. styleId: options2.styleId,
  1169. accessToken: options2.accessToken,
  1170. scaleFactor: options2.scaleFactor
  1171. });
  1172. this._addImageryProvider(options2.id, imageryProvider);
  1173. this.setLayersStyle({
  1174. serviceId: options2.id,
  1175. alpha: options2.alpha
  1176. });
  1177. if (callSuccess)
  1178. callSuccess(options2.id);
  1179. },
  1180. addUrlTemplateImagery: function(options2, callSuccess) {
  1181. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  1182. throw new Cesium.DeveloperError("options.url is required.");
  1183. }
  1184. options2.id = options2.id || this._guid();
  1185. options2.CRS = options2.CRS || "";
  1186. let _ConstructorOptions = {
  1187. url: options2.url
  1188. };
  1189. if (options2.minimumLevel) {
  1190. _ConstructorOptions.minimumLevel = options2.minimumLevel;
  1191. }
  1192. if (options2.maximumLevel) {
  1193. _ConstructorOptions.maximumLevel = options2.maximumLevel;
  1194. } else {
  1195. _ConstructorOptions.maximumLevel = 18;
  1196. }
  1197. var imageryProvider = new Cesium.UrlTemplateImageryProvider(_ConstructorOptions);
  1198. if (options2.CRS.toUpperCase() === "WGS84") {
  1199. imageryProvider.readyPromise.then(() => {
  1200. this._transformProjection(imageryProvider);
  1201. });
  1202. }
  1203. this._addImageryProvider(options2.id, imageryProvider);
  1204. this.setLayersStyle({
  1205. serviceId: options2.id,
  1206. alpha: options2.alpha
  1207. });
  1208. if (callSuccess)
  1209. callSuccess(options2.id);
  1210. },
  1211. addTileMapServiceImagery: function(options2, callSuccess) {
  1212. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  1213. throw new Cesium.DeveloperError("options.url is required.");
  1214. }
  1215. options2.id = options2.id || this._guid();
  1216. let _ConstructorOptions = {
  1217. url: options2.url
  1218. };
  1219. if (options2.minimumLevel) {
  1220. _ConstructorOptions.minimumLevel = options2.minimumLevel;
  1221. }
  1222. if (options2.maximumLevel) {
  1223. _ConstructorOptions.maximumLevel = options2.maximumLevel;
  1224. } else {
  1225. _ConstructorOptions.maximumLevel = 18;
  1226. }
  1227. var imageryProvider = new Cesium.TileMapServiceImageryProvider(_ConstructorOptions);
  1228. this._addImageryProvider(options2.id, imageryProvider);
  1229. this.setLayersStyle({
  1230. serviceId: options2.id,
  1231. alpha: options2.alpha
  1232. });
  1233. if (callSuccess)
  1234. callSuccess(options2.id);
  1235. },
  1236. addWebMapTileService: function(options2, callSuccess) {
  1237. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  1238. throw new Cesium.DeveloperError("options.url is required.");
  1239. }
  1240. if (!Cesium.defined(options2.layers)) {
  1241. throw new Cesium.DeveloperError("options.layers is required.");
  1242. }
  1243. if (!Cesium.defined(options2.style)) {
  1244. throw new Cesium.DeveloperError("options.style is required.");
  1245. }
  1246. if (!Cesium.defined(options2.tileMatrixSetID)) {
  1247. throw new Cesium.DeveloperError("options.tileMatrixSetID is required.");
  1248. }
  1249. options2.id = options2.id || this._guid();
  1250. let _ConstructorOptions = {
  1251. url: options2.url,
  1252. layer: options2.layers,
  1253. style: options2.style,
  1254. tileMatrixSetID: options2.tileMatrixSetID,
  1255. format: Cesium.defaultValue(options2.format, "image/png")
  1256. };
  1257. if (options2.tileMatrixLabels) {
  1258. _ConstructorOptions.tileMatrixLabels = options2.tileMatrixLabels;
  1259. }
  1260. if (options2.minimumLevel) {
  1261. _ConstructorOptions.minimumLevel = options2.minimumLevel;
  1262. }
  1263. if (options2.maximumLevel) {
  1264. _ConstructorOptions.maximumLevel = options2.maximumLevel;
  1265. } else {
  1266. _ConstructorOptions.maximumLevel = 18;
  1267. }
  1268. let imageryProvider = new Cesium.WebMapTileServiceImageryProvider(_ConstructorOptions);
  1269. this._addImageryProvider(options2.id, imageryProvider);
  1270. this.setLayersStyle({
  1271. serviceId: options2.id,
  1272. alpha: options2.alpha
  1273. });
  1274. if (callSuccess)
  1275. callSuccess(options2.id);
  1276. },
  1277. addWebMapService: function(options2, callSuccess) {
  1278. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  1279. throw new Cesium.DeveloperError("options.url is required.");
  1280. }
  1281. if (!Cesium.defined(options2.layers)) {
  1282. throw new Cesium.DeveloperError("options.layers is required.");
  1283. }
  1284. options2.id = options2.id || this._guid();
  1285. let _ConstructorOptions = {
  1286. url: options2.url,
  1287. layers: options2.layers
  1288. };
  1289. if (options2.parameters) {
  1290. _ConstructorOptions.parameters = options2.parameters;
  1291. } else {
  1292. _ConstructorOptions.parameters = {
  1293. service: "WMS",
  1294. transparent: true,
  1295. request: "GetMap",
  1296. format: "image/png"
  1297. };
  1298. }
  1299. if (options2.minimumLevel) {
  1300. _ConstructorOptions.minimumLevel = options2.minimumLevel;
  1301. }
  1302. if (options2.maximumLevel) {
  1303. _ConstructorOptions.maximumLevel = options2.maximumLevel;
  1304. } else {
  1305. _ConstructorOptions.maximumLevel = 18;
  1306. }
  1307. let imageryProvider = new Cesium.WebMapServiceImageryProvider(_ConstructorOptions);
  1308. this._addImageryProvider(options2.id, imageryProvider);
  1309. this.setLayersStyle({
  1310. serviceId: options2.id,
  1311. alpha: options2.alpha
  1312. });
  1313. if (callSuccess)
  1314. callSuccess(options2.id);
  1315. },
  1316. addArcGisMapServer: function(options2, callSuccess) {
  1317. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  1318. throw new Cesium.DeveloperError("options.url is required.");
  1319. }
  1320. options2.id = options2.id || this._guid();
  1321. let _ConstructorOptions = {
  1322. url: options2.url
  1323. };
  1324. if (options2.layers) {
  1325. _ConstructorOptions.layers = options2.layers;
  1326. }
  1327. let imageryProvider = new Cesium.ArcGisMapServerImageryProvider(_ConstructorOptions);
  1328. this._addImageryProvider(options2.id, imageryProvider);
  1329. this.setLayersStyle({
  1330. serviceId: options2.id,
  1331. alpha: options2.alpha
  1332. });
  1333. if (callSuccess)
  1334. callSuccess(options2.id);
  1335. },
  1336. addCesium3DTileset: function(options2, callSuccess) {
  1337. let _self = this;
  1338. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  1339. throw new Cesium.DeveloperError("options.url is required.");
  1340. }
  1341. options2.id = options2.id || this._guid();
  1342. let _ConstructorOptions = {
  1343. url: options2.url,
  1344. skipLevelOfDetail: true
  1345. };
  1346. let tileSetModel = new Cesium.Cesium3DTileset(_ConstructorOptions);
  1347. tileSetModel.readyPromise.then((tileset) => {
  1348. console.log("\u52A0\u8F7D\u5B8C\u6210");
  1349. window[options2.id] = tileset;
  1350. _self._addScenePrimitives(tileset);
  1351. _self.set3DTilePosition({
  1352. serviceId: options2.id,
  1353. height: options2.height
  1354. });
  1355. _self.set3DTileStyle({
  1356. serviceId: options2.id,
  1357. alpha: options2.alpha
  1358. });
  1359. if (callSuccess)
  1360. callSuccess(options2.id);
  1361. }).catch(function(error) {
  1362. console.log(error);
  1363. });
  1364. },
  1365. addCesium3DTilesetBm: function(options2, callSuccess) {
  1366. let _self = this;
  1367. if (!Cesium.defined(options2) || !Cesium.defined(options2.url)) {
  1368. throw new Cesium.DeveloperError("options.url is required.");
  1369. }
  1370. options2.id = options2.id || this._guid();
  1371. let _ConstructorOptions = {
  1372. url: options2.url,
  1373. skipLevelOfDetail: true
  1374. };
  1375. let tileSetModel = new Cesium.Cesium3DTileset(_ConstructorOptions);
  1376. tileSetModel.readyPromise.then((tileset) => {
  1377. console.log("\u52A0\u8F7D\u5B8C\u6210");
  1378. window[options2.id] = tileset;
  1379. _self._addScenePrimitives(tileset);
  1380. _self.set3DTileBMStyle({
  1381. serviceId: options2.id,
  1382. color: options2.color
  1383. });
  1384. if (callSuccess)
  1385. callSuccess(options2.id);
  1386. }).catch(function(error) {
  1387. console.log(error);
  1388. });
  1389. },
  1390. addPolygonImageMaterial: function(options2, callSuccess) {
  1391. if (!Cesium.defined(options2.points)) {
  1392. throw new Cesium.DeveloperError("options.points is required.");
  1393. }
  1394. if (options2.points.length < 3) {
  1395. reject("\u9762\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C113\u4E2A");
  1396. }
  1397. let positions = [];
  1398. if (options2.points instanceof Cesium.Cartesian3) {
  1399. positions = options2.points;
  1400. } else {
  1401. positions = options2.points.map((point2) => {
  1402. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  1403. });
  1404. }
  1405. options2.id = options2.id || this._guid();
  1406. options2.alpha = options2.alpha || 1;
  1407. this.classificationType = Cesium.ClassificationType.BOTH;
  1408. if (options2.classificationType === "Terrain") {
  1409. this.classificationType = Cesium.ClassificationType.TERRAIN;
  1410. } else if (options2.classificationType === "3DTiles") {
  1411. this.classificationType = Cesium.ClassificationType.CESIUM_3D_TILE;
  1412. }
  1413. if (options2.url) {
  1414. if (!Cesium.Entity.supportsMaterialsforEntitiesOnTerrain(this._viewer.scene)) {
  1415. window.alert("Terrain Entity materials are not supported on this platform");
  1416. }
  1417. this.material = new Cesium.ImageMaterialProperty({
  1418. image: options2.url,
  1419. repeat: Cesium.Cartesian2(1, 1),
  1420. transparent: true,
  1421. color: Cesium.Color.WHITE.withAlpha(options2.alpha)
  1422. });
  1423. } else {
  1424. this.material = Cesium.Color.RED.withAlpha(options2.alpha);
  1425. }
  1426. window[options2.id] = this._viewer.entities.add({
  1427. id: options2.id,
  1428. polygon: {
  1429. hierarchy: positions,
  1430. material: this.material,
  1431. classificationType: this.classificationType
  1432. }
  1433. });
  1434. if (callSuccess)
  1435. callSuccess(options2.id);
  1436. },
  1437. addEntitiesGltf: function(options2, callSuccess) {
  1438. let viewer2 = this._viewer;
  1439. if (!Cesium.defined(options2.points)) {
  1440. resolve("options.points is required.");
  1441. throw new Cesium.DeveloperError("options.points is required.");
  1442. }
  1443. if (!Cesium.defined(options2.url)) {
  1444. resolve("options.url is required.");
  1445. throw new Cesium.DeveloperError("options.url is required.");
  1446. }
  1447. options2.id = options2.id || this._guid();
  1448. options2.heading = Cesium.defaultValue(options2.heading, 0);
  1449. options2.pitch = Cesium.defaultValue(options2.pitch, 0);
  1450. options2.roll = Cesium.defaultValue(options2.roll, 0);
  1451. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  1452. let position2 = void 0;
  1453. if (options2.points instanceof Cesium.Cartesian3) {
  1454. position2 = options2.points;
  1455. } else {
  1456. position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
  1457. }
  1458. var heading = Cesium.Math.toRadians(options2.heading);
  1459. var pitch = options2.pitch;
  1460. var roll = options2.roll;
  1461. var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
  1462. var modelGltf = viewer2.entities.add({
  1463. id: options2.id,
  1464. position: position2,
  1465. orientation: Cesium.Transforms.headingPitchRollQuaternion(position2, hpr),
  1466. model: {
  1467. uri: options2.url,
  1468. incrementallyLoadTextures: true,
  1469. colorBlendMode: Cesium.ColorBlendMode["HIGHLIGHT"],
  1470. colorBlendAmount: 0.1,
  1471. color: Cesium.Color.WHITE.withAlpha(options2.alpha),
  1472. imageBasedLightingFactor: new Cesium.Cartesian2(12, 13),
  1473. runAnimations: true,
  1474. show: true,
  1475. debugWireframe: false,
  1476. debugShowBoundingVolume: false
  1477. }
  1478. });
  1479. if (options2.minimumPixelSize) {
  1480. modelGltf.model.minimumPixelSize = options2.minimumPixelSize;
  1481. }
  1482. if (options2.maximumScale) {
  1483. modelGltf.model.maximumScale = options2.maximumScale;
  1484. }
  1485. if (options2.silhouetteColor) {
  1486. modelGltf.model.silhouetteColor = new Cesium.Color(options2.silhouetteColor[0] / 255, options2.silhouetteColor[1] / 255, options2.silhouetteColor[2] / 255, options2.silhouetteColor[3]);
  1487. }
  1488. window[options2.id] = modelGltf;
  1489. if (callSuccess)
  1490. callSuccess(options2.id);
  1491. },
  1492. addScenePrimitivesGltf(options2, callSuccess) {
  1493. let viewer2 = this._viewer;
  1494. if (!Cesium.defined(options2.points)) {
  1495. resolve("options.points is required.");
  1496. throw new Cesium.DeveloperError("options.points is required.");
  1497. }
  1498. if (!Cesium.defined(options2.url)) {
  1499. resolve("options.url is required.");
  1500. throw new Cesium.DeveloperError("options.url is required.");
  1501. }
  1502. options2.id = options2.id || this._guid();
  1503. options2.scale = Cesium.defaultValue(options2.scale, 1);
  1504. let position2 = void 0;
  1505. if (options2.points instanceof Cesium.Cartesian3) {
  1506. position2 = options2.points;
  1507. } else {
  1508. position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
  1509. }
  1510. const modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position2);
  1511. let model = viewer2.scene.primitives.add(
  1512. Cesium.Model.fromGltf({
  1513. show: true,
  1514. url: options2.url,
  1515. modelMatrix,
  1516. lightColor: new Cesium.Cartesian3(10, 10, 10),
  1517. scale: options2.scale,
  1518. debugWireframe: false,
  1519. debugShowBoundingVolume: false
  1520. })
  1521. );
  1522. model.readyPromise.then(function() {
  1523. var rotationX = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(0)));
  1524. Cesium.Matrix4.multiply(model.modelMatrix, rotationX, model.modelMatrix);
  1525. });
  1526. window[options2.id] = model;
  1527. if (callSuccess)
  1528. callSuccess(options2.id);
  1529. },
  1530. addPolylineByGeoJson(options2, callSuccess) {
  1531. let _self = this;
  1532. this._viewer;
  1533. if (!Cesium.defined(options2.url)) {
  1534. resolve("options.url is required.");
  1535. throw new Cesium.DeveloperError("options.url is required.");
  1536. }
  1537. options2.id = options2.id || this._guid();
  1538. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  1539. options2.width = Cesium.defaultValue(options2.width, 3);
  1540. options2.minHeigh = Cesium.defaultValue(options2.minHeigh, 0);
  1541. options2.maxHeigh = Cesium.defaultValue(options2.maxHeigh, 2e8);
  1542. let promise = Cesium.GeoJsonDataSource.load(options2.url, {
  1543. clampToGround: options2.clampToGround
  1544. });
  1545. promise.then((dataSource) => {
  1546. _self._viewer.dataSources.add(dataSource);
  1547. dataSource.name = options2.id;
  1548. let entities2 = dataSource.entities.values;
  1549. let material = new PolylineDirectionMaterialProperty(options2);
  1550. for (var i2 = 0; i2 < entities2.length; i2++) {
  1551. var entity = entities2[i2];
  1552. entity.polyline.material = material;
  1553. entity.polyline.width = options2.width;
  1554. if (options2.clampToGround) {
  1555. entity.polyline.clampToGround = true;
  1556. }
  1557. }
  1558. if (callSuccess)
  1559. callSuccess(options2.id);
  1560. });
  1561. },
  1562. addBillboardByGeoJson(options2, callSuccess) {
  1563. let viewer2 = this._viewer;
  1564. if (!Cesium.defined(options2.url)) {
  1565. resolve("options.url is required.");
  1566. throw new Cesium.DeveloperError("options.url is required.");
  1567. }
  1568. options2.id = options2.id || this._guid();
  1569. let billboard = options2.billboard || {};
  1570. billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
  1571. billboard.scale = Cesium.defaultValue(billboard.scale, 1);
  1572. billboard.pixelOffset = Cesium.defaultValue(billboard.pixelOffset, 0);
  1573. const dataSource = new Cesium.GeoJsonDataSource(options2.id);
  1574. dataSource.load(options2.url, {
  1575. clampToGround: true
  1576. }).then(function(data) {
  1577. viewer2.dataSources.add(data);
  1578. const entities2 = data.entities.values;
  1579. entities2.forEach((entity) => {
  1580. entity.billboard = {
  1581. image: billboard.imgUrl,
  1582. horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
  1583. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1584. scale: billboard.scale,
  1585. pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
  1586. disableDepthTestDistance: Number.POSITIVE_INFINITY
  1587. };
  1588. if (billboard.scaleByDistance) {
  1589. billboard.scaleByDistance.near = Cesium.defaultValue(billboard.scaleByDistance.near, 0);
  1590. billboard.scaleByDistance.nearValue = Cesium.defaultValue(billboard.scaleByDistance.nearValue, 0);
  1591. billboard.scaleByDistance.far = Cesium.defaultValue(billboard.scaleByDistance.far, 1);
  1592. billboard.scaleByDistance.farValue = Cesium.defaultValue(billboard.scaleByDistance.farValue, 0);
  1593. entity.billboard.scaleByDistance = new Cesium.NearFarScalar(billboard.scaleByDistance.near, billboard.scaleByDistance.nearValue, billboard.scaleByDistance.far, billboard.scaleByDistance.farValue);
  1594. }
  1595. if (options2.label) {
  1596. let label = options2.label || {};
  1597. label.text = Cesium.defaultValue(label.text, "");
  1598. label.textField = Cesium.defaultValue(label.textField, "");
  1599. label.font = Cesium.defaultValue(label.font, "24px Helvetica");
  1600. if (label.fillColor instanceof Array) {
  1601. label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
  1602. } else if (typeof options2.color === "string") {
  1603. label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
  1604. } else {
  1605. label.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
  1606. }
  1607. if (label.outlineColor instanceof Array) {
  1608. label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
  1609. } else if (label.outlineColor instanceof String) {
  1610. label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
  1611. } else {
  1612. label.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1613. }
  1614. label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
  1615. label.showBackground = Cesium.defaultValue(label.showBackground, false);
  1616. if (label.backgroundColor instanceof Array) {
  1617. label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
  1618. } else if (label.backgroundColor instanceof String) {
  1619. label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
  1620. } else {
  1621. label.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1622. }
  1623. label.pixelOffset = Cesium.defaultValue(label.pixelOffset, 0);
  1624. label.scale = Cesium.defaultValue(label.scale, 1);
  1625. label.near = Cesium.defaultValue(label.near, 150);
  1626. label.nearValue = Cesium.defaultValue(label.nearValue, 1);
  1627. label.far = Cesium.defaultValue(label.far, 2400);
  1628. label.farValue = Cesium.defaultValue(label.farValue, 0);
  1629. let labelText = label.text;
  1630. if (entity.properties[label.textField]) {
  1631. labelText = entity.properties[label.textField]._value;
  1632. }
  1633. if (labelText === "") {
  1634. labelText = (i + 1).toString();
  1635. }
  1636. entity.label = {
  1637. text: labelText.toString(),
  1638. font: label.font,
  1639. fillColor: label.fillColor,
  1640. outlineColor: label.outlineColor,
  1641. outlineWidth: label.outlineWidth,
  1642. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  1643. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1644. showBackground: label.showBackground,
  1645. backgroundColor: label.backgroundColor,
  1646. backgroundPadding: new Cesium.Cartesian2(6, 6),
  1647. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1648. pixelOffset: new Cesium.Cartesian2(0, label.pixelOffset),
  1649. scale: label.scale
  1650. };
  1651. if (label.scaleByDistance) {
  1652. label.scaleByDistance.near = Cesium.defaultValue(label.scaleByDistance.near, 0);
  1653. label.scaleByDistance.nearValue = Cesium.defaultValue(label.scaleByDistance.nearValue, 0);
  1654. label.scaleByDistance.far = Cesium.defaultValue(label.scaleByDistance.far, 1);
  1655. label.scaleByDistance.farValue = Cesium.defaultValue(label.scaleByDistance.farValue, 0);
  1656. entity.label.scaleByDistance = new Cesium.NearFarScalar(label.scaleByDistance.near, label.scaleByDistance.nearValue, label.scaleByDistance.far, label.scaleByDistance.farValue);
  1657. }
  1658. }
  1659. });
  1660. if (callSuccess)
  1661. callSuccess(options2.id);
  1662. });
  1663. },
  1664. addBillboardByJson(options2, callSuccess) {
  1665. let viewer2 = this._viewer;
  1666. if (!Cesium.defined(options2.url)) {
  1667. resolve("options.url is required.");
  1668. throw new Cesium.DeveloperError("options.url is required.");
  1669. }
  1670. options2.id = options2.id || this._guid();
  1671. let billboard = options2.billboard || {};
  1672. billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
  1673. billboard.scale = Cesium.defaultValue(billboard.scale, 1);
  1674. billboard.pixelOffset = Cesium.defaultValue(billboard.pixelOffset, 0);
  1675. fetch(options2.url).then((res) => {
  1676. return res.json();
  1677. }).then((res) => {
  1678. for (var i2 = 0; i2 < res.features.length; i2++) {
  1679. let coordinates = res.features[i2].geometry.coordinates;
  1680. let position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
  1681. let Point = new Cesium.CustomDataSource(options2.id);
  1682. viewer2.dataSources.add(Point);
  1683. let entity = new Cesium.Entity({
  1684. name: "add billboard",
  1685. position: position2,
  1686. billboard: {
  1687. image: billboard.imgUrl,
  1688. horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
  1689. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1690. scale: billboard.scale,
  1691. pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
  1692. disableDepthTestDistance: Number.POSITIVE_INFINITY
  1693. }
  1694. });
  1695. if (billboard.scaleByDistance) {
  1696. billboard.scaleByDistance.near = Cesium.defaultValue(billboard.scaleByDistance.near, 0);
  1697. billboard.scaleByDistance.nearValue = Cesium.defaultValue(billboard.scaleByDistance.nearValue, 0);
  1698. billboard.scaleByDistance.far = Cesium.defaultValue(billboard.scaleByDistance.far, 1);
  1699. billboard.scaleByDistance.farValue = Cesium.defaultValue(billboard.scaleByDistance.farValue, 0);
  1700. entity.billboard.scaleByDistance = new Cesium.NearFarScalar(billboard.scaleByDistance.near, billboard.scaleByDistance.nearValue, billboard.scaleByDistance.far, billboard.scaleByDistance.farValue);
  1701. }
  1702. if (options2.label) {
  1703. let label = options2.label || {};
  1704. label.text = Cesium.defaultValue(label.text, "");
  1705. label.textField = Cesium.defaultValue(label.textField, "");
  1706. label.font = Cesium.defaultValue(label.font, "24px Helvetica");
  1707. if (label.fillColor instanceof Array) {
  1708. label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
  1709. } else if (typeof options2.color === "string") {
  1710. label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
  1711. } else {
  1712. label.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
  1713. }
  1714. if (label.outlineColor instanceof Array) {
  1715. label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
  1716. } else if (label.outlineColor instanceof String) {
  1717. label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
  1718. } else {
  1719. label.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1720. }
  1721. label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
  1722. label.showBackground = Cesium.defaultValue(label.showBackground, false);
  1723. if (label.backgroundColor instanceof Array) {
  1724. label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
  1725. } else if (label.backgroundColor instanceof String) {
  1726. label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
  1727. } else {
  1728. label.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  1729. }
  1730. label.pixelOffset = Cesium.defaultValue(label.pixelOffset, 0);
  1731. label.scale = Cesium.defaultValue(label.scale, 1);
  1732. label.near = Cesium.defaultValue(label.near, 150);
  1733. label.nearValue = Cesium.defaultValue(label.nearValue, 1);
  1734. label.far = Cesium.defaultValue(label.far, 2400);
  1735. label.farValue = Cesium.defaultValue(label.farValue, 0);
  1736. let labelText = label.text;
  1737. if (res.features[i2].properties[label.textField]) {
  1738. labelText = res.features[i2].properties[label.textField];
  1739. }
  1740. if (labelText === "") {
  1741. labelText = (i2 + 1).toString();
  1742. }
  1743. entity.label = {
  1744. text: labelText.toString(),
  1745. font: label.font,
  1746. fillColor: label.fillColor,
  1747. outlineColor: label.outlineColor,
  1748. outlineWidth: label.outlineWidth,
  1749. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  1750. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  1751. showBackground: label.showBackground,
  1752. backgroundColor: label.backgroundColor,
  1753. backgroundPadding: new Cesium.Cartesian2(6, 6),
  1754. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  1755. pixelOffset: new Cesium.Cartesian2(0, label.pixelOffset),
  1756. scale: label.scale
  1757. };
  1758. if (label.scaleByDistance) {
  1759. label.scaleByDistance.near = Cesium.defaultValue(label.scaleByDistance.near, 0);
  1760. label.scaleByDistance.nearValue = Cesium.defaultValue(label.scaleByDistance.nearValue, 0);
  1761. label.scaleByDistance.far = Cesium.defaultValue(label.scaleByDistance.far, 1);
  1762. label.scaleByDistance.farValue = Cesium.defaultValue(label.scaleByDistance.farValue, 0);
  1763. entity.label.scaleByDistance = new Cesium.NearFarScalar(label.scaleByDistance.near, label.scaleByDistance.nearValue, label.scaleByDistance.far, label.scaleByDistance.farValue);
  1764. }
  1765. }
  1766. Point.entities.add(entity);
  1767. }
  1768. if (callSuccess)
  1769. callSuccess(options2.id);
  1770. });
  1771. },
  1772. addWallByJson(options2, callSuccess) {
  1773. let viewer2 = this._viewer;
  1774. if (!Cesium.defined(options2.url)) {
  1775. resolve("options.url is required.");
  1776. throw new Cesium.DeveloperError("options.url is required.");
  1777. }
  1778. options2 = options2 || {};
  1779. options2.id = options2.id || setSessionid();
  1780. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  1781. options2.minimunHeights = options2.minimunHeights !== void 0 && typeof options2.minimunHeights === "number" ? options2.minimunHeights : 0;
  1782. options2.maximumHeights = options2.maximumHeights !== void 0 && typeof options2.maximumHeights === "number" ? options2.maximumHeights : 1e3;
  1783. if (options2.color) {
  1784. if (options2.color instanceof Array) {
  1785. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  1786. } else if (typeof options2.color === "string") {
  1787. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  1788. } else {
  1789. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  1790. }
  1791. }
  1792. options2.trailImage = Cesium.defaultValue(options2.trailImage, "jt3dSDK/imgs/wallmaterial/wl.png");
  1793. options2.duration = Cesium.defaultValue(options2.duration, 3e3);
  1794. options2.count = Cesium.defaultValue(options2.count, 1);
  1795. options2.direction = Cesium.defaultValue(options2.direction, "vertical");
  1796. options2.order = Cesium.defaultValue(options2.order, "-");
  1797. fetch(options2.url).then((res) => {
  1798. return res.json();
  1799. }).then((res) => {
  1800. for (var i2 = 0; i2 < res.features.length; i2++) {
  1801. let coordinates = res.features[i2].geometry.coordinates;
  1802. let positions = coordinates.map((point2) => {
  1803. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  1804. });
  1805. let wall = new Cesium.CustomDataSource(options2.id);
  1806. viewer2.dataSources.add(wall);
  1807. let entity = new Cesium.Entity({
  1808. name: "\u7ACB\u4F53\u5899\u6548\u679C",
  1809. wall: {
  1810. positions,
  1811. maximumHeights: new Array(positions.length).fill(options2.maximumHeights),
  1812. minimunHeights: new Array(positions.length).fill(options2.minimunHeights),
  1813. material: new WallMaterialProperty$1(viewer2, {
  1814. trailImage: options2.trailImage,
  1815. color: options2.color,
  1816. duration: options2.duration,
  1817. param: {
  1818. count: options2.count,
  1819. direction: options2.direction,
  1820. order: options2.order
  1821. }
  1822. })
  1823. }
  1824. });
  1825. wall.entities.add(entity);
  1826. }
  1827. if (callSuccess)
  1828. callSuccess(options2.id);
  1829. });
  1830. }
  1831. });
  1832. Object.assign(LoadMapData.prototype, {
  1833. set3DTileStyle(options2) {
  1834. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  1835. throw new Cesium.DeveloperError("options.serviceId is required.");
  1836. }
  1837. if (Cesium.defined(options2.alpha)) {
  1838. Cesium.Check.typeOf.number("alpha", options2.alpha);
  1839. }
  1840. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  1841. let tileset = window[options2.serviceId];
  1842. tileset.style = new Cesium.Cesium3DTileStyle({
  1843. color: "color('rgba(255,255,255," + options2.alpha + ")')"
  1844. });
  1845. },
  1846. set3DTileBMStyle: function(options2) {
  1847. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  1848. throw new Cesium.DeveloperError("options.serviceId is required.");
  1849. }
  1850. options2.color = options2.color ? "vec4(" + options2.color[0] + "/255, " + options2.color[1] + "/255, " + options2.color[2] + "/255, " + options2.color[3] + ")" : "vec4(0.0, 0.58, 0.86, 1.0)";
  1851. let tileset = window[options2.serviceId];
  1852. tileset.readyPromise.then((tileset2) => {
  1853. tileset2.boundingSphere.radius;
  1854. if (tileset2.boundingSphere.radius > 1e4) {
  1855. tileset2.boundingSphere.radius / 10;
  1856. }
  1857. tileset2.style = new Cesium.Cesium3DTileStyle({
  1858. color: options2.color
  1859. });
  1860. tileset2.tileVisible.addEventListener((tile) => {
  1861. let content = tile.content;
  1862. let featuresLength = content.featuresLength;
  1863. for (let i2 = 0; i2 < featuresLength; i2 += 2) {
  1864. const feature2 = content.getFeature(i2);
  1865. const model = feature2.content._model;
  1866. if (model && model._sourcePrograms && model._rendererResources) {
  1867. Object.keys(model._sourcePrograms).forEach((key) => {
  1868. const program = model._sourcePrograms[key];
  1869. const fragmentShader = model._rendererResources.sourceShaders[program.fragmentShader];
  1870. let vPosition = "";
  1871. if (fragmentShader.indexOf(" v_positionEC;") !== -1) {
  1872. vPosition = "v_positionEC";
  1873. } else if (fragmentShader.indexOf(" v_pos;") !== -1) {
  1874. vPosition = "v_pos";
  1875. }
  1876. const color2 = `vec4(${feature2.color.toString()})`;
  1877. model._rendererResources.sourceShaders[program.fragmentShader] = `
  1878. varying vec3 ${vPosition};
  1879. void main(void){
  1880. vec4 v_helsing_position = czm_inverseModelView * vec4(${vPosition},1);
  1881. float _baseHeight = -30.0;
  1882. float vtxf_height = v_helsing_position.z - _baseHeight;
  1883. float stc_pl = fract(czm_frameNumber / 120.0) * 3.14159265 * 2.0;
  1884. float stc_sd = vtxf_height / 30.0 + sin(stc_pl) * 0.1;
  1885. gl_FragColor = ${color2};
  1886. gl_FragColor *= vec4(stc_sd, stc_sd, stc_sd, 1.0);
  1887. /* \u626B\u63CF\u7EBF */
  1888. float glowRange = 80.0;
  1889. float stc_a13 = fract(czm_frameNumber / 460.0);
  1890. float stc_h = clamp(v_helsing_position.z / glowRange, 0.0, 1.0);
  1891. stc_a13 = abs(stc_a13 - 0.5) * 1.0;
  1892. float stc_diff = step(0.003, abs(stc_h - stc_a13));
  1893. gl_FragColor.rgb += gl_FragColor.rgb * (1.0 - stc_diff);
  1894. }
  1895. `;
  1896. });
  1897. model._shouldRegenerateShaders = true;
  1898. }
  1899. }
  1900. });
  1901. });
  1902. this._viewer.scene.requestRender();
  1903. },
  1904. set3DTilePosition: function(options2) {
  1905. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  1906. throw new Cesium.DeveloperError("options.serviceId is required.");
  1907. }
  1908. options2.height = Cesium.defaultValue(options2.height, 0);
  1909. let boundingSphere = window[options2.serviceId].boundingSphere;
  1910. let cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
  1911. let left = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, options2.height);
  1912. let right = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0);
  1913. let translation = Cesium.Cartesian3.subtract(left, right, new Cesium.Cartesian3());
  1914. window[options2.serviceId].modelMatrix = Cesium.Matrix4.fromTranslation(translation);
  1915. this._viewer.scene.requestRender();
  1916. },
  1917. setLayersStyle(options2) {
  1918. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  1919. throw new Cesium.DeveloperError("options.serviceId is required.");
  1920. }
  1921. let layer = window[options2.serviceId];
  1922. if (Cesium.defined(options2.alpha)) {
  1923. Cesium.Check.typeOf.number("alpha", options2.alpha);
  1924. }
  1925. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  1926. layer.alpha = options2.alpha;
  1927. if (Cesium.defined(options2.brightness)) {
  1928. Cesium.Check.typeOf.number("brightness", options2.brightness);
  1929. }
  1930. options2.brightness = Cesium.defaultValue(options2.brightness, 1);
  1931. layer.brightness = options2.brightness;
  1932. if (Cesium.defined(options2.contrast)) {
  1933. Cesium.Check.typeOf.number("contrast", options2.contrast);
  1934. }
  1935. options2.contrast = Cesium.defaultValue(options2.contrast, 1);
  1936. layer.contrast = options2.contrast;
  1937. if (Cesium.defined(options2.gamma)) {
  1938. Cesium.Check.typeOf.number("gamma", options2.gamma);
  1939. }
  1940. options2.gamma = Cesium.defaultValue(options2.gamma, 1);
  1941. layer.gamma = options2.gamma;
  1942. if (Cesium.defined(options2.hue)) {
  1943. Cesium.Check.typeOf.number("hue", options2.hue);
  1944. }
  1945. options2.hue = Cesium.defaultValue(options2.hue, 0);
  1946. layer.hue = options2.hue;
  1947. if (Cesium.defined(options2.saturation)) {
  1948. Cesium.Check.typeOf.number("saturation", options2.saturation);
  1949. }
  1950. options2.saturation = Cesium.defaultValue(options2.saturation, 1);
  1951. layer.saturation = options2.saturation;
  1952. },
  1953. setPolygonImageMaterial(options2) {
  1954. if (Cesium.defined(options2.alpha)) {
  1955. Cesium.Check.typeOf.number("alpha", options2.alpha);
  1956. }
  1957. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  1958. let entity = window[options2.serviceId];
  1959. entity.polygon.material.color._value.alpha = options2.alpha;
  1960. },
  1961. setModelStyle(options2) {
  1962. if (Cesium.defined(options2.alpha)) {
  1963. Cesium.Check.typeOf.number("alpha", options2.alpha);
  1964. }
  1965. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  1966. let entity = window[options2.serviceId];
  1967. if (entity.model) {
  1968. entity.model.color._value.alpha = options2.alpha;
  1969. } else {
  1970. entity.color._value.alpha = options2.alpha;
  1971. }
  1972. },
  1973. setTerrainExaggeration(options2) {
  1974. if (Cesium.defined(options2.terrainExaggeration)) {
  1975. Cesium.Check.typeOf.number("terrainExaggeration", options2.terrainExaggeration);
  1976. }
  1977. options2.terrainExaggeration = Cesium.defaultValue(options2.terrainExaggeration, 1);
  1978. this._viewer.scene.globe.terrainExaggeration = options2.terrainExaggeration;
  1979. }
  1980. });
  1981. Object.assign(LoadMapData.prototype, {
  1982. removeImageryProvider(options2) {
  1983. return new Promise((resolve2, reject2) => {
  1984. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  1985. throw new Cesium.DeveloperError("options.serviceId is required.");
  1986. }
  1987. this._removeImageryProvider(options2.serviceId);
  1988. resolve2(true);
  1989. });
  1990. },
  1991. removeTerrain() {
  1992. return new Promise((resolve2, reject2) => {
  1993. this._setEllipsoidTerrain();
  1994. resolve2(true);
  1995. });
  1996. },
  1997. removeScenePrimitives(options2) {
  1998. return new Promise((resolve2, reject2) => {
  1999. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  2000. throw new Cesium.DeveloperError("options.serviceId is required.");
  2001. }
  2002. this._removeScenePrimitives(options2.serviceId);
  2003. resolve2(true);
  2004. });
  2005. },
  2006. removeEntity(options2) {
  2007. return new Promise((resolve2, reject2) => {
  2008. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  2009. throw new Cesium.DeveloperError("options.serviceId is required.");
  2010. }
  2011. this._viewer.entities.remove(window[options2.serviceId]);
  2012. window[options2.serviceId] = null;
  2013. resolve2(true);
  2014. });
  2015. },
  2016. removeDataSources(options2) {
  2017. let viewer2 = this._viewer;
  2018. return new Promise((resolve2, reject2) => {
  2019. if (!Cesium.defined(options2) || !Cesium.defined(options2.serviceId)) {
  2020. throw new Cesium.DeveloperError("options.serviceId is required.");
  2021. }
  2022. let list = viewer2.dataSources.getByName(options2.serviceId);
  2023. list.forEach((res, index2) => {
  2024. viewer2.dataSources.remove(res);
  2025. if (index2 === list.length - 1) {
  2026. resolve2(true);
  2027. }
  2028. });
  2029. });
  2030. }
  2031. });
  2032. Date.prototype.Format = function(fmt) {
  2033. var o = {
  2034. "M+": this.getMonth() + 1,
  2035. "d+": this.getDate(),
  2036. "h+": this.getHours(),
  2037. "m+": this.getMinutes(),
  2038. "s+": this.getSeconds(),
  2039. "q+": Math.floor((this.getMonth() + 3) / 3),
  2040. "S": this.getMilliseconds()
  2041. };
  2042. if (/(y+)/.test(fmt))
  2043. fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
  2044. for (var k in o)
  2045. if (new RegExp("(" + k + ")").test(fmt))
  2046. fmt = fmt.replace(RegExp.$1, RegExp.$1.length == 1 ? o[k] : ("00" + o[k]).substr(("" + o[k]).length));
  2047. return fmt;
  2048. };
  2049. class CrImageServerLayer {
  2050. constructor({
  2051. viewer: viewer2,
  2052. url,
  2053. opacity = 0.75,
  2054. show = true
  2055. } = {}) {
  2056. this._viewer = viewer2;
  2057. this._url = url;
  2058. this._opacity = opacity;
  2059. this._renderName = this._guid();
  2060. let dataSource = new Cesium.CustomDataSource(this._renderName);
  2061. this._viewer.dataSources.add(dataSource);
  2062. this._entities = dataSource.entities;
  2063. this._renderEntities = /* @__PURE__ */ new Map();
  2064. this._isUpdateTile = show;
  2065. this._isDebug = false;
  2066. this._init();
  2067. }
  2068. _init() {
  2069. let _self = this;
  2070. this._provider = new Cesium.ArcGisMapServerImageryProvider({
  2071. url: _self._url
  2072. });
  2073. this._provider.readyPromise.then(function(result) {
  2074. _self._rectangle = _self._provider.rectangle;
  2075. if (_self._isDebug)
  2076. _self._printDebug();
  2077. _self._viewer.scene.postRender.addEventListener(() => {
  2078. if (_self._isUpdateTile) {
  2079. _self._isUpdateTile = false;
  2080. _self._renderTiles();
  2081. }
  2082. });
  2083. });
  2084. }
  2085. _guid() {
  2086. function S4() {
  2087. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  2088. }
  2089. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  2090. }
  2091. _printDebug() {
  2092. this._provider.tilingScheme;
  2093. let tiling84 = new Cesium.GeographicTilingScheme();
  2094. this._drawDebugRectangle(this._rectangle, Cesium.Color.GREEN);
  2095. tiling84.tileXYToRectangle(1696, 312, 10);
  2096. }
  2097. _drawDebugRectangle(rectangle, color2) {
  2098. let positions = this._calculateRectangleOutlineCoordinates(rectangle);
  2099. let rectEntity = new Cesium.Entity({
  2100. name: this._renderName,
  2101. polyline: {
  2102. positions,
  2103. material: color2,
  2104. width: 10,
  2105. clampToGround: true
  2106. }
  2107. });
  2108. this._entities.add(rectEntity);
  2109. }
  2110. _console(...rest) {
  2111. if (this._isDebug)
  2112. console.log("===" + new Date().Format("yyyy-MM-dd HH:mm:ss") + ">>>", rest);
  2113. }
  2114. _renderTiles() {
  2115. let _self = this;
  2116. let tilesToRender = this._viewer.scene.globe._surface._tilesToRender;
  2117. if (tilesToRender === void 0 || tilesToRender.length === 0) {
  2118. this._isUpdateTile = true;
  2119. return;
  2120. } else {
  2121. new Promise((resolve2, reject2) => {
  2122. tilesToRender.sort(function(obj1, obj2) {
  2123. let level1 = parseInt(obj1.level);
  2124. let level2 = parseInt(obj2.level);
  2125. return level1 - level2;
  2126. });
  2127. resolve2(tilesToRender);
  2128. }).then((tiles) => {
  2129. _self._asyncProjectionTiles(tiles);
  2130. });
  2131. }
  2132. }
  2133. _createKey(x, y, level) {
  2134. let key = `${this._renderName}_${x}_${y}_${level}`;
  2135. return key;
  2136. }
  2137. _asyncProjectionTiles(tiles) {
  2138. let renderTiles = [];
  2139. for (let tile of tiles) {
  2140. let proTiles = this._projectionTile(tile);
  2141. for (let proTile of proTiles) {
  2142. let key = this._createKey(proTile.x, proTile.y, proTile.level);
  2143. let subTile = renderTiles.find((obj) => {
  2144. return obj.x === proTile.x && obj.y === proTile.y;
  2145. });
  2146. if (subTile === void 0) {
  2147. let isExists = false;
  2148. for (let eTile of renderTiles) {
  2149. if (Cesium.Rectangle.intersection(eTile.rectangle, proTile.rectangle)) {
  2150. eTile.childTiles.push(key);
  2151. isExists = true;
  2152. break;
  2153. }
  2154. }
  2155. if (!isExists) {
  2156. renderTiles.push({
  2157. key,
  2158. x: proTile.x,
  2159. y: proTile.y,
  2160. level: proTile.level,
  2161. rectangle: proTile.rectangle,
  2162. childTiles: []
  2163. });
  2164. }
  2165. }
  2166. }
  2167. }
  2168. let i2 = renderTiles.length;
  2169. let appendTiles = [];
  2170. while (i2--) {
  2171. let findTile = renderTiles[i2];
  2172. if (findTile.childTiles.length >= 1) {
  2173. let tiles2 = this._createFourTiles(findTile);
  2174. for (let tile of tiles2) {
  2175. appendTiles.push(tile);
  2176. }
  2177. renderTiles.splice(i2, 1);
  2178. }
  2179. }
  2180. for (let appendTile of appendTiles) {
  2181. renderTiles.push(appendTile);
  2182. }
  2183. renderTiles.sort(function(obj1, obj2) {
  2184. let level1 = parseInt(obj1.level);
  2185. let level2 = parseInt(obj2.level);
  2186. return level1 - level2;
  2187. });
  2188. this._renderTilesToViewer(renderTiles);
  2189. }
  2190. _createTileByRectangleAndLevel(rectangle, level) {
  2191. let center2 = Cesium.Rectangle.center(rectangle);
  2192. let nLevel = parseInt(level) + 1;
  2193. let query = this._provider.tilingScheme.positionToTileXY(center2, nLevel);
  2194. if (query === void 0)
  2195. return void 0;
  2196. return {
  2197. key: this._createKey(query.x, query.y, nLevel),
  2198. x: query.x,
  2199. y: query.y,
  2200. level: nLevel,
  2201. rectangle,
  2202. childTiles: []
  2203. };
  2204. }
  2205. _createFourTiles(tile) {
  2206. let rects = [];
  2207. let results = [];
  2208. let rectangle = tile.rectangle;
  2209. rects.push(Cesium.Rectangle.subsection(rectangle, 0, 0, 0.5, 0.5));
  2210. rects.push(Cesium.Rectangle.subsection(rectangle, 0.5, 0, 1, 0.5));
  2211. rects.push(Cesium.Rectangle.subsection(rectangle, 0, 0.5, 0.5, 1));
  2212. rects.push(Cesium.Rectangle.subsection(rectangle, 0.5, 0.5, 1, 1));
  2213. for (let rect of rects) {
  2214. if (Cesium.Rectangle.intersection(rect, this._rectangle)) {
  2215. let newTile = this._createTileByRectangleAndLevel(rect, tile.level);
  2216. if (newTile !== void 0)
  2217. results.push(newTile);
  2218. }
  2219. }
  2220. return results;
  2221. }
  2222. _renderTilesToViewer(tiles) {
  2223. let _self = this;
  2224. let deleteKeys = [];
  2225. for (let [key, tile] of this._renderEntities) {
  2226. let findTile = tiles.find((obj) => {
  2227. return obj.key === key;
  2228. });
  2229. if (findTile === void 0) {
  2230. deleteKeys.push(key);
  2231. }
  2232. }
  2233. for (let key of deleteKeys) {
  2234. this._renderEntities.delete(key);
  2235. this._entities.removeById(key);
  2236. }
  2237. for (let tile of tiles) {
  2238. if (!this._renderEntities.has(tile.key)) {
  2239. let entity = this._renderSimpleTileToViewer(tile);
  2240. this._renderEntities.set(tile.key, entity);
  2241. let workBlob = new Blob([`(${downloadWorker.toString()})()`]);
  2242. let worker = new Worker(URL.createObjectURL(workBlob));
  2243. worker.postMessage({
  2244. key: tile.key,
  2245. url: this._url,
  2246. x: tile.x,
  2247. y: tile.y,
  2248. level: tile.level
  2249. });
  2250. worker.onmessage = function(event2) {
  2251. _self._console(`render x:${event2.data.x} y:${event2.data.y} level:${event2.data.level}`);
  2252. let renderEntity = _self._entities.getById(event2.data.key);
  2253. if (renderEntity !== void 0) {
  2254. event2.data.key;
  2255. const canvas = _self._createCanvas(event2.data, event2.data.image, _self._isDebug);
  2256. renderEntity.rectangle.material = canvas;
  2257. }
  2258. worker.terminate();
  2259. };
  2260. }
  2261. }
  2262. this._isUpdateTile = true;
  2263. }
  2264. _renderSimpleTileToViewer(tile) {
  2265. const canvas = this._createCanvas(tile, void 0, this._isDebug);
  2266. let bjPositions = this._calculateRectangleOutlineCoordinates(tile.rectangle);
  2267. let tileEntity = new Cesium.Entity({
  2268. name: this._renderName,
  2269. id: tile.key,
  2270. rectangle: {
  2271. coordinates: tile.rectangle,
  2272. material: canvas
  2273. },
  2274. polyline: {
  2275. positions: bjPositions,
  2276. material: Cesium.Color.YELLOW.withAlpha(this._isDebug ? 1 : 0),
  2277. width: 1,
  2278. clampToGround: true
  2279. }
  2280. });
  2281. return this._entities.add(tileEntity);
  2282. }
  2283. _createCanvas(tile, image, islabel) {
  2284. let provider = this._provider;
  2285. const canvas = document.createElement("canvas");
  2286. canvas.width = provider.tileWidth;
  2287. canvas.height = provider.tileHeight;
  2288. const context = canvas.getContext("2d");
  2289. if (image !== void 0) {
  2290. context.globalAlpha = this._opacity;
  2291. context.drawImage(event.data.image, 0, 0, canvas.width, canvas.height);
  2292. }
  2293. if (islabel !== void 0 && islabel === true) {
  2294. context.globalAlpha = 1;
  2295. context.font = "20px Arial";
  2296. context.textAlign = "center";
  2297. context.fillStyle = "rgba(255,255,0)";
  2298. context.strokeStyle = "rgba(255,255,255,1)";
  2299. context.lineWidth = 2;
  2300. context.strokeText(`L: ${tile.level}`, 126, 86);
  2301. context.fillText(`L: ${tile.level}`, 126, 86);
  2302. context.strokeText(`X: ${tile.x}`, 126, 136);
  2303. context.fillText(`X: ${tile.x}`, 126, 136);
  2304. context.strokeText(`Y: ${tile.y}`, 126, 186);
  2305. context.fillText(`Y: ${tile.y}`, 126, 186);
  2306. }
  2307. return canvas;
  2308. }
  2309. _projectionTile(tile) {
  2310. let rectangle = tile._rectangle;
  2311. let imageryLevel = parseInt(tile.level);
  2312. let mercatorTilingScheme = this._provider.tilingScheme;
  2313. let res = [];
  2314. let interRectangle = Cesium.Rectangle.intersection(rectangle, this._rectangle);
  2315. if (interRectangle === void 0)
  2316. return res;
  2317. let northwestTileCoordinates = mercatorTilingScheme.positionToTileXY(
  2318. Cesium.Rectangle.northwest(rectangle),
  2319. imageryLevel
  2320. );
  2321. let southeastTileCoordinates = mercatorTilingScheme.positionToTileXY(
  2322. Cesium.Rectangle.southeast(rectangle),
  2323. imageryLevel
  2324. );
  2325. if (northwestTileCoordinates !== void 0 && southeastTileCoordinates !== void 0) {
  2326. for (let i2 = northwestTileCoordinates.x; i2 <= southeastTileCoordinates.x; i2++) {
  2327. for (let j = northwestTileCoordinates.y; j <= southeastTileCoordinates.y; j++) {
  2328. let _webRectangle = mercatorTilingScheme.tileXYToRectangle(i2, j, imageryLevel);
  2329. if (Cesium.Rectangle.intersection(_webRectangle, this._rectangle)) {
  2330. res.push({
  2331. x: i2,
  2332. y: j,
  2333. level: imageryLevel,
  2334. rectangle: _webRectangle
  2335. });
  2336. }
  2337. }
  2338. }
  2339. } else if (northwestTileCoordinates !== void 0) {
  2340. let _webRectangle = mercatorTilingScheme.tileXYToRectangle(
  2341. northwestTileCoordinates.x,
  2342. northwestTileCoordinates.y,
  2343. imageryLevel
  2344. );
  2345. if (Cesium.Rectangle.intersection(_webRectangle, this._rectangle)) {
  2346. res.push({
  2347. x: northwestTileCoordinates.x,
  2348. y: northwestTileCoordinates.y,
  2349. level: imageryLevel,
  2350. rectangle: _webRectangle
  2351. });
  2352. }
  2353. } else if (southeastTileCoordinates !== void 0) {
  2354. let _webRectangle = mercatorTilingScheme.tileXYToRectangle(
  2355. southeastTileCoordinates.x,
  2356. southeastTileCoordinates.y,
  2357. imageryLevel
  2358. );
  2359. if (Cesium.Rectangle.intersection(_webRectangle, this._rectangle)) {
  2360. res.push({
  2361. x: southeastTileCoordinates.x,
  2362. y: southeastTileCoordinates.y,
  2363. level: imageryLevel,
  2364. rectangle: _webRectangle
  2365. });
  2366. }
  2367. }
  2368. return res;
  2369. }
  2370. _calculateRectangleOutlineCoordinates(rectangle) {
  2371. let south_east = Cesium.Rectangle.southeast(rectangle);
  2372. let se2 = Cesium.Cartographic.toCartesian(south_east);
  2373. let south_west = Cesium.Rectangle.southwest(rectangle);
  2374. let sw = Cesium.Cartographic.toCartesian(south_west);
  2375. let north_east = Cesium.Rectangle.northeast(rectangle);
  2376. let ne2 = Cesium.Cartographic.toCartesian(north_east);
  2377. let north_west = Cesium.Rectangle.northwest(rectangle);
  2378. let nw = Cesium.Cartographic.toCartesian(north_west);
  2379. return [sw, se2, ne2, nw, sw];
  2380. }
  2381. _removeEntityByName(entityName) {
  2382. var entities2 = this._entities;
  2383. if (!entities2 || !entities2.values)
  2384. return;
  2385. var delEntitys = [];
  2386. for (var i2 = 0; i2 < entities2.values.length; i2++) {
  2387. if (entities2.values[i2].name == entityName) {
  2388. delEntitys.push(entities2.values[i2]);
  2389. }
  2390. }
  2391. for (var i2 = 0; i2 < delEntitys.length; i2++) {
  2392. entities2.remove(delEntitys[i2]);
  2393. }
  2394. }
  2395. }
  2396. Object.assign(CrImageServerLayer.prototype, {
  2397. hide: function() {
  2398. this._console("\u9690\u85CF");
  2399. this._isUpdateTile = false;
  2400. this._removeEntityByName(this._renderName);
  2401. this._renderEntities.clear();
  2402. },
  2403. show: function() {
  2404. this._console("\u663E\u793A");
  2405. this._isUpdateTile = true;
  2406. },
  2407. setOpacity: function(opacity) {
  2408. if (opacity === void 0 || typeof opacity !== "number")
  2409. return;
  2410. if (opacity >= 1)
  2411. this._opacity = 1;
  2412. if (opacity <= 0)
  2413. this._opacity = 0;
  2414. this._opacity = parseFloat(opacity);
  2415. }
  2416. });
  2417. function downloadWorker() {
  2418. onmessage = function(event2) {
  2419. let data = event2.data;
  2420. let url = data.url + "/tile/" + data.level + "/" + data.y + "/" + data.x;
  2421. let xhr = new XMLHttpRequest();
  2422. xhr.open("get", url, true);
  2423. xhr.responseType = "blob";
  2424. xhr.onload = function() {
  2425. if (this.status === 200) {
  2426. var blob = this.response;
  2427. var bmpPromise = createImageBitmap(blob, {
  2428. imageOrientation: "none",
  2429. premultiplyAlpha: "none",
  2430. colorSpaceConversion: "default"
  2431. });
  2432. bmpPromise.then(function(image) {
  2433. let outObj = {
  2434. key: data.key,
  2435. x: data.x,
  2436. y: data.y,
  2437. level: data.level,
  2438. image
  2439. };
  2440. postMessage(outObj);
  2441. });
  2442. } else {
  2443. console.log("===>>>", url + " Not found");
  2444. }
  2445. };
  2446. xhr.send();
  2447. };
  2448. }
  2449. class LocateUtil {
  2450. constructor(viewer2) {
  2451. if (!viewer2)
  2452. throw new Cesium.DeveloperError("no viewer object!");
  2453. this._viewer = viewer2;
  2454. this._locationEntity = null;
  2455. }
  2456. }
  2457. Object.assign(LocateUtil.prototype, {
  2458. flyToPoint: function(options2) {
  2459. return new Promise((resolve2, reject2) => {
  2460. if (!Cesium.defined(options2) || !Cesium.defined(options2.longitude) || !Cesium.defined(options2.latitude)) {
  2461. throw new Cesium.DeveloperError("options.longitude and options.latitude are required.");
  2462. }
  2463. options2.height = Cesium.defaultValue(options2.height, 0);
  2464. options2.heading = Cesium.defaultValue(options2.heading, 0);
  2465. options2.pitch = Cesium.defaultValue(options2.pitch, -90);
  2466. options2.range = Cesium.defaultValue(options2.range, 0);
  2467. options2.duration = Cesium.defaultValue(options2.duration, 3);
  2468. var boundingSphere = new Cesium.BoundingSphere(Cesium.Cartesian3.fromDegrees(options2.longitude, options2.latitude, options2.height), 0);
  2469. this._viewer.camera.flyToBoundingSphere(boundingSphere, {
  2470. duration: options2.duration,
  2471. complete: function() {
  2472. resolve2(true);
  2473. },
  2474. offset: {
  2475. heading: Cesium.Math.toRadians(options2.heading),
  2476. pitch: Cesium.Math.toRadians(options2.pitch),
  2477. range: options2.range
  2478. }
  2479. });
  2480. });
  2481. },
  2482. flyToEntityByPoints: function(points2, type2, options2) {
  2483. return new Promise((resolve2, reject2) => {
  2484. let _self = this;
  2485. options2 = options2 || {};
  2486. if (points2 === void 0 || points2.length === void 0) {
  2487. reject2("\u8F93\u5165\u7684\u5750\u6807\u96C6\u5408\u5F02\u5E38\uFF01");
  2488. return;
  2489. }
  2490. let pointsArray = points2.map((point2) => {
  2491. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  2492. });
  2493. if (_self._locationEntity) {
  2494. _self._viewer.entities.remove(_self._locationEntity);
  2495. }
  2496. switch (type2) {
  2497. case "point":
  2498. _self._locationEntity = _self._viewer.entities.add({
  2499. position: pointsArray[0],
  2500. point: {
  2501. pixelSize: 1
  2502. }
  2503. });
  2504. break;
  2505. case "polyline":
  2506. if (pointsArray.length < 2) {
  2507. reject2("\u7EBF\u5BF9\u8C61\u5B9A\u4F4D\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  2508. } else {
  2509. _self._locationEntity = _self._viewer.entities.add({
  2510. polyline: {
  2511. positions: pointsArray,
  2512. clampToGround: true,
  2513. material: new Cesium.Color(255, 0, 0, 0.5),
  2514. width: 1
  2515. }
  2516. });
  2517. }
  2518. break;
  2519. case "polygon":
  2520. if (pointsArray.length < 3) {
  2521. reject2("\u9762\u5BF9\u8C61\u5B9A\u4F4D\uFF0C\u70B9\u6570\u81F3\u5C113\u4E2A");
  2522. } else {
  2523. _self._locationEntity = _self._viewer.entities.add({
  2524. polygon: {
  2525. hierarchy: {
  2526. positions: pointsArray
  2527. },
  2528. material: new Cesium.Color(255, 0, 0, 0.5),
  2529. outline: true
  2530. }
  2531. });
  2532. }
  2533. break;
  2534. default:
  2535. reject2("\u5750\u6807\u5F02\u5E38\uFF01");
  2536. break;
  2537. }
  2538. options2.duration = Cesium.defaultValue(options2.duration, 3);
  2539. options2.heading = Cesium.defaultValue(options2.heading, 0);
  2540. options2.pitch = Cesium.defaultValue(options2.pitch, -90);
  2541. options2.range = Cesium.defaultValue(options2.range, 0);
  2542. let flyPromise = _self._viewer.flyTo(_self._locationEntity, {
  2543. duration: options2.duration,
  2544. offset: {
  2545. heading: Cesium.Math.toRadians(options2.heading),
  2546. pitch: Cesium.Math.toRadians(options2.pitch),
  2547. range: options2.range
  2548. }
  2549. });
  2550. flyPromise.then(function(flag) {
  2551. if (flag) {
  2552. resolve2(_self._locationEntity);
  2553. }
  2554. });
  2555. });
  2556. },
  2557. flyToEntity: function(entity, options2) {
  2558. return new Promise((resolve2, reject2) => {
  2559. let _self = this;
  2560. options2 = options2 || {};
  2561. if (_self._locationEntity) {
  2562. _self._viewer.entities.remove(_self._locationEntity);
  2563. }
  2564. _self._locationEntity = entity;
  2565. options2.duration = Cesium.defaultValue(options2.duration, 3);
  2566. options2.heading = Cesium.defaultValue(options2.heading, 0);
  2567. options2.pitch = Cesium.defaultValue(options2.pitch, -90);
  2568. options2.range = Cesium.defaultValue(options2.range, 0);
  2569. let flyPromise = _self._viewer.flyTo(_self._locationEntity, {
  2570. duration: options2.duration,
  2571. offset: {
  2572. heading: Cesium.Math.toRadians(options2.heading),
  2573. pitch: Cesium.Math.toRadians(options2.pitch),
  2574. range: options2.range
  2575. }
  2576. });
  2577. flyPromise.then(function(flag) {
  2578. if (flag) {
  2579. resolve2(_self._locationEntity);
  2580. }
  2581. });
  2582. });
  2583. },
  2584. zoomToTilesets(tileset, options2) {
  2585. return new Promise((resolve2, reject2) => {
  2586. let _self = this;
  2587. if (!Cesium.defined(tileset)) {
  2588. throw new Cesium.DeveloperError("tileset is required.");
  2589. }
  2590. options2 = options2 || {};
  2591. options2.heading = Cesium.defaultValue(options2.heading, 120);
  2592. options2.pitch = Cesium.defaultValue(options2.pitch, -10);
  2593. options2.range = Cesium.defaultValue(options2.range, 450);
  2594. options2.duration = Cesium.defaultValue(options2.duration, 3);
  2595. let boundingSphere = tileset.boundingSphere;
  2596. _self._viewer.camera.flyToBoundingSphere(boundingSphere, {
  2597. duration: options2.duration,
  2598. complete: function() {
  2599. resolve2(true);
  2600. },
  2601. offset: {
  2602. heading: Cesium.Math.toRadians(options2.heading),
  2603. pitch: Cesium.Math.toRadians(options2.pitch),
  2604. range: options2.range
  2605. }
  2606. });
  2607. });
  2608. },
  2609. flyToTileset(tileset, options2) {
  2610. return new Promise((resolve2, reject2) => {
  2611. let _self = this;
  2612. if (!Cesium.defined(tileset)) {
  2613. throw new Cesium.DeveloperError("tileset is required.");
  2614. }
  2615. options2 = options2 || {};
  2616. options2.heading = Cesium.defaultValue(options2.heading, 120);
  2617. options2.pitch = Cesium.defaultValue(options2.pitch, -10);
  2618. options2.range = Cesium.defaultValue(options2.range, 450);
  2619. options2.duration = Cesium.defaultValue(options2.duration, 3);
  2620. let flyPromise = _self._viewer.flyTo(tileset, {
  2621. duration: options2.duration,
  2622. offset: {
  2623. heading: Cesium.Math.toRadians(options2.heading),
  2624. pitch: Cesium.Math.toRadians(options2.pitch),
  2625. range: options2.range
  2626. }
  2627. });
  2628. flyPromise.then(function(flag) {
  2629. if (flag) {
  2630. resolve2(true);
  2631. }
  2632. });
  2633. });
  2634. }
  2635. });
  2636. const CreateRemindertip = function(arr, position2, show) {
  2637. let tooltip2 = document.getElementById("toolTip");
  2638. let style, _x, _y, _color;
  2639. if (arr && typeof arr === "object") {
  2640. style = arr;
  2641. }
  2642. if (style && style.origin) {
  2643. style.origin === "center" && (_x = 15, _y = -12);
  2644. style.origin === "top" && (_x = 15, _y = -44);
  2645. style.origin === "bottom" && (_x = 15, _y = 20);
  2646. } else {
  2647. _x = 15, _y = 20;
  2648. }
  2649. if (style && style.color) {
  2650. style.color === "white" && (_color = "background: rgba(255, 255, 255, 0.8);color: black;");
  2651. style.color === "black" && (_color = "background: rgba(0, 0, 0, 0.65);color: white;");
  2652. style.color === "yellow" && (_color = "color: black;background-color: #ffcc33;border: 1px solid white;");
  2653. } else {
  2654. _color = "background: rgba(0, 0, 0, 0.65);color: white;";
  2655. }
  2656. if (!tooltip2) {
  2657. const viewerDom = document.getElementsByClassName("cesium-viewer")[0];
  2658. let elementbottom = document.createElement("div");
  2659. viewerDom.append(elementbottom);
  2660. let html = '<div id="toolTip" style="display: none;pointer-events: none;position: absolute;z-index: 1000;opacity: 0.8;border-radius: 4px;padding: 4px 8px;white-space: nowrap;font-family:\u9ED1\u4F53;color:white;font-weight: bolder;font-size: 14px;' + _color + '"></div>';
  2661. viewerDom.insertAdjacentHTML("beforeend", html);
  2662. tooltip2 = document.getElementById("toolTip");
  2663. }
  2664. if (show) {
  2665. tooltip2.innerHTML = arr;
  2666. tooltip2.style.left = position2.x + _x + "px";
  2667. tooltip2.style.top = position2.y + _y + "px";
  2668. tooltip2.style.display = "block";
  2669. } else {
  2670. tooltip2.style.display = "none";
  2671. }
  2672. return {
  2673. tooltip: tooltip2,
  2674. style,
  2675. showAt: function(position3, text) {
  2676. this.tooltip.innerHTML = text;
  2677. if (this.style && this.style.origin) {
  2678. this.style.origin === "center" && (_x = 15, _y = -this.tooltip.offsetHeight / 2);
  2679. this.style.origin === "top" && (_x = 15, _y = -this.tooltip.offsetHeight - 20);
  2680. this.style.origin === "bottom" && (_x = 15, _y = 20);
  2681. } else {
  2682. _x = 15, _y = -this.tooltip.offsetHeight / 2;
  2683. }
  2684. this.tooltip.style.left = position3.x + _x + "px";
  2685. this.tooltip.style.top = position3.y + _y + "px";
  2686. this.tooltip.style.display = "block";
  2687. },
  2688. show: function(show2) {
  2689. if (show2) {
  2690. this.tooltip.style.display = "block";
  2691. } else {
  2692. this.tooltip.style.display = "none";
  2693. }
  2694. }
  2695. };
  2696. };
  2697. class SightLine {
  2698. constructor(viewer2) {
  2699. if (!viewer2)
  2700. throw new Cesium.DeveloperError("no viewer object!");
  2701. this._viewer = viewer2;
  2702. this._resultObject = {
  2703. viewPoint: void 0,
  2704. targetPoints: [],
  2705. targetPoint: void 0,
  2706. objectExclude: [],
  2707. entities: []
  2708. };
  2709. }
  2710. _distance(point1, point2) {
  2711. let point1cartographic = Cesium.Cartographic.fromCartesian(point1);
  2712. let point2cartographic = Cesium.Cartographic.fromCartesian(point2);
  2713. let geodesic = new Cesium.EllipsoidGeodesic();
  2714. geodesic.setEndPoints(point1cartographic, point2cartographic);
  2715. let s = geodesic.surfaceDistance;
  2716. s = Math.sqrt(
  2717. Math.pow(s, 2) + Math.pow(point2cartographic.height - point1cartographic.height, 2)
  2718. );
  2719. return s;
  2720. }
  2721. _checkAppOrWeb() {
  2722. if (window.navigator.userAgent.match(
  2723. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  2724. )) {
  2725. return SightLine.RuntimeEnvironment.App;
  2726. } else {
  2727. return SightLine.RuntimeEnvironment.Web;
  2728. }
  2729. }
  2730. _isRuntimeApp() {
  2731. if (this._checkAppOrWeb() === SightLine.RuntimeEnvironment.App) {
  2732. return true;
  2733. }
  2734. return false;
  2735. }
  2736. _isRuntimeWeb() {
  2737. if (this._checkAppOrWeb() === SightLine.RuntimeEnvironment.Web) {
  2738. return true;
  2739. }
  2740. return false;
  2741. }
  2742. _createOperationMainDom() {
  2743. let buttonDiv = document.createElement("div");
  2744. buttonDiv.id = "drawButtonDiv";
  2745. buttonDiv.style.width = "80px";
  2746. buttonDiv.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
  2747. buttonDiv.style.borderRadius = "5px";
  2748. buttonDiv.style.display = "flex";
  2749. buttonDiv.style.flexDirection = "column";
  2750. buttonDiv.style.padding = "8px";
  2751. buttonDiv.style.justifyContent = "center";
  2752. buttonDiv.style.position = "absolute";
  2753. buttonDiv.style.bottom = "150px";
  2754. buttonDiv.style.right = "10px";
  2755. let btnCompletion = document.createElement("button");
  2756. btnCompletion.id = "btnDrawComplete";
  2757. btnCompletion.style.height = "30px";
  2758. btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
  2759. btnCompletion.style.color = "rgb(255, 255, 255)";
  2760. btnCompletion.style.border = "0px solid red";
  2761. btnCompletion.style.borderRadius = "5px";
  2762. btnCompletion.innerHTML = "\u5B8C\u6210";
  2763. btnCompletion.style.fontSize = "13px";
  2764. btnCompletion.style.cursor = "pointer";
  2765. buttonDiv.appendChild(btnCompletion);
  2766. document.body.appendChild(buttonDiv);
  2767. }
  2768. _showTooltipMessage(message) {
  2769. let msgMainDom = document.getElementById("messageMainDom");
  2770. if (msgMainDom !== null && msgMainDom !== void 0) {
  2771. document.body.removeChild(msgMainDom);
  2772. }
  2773. msgMainDom = document.createElement("div");
  2774. msgMainDom.style.width = "30%";
  2775. msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
  2776. msgMainDom.style.height = "45px";
  2777. msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
  2778. msgMainDom.style.borderRadius = "8px";
  2779. msgMainDom.style.display = "flex";
  2780. msgMainDom.style.alignItems = "center";
  2781. msgMainDom.style.paddingLeft = "10px";
  2782. msgMainDom.style.color = "rgb(91, 188, 48)";
  2783. msgMainDom.style.fontSize = "14px";
  2784. msgMainDom.style.fontWeight = "600";
  2785. msgMainDom.style.position = "absolute";
  2786. msgMainDom.style.left = "35%";
  2787. msgMainDom.style.transition = "transform 1s";
  2788. msgMainDom.style.transform = "translateY(-90px)";
  2789. msgMainDom.style.top = "0px";
  2790. msgMainDom.style.zIndex = 1e3;
  2791. document.body.appendChild(msgMainDom);
  2792. let strHtml = "";
  2793. strHtml += "<div style='";
  2794. strHtml += "background-color: rgb(88, 185, 45);";
  2795. strHtml += "color: rgb(255, 255, 255);";
  2796. strHtml += "height: 24px;";
  2797. strHtml += "width: 24px;";
  2798. strHtml += "border-radius: 20px;";
  2799. strHtml += "display: flex;";
  2800. strHtml += "justify-content: center;";
  2801. strHtml += "align-items: center;";
  2802. strHtml += "font-size: 14px;";
  2803. strHtml += "margin-right: 18px;";
  2804. strHtml += "'>&#10003</div>";
  2805. strHtml += "<div>" + message + "</div>";
  2806. msgMainDom.innerHTML = strHtml;
  2807. msgMainDom.addEventListener("transitionend", function() {
  2808. setTimeout(function() {
  2809. document.body.removeChild(msgMainDom);
  2810. }, 1e3);
  2811. }, false);
  2812. setTimeout(function() {
  2813. msgMainDom.style.transform = "translateY(50px)";
  2814. }, 100);
  2815. }
  2816. }
  2817. Object.assign(SightLine.prototype, {
  2818. startSightLine() {
  2819. let _self = this;
  2820. _self.clearAll();
  2821. let toolTip = "\u5DE6\u952E\u5355\u51FB\u521B\u5EFA\u89C6\u89D2\u8D77\u70B9";
  2822. if (this._isRuntimeApp()) {
  2823. toolTip = "\u5355\u51FB\u521B\u5EFA\u89C6\u89D2\u8D77\u70B9";
  2824. _self._showTooltipMessage(toolTip);
  2825. }
  2826. _self.handler = new Cesium.ScreenSpaceEventHandler(_self._viewer.canvas);
  2827. _self.handler.setInputAction((event2) => {
  2828. let loc2 = CoordTransform._transfromFromScreenPoint(_self._viewer, event2.position);
  2829. toolTip = "\u5DE6\u952E\u521B\u5EFA\u89C6\u89D2\u7EC8\u70B9\uFF0C\u53F3\u952E\u7ED3\u675F\u901A\u89C6\u5206\u6790";
  2830. if (this._isRuntimeApp()) {
  2831. toolTip = "\u518D\u6B21\u5355\u51FB\u521B\u5EFA\u89C6\u89D2\u7EC8\u70B9";
  2832. _self._showTooltipMessage(toolTip);
  2833. }
  2834. if (!Cesium.defined(loc2.sLocation))
  2835. return;
  2836. let cartesian = loc2.sLocation;
  2837. if (!_self._resultObject.viewPoint) {
  2838. _self._resultObject.viewPoint = cartesian;
  2839. let pointEntity = _self._viewer.entities.add({
  2840. position: cartesian,
  2841. point: {
  2842. color: Cesium.Color.YELLOW,
  2843. pixelSize: 5
  2844. },
  2845. label: {
  2846. text: "\u89C2\u5BDF\u4F4D\u7F6E",
  2847. font: "12px sans-serif",
  2848. fillColor: new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1),
  2849. outlineColor: new Cesium.Color(0, 154 / 255, 94 / 255, 1),
  2850. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  2851. outlineWidth: 1,
  2852. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  2853. pixelOffset: new Cesium.Cartesian2(0, -28),
  2854. showBackground: true,
  2855. backgroundColor: new Cesium.Color(0, 0, 0, 0.6),
  2856. disableDepthTestDistance: Number.POSITIVE_INFINITY
  2857. }
  2858. });
  2859. _self._resultObject.objectExclude.push(pointEntity);
  2860. _self._resultObject.entities.push(pointEntity);
  2861. } else {
  2862. _self._resultObject.targetPoint = cartesian;
  2863. let pointEntity = _self._viewer.entities.add({
  2864. position: cartesian,
  2865. point: {
  2866. color: Cesium.Color.YELLOW,
  2867. pixelSize: 5
  2868. },
  2869. label: {
  2870. text: "\u76EE\u6807\u4F4D\u7F6E",
  2871. font: "12px sans-serif",
  2872. fillColor: new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1),
  2873. outlineColor: new Cesium.Color(0, 154 / 255, 94 / 255, 1),
  2874. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  2875. outlineWidth: 1,
  2876. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  2877. pixelOffset: new Cesium.Cartesian2(0, -28),
  2878. showBackground: true,
  2879. backgroundColor: new Cesium.Color(0, 0, 0, 0.6),
  2880. disableDepthTestDistance: Number.POSITIVE_INFINITY
  2881. }
  2882. });
  2883. _self._resultObject.objectExclude.push(pointEntity);
  2884. _self._resultObject.entities.push(pointEntity);
  2885. let direction = Cesium.Cartesian3.normalize(
  2886. Cesium.Cartesian3.subtract(
  2887. _self._resultObject.targetPoint,
  2888. _self._resultObject.viewPoint,
  2889. new Cesium.Cartesian3()
  2890. ),
  2891. new Cesium.Cartesian3()
  2892. );
  2893. let ray = new Cesium.Ray(_self._resultObject.viewPoint, direction);
  2894. let result = _self._viewer.scene.pickFromRay(ray, _self._resultObject.objectExclude);
  2895. if (result) {
  2896. let dis0 = _self._distance(
  2897. _self._resultObject.viewPoint,
  2898. _self._resultObject.targetPoint
  2899. );
  2900. let dis1 = _self._distance(
  2901. _self._resultObject.viewPoint,
  2902. result.position
  2903. );
  2904. let dis2 = _self._distance(
  2905. result.position,
  2906. _self._resultObject.targetPoint
  2907. );
  2908. console.log(dis0, dis1, dis2);
  2909. if (dis0 > dis1) {
  2910. let _poly0 = _self._viewer.entities.add({
  2911. polyline: {
  2912. positions: [_self._resultObject.viewPoint, result.position],
  2913. material: Cesium.Color.GREEN,
  2914. width: 3
  2915. }
  2916. });
  2917. _self._resultObject.entities.push(_poly0);
  2918. let _poly1 = _self._viewer.entities.add({
  2919. polyline: {
  2920. positions: [result.position, _self._resultObject.targetPoint],
  2921. material: Cesium.Color.RED,
  2922. width: 3
  2923. }
  2924. });
  2925. _self._resultObject.entities.push(_poly1);
  2926. _self._resultObject.targetPoints.push({
  2927. targetPoint: cartesian,
  2928. visual: false,
  2929. distance: [dis0, dis1, dis2]
  2930. });
  2931. } else {
  2932. let _poly2 = _self._viewer.entities.add({
  2933. polyline: {
  2934. positions: [
  2935. _self._resultObject.viewPoint,
  2936. _self._resultObject.targetPoint
  2937. ],
  2938. material: Cesium.Color.GREEN,
  2939. width: 3
  2940. }
  2941. });
  2942. _self._resultObject.entities.push(_poly2);
  2943. _self._resultObject.targetPoints.push({
  2944. targetPoint: cartesian,
  2945. visual: true,
  2946. distance: [dis0, dis1, dis2]
  2947. });
  2948. }
  2949. }
  2950. }
  2951. if (_self._resultObject.objectExclude.length === 2) {
  2952. if (this._isRuntimeApp()) {
  2953. _self._createOperationMainDom();
  2954. document.getElementById("btnDrawComplete").onclick = () => {
  2955. CreateRemindertip(toolTip, event2.endPosition, false);
  2956. _self.handler.destroy();
  2957. let buttonDiv = document.getElementById("drawButtonDiv");
  2958. if (buttonDiv) {
  2959. document.body.removeChild(buttonDiv);
  2960. }
  2961. };
  2962. }
  2963. }
  2964. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  2965. _self.handler.setInputAction(function(move) {
  2966. if (_self._isRuntimeApp())
  2967. return;
  2968. CreateRemindertip(toolTip, move.endPosition, true);
  2969. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  2970. _self.handler.setInputAction((event2) => {
  2971. CreateRemindertip(toolTip, event2.endPosition, false);
  2972. _self.handler.destroy();
  2973. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  2974. },
  2975. clearAll() {
  2976. this._resultObject.entities.forEach((element) => {
  2977. this._viewer.entities.remove(element);
  2978. });
  2979. this._resultObject = {
  2980. viewPoint: void 0,
  2981. targetPoints: [],
  2982. targetPoint: void 0,
  2983. objectExclude: [],
  2984. entities: []
  2985. };
  2986. if (this.handler) {
  2987. this.handler.destroy();
  2988. }
  2989. let buttonDiv = document.getElementById("drawButtonDiv");
  2990. if (buttonDiv) {
  2991. document.body.removeChild(buttonDiv);
  2992. }
  2993. }
  2994. });
  2995. SightLine.RuntimeEnvironment = Object.freeze({
  2996. App: "app",
  2997. Web: "web"
  2998. });
  2999. /*!
  3000. * author: [object Object]
  3001. * @sakitam-gis/kriging v0.1.0
  3002. * build-time: 2019-7-6 20:41
  3003. * LICENSE: MIT
  3004. * (c) 2019-2019 https://github.com/sakitam-gis/kriging.js
  3005. */
  3006. function max(source) {
  3007. return Math.max.apply(null, source);
  3008. }
  3009. function min(source) {
  3010. return Math.min.apply(null, source);
  3011. }
  3012. function rep(source, n) {
  3013. var array = [];
  3014. for (var i2 = 0; i2 < n; i2++) {
  3015. array.push(source);
  3016. }
  3017. return array;
  3018. }
  3019. function pip(source, x, y) {
  3020. var i2 = 0;
  3021. var j = source.length - 1;
  3022. var c = false;
  3023. var length = source.length;
  3024. for (; i2 < length; j = i2++) {
  3025. if (source[i2][1] > y !== source[j][1] > y && x < (source[j][0] - source[i2][0]) * (y - source[i2][1]) / (source[j][1] - source[i2][1]) + source[i2][0]) {
  3026. c = !c;
  3027. }
  3028. }
  3029. return c;
  3030. }
  3031. function matrixDiag(c, n) {
  3032. var i2 = 0;
  3033. var Z2 = rep(0, n * n);
  3034. for (; i2 < n; i2++) {
  3035. Z2[i2 * n + i2] = c;
  3036. }
  3037. return Z2;
  3038. }
  3039. function matrixTranspose(X2, n, m) {
  3040. var i2 = 0;
  3041. var j;
  3042. var Z2 = Array(m * n);
  3043. for (; i2 < n; i2++) {
  3044. j = 0;
  3045. for (; j < m; j++) {
  3046. Z2[j * n + i2] = X2[i2 * m + j];
  3047. }
  3048. }
  3049. return Z2;
  3050. }
  3051. function matrixAdd(X2, Y, n, m) {
  3052. var i2 = 0;
  3053. var j;
  3054. var Z2 = Array(n * m);
  3055. for (; i2 < n; i2++) {
  3056. j = 0;
  3057. for (; j < m; j++) {
  3058. Z2[i2 * m + j] = X2[i2 * m + j] + Y[i2 * m + j];
  3059. }
  3060. }
  3061. return Z2;
  3062. }
  3063. function matrixMultiply(X2, Y, n, m, p) {
  3064. var i2 = 0;
  3065. var j;
  3066. var k;
  3067. var Z2 = Array(n * p);
  3068. for (; i2 < n; i2++) {
  3069. j = 0;
  3070. for (; j < p; j++) {
  3071. Z2[i2 * p + j] = 0;
  3072. k = 0;
  3073. for (; k < m; k++) {
  3074. Z2[i2 * p + j] += X2[i2 * m + k] * Y[k * p + j];
  3075. }
  3076. }
  3077. }
  3078. return Z2;
  3079. }
  3080. function matrixChol(X2, n) {
  3081. var i2;
  3082. var j;
  3083. var k;
  3084. var p = Array(n);
  3085. for (i2 = 0; i2 < n; i2++)
  3086. p[i2] = X2[i2 * n + i2];
  3087. for (i2 = 0; i2 < n; i2++) {
  3088. for (j = 0; j < i2; j++)
  3089. p[i2] -= X2[i2 * n + j] * X2[i2 * n + j];
  3090. if (p[i2] <= 0)
  3091. return false;
  3092. p[i2] = Math.sqrt(p[i2]);
  3093. for (j = i2 + 1; j < n; j++) {
  3094. for (k = 0; k < i2; k++)
  3095. X2[j * n + i2] -= X2[j * n + k] * X2[i2 * n + k];
  3096. X2[j * n + i2] /= p[i2];
  3097. }
  3098. }
  3099. for (i2 = 0; i2 < n; i2++)
  3100. X2[i2 * n + i2] = p[i2];
  3101. return true;
  3102. }
  3103. function matrixChol2inv(X2, n) {
  3104. var i2;
  3105. var j;
  3106. var k;
  3107. var sum;
  3108. for (i2 = 0; i2 < n; i2++) {
  3109. X2[i2 * n + i2] = 1 / X2[i2 * n + i2];
  3110. for (j = i2 + 1; j < n; j++) {
  3111. sum = 0;
  3112. for (k = i2; k < j; k++)
  3113. sum -= X2[j * n + k] * X2[k * n + i2];
  3114. X2[j * n + i2] = sum / X2[j * n + j];
  3115. }
  3116. }
  3117. for (i2 = 0; i2 < n; i2++)
  3118. for (j = i2 + 1; j < n; j++)
  3119. X2[i2 * n + j] = 0;
  3120. for (i2 = 0; i2 < n; i2++) {
  3121. X2[i2 * n + i2] *= X2[i2 * n + i2];
  3122. for (k = i2 + 1; k < n; k++)
  3123. X2[i2 * n + i2] += X2[k * n + i2] * X2[k * n + i2];
  3124. for (j = i2 + 1; j < n; j++)
  3125. for (k = j; k < n; k++)
  3126. X2[i2 * n + j] += X2[k * n + i2] * X2[k * n + j];
  3127. }
  3128. for (i2 = 0; i2 < n; i2++)
  3129. for (j = 0; j < i2; j++)
  3130. X2[i2 * n + j] = X2[j * n + i2];
  3131. }
  3132. function matrixSolve(X2, n) {
  3133. var m = n;
  3134. var b = Array(n * n);
  3135. var indxc = Array(n);
  3136. var indxr = Array(n);
  3137. var ipiv = Array(n);
  3138. var i2;
  3139. var icol = 0;
  3140. var irow = 0;
  3141. var j;
  3142. var k;
  3143. var l;
  3144. var ll;
  3145. var big;
  3146. var dum;
  3147. var pivinv;
  3148. var temp;
  3149. for (i2 = 0; i2 < n; i2++) {
  3150. for (j = 0; j < n; j++) {
  3151. if (i2 === j)
  3152. b[i2 * n + j] = 1;
  3153. else
  3154. b[i2 * n + j] = 0;
  3155. }
  3156. }
  3157. for (j = 0; j < n; j++)
  3158. ipiv[j] = 0;
  3159. for (i2 = 0; i2 < n; i2++) {
  3160. big = 0;
  3161. for (j = 0; j < n; j++) {
  3162. if (ipiv[j] !== 1) {
  3163. for (k = 0; k < n; k++) {
  3164. if (ipiv[k] === 0) {
  3165. if (Math.abs(X2[j * n + k]) >= big) {
  3166. big = Math.abs(X2[j * n + k]);
  3167. irow = j;
  3168. icol = k;
  3169. }
  3170. }
  3171. }
  3172. }
  3173. }
  3174. ++ipiv[icol];
  3175. if (irow !== icol) {
  3176. for (l = 0; l < n; l++) {
  3177. temp = X2[irow * n + l];
  3178. X2[irow * n + l] = X2[icol * n + l];
  3179. X2[icol * n + l] = temp;
  3180. }
  3181. for (l = 0; l < m; l++) {
  3182. temp = b[irow * n + l];
  3183. b[irow * n + l] = b[icol * n + l];
  3184. b[icol * n + l] = temp;
  3185. }
  3186. }
  3187. indxr[i2] = irow;
  3188. indxc[i2] = icol;
  3189. if (X2[icol * n + icol] === 0)
  3190. return false;
  3191. pivinv = 1 / X2[icol * n + icol];
  3192. X2[icol * n + icol] = 1;
  3193. for (l = 0; l < n; l++)
  3194. X2[icol * n + l] *= pivinv;
  3195. for (l = 0; l < m; l++)
  3196. b[icol * n + l] *= pivinv;
  3197. for (ll = 0; ll < n; ll++) {
  3198. if (ll !== icol) {
  3199. dum = X2[ll * n + icol];
  3200. X2[ll * n + icol] = 0;
  3201. for (l = 0; l < n; l++)
  3202. X2[ll * n + l] -= X2[icol * n + l] * dum;
  3203. for (l = 0; l < m; l++)
  3204. b[ll * n + l] -= b[icol * n + l] * dum;
  3205. }
  3206. }
  3207. }
  3208. for (l = n - 1; l >= 0; l--) {
  3209. if (indxr[l] !== indxc[l]) {
  3210. for (k = 0; k < n; k++) {
  3211. temp = X2[k * n + indxr[l]];
  3212. X2[k * n + indxr[l]] = X2[k * n + indxc[l]];
  3213. X2[k * n + indxc[l]] = temp;
  3214. }
  3215. }
  3216. }
  3217. return true;
  3218. }
  3219. function variogramGaussian(h2, nugget, range3, sill, A) {
  3220. return nugget + (sill - nugget) / range3 * (1 - Math.exp(-(1 / A) * Math.pow(h2 / range3, 2)));
  3221. }
  3222. function variogramExponential(h2, nugget, range3, sill, A) {
  3223. return nugget + (sill - nugget) / range3 * (1 - Math.exp(-(1 / A) * (h2 / range3)));
  3224. }
  3225. function variogramSpherical(h2, nugget, range3, sill) {
  3226. if (h2 > range3)
  3227. return nugget + (sill - nugget) / range3;
  3228. return nugget + (sill - nugget) / range3 * (1.5 * (h2 / range3) - 0.5 * Math.pow(h2 / range3, 3));
  3229. }
  3230. function train(t2, x, y, model, sigma2, alpha) {
  3231. var variogram = {
  3232. t: t2,
  3233. x,
  3234. y,
  3235. nugget: 0,
  3236. range: 0,
  3237. sill: 0,
  3238. A: 1 / 3,
  3239. n: 0,
  3240. model: variogramExponential,
  3241. K: [],
  3242. M: []
  3243. };
  3244. switch (model) {
  3245. case "gaussian":
  3246. variogram.model = variogramGaussian;
  3247. break;
  3248. case "exponential":
  3249. variogram.model = variogramExponential;
  3250. break;
  3251. case "spherical":
  3252. variogram.model = variogramSpherical;
  3253. break;
  3254. default:
  3255. variogram.model = variogramExponential;
  3256. }
  3257. var i2;
  3258. var j;
  3259. var k;
  3260. var l;
  3261. var n = t2.length;
  3262. var distance2 = Array((n * n - n) / 2);
  3263. for (i2 = 0, k = 0; i2 < n; i2++) {
  3264. for (j = 0; j < i2; j++, k++) {
  3265. distance2[k] = Array(2);
  3266. distance2[k][0] = Math.pow(Math.pow(x[i2] - x[j], 2) + Math.pow(y[i2] - y[j], 2), 0.5);
  3267. distance2[k][1] = Math.abs(t2[i2] - t2[j]);
  3268. }
  3269. }
  3270. distance2.sort(function(a, b) {
  3271. return a[0] - b[0];
  3272. });
  3273. variogram.range = distance2[(n * n - n) / 2 - 1][0];
  3274. var lags = (n * n - n) / 2 > 30 ? 30 : (n * n - n) / 2;
  3275. var tolerance = variogram.range / lags;
  3276. var lag = rep(0, lags);
  3277. var semi = rep(0, lags);
  3278. if (lags < 30) {
  3279. for (l = 0; l < lags; l++) {
  3280. lag[l] = distance2[l][0];
  3281. semi[l] = distance2[l][1];
  3282. }
  3283. } else {
  3284. for (i2 = 0, j = 0, k = 0, l = 0; i2 < lags && j < (n * n - n) / 2; i2++, k = 0) {
  3285. while (distance2[j][0] <= (i2 + 1) * tolerance) {
  3286. lag[l] += distance2[j][0];
  3287. semi[l] += distance2[j][1];
  3288. j++;
  3289. k++;
  3290. if (j >= (n * n - n) / 2)
  3291. break;
  3292. }
  3293. if (k > 0) {
  3294. lag[l] /= k;
  3295. semi[l] /= k;
  3296. l++;
  3297. }
  3298. }
  3299. if (l < 2)
  3300. return variogram;
  3301. }
  3302. n = l;
  3303. variogram.range = lag[n - 1] - lag[0];
  3304. var X2 = rep(1, 2 * n);
  3305. var Y = Array(n);
  3306. var A = variogram.A;
  3307. for (i2 = 0; i2 < n; i2++) {
  3308. switch (model) {
  3309. case "gaussian":
  3310. X2[i2 * 2 + 1] = 1 - Math.exp(-(1 / A) * Math.pow(lag[i2] / variogram.range, 2));
  3311. break;
  3312. case "exponential":
  3313. X2[i2 * 2 + 1] = 1 - Math.exp(-(1 / A) * lag[i2] / variogram.range);
  3314. break;
  3315. case "spherical":
  3316. X2[i2 * 2 + 1] = 1.5 * (lag[i2] / variogram.range) - 0.5 * Math.pow(lag[i2] / variogram.range, 3);
  3317. break;
  3318. }
  3319. Y[i2] = semi[i2];
  3320. }
  3321. var Xt2 = matrixTranspose(X2, n, 2);
  3322. var Z2 = matrixMultiply(Xt2, X2, 2, n, 2);
  3323. Z2 = matrixAdd(Z2, matrixDiag(1 / alpha, 2), 2, 2);
  3324. var cloneZ = Z2.slice(0);
  3325. if (matrixChol(Z2, 2)) {
  3326. matrixChol2inv(Z2, 2);
  3327. } else {
  3328. matrixSolve(cloneZ, 2);
  3329. Z2 = cloneZ;
  3330. }
  3331. var W2 = matrixMultiply(matrixMultiply(Z2, Xt2, 2, 2, n), Y, 2, n, 1);
  3332. variogram.nugget = W2[0];
  3333. variogram.sill = W2[1] * variogram.range + variogram.nugget;
  3334. variogram.n = x.length;
  3335. n = x.length;
  3336. var K2 = Array(n * n);
  3337. for (i2 = 0; i2 < n; i2++) {
  3338. for (j = 0; j < i2; j++) {
  3339. K2[i2 * n + j] = variogram.model(Math.pow(Math.pow(x[i2] - x[j], 2) + Math.pow(y[i2] - y[j], 2), 0.5), variogram.nugget, variogram.range, variogram.sill, variogram.A);
  3340. K2[j * n + i2] = K2[i2 * n + j];
  3341. }
  3342. K2[i2 * n + i2] = variogram.model(0, variogram.nugget, variogram.range, variogram.sill, variogram.A);
  3343. }
  3344. var C2 = matrixAdd(K2, matrixDiag(sigma2, n), n, n);
  3345. var cloneC = C2.slice(0);
  3346. if (matrixChol(C2, n)) {
  3347. matrixChol2inv(C2, n);
  3348. } else {
  3349. matrixSolve(cloneC, n);
  3350. C2 = cloneC;
  3351. }
  3352. var K1 = C2.slice(0);
  3353. var M = matrixMultiply(C2, t2, n, n, 1);
  3354. variogram.K = K1;
  3355. variogram.M = M;
  3356. return variogram;
  3357. }
  3358. function predict(x, y, variogram) {
  3359. var i2;
  3360. var k = Array(variogram.n);
  3361. for (i2 = 0; i2 < variogram.n; i2++) {
  3362. k[i2] = variogram.model(Math.pow(Math.pow(x - variogram.x[i2], 2) + Math.pow(y - variogram.y[i2], 2), 0.5), variogram.nugget, variogram.range, variogram.sill, variogram.A);
  3363. }
  3364. return matrixMultiply(k, variogram.M, 1, variogram.n, 1)[0];
  3365. }
  3366. function variance(x, y, variogram) {
  3367. var i2;
  3368. var k = Array(variogram.n);
  3369. for (i2 = 0; i2 < variogram.n; i2++) {
  3370. k[i2] = variogram.model(Math.pow(Math.pow(x - variogram.x[i2], 2) + Math.pow(y - variogram.y[i2], 2), 0.5), variogram.nugget, variogram.range, variogram.sill, variogram.A);
  3371. }
  3372. var val = matrixMultiply(matrixMultiply(k, variogram.K, 1, variogram.n, variogram.n), k, 1, variogram.n, 1)[0];
  3373. return variogram.model(0, variogram.nugget, variogram.range, variogram.sill, variogram.A) + val;
  3374. }
  3375. function grid(polygons2, variogram, width2) {
  3376. var i2;
  3377. var j;
  3378. var k;
  3379. var n = polygons2.length;
  3380. if (n === 0)
  3381. return;
  3382. var xlim = [polygons2[0][0][0], polygons2[0][0][0]];
  3383. var ylim = [polygons2[0][0][1], polygons2[0][0][1]];
  3384. for (i2 = 0; i2 < n; i2++) {
  3385. for (j = 0; j < polygons2[i2].length; j++) {
  3386. if (polygons2[i2][j][0] < xlim[0])
  3387. xlim[0] = polygons2[i2][j][0];
  3388. if (polygons2[i2][j][0] > xlim[1])
  3389. xlim[1] = polygons2[i2][j][0];
  3390. if (polygons2[i2][j][1] < ylim[0])
  3391. ylim[0] = polygons2[i2][j][1];
  3392. if (polygons2[i2][j][1] > ylim[1])
  3393. ylim[1] = polygons2[i2][j][1];
  3394. }
  3395. }
  3396. var xtarget;
  3397. var ytarget;
  3398. var a = Array(2);
  3399. var b = Array(2);
  3400. var lxlim = Array(2);
  3401. var lylim = Array(2);
  3402. var x = Math.ceil((xlim[1] - xlim[0]) / width2);
  3403. var y = Math.ceil((ylim[1] - ylim[0]) / width2);
  3404. var A = Array(x + 1);
  3405. for (i2 = 0; i2 <= x; i2++)
  3406. A[i2] = Array(y + 1);
  3407. for (i2 = 0; i2 < n; i2++) {
  3408. lxlim[0] = polygons2[i2][0][0];
  3409. lxlim[1] = lxlim[0];
  3410. lylim[0] = polygons2[i2][0][1];
  3411. lylim[1] = lylim[0];
  3412. for (j = 1; j < polygons2[i2].length; j++) {
  3413. if (polygons2[i2][j][0] < lxlim[0])
  3414. lxlim[0] = polygons2[i2][j][0];
  3415. if (polygons2[i2][j][0] > lxlim[1])
  3416. lxlim[1] = polygons2[i2][j][0];
  3417. if (polygons2[i2][j][1] < lylim[0])
  3418. lylim[0] = polygons2[i2][j][1];
  3419. if (polygons2[i2][j][1] > lylim[1])
  3420. lylim[1] = polygons2[i2][j][1];
  3421. }
  3422. a[0] = Math.floor((lxlim[0] - (lxlim[0] - xlim[0]) % width2 - xlim[0]) / width2);
  3423. a[1] = Math.ceil((lxlim[1] - (lxlim[1] - xlim[1]) % width2 - xlim[0]) / width2);
  3424. b[0] = Math.floor((lylim[0] - (lylim[0] - ylim[0]) % width2 - ylim[0]) / width2);
  3425. b[1] = Math.ceil((lylim[1] - (lylim[1] - ylim[1]) % width2 - ylim[0]) / width2);
  3426. for (j = a[0]; j <= a[1]; j++) {
  3427. for (k = b[0]; k <= b[1]; k++) {
  3428. xtarget = xlim[0] + j * width2;
  3429. ytarget = ylim[0] + k * width2;
  3430. if (pip(polygons2[i2], xtarget, ytarget)) {
  3431. A[j][k] = predict(xtarget, ytarget, variogram);
  3432. }
  3433. }
  3434. }
  3435. }
  3436. return {
  3437. xlim,
  3438. ylim,
  3439. width: width2,
  3440. data: A,
  3441. zlim: [min(variogram.t), max(variogram.t)]
  3442. };
  3443. }
  3444. function plot(canvas, grid2, xlim, ylim, colors) {
  3445. var ctx = canvas.getContext("2d");
  3446. var data = grid2.data, zlim = grid2.zlim, width2 = grid2.width;
  3447. if (ctx) {
  3448. ctx.clearRect(0, 0, canvas.width, canvas.height);
  3449. var range3 = [xlim[1] - xlim[0], ylim[1] - ylim[0], zlim[1] - zlim[0]];
  3450. var i2 = void 0;
  3451. var j = void 0;
  3452. var x = void 0;
  3453. var y = void 0;
  3454. var z = void 0;
  3455. var n = data.length;
  3456. var m = data[0].length;
  3457. var wx = Math.ceil(width2 * canvas.width / (xlim[1] - xlim[0]));
  3458. var wy = Math.ceil(width2 * canvas.height / (ylim[1] - ylim[0]));
  3459. for (i2 = 0; i2 < n; i2++) {
  3460. for (j = 0; j < m; j++) {
  3461. if (data[i2][j] === void 0)
  3462. continue;
  3463. x = canvas.width * (i2 * width2 + grid2.xlim[0] - xlim[0]) / range3[0];
  3464. y = canvas.height * (1 - (j * width2 + grid2.ylim[0] - ylim[0]) / range3[1]);
  3465. z = (data[i2][j] - zlim[0]) / range3[2];
  3466. if (z < 0)
  3467. z = 0;
  3468. if (z > 1)
  3469. z = 1;
  3470. ctx.fillStyle = colors[Math.floor((colors.length - 1) * z)];
  3471. ctx.fillRect(Math.round(x - wx / 2), Math.round(y - wy / 2), wx, wy);
  3472. }
  3473. }
  3474. }
  3475. }
  3476. var index = {
  3477. train,
  3478. predict,
  3479. variance,
  3480. grid,
  3481. plot,
  3482. max,
  3483. min,
  3484. pip,
  3485. rep,
  3486. matrixDiag,
  3487. matrixTranspose,
  3488. matrixAdd,
  3489. matrixMultiply,
  3490. matrixChol,
  3491. matrixChol2inv,
  3492. matrixSolve,
  3493. variogramGaussian,
  3494. variogramExponential,
  3495. variogramSpherical
  3496. };
  3497. var earthRadius = 63710088e-1;
  3498. var factors = {
  3499. centimeters: earthRadius * 100,
  3500. centimetres: earthRadius * 100,
  3501. degrees: earthRadius / 111325,
  3502. feet: earthRadius * 3.28084,
  3503. inches: earthRadius * 39.37,
  3504. kilometers: earthRadius / 1e3,
  3505. kilometres: earthRadius / 1e3,
  3506. meters: earthRadius,
  3507. metres: earthRadius,
  3508. miles: earthRadius / 1609.344,
  3509. millimeters: earthRadius * 1e3,
  3510. millimetres: earthRadius * 1e3,
  3511. nauticalmiles: earthRadius / 1852,
  3512. radians: 1,
  3513. yards: earthRadius * 1.0936
  3514. };
  3515. var unitsFactors = {
  3516. centimeters: 100,
  3517. centimetres: 100,
  3518. degrees: 1 / 111325,
  3519. feet: 3.28084,
  3520. inches: 39.37,
  3521. kilometers: 1 / 1e3,
  3522. kilometres: 1 / 1e3,
  3523. meters: 1,
  3524. metres: 1,
  3525. miles: 1 / 1609.344,
  3526. millimeters: 1e3,
  3527. millimetres: 1e3,
  3528. nauticalmiles: 1 / 1852,
  3529. radians: 1 / earthRadius,
  3530. yards: 1.0936133
  3531. };
  3532. var areaFactors = {
  3533. acres: 247105e-9,
  3534. centimeters: 1e4,
  3535. centimetres: 1e4,
  3536. feet: 10.763910417,
  3537. hectares: 1e-4,
  3538. inches: 1550.003100006,
  3539. kilometers: 1e-6,
  3540. kilometres: 1e-6,
  3541. meters: 1,
  3542. metres: 1,
  3543. miles: 386e-9,
  3544. millimeters: 1e6,
  3545. millimetres: 1e6,
  3546. yards: 1.195990046
  3547. };
  3548. function feature(geom, properties, options2) {
  3549. if (options2 === void 0) {
  3550. options2 = {};
  3551. }
  3552. var feat = { type: "Feature" };
  3553. if (options2.id === 0 || options2.id) {
  3554. feat.id = options2.id;
  3555. }
  3556. if (options2.bbox) {
  3557. feat.bbox = options2.bbox;
  3558. }
  3559. feat.properties = properties || {};
  3560. feat.geometry = geom;
  3561. return feat;
  3562. }
  3563. function geometry(type2, coordinates, _options) {
  3564. switch (type2) {
  3565. case "Point":
  3566. return point(coordinates).geometry;
  3567. case "LineString":
  3568. return lineString(coordinates).geometry;
  3569. case "Polygon":
  3570. return polygon(coordinates).geometry;
  3571. case "MultiPoint":
  3572. return multiPoint(coordinates).geometry;
  3573. case "MultiLineString":
  3574. return multiLineString(coordinates).geometry;
  3575. case "MultiPolygon":
  3576. return multiPolygon(coordinates).geometry;
  3577. default:
  3578. throw new Error(type2 + " is invalid");
  3579. }
  3580. }
  3581. function point(coordinates, properties, options2) {
  3582. if (options2 === void 0) {
  3583. options2 = {};
  3584. }
  3585. if (!coordinates) {
  3586. throw new Error("coordinates is required");
  3587. }
  3588. if (!Array.isArray(coordinates)) {
  3589. throw new Error("coordinates must be an Array");
  3590. }
  3591. if (coordinates.length < 2) {
  3592. throw new Error("coordinates must be at least 2 numbers long");
  3593. }
  3594. if (!isNumber$1(coordinates[0]) || !isNumber$1(coordinates[1])) {
  3595. throw new Error("coordinates must contain numbers");
  3596. }
  3597. var geom = {
  3598. type: "Point",
  3599. coordinates
  3600. };
  3601. return feature(geom, properties, options2);
  3602. }
  3603. function points(coordinates, properties, options2) {
  3604. if (options2 === void 0) {
  3605. options2 = {};
  3606. }
  3607. return featureCollection$1(coordinates.map(function(coords) {
  3608. return point(coords, properties);
  3609. }), options2);
  3610. }
  3611. function polygon(coordinates, properties, options2) {
  3612. if (options2 === void 0) {
  3613. options2 = {};
  3614. }
  3615. for (var _i = 0, coordinates_1 = coordinates; _i < coordinates_1.length; _i++) {
  3616. var ring = coordinates_1[_i];
  3617. if (ring.length < 4) {
  3618. throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");
  3619. }
  3620. for (var j = 0; j < ring[ring.length - 1].length; j++) {
  3621. if (ring[ring.length - 1][j] !== ring[0][j]) {
  3622. throw new Error("First and last Position are not equivalent.");
  3623. }
  3624. }
  3625. }
  3626. var geom = {
  3627. type: "Polygon",
  3628. coordinates
  3629. };
  3630. return feature(geom, properties, options2);
  3631. }
  3632. function polygons(coordinates, properties, options2) {
  3633. if (options2 === void 0) {
  3634. options2 = {};
  3635. }
  3636. return featureCollection$1(coordinates.map(function(coords) {
  3637. return polygon(coords, properties);
  3638. }), options2);
  3639. }
  3640. function lineString(coordinates, properties, options2) {
  3641. if (options2 === void 0) {
  3642. options2 = {};
  3643. }
  3644. if (coordinates.length < 2) {
  3645. throw new Error("coordinates must be an array of two or more positions");
  3646. }
  3647. var geom = {
  3648. type: "LineString",
  3649. coordinates
  3650. };
  3651. return feature(geom, properties, options2);
  3652. }
  3653. function lineStrings(coordinates, properties, options2) {
  3654. if (options2 === void 0) {
  3655. options2 = {};
  3656. }
  3657. return featureCollection$1(coordinates.map(function(coords) {
  3658. return lineString(coords, properties);
  3659. }), options2);
  3660. }
  3661. function featureCollection$1(features, options2) {
  3662. if (options2 === void 0) {
  3663. options2 = {};
  3664. }
  3665. var fc = { type: "FeatureCollection" };
  3666. if (options2.id) {
  3667. fc.id = options2.id;
  3668. }
  3669. if (options2.bbox) {
  3670. fc.bbox = options2.bbox;
  3671. }
  3672. fc.features = features;
  3673. return fc;
  3674. }
  3675. function multiLineString(coordinates, properties, options2) {
  3676. if (options2 === void 0) {
  3677. options2 = {};
  3678. }
  3679. var geom = {
  3680. type: "MultiLineString",
  3681. coordinates
  3682. };
  3683. return feature(geom, properties, options2);
  3684. }
  3685. function multiPoint(coordinates, properties, options2) {
  3686. if (options2 === void 0) {
  3687. options2 = {};
  3688. }
  3689. var geom = {
  3690. type: "MultiPoint",
  3691. coordinates
  3692. };
  3693. return feature(geom, properties, options2);
  3694. }
  3695. function multiPolygon(coordinates, properties, options2) {
  3696. if (options2 === void 0) {
  3697. options2 = {};
  3698. }
  3699. var geom = {
  3700. type: "MultiPolygon",
  3701. coordinates
  3702. };
  3703. return feature(geom, properties, options2);
  3704. }
  3705. function geometryCollection(geometries, properties, options2) {
  3706. if (options2 === void 0) {
  3707. options2 = {};
  3708. }
  3709. var geom = {
  3710. type: "GeometryCollection",
  3711. geometries
  3712. };
  3713. return feature(geom, properties, options2);
  3714. }
  3715. function round(num, precision) {
  3716. if (precision === void 0) {
  3717. precision = 0;
  3718. }
  3719. if (precision && !(precision >= 0)) {
  3720. throw new Error("precision must be a positive number");
  3721. }
  3722. var multiplier = Math.pow(10, precision || 0);
  3723. return Math.round(num * multiplier) / multiplier;
  3724. }
  3725. function radiansToLength(radians, units) {
  3726. if (units === void 0) {
  3727. units = "kilometers";
  3728. }
  3729. var factor = factors[units];
  3730. if (!factor) {
  3731. throw new Error(units + " units is invalid");
  3732. }
  3733. return radians * factor;
  3734. }
  3735. function lengthToRadians(distance2, units) {
  3736. if (units === void 0) {
  3737. units = "kilometers";
  3738. }
  3739. var factor = factors[units];
  3740. if (!factor) {
  3741. throw new Error(units + " units is invalid");
  3742. }
  3743. return distance2 / factor;
  3744. }
  3745. function lengthToDegrees(distance2, units) {
  3746. return radiansToDegrees(lengthToRadians(distance2, units));
  3747. }
  3748. function bearingToAzimuth(bearing2) {
  3749. var angle = bearing2 % 360;
  3750. if (angle < 0) {
  3751. angle += 360;
  3752. }
  3753. return angle;
  3754. }
  3755. function radiansToDegrees(radians) {
  3756. var degrees = radians % (2 * Math.PI);
  3757. return degrees * 180 / Math.PI;
  3758. }
  3759. function degreesToRadians(degrees) {
  3760. var radians = degrees % 360;
  3761. return radians * Math.PI / 180;
  3762. }
  3763. function convertLength(length, originalUnit, finalUnit) {
  3764. if (originalUnit === void 0) {
  3765. originalUnit = "kilometers";
  3766. }
  3767. if (finalUnit === void 0) {
  3768. finalUnit = "kilometers";
  3769. }
  3770. if (!(length >= 0)) {
  3771. throw new Error("length must be a positive number");
  3772. }
  3773. return radiansToLength(lengthToRadians(length, originalUnit), finalUnit);
  3774. }
  3775. function convertArea(area, originalUnit, finalUnit) {
  3776. if (originalUnit === void 0) {
  3777. originalUnit = "meters";
  3778. }
  3779. if (finalUnit === void 0) {
  3780. finalUnit = "kilometers";
  3781. }
  3782. if (!(area >= 0)) {
  3783. throw new Error("area must be a positive number");
  3784. }
  3785. var startFactor = areaFactors[originalUnit];
  3786. if (!startFactor) {
  3787. throw new Error("invalid original units");
  3788. }
  3789. var finalFactor = areaFactors[finalUnit];
  3790. if (!finalFactor) {
  3791. throw new Error("invalid final units");
  3792. }
  3793. return area / startFactor * finalFactor;
  3794. }
  3795. function isNumber$1(num) {
  3796. return !isNaN(num) && num !== null && !Array.isArray(num);
  3797. }
  3798. function isObject$6(input) {
  3799. return !!input && input.constructor === Object;
  3800. }
  3801. function validateBBox(bbox2) {
  3802. if (!bbox2) {
  3803. throw new Error("bbox is required");
  3804. }
  3805. if (!Array.isArray(bbox2)) {
  3806. throw new Error("bbox must be an Array");
  3807. }
  3808. if (bbox2.length !== 4 && bbox2.length !== 6) {
  3809. throw new Error("bbox must be an Array of 4 or 6 numbers");
  3810. }
  3811. bbox2.forEach(function(num) {
  3812. if (!isNumber$1(num)) {
  3813. throw new Error("bbox must only contain numbers");
  3814. }
  3815. });
  3816. }
  3817. function validateId(id) {
  3818. if (!id) {
  3819. throw new Error("id is required");
  3820. }
  3821. if (["string", "number"].indexOf(typeof id) === -1) {
  3822. throw new Error("id must be a number or a string");
  3823. }
  3824. }
  3825. var es$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  3826. __proto__: null,
  3827. earthRadius,
  3828. factors,
  3829. unitsFactors,
  3830. areaFactors,
  3831. feature,
  3832. geometry,
  3833. point,
  3834. points,
  3835. polygon,
  3836. polygons,
  3837. lineString,
  3838. lineStrings,
  3839. featureCollection: featureCollection$1,
  3840. multiLineString,
  3841. multiPoint,
  3842. multiPolygon,
  3843. geometryCollection,
  3844. round,
  3845. radiansToLength,
  3846. lengthToRadians,
  3847. lengthToDegrees,
  3848. bearingToAzimuth,
  3849. radiansToDegrees,
  3850. degreesToRadians,
  3851. convertLength,
  3852. convertArea,
  3853. isNumber: isNumber$1,
  3854. isObject: isObject$6,
  3855. validateBBox,
  3856. validateId
  3857. }, Symbol.toStringTag, { value: "Module" }));
  3858. function coordEach(geojson, callback2, excludeWrapCoord) {
  3859. if (geojson === null)
  3860. return;
  3861. var j, k, l, geometry2, stopG, coords, geometryMaybeCollection, wrapShrink = 0, coordIndex = 0, isGeometryCollection, type2 = geojson.type, isFeatureCollection = type2 === "FeatureCollection", isFeature = type2 === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
  3862. for (var featureIndex = 0; featureIndex < stop; featureIndex++) {
  3863. geometryMaybeCollection = isFeatureCollection ? geojson.features[featureIndex].geometry : isFeature ? geojson.geometry : geojson;
  3864. isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
  3865. stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
  3866. for (var geomIndex = 0; geomIndex < stopG; geomIndex++) {
  3867. var multiFeatureIndex = 0;
  3868. var geometryIndex = 0;
  3869. geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[geomIndex] : geometryMaybeCollection;
  3870. if (geometry2 === null)
  3871. continue;
  3872. coords = geometry2.coordinates;
  3873. var geomType = geometry2.type;
  3874. wrapShrink = excludeWrapCoord && (geomType === "Polygon" || geomType === "MultiPolygon") ? 1 : 0;
  3875. switch (geomType) {
  3876. case null:
  3877. break;
  3878. case "Point":
  3879. if (callback2(
  3880. coords,
  3881. coordIndex,
  3882. featureIndex,
  3883. multiFeatureIndex,
  3884. geometryIndex
  3885. ) === false)
  3886. return false;
  3887. coordIndex++;
  3888. multiFeatureIndex++;
  3889. break;
  3890. case "LineString":
  3891. case "MultiPoint":
  3892. for (j = 0; j < coords.length; j++) {
  3893. if (callback2(
  3894. coords[j],
  3895. coordIndex,
  3896. featureIndex,
  3897. multiFeatureIndex,
  3898. geometryIndex
  3899. ) === false)
  3900. return false;
  3901. coordIndex++;
  3902. if (geomType === "MultiPoint")
  3903. multiFeatureIndex++;
  3904. }
  3905. if (geomType === "LineString")
  3906. multiFeatureIndex++;
  3907. break;
  3908. case "Polygon":
  3909. case "MultiLineString":
  3910. for (j = 0; j < coords.length; j++) {
  3911. for (k = 0; k < coords[j].length - wrapShrink; k++) {
  3912. if (callback2(
  3913. coords[j][k],
  3914. coordIndex,
  3915. featureIndex,
  3916. multiFeatureIndex,
  3917. geometryIndex
  3918. ) === false)
  3919. return false;
  3920. coordIndex++;
  3921. }
  3922. if (geomType === "MultiLineString")
  3923. multiFeatureIndex++;
  3924. if (geomType === "Polygon")
  3925. geometryIndex++;
  3926. }
  3927. if (geomType === "Polygon")
  3928. multiFeatureIndex++;
  3929. break;
  3930. case "MultiPolygon":
  3931. for (j = 0; j < coords.length; j++) {
  3932. geometryIndex = 0;
  3933. for (k = 0; k < coords[j].length; k++) {
  3934. for (l = 0; l < coords[j][k].length - wrapShrink; l++) {
  3935. if (callback2(
  3936. coords[j][k][l],
  3937. coordIndex,
  3938. featureIndex,
  3939. multiFeatureIndex,
  3940. geometryIndex
  3941. ) === false)
  3942. return false;
  3943. coordIndex++;
  3944. }
  3945. geometryIndex++;
  3946. }
  3947. multiFeatureIndex++;
  3948. }
  3949. break;
  3950. case "GeometryCollection":
  3951. for (j = 0; j < geometry2.geometries.length; j++)
  3952. if (coordEach(geometry2.geometries[j], callback2, excludeWrapCoord) === false)
  3953. return false;
  3954. break;
  3955. default:
  3956. throw new Error("Unknown Geometry Type");
  3957. }
  3958. }
  3959. }
  3960. }
  3961. function coordReduce(geojson, callback2, initialValue, excludeWrapCoord) {
  3962. var previousValue = initialValue;
  3963. coordEach(
  3964. geojson,
  3965. function(currentCoord, coordIndex, featureIndex, multiFeatureIndex, geometryIndex) {
  3966. if (coordIndex === 0 && initialValue === void 0)
  3967. previousValue = currentCoord;
  3968. else
  3969. previousValue = callback2(
  3970. previousValue,
  3971. currentCoord,
  3972. coordIndex,
  3973. featureIndex,
  3974. multiFeatureIndex,
  3975. geometryIndex
  3976. );
  3977. },
  3978. excludeWrapCoord
  3979. );
  3980. return previousValue;
  3981. }
  3982. function propEach(geojson, callback2) {
  3983. var i2;
  3984. switch (geojson.type) {
  3985. case "FeatureCollection":
  3986. for (i2 = 0; i2 < geojson.features.length; i2++) {
  3987. if (callback2(geojson.features[i2].properties, i2) === false)
  3988. break;
  3989. }
  3990. break;
  3991. case "Feature":
  3992. callback2(geojson.properties, 0);
  3993. break;
  3994. }
  3995. }
  3996. function propReduce(geojson, callback2, initialValue) {
  3997. var previousValue = initialValue;
  3998. propEach(geojson, function(currentProperties, featureIndex) {
  3999. if (featureIndex === 0 && initialValue === void 0)
  4000. previousValue = currentProperties;
  4001. else
  4002. previousValue = callback2(previousValue, currentProperties, featureIndex);
  4003. });
  4004. return previousValue;
  4005. }
  4006. function featureEach$1(geojson, callback2) {
  4007. if (geojson.type === "Feature") {
  4008. callback2(geojson, 0);
  4009. } else if (geojson.type === "FeatureCollection") {
  4010. for (var i2 = 0; i2 < geojson.features.length; i2++) {
  4011. if (callback2(geojson.features[i2], i2) === false)
  4012. break;
  4013. }
  4014. }
  4015. }
  4016. function featureReduce(geojson, callback2, initialValue) {
  4017. var previousValue = initialValue;
  4018. featureEach$1(geojson, function(currentFeature, featureIndex) {
  4019. if (featureIndex === 0 && initialValue === void 0)
  4020. previousValue = currentFeature;
  4021. else
  4022. previousValue = callback2(previousValue, currentFeature, featureIndex);
  4023. });
  4024. return previousValue;
  4025. }
  4026. function coordAll(geojson) {
  4027. var coords = [];
  4028. coordEach(geojson, function(coord) {
  4029. coords.push(coord);
  4030. });
  4031. return coords;
  4032. }
  4033. function geomEach(geojson, callback2) {
  4034. var i2, j, g, geometry2, stopG, geometryMaybeCollection, isGeometryCollection, featureProperties, featureBBox, featureId, featureIndex = 0, isFeatureCollection = geojson.type === "FeatureCollection", isFeature = geojson.type === "Feature", stop = isFeatureCollection ? geojson.features.length : 1;
  4035. for (i2 = 0; i2 < stop; i2++) {
  4036. geometryMaybeCollection = isFeatureCollection ? geojson.features[i2].geometry : isFeature ? geojson.geometry : geojson;
  4037. featureProperties = isFeatureCollection ? geojson.features[i2].properties : isFeature ? geojson.properties : {};
  4038. featureBBox = isFeatureCollection ? geojson.features[i2].bbox : isFeature ? geojson.bbox : void 0;
  4039. featureId = isFeatureCollection ? geojson.features[i2].id : isFeature ? geojson.id : void 0;
  4040. isGeometryCollection = geometryMaybeCollection ? geometryMaybeCollection.type === "GeometryCollection" : false;
  4041. stopG = isGeometryCollection ? geometryMaybeCollection.geometries.length : 1;
  4042. for (g = 0; g < stopG; g++) {
  4043. geometry2 = isGeometryCollection ? geometryMaybeCollection.geometries[g] : geometryMaybeCollection;
  4044. if (geometry2 === null) {
  4045. if (callback2(
  4046. null,
  4047. featureIndex,
  4048. featureProperties,
  4049. featureBBox,
  4050. featureId
  4051. ) === false)
  4052. return false;
  4053. continue;
  4054. }
  4055. switch (geometry2.type) {
  4056. case "Point":
  4057. case "LineString":
  4058. case "MultiPoint":
  4059. case "Polygon":
  4060. case "MultiLineString":
  4061. case "MultiPolygon": {
  4062. if (callback2(
  4063. geometry2,
  4064. featureIndex,
  4065. featureProperties,
  4066. featureBBox,
  4067. featureId
  4068. ) === false)
  4069. return false;
  4070. break;
  4071. }
  4072. case "GeometryCollection": {
  4073. for (j = 0; j < geometry2.geometries.length; j++) {
  4074. if (callback2(
  4075. geometry2.geometries[j],
  4076. featureIndex,
  4077. featureProperties,
  4078. featureBBox,
  4079. featureId
  4080. ) === false)
  4081. return false;
  4082. }
  4083. break;
  4084. }
  4085. default:
  4086. throw new Error("Unknown Geometry Type");
  4087. }
  4088. }
  4089. featureIndex++;
  4090. }
  4091. }
  4092. function geomReduce(geojson, callback2, initialValue) {
  4093. var previousValue = initialValue;
  4094. geomEach(
  4095. geojson,
  4096. function(currentGeometry, featureIndex, featureProperties, featureBBox, featureId) {
  4097. if (featureIndex === 0 && initialValue === void 0)
  4098. previousValue = currentGeometry;
  4099. else
  4100. previousValue = callback2(
  4101. previousValue,
  4102. currentGeometry,
  4103. featureIndex,
  4104. featureProperties,
  4105. featureBBox,
  4106. featureId
  4107. );
  4108. }
  4109. );
  4110. return previousValue;
  4111. }
  4112. function flattenEach(geojson, callback2) {
  4113. geomEach(geojson, function(geometry2, featureIndex, properties, bbox2, id) {
  4114. var type2 = geometry2 === null ? null : geometry2.type;
  4115. switch (type2) {
  4116. case null:
  4117. case "Point":
  4118. case "LineString":
  4119. case "Polygon":
  4120. if (callback2(
  4121. feature(geometry2, properties, { bbox: bbox2, id }),
  4122. featureIndex,
  4123. 0
  4124. ) === false)
  4125. return false;
  4126. return;
  4127. }
  4128. var geomType;
  4129. switch (type2) {
  4130. case "MultiPoint":
  4131. geomType = "Point";
  4132. break;
  4133. case "MultiLineString":
  4134. geomType = "LineString";
  4135. break;
  4136. case "MultiPolygon":
  4137. geomType = "Polygon";
  4138. break;
  4139. }
  4140. for (var multiFeatureIndex = 0; multiFeatureIndex < geometry2.coordinates.length; multiFeatureIndex++) {
  4141. var coordinate = geometry2.coordinates[multiFeatureIndex];
  4142. var geom = {
  4143. type: geomType,
  4144. coordinates: coordinate
  4145. };
  4146. if (callback2(feature(geom, properties), featureIndex, multiFeatureIndex) === false)
  4147. return false;
  4148. }
  4149. });
  4150. }
  4151. function flattenReduce(geojson, callback2, initialValue) {
  4152. var previousValue = initialValue;
  4153. flattenEach(
  4154. geojson,
  4155. function(currentFeature, featureIndex, multiFeatureIndex) {
  4156. if (featureIndex === 0 && multiFeatureIndex === 0 && initialValue === void 0)
  4157. previousValue = currentFeature;
  4158. else
  4159. previousValue = callback2(
  4160. previousValue,
  4161. currentFeature,
  4162. featureIndex,
  4163. multiFeatureIndex
  4164. );
  4165. }
  4166. );
  4167. return previousValue;
  4168. }
  4169. function segmentEach(geojson, callback2) {
  4170. flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
  4171. var segmentIndex = 0;
  4172. if (!feature2.geometry)
  4173. return;
  4174. var type2 = feature2.geometry.type;
  4175. if (type2 === "Point" || type2 === "MultiPoint")
  4176. return;
  4177. var previousCoords;
  4178. var previousFeatureIndex = 0;
  4179. var previousMultiIndex = 0;
  4180. var prevGeomIndex = 0;
  4181. if (coordEach(
  4182. feature2,
  4183. function(currentCoord, coordIndex, featureIndexCoord, multiPartIndexCoord, geometryIndex) {
  4184. if (previousCoords === void 0 || featureIndex > previousFeatureIndex || multiPartIndexCoord > previousMultiIndex || geometryIndex > prevGeomIndex) {
  4185. previousCoords = currentCoord;
  4186. previousFeatureIndex = featureIndex;
  4187. previousMultiIndex = multiPartIndexCoord;
  4188. prevGeomIndex = geometryIndex;
  4189. segmentIndex = 0;
  4190. return;
  4191. }
  4192. var currentSegment = lineString(
  4193. [previousCoords, currentCoord],
  4194. feature2.properties
  4195. );
  4196. if (callback2(
  4197. currentSegment,
  4198. featureIndex,
  4199. multiFeatureIndex,
  4200. geometryIndex,
  4201. segmentIndex
  4202. ) === false)
  4203. return false;
  4204. segmentIndex++;
  4205. previousCoords = currentCoord;
  4206. }
  4207. ) === false)
  4208. return false;
  4209. });
  4210. }
  4211. function segmentReduce(geojson, callback2, initialValue) {
  4212. var previousValue = initialValue;
  4213. var started = false;
  4214. segmentEach(
  4215. geojson,
  4216. function(currentSegment, featureIndex, multiFeatureIndex, geometryIndex, segmentIndex) {
  4217. if (started === false && initialValue === void 0)
  4218. previousValue = currentSegment;
  4219. else
  4220. previousValue = callback2(
  4221. previousValue,
  4222. currentSegment,
  4223. featureIndex,
  4224. multiFeatureIndex,
  4225. geometryIndex,
  4226. segmentIndex
  4227. );
  4228. started = true;
  4229. }
  4230. );
  4231. return previousValue;
  4232. }
  4233. function lineEach(geojson, callback2) {
  4234. if (!geojson)
  4235. throw new Error("geojson is required");
  4236. flattenEach(geojson, function(feature2, featureIndex, multiFeatureIndex) {
  4237. if (feature2.geometry === null)
  4238. return;
  4239. var type2 = feature2.geometry.type;
  4240. var coords = feature2.geometry.coordinates;
  4241. switch (type2) {
  4242. case "LineString":
  4243. if (callback2(feature2, featureIndex, multiFeatureIndex, 0, 0) === false)
  4244. return false;
  4245. break;
  4246. case "Polygon":
  4247. for (var geometryIndex = 0; geometryIndex < coords.length; geometryIndex++) {
  4248. if (callback2(
  4249. lineString(coords[geometryIndex], feature2.properties),
  4250. featureIndex,
  4251. multiFeatureIndex,
  4252. geometryIndex
  4253. ) === false)
  4254. return false;
  4255. }
  4256. break;
  4257. }
  4258. });
  4259. }
  4260. function lineReduce(geojson, callback2, initialValue) {
  4261. var previousValue = initialValue;
  4262. lineEach(
  4263. geojson,
  4264. function(currentLine, featureIndex, multiFeatureIndex, geometryIndex) {
  4265. if (featureIndex === 0 && initialValue === void 0)
  4266. previousValue = currentLine;
  4267. else
  4268. previousValue = callback2(
  4269. previousValue,
  4270. currentLine,
  4271. featureIndex,
  4272. multiFeatureIndex,
  4273. geometryIndex
  4274. );
  4275. }
  4276. );
  4277. return previousValue;
  4278. }
  4279. function findSegment(geojson, options2) {
  4280. options2 = options2 || {};
  4281. if (!isObject$6(options2))
  4282. throw new Error("options is invalid");
  4283. var featureIndex = options2.featureIndex || 0;
  4284. var multiFeatureIndex = options2.multiFeatureIndex || 0;
  4285. var geometryIndex = options2.geometryIndex || 0;
  4286. var segmentIndex = options2.segmentIndex || 0;
  4287. var properties = options2.properties;
  4288. var geometry2;
  4289. switch (geojson.type) {
  4290. case "FeatureCollection":
  4291. if (featureIndex < 0)
  4292. featureIndex = geojson.features.length + featureIndex;
  4293. properties = properties || geojson.features[featureIndex].properties;
  4294. geometry2 = geojson.features[featureIndex].geometry;
  4295. break;
  4296. case "Feature":
  4297. properties = properties || geojson.properties;
  4298. geometry2 = geojson.geometry;
  4299. break;
  4300. case "Point":
  4301. case "MultiPoint":
  4302. return null;
  4303. case "LineString":
  4304. case "Polygon":
  4305. case "MultiLineString":
  4306. case "MultiPolygon":
  4307. geometry2 = geojson;
  4308. break;
  4309. default:
  4310. throw new Error("geojson is invalid");
  4311. }
  4312. if (geometry2 === null)
  4313. return null;
  4314. var coords = geometry2.coordinates;
  4315. switch (geometry2.type) {
  4316. case "Point":
  4317. case "MultiPoint":
  4318. return null;
  4319. case "LineString":
  4320. if (segmentIndex < 0)
  4321. segmentIndex = coords.length + segmentIndex - 1;
  4322. return lineString(
  4323. [coords[segmentIndex], coords[segmentIndex + 1]],
  4324. properties,
  4325. options2
  4326. );
  4327. case "Polygon":
  4328. if (geometryIndex < 0)
  4329. geometryIndex = coords.length + geometryIndex;
  4330. if (segmentIndex < 0)
  4331. segmentIndex = coords[geometryIndex].length + segmentIndex - 1;
  4332. return lineString(
  4333. [
  4334. coords[geometryIndex][segmentIndex],
  4335. coords[geometryIndex][segmentIndex + 1]
  4336. ],
  4337. properties,
  4338. options2
  4339. );
  4340. case "MultiLineString":
  4341. if (multiFeatureIndex < 0)
  4342. multiFeatureIndex = coords.length + multiFeatureIndex;
  4343. if (segmentIndex < 0)
  4344. segmentIndex = coords[multiFeatureIndex].length + segmentIndex - 1;
  4345. return lineString(
  4346. [
  4347. coords[multiFeatureIndex][segmentIndex],
  4348. coords[multiFeatureIndex][segmentIndex + 1]
  4349. ],
  4350. properties,
  4351. options2
  4352. );
  4353. case "MultiPolygon":
  4354. if (multiFeatureIndex < 0)
  4355. multiFeatureIndex = coords.length + multiFeatureIndex;
  4356. if (geometryIndex < 0)
  4357. geometryIndex = coords[multiFeatureIndex].length + geometryIndex;
  4358. if (segmentIndex < 0)
  4359. segmentIndex = coords[multiFeatureIndex][geometryIndex].length - segmentIndex - 1;
  4360. return lineString(
  4361. [
  4362. coords[multiFeatureIndex][geometryIndex][segmentIndex],
  4363. coords[multiFeatureIndex][geometryIndex][segmentIndex + 1]
  4364. ],
  4365. properties,
  4366. options2
  4367. );
  4368. }
  4369. throw new Error("geojson is invalid");
  4370. }
  4371. function findPoint(geojson, options2) {
  4372. options2 = options2 || {};
  4373. if (!isObject$6(options2))
  4374. throw new Error("options is invalid");
  4375. var featureIndex = options2.featureIndex || 0;
  4376. var multiFeatureIndex = options2.multiFeatureIndex || 0;
  4377. var geometryIndex = options2.geometryIndex || 0;
  4378. var coordIndex = options2.coordIndex || 0;
  4379. var properties = options2.properties;
  4380. var geometry2;
  4381. switch (geojson.type) {
  4382. case "FeatureCollection":
  4383. if (featureIndex < 0)
  4384. featureIndex = geojson.features.length + featureIndex;
  4385. properties = properties || geojson.features[featureIndex].properties;
  4386. geometry2 = geojson.features[featureIndex].geometry;
  4387. break;
  4388. case "Feature":
  4389. properties = properties || geojson.properties;
  4390. geometry2 = geojson.geometry;
  4391. break;
  4392. case "Point":
  4393. case "MultiPoint":
  4394. return null;
  4395. case "LineString":
  4396. case "Polygon":
  4397. case "MultiLineString":
  4398. case "MultiPolygon":
  4399. geometry2 = geojson;
  4400. break;
  4401. default:
  4402. throw new Error("geojson is invalid");
  4403. }
  4404. if (geometry2 === null)
  4405. return null;
  4406. var coords = geometry2.coordinates;
  4407. switch (geometry2.type) {
  4408. case "Point":
  4409. return point(coords, properties, options2);
  4410. case "MultiPoint":
  4411. if (multiFeatureIndex < 0)
  4412. multiFeatureIndex = coords.length + multiFeatureIndex;
  4413. return point(coords[multiFeatureIndex], properties, options2);
  4414. case "LineString":
  4415. if (coordIndex < 0)
  4416. coordIndex = coords.length + coordIndex;
  4417. return point(coords[coordIndex], properties, options2);
  4418. case "Polygon":
  4419. if (geometryIndex < 0)
  4420. geometryIndex = coords.length + geometryIndex;
  4421. if (coordIndex < 0)
  4422. coordIndex = coords[geometryIndex].length + coordIndex;
  4423. return point(coords[geometryIndex][coordIndex], properties, options2);
  4424. case "MultiLineString":
  4425. if (multiFeatureIndex < 0)
  4426. multiFeatureIndex = coords.length + multiFeatureIndex;
  4427. if (coordIndex < 0)
  4428. coordIndex = coords[multiFeatureIndex].length + coordIndex;
  4429. return point(coords[multiFeatureIndex][coordIndex], properties, options2);
  4430. case "MultiPolygon":
  4431. if (multiFeatureIndex < 0)
  4432. multiFeatureIndex = coords.length + multiFeatureIndex;
  4433. if (geometryIndex < 0)
  4434. geometryIndex = coords[multiFeatureIndex].length + geometryIndex;
  4435. if (coordIndex < 0)
  4436. coordIndex = coords[multiFeatureIndex][geometryIndex].length - coordIndex;
  4437. return point(
  4438. coords[multiFeatureIndex][geometryIndex][coordIndex],
  4439. properties,
  4440. options2
  4441. );
  4442. }
  4443. throw new Error("geojson is invalid");
  4444. }
  4445. var es$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  4446. __proto__: null,
  4447. coordAll,
  4448. coordEach,
  4449. coordReduce,
  4450. featureEach: featureEach$1,
  4451. featureReduce,
  4452. findPoint,
  4453. findSegment,
  4454. flattenEach,
  4455. flattenReduce,
  4456. geomEach,
  4457. geomReduce,
  4458. lineEach,
  4459. lineReduce,
  4460. propEach,
  4461. propReduce,
  4462. segmentEach,
  4463. segmentReduce
  4464. }, Symbol.toStringTag, { value: "Module" }));
  4465. function bbox$1(geojson) {
  4466. var result = [Infinity, Infinity, -Infinity, -Infinity];
  4467. coordEach(geojson, function(coord) {
  4468. if (result[0] > coord[0]) {
  4469. result[0] = coord[0];
  4470. }
  4471. if (result[1] > coord[1]) {
  4472. result[1] = coord[1];
  4473. }
  4474. if (result[2] < coord[0]) {
  4475. result[2] = coord[0];
  4476. }
  4477. if (result[3] < coord[1]) {
  4478. result[3] = coord[1];
  4479. }
  4480. });
  4481. return result;
  4482. }
  4483. bbox$1["default"] = bbox$1;
  4484. var es = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  4485. __proto__: null,
  4486. "default": bbox$1
  4487. }, Symbol.toStringTag, { value: "Module" }));
  4488. function getCoord(coord) {
  4489. if (!coord) {
  4490. throw new Error("coord is required");
  4491. }
  4492. if (!Array.isArray(coord)) {
  4493. if (coord.type === "Feature" && coord.geometry !== null && coord.geometry.type === "Point") {
  4494. return coord.geometry.coordinates;
  4495. }
  4496. if (coord.type === "Point") {
  4497. return coord.coordinates;
  4498. }
  4499. }
  4500. if (Array.isArray(coord) && coord.length >= 2 && !Array.isArray(coord[0]) && !Array.isArray(coord[1])) {
  4501. return coord;
  4502. }
  4503. throw new Error("coord must be GeoJSON Point or an Array of numbers");
  4504. }
  4505. function getCoords(coords) {
  4506. if (Array.isArray(coords)) {
  4507. return coords;
  4508. }
  4509. if (coords.type === "Feature") {
  4510. if (coords.geometry !== null) {
  4511. return coords.geometry.coordinates;
  4512. }
  4513. } else {
  4514. if (coords.coordinates) {
  4515. return coords.coordinates;
  4516. }
  4517. }
  4518. throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array");
  4519. }
  4520. function getGeom(geojson) {
  4521. if (geojson.type === "Feature") {
  4522. return geojson.geometry;
  4523. }
  4524. return geojson;
  4525. }
  4526. function getType(geojson, _name) {
  4527. if (geojson.type === "FeatureCollection") {
  4528. return "FeatureCollection";
  4529. }
  4530. if (geojson.type === "GeometryCollection") {
  4531. return "GeometryCollection";
  4532. }
  4533. if (geojson.type === "Feature" && geojson.geometry !== null) {
  4534. return geojson.geometry.type;
  4535. }
  4536. return geojson.type;
  4537. }
  4538. var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  4539. function getDefaultExportFromCjs(x) {
  4540. return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, "default") ? x["default"] : x;
  4541. }
  4542. function getAugmentedNamespace(n) {
  4543. if (n.__esModule)
  4544. return n;
  4545. var a = Object.defineProperty({}, "__esModule", { value: true });
  4546. Object.keys(n).forEach(function(k) {
  4547. var d2 = Object.getOwnPropertyDescriptor(n, k);
  4548. Object.defineProperty(a, k, d2.get ? d2 : {
  4549. enumerable: true,
  4550. get: function() {
  4551. return n[k];
  4552. }
  4553. });
  4554. });
  4555. return a;
  4556. }
  4557. var concaveman$2 = { exports: {} };
  4558. var rbush_min$1 = { exports: {} };
  4559. (function(module2, exports2) {
  4560. !function(t2, i2) {
  4561. module2.exports = i2();
  4562. }(commonjsGlobal, function() {
  4563. function t2(t3, r3, e2, a2, h3) {
  4564. !function t4(n2, r4, e3, a3, h4) {
  4565. for (; a3 > e3; ) {
  4566. if (a3 - e3 > 600) {
  4567. var o2 = a3 - e3 + 1, s2 = r4 - e3 + 1, l2 = Math.log(o2), f2 = 0.5 * Math.exp(2 * l2 / 3), u2 = 0.5 * Math.sqrt(l2 * f2 * (o2 - f2) / o2) * (s2 - o2 / 2 < 0 ? -1 : 1), m2 = Math.max(e3, Math.floor(r4 - s2 * f2 / o2 + u2)), c2 = Math.min(a3, Math.floor(r4 + (o2 - s2) * f2 / o2 + u2));
  4568. t4(n2, r4, m2, c2, h4);
  4569. }
  4570. var p2 = n2[r4], d3 = e3, x = a3;
  4571. for (i2(n2, e3, r4), h4(n2[a3], p2) > 0 && i2(n2, e3, a3); d3 < x; ) {
  4572. for (i2(n2, d3, x), d3++, x--; h4(n2[d3], p2) < 0; )
  4573. d3++;
  4574. for (; h4(n2[x], p2) > 0; )
  4575. x--;
  4576. }
  4577. 0 === h4(n2[e3], p2) ? i2(n2, e3, x) : i2(n2, ++x, a3), x <= r4 && (e3 = x + 1), r4 <= x && (a3 = x - 1);
  4578. }
  4579. }(t3, r3, e2 || 0, a2 || t3.length - 1, h3 || n);
  4580. }
  4581. function i2(t3, i3, n2) {
  4582. var r3 = t3[i3];
  4583. t3[i3] = t3[n2], t3[n2] = r3;
  4584. }
  4585. function n(t3, i3) {
  4586. return t3 < i3 ? -1 : t3 > i3 ? 1 : 0;
  4587. }
  4588. var r2 = function(t3) {
  4589. void 0 === t3 && (t3 = 9), this._maxEntries = Math.max(4, t3), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
  4590. };
  4591. function e(t3, i3, n2) {
  4592. if (!n2)
  4593. return i3.indexOf(t3);
  4594. for (var r3 = 0; r3 < i3.length; r3++)
  4595. if (n2(t3, i3[r3]))
  4596. return r3;
  4597. return -1;
  4598. }
  4599. function a(t3, i3) {
  4600. h2(t3, 0, t3.children.length, i3, t3);
  4601. }
  4602. function h2(t3, i3, n2, r3, e2) {
  4603. e2 || (e2 = p(null)), e2.minX = 1 / 0, e2.minY = 1 / 0, e2.maxX = -1 / 0, e2.maxY = -1 / 0;
  4604. for (var a2 = i3; a2 < n2; a2++) {
  4605. var h3 = t3.children[a2];
  4606. o(e2, t3.leaf ? r3(h3) : h3);
  4607. }
  4608. return e2;
  4609. }
  4610. function o(t3, i3) {
  4611. return t3.minX = Math.min(t3.minX, i3.minX), t3.minY = Math.min(t3.minY, i3.minY), t3.maxX = Math.max(t3.maxX, i3.maxX), t3.maxY = Math.max(t3.maxY, i3.maxY), t3;
  4612. }
  4613. function s(t3, i3) {
  4614. return t3.minX - i3.minX;
  4615. }
  4616. function l(t3, i3) {
  4617. return t3.minY - i3.minY;
  4618. }
  4619. function f(t3) {
  4620. return (t3.maxX - t3.minX) * (t3.maxY - t3.minY);
  4621. }
  4622. function u(t3) {
  4623. return t3.maxX - t3.minX + (t3.maxY - t3.minY);
  4624. }
  4625. function m(t3, i3) {
  4626. return t3.minX <= i3.minX && t3.minY <= i3.minY && i3.maxX <= t3.maxX && i3.maxY <= t3.maxY;
  4627. }
  4628. function c(t3, i3) {
  4629. return i3.minX <= t3.maxX && i3.minY <= t3.maxY && i3.maxX >= t3.minX && i3.maxY >= t3.minY;
  4630. }
  4631. function p(t3) {
  4632. return { children: t3, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
  4633. }
  4634. function d2(i3, n2, r3, e2, a2) {
  4635. for (var h3 = [n2, r3]; h3.length; )
  4636. if (!((r3 = h3.pop()) - (n2 = h3.pop()) <= e2)) {
  4637. var o2 = n2 + Math.ceil((r3 - n2) / e2 / 2) * e2;
  4638. t2(i3, o2, n2, r3, a2), h3.push(n2, o2, o2, r3);
  4639. }
  4640. }
  4641. return r2.prototype.all = function() {
  4642. return this._all(this.data, []);
  4643. }, r2.prototype.search = function(t3) {
  4644. var i3 = this.data, n2 = [];
  4645. if (!c(t3, i3))
  4646. return n2;
  4647. for (var r3 = this.toBBox, e2 = []; i3; ) {
  4648. for (var a2 = 0; a2 < i3.children.length; a2++) {
  4649. var h3 = i3.children[a2], o2 = i3.leaf ? r3(h3) : h3;
  4650. c(t3, o2) && (i3.leaf ? n2.push(h3) : m(t3, o2) ? this._all(h3, n2) : e2.push(h3));
  4651. }
  4652. i3 = e2.pop();
  4653. }
  4654. return n2;
  4655. }, r2.prototype.collides = function(t3) {
  4656. var i3 = this.data;
  4657. if (!c(t3, i3))
  4658. return false;
  4659. for (var n2 = []; i3; ) {
  4660. for (var r3 = 0; r3 < i3.children.length; r3++) {
  4661. var e2 = i3.children[r3], a2 = i3.leaf ? this.toBBox(e2) : e2;
  4662. if (c(t3, a2)) {
  4663. if (i3.leaf || m(t3, a2))
  4664. return true;
  4665. n2.push(e2);
  4666. }
  4667. }
  4668. i3 = n2.pop();
  4669. }
  4670. return false;
  4671. }, r2.prototype.load = function(t3) {
  4672. if (!t3 || !t3.length)
  4673. return this;
  4674. if (t3.length < this._minEntries) {
  4675. for (var i3 = 0; i3 < t3.length; i3++)
  4676. this.insert(t3[i3]);
  4677. return this;
  4678. }
  4679. var n2 = this._build(t3.slice(), 0, t3.length - 1, 0);
  4680. if (this.data.children.length)
  4681. if (this.data.height === n2.height)
  4682. this._splitRoot(this.data, n2);
  4683. else {
  4684. if (this.data.height < n2.height) {
  4685. var r3 = this.data;
  4686. this.data = n2, n2 = r3;
  4687. }
  4688. this._insert(n2, this.data.height - n2.height - 1, true);
  4689. }
  4690. else
  4691. this.data = n2;
  4692. return this;
  4693. }, r2.prototype.insert = function(t3) {
  4694. return t3 && this._insert(t3, this.data.height - 1), this;
  4695. }, r2.prototype.clear = function() {
  4696. return this.data = p([]), this;
  4697. }, r2.prototype.remove = function(t3, i3) {
  4698. if (!t3)
  4699. return this;
  4700. for (var n2, r3, a2, h3 = this.data, o2 = this.toBBox(t3), s2 = [], l2 = []; h3 || s2.length; ) {
  4701. if (h3 || (h3 = s2.pop(), r3 = s2[s2.length - 1], n2 = l2.pop(), a2 = true), h3.leaf) {
  4702. var f2 = e(t3, h3.children, i3);
  4703. if (-1 !== f2)
  4704. return h3.children.splice(f2, 1), s2.push(h3), this._condense(s2), this;
  4705. }
  4706. a2 || h3.leaf || !m(h3, o2) ? r3 ? (n2++, h3 = r3.children[n2], a2 = false) : h3 = null : (s2.push(h3), l2.push(n2), n2 = 0, r3 = h3, h3 = h3.children[0]);
  4707. }
  4708. return this;
  4709. }, r2.prototype.toBBox = function(t3) {
  4710. return t3;
  4711. }, r2.prototype.compareMinX = function(t3, i3) {
  4712. return t3.minX - i3.minX;
  4713. }, r2.prototype.compareMinY = function(t3, i3) {
  4714. return t3.minY - i3.minY;
  4715. }, r2.prototype.toJSON = function() {
  4716. return this.data;
  4717. }, r2.prototype.fromJSON = function(t3) {
  4718. return this.data = t3, this;
  4719. }, r2.prototype._all = function(t3, i3) {
  4720. for (var n2 = []; t3; )
  4721. t3.leaf ? i3.push.apply(i3, t3.children) : n2.push.apply(n2, t3.children), t3 = n2.pop();
  4722. return i3;
  4723. }, r2.prototype._build = function(t3, i3, n2, r3) {
  4724. var e2, h3 = n2 - i3 + 1, o2 = this._maxEntries;
  4725. if (h3 <= o2)
  4726. return a(e2 = p(t3.slice(i3, n2 + 1)), this.toBBox), e2;
  4727. r3 || (r3 = Math.ceil(Math.log(h3) / Math.log(o2)), o2 = Math.ceil(h3 / Math.pow(o2, r3 - 1))), (e2 = p([])).leaf = false, e2.height = r3;
  4728. var s2 = Math.ceil(h3 / o2), l2 = s2 * Math.ceil(Math.sqrt(o2));
  4729. d2(t3, i3, n2, l2, this.compareMinX);
  4730. for (var f2 = i3; f2 <= n2; f2 += l2) {
  4731. var u2 = Math.min(f2 + l2 - 1, n2);
  4732. d2(t3, f2, u2, s2, this.compareMinY);
  4733. for (var m2 = f2; m2 <= u2; m2 += s2) {
  4734. var c2 = Math.min(m2 + s2 - 1, u2);
  4735. e2.children.push(this._build(t3, m2, c2, r3 - 1));
  4736. }
  4737. }
  4738. return a(e2, this.toBBox), e2;
  4739. }, r2.prototype._chooseSubtree = function(t3, i3, n2, r3) {
  4740. for (; r3.push(i3), !i3.leaf && r3.length - 1 !== n2; ) {
  4741. for (var e2 = 1 / 0, a2 = 1 / 0, h3 = void 0, o2 = 0; o2 < i3.children.length; o2++) {
  4742. var s2 = i3.children[o2], l2 = f(s2), u2 = (m2 = t3, c2 = s2, (Math.max(c2.maxX, m2.maxX) - Math.min(c2.minX, m2.minX)) * (Math.max(c2.maxY, m2.maxY) - Math.min(c2.minY, m2.minY)) - l2);
  4743. u2 < a2 ? (a2 = u2, e2 = l2 < e2 ? l2 : e2, h3 = s2) : u2 === a2 && l2 < e2 && (e2 = l2, h3 = s2);
  4744. }
  4745. i3 = h3 || i3.children[0];
  4746. }
  4747. var m2, c2;
  4748. return i3;
  4749. }, r2.prototype._insert = function(t3, i3, n2) {
  4750. var r3 = n2 ? t3 : this.toBBox(t3), e2 = [], a2 = this._chooseSubtree(r3, this.data, i3, e2);
  4751. for (a2.children.push(t3), o(a2, r3); i3 >= 0 && e2[i3].children.length > this._maxEntries; )
  4752. this._split(e2, i3), i3--;
  4753. this._adjustParentBBoxes(r3, e2, i3);
  4754. }, r2.prototype._split = function(t3, i3) {
  4755. var n2 = t3[i3], r3 = n2.children.length, e2 = this._minEntries;
  4756. this._chooseSplitAxis(n2, e2, r3);
  4757. var h3 = this._chooseSplitIndex(n2, e2, r3), o2 = p(n2.children.splice(h3, n2.children.length - h3));
  4758. o2.height = n2.height, o2.leaf = n2.leaf, a(n2, this.toBBox), a(o2, this.toBBox), i3 ? t3[i3 - 1].children.push(o2) : this._splitRoot(n2, o2);
  4759. }, r2.prototype._splitRoot = function(t3, i3) {
  4760. this.data = p([t3, i3]), this.data.height = t3.height + 1, this.data.leaf = false, a(this.data, this.toBBox);
  4761. }, r2.prototype._chooseSplitIndex = function(t3, i3, n2) {
  4762. for (var r3, e2, a2, o2, s2, l2, u2, m2 = 1 / 0, c2 = 1 / 0, p2 = i3; p2 <= n2 - i3; p2++) {
  4763. var d3 = h2(t3, 0, p2, this.toBBox), x = h2(t3, p2, n2, this.toBBox), v = (e2 = d3, a2 = x, o2 = void 0, s2 = void 0, l2 = void 0, u2 = void 0, o2 = Math.max(e2.minX, a2.minX), s2 = Math.max(e2.minY, a2.minY), l2 = Math.min(e2.maxX, a2.maxX), u2 = Math.min(e2.maxY, a2.maxY), Math.max(0, l2 - o2) * Math.max(0, u2 - s2)), M = f(d3) + f(x);
  4764. v < m2 ? (m2 = v, r3 = p2, c2 = M < c2 ? M : c2) : v === m2 && M < c2 && (c2 = M, r3 = p2);
  4765. }
  4766. return r3 || n2 - i3;
  4767. }, r2.prototype._chooseSplitAxis = function(t3, i3, n2) {
  4768. var r3 = t3.leaf ? this.compareMinX : s, e2 = t3.leaf ? this.compareMinY : l;
  4769. this._allDistMargin(t3, i3, n2, r3) < this._allDistMargin(t3, i3, n2, e2) && t3.children.sort(r3);
  4770. }, r2.prototype._allDistMargin = function(t3, i3, n2, r3) {
  4771. t3.children.sort(r3);
  4772. for (var e2 = this.toBBox, a2 = h2(t3, 0, i3, e2), s2 = h2(t3, n2 - i3, n2, e2), l2 = u(a2) + u(s2), f2 = i3; f2 < n2 - i3; f2++) {
  4773. var m2 = t3.children[f2];
  4774. o(a2, t3.leaf ? e2(m2) : m2), l2 += u(a2);
  4775. }
  4776. for (var c2 = n2 - i3 - 1; c2 >= i3; c2--) {
  4777. var p2 = t3.children[c2];
  4778. o(s2, t3.leaf ? e2(p2) : p2), l2 += u(s2);
  4779. }
  4780. return l2;
  4781. }, r2.prototype._adjustParentBBoxes = function(t3, i3, n2) {
  4782. for (var r3 = n2; r3 >= 0; r3--)
  4783. o(i3[r3], t3);
  4784. }, r2.prototype._condense = function(t3) {
  4785. for (var i3 = t3.length - 1, n2 = void 0; i3 >= 0; i3--)
  4786. 0 === t3[i3].children.length ? i3 > 0 ? (n2 = t3[i3 - 1].children).splice(n2.indexOf(t3[i3]), 1) : this.clear() : a(t3[i3], this.toBBox);
  4787. }, r2;
  4788. });
  4789. })(rbush_min$1);
  4790. class TinyQueue {
  4791. constructor(data = [], compare = defaultCompare) {
  4792. this.data = data;
  4793. this.length = this.data.length;
  4794. this.compare = compare;
  4795. if (this.length > 0) {
  4796. for (let i2 = (this.length >> 1) - 1; i2 >= 0; i2--)
  4797. this._down(i2);
  4798. }
  4799. }
  4800. push(item) {
  4801. this.data.push(item);
  4802. this.length++;
  4803. this._up(this.length - 1);
  4804. }
  4805. pop() {
  4806. if (this.length === 0)
  4807. return void 0;
  4808. const top = this.data[0];
  4809. const bottom = this.data.pop();
  4810. this.length--;
  4811. if (this.length > 0) {
  4812. this.data[0] = bottom;
  4813. this._down(0);
  4814. }
  4815. return top;
  4816. }
  4817. peek() {
  4818. return this.data[0];
  4819. }
  4820. _up(pos) {
  4821. const { data, compare } = this;
  4822. const item = data[pos];
  4823. while (pos > 0) {
  4824. const parent = pos - 1 >> 1;
  4825. const current = data[parent];
  4826. if (compare(item, current) >= 0)
  4827. break;
  4828. data[pos] = current;
  4829. pos = parent;
  4830. }
  4831. data[pos] = item;
  4832. }
  4833. _down(pos) {
  4834. const { data, compare } = this;
  4835. const halfLength = this.length >> 1;
  4836. const item = data[pos];
  4837. while (pos < halfLength) {
  4838. let left = (pos << 1) + 1;
  4839. let best = data[left];
  4840. const right = left + 1;
  4841. if (right < this.length && compare(data[right], best) < 0) {
  4842. left = right;
  4843. best = data[right];
  4844. }
  4845. if (compare(best, item) >= 0)
  4846. break;
  4847. data[pos] = best;
  4848. pos = left;
  4849. }
  4850. data[pos] = item;
  4851. }
  4852. }
  4853. function defaultCompare(a, b) {
  4854. return a < b ? -1 : a > b ? 1 : 0;
  4855. }
  4856. var tinyqueue = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  4857. __proto__: null,
  4858. "default": TinyQueue
  4859. }, Symbol.toStringTag, { value: "Module" }));
  4860. var require$$1$2 = /* @__PURE__ */ getAugmentedNamespace(tinyqueue);
  4861. var pointInPolygon$1 = { exports: {} };
  4862. var flat = function pointInPolygonFlat(point2, vs, start2, end) {
  4863. var x = point2[0], y = point2[1];
  4864. var inside2 = false;
  4865. if (start2 === void 0)
  4866. start2 = 0;
  4867. if (end === void 0)
  4868. end = vs.length;
  4869. var len = (end - start2) / 2;
  4870. for (var i2 = 0, j = len - 1; i2 < len; j = i2++) {
  4871. var xi = vs[start2 + i2 * 2 + 0], yi = vs[start2 + i2 * 2 + 1];
  4872. var xj = vs[start2 + j * 2 + 0], yj = vs[start2 + j * 2 + 1];
  4873. var intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
  4874. if (intersect)
  4875. inside2 = !inside2;
  4876. }
  4877. return inside2;
  4878. };
  4879. var nested = function pointInPolygonNested(point2, vs, start2, end) {
  4880. var x = point2[0], y = point2[1];
  4881. var inside2 = false;
  4882. if (start2 === void 0)
  4883. start2 = 0;
  4884. if (end === void 0)
  4885. end = vs.length;
  4886. var len = end - start2;
  4887. for (var i2 = 0, j = len - 1; i2 < len; j = i2++) {
  4888. var xi = vs[i2 + start2][0], yi = vs[i2 + start2][1];
  4889. var xj = vs[j + start2][0], yj = vs[j + start2][1];
  4890. var intersect = yi > y !== yj > y && x < (xj - xi) * (y - yi) / (yj - yi) + xi;
  4891. if (intersect)
  4892. inside2 = !inside2;
  4893. }
  4894. return inside2;
  4895. };
  4896. var pointInPolygonFlat2 = flat;
  4897. var pointInPolygonNested2 = nested;
  4898. pointInPolygon$1.exports = function pointInPolygon(point2, vs, start2, end) {
  4899. if (vs.length > 0 && Array.isArray(vs[0])) {
  4900. return pointInPolygonNested2(point2, vs, start2, end);
  4901. } else {
  4902. return pointInPolygonFlat2(point2, vs, start2, end);
  4903. }
  4904. };
  4905. pointInPolygon$1.exports.nested = pointInPolygonNested2;
  4906. pointInPolygon$1.exports.flat = pointInPolygonFlat2;
  4907. var orient2d_min = { exports: {} };
  4908. (function(module2, exports2) {
  4909. !function(t2, e) {
  4910. e(exports2);
  4911. }(commonjsGlobal, function(t2) {
  4912. const e = 134217729, n = 33306690738754706e-32;
  4913. function r2(t3, e2, n2, r3, o2) {
  4914. let f2, i3, u2, c2, s2 = e2[0], a2 = r3[0], d3 = 0, l2 = 0;
  4915. a2 > s2 == a2 > -s2 ? (f2 = s2, s2 = e2[++d3]) : (f2 = a2, a2 = r3[++l2]);
  4916. let p = 0;
  4917. if (d3 < t3 && l2 < n2)
  4918. for (a2 > s2 == a2 > -s2 ? (u2 = f2 - ((i3 = s2 + f2) - s2), s2 = e2[++d3]) : (u2 = f2 - ((i3 = a2 + f2) - a2), a2 = r3[++l2]), f2 = i3, 0 !== u2 && (o2[p++] = u2); d3 < t3 && l2 < n2; )
  4919. a2 > s2 == a2 > -s2 ? (u2 = f2 - ((i3 = f2 + s2) - (c2 = i3 - f2)) + (s2 - c2), s2 = e2[++d3]) : (u2 = f2 - ((i3 = f2 + a2) - (c2 = i3 - f2)) + (a2 - c2), a2 = r3[++l2]), f2 = i3, 0 !== u2 && (o2[p++] = u2);
  4920. for (; d3 < t3; )
  4921. u2 = f2 - ((i3 = f2 + s2) - (c2 = i3 - f2)) + (s2 - c2), s2 = e2[++d3], f2 = i3, 0 !== u2 && (o2[p++] = u2);
  4922. for (; l2 < n2; )
  4923. u2 = f2 - ((i3 = f2 + a2) - (c2 = i3 - f2)) + (a2 - c2), a2 = r3[++l2], f2 = i3, 0 !== u2 && (o2[p++] = u2);
  4924. return 0 === f2 && 0 !== p || (o2[p++] = f2), p;
  4925. }
  4926. function o(t3) {
  4927. return new Float64Array(t3);
  4928. }
  4929. const f = 33306690738754716e-32, i2 = 22204460492503146e-32, u = 11093356479670487e-47, c = o(4), s = o(8), a = o(12), d2 = o(16), l = o(4);
  4930. t2.orient2d = function(t3, o2, p, b, y, h2) {
  4931. const M = (o2 - h2) * (p - y), x = (t3 - y) * (b - h2), j = M - x;
  4932. if (0 === M || 0 === x || M > 0 != x > 0)
  4933. return j;
  4934. const m = Math.abs(M + x);
  4935. return Math.abs(j) >= f * m ? j : -function(t4, o3, f2, p2, b2, y2, h3) {
  4936. let M2, x2, j2, m2, _, v, w, A, F, O, P2, g, k, q2, z, B2, C2, D;
  4937. const E2 = t4 - b2, G2 = f2 - b2, H2 = o3 - y2, I2 = p2 - y2;
  4938. _ = (z = (A = E2 - (w = (v = e * E2) - (v - E2))) * (O = I2 - (F = (v = e * I2) - (v - I2))) - ((q2 = E2 * I2) - w * F - A * F - w * O)) - (P2 = z - (C2 = (A = H2 - (w = (v = e * H2) - (v - H2))) * (O = G2 - (F = (v = e * G2) - (v - G2))) - ((B2 = H2 * G2) - w * F - A * F - w * O))), c[0] = z - (P2 + _) + (_ - C2), _ = (k = q2 - ((g = q2 + P2) - (_ = g - q2)) + (P2 - _)) - (P2 = k - B2), c[1] = k - (P2 + _) + (_ - B2), _ = (D = g + P2) - g, c[2] = g - (D - _) + (P2 - _), c[3] = D;
  4939. let J2 = function(t5, e2) {
  4940. let n2 = e2[0];
  4941. for (let r3 = 1; r3 < t5; r3++)
  4942. n2 += e2[r3];
  4943. return n2;
  4944. }(4, c), K2 = i2 * h3;
  4945. if (J2 >= K2 || -J2 >= K2)
  4946. return J2;
  4947. if (M2 = t4 - (E2 + (_ = t4 - E2)) + (_ - b2), j2 = f2 - (G2 + (_ = f2 - G2)) + (_ - b2), x2 = o3 - (H2 + (_ = o3 - H2)) + (_ - y2), m2 = p2 - (I2 + (_ = p2 - I2)) + (_ - y2), 0 === M2 && 0 === x2 && 0 === j2 && 0 === m2)
  4948. return J2;
  4949. if (K2 = u * h3 + n * Math.abs(J2), (J2 += E2 * m2 + I2 * M2 - (H2 * j2 + G2 * x2)) >= K2 || -J2 >= K2)
  4950. return J2;
  4951. _ = (z = (A = M2 - (w = (v = e * M2) - (v - M2))) * (O = I2 - (F = (v = e * I2) - (v - I2))) - ((q2 = M2 * I2) - w * F - A * F - w * O)) - (P2 = z - (C2 = (A = x2 - (w = (v = e * x2) - (v - x2))) * (O = G2 - (F = (v = e * G2) - (v - G2))) - ((B2 = x2 * G2) - w * F - A * F - w * O))), l[0] = z - (P2 + _) + (_ - C2), _ = (k = q2 - ((g = q2 + P2) - (_ = g - q2)) + (P2 - _)) - (P2 = k - B2), l[1] = k - (P2 + _) + (_ - B2), _ = (D = g + P2) - g, l[2] = g - (D - _) + (P2 - _), l[3] = D;
  4952. const L = r2(4, c, 4, l, s);
  4953. _ = (z = (A = E2 - (w = (v = e * E2) - (v - E2))) * (O = m2 - (F = (v = e * m2) - (v - m2))) - ((q2 = E2 * m2) - w * F - A * F - w * O)) - (P2 = z - (C2 = (A = H2 - (w = (v = e * H2) - (v - H2))) * (O = j2 - (F = (v = e * j2) - (v - j2))) - ((B2 = H2 * j2) - w * F - A * F - w * O))), l[0] = z - (P2 + _) + (_ - C2), _ = (k = q2 - ((g = q2 + P2) - (_ = g - q2)) + (P2 - _)) - (P2 = k - B2), l[1] = k - (P2 + _) + (_ - B2), _ = (D = g + P2) - g, l[2] = g - (D - _) + (P2 - _), l[3] = D;
  4954. const N2 = r2(L, s, 4, l, a);
  4955. _ = (z = (A = M2 - (w = (v = e * M2) - (v - M2))) * (O = m2 - (F = (v = e * m2) - (v - m2))) - ((q2 = M2 * m2) - w * F - A * F - w * O)) - (P2 = z - (C2 = (A = x2 - (w = (v = e * x2) - (v - x2))) * (O = j2 - (F = (v = e * j2) - (v - j2))) - ((B2 = x2 * j2) - w * F - A * F - w * O))), l[0] = z - (P2 + _) + (_ - C2), _ = (k = q2 - ((g = q2 + P2) - (_ = g - q2)) + (P2 - _)) - (P2 = k - B2), l[1] = k - (P2 + _) + (_ - B2), _ = (D = g + P2) - g, l[2] = g - (D - _) + (P2 - _), l[3] = D;
  4956. const Q2 = r2(N2, a, 4, l, d2);
  4957. return d2[Q2 - 1];
  4958. }(t3, o2, p, b, y, h2, m);
  4959. }, t2.orient2dfast = function(t3, e2, n2, r3, o2, f2) {
  4960. return (e2 - f2) * (n2 - o2) - (t3 - o2) * (r3 - f2);
  4961. }, Object.defineProperty(t2, "__esModule", { value: true });
  4962. });
  4963. })(orient2d_min, orient2d_min.exports);
  4964. var RBush = rbush_min$1.exports;
  4965. var Queue = require$$1$2;
  4966. var pointInPolygon2 = pointInPolygon$1.exports;
  4967. var orient = orient2d_min.exports.orient2d;
  4968. if (Queue.default) {
  4969. Queue = Queue.default;
  4970. }
  4971. concaveman$2.exports = concaveman;
  4972. concaveman$2.exports.default = concaveman;
  4973. function concaveman(points2, concavity, lengthThreshold) {
  4974. concavity = Math.max(0, concavity === void 0 ? 2 : concavity);
  4975. lengthThreshold = lengthThreshold || 0;
  4976. var hull = fastConvexHull(points2);
  4977. var tree = new RBush(16);
  4978. tree.toBBox = function(a2) {
  4979. return {
  4980. minX: a2[0],
  4981. minY: a2[1],
  4982. maxX: a2[0],
  4983. maxY: a2[1]
  4984. };
  4985. };
  4986. tree.compareMinX = function(a2, b2) {
  4987. return a2[0] - b2[0];
  4988. };
  4989. tree.compareMinY = function(a2, b2) {
  4990. return a2[1] - b2[1];
  4991. };
  4992. tree.load(points2);
  4993. var queue = [];
  4994. for (var i2 = 0, last; i2 < hull.length; i2++) {
  4995. var p = hull[i2];
  4996. tree.remove(p);
  4997. last = insertNode(p, last);
  4998. queue.push(last);
  4999. }
  5000. var segTree = new RBush(16);
  5001. for (i2 = 0; i2 < queue.length; i2++)
  5002. segTree.insert(updateBBox(queue[i2]));
  5003. var sqConcavity = concavity * concavity;
  5004. var sqLenThreshold = lengthThreshold * lengthThreshold;
  5005. while (queue.length) {
  5006. var node = queue.shift();
  5007. var a = node.p;
  5008. var b = node.next.p;
  5009. var sqLen = getSqDist(a, b);
  5010. if (sqLen < sqLenThreshold)
  5011. continue;
  5012. var maxSqLen = sqLen / sqConcavity;
  5013. p = findCandidate(tree, node.prev.p, a, b, node.next.next.p, maxSqLen, segTree);
  5014. if (p && Math.min(getSqDist(p, a), getSqDist(p, b)) <= maxSqLen) {
  5015. queue.push(node);
  5016. queue.push(insertNode(p, node));
  5017. tree.remove(p);
  5018. segTree.remove(node);
  5019. segTree.insert(updateBBox(node));
  5020. segTree.insert(updateBBox(node.next));
  5021. }
  5022. }
  5023. node = last;
  5024. var concave = [];
  5025. do {
  5026. concave.push(node.p);
  5027. node = node.next;
  5028. } while (node !== last);
  5029. concave.push(node.p);
  5030. return concave;
  5031. }
  5032. function findCandidate(tree, a, b, c, d2, maxDist, segTree) {
  5033. var queue = new Queue([], compareDist);
  5034. var node = tree.data;
  5035. while (node) {
  5036. for (var i2 = 0; i2 < node.children.length; i2++) {
  5037. var child = node.children[i2];
  5038. var dist = node.leaf ? sqSegDist(child, b, c) : sqSegBoxDist(b, c, child);
  5039. if (dist > maxDist)
  5040. continue;
  5041. queue.push({
  5042. node: child,
  5043. dist
  5044. });
  5045. }
  5046. while (queue.length && !queue.peek().node.children) {
  5047. var item = queue.pop();
  5048. var p = item.node;
  5049. var d0 = sqSegDist(p, a, b);
  5050. var d1 = sqSegDist(p, c, d2);
  5051. if (item.dist < d0 && item.dist < d1 && noIntersections(b, p, segTree) && noIntersections(c, p, segTree))
  5052. return p;
  5053. }
  5054. node = queue.pop();
  5055. if (node)
  5056. node = node.node;
  5057. }
  5058. return null;
  5059. }
  5060. function compareDist(a, b) {
  5061. return a.dist - b.dist;
  5062. }
  5063. function sqSegBoxDist(a, b, bbox2) {
  5064. if (inside(a, bbox2) || inside(b, bbox2))
  5065. return 0;
  5066. var d1 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.minX, bbox2.minY, bbox2.maxX, bbox2.minY);
  5067. if (d1 === 0)
  5068. return 0;
  5069. var d2 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.minX, bbox2.minY, bbox2.minX, bbox2.maxY);
  5070. if (d2 === 0)
  5071. return 0;
  5072. var d3 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.maxX, bbox2.minY, bbox2.maxX, bbox2.maxY);
  5073. if (d3 === 0)
  5074. return 0;
  5075. var d4 = sqSegSegDist(a[0], a[1], b[0], b[1], bbox2.minX, bbox2.maxY, bbox2.maxX, bbox2.maxY);
  5076. if (d4 === 0)
  5077. return 0;
  5078. return Math.min(d1, d2, d3, d4);
  5079. }
  5080. function inside(a, bbox2) {
  5081. return a[0] >= bbox2.minX && a[0] <= bbox2.maxX && a[1] >= bbox2.minY && a[1] <= bbox2.maxY;
  5082. }
  5083. function noIntersections(a, b, segTree) {
  5084. var minX = Math.min(a[0], b[0]);
  5085. var minY = Math.min(a[1], b[1]);
  5086. var maxX = Math.max(a[0], b[0]);
  5087. var maxY = Math.max(a[1], b[1]);
  5088. var edges = segTree.search({ minX, minY, maxX, maxY });
  5089. for (var i2 = 0; i2 < edges.length; i2++) {
  5090. if (intersects$1(edges[i2].p, edges[i2].next.p, a, b))
  5091. return false;
  5092. }
  5093. return true;
  5094. }
  5095. function cross(p1, p2, p3) {
  5096. return orient(p1[0], p1[1], p2[0], p2[1], p3[0], p3[1]);
  5097. }
  5098. function intersects$1(p1, q1, p2, q2) {
  5099. return p1 !== q2 && q1 !== p2 && cross(p1, q1, p2) > 0 !== cross(p1, q1, q2) > 0 && cross(p2, q2, p1) > 0 !== cross(p2, q2, q1) > 0;
  5100. }
  5101. function updateBBox(node) {
  5102. var p1 = node.p;
  5103. var p2 = node.next.p;
  5104. node.minX = Math.min(p1[0], p2[0]);
  5105. node.minY = Math.min(p1[1], p2[1]);
  5106. node.maxX = Math.max(p1[0], p2[0]);
  5107. node.maxY = Math.max(p1[1], p2[1]);
  5108. return node;
  5109. }
  5110. function fastConvexHull(points2) {
  5111. var left = points2[0];
  5112. var top = points2[0];
  5113. var right = points2[0];
  5114. var bottom = points2[0];
  5115. for (var i2 = 0; i2 < points2.length; i2++) {
  5116. var p = points2[i2];
  5117. if (p[0] < left[0])
  5118. left = p;
  5119. if (p[0] > right[0])
  5120. right = p;
  5121. if (p[1] < top[1])
  5122. top = p;
  5123. if (p[1] > bottom[1])
  5124. bottom = p;
  5125. }
  5126. var cull = [left, top, right, bottom];
  5127. var filtered = cull.slice();
  5128. for (i2 = 0; i2 < points2.length; i2++) {
  5129. if (!pointInPolygon2(points2[i2], cull))
  5130. filtered.push(points2[i2]);
  5131. }
  5132. return convexHull(filtered);
  5133. }
  5134. function insertNode(p, prev) {
  5135. var node = {
  5136. p,
  5137. prev: null,
  5138. next: null,
  5139. minX: 0,
  5140. minY: 0,
  5141. maxX: 0,
  5142. maxY: 0
  5143. };
  5144. if (!prev) {
  5145. node.prev = node;
  5146. node.next = node;
  5147. } else {
  5148. node.next = prev.next;
  5149. node.prev = prev;
  5150. prev.next.prev = node;
  5151. prev.next = node;
  5152. }
  5153. return node;
  5154. }
  5155. function getSqDist(p1, p2) {
  5156. var dx = p1[0] - p2[0], dy = p1[1] - p2[1];
  5157. return dx * dx + dy * dy;
  5158. }
  5159. function sqSegDist(p, p1, p2) {
  5160. var x = p1[0], y = p1[1], dx = p2[0] - x, dy = p2[1] - y;
  5161. if (dx !== 0 || dy !== 0) {
  5162. var t2 = ((p[0] - x) * dx + (p[1] - y) * dy) / (dx * dx + dy * dy);
  5163. if (t2 > 1) {
  5164. x = p2[0];
  5165. y = p2[1];
  5166. } else if (t2 > 0) {
  5167. x += dx * t2;
  5168. y += dy * t2;
  5169. }
  5170. }
  5171. dx = p[0] - x;
  5172. dy = p[1] - y;
  5173. return dx * dx + dy * dy;
  5174. }
  5175. function sqSegSegDist(x0, y0, x1, y1, x2, y2, x3, y3) {
  5176. var ux = x1 - x0;
  5177. var uy = y1 - y0;
  5178. var vx = x3 - x2;
  5179. var vy = y3 - y2;
  5180. var wx = x0 - x2;
  5181. var wy = y0 - y2;
  5182. var a = ux * ux + uy * uy;
  5183. var b = ux * vx + uy * vy;
  5184. var c = vx * vx + vy * vy;
  5185. var d2 = ux * wx + uy * wy;
  5186. var e = vx * wx + vy * wy;
  5187. var D = a * c - b * b;
  5188. var sc, sN, tc, tN;
  5189. var sD = D;
  5190. var tD = D;
  5191. if (D === 0) {
  5192. sN = 0;
  5193. sD = 1;
  5194. tN = e;
  5195. tD = c;
  5196. } else {
  5197. sN = b * e - c * d2;
  5198. tN = a * e - b * d2;
  5199. if (sN < 0) {
  5200. sN = 0;
  5201. tN = e;
  5202. tD = c;
  5203. } else if (sN > sD) {
  5204. sN = sD;
  5205. tN = e + b;
  5206. tD = c;
  5207. }
  5208. }
  5209. if (tN < 0) {
  5210. tN = 0;
  5211. if (-d2 < 0)
  5212. sN = 0;
  5213. else if (-d2 > a)
  5214. sN = sD;
  5215. else {
  5216. sN = -d2;
  5217. sD = a;
  5218. }
  5219. } else if (tN > tD) {
  5220. tN = tD;
  5221. if (-d2 + b < 0)
  5222. sN = 0;
  5223. else if (-d2 + b > a)
  5224. sN = sD;
  5225. else {
  5226. sN = -d2 + b;
  5227. sD = a;
  5228. }
  5229. }
  5230. sc = sN === 0 ? 0 : sN / sD;
  5231. tc = tN === 0 ? 0 : tN / tD;
  5232. var cx = (1 - sc) * x0 + sc * x1;
  5233. var cy = (1 - sc) * y0 + sc * y1;
  5234. var cx2 = (1 - tc) * x2 + tc * x3;
  5235. var cy2 = (1 - tc) * y2 + tc * y3;
  5236. var dx = cx2 - cx;
  5237. var dy = cy2 - cy;
  5238. return dx * dx + dy * dy;
  5239. }
  5240. function compareByX(a, b) {
  5241. return a[0] === b[0] ? a[1] - b[1] : a[0] - b[0];
  5242. }
  5243. function convexHull(points2) {
  5244. points2.sort(compareByX);
  5245. var lower = [];
  5246. for (var i2 = 0; i2 < points2.length; i2++) {
  5247. while (lower.length >= 2 && cross(lower[lower.length - 2], lower[lower.length - 1], points2[i2]) <= 0) {
  5248. lower.pop();
  5249. }
  5250. lower.push(points2[i2]);
  5251. }
  5252. var upper = [];
  5253. for (var ii = points2.length - 1; ii >= 0; ii--) {
  5254. while (upper.length >= 2 && cross(upper[upper.length - 2], upper[upper.length - 1], points2[ii]) <= 0) {
  5255. upper.pop();
  5256. }
  5257. upper.push(points2[ii]);
  5258. }
  5259. upper.pop();
  5260. lower.pop();
  5261. return lower.concat(upper);
  5262. }
  5263. var concaveman$1 = concaveman$2.exports;
  5264. function convex(geojson, options2) {
  5265. if (options2 === void 0) {
  5266. options2 = {};
  5267. }
  5268. options2.concavity = options2.concavity || Infinity;
  5269. var points2 = [];
  5270. coordEach(geojson, function(coord) {
  5271. points2.push([coord[0], coord[1]]);
  5272. });
  5273. if (!points2.length) {
  5274. return null;
  5275. }
  5276. var convexHull2 = concaveman$1(points2, options2.concavity);
  5277. if (convexHull2.length > 3) {
  5278. return polygon([convexHull2]);
  5279. }
  5280. return null;
  5281. }
  5282. function booleanPointInPolygon(point2, polygon2, options2) {
  5283. if (options2 === void 0) {
  5284. options2 = {};
  5285. }
  5286. if (!point2) {
  5287. throw new Error("point is required");
  5288. }
  5289. if (!polygon2) {
  5290. throw new Error("polygon is required");
  5291. }
  5292. var pt2 = getCoord(point2);
  5293. var geom = getGeom(polygon2);
  5294. var type2 = geom.type;
  5295. var bbox2 = polygon2.bbox;
  5296. var polys = geom.coordinates;
  5297. if (bbox2 && inBBox(pt2, bbox2) === false) {
  5298. return false;
  5299. }
  5300. if (type2 === "Polygon") {
  5301. polys = [polys];
  5302. }
  5303. var insidePoly = false;
  5304. for (var i2 = 0; i2 < polys.length && !insidePoly; i2++) {
  5305. if (inRing(pt2, polys[i2][0], options2.ignoreBoundary)) {
  5306. var inHole = false;
  5307. var k = 1;
  5308. while (k < polys[i2].length && !inHole) {
  5309. if (inRing(pt2, polys[i2][k], !options2.ignoreBoundary)) {
  5310. inHole = true;
  5311. }
  5312. k++;
  5313. }
  5314. if (!inHole) {
  5315. insidePoly = true;
  5316. }
  5317. }
  5318. }
  5319. return insidePoly;
  5320. }
  5321. function inRing(pt2, ring, ignoreBoundary) {
  5322. var isInside = false;
  5323. if (ring[0][0] === ring[ring.length - 1][0] && ring[0][1] === ring[ring.length - 1][1]) {
  5324. ring = ring.slice(0, ring.length - 1);
  5325. }
  5326. for (var i2 = 0, j = ring.length - 1; i2 < ring.length; j = i2++) {
  5327. var xi = ring[i2][0];
  5328. var yi = ring[i2][1];
  5329. var xj = ring[j][0];
  5330. var yj = ring[j][1];
  5331. var onBoundary = pt2[1] * (xi - xj) + yi * (xj - pt2[0]) + yj * (pt2[0] - xi) === 0 && (xi - pt2[0]) * (xj - pt2[0]) <= 0 && (yi - pt2[1]) * (yj - pt2[1]) <= 0;
  5332. if (onBoundary) {
  5333. return !ignoreBoundary;
  5334. }
  5335. var intersect = yi > pt2[1] !== yj > pt2[1] && pt2[0] < (xj - xi) * (pt2[1] - yi) / (yj - yi) + xi;
  5336. if (intersect) {
  5337. isInside = !isInside;
  5338. }
  5339. }
  5340. return isInside;
  5341. }
  5342. function inBBox(pt2, bbox2) {
  5343. return bbox2[0] <= pt2[0] && bbox2[1] <= pt2[1] && bbox2[2] >= pt2[0] && bbox2[3] >= pt2[1];
  5344. }
  5345. function distance(from3, to, options2) {
  5346. if (options2 === void 0) {
  5347. options2 = {};
  5348. }
  5349. var coordinates1 = getCoord(from3);
  5350. var coordinates2 = getCoord(to);
  5351. var dLat = degreesToRadians(coordinates2[1] - coordinates1[1]);
  5352. var dLon = degreesToRadians(coordinates2[0] - coordinates1[0]);
  5353. var lat1 = degreesToRadians(coordinates1[1]);
  5354. var lat2 = degreesToRadians(coordinates2[1]);
  5355. var a = Math.pow(Math.sin(dLat / 2), 2) + Math.pow(Math.sin(dLon / 2), 2) * Math.cos(lat1) * Math.cos(lat2);
  5356. return radiansToLength(2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)), options2.units);
  5357. }
  5358. function bboxPolygon(bbox2, options2) {
  5359. if (options2 === void 0) {
  5360. options2 = {};
  5361. }
  5362. var west = Number(bbox2[0]);
  5363. var south = Number(bbox2[1]);
  5364. var east = Number(bbox2[2]);
  5365. var north = Number(bbox2[3]);
  5366. if (bbox2.length === 6) {
  5367. throw new Error("@turf/bbox-polygon does not support BBox with 6 positions");
  5368. }
  5369. var lowLeft = [west, south];
  5370. var topLeft = [west, north];
  5371. var topRight = [east, north];
  5372. var lowRight = [east, south];
  5373. return polygon([[lowLeft, lowRight, topRight, topLeft, lowLeft]], options2.properties, { bbox: bbox2, id: options2.id });
  5374. }
  5375. function destination(origin, distance2, bearing2, options2) {
  5376. if (options2 === void 0) {
  5377. options2 = {};
  5378. }
  5379. var coordinates1 = getCoord(origin);
  5380. var longitude1 = degreesToRadians(coordinates1[0]);
  5381. var latitude1 = degreesToRadians(coordinates1[1]);
  5382. var bearingRad = degreesToRadians(bearing2);
  5383. var radians = lengthToRadians(distance2, options2.units);
  5384. var latitude2 = Math.asin(Math.sin(latitude1) * Math.cos(radians) + Math.cos(latitude1) * Math.sin(radians) * Math.cos(bearingRad));
  5385. var longitude2 = longitude1 + Math.atan2(Math.sin(bearingRad) * Math.sin(radians) * Math.cos(latitude1), Math.cos(radians) - Math.sin(latitude1) * Math.sin(latitude2));
  5386. var lng = radiansToDegrees(longitude2);
  5387. var lat = radiansToDegrees(latitude2);
  5388. return point([lng, lat], options2.properties);
  5389. }
  5390. function bearing(start2, end, options2) {
  5391. if (options2 === void 0) {
  5392. options2 = {};
  5393. }
  5394. if (options2.final === true) {
  5395. return calculateFinalBearing(start2, end);
  5396. }
  5397. var coordinates1 = getCoord(start2);
  5398. var coordinates2 = getCoord(end);
  5399. var lon1 = degreesToRadians(coordinates1[0]);
  5400. var lon2 = degreesToRadians(coordinates2[0]);
  5401. var lat1 = degreesToRadians(coordinates1[1]);
  5402. var lat2 = degreesToRadians(coordinates2[1]);
  5403. var a = Math.sin(lon2 - lon1) * Math.cos(lat2);
  5404. var b = Math.cos(lat1) * Math.sin(lat2) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon2 - lon1);
  5405. return radiansToDegrees(Math.atan2(a, b));
  5406. }
  5407. function calculateFinalBearing(start2, end) {
  5408. var bear = bearing(end, start2);
  5409. bear = (bear + 180) % 360;
  5410. return bear;
  5411. }
  5412. function midpoint(point1, point2) {
  5413. var dist = distance(point1, point2);
  5414. var heading = bearing(point1, point2);
  5415. var midpoint2 = destination(point1, dist / 2, heading);
  5416. return midpoint2;
  5417. }
  5418. function center(geojson, options2) {
  5419. if (options2 === void 0) {
  5420. options2 = {};
  5421. }
  5422. var ext = bbox$1(geojson);
  5423. var x = (ext[0] + ext[2]) / 2;
  5424. var y = (ext[1] + ext[3]) / 2;
  5425. return point([x, y], options2.properties, options2);
  5426. }
  5427. function centroid(geojson, options2) {
  5428. if (options2 === void 0) {
  5429. options2 = {};
  5430. }
  5431. var xSum = 0;
  5432. var ySum = 0;
  5433. var len = 0;
  5434. coordEach(geojson, function(coord) {
  5435. xSum += coord[0];
  5436. ySum += coord[1];
  5437. len++;
  5438. }, true);
  5439. return point([xSum / len, ySum / len], options2.properties);
  5440. }
  5441. function centerOfMass(geojson, options2) {
  5442. if (options2 === void 0) {
  5443. options2 = {};
  5444. }
  5445. switch (getType(geojson)) {
  5446. case "Point":
  5447. return point(getCoord(geojson), options2.properties);
  5448. case "Polygon":
  5449. var coords = [];
  5450. coordEach(geojson, function(coord) {
  5451. coords.push(coord);
  5452. });
  5453. var centre = centroid(geojson, { properties: options2.properties });
  5454. var translation = centre.geometry.coordinates;
  5455. var sx = 0;
  5456. var sy = 0;
  5457. var sArea = 0;
  5458. var i2, pi, pj, xi, xj, yi, yj, a;
  5459. var neutralizedPoints = coords.map(function(point2) {
  5460. return [point2[0] - translation[0], point2[1] - translation[1]];
  5461. });
  5462. for (i2 = 0; i2 < coords.length - 1; i2++) {
  5463. pi = neutralizedPoints[i2];
  5464. xi = pi[0];
  5465. yi = pi[1];
  5466. pj = neutralizedPoints[i2 + 1];
  5467. xj = pj[0];
  5468. yj = pj[1];
  5469. a = xi * yj - xj * yi;
  5470. sArea += a;
  5471. sx += (xi + xj) * a;
  5472. sy += (yi + yj) * a;
  5473. }
  5474. if (sArea === 0) {
  5475. return centre;
  5476. } else {
  5477. var area = sArea * 0.5;
  5478. var areaFactor = 1 / (6 * area);
  5479. return point([translation[0] + areaFactor * sx, translation[1] + areaFactor * sy], options2.properties);
  5480. }
  5481. default:
  5482. var hull = convex(geojson);
  5483. if (hull)
  5484. return centerOfMass(hull, { properties: options2.properties });
  5485. else
  5486. return centroid(geojson, { properties: options2.properties });
  5487. }
  5488. }
  5489. function lineSegment(geojson) {
  5490. if (!geojson) {
  5491. throw new Error("geojson is required");
  5492. }
  5493. var results = [];
  5494. flattenEach(geojson, function(feature2) {
  5495. lineSegmentFeature(feature2, results);
  5496. });
  5497. return featureCollection$1(results);
  5498. }
  5499. function lineSegmentFeature(geojson, results) {
  5500. var coords = [];
  5501. var geometry2 = geojson.geometry;
  5502. if (geometry2 !== null) {
  5503. switch (geometry2.type) {
  5504. case "Polygon":
  5505. coords = getCoords(geometry2);
  5506. break;
  5507. case "LineString":
  5508. coords = [getCoords(geometry2)];
  5509. }
  5510. coords.forEach(function(coord) {
  5511. var segments = createSegments(coord, geojson.properties);
  5512. segments.forEach(function(segment) {
  5513. segment.id = results.length;
  5514. results.push(segment);
  5515. });
  5516. });
  5517. }
  5518. }
  5519. function createSegments(coords, properties) {
  5520. var segments = [];
  5521. coords.reduce(function(previousCoords, currentCoords) {
  5522. var segment = lineString([previousCoords, currentCoords], properties);
  5523. segment.bbox = bbox(previousCoords, currentCoords);
  5524. segments.push(segment);
  5525. return currentCoords;
  5526. });
  5527. return segments;
  5528. }
  5529. function bbox(coords1, coords2) {
  5530. var x1 = coords1[0];
  5531. var y1 = coords1[1];
  5532. var x2 = coords2[0];
  5533. var y2 = coords2[1];
  5534. var west = x1 < x2 ? x1 : x2;
  5535. var south = y1 < y2 ? y1 : y2;
  5536. var east = x1 > x2 ? x1 : x2;
  5537. var north = y1 > y2 ? y1 : y2;
  5538. return [west, south, east, north];
  5539. }
  5540. var geojsonRbush$1 = { exports: {} };
  5541. var rbush_min = { exports: {} };
  5542. (function(module2, exports2) {
  5543. !function(t2, i2) {
  5544. module2.exports = i2();
  5545. }(commonjsGlobal, function() {
  5546. function t2(t3, r3, e2, a2, h3) {
  5547. !function t4(n2, r4, e3, a3, h4) {
  5548. for (; a3 > e3; ) {
  5549. if (a3 - e3 > 600) {
  5550. var o2 = a3 - e3 + 1, s2 = r4 - e3 + 1, l2 = Math.log(o2), f2 = 0.5 * Math.exp(2 * l2 / 3), u2 = 0.5 * Math.sqrt(l2 * f2 * (o2 - f2) / o2) * (s2 - o2 / 2 < 0 ? -1 : 1), m2 = Math.max(e3, Math.floor(r4 - s2 * f2 / o2 + u2)), c2 = Math.min(a3, Math.floor(r4 + (o2 - s2) * f2 / o2 + u2));
  5551. t4(n2, r4, m2, c2, h4);
  5552. }
  5553. var p2 = n2[r4], d3 = e3, x = a3;
  5554. for (i2(n2, e3, r4), h4(n2[a3], p2) > 0 && i2(n2, e3, a3); d3 < x; ) {
  5555. for (i2(n2, d3, x), d3++, x--; h4(n2[d3], p2) < 0; )
  5556. d3++;
  5557. for (; h4(n2[x], p2) > 0; )
  5558. x--;
  5559. }
  5560. 0 === h4(n2[e3], p2) ? i2(n2, e3, x) : i2(n2, ++x, a3), x <= r4 && (e3 = x + 1), r4 <= x && (a3 = x - 1);
  5561. }
  5562. }(t3, r3, e2 || 0, a2 || t3.length - 1, h3 || n);
  5563. }
  5564. function i2(t3, i3, n2) {
  5565. var r3 = t3[i3];
  5566. t3[i3] = t3[n2], t3[n2] = r3;
  5567. }
  5568. function n(t3, i3) {
  5569. return t3 < i3 ? -1 : t3 > i3 ? 1 : 0;
  5570. }
  5571. var r2 = function(t3) {
  5572. void 0 === t3 && (t3 = 9), this._maxEntries = Math.max(4, t3), this._minEntries = Math.max(2, Math.ceil(0.4 * this._maxEntries)), this.clear();
  5573. };
  5574. function e(t3, i3, n2) {
  5575. if (!n2)
  5576. return i3.indexOf(t3);
  5577. for (var r3 = 0; r3 < i3.length; r3++)
  5578. if (n2(t3, i3[r3]))
  5579. return r3;
  5580. return -1;
  5581. }
  5582. function a(t3, i3) {
  5583. h2(t3, 0, t3.children.length, i3, t3);
  5584. }
  5585. function h2(t3, i3, n2, r3, e2) {
  5586. e2 || (e2 = p(null)), e2.minX = 1 / 0, e2.minY = 1 / 0, e2.maxX = -1 / 0, e2.maxY = -1 / 0;
  5587. for (var a2 = i3; a2 < n2; a2++) {
  5588. var h3 = t3.children[a2];
  5589. o(e2, t3.leaf ? r3(h3) : h3);
  5590. }
  5591. return e2;
  5592. }
  5593. function o(t3, i3) {
  5594. return t3.minX = Math.min(t3.minX, i3.minX), t3.minY = Math.min(t3.minY, i3.minY), t3.maxX = Math.max(t3.maxX, i3.maxX), t3.maxY = Math.max(t3.maxY, i3.maxY), t3;
  5595. }
  5596. function s(t3, i3) {
  5597. return t3.minX - i3.minX;
  5598. }
  5599. function l(t3, i3) {
  5600. return t3.minY - i3.minY;
  5601. }
  5602. function f(t3) {
  5603. return (t3.maxX - t3.minX) * (t3.maxY - t3.minY);
  5604. }
  5605. function u(t3) {
  5606. return t3.maxX - t3.minX + (t3.maxY - t3.minY);
  5607. }
  5608. function m(t3, i3) {
  5609. return t3.minX <= i3.minX && t3.minY <= i3.minY && i3.maxX <= t3.maxX && i3.maxY <= t3.maxY;
  5610. }
  5611. function c(t3, i3) {
  5612. return i3.minX <= t3.maxX && i3.minY <= t3.maxY && i3.maxX >= t3.minX && i3.maxY >= t3.minY;
  5613. }
  5614. function p(t3) {
  5615. return { children: t3, height: 1, leaf: true, minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
  5616. }
  5617. function d2(i3, n2, r3, e2, a2) {
  5618. for (var h3 = [n2, r3]; h3.length; )
  5619. if (!((r3 = h3.pop()) - (n2 = h3.pop()) <= e2)) {
  5620. var o2 = n2 + Math.ceil((r3 - n2) / e2 / 2) * e2;
  5621. t2(i3, o2, n2, r3, a2), h3.push(n2, o2, o2, r3);
  5622. }
  5623. }
  5624. return r2.prototype.all = function() {
  5625. return this._all(this.data, []);
  5626. }, r2.prototype.search = function(t3) {
  5627. var i3 = this.data, n2 = [];
  5628. if (!c(t3, i3))
  5629. return n2;
  5630. for (var r3 = this.toBBox, e2 = []; i3; ) {
  5631. for (var a2 = 0; a2 < i3.children.length; a2++) {
  5632. var h3 = i3.children[a2], o2 = i3.leaf ? r3(h3) : h3;
  5633. c(t3, o2) && (i3.leaf ? n2.push(h3) : m(t3, o2) ? this._all(h3, n2) : e2.push(h3));
  5634. }
  5635. i3 = e2.pop();
  5636. }
  5637. return n2;
  5638. }, r2.prototype.collides = function(t3) {
  5639. var i3 = this.data;
  5640. if (!c(t3, i3))
  5641. return false;
  5642. for (var n2 = []; i3; ) {
  5643. for (var r3 = 0; r3 < i3.children.length; r3++) {
  5644. var e2 = i3.children[r3], a2 = i3.leaf ? this.toBBox(e2) : e2;
  5645. if (c(t3, a2)) {
  5646. if (i3.leaf || m(t3, a2))
  5647. return true;
  5648. n2.push(e2);
  5649. }
  5650. }
  5651. i3 = n2.pop();
  5652. }
  5653. return false;
  5654. }, r2.prototype.load = function(t3) {
  5655. if (!t3 || !t3.length)
  5656. return this;
  5657. if (t3.length < this._minEntries) {
  5658. for (var i3 = 0; i3 < t3.length; i3++)
  5659. this.insert(t3[i3]);
  5660. return this;
  5661. }
  5662. var n2 = this._build(t3.slice(), 0, t3.length - 1, 0);
  5663. if (this.data.children.length)
  5664. if (this.data.height === n2.height)
  5665. this._splitRoot(this.data, n2);
  5666. else {
  5667. if (this.data.height < n2.height) {
  5668. var r3 = this.data;
  5669. this.data = n2, n2 = r3;
  5670. }
  5671. this._insert(n2, this.data.height - n2.height - 1, true);
  5672. }
  5673. else
  5674. this.data = n2;
  5675. return this;
  5676. }, r2.prototype.insert = function(t3) {
  5677. return t3 && this._insert(t3, this.data.height - 1), this;
  5678. }, r2.prototype.clear = function() {
  5679. return this.data = p([]), this;
  5680. }, r2.prototype.remove = function(t3, i3) {
  5681. if (!t3)
  5682. return this;
  5683. for (var n2, r3, a2, h3 = this.data, o2 = this.toBBox(t3), s2 = [], l2 = []; h3 || s2.length; ) {
  5684. if (h3 || (h3 = s2.pop(), r3 = s2[s2.length - 1], n2 = l2.pop(), a2 = true), h3.leaf) {
  5685. var f2 = e(t3, h3.children, i3);
  5686. if (-1 !== f2)
  5687. return h3.children.splice(f2, 1), s2.push(h3), this._condense(s2), this;
  5688. }
  5689. a2 || h3.leaf || !m(h3, o2) ? r3 ? (n2++, h3 = r3.children[n2], a2 = false) : h3 = null : (s2.push(h3), l2.push(n2), n2 = 0, r3 = h3, h3 = h3.children[0]);
  5690. }
  5691. return this;
  5692. }, r2.prototype.toBBox = function(t3) {
  5693. return t3;
  5694. }, r2.prototype.compareMinX = function(t3, i3) {
  5695. return t3.minX - i3.minX;
  5696. }, r2.prototype.compareMinY = function(t3, i3) {
  5697. return t3.minY - i3.minY;
  5698. }, r2.prototype.toJSON = function() {
  5699. return this.data;
  5700. }, r2.prototype.fromJSON = function(t3) {
  5701. return this.data = t3, this;
  5702. }, r2.prototype._all = function(t3, i3) {
  5703. for (var n2 = []; t3; )
  5704. t3.leaf ? i3.push.apply(i3, t3.children) : n2.push.apply(n2, t3.children), t3 = n2.pop();
  5705. return i3;
  5706. }, r2.prototype._build = function(t3, i3, n2, r3) {
  5707. var e2, h3 = n2 - i3 + 1, o2 = this._maxEntries;
  5708. if (h3 <= o2)
  5709. return a(e2 = p(t3.slice(i3, n2 + 1)), this.toBBox), e2;
  5710. r3 || (r3 = Math.ceil(Math.log(h3) / Math.log(o2)), o2 = Math.ceil(h3 / Math.pow(o2, r3 - 1))), (e2 = p([])).leaf = false, e2.height = r3;
  5711. var s2 = Math.ceil(h3 / o2), l2 = s2 * Math.ceil(Math.sqrt(o2));
  5712. d2(t3, i3, n2, l2, this.compareMinX);
  5713. for (var f2 = i3; f2 <= n2; f2 += l2) {
  5714. var u2 = Math.min(f2 + l2 - 1, n2);
  5715. d2(t3, f2, u2, s2, this.compareMinY);
  5716. for (var m2 = f2; m2 <= u2; m2 += s2) {
  5717. var c2 = Math.min(m2 + s2 - 1, u2);
  5718. e2.children.push(this._build(t3, m2, c2, r3 - 1));
  5719. }
  5720. }
  5721. return a(e2, this.toBBox), e2;
  5722. }, r2.prototype._chooseSubtree = function(t3, i3, n2, r3) {
  5723. for (; r3.push(i3), !i3.leaf && r3.length - 1 !== n2; ) {
  5724. for (var e2 = 1 / 0, a2 = 1 / 0, h3 = void 0, o2 = 0; o2 < i3.children.length; o2++) {
  5725. var s2 = i3.children[o2], l2 = f(s2), u2 = (m2 = t3, c2 = s2, (Math.max(c2.maxX, m2.maxX) - Math.min(c2.minX, m2.minX)) * (Math.max(c2.maxY, m2.maxY) - Math.min(c2.minY, m2.minY)) - l2);
  5726. u2 < a2 ? (a2 = u2, e2 = l2 < e2 ? l2 : e2, h3 = s2) : u2 === a2 && l2 < e2 && (e2 = l2, h3 = s2);
  5727. }
  5728. i3 = h3 || i3.children[0];
  5729. }
  5730. var m2, c2;
  5731. return i3;
  5732. }, r2.prototype._insert = function(t3, i3, n2) {
  5733. var r3 = n2 ? t3 : this.toBBox(t3), e2 = [], a2 = this._chooseSubtree(r3, this.data, i3, e2);
  5734. for (a2.children.push(t3), o(a2, r3); i3 >= 0 && e2[i3].children.length > this._maxEntries; )
  5735. this._split(e2, i3), i3--;
  5736. this._adjustParentBBoxes(r3, e2, i3);
  5737. }, r2.prototype._split = function(t3, i3) {
  5738. var n2 = t3[i3], r3 = n2.children.length, e2 = this._minEntries;
  5739. this._chooseSplitAxis(n2, e2, r3);
  5740. var h3 = this._chooseSplitIndex(n2, e2, r3), o2 = p(n2.children.splice(h3, n2.children.length - h3));
  5741. o2.height = n2.height, o2.leaf = n2.leaf, a(n2, this.toBBox), a(o2, this.toBBox), i3 ? t3[i3 - 1].children.push(o2) : this._splitRoot(n2, o2);
  5742. }, r2.prototype._splitRoot = function(t3, i3) {
  5743. this.data = p([t3, i3]), this.data.height = t3.height + 1, this.data.leaf = false, a(this.data, this.toBBox);
  5744. }, r2.prototype._chooseSplitIndex = function(t3, i3, n2) {
  5745. for (var r3, e2, a2, o2, s2, l2, u2, m2 = 1 / 0, c2 = 1 / 0, p2 = i3; p2 <= n2 - i3; p2++) {
  5746. var d3 = h2(t3, 0, p2, this.toBBox), x = h2(t3, p2, n2, this.toBBox), v = (e2 = d3, a2 = x, o2 = void 0, s2 = void 0, l2 = void 0, u2 = void 0, o2 = Math.max(e2.minX, a2.minX), s2 = Math.max(e2.minY, a2.minY), l2 = Math.min(e2.maxX, a2.maxX), u2 = Math.min(e2.maxY, a2.maxY), Math.max(0, l2 - o2) * Math.max(0, u2 - s2)), M = f(d3) + f(x);
  5747. v < m2 ? (m2 = v, r3 = p2, c2 = M < c2 ? M : c2) : v === m2 && M < c2 && (c2 = M, r3 = p2);
  5748. }
  5749. return r3 || n2 - i3;
  5750. }, r2.prototype._chooseSplitAxis = function(t3, i3, n2) {
  5751. var r3 = t3.leaf ? this.compareMinX : s, e2 = t3.leaf ? this.compareMinY : l;
  5752. this._allDistMargin(t3, i3, n2, r3) < this._allDistMargin(t3, i3, n2, e2) && t3.children.sort(r3);
  5753. }, r2.prototype._allDistMargin = function(t3, i3, n2, r3) {
  5754. t3.children.sort(r3);
  5755. for (var e2 = this.toBBox, a2 = h2(t3, 0, i3, e2), s2 = h2(t3, n2 - i3, n2, e2), l2 = u(a2) + u(s2), f2 = i3; f2 < n2 - i3; f2++) {
  5756. var m2 = t3.children[f2];
  5757. o(a2, t3.leaf ? e2(m2) : m2), l2 += u(a2);
  5758. }
  5759. for (var c2 = n2 - i3 - 1; c2 >= i3; c2--) {
  5760. var p2 = t3.children[c2];
  5761. o(s2, t3.leaf ? e2(p2) : p2), l2 += u(s2);
  5762. }
  5763. return l2;
  5764. }, r2.prototype._adjustParentBBoxes = function(t3, i3, n2) {
  5765. for (var r3 = n2; r3 >= 0; r3--)
  5766. o(i3[r3], t3);
  5767. }, r2.prototype._condense = function(t3) {
  5768. for (var i3 = t3.length - 1, n2 = void 0; i3 >= 0; i3--)
  5769. 0 === t3[i3].children.length ? i3 > 0 ? (n2 = t3[i3 - 1].children).splice(n2.indexOf(t3[i3]), 1) : this.clear() : a(t3[i3], this.toBBox);
  5770. }, r2;
  5771. });
  5772. })(rbush_min);
  5773. var require$$1$1 = /* @__PURE__ */ getAugmentedNamespace(es$2);
  5774. var require$$2 = /* @__PURE__ */ getAugmentedNamespace(es$1);
  5775. var require$$3 = /* @__PURE__ */ getAugmentedNamespace(es);
  5776. var rbush = rbush_min.exports;
  5777. var helpers = require$$1$1;
  5778. var meta = require$$2;
  5779. var turfBBox = require$$3.default;
  5780. var featureEach = meta.featureEach;
  5781. meta.coordEach;
  5782. helpers.polygon;
  5783. var featureCollection = helpers.featureCollection;
  5784. function geojsonRbush(maxEntries) {
  5785. var tree = new rbush(maxEntries);
  5786. tree.insert = function(feature2) {
  5787. if (feature2.type !== "Feature")
  5788. throw new Error("invalid feature");
  5789. feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
  5790. return rbush.prototype.insert.call(this, feature2);
  5791. };
  5792. tree.load = function(features) {
  5793. var load = [];
  5794. if (Array.isArray(features)) {
  5795. features.forEach(function(feature2) {
  5796. if (feature2.type !== "Feature")
  5797. throw new Error("invalid features");
  5798. feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
  5799. load.push(feature2);
  5800. });
  5801. } else {
  5802. featureEach(features, function(feature2) {
  5803. if (feature2.type !== "Feature")
  5804. throw new Error("invalid features");
  5805. feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
  5806. load.push(feature2);
  5807. });
  5808. }
  5809. return rbush.prototype.load.call(this, load);
  5810. };
  5811. tree.remove = function(feature2, equals) {
  5812. if (feature2.type !== "Feature")
  5813. throw new Error("invalid feature");
  5814. feature2.bbox = feature2.bbox ? feature2.bbox : turfBBox(feature2);
  5815. return rbush.prototype.remove.call(this, feature2, equals);
  5816. };
  5817. tree.clear = function() {
  5818. return rbush.prototype.clear.call(this);
  5819. };
  5820. tree.search = function(geojson) {
  5821. var features = rbush.prototype.search.call(this, this.toBBox(geojson));
  5822. return featureCollection(features);
  5823. };
  5824. tree.collides = function(geojson) {
  5825. return rbush.prototype.collides.call(this, this.toBBox(geojson));
  5826. };
  5827. tree.all = function() {
  5828. var features = rbush.prototype.all.call(this);
  5829. return featureCollection(features);
  5830. };
  5831. tree.toJSON = function() {
  5832. return rbush.prototype.toJSON.call(this);
  5833. };
  5834. tree.fromJSON = function(json) {
  5835. return rbush.prototype.fromJSON.call(this, json);
  5836. };
  5837. tree.toBBox = function(geojson) {
  5838. var bbox2;
  5839. if (geojson.bbox)
  5840. bbox2 = geojson.bbox;
  5841. else if (Array.isArray(geojson) && geojson.length === 4)
  5842. bbox2 = geojson;
  5843. else if (Array.isArray(geojson) && geojson.length === 6)
  5844. bbox2 = [geojson[0], geojson[1], geojson[3], geojson[4]];
  5845. else if (geojson.type === "Feature")
  5846. bbox2 = turfBBox(geojson);
  5847. else if (geojson.type === "FeatureCollection")
  5848. bbox2 = turfBBox(geojson);
  5849. else
  5850. throw new Error("invalid geojson");
  5851. return {
  5852. minX: bbox2[0],
  5853. minY: bbox2[1],
  5854. maxX: bbox2[2],
  5855. maxY: bbox2[3]
  5856. };
  5857. };
  5858. return tree;
  5859. }
  5860. geojsonRbush$1.exports = geojsonRbush;
  5861. geojsonRbush$1.exports.default = geojsonRbush;
  5862. var rbush$1 = geojsonRbush$1.exports;
  5863. function lineIntersect(line1, line2) {
  5864. var unique = {};
  5865. var results = [];
  5866. if (line1.type === "LineString") {
  5867. line1 = feature(line1);
  5868. }
  5869. if (line2.type === "LineString") {
  5870. line2 = feature(line2);
  5871. }
  5872. if (line1.type === "Feature" && line2.type === "Feature" && line1.geometry !== null && line2.geometry !== null && line1.geometry.type === "LineString" && line2.geometry.type === "LineString" && line1.geometry.coordinates.length === 2 && line2.geometry.coordinates.length === 2) {
  5873. var intersect = intersects(line1, line2);
  5874. if (intersect) {
  5875. results.push(intersect);
  5876. }
  5877. return featureCollection$1(results);
  5878. }
  5879. var tree = rbush$1();
  5880. tree.load(lineSegment(line2));
  5881. featureEach$1(lineSegment(line1), function(segment) {
  5882. featureEach$1(tree.search(segment), function(match) {
  5883. var intersect2 = intersects(segment, match);
  5884. if (intersect2) {
  5885. var key = getCoords(intersect2).join(",");
  5886. if (!unique[key]) {
  5887. unique[key] = true;
  5888. results.push(intersect2);
  5889. }
  5890. }
  5891. });
  5892. });
  5893. return featureCollection$1(results);
  5894. }
  5895. function intersects(line1, line2) {
  5896. var coords1 = getCoords(line1);
  5897. var coords2 = getCoords(line2);
  5898. if (coords1.length !== 2) {
  5899. throw new Error("<intersects> line1 must only contain 2 coordinates");
  5900. }
  5901. if (coords2.length !== 2) {
  5902. throw new Error("<intersects> line2 must only contain 2 coordinates");
  5903. }
  5904. var x1 = coords1[0][0];
  5905. var y1 = coords1[0][1];
  5906. var x2 = coords1[1][0];
  5907. var y2 = coords1[1][1];
  5908. var x3 = coords2[0][0];
  5909. var y3 = coords2[0][1];
  5910. var x4 = coords2[1][0];
  5911. var y4 = coords2[1][1];
  5912. var denom = (y4 - y3) * (x2 - x1) - (x4 - x3) * (y2 - y1);
  5913. var numeA = (x4 - x3) * (y1 - y3) - (y4 - y3) * (x1 - x3);
  5914. var numeB = (x2 - x1) * (y1 - y3) - (y2 - y1) * (x1 - x3);
  5915. if (denom === 0) {
  5916. if (numeA === 0 && numeB === 0) {
  5917. return null;
  5918. }
  5919. return null;
  5920. }
  5921. var uA = numeA / denom;
  5922. var uB = numeB / denom;
  5923. if (uA >= 0 && uA <= 1 && uB >= 0 && uB <= 1) {
  5924. var x = x1 + uA * (x2 - x1);
  5925. var y = y1 + uA * (y2 - y1);
  5926. return point([x, y]);
  5927. }
  5928. return null;
  5929. }
  5930. function booleanPointOnLine(pt2, line, options2) {
  5931. if (options2 === void 0) {
  5932. options2 = {};
  5933. }
  5934. var ptCoords = getCoord(pt2);
  5935. var lineCoords = getCoords(line);
  5936. for (var i2 = 0; i2 < lineCoords.length - 1; i2++) {
  5937. var ignoreBoundary = false;
  5938. if (options2.ignoreEndVertices) {
  5939. if (i2 === 0) {
  5940. ignoreBoundary = "start";
  5941. }
  5942. if (i2 === lineCoords.length - 2) {
  5943. ignoreBoundary = "end";
  5944. }
  5945. if (i2 === 0 && i2 + 1 === lineCoords.length - 1) {
  5946. ignoreBoundary = "both";
  5947. }
  5948. }
  5949. if (isPointOnLineSegment$1(lineCoords[i2], lineCoords[i2 + 1], ptCoords, ignoreBoundary, typeof options2.epsilon === "undefined" ? null : options2.epsilon)) {
  5950. return true;
  5951. }
  5952. }
  5953. return false;
  5954. }
  5955. function isPointOnLineSegment$1(lineSegmentStart, lineSegmentEnd, pt2, excludeBoundary, epsilon) {
  5956. var x = pt2[0];
  5957. var y = pt2[1];
  5958. var x1 = lineSegmentStart[0];
  5959. var y1 = lineSegmentStart[1];
  5960. var x2 = lineSegmentEnd[0];
  5961. var y2 = lineSegmentEnd[1];
  5962. var dxc = pt2[0] - x1;
  5963. var dyc = pt2[1] - y1;
  5964. var dxl = x2 - x1;
  5965. var dyl = y2 - y1;
  5966. var cross2 = dxc * dyl - dyc * dxl;
  5967. if (epsilon !== null) {
  5968. if (Math.abs(cross2) > epsilon) {
  5969. return false;
  5970. }
  5971. } else if (cross2 !== 0) {
  5972. return false;
  5973. }
  5974. if (!excludeBoundary) {
  5975. if (Math.abs(dxl) >= Math.abs(dyl)) {
  5976. return dxl > 0 ? x1 <= x && x <= x2 : x2 <= x && x <= x1;
  5977. }
  5978. return dyl > 0 ? y1 <= y && y <= y2 : y2 <= y && y <= y1;
  5979. } else if (excludeBoundary === "start") {
  5980. if (Math.abs(dxl) >= Math.abs(dyl)) {
  5981. return dxl > 0 ? x1 < x && x <= x2 : x2 <= x && x < x1;
  5982. }
  5983. return dyl > 0 ? y1 < y && y <= y2 : y2 <= y && y < y1;
  5984. } else if (excludeBoundary === "end") {
  5985. if (Math.abs(dxl) >= Math.abs(dyl)) {
  5986. return dxl > 0 ? x1 <= x && x < x2 : x2 < x && x <= x1;
  5987. }
  5988. return dyl > 0 ? y1 <= y && y < y2 : y2 < y && y <= y1;
  5989. } else if (excludeBoundary === "both") {
  5990. if (Math.abs(dxl) >= Math.abs(dyl)) {
  5991. return dxl > 0 ? x1 < x && x < x2 : x2 < x && x < x1;
  5992. }
  5993. return dyl > 0 ? y1 < y && y < y2 : y2 < y && y < y1;
  5994. }
  5995. return false;
  5996. }
  5997. function booleanWithin(feature1, feature2) {
  5998. var geom1 = getGeom(feature1);
  5999. var geom2 = getGeom(feature2);
  6000. var type1 = geom1.type;
  6001. var type2 = geom2.type;
  6002. switch (type1) {
  6003. case "Point":
  6004. switch (type2) {
  6005. case "MultiPoint":
  6006. return isPointInMultiPoint(geom1, geom2);
  6007. case "LineString":
  6008. return booleanPointOnLine(geom1, geom2, { ignoreEndVertices: true });
  6009. case "Polygon":
  6010. case "MultiPolygon":
  6011. return booleanPointInPolygon(geom1, geom2, { ignoreBoundary: true });
  6012. default:
  6013. throw new Error("feature2 " + type2 + " geometry not supported");
  6014. }
  6015. case "MultiPoint":
  6016. switch (type2) {
  6017. case "MultiPoint":
  6018. return isMultiPointInMultiPoint(geom1, geom2);
  6019. case "LineString":
  6020. return isMultiPointOnLine(geom1, geom2);
  6021. case "Polygon":
  6022. case "MultiPolygon":
  6023. return isMultiPointInPoly(geom1, geom2);
  6024. default:
  6025. throw new Error("feature2 " + type2 + " geometry not supported");
  6026. }
  6027. case "LineString":
  6028. switch (type2) {
  6029. case "LineString":
  6030. return isLineOnLine$1(geom1, geom2);
  6031. case "Polygon":
  6032. case "MultiPolygon":
  6033. return isLineInPoly$1(geom1, geom2);
  6034. default:
  6035. throw new Error("feature2 " + type2 + " geometry not supported");
  6036. }
  6037. case "Polygon":
  6038. switch (type2) {
  6039. case "Polygon":
  6040. case "MultiPolygon":
  6041. return isPolyInPoly$1(geom1, geom2);
  6042. default:
  6043. throw new Error("feature2 " + type2 + " geometry not supported");
  6044. }
  6045. default:
  6046. throw new Error("feature1 " + type1 + " geometry not supported");
  6047. }
  6048. }
  6049. function isPointInMultiPoint(point2, multiPoint2) {
  6050. var i2;
  6051. var output = false;
  6052. for (i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {
  6053. if (compareCoords$1(multiPoint2.coordinates[i2], point2.coordinates)) {
  6054. output = true;
  6055. break;
  6056. }
  6057. }
  6058. return output;
  6059. }
  6060. function isMultiPointInMultiPoint(multiPoint1, multiPoint2) {
  6061. for (var i2 = 0; i2 < multiPoint1.coordinates.length; i2++) {
  6062. var anyMatch = false;
  6063. for (var i22 = 0; i22 < multiPoint2.coordinates.length; i22++) {
  6064. if (compareCoords$1(multiPoint1.coordinates[i2], multiPoint2.coordinates[i22])) {
  6065. anyMatch = true;
  6066. }
  6067. }
  6068. if (!anyMatch) {
  6069. return false;
  6070. }
  6071. }
  6072. return true;
  6073. }
  6074. function isMultiPointOnLine(multiPoint2, lineString2) {
  6075. var foundInsidePoint = false;
  6076. for (var i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {
  6077. if (!booleanPointOnLine(multiPoint2.coordinates[i2], lineString2)) {
  6078. return false;
  6079. }
  6080. if (!foundInsidePoint) {
  6081. foundInsidePoint = booleanPointOnLine(multiPoint2.coordinates[i2], lineString2, { ignoreEndVertices: true });
  6082. }
  6083. }
  6084. return foundInsidePoint;
  6085. }
  6086. function isMultiPointInPoly(multiPoint2, polygon2) {
  6087. var output = true;
  6088. var isInside = false;
  6089. for (var i2 = 0; i2 < multiPoint2.coordinates.length; i2++) {
  6090. isInside = booleanPointInPolygon(multiPoint2.coordinates[1], polygon2);
  6091. if (!isInside) {
  6092. output = false;
  6093. break;
  6094. }
  6095. {
  6096. isInside = booleanPointInPolygon(multiPoint2.coordinates[1], polygon2, {
  6097. ignoreBoundary: true
  6098. });
  6099. }
  6100. }
  6101. return output && isInside;
  6102. }
  6103. function isLineOnLine$1(lineString1, lineString2) {
  6104. for (var i2 = 0; i2 < lineString1.coordinates.length; i2++) {
  6105. if (!booleanPointOnLine(lineString1.coordinates[i2], lineString2)) {
  6106. return false;
  6107. }
  6108. }
  6109. return true;
  6110. }
  6111. function isLineInPoly$1(linestring, polygon2) {
  6112. var polyBbox = bbox$1(polygon2);
  6113. var lineBbox = bbox$1(linestring);
  6114. if (!doBBoxOverlap(polyBbox, lineBbox)) {
  6115. return false;
  6116. }
  6117. var foundInsidePoint = false;
  6118. for (var i2 = 0; i2 < linestring.coordinates.length - 1; i2++) {
  6119. if (!booleanPointInPolygon(linestring.coordinates[i2], polygon2)) {
  6120. return false;
  6121. }
  6122. if (!foundInsidePoint) {
  6123. foundInsidePoint = booleanPointInPolygon(linestring.coordinates[i2], polygon2, { ignoreBoundary: true });
  6124. }
  6125. if (!foundInsidePoint) {
  6126. var midpoint2 = getMidpoint(linestring.coordinates[i2], linestring.coordinates[i2 + 1]);
  6127. foundInsidePoint = booleanPointInPolygon(midpoint2, polygon2, {
  6128. ignoreBoundary: true
  6129. });
  6130. }
  6131. }
  6132. return foundInsidePoint;
  6133. }
  6134. function isPolyInPoly$1(geometry1, geometry2) {
  6135. var poly1Bbox = bbox$1(geometry1);
  6136. var poly2Bbox = bbox$1(geometry2);
  6137. if (!doBBoxOverlap(poly2Bbox, poly1Bbox)) {
  6138. return false;
  6139. }
  6140. for (var i2 = 0; i2 < geometry1.coordinates[0].length; i2++) {
  6141. if (!booleanPointInPolygon(geometry1.coordinates[0][i2], geometry2)) {
  6142. return false;
  6143. }
  6144. }
  6145. return true;
  6146. }
  6147. function doBBoxOverlap(bbox1, bbox2) {
  6148. if (bbox1[0] > bbox2[0])
  6149. return false;
  6150. if (bbox1[2] < bbox2[2])
  6151. return false;
  6152. if (bbox1[1] > bbox2[1])
  6153. return false;
  6154. if (bbox1[3] < bbox2[3])
  6155. return false;
  6156. return true;
  6157. }
  6158. function compareCoords$1(pair1, pair2) {
  6159. return pair1[0] === pair2[0] && pair1[1] === pair2[1];
  6160. }
  6161. function getMidpoint(pair1, pair2) {
  6162. return [(pair1[0] + pair2[0]) / 2, (pair1[1] + pair2[1]) / 2];
  6163. }
  6164. function pointGrid(bbox2, cellSide, options2) {
  6165. if (options2 === void 0) {
  6166. options2 = {};
  6167. }
  6168. if (options2.mask && !options2.units)
  6169. options2.units = "kilometers";
  6170. var results = [];
  6171. var west = bbox2[0];
  6172. var south = bbox2[1];
  6173. var east = bbox2[2];
  6174. var north = bbox2[3];
  6175. var xFraction = cellSide / distance([west, south], [east, south], options2);
  6176. var cellWidth = xFraction * (east - west);
  6177. var yFraction = cellSide / distance([west, south], [west, north], options2);
  6178. var cellHeight = yFraction * (north - south);
  6179. var bboxWidth = east - west;
  6180. var bboxHeight = north - south;
  6181. var columns = Math.floor(bboxWidth / cellWidth);
  6182. var rows = Math.floor(bboxHeight / cellHeight);
  6183. var deltaX = (bboxWidth - columns * cellWidth) / 2;
  6184. var deltaY = (bboxHeight - rows * cellHeight) / 2;
  6185. var currentX = west + deltaX;
  6186. while (currentX <= east) {
  6187. var currentY = south + deltaY;
  6188. while (currentY <= north) {
  6189. var cellPt = point([currentX, currentY], options2.properties);
  6190. if (options2.mask) {
  6191. if (booleanWithin(cellPt, options2.mask))
  6192. results.push(cellPt);
  6193. } else {
  6194. results.push(cellPt);
  6195. }
  6196. currentY += cellHeight;
  6197. }
  6198. currentX += cellWidth;
  6199. }
  6200. return featureCollection$1(results);
  6201. }
  6202. function polygonToLine(poly, options2) {
  6203. if (options2 === void 0) {
  6204. options2 = {};
  6205. }
  6206. var geom = getGeom(poly);
  6207. if (!options2.properties && poly.type === "Feature") {
  6208. options2.properties = poly.properties;
  6209. }
  6210. switch (geom.type) {
  6211. case "Polygon":
  6212. return polygonToLine$1(geom, options2);
  6213. case "MultiPolygon":
  6214. return multiPolygonToLine(geom, options2);
  6215. default:
  6216. throw new Error("invalid poly");
  6217. }
  6218. }
  6219. function polygonToLine$1(poly, options2) {
  6220. if (options2 === void 0) {
  6221. options2 = {};
  6222. }
  6223. var geom = getGeom(poly);
  6224. var coords = geom.coordinates;
  6225. var properties = options2.properties ? options2.properties : poly.type === "Feature" ? poly.properties : {};
  6226. return coordsToLine(coords, properties);
  6227. }
  6228. function multiPolygonToLine(multiPoly, options2) {
  6229. if (options2 === void 0) {
  6230. options2 = {};
  6231. }
  6232. var geom = getGeom(multiPoly);
  6233. var coords = geom.coordinates;
  6234. var properties = options2.properties ? options2.properties : multiPoly.type === "Feature" ? multiPoly.properties : {};
  6235. var lines = [];
  6236. coords.forEach(function(coord) {
  6237. lines.push(coordsToLine(coord, properties));
  6238. });
  6239. return featureCollection$1(lines);
  6240. }
  6241. function coordsToLine(coords, properties) {
  6242. if (coords.length > 1) {
  6243. return multiLineString(coords, properties);
  6244. }
  6245. return lineString(coords[0], properties);
  6246. }
  6247. function booleanClockwise(line) {
  6248. var ring = getCoords(line);
  6249. var sum = 0;
  6250. var i2 = 1;
  6251. var prev;
  6252. var cur;
  6253. while (i2 < ring.length) {
  6254. prev = cur || ring[0];
  6255. cur = ring[i2];
  6256. sum += (cur[0] - prev[0]) * (cur[1] + prev[1]);
  6257. i2++;
  6258. }
  6259. return sum > 0;
  6260. }
  6261. function booleanDisjoint(feature1, feature2) {
  6262. var bool = true;
  6263. flattenEach(feature1, function(flatten1) {
  6264. flattenEach(feature2, function(flatten22) {
  6265. if (bool === false) {
  6266. return false;
  6267. }
  6268. bool = disjoint(flatten1.geometry, flatten22.geometry);
  6269. });
  6270. });
  6271. return bool;
  6272. }
  6273. function disjoint(geom1, geom2) {
  6274. switch (geom1.type) {
  6275. case "Point":
  6276. switch (geom2.type) {
  6277. case "Point":
  6278. return !compareCoords(geom1.coordinates, geom2.coordinates);
  6279. case "LineString":
  6280. return !isPointOnLine(geom2, geom1);
  6281. case "Polygon":
  6282. return !booleanPointInPolygon(geom1, geom2);
  6283. }
  6284. break;
  6285. case "LineString":
  6286. switch (geom2.type) {
  6287. case "Point":
  6288. return !isPointOnLine(geom1, geom2);
  6289. case "LineString":
  6290. return !isLineOnLine(geom1, geom2);
  6291. case "Polygon":
  6292. return !isLineInPoly(geom2, geom1);
  6293. }
  6294. break;
  6295. case "Polygon":
  6296. switch (geom2.type) {
  6297. case "Point":
  6298. return !booleanPointInPolygon(geom2, geom1);
  6299. case "LineString":
  6300. return !isLineInPoly(geom1, geom2);
  6301. case "Polygon":
  6302. return !isPolyInPoly(geom2, geom1);
  6303. }
  6304. }
  6305. return false;
  6306. }
  6307. function isPointOnLine(lineString2, pt2) {
  6308. for (var i2 = 0; i2 < lineString2.coordinates.length - 1; i2++) {
  6309. if (isPointOnLineSegment(lineString2.coordinates[i2], lineString2.coordinates[i2 + 1], pt2.coordinates)) {
  6310. return true;
  6311. }
  6312. }
  6313. return false;
  6314. }
  6315. function isLineOnLine(lineString1, lineString2) {
  6316. var doLinesIntersect = lineIntersect(lineString1, lineString2);
  6317. if (doLinesIntersect.features.length > 0) {
  6318. return true;
  6319. }
  6320. return false;
  6321. }
  6322. function isLineInPoly(polygon2, lineString2) {
  6323. for (var _i = 0, _a2 = lineString2.coordinates; _i < _a2.length; _i++) {
  6324. var coord = _a2[_i];
  6325. if (booleanPointInPolygon(coord, polygon2)) {
  6326. return true;
  6327. }
  6328. }
  6329. var doLinesIntersect = lineIntersect(lineString2, polygonToLine(polygon2));
  6330. if (doLinesIntersect.features.length > 0) {
  6331. return true;
  6332. }
  6333. return false;
  6334. }
  6335. function isPolyInPoly(feature1, feature2) {
  6336. for (var _i = 0, _a2 = feature1.coordinates[0]; _i < _a2.length; _i++) {
  6337. var coord1 = _a2[_i];
  6338. if (booleanPointInPolygon(coord1, feature2)) {
  6339. return true;
  6340. }
  6341. }
  6342. for (var _b = 0, _c = feature2.coordinates[0]; _b < _c.length; _b++) {
  6343. var coord2 = _c[_b];
  6344. if (booleanPointInPolygon(coord2, feature1)) {
  6345. return true;
  6346. }
  6347. }
  6348. var doLinesIntersect = lineIntersect(polygonToLine(feature1), polygonToLine(feature2));
  6349. if (doLinesIntersect.features.length > 0) {
  6350. return true;
  6351. }
  6352. return false;
  6353. }
  6354. function isPointOnLineSegment(lineSegmentStart, lineSegmentEnd, pt2) {
  6355. var dxc = pt2[0] - lineSegmentStart[0];
  6356. var dyc = pt2[1] - lineSegmentStart[1];
  6357. var dxl = lineSegmentEnd[0] - lineSegmentStart[0];
  6358. var dyl = lineSegmentEnd[1] - lineSegmentStart[1];
  6359. var cross2 = dxc * dyl - dyc * dxl;
  6360. if (cross2 !== 0) {
  6361. return false;
  6362. }
  6363. if (Math.abs(dxl) >= Math.abs(dyl)) {
  6364. if (dxl > 0) {
  6365. return lineSegmentStart[0] <= pt2[0] && pt2[0] <= lineSegmentEnd[0];
  6366. } else {
  6367. return lineSegmentEnd[0] <= pt2[0] && pt2[0] <= lineSegmentStart[0];
  6368. }
  6369. } else if (dyl > 0) {
  6370. return lineSegmentStart[1] <= pt2[1] && pt2[1] <= lineSegmentEnd[1];
  6371. } else {
  6372. return lineSegmentEnd[1] <= pt2[1] && pt2[1] <= lineSegmentStart[1];
  6373. }
  6374. }
  6375. function compareCoords(pair1, pair2) {
  6376. return pair1[0] === pair2[0] && pair1[1] === pair2[1];
  6377. }
  6378. function booleanIntersects(feature1, feature2) {
  6379. var bool = false;
  6380. flattenEach(feature1, function(flatten1) {
  6381. flattenEach(feature2, function(flatten22) {
  6382. if (bool === true) {
  6383. return true;
  6384. }
  6385. bool = !booleanDisjoint(flatten1.geometry, flatten22.geometry);
  6386. });
  6387. });
  6388. return bool;
  6389. }
  6390. function rectangleGrid(bbox2, cellWidth, cellHeight, options2) {
  6391. if (options2 === void 0) {
  6392. options2 = {};
  6393. }
  6394. var results = [];
  6395. var west = bbox2[0];
  6396. var south = bbox2[1];
  6397. var east = bbox2[2];
  6398. var north = bbox2[3];
  6399. var xFraction = cellWidth / distance([west, south], [east, south], options2);
  6400. var cellWidthDeg = xFraction * (east - west);
  6401. var yFraction = cellHeight / distance([west, south], [west, north], options2);
  6402. var cellHeightDeg = yFraction * (north - south);
  6403. var bboxWidth = east - west;
  6404. var bboxHeight = north - south;
  6405. var columns = Math.floor(bboxWidth / cellWidthDeg);
  6406. var rows = Math.floor(bboxHeight / cellHeightDeg);
  6407. var deltaX = (bboxWidth - columns * cellWidthDeg) / 2;
  6408. var deltaY = (bboxHeight - rows * cellHeightDeg) / 2;
  6409. var currentX = west + deltaX;
  6410. for (var column = 0; column < columns; column++) {
  6411. var currentY = south + deltaY;
  6412. for (var row = 0; row < rows; row++) {
  6413. var cellPoly = polygon([
  6414. [
  6415. [currentX, currentY],
  6416. [currentX, currentY + cellHeightDeg],
  6417. [currentX + cellWidthDeg, currentY + cellHeightDeg],
  6418. [currentX + cellWidthDeg, currentY],
  6419. [currentX, currentY]
  6420. ]
  6421. ], options2.properties);
  6422. if (options2.mask) {
  6423. if (booleanIntersects(options2.mask, cellPoly)) {
  6424. results.push(cellPoly);
  6425. }
  6426. } else {
  6427. results.push(cellPoly);
  6428. }
  6429. currentY += cellHeightDeg;
  6430. }
  6431. currentX += cellWidthDeg;
  6432. }
  6433. return featureCollection$1(results);
  6434. }
  6435. function squareGrid(bbox2, cellSide, options2) {
  6436. if (options2 === void 0) {
  6437. options2 = {};
  6438. }
  6439. return rectangleGrid(bbox2, cellSide, cellSide, options2);
  6440. }
  6441. class ViewShed {
  6442. constructor(viewer2) {
  6443. if (!viewer2)
  6444. throw new Cesium.DeveloperError("no viewer object!");
  6445. this.viewer = viewer2;
  6446. this.handler = void 0;
  6447. this.lightCamera;
  6448. this.pyramid;
  6449. this.frustumPrimitive;
  6450. this.viewershedPolygon;
  6451. }
  6452. initHandler() {
  6453. if (this.handler) {
  6454. this.handler.destroy();
  6455. this.handler = void 0;
  6456. }
  6457. let canvas = document.getElementById("canvasMap");
  6458. if (canvas == null) {
  6459. canvas = document.createElement("canvas");
  6460. canvas.id = "canvasMap";
  6461. canvas.style.display = "none";
  6462. canvas.style.top = "0px";
  6463. canvas.style.position = "absolute";
  6464. document.body.append(canvas);
  6465. }
  6466. this.canvasEle = canvas;
  6467. }
  6468. ReturnDistance(pos0, pos1) {
  6469. let point1cartographic = Cesium.Cartographic.fromCartesian(pos0);
  6470. let point2cartographic = Cesium.Cartographic.fromCartesian(pos1);
  6471. let geodesic = new Cesium.EllipsoidGeodesic();
  6472. geodesic.setEndPoints(point1cartographic, point2cartographic);
  6473. let s = geodesic.surfaceDistance;
  6474. return s;
  6475. }
  6476. getHeight(x, y, objectsToExclude) {
  6477. let endCartographic = Cesium.Cartographic.fromDegrees(x, y);
  6478. let endHeight = this.viewer.scene.sampleHeight(
  6479. endCartographic,
  6480. objectsToExclude
  6481. );
  6482. return endHeight;
  6483. }
  6484. cartesian3ToDegree(Cartesian32) {
  6485. let _ellipsoid = this.viewer.scene.globe.ellipsoid;
  6486. let _cartographic = _ellipsoid.cartesianToCartographic(Cartesian32);
  6487. let _lat = Cesium.Math.toDegrees(_cartographic.latitude);
  6488. let _lng = Cesium.Math.toDegrees(_cartographic.longitude);
  6489. let _alt = _cartographic.height;
  6490. return [_lng, _lat, _alt];
  6491. }
  6492. getAngle(lng1, lat1, lng2, lat2) {
  6493. let dRotateAngle = Math.atan2(Math.abs(lng1 - lng2), Math.abs(lat1 - lat2));
  6494. if (lng2 >= lng1) {
  6495. dRotateAngle = lat2 < lat1 ? Math.PI - dRotateAngle : dRotateAngle;
  6496. } else {
  6497. dRotateAngle = lat2 >= lat1 ? 2 * Math.PI - dRotateAngle : Math.PI + dRotateAngle;
  6498. }
  6499. dRotateAngle = dRotateAngle * 180 / Math.PI;
  6500. return dRotateAngle;
  6501. }
  6502. getPitch(pointA, pointB) {
  6503. let transfrom = Cesium.Transforms.eastNorthUpToFixedFrame(pointA);
  6504. const vector = Cesium.Cartesian3.subtract(
  6505. pointB,
  6506. pointA,
  6507. new Cesium.Cartesian3()
  6508. );
  6509. let direction = Cesium.Matrix4.multiplyByPointAsVector(
  6510. Cesium.Matrix4.inverse(transfrom, transfrom),
  6511. vector,
  6512. vector
  6513. );
  6514. Cesium.Cartesian3.normalize(direction, direction);
  6515. return Cesium.Math.PI_OVER_TWO - Cesium.Math.acosClamped(direction.z);
  6516. }
  6517. updateViewShed() {
  6518. this.clear();
  6519. this.setLightCamera();
  6520. this.addVisualPyramid();
  6521. this.createFrustum();
  6522. }
  6523. clear() {
  6524. if (this.pyramid) {
  6525. this.viewer.entities.removeById(this.pyramid.id);
  6526. this.pyramid = void 0;
  6527. }
  6528. if (this.frustumPrimitive) {
  6529. this.viewer.scene.primitives.remove(this.frustumPrimitive);
  6530. this.frustumPrimitive = void 0;
  6531. }
  6532. if (this.debugModelMatrixPrimitive) {
  6533. this.viewer.scene.primitives.remove(this.debugModelMatrixPrimitive);
  6534. this.debugModelMatrixPrimitive = void 0;
  6535. }
  6536. }
  6537. addVisualPyramid() {
  6538. let options2 = this.ViewShedOptions;
  6539. let position2 = options2.viewPosition;
  6540. let visualRange = Number(options2.visualRange);
  6541. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(position2);
  6542. this.debugModelMatrixPrimitive = this.viewer.scene.primitives.add(
  6543. new Cesium.DebugModelMatrixPrimitive({
  6544. modelMatrix: transform3,
  6545. length: 5
  6546. })
  6547. );
  6548. const halfClock = options2.horizontalViewAngle / 2;
  6549. const halfCone = options2.verticalViewAngle / 2;
  6550. const pitch = Cesium.Math.toDegrees(options2.pitch);
  6551. const ellipsoid = new Cesium.EllipsoidGraphics({
  6552. radii: new Cesium.Cartesian3(visualRange, visualRange, visualRange),
  6553. minimumClock: Cesium.Math.toRadians(90 - options2.direction - halfClock),
  6554. maximumClock: Cesium.Math.toRadians(90 - options2.direction + halfClock),
  6555. minimumCone: Cesium.Math.toRadians(90 - pitch - halfCone),
  6556. maximumCone: Cesium.Math.toRadians(90 - pitch + halfCone),
  6557. fill: false,
  6558. outline: true,
  6559. subdivisions: 256,
  6560. stackPartitions: 64,
  6561. slicePartitions: 64,
  6562. outlineColor: Cesium.Color.YELLOWGREEN.withAlpha(0.5)
  6563. });
  6564. const pyramidEntity = new Cesium.Entity({
  6565. position: position2,
  6566. ellipsoid
  6567. });
  6568. this.pyramid = this.viewer.entities.add(pyramidEntity);
  6569. }
  6570. setLightCamera() {
  6571. if (!this.lightCamera) {
  6572. this.lightCamera = new Cesium.Camera(this.viewer.scene);
  6573. }
  6574. let options2 = this.ViewShedOptions;
  6575. let visualRange = Number(options2.visualRange);
  6576. this.lightCamera.position = options2.viewPosition;
  6577. this.lightCamera.frustum.near = 0.1;
  6578. this.lightCamera.frustum.far = visualRange;
  6579. const hr = Cesium.Math.toRadians(options2.horizontalViewAngle);
  6580. const vr = Cesium.Math.toRadians(options2.verticalViewAngle);
  6581. this.lightCamera.frustum.aspectRatio = visualRange * Math.tan(hr / 2) * 2 / (visualRange * Math.tan(vr / 2) * 2);
  6582. this.lightCamera.frustum.fov = hr > vr ? hr : vr;
  6583. this.lightCamera.setView({
  6584. destination: options2.viewPosition,
  6585. orientation: {
  6586. heading: Cesium.Math.toRadians(options2.direction || 0),
  6587. pitch: options2.pitch || 0,
  6588. roll: 0
  6589. }
  6590. });
  6591. }
  6592. createFrustum() {
  6593. const scratchRight = new Cesium.Cartesian3();
  6594. const scratchRotation = new Cesium.Matrix3();
  6595. const scratchOrientation = new Cesium.Quaternion();
  6596. const direction = this.lightCamera.directionWC;
  6597. const up = this.lightCamera.upWC;
  6598. let right = this.lightCamera.rightWC;
  6599. right = Cesium.Cartesian3.negate(right, scratchRight);
  6600. let rotation = scratchRotation;
  6601. Cesium.Matrix3.setColumn(rotation, 0, right, rotation);
  6602. Cesium.Matrix3.setColumn(rotation, 1, up, rotation);
  6603. Cesium.Matrix3.setColumn(rotation, 2, direction, rotation);
  6604. let orientation = Cesium.Quaternion.fromRotationMatrix(
  6605. rotation,
  6606. scratchOrientation
  6607. );
  6608. let instanceOutline = new Cesium.GeometryInstance({
  6609. geometry: new Cesium.FrustumOutlineGeometry({
  6610. frustum: this.lightCamera.frustum,
  6611. origin: this.ViewShedOptions.viewPosition,
  6612. orientation
  6613. }),
  6614. id: "\u89C6\u690E\u4F53\u8F6E\u5ED3\u7EBF" + Math.random().toString(36).substr(2),
  6615. attributes: {
  6616. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  6617. new Cesium.Color(0, 1, 0, 1)
  6618. ),
  6619. show: new Cesium.ShowGeometryInstanceAttribute(true)
  6620. }
  6621. });
  6622. this.frustumPrimitive = this.viewer.scene.primitives.add(
  6623. new Cesium.Primitive({
  6624. geometryInstances: instanceOutline,
  6625. appearance: new Cesium.PerInstanceColorAppearance({
  6626. flat: true,
  6627. translucent: false,
  6628. closed: true
  6629. })
  6630. })
  6631. );
  6632. }
  6633. addViewershedPolygon(positionArr) {
  6634. let polygon2 = new Cesium.PolygonGeometry({
  6635. polygonHierarchy: new Cesium.PolygonHierarchy(
  6636. Cesium.Cartesian3.fromDegreesArray(positionArr)
  6637. ),
  6638. height: 0,
  6639. extrudedHeight: 0,
  6640. vertexFormat: Cesium.PerInstanceColorAppearance.VERTEX_FORMAT,
  6641. stRotation: 0,
  6642. ellipsoid: Cesium.Ellipsoid.WGS84,
  6643. granularity: Cesium.Math.RADIANS_PER_DEGREE,
  6644. perPositionHeight: false,
  6645. closeTop: true,
  6646. closeBottom: true,
  6647. arcType: Cesium.ArcType.GEODESIC
  6648. });
  6649. let polygonInstance = new Cesium.GeometryInstance({
  6650. geometry: polygon2,
  6651. name: "ViewershedPolygon",
  6652. attributes: {
  6653. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  6654. Cesium.Color.BLUE.withAlpha(0.6)
  6655. ),
  6656. show: new Cesium.ShowGeometryInstanceAttribute(true)
  6657. }
  6658. });
  6659. this.viewershedPolygon = this.viewer.scene.primitives.add(
  6660. new Cesium.GroundPrimitive({
  6661. geometryInstances: polygonInstance,
  6662. appearance: new Cesium.EllipsoidSurfaceAppearance({
  6663. aboveGround: true,
  6664. material: new Cesium.Material({
  6665. fabric: {
  6666. type: "Image",
  6667. uniforms: {
  6668. image: this.returnImgae()
  6669. }
  6670. }
  6671. })
  6672. })
  6673. })
  6674. );
  6675. }
  6676. drawViewershed(precision) {
  6677. const pos = this.cartesian3ToDegree(this.ViewShedOptions.viewPosition);
  6678. const radius = this.ViewShedOptions.visualRange;
  6679. const direction = this.ViewShedOptions.direction;
  6680. let boundary = this.computeBoundaryOptions(pos, radius, direction);
  6681. const bbox2 = boundary.bbox;
  6682. let mask = polygon([boundary.boundaryPoints]);
  6683. const dis = this.ViewShedOptions.visualRange / (precision * 1e3);
  6684. let gridPoints = pointGrid(bbox2, dis, {
  6685. mask
  6686. });
  6687. console.log(this.ViewShedOptions.visualRange, precision, dis);
  6688. let pointsResult = this.createTargetPoints(gridPoints, dis, pos);
  6689. let variogram = index.train(
  6690. pointsResult.values,
  6691. pointsResult.lngs,
  6692. pointsResult.lats,
  6693. "exponential",
  6694. 0,
  6695. 100
  6696. );
  6697. let grid2 = index.grid([boundary.boundaryPoints], variogram, dis / 1e3);
  6698. const colors = [
  6699. "#ff000080",
  6700. "#ff000080",
  6701. "#ff000080",
  6702. "#ff000080",
  6703. "#ff000080",
  6704. "#ff000080",
  6705. "#00ff0080",
  6706. "#00ff0080",
  6707. "#00ff0080",
  6708. "#00ff0080",
  6709. "#00ff0080",
  6710. "#00ff0080"
  6711. ];
  6712. this.canvasEle.width = 3840;
  6713. this.canvasEle.height = 2160;
  6714. index.plot(
  6715. this.canvasEle,
  6716. grid2,
  6717. [bbox2[0], bbox2[2]],
  6718. [bbox2[1], bbox2[3]],
  6719. colors
  6720. );
  6721. this.addViewershedPolygon(boundary.positionArr);
  6722. }
  6723. computeBoundaryOptions(pos, radius, angle) {
  6724. let Ea = 6378137;
  6725. let Eb = 6356725;
  6726. const lng = pos[0], lat = pos[1];
  6727. const bbox2 = [lng, lat, lng, lat];
  6728. let positionArr = [];
  6729. let boundaryPoints = [];
  6730. positionArr.push(lng, lat);
  6731. boundaryPoints.push([lng, lat]);
  6732. let start2 = angle + 45 > 360 ? angle - 45 - 360 : angle - 45;
  6733. let end = start2 + 90;
  6734. for (let i2 = start2; i2 <= end; i2++) {
  6735. let dx = radius * Math.sin(i2 * Math.PI / 180);
  6736. let dy = radius * Math.cos(i2 * Math.PI / 180);
  6737. let ec = Eb + (Ea - Eb) * (90 - lat) / 90;
  6738. let ed = ec * Math.cos(lat * Math.PI / 180);
  6739. let BJD = lng + dx / ed * 180 / Math.PI;
  6740. let BWD = lat + dy / ec * 180 / Math.PI;
  6741. positionArr.push(BJD, BWD);
  6742. boundaryPoints.push([BJD, BWD]);
  6743. this.refreshBBox(bbox2, BJD, BWD);
  6744. }
  6745. boundaryPoints.push([lng, lat]);
  6746. return {
  6747. positionArr,
  6748. boundaryPoints,
  6749. bbox: bbox2
  6750. };
  6751. }
  6752. refreshBBox(result, x, y) {
  6753. result[0] = x < result[0] ? x : result[0];
  6754. result[1] = y < result[1] ? y : result[1];
  6755. result[2] = x > result[2] ? x : result[2];
  6756. result[3] = y > result[3] ? y : result[3];
  6757. }
  6758. createTargetPoints(gridPoints, step, sourcePos) {
  6759. let positionArr = [];
  6760. let objectsToExclude = [
  6761. this.frustumPrimitive,
  6762. this.pyramid,
  6763. this.debugModelMatrixPrimitive
  6764. ];
  6765. let values3 = [], lngs = [], lats = [];
  6766. let height2 = this.getHeight(sourcePos[0], sourcePos[1], objectsToExclude);
  6767. positionArr.push({
  6768. x: sourcePos[0],
  6769. y: sourcePos[1],
  6770. z: height2
  6771. });
  6772. let viewPoint = this.ViewShedOptions.viewPosition;
  6773. for (let index2 = 0; index2 < gridPoints.features.length; index2++) {
  6774. const feature2 = gridPoints.features[index2];
  6775. const coords = feature2.geometry.coordinates;
  6776. const x = coords[0], y = coords[1];
  6777. let h2 = this.getHeight(x, y, objectsToExclude);
  6778. let endPoint = Cesium.Cartesian3.fromDegrees(x, y, h2);
  6779. let direction = Cesium.Cartesian3.normalize(
  6780. Cesium.Cartesian3.subtract(
  6781. endPoint,
  6782. viewPoint,
  6783. new Cesium.Cartesian3()
  6784. ),
  6785. new Cesium.Cartesian3()
  6786. );
  6787. let ray = new Cesium.Ray(viewPoint, direction);
  6788. let result = this.viewer.scene.pickFromRay(ray, objectsToExclude);
  6789. if (result) {
  6790. let buffer = this.ReturnDistance(endPoint, result.position);
  6791. if (buffer > step) {
  6792. values3.push(0);
  6793. } else {
  6794. values3.push(1);
  6795. }
  6796. lngs.push(x);
  6797. lats.push(y);
  6798. }
  6799. }
  6800. return {
  6801. values: values3,
  6802. lngs,
  6803. lats
  6804. };
  6805. }
  6806. returnImgae() {
  6807. return this.canvasEle.toDataURL("image/png");
  6808. }
  6809. }
  6810. Object.assign(ViewShed.prototype, {
  6811. createViewshed: function(precision) {
  6812. let _self = this;
  6813. let scene = _self.viewer.scene;
  6814. _self.initHandler();
  6815. _self.clearAll();
  6816. let count = 0;
  6817. let toolTip = "\u5DE6\u952E\u70B9\u51FB\u521B\u5EFA\u8D77\u70B9";
  6818. _self.handler = new Cesium.ScreenSpaceEventHandler(_self.viewer.canvas);
  6819. _self.handler.setInputAction((event2) => {
  6820. count++;
  6821. if (count === 1) {
  6822. toolTip = "\u5DE6\u952E\u70B9\u51FB\u521B\u5EFA\u7EC8\u70B9";
  6823. let earthPosition = scene.pickPosition(event2.position);
  6824. let pos = _self.cartesian3ToDegree(earthPosition);
  6825. _self.handler.setInputAction(function(move) {
  6826. CreateRemindertip(toolTip, move.endPosition, true);
  6827. let newPosition = scene.pickPosition(move.endPosition);
  6828. if (Cesium.defined(newPosition)) {
  6829. let pos1 = _self.cartesian3ToDegree(newPosition);
  6830. let distance2 = Cesium.Cartesian3.distance(newPosition, earthPosition);
  6831. let angle = _self.getAngle(pos[0], pos[1], pos1[0], pos1[1]);
  6832. let pitch = _self.getPitch(earthPosition, newPosition);
  6833. _self.ViewShedOptions = {
  6834. viewPosition: earthPosition,
  6835. endPosition: newPosition,
  6836. direction: angle,
  6837. pitch,
  6838. horizontalViewAngle: 90,
  6839. verticalViewAngle: 60,
  6840. visibleAreaColor: Cesium.Color.GREEN,
  6841. invisibleAreaColor: Cesium.Color.RED,
  6842. visualRange: distance2
  6843. };
  6844. _self.updateViewShed();
  6845. }
  6846. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  6847. }
  6848. if (count === 2) {
  6849. _self.initHandler();
  6850. _self.drawViewershed(precision);
  6851. CreateRemindertip(toolTip, event2.endPosition, false);
  6852. }
  6853. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  6854. _self.handler.setInputAction(function(move) {
  6855. CreateRemindertip(toolTip, move.endPosition, true);
  6856. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  6857. },
  6858. clearAll: function() {
  6859. this.clear();
  6860. if (this.viewershedPolygon) {
  6861. this.viewer.scene.primitives.remove(this.viewershedPolygon);
  6862. this.viewershedPolygon = void 0;
  6863. }
  6864. }
  6865. });
  6866. class SunshineShadow {
  6867. constructor(viewer2) {
  6868. if (!viewer2)
  6869. throw new Cesium.DeveloperError("no viewer object!");
  6870. this._viewer = viewer2;
  6871. this._stopTime = null;
  6872. }
  6873. }
  6874. Object.assign(SunshineShadow.prototype, {
  6875. startSunShine(options2) {
  6876. options2 = options2 || {};
  6877. if (!Cesium.defined(options2.startTime)) {
  6878. options2.startTime = new Date().getTime();
  6879. }
  6880. if (!Cesium.defined(options2.stopTime)) {
  6881. options2.stopTime = new Date().getTime() + 1e3;
  6882. }
  6883. if (!Cesium.defined(options2.speed)) {
  6884. options2.speed = 1600;
  6885. }
  6886. if (this._stopTime) {
  6887. this._viewer.clock.shouldAnimate = true;
  6888. this._viewer.clock.currentTime = this._stopTime;
  6889. } else {
  6890. this._viewer.scene.globe.enableLighting = true;
  6891. this._viewer.shadows = true;
  6892. this._viewer.clock.startTime = Cesium.JulianDate.fromDate(new Date(options2.startTime));
  6893. this._viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(options2.startTime));
  6894. this._viewer.clock.stopTime = Cesium.JulianDate.fromDate(new Date(options2.stopTime));
  6895. console.log(this._viewer.clock.currentTime);
  6896. this._viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
  6897. this._viewer.clock.clockStep = Cesium.ClockStep.SYSTEM_CLOCK_MULTIPLIER;
  6898. this._viewer.clock.multiplier = options2.speed;
  6899. this._viewer.clock.canAnimate = true;
  6900. this._viewer.clock.shouldAnimate = true;
  6901. }
  6902. },
  6903. stopSunShine() {
  6904. this._stopTime = this._viewer.clock.currentTime;
  6905. console.log(this._viewer.clock.currentTime);
  6906. this._viewer.clock.shouldAnimate = false;
  6907. },
  6908. removeSunShine() {
  6909. if (this._stopTime) {
  6910. this._viewer.clock.shouldAnimate = true;
  6911. this._viewer.clock.currentTime = this._stopTime;
  6912. console.log(this._viewer.clock.currentTime);
  6913. }
  6914. this._viewer.scene.globe.enableLighting = false;
  6915. this._viewer.shadows = false;
  6916. this._stopTime = null;
  6917. }
  6918. });
  6919. Object.assign(SunshineShadow.prototype, {
  6920. start(options2) {
  6921. if (document.getElementsByClassName("cesium-viewer-animationContainer").length > 0) {
  6922. document.getElementsByClassName("cesium-viewer-animationContainer")[0].style.display = "block";
  6923. }
  6924. if (document.getElementsByClassName("cesium-viewer-timelineContainer").length > 0) {
  6925. document.getElementsByClassName("cesium-viewer-timelineContainer")[0].style.display = "block";
  6926. }
  6927. this._viewer.shadows = true;
  6928. options2 = options2 || {};
  6929. if (!Cesium.defined(options2.startTime)) {
  6930. options2.startTime = new Date(new Date().toLocaleDateString()).getTime();
  6931. console.log("\u5F53\u5929\u51CC\u66680\u70B9", new Date(new Date().toLocaleDateString()));
  6932. }
  6933. if (!Cesium.defined(options2.stopTime)) {
  6934. options2.stopTime = new Date(new Date().toLocaleDateString()).getTime() + 24 * 60 * 60 * 1e3 - 1;
  6935. console.log("\u5F53\u592923\u70B959\u520659\u79D2", new Date(new Date(new Date().toLocaleDateString()).getTime() + 4 * 60 * 60 * 1e3));
  6936. }
  6937. if (!Cesium.defined(options2.speed)) {
  6938. options2.speed = 1600;
  6939. }
  6940. let start2 = Cesium.JulianDate.fromDate(new Date(options2.startTime));
  6941. let stop = Cesium.JulianDate.fromDate(new Date(options2.stopTime));
  6942. viewer.timeline.zoomTo(start2, stop);
  6943. let clock2 = viewer.clock;
  6944. clock2.shouldAnimate = false;
  6945. clock2.startTime = start2;
  6946. clock2.stopTime = stop;
  6947. clock2.currentTime = start2;
  6948. clock2.clockRange = Cesium.ClockRange.UNBOUNDED;
  6949. clock2.multiplier = options2.speed;
  6950. },
  6951. remove() {
  6952. if (document.getElementsByClassName("cesium-viewer-animationContainer").length > 0) {
  6953. document.getElementsByClassName("cesium-viewer-animationContainer")[0].style.display = "none";
  6954. }
  6955. if (document.getElementsByClassName("cesium-viewer-timelineContainer").length > 0) {
  6956. document.getElementsByClassName("cesium-viewer-timelineContainer")[0].style.display = "none";
  6957. }
  6958. this._viewer.shadows = false;
  6959. this._viewer.clock.currentTime = Cesium.JulianDate.fromDate(new Date(new Date().getTime()));
  6960. this._viewer.clock.shouldAnimate = false;
  6961. }
  6962. });
  6963. class Profile {
  6964. constructor(viewer2) {
  6965. if (!viewer2)
  6966. throw new Cesium.DeveloperError("no viewer object!");
  6967. this._viewer = viewer2;
  6968. this._profileEntities = [];
  6969. }
  6970. _interPoints(positions, objectsToExclude) {
  6971. let positionsCartographic = [];
  6972. let terrainSamplePositions = [];
  6973. for (let index2 = 0; index2 < positions.length; index2++) {
  6974. const element = positions[index2];
  6975. let ellipsoid = this._viewer.scene.globe.ellipsoid;
  6976. let cartographic = ellipsoid.cartesianToCartographic(element);
  6977. positionsCartographic.push(cartographic);
  6978. }
  6979. for (let i2 = 0; i2 < positionsCartographic.length; i2++) {
  6980. const m_Cartographic0 = positionsCartographic[i2];
  6981. const m_Cartographic1 = positionsCartographic[i2 + 1];
  6982. if (m_Cartographic1) {
  6983. let a = Math.abs(m_Cartographic0.longitude - m_Cartographic1.longitude) * 1e7;
  6984. let b = Math.abs(m_Cartographic0.latitude - m_Cartographic1.latitude) * 1e7;
  6985. if (a > b)
  6986. b = a;
  6987. let length = parseInt(b / 2);
  6988. if (length > 1e3)
  6989. length = 1e3;
  6990. if (length < 2)
  6991. length = 2;
  6992. for (let j = 0; j < length; j++) {
  6993. terrainSamplePositions.push(
  6994. new Cesium.Cartographic(
  6995. Cesium.Math.lerp(
  6996. m_Cartographic0.longitude,
  6997. m_Cartographic1.longitude,
  6998. j / (length - 1)
  6999. ),
  7000. Cesium.Math.lerp(
  7001. m_Cartographic0.latitude,
  7002. m_Cartographic1.latitude,
  7003. j / (length - 1)
  7004. )
  7005. )
  7006. );
  7007. }
  7008. terrainSamplePositions.pop();
  7009. } else {
  7010. terrainSamplePositions.push(m_Cartographic0);
  7011. }
  7012. }
  7013. let positions_Inter = [];
  7014. let distance2 = 0;
  7015. for (let n = 0; n < terrainSamplePositions.length; n++) {
  7016. let curCartographic = terrainSamplePositions[n];
  7017. let height2 = this._viewer.scene.sampleHeight(curCartographic, objectsToExclude);
  7018. const lon = curCartographic.longitude / Math.PI * 180;
  7019. const lat = curCartographic.latitude / Math.PI * 180;
  7020. let point2 = Cesium.Cartesian3.fromDegrees(lon, lat, height2);
  7021. let preCartographic = terrainSamplePositions[n - 1];
  7022. if (preCartographic) {
  7023. const lon1 = preCartographic.longitude / Math.PI * 180;
  7024. const lat1 = preCartographic.latitude / Math.PI * 180;
  7025. let point1 = Cesium.Cartesian3.fromDegrees(lon1, lat1, height2);
  7026. let curDis = Cesium.Cartesian3.distance(point1, point2);
  7027. distance2 += curDis;
  7028. }
  7029. positions_Inter.push({
  7030. position: {
  7031. lon,
  7032. lat,
  7033. height: height2
  7034. },
  7035. distance: distance2
  7036. });
  7037. }
  7038. return positions_Inter;
  7039. }
  7040. }
  7041. Object.assign(Profile.prototype, {
  7042. startProfileAnalysis(points2, entity) {
  7043. return new Promise((resolve2, reject2) => {
  7044. let _self = this;
  7045. let positions = points2.map((point2) => {
  7046. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  7047. });
  7048. _self.removeProfileAnalysis();
  7049. entity.clampToGround = true;
  7050. console.log(positions);
  7051. let pointsList = _self._interPoints(positions, [entity]);
  7052. console.log(pointsList);
  7053. resolve2(pointsList);
  7054. });
  7055. },
  7056. removeProfileAnalysis() {
  7057. let _self = this;
  7058. if (_self._profileEntities && _self._profileEntities.length > 0) {
  7059. _self._profileEntities.forEach((element) => {
  7060. _self._viewer.entities.remove(element);
  7061. });
  7062. }
  7063. _self._profileEntities = [];
  7064. }
  7065. });
  7066. class CutFill {
  7067. constructor(viewer2) {
  7068. if (!viewer2)
  7069. throw new Cesium.DeveloperError("no viewer object!");
  7070. this._viewer = viewer2;
  7071. this.delEntitys = [];
  7072. this.maxHeigh = -1e6;
  7073. }
  7074. _VolumeAnalysis(options2) {
  7075. let _self = this;
  7076. let cutArea = 0, cutVolume = 0, fillArea = 0, fillVolume = 0;
  7077. const indices = options2.geom.indices;
  7078. const positions = options2.geom.attributes.position.values;
  7079. for (let index2 = 0; index2 < indices.length; index2 += 3) {
  7080. const pos0 = _self._returnPosition(positions, indices[index2]);
  7081. const pos1 = _self._returnPosition(positions, indices[index2 + 1]);
  7082. const pos2 = _self._returnPosition(positions, indices[index2 + 2]);
  7083. let _entities = _self._viewer.entities.add({
  7084. name: "\u4E09\u89D2\u9762",
  7085. polygon: {
  7086. hierarchy: [pos0.heightPos, pos1.heightPos, pos2.heightPos],
  7087. perPositionHeight: true,
  7088. material: Cesium.Color.fromRandom(),
  7089. extrudedHeight: options2.height,
  7090. outline: true,
  7091. outlineColor: Cesium.Color.BLACK
  7092. }
  7093. });
  7094. _self.delEntitys.push(_entities);
  7095. const area = _self._computeArea4Triangle(
  7096. pos0.noHeightPos,
  7097. pos1.noHeightPos,
  7098. pos2.noHeightPos
  7099. );
  7100. const height2 = (pos0.height + pos1.height + pos2.height) / 3;
  7101. if (height2 < options2.height) {
  7102. fillArea += area;
  7103. const volume = area * (options2.height - height2);
  7104. fillVolume += volume;
  7105. } else {
  7106. cutArea += area;
  7107. const volume = area * (height2 - options2.height);
  7108. cutVolume += volume;
  7109. }
  7110. }
  7111. let allArea = cutArea + fillArea;
  7112. allArea = allArea.toFixed(2);
  7113. cutArea = cutArea.toFixed(2);
  7114. cutVolume = cutVolume.toFixed(2);
  7115. fillArea = fillArea.toFixed(2);
  7116. fillVolume = fillVolume.toFixed(2);
  7117. let result = {
  7118. allArea,
  7119. cutArea,
  7120. cutVolume,
  7121. fillArea,
  7122. fillVolume
  7123. };
  7124. return result;
  7125. }
  7126. _computeArea4Triangle(pos1, pos2, pos3) {
  7127. let a = Cesium.Cartesian3.distance(pos1, pos2);
  7128. let b = Cesium.Cartesian3.distance(pos2, pos3);
  7129. let c = Cesium.Cartesian3.distance(pos3, pos1);
  7130. let S = (a + b + c) / 2;
  7131. return Math.sqrt(S * (S - a) * (S - b) * (S - c));
  7132. }
  7133. _returnPosition(positions, index2) {
  7134. let cartesian = new Cesium.Cartesian3(
  7135. positions[index2 * 3],
  7136. positions[index2 * 3 + 1],
  7137. positions[index2 * 3 + 2]
  7138. );
  7139. let cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  7140. let height2 = this._viewer.scene.sampleHeightSupported ? this._viewer.scene.sampleHeight(cartographic) : this._viewer.scene.globe.getHeight(cartographic);
  7141. if (height2 > this.maxHeigh) {
  7142. this.maxHeigh = height2;
  7143. }
  7144. return {
  7145. heightPos: Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, height2),
  7146. noHeightPos: Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, 0),
  7147. height: height2
  7148. };
  7149. }
  7150. }
  7151. Object.assign(CutFill.prototype, {
  7152. createPolygonGeo(points2, options2) {
  7153. return new Promise((resolve2, reject2) => {
  7154. let _self = this;
  7155. options2 = options2 || {};
  7156. options2.precision = Cesium.defaultValue(options2.precision, 256);
  7157. options2.height = Cesium.defaultValue(options2.height, 10);
  7158. _self.remove();
  7159. let positions = [];
  7160. for (let i2 = 0; i2 < points2.length; i2++) {
  7161. if (points2[i2] instanceof Cesium.Cartesian3) {
  7162. positions.push(points2[i2]);
  7163. } else {
  7164. positions.push(Cesium.Cartesian3.fromDegrees(points2[i2][0], points2[i2][1], points2[i2][1] || 0));
  7165. }
  7166. }
  7167. let granularity = Math.PI / Math.pow(2, 11);
  7168. granularity = granularity / options2.precision;
  7169. let polygonGeometry = new Cesium.PolygonGeometry.fromPositions({
  7170. positions,
  7171. vertexFormat: Cesium.PerInstanceColorAppearance.FLAT_VERTEX_FORMAT,
  7172. granularity
  7173. });
  7174. options2.geom = new Cesium.PolygonGeometry.createGeometry(polygonGeometry);
  7175. let result = _self._VolumeAnalysis(options2);
  7176. _self._viewer.scene.globe.baseColor = new Cesium.Color(1, 1, 1, 0.9);
  7177. _self._viewer.scene.screenSpaceCameraController.enableCollisionDetection = false;
  7178. _self._viewer.scene.globe.translucency.enabled = true;
  7179. resolve2(result);
  7180. });
  7181. },
  7182. remove() {
  7183. for (var i2 = 0; i2 < this.delEntitys.length; i2++) {
  7184. this._viewer.entities.remove(this.delEntitys[i2]);
  7185. }
  7186. this._viewer.scene.screenSpaceCameraController.enableCollisionDetection = true;
  7187. this._viewer.scene.globe.translucency.enabled = false;
  7188. }
  7189. });
  7190. class HeightLimit {
  7191. constructor(viewer2) {
  7192. if (!viewer2)
  7193. throw new Cesium.DeveloperError("no viewer object!");
  7194. this._viewer = viewer2;
  7195. this.targetY = 0;
  7196. }
  7197. _setPolygon(options2) {
  7198. let _self = this;
  7199. _self.HiePolygon = _self._viewer.entities.add({
  7200. polygon: {
  7201. hierarchy: new Cesium.PolygonHierarchy(_self.data),
  7202. material: _self._handleColor("#FFF8DC", options2.alpha),
  7203. height: new Cesium.CallbackProperty(_self._createPolygonUpdateFunction(), false),
  7204. perPositionHeight: false,
  7205. outline: true,
  7206. outlineColor: _self._handleColor("red", options2.alpha),
  7207. outlineWidth: 1
  7208. }
  7209. });
  7210. }
  7211. _createPolygonUpdateFunction() {
  7212. let _self = this;
  7213. return function() {
  7214. return _self.targetY;
  7215. };
  7216. }
  7217. _handleColor(color2, alpha) {
  7218. return Cesium.Color.fromCssColorString(color2).withAlpha(alpha || 1);
  7219. }
  7220. _getMinHeight(points2) {
  7221. let height2 = 0;
  7222. points2.map((point2) => {
  7223. let _height = point2[2] || 0;
  7224. height2 = _height;
  7225. if (_height < height2) {
  7226. height2 = _height;
  7227. }
  7228. });
  7229. return height2;
  7230. }
  7231. }
  7232. Object.assign(HeightLimit.prototype, {
  7233. addPrimitive(points2, options2) {
  7234. this.removePrimitive();
  7235. options2 = options2 || {};
  7236. options2.height = Cesium.defaultValue(options2.height, 50);
  7237. options2.baseHeight = Cesium.defaultValue(options2.baseHeight, 50);
  7238. options2.color = Cesium.defaultValue(options2.color, "red");
  7239. options2.alpha = Cesium.defaultValue(options2.alpha, 0.6);
  7240. let positions = points2.map((point2) => {
  7241. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  7242. });
  7243. let _self = this;
  7244. _self.data = positions;
  7245. _self.baseHeight = options2.baseHeight;
  7246. _self.targetY = options2.baseHeight + options2.height;
  7247. let polygonInstance = new Cesium.GeometryInstance({
  7248. geometry: new Cesium.PolygonGeometry({
  7249. polygonHierarchy: new Cesium.PolygonHierarchy(_self.data),
  7250. height: _self.baseHeight,
  7251. extrudedHeight: _self.baseHeight + 3e3
  7252. }),
  7253. attributes: {
  7254. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  7255. Cesium.Color.fromCssColorString(options2.color).withAlpha(options2.alpha)
  7256. ),
  7257. show: new Cesium.ShowGeometryInstanceAttribute(true)
  7258. }
  7259. });
  7260. _self.limitHeightPrimitive = _self._viewer.scene.primitives.add(
  7261. new Cesium.ClassificationPrimitive({
  7262. geometryInstances: polygonInstance,
  7263. releaseGeometryInstances: false,
  7264. classificationType: Cesium.ClassificationType.CESIUM_3D_TILE
  7265. })
  7266. );
  7267. _self._setPolygon(options2);
  7268. },
  7269. removePrimitive() {
  7270. if (this.HiePolygon) {
  7271. this._viewer.entities.remove(this.HiePolygon);
  7272. }
  7273. if (this.limitHeightPrimitive) {
  7274. this._viewer.scene.primitives.remove(this.limitHeightPrimitive);
  7275. }
  7276. },
  7277. changeHeight(height2) {
  7278. if (!this.limitHeightPrimitive)
  7279. return;
  7280. this.targetY = this.baseHeight + height2;
  7281. let cartographic = Cesium.Cartographic.fromCartesian(this.limitHeightPrimitive._primitive._boundingSpheres[0].center);
  7282. let surface = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, this.baseHeight);
  7283. let offset = Cesium.Cartesian3.fromRadians(cartographic.longitude, cartographic.latitude, this.baseHeight + height2);
  7284. let translation = Cesium.Cartesian3.subtract(offset, surface, new Cesium.Cartesian3());
  7285. this.limitHeightPrimitive._primitive.modelMatrix = Cesium.Matrix4.fromTranslation(translation);
  7286. }
  7287. });
  7288. class Cutting {
  7289. constructor(viewer2) {
  7290. if (!viewer2)
  7291. throw new Cesium.DeveloperError("no viewer object!");
  7292. this._viewer = viewer2;
  7293. this._camera = this._viewer.camera;
  7294. this._scene = this._viewer.scene;
  7295. this.targetY = 0;
  7296. this._mouseHandler();
  7297. }
  7298. _mouseHandler() {
  7299. let _self = this;
  7300. let viewer2 = _self._viewer;
  7301. let scene = _self._scene;
  7302. let selectedPlane;
  7303. let downHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  7304. downHandler.setInputAction(function(movement) {
  7305. let pickedObject = scene.pick(movement.position);
  7306. if (Cesium.defined(pickedObject) && Cesium.defined(pickedObject.id) && Cesium.defined(pickedObject.id.plane)) {
  7307. selectedPlane = pickedObject.id.plane;
  7308. selectedPlane.material = Cesium.Color.RED.withAlpha(0.05);
  7309. selectedPlane.outlineColor = Cesium.Color.RED;
  7310. scene.screenSpaceCameraController.enableInputs = false;
  7311. }
  7312. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  7313. let upHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  7314. upHandler.setInputAction(function() {
  7315. if (Cesium.defined(selectedPlane)) {
  7316. selectedPlane.material = Cesium.Color.RED.withAlpha(0.1);
  7317. selectedPlane.outlineColor = Cesium.Color.RED;
  7318. selectedPlane = void 0;
  7319. }
  7320. scene.screenSpaceCameraController.enableInputs = true;
  7321. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  7322. let moveHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  7323. moveHandler.setInputAction(function(movement) {
  7324. if (Cesium.defined(selectedPlane)) {
  7325. let deltaY = movement.startPosition.y - movement.endPosition.y;
  7326. _self.targetY += deltaY;
  7327. }
  7328. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  7329. }
  7330. _createPlaneUpdateFunction(plane) {
  7331. let _self = this;
  7332. return function() {
  7333. plane.distance = _self.targetY;
  7334. return plane;
  7335. };
  7336. }
  7337. _createPlane(p1, p2, inverseTransform) {
  7338. let _self = this;
  7339. let p1C3 = _self._getOriginCoordinateSystemPoint(p1, inverseTransform);
  7340. let p2C3 = _self._getOriginCoordinateSystemPoint(p2, inverseTransform);
  7341. let up = new Cesium.Cartesian3(0, 0, 10);
  7342. let right = Cesium.Cartesian3.subtract(p2C3, p1C3, new Cesium.Cartesian3());
  7343. let normal = Cesium.Cartesian3.cross(right, up, new Cesium.Cartesian3());
  7344. normal = Cesium.Cartesian3.normalize(normal, normal);
  7345. let planeTmp = Cesium.Plane.fromPointNormal(p1C3, normal);
  7346. return Cesium.ClippingPlane.fromPlane(planeTmp);
  7347. }
  7348. _getOriginCoordinateSystemPoint(point2, inverseTransform) {
  7349. let val = Cesium.Cartesian3.fromDegrees(point2[0], point2[1]);
  7350. return Cesium.Matrix4.multiplyByPoint(
  7351. inverseTransform,
  7352. val,
  7353. new Cesium.Cartesian3(0, 0, 0)
  7354. );
  7355. }
  7356. _getInverseTransform(tileSet) {
  7357. let transform3;
  7358. const tmp = tileSet.root.transform;
  7359. if (tmp && tmp.equals(Cesium.Matrix4.IDENTITY) || !tmp) {
  7360. transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(tileSet.boundingSphere.center);
  7361. } else {
  7362. transform3 = Cesium.Matrix4.fromArray(tileSet.root.transform);
  7363. }
  7364. return Cesium.Matrix4.inverseTransformation(transform3, new Cesium.Matrix4());
  7365. }
  7366. _isDirRes(polygon2, isClockwise) {
  7367. var lineStringList = [];
  7368. polygon2.forEach((p) => {
  7369. lineStringList.push([p.lng, p.lat]);
  7370. });
  7371. var clockwiseRing = lineString(lineStringList);
  7372. let isR = booleanClockwise(clockwiseRing);
  7373. var points2 = [];
  7374. if (isClockwise) {
  7375. if (!isR) {
  7376. points2 = polygon2;
  7377. } else {
  7378. var count = 0;
  7379. for (var ii = polygon2.length - 1; ii >= 0; ii--) {
  7380. points2[count] = polygon2[ii];
  7381. count++;
  7382. }
  7383. }
  7384. } else {
  7385. if (isR) {
  7386. points2 = polygon2;
  7387. } else {
  7388. var count = 0;
  7389. for (var ii = polygon2.length - 1; ii >= 0; ii--) {
  7390. points2[count] = polygon2[ii];
  7391. count++;
  7392. }
  7393. }
  7394. }
  7395. return points2;
  7396. }
  7397. }
  7398. Object.assign(Cutting.prototype, {
  7399. activate(tileset) {
  7400. let _self = this;
  7401. let viewer2 = _self._viewer;
  7402. let inverseTransform = _self._getInverseTransform(tileset);
  7403. const clippingPlanes1 = [];
  7404. clippingPlanes1.push(_self._createPlane([121.55814450142213, 37.39658788787028], [121.65814450142213, 37.49658788787028], inverseTransform));
  7405. let clippingPlanes = new Cesium.ClippingPlaneCollection({
  7406. planes: [
  7407. new Cesium.ClippingPlane(
  7408. new Cesium.Cartesian3(0, 1, 0),
  7409. -10
  7410. )
  7411. ],
  7412. edgeWidth: 1
  7413. });
  7414. _self.tileset = tileset;
  7415. tileset.clippingPlanes = clippingPlanes;
  7416. tileset.debugShowBoundingVolume = false;
  7417. return tileset.readyPromise.then(function() {
  7418. let boundingSphere = tileset.boundingSphere;
  7419. let radius = boundingSphere.radius;
  7420. viewer2.zoomTo(
  7421. tileset,
  7422. new Cesium.HeadingPitchRange(0.5, -0.2, radius / 5)
  7423. );
  7424. if (!Cesium.Matrix4.equals(
  7425. tileset.root.transform,
  7426. Cesium.Matrix4.IDENTITY
  7427. )) {
  7428. const transformCenter = Cesium.Matrix4.getTranslation(tileset.root.transform, new Cesium.Cartesian3());
  7429. const transformCartographic = Cesium.Cartographic.fromCartesian(transformCenter);
  7430. const boundingSphereCartographic = Cesium.Cartographic.fromCartesian(tileset.boundingSphere.center);
  7431. const height2 = boundingSphereCartographic.height - transformCartographic.height;
  7432. clippingPlanes.modelMatrix = Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0, 0, height2));
  7433. }
  7434. for (let i2 = 0; i2 < clippingPlanes.length; ++i2) {
  7435. const plane = clippingPlanes.get(i2);
  7436. viewer2.entities.add({
  7437. position: boundingSphere.center,
  7438. plane: {
  7439. dimensions: new Cesium.Cartesian2(
  7440. radius / 10,
  7441. radius / 10
  7442. ),
  7443. material: Cesium.Color.WHITE.withAlpha(0.1),
  7444. plane: new Cesium.CallbackProperty(
  7445. _self._createPlaneUpdateFunction(plane),
  7446. false
  7447. ),
  7448. outline: true,
  7449. outlineColor: Cesium.Color.WHITE
  7450. }
  7451. });
  7452. }
  7453. return tileset;
  7454. });
  7455. },
  7456. addTiles(my3dtiles, pointsArray) {
  7457. let _self = this;
  7458. let viewer2 = _self._viewer;
  7459. let tileset = my3dtiles;
  7460. _self.polygon = pointsArray;
  7461. _self.tileset = tileset;
  7462. return tileset.readyPromise.then(function() {
  7463. let inverseTransform = _self._getInverseTransform(tileset);
  7464. _self.polygon = _self._isDirRes(_self.polygon, false);
  7465. const clippingPlanes1 = [];
  7466. for (let i2 = 0; i2 < _self.polygon.length; i2++) {
  7467. if (i2 === _self.polygon.length - 1) {
  7468. clippingPlanes1.push(_self._createPlane(_self.polygon[i2], _self.polygon[0], inverseTransform));
  7469. } else {
  7470. clippingPlanes1.push(_self._createPlane(_self.polygon[i2], _self.polygon[i2 + 1], inverseTransform));
  7471. }
  7472. }
  7473. let clippingPlanes = new Cesium.ClippingPlaneCollection({
  7474. planes: clippingPlanes1,
  7475. edgeWidth: 1,
  7476. edgeColor: Cesium.Color.RED,
  7477. unionClippingRegions: false
  7478. });
  7479. _self.clippingPlanes = clippingPlanes;
  7480. tileset.clippingPlanes = clippingPlanes;
  7481. tileset.debugShowBoundingVolume = false;
  7482. let boundingSphere = tileset.boundingSphere;
  7483. let radius = boundingSphere.radius;
  7484. for (let i2 = 0; i2 < clippingPlanes.length; ++i2) {
  7485. let plane = clippingPlanes.get(i2);
  7486. viewer2.entities.add({
  7487. position: boundingSphere.center,
  7488. plane: {
  7489. dimensions: new Cesium.Cartesian2(
  7490. radius / 10,
  7491. radius / 10
  7492. ),
  7493. material: Cesium.Color.RED.withAlpha(0.1),
  7494. plane: new Cesium.CallbackProperty(
  7495. _self._createPlaneUpdateFunction(plane),
  7496. false
  7497. ),
  7498. outline: true,
  7499. outlineColor: Cesium.Color.RED
  7500. }
  7501. });
  7502. }
  7503. return tileset;
  7504. });
  7505. },
  7506. addTiles2(my3dtiles, pointsArray) {
  7507. let _self = this;
  7508. _self._viewer;
  7509. let tileset = my3dtiles;
  7510. _self.polygon = pointsArray;
  7511. _self.tileset = tileset;
  7512. Cesium.Matrix4.fromArray(
  7513. [
  7514. 1,
  7515. 5551115123125783e-31,
  7516. 5898416033378595e-24,
  7517. 0,
  7518. -6106226635438361e-31,
  7519. 1,
  7520. -11355608731111744e-24,
  7521. 0,
  7522. -5898416061134171e-24,
  7523. 11355608731111744e-24,
  7524. 0.9999999999999999,
  7525. 0,
  7526. 9.912469893228263,
  7527. -19.08345020748675,
  7528. -14.613607150502503,
  7529. 1
  7530. ]
  7531. );
  7532. let transform3 = Cesium.Matrix4.fromArray(
  7533. [
  7534. -0.8874246461620654,
  7535. -0.46095281470464317,
  7536. 0,
  7537. 0,
  7538. 0.2602796082288922,
  7539. -0.5010893346724129,
  7540. 0.8253266045740758,
  7541. 0,
  7542. -0.3804366214290463,
  7543. 0.7324151700322881,
  7544. 0.5646556435405804,
  7545. 0,
  7546. -2429070591483741e-9,
  7547. 467643767731705e-8,
  7548. 3581165448379543e-9,
  7549. 1
  7550. ]
  7551. );
  7552. let inverseTransform = Cesium.Matrix4.inverseTransformation(transform3, new Cesium.Matrix4());
  7553. let clippingPlanes1 = [];
  7554. for (let i2 = 0; i2 < _self.polygon.length - 1; i2++) {
  7555. let plane = _self.createPlane(_self.polygon[i2], _self.polygon[i2 + 1], inverseTransform);
  7556. clippingPlanes1.push(plane);
  7557. }
  7558. let clippingPlanes = new Cesium.ClippingPlaneCollection({
  7559. planes: clippingPlanes1,
  7560. edgeWidth: 1,
  7561. edgeColor: Cesium.Color.RED,
  7562. unionClippingRegions: false
  7563. });
  7564. _self.clippingPlanes = clippingPlanes;
  7565. return tileset.readyPromise.then(function() {
  7566. tileset.clippingPlanes = clippingPlanes;
  7567. tileset.debugShowBoundingVolume = false;
  7568. let boundingSphere = tileset.boundingSphere;
  7569. boundingSphere.radius;
  7570. return tileset;
  7571. });
  7572. },
  7573. toggleClipping() {
  7574. let _self = this;
  7575. _self.tileset = null;
  7576. }
  7577. });
  7578. class GeologyClipPlan {
  7579. constructor(viewer2) {
  7580. if (!viewer2)
  7581. throw new Cesium.DeveloperError("no viewer object!");
  7582. this._viewer = viewer2;
  7583. this._camera = this._viewer.camera;
  7584. this._scene = this._viewer.scene;
  7585. this.tileset = void 0;
  7586. this.targetY = 0;
  7587. this.planeEntities = [];
  7588. this._mouseHandler();
  7589. }
  7590. _mouseHandler() {
  7591. let _self = this;
  7592. let viewer2 = _self._viewer;
  7593. let scene = _self._scene;
  7594. let selectedPlane;
  7595. let downHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  7596. downHandler.setInputAction(function(movement) {
  7597. let pickedObject = scene.pick(movement.position);
  7598. if (Cesium.defined(pickedObject) && Cesium.defined(pickedObject.id) && Cesium.defined(pickedObject.id.plane)) {
  7599. selectedPlane = pickedObject.id.plane;
  7600. selectedPlane.material = Cesium.Color.RED.withAlpha(0.05);
  7601. selectedPlane.outlineColor = Cesium.Color.RED;
  7602. scene.screenSpaceCameraController.enableInputs = false;
  7603. }
  7604. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  7605. let upHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  7606. upHandler.setInputAction(function() {
  7607. if (Cesium.defined(selectedPlane)) {
  7608. selectedPlane.material = Cesium.Color.RED.withAlpha(0.1);
  7609. selectedPlane.outlineColor = Cesium.Color.RED;
  7610. selectedPlane = void 0;
  7611. }
  7612. scene.screenSpaceCameraController.enableInputs = true;
  7613. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  7614. let moveHandler = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  7615. moveHandler.setInputAction(function(movement) {
  7616. if (Cesium.defined(selectedPlane)) {
  7617. let deltaY = movement.startPosition.y - movement.endPosition.y;
  7618. _self.targetY += deltaY;
  7619. }
  7620. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  7621. }
  7622. _createPlaneUpdateFunction(plane) {
  7623. let _self = this;
  7624. return function() {
  7625. plane.distance = _self.targetY;
  7626. return plane;
  7627. };
  7628. }
  7629. }
  7630. Object.assign(GeologyClipPlan.prototype, {
  7631. activate(tileset, options2) {
  7632. let _self = this;
  7633. let viewer2 = _self._viewer;
  7634. let distance2 = 1e5;
  7635. let clippingPlanes = new Cesium.ClippingPlaneCollection({
  7636. planes: [
  7637. new Cesium.ClippingPlane(
  7638. new Cesium.Cartesian3(0, 0, -1),
  7639. distance2
  7640. )
  7641. ],
  7642. edgeWidth: 1
  7643. });
  7644. _self.tileset = tileset;
  7645. tileset.clippingPlanes = clippingPlanes;
  7646. tileset.debugShowBoundingVolume = false;
  7647. return tileset.readyPromise.then(function() {
  7648. let boundingSphere = tileset.boundingSphere;
  7649. let radius = boundingSphere.radius;
  7650. if (!Cesium.Matrix4.equals(
  7651. tileset.root.transform,
  7652. Cesium.Matrix4.IDENTITY
  7653. )) {
  7654. const transformCenter = Cesium.Matrix4.getTranslation(
  7655. tileset.root.transform,
  7656. new Cesium.Cartesian3()
  7657. );
  7658. const transformCartographic = Cesium.Cartographic.fromCartesian(
  7659. transformCenter
  7660. );
  7661. const boundingSphereCartographic = Cesium.Cartographic.fromCartesian(
  7662. tileset.boundingSphere.center
  7663. );
  7664. const height2 = boundingSphereCartographic.height - transformCartographic.height;
  7665. clippingPlanes.modelMatrix = Cesium.Matrix4.fromTranslation(new Cesium.Cartesian3(0, 0, height2));
  7666. }
  7667. viewer2.zoomTo(
  7668. tileset,
  7669. new Cesium.HeadingPitchRange(0.5, -0.2, radius / 10)
  7670. );
  7671. let cartographic = Cesium.Cartographic.fromCartesian(boundingSphere.center);
  7672. let lng = Cesium.Math.toDegrees(cartographic.longitude);
  7673. let lat = Cesium.Math.toDegrees(cartographic.latitude);
  7674. cartographic.height;
  7675. var Cartesian33 = Cesium.Cartesian3.fromDegrees(lng, lat, 105);
  7676. for (let i2 = 0; i2 < clippingPlanes.length; ++i2) {
  7677. let plane = clippingPlanes.get(i2);
  7678. let planeEntity = viewer2.entities.add({
  7679. position: Cartesian33,
  7680. plane: {
  7681. dimensions: new Cesium.Cartesian2(
  7682. radius / 10,
  7683. radius / 20
  7684. ),
  7685. material: Cesium.Color.RED.withAlpha(0.1),
  7686. plane: new Cesium.CallbackProperty(
  7687. _self._createPlaneUpdateFunction(plane),
  7688. false
  7689. ),
  7690. outline: true,
  7691. outlineColor: Cesium.Color.RED
  7692. }
  7693. });
  7694. _self.planeEntities.push(planeEntity);
  7695. }
  7696. return tileset;
  7697. });
  7698. },
  7699. toggleClipping() {
  7700. let _self = this;
  7701. for (let i2 = 0; i2 < _self.planeEntities.length; i2++) {
  7702. _self._viewer.entities.remove(_self.planeEntities[i2]);
  7703. }
  7704. _self.planeEntities = [];
  7705. _self.targetY = 0;
  7706. let boundingSphere = _self.tileset.boundingSphere;
  7707. _self._camera.viewBoundingSphere(boundingSphere, new Cesium.HeadingPitchRange(Cesium.Math.toRadians(120), Cesium.Math.toRadians(-10), boundingSphere.radius * 2.5));
  7708. _self._camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
  7709. },
  7710. reset() {
  7711. this.planeEntities = [];
  7712. this.targetY = 0;
  7713. }
  7714. });
  7715. let SpatialAnalysis = {
  7716. SightLine,
  7717. ViewShed,
  7718. SunshineShadow,
  7719. Profile,
  7720. CutFill,
  7721. HeightLimit,
  7722. Cutting,
  7723. GeologyClipPlan
  7724. };
  7725. class TerrainExcavation {
  7726. constructor(viewer2) {
  7727. if (!viewer2)
  7728. throw new Error("no viewer object!");
  7729. this.viewer = viewer2;
  7730. }
  7731. prepareWell(activePoints) {
  7732. let pointLength = activePoints.length;
  7733. let heightDiff = this.excavateMinHeight - this.height;
  7734. let no_height_top = [], bottom_pos = [], lerp_pos = [];
  7735. for (let l = 0; l < pointLength; l++) {
  7736. let u = l == pointLength - 1 ? 0 : l + 1;
  7737. let point0 = [
  7738. Cesium.Cartographic.fromCartesian(activePoints[l]).longitude,
  7739. Cesium.Cartographic.fromCartesian(activePoints[l]).latitude
  7740. ];
  7741. let point1 = [
  7742. Cesium.Cartographic.fromCartesian(activePoints[u]).longitude,
  7743. Cesium.Cartographic.fromCartesian(activePoints[u]).latitude
  7744. ];
  7745. if (0 == l) {
  7746. lerp_pos.push(new Cesium.Cartographic(point0[0], point0[1]));
  7747. bottom_pos.push(
  7748. Cesium.Cartesian3.fromRadians(point0[0], point0[1], heightDiff)
  7749. );
  7750. no_height_top.push(
  7751. Cesium.Cartesian3.fromRadians(point0[0], point0[1], 0)
  7752. );
  7753. }
  7754. for (let p = 1; p <= this.splitNum; p++) {
  7755. let m = Cesium.Math.lerp(point0[0], point1[0], p / this.splitNum);
  7756. let g = Cesium.Math.lerp(point0[1], point1[1], p / this.splitNum);
  7757. l == pointLength - 1 && p == this.splitNum || (lerp_pos.push(new Cesium.Cartographic(m, g)), bottom_pos.push(Cesium.Cartesian3.fromRadians(m, g, heightDiff)), no_height_top.push(Cesium.Cartesian3.fromRadians(m, g, 0)));
  7758. }
  7759. }
  7760. this.wellData = {
  7761. lerp_pos,
  7762. bottom_pos,
  7763. no_height_top
  7764. };
  7765. }
  7766. createWell(wallData) {
  7767. let $this = this;
  7768. if (this.viewer.terrainProvider._layers) {
  7769. this.createBottomSurface(wallData.bottom_pos);
  7770. let positions = Cesium.sampleTerrainMostDetailed(
  7771. this.viewer.terrainProvider,
  7772. wallData.lerp_pos
  7773. );
  7774. positions.then(function(pos) {
  7775. let positionList = [];
  7776. for (let index2 = 0; index2 < pos.length; index2++) {
  7777. const element = pos[index2];
  7778. let curPos = Cesium.Cartesian3.fromRadians(
  7779. element.longitude,
  7780. element.latitude,
  7781. element.height
  7782. );
  7783. positionList.push(curPos);
  7784. }
  7785. $this.createWellWall(wallData.bottom_pos, positionList);
  7786. });
  7787. } else {
  7788. this.createBottomSurface(wallData.bottom_pos);
  7789. this.createWellWall(wallData.bottom_pos, wallData.no_height_top);
  7790. }
  7791. }
  7792. ellipsoidToDegree(pos) {
  7793. let cartesian3 = new Cesium.Cartesian3(pos.x, pos.y, pos.z);
  7794. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian3);
  7795. return {
  7796. longitude: Cesium.Math.toDegrees(cartographic.longitude),
  7797. latitude: Cesium.Math.toDegrees(cartographic.latitude),
  7798. altitude: cartographic.height
  7799. };
  7800. }
  7801. createBottomSurface(points2) {
  7802. if (points2.length) {
  7803. let minHeight = this.getMinHeight(points2);
  7804. let positions = [];
  7805. for (let i2 = 0; i2 < points2.length; i2++) {
  7806. let curPoint = this.ellipsoidToDegree(points2[i2]);
  7807. positions.push(curPoint.longitude, curPoint.latitude, minHeight);
  7808. }
  7809. let polygon2 = new Cesium.PolygonGeometry({
  7810. polygonHierarchy: new Cesium.PolygonHierarchy(
  7811. Cesium.Cartesian3.fromDegreesArrayHeights(positions)
  7812. ),
  7813. perPositionHeight: true
  7814. });
  7815. let material = new Cesium.Material({
  7816. fabric: {
  7817. type: "Image",
  7818. uniforms: {
  7819. image: this.bottomImg
  7820. }
  7821. }
  7822. });
  7823. let appearance = new Cesium.MaterialAppearance({
  7824. translucent: false,
  7825. flat: true,
  7826. material
  7827. });
  7828. this.bottomSurface = new Cesium.Primitive({
  7829. geometryInstances: new Cesium.GeometryInstance({
  7830. geometry: Cesium.PolygonGeometry.createGeometry(polygon2)
  7831. }),
  7832. appearance,
  7833. asynchronous: false
  7834. });
  7835. this.viewer.scene.primitives.add(this.bottomSurface);
  7836. }
  7837. }
  7838. createWellWall(bottomPos, positionList) {
  7839. let minHeight = this.getMinHeight(bottomPos);
  7840. let maxHeights = [], minHeights = [];
  7841. for (let i2 = 0; i2 < positionList.length; i2++) {
  7842. maxHeights.push(this.ellipsoidToDegree(positionList[i2]).altitude);
  7843. minHeights.push(minHeight);
  7844. }
  7845. let wall = new Cesium.WallGeometry({
  7846. positions: positionList,
  7847. maximumHeights: maxHeights,
  7848. minimumHeights: minHeights
  7849. });
  7850. let geometry2 = Cesium.WallGeometry.createGeometry(wall);
  7851. let material = new Cesium.Material({
  7852. fabric: {
  7853. type: "Image",
  7854. uniforms: {
  7855. image: this.wallImg
  7856. }
  7857. }
  7858. });
  7859. let appearance = new Cesium.MaterialAppearance({
  7860. translucent: false,
  7861. flat: true,
  7862. material
  7863. });
  7864. this.wellWall = new Cesium.Primitive({
  7865. geometryInstances: new Cesium.GeometryInstance({
  7866. geometry: geometry2,
  7867. attributes: {
  7868. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  7869. Cesium.Color.GREY
  7870. )
  7871. },
  7872. id: "PitWall"
  7873. }),
  7874. appearance,
  7875. asynchronous: false
  7876. });
  7877. this.viewer.scene.primitives.add(this.wellWall);
  7878. }
  7879. getMinHeight(points2) {
  7880. let minHeight = 5e6;
  7881. let minPoint = null;
  7882. for (let i2 = 0; i2 < points2.length; i2++) {
  7883. let height2 = points2[i2]["z"];
  7884. if (height2 < minHeight) {
  7885. minHeight = height2;
  7886. minPoint = this.ellipsoidToDegree(points2[i2]);
  7887. }
  7888. }
  7889. return minPoint.altitude;
  7890. }
  7891. switchExcavate(show) {
  7892. if (show) {
  7893. this.viewer.scene.globe.material = null;
  7894. this.wellWall.show = true;
  7895. this.bottomSurface.show = true;
  7896. } else {
  7897. this.viewer.scene.globe.material = null;
  7898. this.wellWall.show = false;
  7899. this.bottomSurface.show = false;
  7900. }
  7901. }
  7902. updateExcavateDepth(height2) {
  7903. this.viewer.scene.primitives.remove(this.bottomSurface);
  7904. this.viewer.scene.primitives.remove(this.wellWall);
  7905. console.log(this.wellData, this.excavateMinHeight);
  7906. let lerp_pos = this.wellData.lerp_pos;
  7907. let posList = [];
  7908. for (let n = 0; n < lerp_pos.length; n++) {
  7909. posList.push(
  7910. Cesium.Cartesian3.fromRadians(
  7911. lerp_pos[n].longitude,
  7912. lerp_pos[n].latitude,
  7913. this.excavateMinHeight - height2
  7914. )
  7915. );
  7916. }
  7917. this.wellData.bottom_pos = posList;
  7918. this.createWell(this.wellData);
  7919. }
  7920. }
  7921. Object.defineProperties(TerrainExcavation.prototype, {
  7922. show: {
  7923. get: function() {
  7924. return this._show;
  7925. },
  7926. set: function(e) {
  7927. this._show = e;
  7928. this.switchExcavate(e);
  7929. }
  7930. },
  7931. height: {
  7932. get: function() {
  7933. return this._height;
  7934. },
  7935. set: function(e) {
  7936. this._height = e;
  7937. this.updateExcavateDepth(e);
  7938. }
  7939. }
  7940. });
  7941. Object.assign(TerrainExcavation.prototype, {
  7942. add(activePoints, options2) {
  7943. options2 = options2 || {};
  7944. this._height = options2.excavateDepth || 10;
  7945. this.bottomImg = options2.bottomImg || "jt3dSDK/imgs/polygon/ground.png";
  7946. this.wallImg = options2.wallImg || "jt3dSDK/imgs/polygon/ground.png";
  7947. this.splitNum = Cesium.defaultValue(options2.splitNum, 50);
  7948. activePoints = activePoints.map((point2) => {
  7949. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  7950. });
  7951. let viewer2 = this.viewer;
  7952. this.clear();
  7953. let clippingPlanesList = [];
  7954. let car3Difference = Cesium.Cartesian3.subtract(
  7955. activePoints[0],
  7956. activePoints[1],
  7957. new Cesium.Cartesian3()
  7958. );
  7959. let boolDiff = car3Difference.x > 0;
  7960. this.excavateMinHeight = 999999999;
  7961. for (let index2 = 0; index2 < activePoints.length; ++index2) {
  7962. let s = (index2 + 1) % activePoints.length;
  7963. let curMidPoint = Cesium.Cartesian3.midpoint(
  7964. activePoints[index2],
  7965. activePoints[s],
  7966. new Cesium.Cartesian3()
  7967. );
  7968. let cartographic = Cesium.Cartographic.fromCartesian(activePoints[index2]);
  7969. let curHeight = viewer2.scene.globe.getHeight(cartographic) || cartographic.height;
  7970. console.log(curHeight);
  7971. if (curHeight < this.excavateMinHeight) {
  7972. this.excavateMinHeight = curHeight;
  7973. }
  7974. let curMidPointNormal = Cesium.Cartesian3.normalize(
  7975. curMidPoint,
  7976. new Cesium.Cartesian3()
  7977. );
  7978. let curMidPointDifference = boolDiff ? Cesium.Cartesian3.subtract(
  7979. activePoints[index2],
  7980. curMidPoint,
  7981. new Cesium.Cartesian3()
  7982. ) : Cesium.Cartesian3.subtract(
  7983. activePoints[s],
  7984. curMidPoint,
  7985. new Cesium.Cartesian3()
  7986. );
  7987. curMidPointDifference = Cesium.Cartesian3.normalize(
  7988. curMidPointDifference,
  7989. curMidPointDifference
  7990. );
  7991. let curMidPointCross = Cesium.Cartesian3.cross(
  7992. curMidPointDifference,
  7993. curMidPointNormal,
  7994. new Cesium.Cartesian3()
  7995. );
  7996. curMidPointCross = Cesium.Cartesian3.normalize(
  7997. curMidPointCross,
  7998. curMidPointCross
  7999. );
  8000. let plane = new Cesium.Plane(curMidPointCross, 0);
  8001. let distance2 = Cesium.Plane.getPointDistance(plane, curMidPoint);
  8002. clippingPlanesList.push(
  8003. new Cesium.ClippingPlane(curMidPointCross, distance2)
  8004. );
  8005. }
  8006. this.viewer.scene.globe.clippingPlanes = new Cesium.ClippingPlaneCollection({
  8007. planes: clippingPlanesList,
  8008. edgeWidth: 1,
  8009. edgeColor: Cesium.Color.WHITE,
  8010. enabled: true
  8011. });
  8012. this.prepareWell(activePoints);
  8013. this.createWell(this.wellData);
  8014. },
  8015. clear() {
  8016. if (this.viewer.scene.globe.clippingPlanes) {
  8017. this.viewer.scene.globe.clippingPlanes.removeAll();
  8018. this.viewer.scene.primitives.remove(this.bottomSurface);
  8019. this.viewer.scene.primitives.remove(this.wellWall);
  8020. this.viewer.scene.render();
  8021. }
  8022. }
  8023. });
  8024. var tooltip = "";
  8025. function setSessionid$1(num) {
  8026. let len = num || 32;
  8027. let chars = "ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678";
  8028. let maxPos = chars.length;
  8029. let pwd = "";
  8030. for (let i2 = 0; i2 < len; i2++) {
  8031. pwd += chars.charAt(Math.floor(Math.random() * maxPos));
  8032. }
  8033. return pwd;
  8034. }
  8035. function guid() {
  8036. function S4() {
  8037. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  8038. }
  8039. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  8040. }
  8041. function getGuid(removeMinus) {
  8042. let d2 = new Date().getTime();
  8043. let uuid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
  8044. const r2 = (d2 + Math.random() * 16) % 16 | 0;
  8045. d2 = Math.floor(d2 / 16);
  8046. return (c === "x" ? r2 : r2 & 3 | 8).toString(16);
  8047. });
  8048. if (removeMinus) {
  8049. uuid = uuid.replace(/-/g, "");
  8050. }
  8051. return uuid;
  8052. }
  8053. function getHeigthByLngLat(viewer2, options2) {
  8054. if (!viewer2)
  8055. throw new Cesium.DeveloperError("no viewer object!");
  8056. if (!Cesium.defined(options2.longitude) && !Cesium.defined(options2.latitude)) {
  8057. throw new Cesium.DeveloperError("longitude and latitude are required.");
  8058. }
  8059. options2.level = Cesium.defaultValue(options2.level, 11);
  8060. let positions = Cesium.Cartographic.fromDegrees(options2.longitude, options2.latitude);
  8061. let terrainProvider = viewer2.terrainProvider;
  8062. return new Promise((resolve2, reject2) => {
  8063. new Cesium.sampleTerrain(terrainProvider, options2.level, [positions]).then(function(updatedPositions) {
  8064. if (updatedPositions) {
  8065. resolve2(updatedPositions[0].height);
  8066. }
  8067. });
  8068. });
  8069. }
  8070. function getHeigthByPoints(viewer2, options2) {
  8071. if (!viewer2)
  8072. throw new Cesium.DeveloperError("no viewer object!");
  8073. if (!Cesium.defined(options2)) {
  8074. throw new Cesium.DeveloperError("options is required.");
  8075. }
  8076. options2.level = Cesium.defaultValue(options2.level, 11);
  8077. let positions = [];
  8078. let points2 = options2.points;
  8079. for (let i2 = 0; i2 < points2.length; i2++) {
  8080. let pointX = points2[i2][0];
  8081. let pointY = points2[i2][1];
  8082. positions.push(
  8083. Cesium.Cartographic.fromDegrees(pointX, pointY)
  8084. );
  8085. }
  8086. let terrainProvider = viewer2.terrainProvider;
  8087. return new Promise((resolve2, reject2) => {
  8088. new Cesium.sampleTerrain(terrainProvider, options2.level, positions).then(function(updatedPositions) {
  8089. if (updatedPositions) {
  8090. resolve2(updatedPositions);
  8091. }
  8092. });
  8093. });
  8094. }
  8095. function getHeigthByPointsMostDetailed(viewer2, points2) {
  8096. if (!viewer2)
  8097. throw new Cesium.DeveloperError("no viewer object!");
  8098. if (!Cesium.defined(points2)) {
  8099. throw new Cesium.DeveloperError("points is required.");
  8100. }
  8101. let positions = [];
  8102. for (let i2 = 0; i2 < points2.length; i2++) {
  8103. let pointX = points2[i2][0];
  8104. let pointY = points2[i2][1];
  8105. positions.push(Cesium.Cartographic.fromDegrees(pointX, pointY));
  8106. }
  8107. let terrainProvider = viewer2.terrainProvider;
  8108. return new Promise((resolve2, reject2) => {
  8109. let promise = new Cesium.sampleTerrainMostDetailed(terrainProvider, positions);
  8110. promise.then(function(updatedPositions) {
  8111. resolve2(updatedPositions);
  8112. });
  8113. });
  8114. }
  8115. function getHeigthByPointMostDetailed(viewer2, points2) {
  8116. if (!viewer2)
  8117. throw new Cesium.DeveloperError("no viewer object!");
  8118. if (!Cesium.defined(points2)) {
  8119. throw new Cesium.DeveloperError("points is required.");
  8120. }
  8121. let positions = Cesium.Cartographic.fromDegrees(points2[0], points2[1]);
  8122. let terrainProvider = viewer2.terrainProvider;
  8123. return new Promise((resolve2, reject2) => {
  8124. let promise = new Cesium.sampleTerrainMostDetailed(terrainProvider, positions);
  8125. promise.then(function(updatedPositions) {
  8126. resolve2(updatedPositions);
  8127. });
  8128. });
  8129. }
  8130. function createTooltip(frameDiv) {
  8131. var tooltip2 = function(frameDiv2) {
  8132. var div = document.createElement("DIV");
  8133. div.className = "twipsy right";
  8134. var arrow = document.createElement("DIV");
  8135. arrow.className = "twipsy-arrow";
  8136. div.appendChild(arrow);
  8137. var title = document.createElement("DIV");
  8138. title.className = "twipsy-inner";
  8139. div.appendChild(title);
  8140. this._div = div;
  8141. this._title = title;
  8142. frameDiv2.appendChild(div);
  8143. };
  8144. tooltip2.prototype.setVisible = function(visible) {
  8145. this._div.style.display = visible ? "block" : "none";
  8146. };
  8147. tooltip2.prototype.showAt = function(position2, message) {
  8148. if (position2 && message) {
  8149. this.setVisible(true);
  8150. this._title.innerHTML = message;
  8151. this._div.style.left = position2.x + 10 + "px";
  8152. this._div.style.top = position2.y - this._div.clientHeight / 2 + "px";
  8153. }
  8154. };
  8155. return new tooltip2(frameDiv);
  8156. }
  8157. var common = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  8158. __proto__: null,
  8159. setSessionid: setSessionid$1,
  8160. guid,
  8161. getGuid,
  8162. getHeigthByLngLat,
  8163. getHeigthByPoints,
  8164. getHeigthByPointsMostDetailed,
  8165. getHeigthByPointMostDetailed,
  8166. createTooltip
  8167. }, Symbol.toStringTag, { value: "Module" }));
  8168. class SlopeAspect {
  8169. constructor(viewer2) {
  8170. if (!viewer2)
  8171. throw new Cesium.DeveloperError("no viewer object!");
  8172. this._viewer = viewer2;
  8173. this.result = [];
  8174. this.handler = void 0;
  8175. this.toolTip = "";
  8176. }
  8177. _openTip() {
  8178. let _self = this;
  8179. this.handler = new Cesium.ScreenSpaceEventHandler(_self._viewer.canvas);
  8180. this.handler.setInputAction(function(movement) {
  8181. let endPos = movement.endPosition;
  8182. var pick = _self._viewer.scene.pick(endPos);
  8183. if (pick && pick.id && pick.id.type === "SlopeAspect") {
  8184. _self.toolTip = pick.id.value.toFixed(2);
  8185. CreateRemindertip(_self.toolTip, endPos, true);
  8186. } else {
  8187. _self.toolTip = "";
  8188. CreateRemindertip(_self.toolTip, endPos, false);
  8189. }
  8190. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  8191. }
  8192. _createEllipse(gridSquare) {
  8193. let _self = this;
  8194. let boxResults = [];
  8195. for (let index2 = 0; index2 < gridSquare.features.length; index2++) {
  8196. const feature2 = gridSquare.features[index2];
  8197. const coordinates = feature2.geometry.coordinates[0];
  8198. const centerdegree = [
  8199. (coordinates[0][0] + coordinates[2][0]) / 2,
  8200. (coordinates[0][1] + coordinates[2][1]) / 2
  8201. ];
  8202. let centerCartographic = Cesium.Cartographic.fromDegrees(
  8203. centerdegree[0],
  8204. centerdegree[1]
  8205. );
  8206. boxResults.push(centerCartographic);
  8207. for (let i2 = 0; i2 < coordinates.length; i2++) {
  8208. const coord = coordinates[i2];
  8209. let cartographic = Cesium.Cartographic.fromDegrees(coord[0], coord[1]);
  8210. boxResults.push(cartographic);
  8211. const coord1 = coordinates[i2 + 1];
  8212. if (coord1) {
  8213. let newCoord = [(coord[0] + coord1[0]) / 2, (coord[1] + coord1[1]) / 2];
  8214. let newCartographic = Cesium.Cartographic.fromDegrees(newCoord[0], newCoord[1]);
  8215. boxResults.push(newCartographic);
  8216. }
  8217. }
  8218. }
  8219. Cesium.sampleTerrainMostDetailed(
  8220. _self._viewer.scene.terrainProvider,
  8221. boxResults
  8222. ).then((updatePositions) => {
  8223. let arrr = [];
  8224. let ellipseResults = updatePositions.reduce(function(pre, item, index2, updatePositions2) {
  8225. var begin = index2 * 10;
  8226. var end = begin + 10;
  8227. var res = updatePositions2.slice(begin, end);
  8228. if (res.length != 0) {
  8229. arrr[index2] = res;
  8230. }
  8231. return arrr;
  8232. }, []);
  8233. _self._calculateSlope(ellipseResults);
  8234. _self._openTip();
  8235. });
  8236. }
  8237. _createPolygonInsrance(points2, color2) {
  8238. let positions = [];
  8239. for (let index2 = 1; index2 < points2.length - 1; index2++) {
  8240. const element = points2[index2];
  8241. positions.push(Cesium.Cartographic.toCartesian(element));
  8242. }
  8243. let polygon2 = new Cesium.PolygonGeometry({
  8244. polygonHierarchy: new Cesium.PolygonHierarchy(positions)
  8245. });
  8246. let polygonInstance = new Cesium.GeometryInstance({
  8247. geometry: polygon2,
  8248. attributes: {
  8249. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  8250. Cesium.Color.fromCssColorString(color2)
  8251. ),
  8252. show: new Cesium.ShowGeometryInstanceAttribute(true)
  8253. }
  8254. });
  8255. return polygonInstance;
  8256. }
  8257. _createArrowInstance(targetPoint, center2, diagonalPoint, heightDifference, curSlope) {
  8258. let cartographic_0 = new Cesium.Cartographic(
  8259. (targetPoint.longitude + center2.longitude) / 2,
  8260. (targetPoint.latitude + center2.latitude) / 2,
  8261. (targetPoint.height + center2.height) / 2
  8262. );
  8263. let cartographic_1 = new Cesium.Cartographic(
  8264. (diagonalPoint.longitude + center2.longitude) / 2,
  8265. (diagonalPoint.latitude + center2.latitude) / 2,
  8266. (diagonalPoint.height + center2.height) / 2
  8267. );
  8268. let positions1 = heightDifference > 0 ? [
  8269. Cesium.Cartographic.toCartesian(cartographic_0),
  8270. Cesium.Cartographic.toCartesian(cartographic_1)
  8271. ] : [
  8272. Cesium.Cartographic.toCartesian(cartographic_1),
  8273. Cesium.Cartographic.toCartesian(cartographic_0)
  8274. ];
  8275. const instance = new Cesium.GeometryInstance({
  8276. id: {
  8277. type: "SlopeAspect",
  8278. value: curSlope
  8279. },
  8280. geometry: new Cesium.GroundPolylineGeometry({
  8281. positions: positions1,
  8282. width: this.arrowWidth
  8283. }),
  8284. attributes: {
  8285. color: Cesium.ColorGeometryInstanceAttribute.fromColor(
  8286. Cesium.Color.BLUE.withAlpha(0.6)
  8287. ),
  8288. show: new Cesium.ShowGeometryInstanceAttribute(true)
  8289. }
  8290. });
  8291. return instance;
  8292. }
  8293. _calculateSlope(ellipseResults) {
  8294. let _self = this;
  8295. let instances = [];
  8296. let polygonInstance = [];
  8297. for (let index2 = 0; index2 < ellipseResults.length; index2++) {
  8298. const ellipse = ellipseResults[index2];
  8299. const center2 = ellipse[0];
  8300. let heightDifference = 0;
  8301. let maxIndex = 0;
  8302. for (let i2 = 1; i2 < ellipse.length - 1; i2++) {
  8303. const point2 = ellipse[i2];
  8304. let curHD = point2.height - center2.height;
  8305. if (Math.abs(curHD) > heightDifference) {
  8306. heightDifference = curHD;
  8307. maxIndex = i2;
  8308. }
  8309. }
  8310. let pos0 = new Cesium.Cartographic(center2.longitude, center2.latitude, 0);
  8311. let pos1 = new Cesium.Cartographic(
  8312. ellipse[maxIndex].longitude,
  8313. ellipse[maxIndex].latitude,
  8314. 0
  8315. );
  8316. let distance2 = Cesium.Cartesian3.distance(
  8317. Cesium.Cartographic.toCartesian(pos0),
  8318. Cesium.Cartographic.toCartesian(pos1)
  8319. );
  8320. let curSlope = Math.abs(heightDifference / distance2);
  8321. let curColor = _self._calculateSlopeColor(curSlope, 0.4);
  8322. const curPolygonInstance = _self._createPolygonInsrance(ellipse, curColor);
  8323. polygonInstance.push(curPolygonInstance);
  8324. let diagonalPoint = maxIndex > 4 ? ellipse[maxIndex - 4] : ellipse[maxIndex + 4];
  8325. let targetPoint = ellipse[maxIndex];
  8326. const arrowInstance = _self._createArrowInstance(targetPoint, center2, diagonalPoint, heightDifference, curSlope);
  8327. instances.push(arrowInstance);
  8328. }
  8329. const mapPrimitive = _self._viewer.scene.primitives.add(
  8330. new Cesium.GroundPrimitive({
  8331. geometryInstances: polygonInstance,
  8332. appearance: new Cesium.PerInstanceColorAppearance({
  8333. translucent: true,
  8334. closed: false
  8335. })
  8336. })
  8337. );
  8338. const arrowPrimitive = _self._viewer.scene.primitives.add(
  8339. new Cesium.GroundPolylinePrimitive({
  8340. geometryInstances: instances,
  8341. appearance: new Cesium.PolylineMaterialAppearance({
  8342. material: new Cesium.Material({
  8343. fabric: {
  8344. type: "PolylineArrow",
  8345. uniforms: {
  8346. color: new Cesium.Color(1, 1, 0, 0.8)
  8347. }
  8348. }
  8349. })
  8350. })
  8351. })
  8352. );
  8353. _self.result.push(arrowPrimitive, mapPrimitive);
  8354. }
  8355. _calculateSlopeColor(value, alpha) {
  8356. if (value < 0.00872686779075879) {
  8357. return "rgba(85,182,43," + alpha + ")";
  8358. } else if (value < 0.03492076949174773) {
  8359. return "rgba(135,211,43," + alpha + ")";
  8360. } else if (value < 0.08748866352592401) {
  8361. return "rgba(204,244,44," + alpha + ")";
  8362. } else if (value < 0.2679491924311227) {
  8363. return "rgba(245,233,44," + alpha + ")";
  8364. } else if (value < 0.7002075382097097) {
  8365. return "rgba(255,138,43," + alpha + ")";
  8366. } else if (value < 1.4281480067421144) {
  8367. return "rgba(255,84,43," + alpha + ")";
  8368. } else {
  8369. return "rgba(255,32,43," + alpha + ")";
  8370. }
  8371. }
  8372. }
  8373. Object.assign(SlopeAspect.prototype, {
  8374. createNew4Distance(points2, polygon$1, options2) {
  8375. let _self = this;
  8376. options2 = options2 || {};
  8377. options2.distance = options2.distance || 0.1;
  8378. let width2 = options2.distance * 200 > 35 ? 35 : options2.distance * 200;
  8379. _self.arrowWidth = width2 < 15 ? 15 : width2;
  8380. let positions = points2.map((point2) => {
  8381. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  8382. });
  8383. _self.clearAll();
  8384. let degrees = CoordTransform.Cartesian3ListToWGS84(positions);
  8385. let boundary = [];
  8386. let minX = 1e4, minY = 1e4, maxX = -1e4, maxY = -1e3;
  8387. for (let index2 = 0; index2 < degrees.length; index2++) {
  8388. const element = degrees[index2];
  8389. const x = element.lng;
  8390. const y = element.lat;
  8391. boundary.push([x, y]);
  8392. minX = x < minX ? x : minX;
  8393. minY = y < minY ? y : minY;
  8394. maxX = x > maxX ? x : maxX;
  8395. maxY = y > maxY ? y : maxY;
  8396. }
  8397. boundary.push(boundary[0]);
  8398. let bbox2 = [minX, minY, maxX, maxY];
  8399. polygon([boundary]);
  8400. let gridSquare = squareGrid(bbox2, options2.distance, {});
  8401. _self._createEllipse(gridSquare);
  8402. },
  8403. createNew4Num(points2, polygon$1, options2) {
  8404. let _self = this;
  8405. options2 = options2 || {};
  8406. options2.num = Cesium.defaultValue(options2.num, 10);
  8407. let positions = points2.map((point2) => {
  8408. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  8409. });
  8410. _self.clearAll();
  8411. let degrees = CoordTransform.Cartesian3ListToWGS84(positions);
  8412. let boundary = [];
  8413. let minX = 1e4, minY = 1e4, maxX = -1e4, maxY = -1e3;
  8414. for (let index2 = 0; index2 < degrees.length; index2++) {
  8415. const element = degrees[index2];
  8416. const x = element.lng;
  8417. const y = element.lat;
  8418. boundary.push([x, y]);
  8419. minX = x < minX ? x : minX;
  8420. minY = y < minY ? y : minY;
  8421. maxX = x > maxX ? x : maxX;
  8422. maxY = y > maxY ? y : maxY;
  8423. }
  8424. boundary.push(boundary[0]);
  8425. let bbox2 = [minX, minY, maxX, maxY];
  8426. let a = maxX - minX;
  8427. let b = maxY - minY;
  8428. b = b > a ? b : a;
  8429. const step = b / options2.num;
  8430. let width2 = step * 2e3 > 35 ? 35 : step * 2e3;
  8431. _self.arrowWidth = width2 < 15 ? 15 : width2;
  8432. polygon([boundary]);
  8433. let gridSquare = squareGrid(bbox2, step, {
  8434. units: "degrees"
  8435. });
  8436. _self._createEllipse(gridSquare);
  8437. },
  8438. clearAll() {
  8439. this.result.forEach((element) => {
  8440. this._viewer.scene.primitives.remove(element);
  8441. });
  8442. this.result = [];
  8443. if (this.handler) {
  8444. this.handler.destroy();
  8445. this.handler = void 0;
  8446. }
  8447. }
  8448. });
  8449. let TerrainAnalysis = {
  8450. TerrainExcavation,
  8451. SlopeAspect
  8452. };
  8453. class Weather {
  8454. constructor(viewer2) {
  8455. if (!viewer2)
  8456. throw new Cesium.DeveloperError("no viewer object!");
  8457. this._viewer = viewer2;
  8458. }
  8459. _initRain() {
  8460. this.rainStage = new Cesium.PostProcessStage({
  8461. name: "jt_rain",
  8462. fragmentShader: this._rain(),
  8463. uniforms: {
  8464. tiltAngle: () => {
  8465. return this.tiltAngle;
  8466. },
  8467. rainSize: () => {
  8468. return this.rainSize;
  8469. },
  8470. rainSpeed: () => {
  8471. return this.rainSpeed;
  8472. }
  8473. }
  8474. });
  8475. this._viewer.scene.postProcessStages.add(this.rainStage);
  8476. }
  8477. _initSnow() {
  8478. this.snowStage = new Cesium.PostProcessStage({
  8479. name: "jt_snow",
  8480. fragmentShader: this._snow(),
  8481. uniforms: {
  8482. snowSize: () => {
  8483. return this.snowSize;
  8484. },
  8485. snowSpeed: () => {
  8486. return this.snowSpeed;
  8487. }
  8488. }
  8489. });
  8490. this._viewer.scene.postProcessStages.add(this.snowStage);
  8491. }
  8492. _initFog() {
  8493. this.fogStage = new Cesium.PostProcessStage({
  8494. name: "jt_fog",
  8495. fragmentShader: this._fog(),
  8496. uniforms: {
  8497. visibility: () => {
  8498. return this.visibility;
  8499. },
  8500. fogColor: () => {
  8501. return this.color;
  8502. }
  8503. }
  8504. });
  8505. this._viewer.scene.postProcessStages.add(this.fogStage);
  8506. }
  8507. _rain() {
  8508. return "uniform sampler2D colorTexture;\n varying vec2 v_textureCoordinates;\n uniform float tiltAngle;\n uniform float rainSize;\n uniform float rainSpeed;\n float hash(float x) {\n return fract(sin(x * 133.3) * 13.13);\n }\n void main(void) {\n float time = czm_frameNumber / rainSpeed;\n vec2 resolution = czm_viewport.zw;\n vec2 uv = (gl_FragCoord.xy * 2. - resolution.xy) / min(resolution.x, resolution.y);\n vec3 c = vec3(.6, .7, .8);\n float a = tiltAngle;\n float si = sin(a), co = cos(a);\n uv *= mat2(co, -si, si, co);\n uv *= length(uv + vec2(0, 4.9)) * rainSize + 1.;\n float v = 1. - sin(hash(floor(uv.x * 100.)) * 2.);\n float b = clamp(abs(sin(20. * time * v + uv.y * (5. / (2. + v)))) - .95, 0., 1.) * 20.;\n c *= v * b;\n gl_FragColor = mix(texture2D(colorTexture, v_textureCoordinates), vec4(c, 1), .5);\n }\n ";
  8509. }
  8510. _snow() {
  8511. return "uniform sampler2D colorTexture;\n varying vec2 v_textureCoordinates;\n uniform float snowSpeed;\n uniform float snowSize;\n float snow(vec2 uv,float scale)\n {\n float time=czm_frameNumber/snowSpeed;\n float w=smoothstep(1.,0.,-uv.y*(scale/10.));if(w<.1)return 0.;\n uv+=time/scale;uv.y+=time*2./scale;uv.x+=sin(uv.y+time*.5)/scale;\n uv*=scale;vec2 s=floor(uv),f=fract(uv),p;float k=3.,d;\n p=.5+.35*sin(11.*fract(sin((s+p+scale)*mat2(7,3,6,5))*5.))-f;d=length(p);k=min(d,k);\n k=smoothstep(0.,k,sin(f.x+f.y)*snowSize);\n return k*w;\n }\n void main(void){\n vec2 resolution=czm_viewport.zw;\n vec2 uv=(gl_FragCoord.xy*2.-resolution.xy)/min(resolution.x,resolution.y);\n vec3 finalColor=vec3(0);\n //float c=smoothstep(1.,0.3,clamp(uv.y*.3+.8,0.,.75));\n float c=0.;\n c+=snow(uv,30.)*.0;\n c+=snow(uv,20.)*.0;\n c+=snow(uv,15.)*.0;\n c+=snow(uv,10.);\n c+=snow(uv,8.);\n c+=snow(uv,6.);\n c+=snow(uv,5.);\n finalColor=(vec3(c));\n gl_FragColor=mix(texture2D(colorTexture,v_textureCoordinates),vec4(finalColor,1),.5);\n }\n ";
  8512. }
  8513. _fog() {
  8514. return "uniform sampler2D colorTexture;\n uniform sampler2D depthTexture;\n uniform float visibility;\n uniform vec4 fogColor;\n varying vec2 v_textureCoordinates; \n void main(void) \n { \n vec4 origcolor = texture2D(colorTexture, v_textureCoordinates); \n float depth = czm_readDepth(depthTexture, v_textureCoordinates); \n vec4 depthcolor = texture2D(depthTexture, v_textureCoordinates); \n float f = visibility * (depthcolor.r - 0.3) / 0.2; \n if (f < 0.0) f = 0.0; \n else if (f > 1.0) f = 1.0; \n gl_FragColor = mix(origcolor, fogColor, f); \n }\n";
  8515. }
  8516. _removeSnow() {
  8517. if (!this._viewer || !this.snowStage)
  8518. return;
  8519. this._viewer.scene.postProcessStages.remove(this.snowStage);
  8520. delete this.snowSize;
  8521. delete this.snowSpeed;
  8522. }
  8523. _removeRain() {
  8524. if (!this._viewer || !this.rainStage)
  8525. return;
  8526. this._viewer.scene.postProcessStages.remove(this.rainStage);
  8527. delete this.tiltAngle;
  8528. delete this.rainSize;
  8529. delete this.rainSpeed;
  8530. }
  8531. _removeFog() {
  8532. if (!this._viewer || !this.fogStage)
  8533. return;
  8534. this._viewer.scene.postProcessStages.remove(this.fogStage);
  8535. delete this.visibility;
  8536. delete this.color;
  8537. }
  8538. }
  8539. Object.assign(Weather.prototype, {
  8540. addRainEffect(options2) {
  8541. options2 = options2 || {};
  8542. this.tiltAngle = Cesium.defaultValue(options2.tiltAngle, -0.6);
  8543. this.rainSize = Cesium.defaultValue(options2.rainSize, 0.3);
  8544. this.rainSpeed = Cesium.defaultValue(options2.rainSpeed, 60);
  8545. this._initRain();
  8546. },
  8547. addSnowEffect(options2) {
  8548. options2 = options2 || {};
  8549. this.snowSize = Cesium.defaultValue(options2.snowSize, 0.02);
  8550. this.snowSpeed = Cesium.defaultValue(options2.snowSpeed, 60);
  8551. this._initSnow();
  8552. },
  8553. addFogEffect(options2) {
  8554. options2 = options2 || {};
  8555. this.visibility = Cesium.defaultValue(options2.visibility, 0.1);
  8556. this.color = Cesium.defaultValue(options2.color, new Cesium.Color(0.8, 0.8, 0.8, 0.5));
  8557. this._show = Cesium.defaultValue(options2.show, true);
  8558. this._initFog();
  8559. },
  8560. removeEffect() {
  8561. if (this.snowStage) {
  8562. this._removeSnow();
  8563. }
  8564. if (this.rainStage) {
  8565. this._removeRain();
  8566. }
  8567. if (this.fogStage) {
  8568. this._removeFog();
  8569. }
  8570. }
  8571. });
  8572. const BoxGeometry = Cesium.BoxGeometry;
  8573. const Cartesian3 = Cesium.Cartesian3;
  8574. const defaultValue = Cesium.defaultValue;
  8575. const defined = Cesium.defined;
  8576. const destroyObject = Cesium.destroyObject;
  8577. const DeveloperError$1 = Cesium.DeveloperError;
  8578. const GeometryPipeline = Cesium.GeometryPipeline;
  8579. const Matrix3 = Cesium.Matrix3;
  8580. const Matrix4 = Cesium.Matrix4;
  8581. const Transforms = Cesium.Transforms;
  8582. const VertexFormat = Cesium.VertexFormat;
  8583. const BufferUsage = Cesium.BufferUsage;
  8584. const CubeMap = Cesium.CubeMap;
  8585. const DrawCommand = Cesium.DrawCommand;
  8586. const loadCubeMap = Cesium.loadCubeMap;
  8587. const RenderState = Cesium.RenderState;
  8588. const VertexArray = Cesium.VertexArray;
  8589. const BlendingState = Cesium.BlendingState;
  8590. const SceneMode = Cesium.SceneMode;
  8591. const ShaderProgram = Cesium.ShaderProgram;
  8592. const ShaderSource = Cesium.ShaderSource;
  8593. const SkyBoxFS = "uniform samplerCube u_cubeMap;\n varying vec3 v_texCoord;\n void main()\n {\n vec4 color = textureCube(u_cubeMap, normalize(v_texCoord));\n gl_FragColor = vec4(czm_gammaCorrect(color).rgb, czm_morphTime);\n }\n ";
  8594. const SkyBoxVS = "attribute vec3 position;\n varying vec3 v_texCoord;\n uniform mat3 u_rotateMatrix;\n void main()\n {\n vec3 p = czm_viewRotation * u_rotateMatrix * (czm_temeToPseudoFixed * (czm_entireFrustum.y * position));\n gl_Position = czm_projection * vec4(p, 1.0);\n v_texCoord = position.xyz;\n }\n ";
  8595. if (!Cesium.defined(Cesium.Matrix4.getRotation)) {
  8596. Cesium.Matrix4.getRotation = Cesium.Matrix4.getMatrix3;
  8597. }
  8598. class SkyBoxOnGround {
  8599. constructor(options2) {
  8600. this.sources = options2.sources;
  8601. this._sources = void 0;
  8602. this.show = defaultValue(options2.show, true);
  8603. this._command = new DrawCommand({
  8604. modelMatrix: Matrix4.clone(Matrix4.IDENTITY),
  8605. owner: this
  8606. });
  8607. this._cubeMap = void 0;
  8608. this._attributeLocations = void 0;
  8609. this._useHdr = void 0;
  8610. }
  8611. }
  8612. const skyboxMatrix3 = new Matrix3();
  8613. SkyBoxOnGround.prototype.update = function(frameState, useHdr) {
  8614. const that = this;
  8615. if (!this.show) {
  8616. return void 0;
  8617. }
  8618. if (frameState.mode !== SceneMode.SCENE3D && frameState.mode !== SceneMode.MORPHING) {
  8619. return void 0;
  8620. }
  8621. if (!frameState.passes.render) {
  8622. return void 0;
  8623. }
  8624. const context = frameState.context;
  8625. if (this._sources !== this.sources) {
  8626. this._sources = this.sources;
  8627. const sources = this.sources;
  8628. if (!defined(sources.positiveX) || !defined(sources.negativeX) || !defined(sources.positiveY) || !defined(sources.negativeY) || !defined(sources.positiveZ) || !defined(sources.negativeZ)) {
  8629. throw new DeveloperError$1(
  8630. "this.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."
  8631. );
  8632. }
  8633. if (typeof sources.positiveX !== typeof sources.negativeX || typeof sources.positiveX !== typeof sources.positiveY || typeof sources.positiveX !== typeof sources.negativeY || typeof sources.positiveX !== typeof sources.positiveZ || typeof sources.positiveX !== typeof sources.negativeZ) {
  8634. throw new DeveloperError$1(
  8635. "this.sources properties must all be the same type."
  8636. );
  8637. }
  8638. if (typeof sources.positiveX === "string") {
  8639. loadCubeMap(context, this._sources).then(function(cubeMap) {
  8640. that._cubeMap = that._cubeMap && that._cubeMap.destroy();
  8641. that._cubeMap = cubeMap;
  8642. });
  8643. } else {
  8644. this._cubeMap = this._cubeMap && this._cubeMap.destroy();
  8645. this._cubeMap = new CubeMap({
  8646. context,
  8647. source: sources
  8648. });
  8649. }
  8650. }
  8651. const command = this._command;
  8652. command.modelMatrix = Transforms.eastNorthUpToFixedFrame(
  8653. frameState.camera._positionWC
  8654. );
  8655. if (!defined(command.vertexArray)) {
  8656. command.uniformMap = {
  8657. u_cubeMap: function() {
  8658. return that._cubeMap;
  8659. },
  8660. u_rotateMatrix: function() {
  8661. return Matrix4.getRotation(command.modelMatrix, skyboxMatrix3);
  8662. }
  8663. };
  8664. const geometry2 = BoxGeometry.createGeometry(
  8665. BoxGeometry.fromDimensions({
  8666. dimensions: new Cartesian3(2, 2, 2),
  8667. vertexFormat: VertexFormat.POSITION_ONLY
  8668. })
  8669. );
  8670. const attributeLocations = this._attributeLocations = GeometryPipeline.createAttributeLocations(
  8671. geometry2
  8672. );
  8673. command.vertexArray = VertexArray.fromGeometry({
  8674. context,
  8675. geometry: geometry2,
  8676. attributeLocations,
  8677. bufferUsage: BufferUsage._DRAW
  8678. });
  8679. command.renderState = RenderState.fromCache({
  8680. blending: BlendingState.ALPHA_BLEND
  8681. });
  8682. }
  8683. if (!defined(command.shaderProgram) || this._useHdr !== useHdr) {
  8684. const fs = new ShaderSource({
  8685. defines: [useHdr ? "HDR" : ""],
  8686. sources: [SkyBoxFS]
  8687. });
  8688. command.shaderProgram = ShaderProgram.fromCache({
  8689. context,
  8690. vertexShaderSource: SkyBoxVS,
  8691. fragmentShaderSource: fs,
  8692. attributeLocations: this._attributeLocations
  8693. });
  8694. this._useHdr = useHdr;
  8695. }
  8696. if (!defined(this._cubeMap)) {
  8697. return void 0;
  8698. }
  8699. return command;
  8700. };
  8701. SkyBoxOnGround.prototype.isDestroyed = function() {
  8702. return false;
  8703. };
  8704. SkyBoxOnGround.prototype.destroy = function() {
  8705. const command = this._command;
  8706. command.vertexArray = command.vertexArray && command.vertexArray.destroy();
  8707. command.shaderProgram = command.shaderProgram && command.shaderProgram.destroy();
  8708. this._cubeMap = this._cubeMap && this._cubeMap.destroy();
  8709. return destroyObject(this);
  8710. };
  8711. class SkyBox {
  8712. constructor(viewer2) {
  8713. if (!viewer2)
  8714. throw new Cesium.DeveloperError("no viewer object!");
  8715. this._viewer = viewer2;
  8716. this._farSkyBox = viewer2.scene.skyBox;
  8717. }
  8718. }
  8719. Object.assign(SkyBox.prototype, {
  8720. setGroundSkyBox(options2) {
  8721. options2 = options2 || {};
  8722. options2.height = options2.height || 2e5;
  8723. options2.type = options2.type || "\u84DD\u5929";
  8724. if (!options2.sources) {
  8725. switch (options2.type) {
  8726. case "\u665A\u971E":
  8727. options2.sources = {
  8728. positiveX: "jt3dSDK/imgs/skybox/01/px.png",
  8729. negativeX: "jt3dSDK/imgs/skybox/01/nx.png",
  8730. positiveY: "jt3dSDK/imgs/skybox/01/py.png",
  8731. negativeY: "jt3dSDK/imgs/skybox/01/ny.png",
  8732. positiveZ: "jt3dSDK/imgs/skybox/01/pz.png",
  8733. negativeZ: "jt3dSDK/imgs/skybox/01/nz.png"
  8734. };
  8735. break;
  8736. case "\u9634\u5929":
  8737. options2.sources = {
  8738. positiveX: "jt3dSDK/imgs/skybox/02/px.jpg",
  8739. negativeX: "jt3dSDK/imgs/skybox/02/nx.jpg",
  8740. positiveY: "jt3dSDK/imgs/skybox/02/py.jpg",
  8741. negativeY: "jt3dSDK/imgs/skybox/02/ny.jpg",
  8742. positiveZ: "jt3dSDK/imgs/skybox/02/pz.jpg",
  8743. negativeZ: "jt3dSDK/imgs/skybox/02/nz.jpg"
  8744. };
  8745. break;
  8746. case "\u84DD\u5929":
  8747. options2.sources = {
  8748. positiveX: "jt3dSDK/imgs/skybox/03/px.jpg",
  8749. negativeX: "jt3dSDK/imgs/skybox/03/nx.jpg",
  8750. positiveY: "jt3dSDK/imgs/skybox/03/py.jpg",
  8751. negativeY: "jt3dSDK/imgs/skybox/03/ny.jpg",
  8752. positiveZ: "jt3dSDK/imgs/skybox/03/pz.jpg",
  8753. negativeZ: "jt3dSDK/imgs/skybox/03/nz.jpg"
  8754. };
  8755. break;
  8756. case "\u7D2B\u8272\u661F\u7A7A":
  8757. options2.sources = {
  8758. positiveX: "jt3dSDK/imgs/skybox/04/px.jpg",
  8759. negativeX: "jt3dSDK/imgs/skybox/04/nx.jpg",
  8760. positiveY: "jt3dSDK/imgs/skybox/04/py.jpg",
  8761. negativeY: "jt3dSDK/imgs/skybox/04/ny.jpg",
  8762. positiveZ: "jt3dSDK/imgs/skybox/04/pz.jpg",
  8763. negativeZ: "jt3dSDK/imgs/skybox/04/nz.jpg"
  8764. };
  8765. break;
  8766. case "\u84DD\u8272\u661F\u7A7A":
  8767. options2.sources = {
  8768. positiveX: "jt3dSDK/imgs/skybox/05/px.jpg",
  8769. negativeX: "jt3dSDK/imgs/skybox/05/nx.jpg",
  8770. positiveY: "jt3dSDK/imgs/skybox/05/py.jpg",
  8771. negativeY: "jt3dSDK/imgs/skybox/05/ny.jpg",
  8772. positiveZ: "jt3dSDK/imgs/skybox/05/pz.jpg",
  8773. negativeZ: "jt3dSDK/imgs/skybox/05/nz.jpg"
  8774. };
  8775. break;
  8776. }
  8777. } else if (!Cesium.defined(options2.sources.positiveX) || !Cesium.defined(options2.sources.negativeX) || !Cesium.defined(options2.sources.positiveY) || !Cesium.defined(options2.sources.negativeY) || !Cesium.defined(options2.sources.positiveZ) || !Cesium.defined(options2.sources.negativeZ)) {
  8778. throw new Cesium.DeveloperError(
  8779. "options.sources is required and must have positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ properties."
  8780. );
  8781. }
  8782. let _self = this;
  8783. let groundSkyBox = new SkyBoxOnGround({
  8784. sources: options2.sources,
  8785. show: true
  8786. });
  8787. _self._viewer.scene.postRender.addEventListener(() => {
  8788. var e = _self._viewer.camera.position;
  8789. if (Cesium.Cartographic.fromCartesian(e).height < options2.height) {
  8790. _self._viewer.scene.skyBox = groundSkyBox;
  8791. } else {
  8792. _self._viewer.scene.skyBox = _self._defaultSkyBox;
  8793. }
  8794. });
  8795. }
  8796. });
  8797. class ParticleSystem {
  8798. constructor(viewer2) {
  8799. if (!viewer2)
  8800. throw new DeveloperError("no viewer object!");
  8801. this.viewer = viewer2;
  8802. }
  8803. }
  8804. Object.assign(ParticleSystem.prototype, {
  8805. createParticleFire: function(coordinates) {
  8806. this.viewer.clock.shouldAnimate = true;
  8807. var position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
  8808. var entity = this.viewer.entities.add({
  8809. position: position2
  8810. });
  8811. function computeModelMatrix(entity2, time) {
  8812. var position3 = Cesium.Property.getValueOrUndefined(entity2.position);
  8813. var modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position3);
  8814. return modelMatrix;
  8815. }
  8816. var viewModel = {
  8817. startScale: 3,
  8818. endScale: 1.5,
  8819. minimumParticleLife: 1.5,
  8820. maximumParticleLife: 1.8,
  8821. minimumSpeed: 7,
  8822. maximumSpeed: 9,
  8823. particleSize: 2,
  8824. emissionRate: 200
  8825. };
  8826. var primitive = this.viewer.scene.primitives.add(
  8827. new Cesium.ParticleSystem({
  8828. image: "jt3dSDK/imgs/particlesystem/fire.png",
  8829. imageSize: new Cesium.Cartesian2(viewModel.particleSize, viewModel.particleSize),
  8830. startColor: new Cesium.Color(1, 1, 1, 1),
  8831. endColor: new Cesium.Color(0.5, 0, 0, 0),
  8832. startScale: viewModel.startScale,
  8833. endScale: viewModel.endScale,
  8834. minimumParticleLife: viewModel.minimumParticleLife,
  8835. maximumParticleLife: viewModel.maximumParticleLife,
  8836. minimumSpeed: viewModel.minimumSpeed,
  8837. maximumSpeed: viewModel.maximumSpeed,
  8838. emissionRate: viewModel.emissionRate,
  8839. lifetime: 16,
  8840. loop: true,
  8841. sizeInMeters: true,
  8842. emitter: new Cesium.ConeEmitter(Cesium.Math.toRadians(45)),
  8843. modelMatrix: computeModelMatrix(entity, Cesium.JulianDate.now())
  8844. })
  8845. );
  8846. entity.remove = function() {
  8847. viewer.entities.remove(entity);
  8848. viewer.scene.primitives.remove(primitive);
  8849. };
  8850. return entity;
  8851. },
  8852. createParticleWater: function(coordinates) {
  8853. let viewer2 = this.viewer;
  8854. this.viewer.clock.shouldAnimate = true;
  8855. var position2 = Cesium.Cartesian3.fromDegrees(coordinates[0], coordinates[1], coordinates[2] || 0);
  8856. var entity = this.viewer.entities.add({
  8857. position: position2
  8858. });
  8859. function computeModelMatrix(entity2, time) {
  8860. return entity2.computeModelMatrix(time, new Cesium.Matrix4());
  8861. }
  8862. function computeEmitterModelMatrix() {
  8863. let hpr = Cesium.HeadingPitchRoll.fromDegrees(viewModel.heading, viewModel.pitch, viewModel.roll);
  8864. let trs = new Cesium.TranslationRotationScale();
  8865. trs.translation = Cesium.Cartesian3.fromElements(0, 0, 1);
  8866. trs.rotation = Cesium.Quaternion.fromHeadingPitchRoll(hpr);
  8867. let Matrix42 = Cesium.Matrix4.fromTranslationRotationScale(trs);
  8868. return Matrix42;
  8869. }
  8870. function updateCallback(p, dt2) {
  8871. var gravityScratch = new Cesium.Cartesian3();
  8872. var position3 = p.position;
  8873. Cesium.Cartesian3.normalize(position3, gravityScratch);
  8874. Cesium.Cartesian3.multiplyByScalar(gravityScratch, viewModel.gravity * dt2, gravityScratch);
  8875. p.velocity = Cesium.Cartesian3.add(p.velocity, gravityScratch, p.velocity);
  8876. }
  8877. function update(scene, time) {
  8878. waterParticleSystem.modelMatrix = computeModelMatrix(entity, time);
  8879. waterParticleSystem.emitterModelMatrix = computeEmitterModelMatrix();
  8880. }
  8881. viewer2.scene.preUpdate.addEventListener(update);
  8882. var viewModel = {
  8883. startScale: 1,
  8884. endScale: 7,
  8885. minimumParticleLife: 6,
  8886. maximumParticleLife: 7,
  8887. minimumSpeed: 9,
  8888. maximumSpeed: 9.5,
  8889. particleSize: 1,
  8890. emissionRate: 60,
  8891. gravity: -4,
  8892. heading: 110,
  8893. pitch: 30,
  8894. roll: 0
  8895. };
  8896. var waterParticleSystem = new Cesium.ParticleSystem({
  8897. image: "jt3dSDK/imgs/particlesystem/water.png",
  8898. imageSize: new Cesium.Cartesian2(viewModel.particleSize, viewModel.particleSize),
  8899. startColor: new Cesium.Color(1, 1, 1, 0.6),
  8900. endColor: new Cesium.Color(0.8, 0.86, 1, 0.4),
  8901. startScale: viewModel.startScale,
  8902. endScale: viewModel.endScale,
  8903. minimumParticleLife: viewModel.minimumParticleLife,
  8904. maximumParticleLife: viewModel.maximumParticleLife,
  8905. minimumSpeed: viewModel.minimumSpeed,
  8906. maximumSpeed: viewModel.maximumSpeed,
  8907. emissionRate: viewModel.emissionRate,
  8908. sizeInMeters: true,
  8909. emitter: new Cesium.CircleEmitter(0.2),
  8910. modelMatrix: computeModelMatrix(entity),
  8911. emitterModelMatrix: computeEmitterModelMatrix(),
  8912. updateCallback
  8913. });
  8914. viewer2.scene.primitives.add(waterParticleSystem);
  8915. entity.remove = function() {
  8916. viewer2.entities.remove(entity);
  8917. viewer2.scene.primitives.remove(waterParticleSystem);
  8918. };
  8919. return entity;
  8920. }
  8921. });
  8922. let SceneEffects = {
  8923. Weather,
  8924. SkyBox,
  8925. ParticleSystem
  8926. };
  8927. class ImageLayerSplit {
  8928. constructor(viewer2) {
  8929. if (!viewer2)
  8930. throw new Cesium.DeveloperError("no viewer object!");
  8931. this._viewer = viewer2;
  8932. }
  8933. }
  8934. Object.assign(ImageLayerSplit.prototype, {
  8935. initSplit() {
  8936. let _self = this;
  8937. this.viewer = this._viewer;
  8938. let sliderDiv = document.getElementById("image_slider");
  8939. if (sliderDiv == null) {
  8940. sliderDiv = document.createElement("div");
  8941. sliderDiv.id = "image_slider";
  8942. sliderDiv.style.position = "absolute";
  8943. sliderDiv.style.left = "50%";
  8944. sliderDiv.style.top = "0px";
  8945. sliderDiv.style.backgroundColor = "#d3d3d3";
  8946. sliderDiv.style.width = "5px";
  8947. sliderDiv.style.height = "100%";
  8948. sliderDiv.style.zIndex = "9999";
  8949. sliderDiv.onmouseover = function() {
  8950. this.style.cursor = "ew-resize";
  8951. };
  8952. document.body.appendChild(sliderDiv);
  8953. }
  8954. this.slider = sliderDiv;
  8955. viewer.scene.splitPosition = this.slider.offsetLeft / this.slider.parentElement.offsetWidth;
  8956. if (this.handler) {
  8957. this.handler.destroy();
  8958. this.handler = null;
  8959. }
  8960. this.handler = new Cesium.ScreenSpaceEventHandler(this.slider);
  8961. var moveActive = false;
  8962. function move(movement) {
  8963. if (!moveActive) {
  8964. return;
  8965. }
  8966. var relativeOffset = movement.endPosition.x;
  8967. var splitPosition = (_self.slider.offsetLeft + relativeOffset) / _self.slider.parentElement.offsetWidth;
  8968. _self.slider.style.left = `${100 * splitPosition}%`;
  8969. viewer.scene.splitPosition = splitPosition;
  8970. }
  8971. this.handler.setInputAction(function() {
  8972. moveActive = true;
  8973. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  8974. this.handler.setInputAction(function() {
  8975. moveActive = true;
  8976. }, Cesium.ScreenSpaceEventType.PINCH_START);
  8977. this.handler.setInputAction(move, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  8978. this.handler.setInputAction(move, Cesium.ScreenSpaceEventType.PINCH_MOVE);
  8979. this.handler.setInputAction(function() {
  8980. moveActive = false;
  8981. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  8982. this.handler.setInputAction(function() {
  8983. moveActive = false;
  8984. }, Cesium.ScreenSpaceEventType.PINCH_END);
  8985. },
  8986. addSplitLayer(earthAtLeft, earthAtRight) {
  8987. if (this.earthAtLeft) {
  8988. this._viewer.imageryLayers.remove(this.earthAtLeft);
  8989. }
  8990. if (this.earthAtRight) {
  8991. this._viewer.imageryLayers.remove(this.earthAtRight);
  8992. }
  8993. this.earthAtLeft = earthAtLeft;
  8994. this.earthAtRight = earthAtRight;
  8995. this.earthAtLeft.splitDirection = Cesium.SplitDirection.LEFT;
  8996. this.earthAtRight.splitDirection = Cesium.SplitDirection.RIGHT;
  8997. },
  8998. removeSplitLayer() {
  8999. document.body.removeChild(this.slider);
  9000. if (this.earthAtLeft) {
  9001. this._viewer.imageryLayers.remove(this.earthAtLeft);
  9002. }
  9003. if (this.earthAtRight) {
  9004. this._viewer.imageryLayers.remove(this.earthAtRight);
  9005. }
  9006. }
  9007. });
  9008. class ViewerSplitScreen {
  9009. constructor() {
  9010. }
  9011. }
  9012. Object.assign(ViewerSplitScreen.prototype, {
  9013. initHandler(viewer1, viewer2) {
  9014. var _self = this;
  9015. if (_self.handler1 && _self.handler1.getInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE)) {
  9016. return;
  9017. }
  9018. _self.handler1 = new Cesium.ScreenSpaceEventHandler(viewer1.scene.canvas);
  9019. _self.handler2 = new Cesium.ScreenSpaceEventHandler(viewer2.scene.canvas);
  9020. _self.handler1.setInputAction(function(movement) {
  9021. var _camerca = viewer1.camera;
  9022. viewer2.camera.setView({
  9023. destination: _camerca.position,
  9024. orientation: {
  9025. direction: _camerca._direction,
  9026. up: _camerca.up,
  9027. heading: _camerca.heading,
  9028. pitch: _camerca.pitch,
  9029. roll: _camerca.roll
  9030. }
  9031. });
  9032. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  9033. _self.handler1.setInputAction(function(movement) {
  9034. var _camerca = viewer1.camera;
  9035. viewer2.camera.setView({
  9036. destination: _camerca.position,
  9037. orientation: {
  9038. direction: _camerca._direction,
  9039. up: _camerca.up,
  9040. heading: _camerca.heading,
  9041. pitch: _camerca.pitch,
  9042. roll: _camerca.roll
  9043. }
  9044. });
  9045. }, Cesium.ScreenSpaceEventType.WHEEL);
  9046. _self.handler2.setInputAction(function(movement) {
  9047. var _camerca = viewer2.camera;
  9048. viewer1.camera.setView({
  9049. destination: _camerca.position,
  9050. orientation: {
  9051. direction: _camerca._direction,
  9052. up: _camerca.up,
  9053. heading: _camerca.heading,
  9054. pitch: _camerca.pitch,
  9055. roll: _camerca.roll
  9056. }
  9057. });
  9058. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  9059. _self.handler2.setInputAction(function(movement) {
  9060. var _camerca = viewer2.camera;
  9061. viewer1.camera.setView({
  9062. destination: _camerca.position,
  9063. orientation: {
  9064. direction: _camerca._direction,
  9065. up: _camerca.up,
  9066. heading: _camerca.heading,
  9067. pitch: _camerca.pitch,
  9068. roll: _camerca.roll
  9069. }
  9070. });
  9071. }, Cesium.ScreenSpaceEventType.WHEEL);
  9072. },
  9073. clearHandler() {
  9074. var _self = this;
  9075. if (_self.handler1) {
  9076. _self.handler1.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  9077. _self.handler1.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL);
  9078. }
  9079. if (_self.handler2) {
  9080. _self.handler2.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  9081. _self.handler2.removeInputAction(Cesium.ScreenSpaceEventType.WHEEL);
  9082. }
  9083. }
  9084. });
  9085. let SceneControl = {
  9086. ImageLayerSplit,
  9087. ViewerSplitScreen
  9088. };
  9089. class TrackRoam {
  9090. constructor(viewer2) {
  9091. if (!viewer2)
  9092. throw new Cesium.DeveloperError("no viewer object!");
  9093. this._viewer = viewer2;
  9094. this._draw3DObj = null;
  9095. }
  9096. _startFly(pathsData, options2) {
  9097. var _self = this;
  9098. options2 = options2 || {};
  9099. options2.time = Cesium.defaultValue(options2.time, 360);
  9100. options2.isPathShow = Cesium.defaultValue(options2.isPathShow, true);
  9101. options2.height = Cesium.defaultValue(options2.height, 5);
  9102. options2.role = Cesium.defaultValue(options2.role, 1);
  9103. this.url = options2.modelUrl;
  9104. this.time = options2.time;
  9105. this.isPathShow = options2.isPathShow;
  9106. this.height = options2.height;
  9107. this.role = options2.role;
  9108. _self.clearFlyPaths();
  9109. _self._viewer.camera.setView({
  9110. destination: pathsData.position,
  9111. orientation: pathsData.orientation
  9112. });
  9113. setTimeout(function() {
  9114. executeFly3D();
  9115. }, 200);
  9116. function executeFly3D() {
  9117. if (pathsData && pathsData.geometry) {
  9118. var positionA = pathsData.geometry.coordinates;
  9119. let positions = positionA.map((point2) => {
  9120. return Cesium.Cartesian3.fromDegrees(point2.lng, point2.lat, point2.height);
  9121. });
  9122. let distance2 = [];
  9123. for (let i2 = 0; i2 < positions.length - 1; i2++) {
  9124. let dis = Cesium.Cartesian3.distance(positions[i2], positions[i2 + 1]);
  9125. distance2.push(dis);
  9126. }
  9127. let times = [Cesium.JulianDate.fromDate(new Date())];
  9128. times.push(Cesium.JulianDate.addSeconds(times[0], _self.time, new Cesium.JulianDate()));
  9129. for (let i2 = 1; i2 < positions.length - 1; i2++) {
  9130. let s = Cesium.JulianDate.addSeconds(times[i2], _self.time * (distance2[i2] / distance2[0]), new Cesium.JulianDate());
  9131. times.push(s);
  9132. }
  9133. let oriSamples = new Cesium.SampledProperty(Cesium.Cartesian3);
  9134. oriSamples.addSamples(times, positions);
  9135. let startTime = times[0];
  9136. let stopTime = times[times.length - 1];
  9137. _self._viewer.clock.startTime = startTime.clone();
  9138. _self._viewer.clock.stopTime = stopTime.clone();
  9139. _self._viewer.clock.currentTime = startTime.clone();
  9140. _self._viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
  9141. _self._viewer.clock.multiplier = 10;
  9142. let timeOfResolution = 6;
  9143. let samplesNum = Math.floor(
  9144. Cesium.JulianDate.secondsDifference(stopTime, startTime) / timeOfResolution
  9145. );
  9146. let sampledPositions = [];
  9147. let sampledTimes = [];
  9148. for (let i2 = 0; i2 < samplesNum + 1; i2++) {
  9149. let sampleTime = Cesium.JulianDate.addSeconds(
  9150. startTime,
  9151. i2 * timeOfResolution,
  9152. new Cesium.JulianDate()
  9153. );
  9154. let tmpPos = oriSamples.getValue(sampleTime);
  9155. sampledPositions.push(Cesium.Cartographic.fromCartesian(tmpPos));
  9156. sampledTimes.push(sampleTime);
  9157. }
  9158. Cesium.sampleTerrainMostDetailed(
  9159. _self._viewer.terrainProvider,
  9160. sampledPositions
  9161. ).then(() => {
  9162. let carPositionProperty = new Cesium.SampledPositionProperty();
  9163. for (let i2 = 0; i2 < sampledPositions.length; i2++) {
  9164. sampledPositions[i2].height = sampledPositions[i2].height + _self.height;
  9165. }
  9166. for (let i2 = 0; i2 < samplesNum + 1; i2++) {
  9167. carPositionProperty.addSample(
  9168. sampledTimes[i2],
  9169. Cesium.Ellipsoid.WGS84.cartographicToCartesian(sampledPositions[i2])
  9170. );
  9171. }
  9172. var position2 = carPositionProperty;
  9173. _self.entityFly = _self._viewer.entities.add({
  9174. availability: new Cesium.TimeIntervalCollection([
  9175. new Cesium.TimeInterval({
  9176. start: startTime,
  9177. stop: stopTime
  9178. })
  9179. ]),
  9180. position: position2,
  9181. orientation: new Cesium.VelocityOrientationProperty(position2),
  9182. point: {
  9183. color: Cesium.Color.RED,
  9184. outlineColor: Cesium.Color.WHITE,
  9185. outlineWidth: 2,
  9186. pixelSize: 10
  9187. },
  9188. path: {
  9189. show: _self.isPathShow,
  9190. resolution: 1,
  9191. material: new Cesium.PolylineGlowMaterialProperty({
  9192. glowPower: 0.1,
  9193. color: Cesium.Color.YELLOW
  9194. }),
  9195. width: 10
  9196. }
  9197. });
  9198. if (_self.role == 0)
  9199. ;
  9200. else if (_self.role == 1) {
  9201. _self._viewer.trackedEntity = _self.entityFly;
  9202. } else if (_self.role == 2) {
  9203. _self._viewer.trackedEntity = _self.entityFly;
  9204. let exection = function TimeExecution() {
  9205. if (_self._viewer.clock.shouldAnimate === true) {
  9206. let center2 = _self.entity.position.getValue(
  9207. _self._viewer.clock.currentTime
  9208. );
  9209. let orientation = _self.entity.orientation.getValue(
  9210. _self._viewer.clock.currentTime
  9211. );
  9212. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(center2);
  9213. transform3 = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromQuaternion(orientation), center2);
  9214. _self._viewer.camera.lookAtTransform(transform3, new Cesium.Cartesian3(-50, 0, 250));
  9215. }
  9216. };
  9217. _self._viewer.clock.onTick.addEventListener(exection);
  9218. } else if (_self.role == 3) {
  9219. _self._viewer.trackedEntity = _self.entityFly;
  9220. let exection = function TimeExecution() {
  9221. if (_self._viewer.clock.shouldAnimate === true) {
  9222. let center2 = _self.entity.position.getValue(
  9223. _self._viewer.clock.currentTime
  9224. );
  9225. _self._viewer.camera.lookAt(center2, new Cesium.Cartesian3(0, 0, 1e3));
  9226. }
  9227. };
  9228. _self._viewer.clock.onTick.addEventListener(exection);
  9229. }
  9230. });
  9231. } else {
  9232. return;
  9233. }
  9234. }
  9235. }
  9236. }
  9237. Object.assign(TrackRoam.prototype, {
  9238. drawFlyPaths(coordinates, options2) {
  9239. return new Promise((resolve2, reject2) => {
  9240. let _self = this;
  9241. _self.clearFlyPaths();
  9242. let position2 = _self._viewer.camera.position;
  9243. let heading = _self._viewer.camera.heading;
  9244. let pitch = _self._viewer.camera.pitch;
  9245. let roll = _self._viewer.camera.roll;
  9246. var pathsData = {
  9247. "orientation": {
  9248. "heading": heading,
  9249. "pitch": pitch,
  9250. "roll": roll
  9251. },
  9252. "position": position2,
  9253. "clampToGround": true,
  9254. "geometry": {
  9255. "type": "LineString",
  9256. "coordinates": coordinates
  9257. }
  9258. };
  9259. _self._draw3DObj = pathsData;
  9260. resolve2(true);
  9261. });
  9262. },
  9263. clearFlyPaths() {
  9264. this._draw3DObj = null;
  9265. this._viewer.trackedEntity = void 0;
  9266. this._viewer.entities.remove(this.entityFly);
  9267. },
  9268. startFly(options2, callError) {
  9269. if (this._draw3DObj) {
  9270. this._startFly(this._draw3DObj, options2);
  9271. } else {
  9272. if (callError)
  9273. callError("\u6F2B\u6E38\u8DEF\u7EBF\u4E0D\u5B58\u5728");
  9274. }
  9275. },
  9276. pauseFly() {
  9277. var clockViewModel = this._viewer.clockViewModel;
  9278. if (clockViewModel.shouldAnimate) {
  9279. clockViewModel.shouldAnimate = false;
  9280. } else if (this._viewer.clockViewModel.canAnimate) {
  9281. clockViewModel.shouldAnimate = true;
  9282. }
  9283. },
  9284. forwardFly() {
  9285. var clockViewModel = this._viewer.clockViewModel;
  9286. var multiplier = clockViewModel.multiplier;
  9287. if (multiplier < 0) {
  9288. clockViewModel.multiplier = -multiplier;
  9289. }
  9290. clockViewModel.shouldAnimate = true;
  9291. },
  9292. backwardsFly() {
  9293. var clockViewModel = this._viewer.clockViewModel;
  9294. var multiplier = clockViewModel.multiplier;
  9295. if (multiplier > 0) {
  9296. clockViewModel.multiplier = -multiplier;
  9297. }
  9298. clockViewModel.shouldAnimate = true;
  9299. },
  9300. outFly() {
  9301. var start2 = Cesium.JulianDate.fromDate(new Date());
  9302. this._viewer.clock.startTime = start2.clone();
  9303. var stop = Cesium.JulianDate.addSeconds(start2, 3e8, new Cesium.JulianDate());
  9304. this._viewer.clock.stopTime = stop.clone();
  9305. this.clearFlyPaths();
  9306. }
  9307. });
  9308. class Roaming {
  9309. constructor(viewer2, positions, options2) {
  9310. if (!viewer2)
  9311. throw new Cesium.DeveloperError("no viewer object!");
  9312. if (!positions)
  9313. throw new Cesium.DeveloperError("no positions Array!");
  9314. this.viewer = viewer2;
  9315. this.entity = void 0;
  9316. options2 = options2 || {};
  9317. options2.time = Cesium.defaultValue(options2.time, 360);
  9318. options2.speed = Cesium.defaultValue(options2.speed, 10);
  9319. options2.isPathShow = Cesium.defaultValue(options2.isPathShow, true);
  9320. options2.height = Cesium.defaultValue(options2.height, 5);
  9321. options2.role = Cesium.defaultValue(options2.role, 1);
  9322. options2.followedX = Cesium.defaultValue(options2.followedX, 50);
  9323. options2.followedZ = Cesium.defaultValue(options2.followedZ, 10);
  9324. this.time = options2.time;
  9325. this.speed = options2.speed;
  9326. this.isPathShow = options2.isPathShow;
  9327. this.height = options2.height;
  9328. this.role = options2.role;
  9329. this.followedX = options2.followedX;
  9330. this.followedZ = options2.followedZ;
  9331. this.model = options2.model;
  9332. this.billboard = options2.billboard;
  9333. this.point = options2.point;
  9334. this.label = options2.label;
  9335. this.property = this.ComputeRoamingLineProperty(positions, this.time);
  9336. }
  9337. ComputeRoamingLineProperty(Lines, time) {
  9338. let positions = [];
  9339. if (Lines[0] instanceof Cesium.Cartesian3) {
  9340. positions = Lines;
  9341. } else {
  9342. positions = Lines.map((point2) => {
  9343. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  9344. });
  9345. }
  9346. let distance2 = [];
  9347. for (let i2 = 0; i2 < positions.length - 1; i2++) {
  9348. let dis = Cesium.Cartesian3.distance(positions[i2], positions[i2 + 1]);
  9349. distance2.push(dis);
  9350. }
  9351. let times = [Cesium.JulianDate.fromDate(new Date())];
  9352. times.push(Cesium.JulianDate.addSeconds(times[0], time, new Cesium.JulianDate()));
  9353. for (let i2 = 1; i2 < positions.length - 1; i2++) {
  9354. let s = Cesium.JulianDate.addSeconds(times[i2], time * (distance2[i2] / distance2[0]), new Cesium.JulianDate());
  9355. times.push(s);
  9356. }
  9357. let oriSamples = new Cesium.SampledProperty(Cesium.Cartesian3);
  9358. oriSamples.addSamples(times, positions);
  9359. let startTime = times[0];
  9360. let stopTime = times[times.length - 1];
  9361. this.viewer.clock.startTime = startTime.clone();
  9362. this.viewer.clock.stopTime = stopTime.clone();
  9363. this.viewer.clock.currentTime = startTime.clone();
  9364. this.viewer.clock.clockRange = Cesium.ClockRange.LOOP_STOP;
  9365. this.viewer.clock.multiplier = this.speed;
  9366. let timeOfResolution = 6;
  9367. let samplesNum = Math.floor(
  9368. Cesium.JulianDate.secondsDifference(stopTime, startTime) / timeOfResolution
  9369. );
  9370. let sampledPositions = [];
  9371. let sampledTimes = [];
  9372. for (let i2 = 0; i2 < samplesNum + 1; i2++) {
  9373. let sampleTime = Cesium.JulianDate.addSeconds(
  9374. startTime,
  9375. i2 * timeOfResolution,
  9376. new Cesium.JulianDate()
  9377. );
  9378. let tmpPos = oriSamples.getValue(sampleTime);
  9379. sampledPositions.push(Cesium.Cartographic.fromCartesian(tmpPos));
  9380. sampledTimes.push(sampleTime);
  9381. }
  9382. Cesium.sampleTerrainMostDetailed(
  9383. this.viewer.terrainProvider,
  9384. sampledPositions
  9385. ).then((updatedPositions) => {
  9386. let carPositionProperty = new Cesium.SampledPositionProperty();
  9387. for (let i2 = 0; i2 < sampledPositions.length; i2++) {
  9388. sampledPositions[i2].height = sampledPositions[i2].height + this.height;
  9389. }
  9390. for (let i2 = 0; i2 < samplesNum + 1; i2++) {
  9391. carPositionProperty.addSample(
  9392. sampledTimes[i2],
  9393. Cesium.Ellipsoid.WGS84.cartographicToCartesian(sampledPositions[i2])
  9394. );
  9395. }
  9396. var position2 = carPositionProperty;
  9397. this.InitRoaming(position2, startTime, stopTime, this.isPathShow);
  9398. });
  9399. }
  9400. InitRoaming(position2, start2, stop, isPathShow) {
  9401. this.entity = this.viewer.entities.add({
  9402. availability: new Cesium.TimeIntervalCollection([new Cesium.TimeInterval({
  9403. start: start2,
  9404. stop
  9405. })]),
  9406. position: position2,
  9407. orientation: new Cesium.VelocityOrientationProperty(position2),
  9408. path: {
  9409. resolution: 1,
  9410. material: new Cesium.PolylineGlowMaterialProperty({
  9411. glowPower: 0.1,
  9412. color: Cesium.Color.YELLOW
  9413. }),
  9414. width: 10,
  9415. show: isPathShow
  9416. }
  9417. });
  9418. if (this.model) {
  9419. let model = this.model;
  9420. this.entity.model = {
  9421. uri: model.url,
  9422. minimumPixelSize: 64,
  9423. maximumSize: 128,
  9424. maximumScale: 200,
  9425. show: true,
  9426. silhouetteColor: Cesium.Color.WHITE,
  9427. debugWireframe: false,
  9428. debugShowBoundingVolume: false,
  9429. scale: 20,
  9430. runAnimations: true
  9431. };
  9432. } else if (this.billboard) {
  9433. let billboard = this.billboard;
  9434. billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
  9435. this.entity.billboard = {
  9436. image: billboard.imgUrl,
  9437. show: true,
  9438. width: 30,
  9439. scale: 1,
  9440. height: 30,
  9441. pixelOffset: new Cesium.Cartesian2(0, -14)
  9442. };
  9443. } else {
  9444. let point2 = {};
  9445. if (this.point) {
  9446. point2 = this.point;
  9447. }
  9448. point2.pixelSize = Cesium.defaultValue(point2.pixelSize, 10);
  9449. if (point2.color) {
  9450. if (point2.color instanceof Array) {
  9451. point2.color = new Cesium.Color(point2.color[0] / 255, point2.color[1] / 255, point2.color[2] / 255, point2.color[3]);
  9452. } else if (typeof point2.color === "string") {
  9453. point2.color = new Cesium.Color.fromCssColorString(point2.color);
  9454. } else {
  9455. point2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  9456. }
  9457. }
  9458. if (point2.outlineColor) {
  9459. if (point2.outlineColor instanceof Array) {
  9460. point2.outlineColor = new Cesium.Color(point2.outlineColor[0] / 255, point2.outlineColor[1] / 255, point2.outlineColor[2] / 255, point2.outlineColor[3]);
  9461. } else if (typeof point2.outlineColor === "string") {
  9462. point2.outlineColor = new Cesium.Color.fromCssColorString(point2.outlineColor);
  9463. } else {
  9464. point2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  9465. }
  9466. }
  9467. point2.outlineWidth = Cesium.defaultValue(point2.outlineWidth, 2);
  9468. this.entity.point = point2;
  9469. }
  9470. if (this.label) {
  9471. let label = this.label;
  9472. label.text = Cesium.defaultValue(label.text, "");
  9473. label.font = Cesium.defaultValue(label.font, "24px Helvetica");
  9474. if (label.fillColor) {
  9475. if (label.fillColor instanceof Array) {
  9476. label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
  9477. } else if (typeof label.fillColor === "string") {
  9478. label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
  9479. } else {
  9480. label.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
  9481. }
  9482. }
  9483. if (label.outlineColor) {
  9484. if (label.outlineColor instanceof Array) {
  9485. label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
  9486. } else if (typeof label.outlineColor === "string") {
  9487. label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
  9488. } else {
  9489. label.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  9490. }
  9491. }
  9492. label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
  9493. label.showBackground = Cesium.defaultValue(label.showBackground, false);
  9494. if (label.backgroundColor) {
  9495. if (label.backgroundColor instanceof Array) {
  9496. label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
  9497. } else if (typeof label.backgroundColor === "string") {
  9498. label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
  9499. } else {
  9500. label.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  9501. }
  9502. }
  9503. label.pixelOffset = Cesium.defaultValue(label.pixelOffset, 0);
  9504. label.scale = Cesium.defaultValue(label.scale, 1);
  9505. label.near = Cesium.defaultValue(label.near, 150);
  9506. label.nearValue = Cesium.defaultValue(label.nearValue, 1);
  9507. label.far = Cesium.defaultValue(label.far, 2400);
  9508. label.farValue = Cesium.defaultValue(label.farValue, 0);
  9509. this.entity.label = {
  9510. text: label.text,
  9511. font: label.font,
  9512. fillColor: label.fillColor,
  9513. outlineColor: label.outlineColor,
  9514. outlineWidth: label.outlineWidth,
  9515. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  9516. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  9517. showBackground: label.showBackground,
  9518. backgroundColor: label.backgroundColor,
  9519. backgroundPadding: new Cesium.Cartesian2(6, 6),
  9520. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  9521. pixelOffset: new Cesium.Cartesian2(0, label.pixelOffset),
  9522. scale: label.scale
  9523. };
  9524. }
  9525. this.entity.position.setInterpolationOptions({
  9526. interpolationDegree: 5,
  9527. interpolationAlgorithm: Cesium.LagrangePolynomialApproximation
  9528. });
  9529. this.initRole(this.role);
  9530. }
  9531. initRole(role) {
  9532. let _self = this;
  9533. if (role == 0) {
  9534. this.viewer.trackedEntity = void 0;
  9535. let len = _self.viewer.clock.onTick.numberOfListeners;
  9536. for (let i2 = 0; i2 < len; i2++) {
  9537. _self.viewer.clock.onTick.removeEventListener(_self.viewer.clock.onTick._listeners[i2]);
  9538. }
  9539. } else if (role == 1) {
  9540. this.viewer.trackedEntity = this.entity;
  9541. let len = _self.viewer.clock.onTick.numberOfListeners;
  9542. for (let i2 = 0; i2 < len; i2++) {
  9543. _self.viewer.clock.onTick.removeEventListener(_self.viewer.clock.onTick._listeners[i2]);
  9544. }
  9545. } else if (role == 2) {
  9546. this.viewer.trackedEntity = this.entity;
  9547. let exection = function TimeExecution() {
  9548. if (_self.viewer.clock.shouldAnimate === true) {
  9549. let center2 = _self.entity.position.getValue(
  9550. _self.viewer.clock.currentTime
  9551. );
  9552. let orientation = _self.entity.orientation.getValue(
  9553. _self.viewer.clock.currentTime
  9554. );
  9555. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(center2);
  9556. transform3 = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromQuaternion(orientation), center2);
  9557. var transformX = _self.followedX || 50;
  9558. var transformZ = _self.followedZ || 10;
  9559. _self.viewer.camera.lookAtTransform(transform3, new Cesium.Cartesian3(transformX, 0, transformZ));
  9560. }
  9561. };
  9562. this.viewer.clock.onTick.addEventListener(exection);
  9563. } else if (role == 3) {
  9564. this.viewer.trackedEntity = this.entity;
  9565. let exection = function TimeExecution() {
  9566. if (_self.viewer.clock.shouldAnimate === true) {
  9567. let center2 = _self.entity.position.getValue(
  9568. _self.viewer.clock.currentTime
  9569. );
  9570. _self.viewer.camera.lookAt(center2, new Cesium.Cartesian3(0, 0, 1e3));
  9571. }
  9572. };
  9573. this.viewer.clock.onTick.addEventListener(exection);
  9574. }
  9575. }
  9576. PauseOrContinue(state) {
  9577. this.viewer.clock.shouldAnimate = state;
  9578. }
  9579. forwardFly() {
  9580. var multiplier = this.viewer.clock.multiplier;
  9581. if (multiplier < 0) {
  9582. this.viewer.clock.multiplier = -multiplier;
  9583. }
  9584. this.viewer.clock.shouldAnimate = true;
  9585. }
  9586. backwardsFly() {
  9587. var multiplier = this.viewer.clock.multiplier;
  9588. if (multiplier > 0) {
  9589. this.viewer.clock.multiplier = -multiplier;
  9590. }
  9591. this.viewer.clock.shouldAnimate = true;
  9592. }
  9593. ChangeRoamingSpeed(value) {
  9594. this.viewer.clock.multiplier = value;
  9595. }
  9596. EndRoaming() {
  9597. if (this.entity !== void 0) {
  9598. this.viewer.entities.remove(this.entity);
  9599. }
  9600. this.viewer.trackedEntity = void 0;
  9601. this.viewer.clock.shouldAnimate = false;
  9602. let len = this.viewer.clock.onTick.numberOfListeners;
  9603. for (let i2 = 0; i2 < len; i2++) {
  9604. this.viewer.clock.onTick.removeEventListener(this.viewer.clock.onTick._listeners[i2]);
  9605. }
  9606. }
  9607. }
  9608. class PointObject {
  9609. constructor(viewer2) {
  9610. if (!viewer2)
  9611. throw new Cesium.DeveloperError("no viewer object!");
  9612. this._viewer = viewer2;
  9613. }
  9614. }
  9615. Object.assign(PointObject.prototype, {
  9616. addLabel(points2, options2) {
  9617. return new Promise((resolve2, reject2) => {
  9618. let _self = this;
  9619. if (!Cesium.defined(points2)) {
  9620. throw new Cesium.DeveloperError("points is required.");
  9621. }
  9622. let position2;
  9623. if (points2 instanceof Cesium.Cartesian3) {
  9624. position2 = points2;
  9625. } else {
  9626. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  9627. }
  9628. options2 = options2 || {};
  9629. options2.id = options2.id || setSessionid$1();
  9630. let label = options2.label || {};
  9631. label.text = Cesium.defaultValue(label.text, "\u91D1\u7530CIM\u4E09\u7EF4\u57FA\u7840\u5E73\u53F0");
  9632. label.font = Cesium.defaultValue(label.font, "24px Helvetica");
  9633. if (label.fillColor instanceof Array) {
  9634. label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
  9635. } else if (typeof label.fillColor === "string") {
  9636. label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
  9637. } else {
  9638. label.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
  9639. }
  9640. if (label.outlineColor instanceof Array) {
  9641. label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
  9642. } else if (typeof label.outlineColor === "string") {
  9643. label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
  9644. } else {
  9645. label.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  9646. }
  9647. label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
  9648. label.showBackground = Cesium.defaultValue(label.showBackground, false);
  9649. if (label.backgroundColor instanceof Array) {
  9650. label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
  9651. } else if (typeof label.backgroundColor === "string") {
  9652. label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
  9653. } else {
  9654. label.backgroundColor = new Cesium.Color.fromCssColorString("#FFF");
  9655. }
  9656. if (label.backgroundPadding) {
  9657. label.backgroundPadding = new Cesium.Cartesian2(label.backgroundPadding, label.backgroundPadding);
  9658. }
  9659. let entity = new Cesium.Entity({
  9660. id: options2.id,
  9661. position: position2,
  9662. label: {
  9663. text: label.text,
  9664. font: label.font,
  9665. fillColor: label.fillColor,
  9666. outlineColor: label.outlineColor,
  9667. outlineWidth: label.outlineWidth,
  9668. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  9669. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  9670. showBackground: label.showBackground,
  9671. backgroundColor: label.backgroundColor,
  9672. backgroundPadding: label.backgroundPadding,
  9673. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  9674. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  9675. }
  9676. });
  9677. if (label.pixelOffset) {
  9678. label.pixelOffset.x = Cesium.defaultValue(label.pixelOffset.x, 0);
  9679. label.pixelOffset.y = Cesium.defaultValue(label.pixelOffset.y, 0);
  9680. entity.label.pixelOffset = new Cesium.Cartesian2(label.pixelOffset.x, label.pixelOffset.y);
  9681. }
  9682. if (label.scaleByDistance) {
  9683. label.scaleByDistance.near = Cesium.defaultValue(label.scaleByDistance.near, 0);
  9684. label.scaleByDistance.nearValue = Cesium.defaultValue(label.scaleByDistance.nearValue, 0);
  9685. label.scaleByDistance.far = Cesium.defaultValue(label.scaleByDistance.far, 1);
  9686. label.scaleByDistance.farValue = Cesium.defaultValue(label.scaleByDistance.farValue, 0);
  9687. entity.label.scaleByDistance = new Cesium.NearFarScalar(label.scaleByDistance.near, label.scaleByDistance.nearValue, label.scaleByDistance.far, label.scaleByDistance.farValue);
  9688. }
  9689. _self._viewer.entities.add(entity);
  9690. resolve2(entity);
  9691. });
  9692. },
  9693. addPoint(points2, options2) {
  9694. return new Promise((resolve2, reject2) => {
  9695. let _self = this;
  9696. if (!Cesium.defined(points2)) {
  9697. throw new Cesium.DeveloperError("points is required.");
  9698. }
  9699. let position2;
  9700. if (points2 instanceof Cesium.Cartesian3) {
  9701. position2 = points2;
  9702. } else {
  9703. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  9704. }
  9705. options2 = options2 || {};
  9706. options2.id = options2.id || setSessionid$1();
  9707. let point2 = options2.point || {};
  9708. point2.pixelSize = Cesium.defaultValue(point2.pixelSize, 10);
  9709. if (point2.color instanceof Array) {
  9710. point2.color = new Cesium.Color(point2.color[0] / 255, point2.color[1] / 255, point2.color[2] / 255, point2.color[3]);
  9711. } else if (typeof point2.color === "string") {
  9712. point2.color = new Cesium.Color.fromCssColorString(point2.color);
  9713. } else {
  9714. point2.color = new Cesium.Color.fromCssColorString("#FFF");
  9715. }
  9716. if (point2.outlineColor instanceof Array) {
  9717. point2.outlineColor = new Cesium.Color(point2.outlineColor[0] / 255, point2.outlineColor[1] / 255, point2.outlineColor[2] / 255, point2.outlineColor[3]);
  9718. } else if (typeof point2.outlineColor === "string") {
  9719. point2.outlineColor = new Cesium.Color.fromCssColorString(point2.outlineColor);
  9720. } else {
  9721. point2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  9722. }
  9723. point2.outlineWidth = Cesium.defaultValue(point2.outlineWidth, 1);
  9724. let entity = new Cesium.Entity({
  9725. id: options2.id,
  9726. position: position2,
  9727. point: {
  9728. pixelSize: point2.pixelSize,
  9729. color: point2.color,
  9730. outlineColor: point2.outlineColor,
  9731. outlineWidth: point2.outlineWidth,
  9732. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
  9733. disableDepthTestDistance: Number.POSITIVE_INFINITY
  9734. }
  9735. });
  9736. if (options2.label) {
  9737. let label = options2.label || {};
  9738. label.text = Cesium.defaultValue(label.text, "");
  9739. label.font = Cesium.defaultValue(label.font, "24px Helvetica");
  9740. if (label.fillColor instanceof Array) {
  9741. label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
  9742. } else if (typeof label.fillColor === "string") {
  9743. label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
  9744. } else {
  9745. label.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
  9746. }
  9747. if (label.outlineColor instanceof Array) {
  9748. label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
  9749. } else if (typeof label.outlineColor === "string") {
  9750. label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
  9751. } else {
  9752. label.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  9753. }
  9754. label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
  9755. label.showBackground = Cesium.defaultValue(label.showBackground, false);
  9756. if (label.backgroundColor instanceof Array) {
  9757. label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
  9758. } else if (typeof label.backgroundColor === "string") {
  9759. label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
  9760. } else {
  9761. label.backgroundColor = new Cesium.Color.fromCssColorString("#FFF");
  9762. }
  9763. if (label.backgroundPadding) {
  9764. label.backgroundPadding = new Cesium.Cartesian2(label.backgroundPadding, label.backgroundPadding);
  9765. }
  9766. entity.label = {
  9767. text: label.text,
  9768. font: label.font,
  9769. fillColor: label.fillColor,
  9770. outlineColor: label.outlineColor,
  9771. outlineWidth: label.outlineWidth,
  9772. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  9773. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  9774. showBackground: label.showBackground,
  9775. backgroundColor: label.backgroundColor,
  9776. backgroundPadding: new Cesium.Cartesian2(6, 6),
  9777. disableDepthTestDistance: Number.POSITIVE_INFINITY
  9778. };
  9779. if (label.scaleByDistance) {
  9780. label.scaleByDistance.near = Cesium.defaultValue(label.scaleByDistance.near, 0);
  9781. label.scaleByDistance.nearValue = Cesium.defaultValue(label.scaleByDistance.nearValue, 0);
  9782. label.scaleByDistance.far = Cesium.defaultValue(label.scaleByDistance.far, 1);
  9783. label.scaleByDistance.farValue = Cesium.defaultValue(label.scaleByDistance.farValue, 0);
  9784. entity.label.scaleByDistance = new Cesium.NearFarScalar(label.scaleByDistance.near, label.scaleByDistance.nearValue, label.scaleByDistance.far, label.scaleByDistance.farValue);
  9785. }
  9786. }
  9787. _self._viewer.entities.add(entity);
  9788. resolve2(entity);
  9789. });
  9790. },
  9791. addBillboard(points2, options2) {
  9792. return new Promise((resolve2, reject2) => {
  9793. if (!Cesium.defined(points2)) {
  9794. throw new Cesium.DeveloperError("points is required.");
  9795. }
  9796. let position2;
  9797. if (points2 instanceof Cesium.Cartesian3) {
  9798. position2 = points2;
  9799. } else {
  9800. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  9801. }
  9802. options2 = options2 || {};
  9803. options2.id = options2.id || setSessionid$1();
  9804. let billboard = options2.billboard || {};
  9805. billboard.image = billboard.imgUrl || "jt3dSDK/imgs/point/point3.png";
  9806. billboard.scale = Cesium.defaultValue(billboard.scale, 1);
  9807. billboard.pixelOffset = Cesium.defaultValue(billboard.pixelOffset, 0);
  9808. let entity = new Cesium.Entity({
  9809. id: options2.id,
  9810. name: "add billboard",
  9811. position: position2,
  9812. billboard: {
  9813. image: billboard.image,
  9814. horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
  9815. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  9816. scale: billboard.scale,
  9817. pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
  9818. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
  9819. disableDepthTestDistance: Number.POSITIVE_INFINITY
  9820. }
  9821. });
  9822. if (billboard.scaleByDistance) {
  9823. billboard.scaleByDistance.near = Cesium.defaultValue(billboard.scaleByDistance.near, 0);
  9824. billboard.scaleByDistance.nearValue = Cesium.defaultValue(billboard.scaleByDistance.nearValue, 0);
  9825. billboard.scaleByDistance.far = Cesium.defaultValue(billboard.scaleByDistance.far, 1);
  9826. billboard.scaleByDistance.farValue = Cesium.defaultValue(billboard.scaleByDistance.farValue, 0);
  9827. entity.billboard.scaleByDistance = new Cesium.NearFarScalar(billboard.scaleByDistance.near, billboard.scaleByDistance.nearValue, billboard.scaleByDistance.far, billboard.scaleByDistance.farValue);
  9828. }
  9829. if (options2.label) {
  9830. let label = options2.label || {};
  9831. label.text = Cesium.defaultValue(label.text, "");
  9832. label.font = Cesium.defaultValue(label.font, "24px Helvetica");
  9833. if (label.fillColor instanceof Array) {
  9834. label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
  9835. } else if (typeof label.fillColor === "string") {
  9836. label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
  9837. } else {
  9838. label.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
  9839. }
  9840. if (label.outlineColor instanceof Array) {
  9841. label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
  9842. } else if (typeof label.outlineColor === "string") {
  9843. label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
  9844. } else {
  9845. label.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  9846. }
  9847. label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
  9848. label.showBackground = Cesium.defaultValue(label.showBackground, false);
  9849. if (label.backgroundColor instanceof Array) {
  9850. label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
  9851. } else if (typeof label.backgroundColor === "string") {
  9852. label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
  9853. } else {
  9854. label.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  9855. }
  9856. if (label.backgroundPadding) {
  9857. label.backgroundPadding = new Cesium.Cartesian2(label.backgroundPadding, label.backgroundPadding);
  9858. }
  9859. entity.label = {
  9860. text: label.text,
  9861. font: label.font,
  9862. fillColor: label.fillColor,
  9863. outlineColor: label.outlineColor,
  9864. outlineWidth: label.outlineWidth,
  9865. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  9866. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  9867. showBackground: label.showBackground,
  9868. backgroundColor: label.backgroundColor,
  9869. backgroundPadding: label.backgroundPadding,
  9870. disableDepthTestDistance: Number.POSITIVE_INFINITY
  9871. };
  9872. if (label.pixelOffset) {
  9873. label.pixelOffset.x = Cesium.defaultValue(label.pixelOffset.x, 0);
  9874. label.pixelOffset.y = Cesium.defaultValue(label.pixelOffset.y, 0);
  9875. entity.label.pixelOffset = new Cesium.Cartesian2(label.pixelOffset.x, label.pixelOffset.y);
  9876. }
  9877. if (label.scaleByDistance) {
  9878. label.scaleByDistance.near = Cesium.defaultValue(label.scaleByDistance.near, 0);
  9879. label.scaleByDistance.nearValue = Cesium.defaultValue(label.scaleByDistance.nearValue, 0);
  9880. label.scaleByDistance.far = Cesium.defaultValue(label.scaleByDistance.far, 1);
  9881. label.scaleByDistance.farValue = Cesium.defaultValue(label.scaleByDistance.farValue, 0);
  9882. entity.label.scaleByDistance = new Cesium.NearFarScalar(label.scaleByDistance.near, label.scaleByDistance.nearValue, label.scaleByDistance.far, label.scaleByDistance.farValue);
  9883. }
  9884. }
  9885. this._viewer.entities.add(entity);
  9886. resolve2(entity);
  9887. });
  9888. },
  9889. addModel: function(points2, options2) {
  9890. let _self = this;
  9891. this._viewer;
  9892. return new Promise((resolve2, reject2) => {
  9893. if (!Cesium.defined(points2)) {
  9894. throw new Cesium.DeveloperError("points is required.");
  9895. }
  9896. let position2;
  9897. if (points2 instanceof Cesium.Cartesian3) {
  9898. position2 = points2;
  9899. } else {
  9900. position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], points2[2] || 0);
  9901. }
  9902. options2 = options2 || {};
  9903. options2.id = options2.id || setSessionid$1();
  9904. let model = options2.model || {};
  9905. model.alpha = Cesium.defaultValue(model.alpha, 1);
  9906. model.heading = Cesium.defaultValue(model.heading, 0);
  9907. model.pitch = Cesium.defaultValue(model.pitch, 0);
  9908. model.roll = Cesium.defaultValue(model.roll, 0);
  9909. var heading = Cesium.Math.toRadians(model.heading);
  9910. var pitch = model.pitch;
  9911. var roll = model.roll;
  9912. new Cesium.HeadingPitchRoll(heading, pitch, roll);
  9913. let entity = new Cesium.Entity({
  9914. id: options2.id,
  9915. position: position2,
  9916. model: {
  9917. uri: model.url,
  9918. incrementallyLoadTextures: true,
  9919. colorBlendMode: Cesium.ColorBlendMode["HIGHLIGHT"],
  9920. colorBlendAmount: 0.1,
  9921. color: Cesium.Color.WHITE.withAlpha(model.alpha),
  9922. imageBasedLightingFactor: new Cesium.Cartesian2(12, 13),
  9923. runAnimations: true,
  9924. show: true,
  9925. debugWireframe: false,
  9926. debugShowBoundingVolume: false,
  9927. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND,
  9928. disableDepthTestDistance: Number.POSITIVE_INFINITY
  9929. }
  9930. });
  9931. if (model.minimumPixelSize) {
  9932. entity.model.minimumPixelSize = model.minimumPixelSize;
  9933. }
  9934. if (model.maximumScale) {
  9935. entity.model.maximumScale = model.maximumScale;
  9936. }
  9937. if (model.silhouetteColor) {
  9938. if (model.silhouetteColor instanceof Array) {
  9939. entity.model.silhouetteColor = new Cesium.Color(model.silhouetteColor[0] / 255, model.silhouetteColor[1] / 255, model.silhouetteColor[2] / 255, model.silhouetteColor[3]);
  9940. } else if (typeof model.silhouetteColor === "string") {
  9941. entity.model.silhouetteColor = new Cesium.Color.fromCssColorString(model.silhouetteColor);
  9942. }
  9943. }
  9944. model.silhouetteSize = Cesium.defaultValue(model.silhouetteSize, 1);
  9945. _self._viewer.entities.add(entity);
  9946. resolve2(entity);
  9947. });
  9948. },
  9949. generatePoint(points2, options2) {
  9950. return new Promise((resolve2, reject2) => {
  9951. let _self = this;
  9952. if (!Cesium.defined(points2)) {
  9953. throw new Cesium.DeveloperError("points is required.");
  9954. }
  9955. options2 = options2 || {};
  9956. options2.id = options2.id || setSessionid$1();
  9957. let point2 = options2.point || {};
  9958. point2.pixelSize = Cesium.defaultValue(point2.pixelSize, 10);
  9959. if (point2.color instanceof Array) {
  9960. point2.color = new Cesium.Color(point2.color[0] / 255, point2.color[1] / 255, point2.color[2] / 255, point2.color[3]);
  9961. } else if (typeof point2.color === "string") {
  9962. point2.color = new Cesium.Color.fromCssColorString(point2.color);
  9963. } else {
  9964. point2.color = new Cesium.Color.fromCssColorString("#FFF");
  9965. }
  9966. if (point2.outlineColor instanceof Array) {
  9967. point2.outlineColor = new Cesium.Color(point2.outlineColor[0] / 255, point2.outlineColor[1] / 255, point2.outlineColor[2] / 255, point2.outlineColor[3]);
  9968. } else if (typeof point2.outlineColor === "string") {
  9969. point2.outlineColor = new Cesium.Color.fromCssColorString(point2.outlineColor);
  9970. } else {
  9971. point2.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  9972. }
  9973. point2.outlineWidth = Cesium.defaultValue(point2.outlineWidth, 1);
  9974. let terrainAltitude = getHeigthByPointsMostDetailed(_self._viewer, [points2]);
  9975. terrainAltitude.then(function(updatedPositions) {
  9976. let position2 = Cesium.Cartesian3.fromDegrees(points2[0], points2[1], updatedPositions[0].height);
  9977. let entity = new Cesium.Entity({
  9978. id: options2.id,
  9979. position: position2,
  9980. point: {
  9981. pixelSize: point2.pixelSize,
  9982. color: point2.color,
  9983. outlineColor: point2.outlineColor,
  9984. outlineWidth: point2.outlineWidth,
  9985. heightReference: Cesium.HeightReference.NONE,
  9986. disableDepthTestDistance: updatedPositions[0].height
  9987. }
  9988. });
  9989. if (options2.label) {
  9990. let label = options2.label || {};
  9991. label.text = Cesium.defaultValue(label.text, "");
  9992. label.font = Cesium.defaultValue(label.font, "24px Helvetica");
  9993. if (label.fillColor instanceof Array) {
  9994. label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
  9995. } else if (typeof label.fillColor === "string") {
  9996. label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
  9997. } else {
  9998. label.fillColor = new Cesium.Color.fromCssColorString("#FFFF00");
  9999. }
  10000. if (label.outlineColor instanceof Array) {
  10001. label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
  10002. } else if (typeof label.outlineColor === "string") {
  10003. label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
  10004. } else {
  10005. label.outlineColor = new Cesium.Color.fromCssColorString("#FFF");
  10006. }
  10007. label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
  10008. label.showBackground = Cesium.defaultValue(label.showBackground, false);
  10009. if (label.backgroundColor instanceof Array) {
  10010. label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
  10011. } else if (typeof label.backgroundColor === "string") {
  10012. label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
  10013. } else {
  10014. label.backgroundColor = new Cesium.Color.fromCssColorString("#FFF");
  10015. }
  10016. label.pixelOffset = Cesium.defaultValue(label.pixelOffset, 0);
  10017. label.scale = Cesium.defaultValue(label.scale, 1);
  10018. entity.label = {
  10019. text: label.text,
  10020. font: label.font,
  10021. fillColor: label.fillColor,
  10022. outlineColor: label.outlineColor,
  10023. outlineWidth: label.outlineWidth,
  10024. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  10025. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  10026. showBackground: label.showBackground,
  10027. backgroundColor: label.backgroundColor,
  10028. backgroundPadding: new Cesium.Cartesian2(6, 6),
  10029. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  10030. pixelOffset: new Cesium.Cartesian2(0, label.pixelOffset),
  10031. scale: label.scale
  10032. };
  10033. }
  10034. _self._viewer.entities.add(entity);
  10035. resolve2(entity);
  10036. });
  10037. });
  10038. },
  10039. addBillboardByGeoJson: function(geoJsonUrl, options2) {
  10040. return new Promise((resolve2, reject2) => {
  10041. let viewer2 = this._viewer;
  10042. if (!Cesium.defined(geoJsonUrl)) {
  10043. throw new Cesium.DeveloperError("geoJsonUrl is required.");
  10044. }
  10045. options2 = options2 || {};
  10046. options2.id = options2.id || setSessionid$1();
  10047. let billboard = options2.billboard || {};
  10048. billboard.imgUrl = Cesium.defaultValue(billboard.imgUrl, "jt3dSDK/imgs/point/point3.png");
  10049. billboard.scale = Cesium.defaultValue(billboard.scale, 1);
  10050. billboard.pixelOffset = Cesium.defaultValue(billboard.pixelOffset, 0);
  10051. let label = options2.label || {};
  10052. label.text = Cesium.defaultValue(label.text, "");
  10053. label.textField = Cesium.defaultValue(label.textField, "");
  10054. label.font = Cesium.defaultValue(label.font, "24px Helvetica");
  10055. if (label.fillColor instanceof Array) {
  10056. label.fillColor = new Cesium.Color(label.fillColor[0] / 255, label.fillColor[1] / 255, label.fillColor[2] / 255, label.fillColor[3]);
  10057. } else if (typeof label.fillColor === "string") {
  10058. label.fillColor = new Cesium.Color.fromCssColorString(label.fillColor);
  10059. } else {
  10060. label.fillColor = new Cesium.Color.fromCssColorString("#ff0000");
  10061. }
  10062. if (label.outlineColor instanceof Array) {
  10063. label.outlineColor = new Cesium.Color(label.outlineColor[0] / 255, label.outlineColor[1] / 255, label.outlineColor[2] / 255, label.outlineColor[3]);
  10064. } else if (typeof label.outlineColor === "string") {
  10065. label.outlineColor = new Cesium.Color.fromCssColorString(label.outlineColor);
  10066. } else {
  10067. label.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10068. }
  10069. label.outlineWidth = Cesium.defaultValue(label.outlineWidth, 1);
  10070. label.showBackground = Cesium.defaultValue(label.showBackground, false);
  10071. if (label.backgroundColor instanceof Array) {
  10072. label.backgroundColor = new Cesium.Color(label.backgroundColor[0] / 255, label.backgroundColor[1] / 255, label.backgroundColor[2] / 255, label.backgroundColor[3]);
  10073. } else if (typeof label.backgroundColor === "string") {
  10074. label.backgroundColor = new Cesium.Color.fromCssColorString(label.backgroundColor);
  10075. } else {
  10076. label.backgroundColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10077. }
  10078. label.pixelOffset = Cesium.defaultValue(label.pixelOffset, 0);
  10079. label.scale = Cesium.defaultValue(label.scale, 1);
  10080. const dataSource = new Cesium.GeoJsonDataSource(options2.id);
  10081. dataSource.load(geoJsonUrl, {
  10082. clampToGround: true
  10083. }).then(function(data) {
  10084. viewer2.dataSources.add(data);
  10085. const entities2 = data.entities.values;
  10086. entities2.forEach((entity) => {
  10087. entity.billboard = {
  10088. image: billboard.imgUrl,
  10089. horizontalOrigin: Cesium.HorizontalOrigin.CENTER,
  10090. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  10091. scale: billboard.scale,
  10092. pixelOffset: new Cesium.Cartesian2(0, billboard.pixelOffset),
  10093. disableDepthTestDistance: Number.POSITIVE_INFINITY
  10094. };
  10095. let labelText = label.text;
  10096. if (entity.properties[label.textField]) {
  10097. labelText = entity.properties[label.textField]._value;
  10098. }
  10099. if (labelText === "") {
  10100. labelText = (i + 1).toString();
  10101. }
  10102. entity.label = {
  10103. text: labelText.toString(),
  10104. font: label.font,
  10105. fillColor: label.fillColor,
  10106. outlineColor: label.outlineColor,
  10107. outlineWidth: label.outlineWidth,
  10108. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  10109. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  10110. showBackground: label.showBackground,
  10111. backgroundColor: label.backgroundColor,
  10112. backgroundPadding: new Cesium.Cartesian2(6, 6),
  10113. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  10114. pixelOffset: new Cesium.Cartesian2(0, label.pixelOffset),
  10115. scale: label.scale
  10116. };
  10117. if (label.scaleByDistance) {
  10118. label.scaleByDistance.near = Cesium.defaultValue(label.scaleByDistance.near, 0);
  10119. label.scaleByDistance.nearValue = Cesium.defaultValue(label.scaleByDistance.nearValue, 0);
  10120. label.scaleByDistance.far = Cesium.defaultValue(label.scaleByDistance.far, 1);
  10121. label.scaleByDistance.farValue = Cesium.defaultValue(label.scaleByDistance.farValue, 0);
  10122. entity.label.scaleByDistance = new Cesium.NearFarScalar(label.scaleByDistance.near, label.scaleByDistance.nearValue, label.scaleByDistance.far, label.scaleByDistance.farValue);
  10123. }
  10124. });
  10125. });
  10126. });
  10127. },
  10128. addGltf: function(options2) {
  10129. let viewer2 = this._viewer;
  10130. return new Promise((resolve2, reject2) => {
  10131. if (!Cesium.defined(options2.points)) {
  10132. resolve2("options.points is required.");
  10133. throw new Cesium.DeveloperError("options.points is required.");
  10134. }
  10135. if (!Cesium.defined(options2.url)) {
  10136. resolve2("options.url is required.");
  10137. throw new Cesium.DeveloperError("options.url is required.");
  10138. }
  10139. options2.id = options2.id || setSessionid$1();
  10140. options2.heading = Cesium.defaultValue(options2.heading, 0);
  10141. options2.pitch = Cesium.defaultValue(options2.pitch, 0);
  10142. options2.roll = Cesium.defaultValue(options2.roll, 0);
  10143. options2.alpha = Cesium.defaultValue(options2.alpha, 1);
  10144. let position2 = void 0;
  10145. if (options2.points instanceof Cesium.Cartesian3) {
  10146. position2 = options2.points;
  10147. } else {
  10148. position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
  10149. }
  10150. var heading = Cesium.Math.toRadians(options2.heading);
  10151. var pitch = options2.pitch;
  10152. var roll = options2.roll;
  10153. var hpr = new Cesium.HeadingPitchRoll(heading, pitch, roll);
  10154. var modelGltf = viewer2.entities.add({
  10155. id: options2.id,
  10156. position: position2,
  10157. orientation: Cesium.Transforms.headingPitchRollQuaternion(position2, hpr),
  10158. model: {
  10159. uri: options2.url,
  10160. incrementallyLoadTextures: true,
  10161. colorBlendMode: Cesium.ColorBlendMode["HIGHLIGHT"],
  10162. colorBlendAmount: 0.1,
  10163. color: Cesium.Color.WHITE.withAlpha(options2.alpha),
  10164. imageBasedLightingFactor: new Cesium.Cartesian2(12, 13),
  10165. runAnimations: true,
  10166. show: true,
  10167. debugWireframe: false,
  10168. debugShowBoundingVolume: false
  10169. }
  10170. });
  10171. if (options2.minimumPixelSize) {
  10172. modelGltf.model.minimumPixelSize = options2.minimumPixelSize;
  10173. }
  10174. if (options2.maximumScale) {
  10175. modelGltf.model.maximumScale = options2.maximumScale;
  10176. }
  10177. if (options2.silhouetteColor) {
  10178. if (options2.silhouetteColor instanceof Array) {
  10179. options2.silhouetteColor = new Cesium.Color(options2.silhouetteColor[0] / 255, options2.silhouetteColor[1] / 255, options2.silhouetteColor[2] / 255, options2.silhouetteColor[3]);
  10180. } else if (typeof options2.silhouetteColor === "string") {
  10181. options2.silhouetteColor = new Cesium.Color.fromCssColorString(options2.silhouetteColor);
  10182. } else {
  10183. options2.silhouetteColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10184. }
  10185. }
  10186. window[options2.id] = modelGltf;
  10187. resolve2(options2.id);
  10188. });
  10189. },
  10190. addModelFromGltf(points2, options2) {
  10191. let viewer2 = this._viewer;
  10192. return new Promise((resolve2, reject2) => {
  10193. if (!Cesium.defined(options2.points)) {
  10194. resolve2("options.points is required.");
  10195. throw new Cesium.DeveloperError("options.points is required.");
  10196. }
  10197. if (!Cesium.defined(options2.url)) {
  10198. resolve2("options.url is required.");
  10199. throw new Cesium.DeveloperError("options.url is required.");
  10200. }
  10201. options2.id = options2.id || setSessionid$1();
  10202. options2.scale = Cesium.defaultValue(options2.scale, 1);
  10203. let position2 = void 0;
  10204. if (options2.points instanceof Cesium.Cartesian3) {
  10205. position2 = options2.points;
  10206. } else {
  10207. position2 = Cesium.Cartesian3.fromDegrees(options2.points[0], options2.points[1], options2.points[2] || 0);
  10208. }
  10209. const modelMatrix = Cesium.Transforms.eastNorthUpToFixedFrame(position2);
  10210. let model = viewer2.scene.primitives.add(
  10211. Cesium.Model.fromGltf({
  10212. show: true,
  10213. url: options2.url,
  10214. modelMatrix,
  10215. lightColor: new Cesium.Cartesian3(10, 10, 10),
  10216. debugWireframe: false,
  10217. debugShowBoundingVolume: false
  10218. })
  10219. );
  10220. model.readyPromise.then(function() {
  10221. var rotationX = Cesium.Matrix4.fromRotationTranslation(Cesium.Matrix3.fromRotationZ(Cesium.Math.toRadians(0)));
  10222. Cesium.Matrix4.multiply(model.modelMatrix, rotationX, model.modelMatrix);
  10223. });
  10224. window[options2.id] = model;
  10225. resolve2(options2.id);
  10226. });
  10227. }
  10228. });
  10229. class PolylineObject {
  10230. constructor(viewer2) {
  10231. if (!viewer2)
  10232. throw new Cesium.DeveloperError("no viewer object!");
  10233. this._viewer = viewer2;
  10234. }
  10235. }
  10236. Object.assign(PolylineObject.prototype, {
  10237. drawPolylineByGeoJson: function(geoJsonUrl, options2) {
  10238. return new Promise((resolve2, reject2) => {
  10239. let viewer2 = this._viewer;
  10240. if (!Cesium.defined(geoJsonUrl)) {
  10241. throw new Cesium.DeveloperError("geoJsonUrl is required.");
  10242. }
  10243. options2 = options2 || {};
  10244. options2.id = options2.id || setSessionid$1();
  10245. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  10246. options2.width = Cesium.defaultValue(options2.width, 3);
  10247. options2.minHeigh = Cesium.defaultValue(options2.minHeigh, 0);
  10248. options2.maxHeigh = Cesium.defaultValue(options2.maxHeigh, 2e8);
  10249. let promise = Cesium.GeoJsonDataSource.load(geoJsonUrl, {
  10250. clampToGround: options2.clampToGround
  10251. });
  10252. promise.then((dataSource) => {
  10253. viewer2.dataSources.add(dataSource);
  10254. dataSource.name = options2.id;
  10255. let entities2 = dataSource.entities.values;
  10256. let distanceDisplayCondition = new Cesium.DistanceDisplayCondition(options2.minHeigh, options2.maxHeigh);
  10257. let material = new PolylineDirectionMaterialProperty(options2);
  10258. for (var i2 = 0; i2 < entities2.length; i2++) {
  10259. var entity = entities2[i2];
  10260. entity.polyline.distanceDisplayCondition = distanceDisplayCondition;
  10261. entity.polyline.material = material;
  10262. entity.polyline.width = options2.width;
  10263. if (options2.clampToGround) {
  10264. entity.polyline.clampToGround = true;
  10265. }
  10266. }
  10267. resolve2(entities2);
  10268. });
  10269. });
  10270. },
  10271. PolylineLinkPulseMaterialProperty: function(points2, options2) {
  10272. return new Promise((resolve2, reject2) => {
  10273. if (!Cesium.defined(points2)) {
  10274. throw new Cesium.DeveloperError("points is required.");
  10275. }
  10276. if (points2.length < 2) {
  10277. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  10278. }
  10279. let positions = points2.map((point2) => {
  10280. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10281. });
  10282. options2 = options2 || {};
  10283. options2.id = options2.id || setSessionid$1();
  10284. options2.width = options2.width || 5;
  10285. let material = new PolylineDirectionMaterialProperty(options2);
  10286. let entity = this._viewer.entities.add({
  10287. id: options2.id,
  10288. name: "Pulse line",
  10289. polyline: {
  10290. positions,
  10291. width: options2.width,
  10292. material,
  10293. clampToGround: true
  10294. }
  10295. });
  10296. resolve2(entity);
  10297. });
  10298. },
  10299. PolylineArrowMaterialProperty: function(points2, options2) {
  10300. return new Promise((resolve2, reject2) => {
  10301. if (!Cesium.defined(points2)) {
  10302. throw new Cesium.DeveloperError("points is required.");
  10303. }
  10304. if (points2.length < 2) {
  10305. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  10306. }
  10307. let positions = points2.map((point2) => {
  10308. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10309. });
  10310. options2 = options2 || {};
  10311. options2.id = options2.id || setSessionid$1();
  10312. options2.width = options2.width || 5;
  10313. let material = new PolylineDirectionMaterialProperty(options2);
  10314. let entity = this._viewer.entities.add({
  10315. id: options2.id,
  10316. name: "Pulse line",
  10317. polyline: {
  10318. positions,
  10319. width: options2.width,
  10320. material,
  10321. clampToGround: true
  10322. }
  10323. });
  10324. resolve2(entity);
  10325. });
  10326. },
  10327. drawGlowingLine(points2, options2) {
  10328. return new Promise((resolve2, reject2) => {
  10329. if (!Cesium.defined(points2)) {
  10330. throw new Cesium.DeveloperError("points is required.");
  10331. }
  10332. if (points2.length < 2) {
  10333. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  10334. }
  10335. let positions = points2.map((point2) => {
  10336. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10337. });
  10338. options2 = options2 || {};
  10339. options2.id = options2.id || setSessionid$1();
  10340. if (options2.color) {
  10341. if (options2.color instanceof Array) {
  10342. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  10343. } else if (typeof options2.color === "string") {
  10344. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  10345. } else {
  10346. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  10347. }
  10348. }
  10349. options2.width = options2.width || 5;
  10350. options2.glowPower = options2.glowPower || 0.25;
  10351. options2.taperPower = options2.taperPower || 1;
  10352. let entity = this._viewer.entities.add({
  10353. id: options2.id,
  10354. name: "Glowing blue line on the surface",
  10355. polyline: {
  10356. clampToGround: true,
  10357. positions,
  10358. width: options2.width,
  10359. followSurface: true,
  10360. material: new Cesium.PolylineGlowMaterialProperty({
  10361. color: options2.color,
  10362. glowPower: options2.glowPower,
  10363. taperPower: options2.taperPower
  10364. })
  10365. }
  10366. });
  10367. resolve2(entity);
  10368. });
  10369. },
  10370. drawSpecifyColorLine(points2, options2) {
  10371. return new Promise((resolve2, reject2) => {
  10372. if (!Cesium.defined(points2)) {
  10373. reject2("points is required.");
  10374. }
  10375. if (points2.length < 2) {
  10376. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  10377. }
  10378. let positions = points2.map((point2) => {
  10379. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10380. });
  10381. options2 = options2 || {};
  10382. options2.id = options2.id || setSessionid$1();
  10383. if (options2.color) {
  10384. if (options2.color instanceof Array) {
  10385. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  10386. } else if (typeof options2.color === "string") {
  10387. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  10388. } else {
  10389. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  10390. }
  10391. }
  10392. options2.width = options2.width || 5;
  10393. let entity = this._viewer.entities.add({
  10394. id: options2.id,
  10395. name: "Red line on the surface",
  10396. polyline: {
  10397. clampToGround: true,
  10398. positions,
  10399. width: options2.width,
  10400. material: options2.color
  10401. }
  10402. });
  10403. resolve2(entity);
  10404. });
  10405. },
  10406. drawSpecifyColorAndOutlineColorLine(points2, options2) {
  10407. return new Promise((resolve2, reject2) => {
  10408. if (!Cesium.defined(points2)) {
  10409. throw new Cesium.DeveloperError("points is required.");
  10410. }
  10411. if (points2.length < 2) {
  10412. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  10413. }
  10414. let positions = points2.map((point2) => {
  10415. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10416. });
  10417. options2 = options2 || {};
  10418. options2.id = options2.id || setSessionid$1();
  10419. if (options2.color) {
  10420. if (options2.color instanceof Array) {
  10421. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  10422. } else if (typeof options2.color === "string") {
  10423. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  10424. } else {
  10425. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  10426. }
  10427. }
  10428. options2.width = options2.width || 5;
  10429. if (options2.outlineColor) {
  10430. if (options2.outlineColor instanceof Array) {
  10431. options2.outlineColor = new Cesium.Color(options2.outlineColor[0] / 255, options2.outlineColor[1] / 255, options2.outlineColor[2] / 255, options2.outlineColor[3]);
  10432. } else if (typeof options2.outlineColor === "string") {
  10433. options2.outlineColor = new Cesium.Color.fromCssColorString(options2.outlineColor);
  10434. } else {
  10435. options2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10436. }
  10437. }
  10438. options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 1);
  10439. let entity = this._viewer.entities.add({
  10440. id: options2.id,
  10441. name: "Orange line with black outline at height and following the surface",
  10442. polyline: {
  10443. clampToGround: true,
  10444. positions,
  10445. width: options2.width,
  10446. material: new Cesium.PolylineOutlineMaterialProperty({
  10447. color: options2.color,
  10448. outlineWidth: options2.outlineWidth,
  10449. outlineColor: options2.outlineColor
  10450. })
  10451. }
  10452. });
  10453. resolve2(entity);
  10454. });
  10455. },
  10456. drawSpecifyColorArrowStaticStateLine(points2, options2) {
  10457. return new Promise((resolve2, reject2) => {
  10458. if (!Cesium.defined(points2)) {
  10459. throw new Cesium.DeveloperError("points is required.");
  10460. }
  10461. if (points2.length < 2) {
  10462. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  10463. }
  10464. let positions = points2.map((point2) => {
  10465. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10466. });
  10467. options2 = options2 || {};
  10468. options2.id = options2.id || setSessionid$1();
  10469. if (options2.color) {
  10470. if (options2.color instanceof Array) {
  10471. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  10472. } else if (typeof options2.color === "string") {
  10473. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  10474. } else {
  10475. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  10476. }
  10477. }
  10478. options2.width = options2.width || 5;
  10479. let entity = this._viewer.entities.add({
  10480. id: options2.id,
  10481. name: "Purple straight arrow at height",
  10482. polyline: {
  10483. clampToGround: true,
  10484. positions,
  10485. width: options2.width,
  10486. followSurface: false,
  10487. material: new Cesium.PolylineArrowMaterialProperty(options2.color)
  10488. }
  10489. });
  10490. resolve2(entity);
  10491. });
  10492. },
  10493. drawDashedLine(points2, options2) {
  10494. return new Promise((resolve2, reject2) => {
  10495. if (!Cesium.defined(points2)) {
  10496. throw new Cesium.DeveloperError("points is required.");
  10497. }
  10498. if (points2.length < 2) {
  10499. reject2("\u7EBF\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C112\u4E2A");
  10500. }
  10501. let positions = points2.map((point2) => {
  10502. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10503. });
  10504. options2 = options2 || {};
  10505. options2.id = options2.id || setSessionid$1();
  10506. if (options2.color) {
  10507. if (options2.color instanceof Array) {
  10508. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  10509. } else if (typeof options2.color === "string") {
  10510. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  10511. } else {
  10512. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  10513. }
  10514. }
  10515. options2.width = options2.width || 5;
  10516. if (options2.gapColor) {
  10517. if (options2.gapColor instanceof Array) {
  10518. options2.gapColor = new Cesium.Color(options2.gapColor[0] / 255, options2.gapColor[1] / 255, options2.gapColor[2] / 255, options2.gapColor[3]);
  10519. } else if (typeof options2.gapColor === "string") {
  10520. options2.gapColor = new Cesium.Color.fromCssColorString(options2.gapColor);
  10521. } else {
  10522. options2.gapColor = new Cesium.Color.fromCssColorString("#FFFF00");
  10523. }
  10524. }
  10525. options2.dashLength = options2.dashLength || 16;
  10526. options2.dashPattern = options2.dashPattern || 255;
  10527. let entity = this._viewer.entities.add({
  10528. id: options2.id,
  10529. name: "CYAN dashed line",
  10530. polyline: {
  10531. clampToGround: true,
  10532. positions,
  10533. width: options2.width,
  10534. material: new Cesium.PolylineDashMaterialProperty({
  10535. color: options2.color,
  10536. gapColor: options2.gapColor,
  10537. dashLength: options2.dashLength,
  10538. dashPattern: options2.dashPattern
  10539. })
  10540. }
  10541. });
  10542. resolve2(entity);
  10543. });
  10544. }
  10545. });
  10546. class PolygonObject {
  10547. constructor(viewer2) {
  10548. if (!viewer2)
  10549. throw new Cesium.DeveloperError("no viewer object!");
  10550. this._viewer = viewer2;
  10551. this._drawEntities = [];
  10552. this._polygonEntity = null;
  10553. }
  10554. }
  10555. Object.assign(PolygonObject.prototype, {
  10556. drawPolygonByGeoJson(geoJsonUrl, options2) {
  10557. return new Promise((resolve2, reject2) => {
  10558. let _self = this;
  10559. if (!Cesium.defined(geoJsonUrl)) {
  10560. throw new Cesium.DeveloperError("geoJsonUrl is required.");
  10561. }
  10562. options2 = options2 || {};
  10563. options2.id = options2.id || setSessionid$1();
  10564. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  10565. options2.color = Cesium.defaultValue(options2.color, "#FF0000");
  10566. options2.outlineColor = Cesium.defaultValue(options2.outlineColor, "#FFFF00");
  10567. options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 1);
  10568. options2.extrudedHeight = Cesium.defaultValue(options2.extrudedHeight, 0);
  10569. let promise = Cesium.GeoJsonDataSource.load(geoJsonUrl, {
  10570. clampToGround: true,
  10571. stroke: Cesium.Color.WHITE,
  10572. strokeWidth: 3,
  10573. fill: Cesium.Color.RED.withAlpha(0.5)
  10574. });
  10575. promise.then((dataSource) => {
  10576. _self._viewer.dataSources.add(dataSource);
  10577. dataSource.name = options2.id;
  10578. let entities2 = dataSource.entities.values;
  10579. for (let index2 = 0; index2 < entities2.length; index2++) {
  10580. let entity = entities2[index2];
  10581. entity.polygon.material = new Cesium.Color.fromCssColorString(color).withAlpha(0.1);
  10582. entity.polygon.extrudedHeight = options2.extrudedHeight;
  10583. entity.polygon.fill = false;
  10584. entity.polygon.outline = false;
  10585. entity.polygon.outlineWidth = options2.outlineWidth;
  10586. entity.polygon.outlineColor = options2.outlineColor;
  10587. entity.polyline = {
  10588. positions: entity.polygon.hierarchy._value.positions,
  10589. width: entity.polygon.outlineWidth,
  10590. material: new Cesium.Color.fromCssColorString(color).withAlpha(0.1)
  10591. };
  10592. if (options2.clampToGround) {
  10593. entity.polyline.clampToGround = true;
  10594. }
  10595. }
  10596. resolve2(entities2);
  10597. });
  10598. });
  10599. },
  10600. generatePolygonByPoints(points2, options2) {
  10601. return new Promise((resolve2, reject2) => {
  10602. let _self = this;
  10603. if (!Cesium.defined(points2)) {
  10604. throw new Cesium.DeveloperError("points is required.");
  10605. }
  10606. if (points2.length < 3) {
  10607. reject2("\u9762\u5BF9\u8C61\uFF0C\u70B9\u6570\u81F3\u5C113\u4E2A");
  10608. }
  10609. let positions = points2.map((point2) => {
  10610. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10611. });
  10612. options2 = options2 || {};
  10613. options2.id = options2.id || setSessionid$1();
  10614. options2.fill = options2.fill || true;
  10615. if (options2.color) {
  10616. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  10617. } else {
  10618. options2.color = new Cesium.Color.fromCssColorString("#ff0000");
  10619. }
  10620. options2.outline = options2.outline || false;
  10621. if (options2.outlineColor) {
  10622. options2.outlineColor = new Cesium.Color(options2.outlineColor[0] / 255, options2.outlineColor[1] / 255, options2.outlineColor[2] / 255, options2.outlineColor[3]);
  10623. } else {
  10624. options2.outlineColor = new Cesium.Color.fromCssColorString("#000");
  10625. }
  10626. options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 1);
  10627. let entity = new Cesium.Entity({
  10628. id: options2.id,
  10629. name: "Generate surfaces based on coordinate points",
  10630. polygon: {
  10631. hierarchy: positions,
  10632. material: options2.color,
  10633. fill: options2.fill,
  10634. outline: options2.outline,
  10635. outlineWidth: options2.outlineWidth,
  10636. outlineColor: options2.outlineColor
  10637. }
  10638. });
  10639. if (options2.outline) {
  10640. entity.polyline = {
  10641. positions: entity.polygon.hierarchy._value.positions,
  10642. width: options2.outlineWidth,
  10643. material: options2.outlineColor,
  10644. clampToGround: true
  10645. };
  10646. }
  10647. _self._viewer.entities.add(entity);
  10648. resolve2(entity);
  10649. });
  10650. }
  10651. });
  10652. function DynamicWallMaterialProperty(options2) {
  10653. this._definitionChanged = new Cesium.Event();
  10654. this._color = void 0;
  10655. this._colorSubscription = void 0;
  10656. this.color = options2.color || Color.BLUE;
  10657. this.duration = options2.duration || 1e3;
  10658. this.trailImage = options2.trailImage;
  10659. this._time = new Date().getTime();
  10660. }
  10661. function _getDirectionWallShader(options2) {
  10662. if (options2 && options2.get) {
  10663. var materail = "czm_material czm_getMaterial(czm_materialInput materialInput)\n {\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;";
  10664. if (options2.direction == "vertical") {
  10665. materail += "vec4 colorImage = texture2D(image, vec2(fract(st.s), fract(float(" + options2.count + ")*st.t" + options2.order + " time)));\n ";
  10666. } else {
  10667. materail += "vec4 colorImage = texture2D(image, vec2(fract(float(" + options2.count + ")*st.s " + options2.order + " time), fract(st.t)));\n ";
  10668. }
  10669. materail += "vec4 fragColor;\n fragColor.rgb = (colorImage.rgb+color.rgb) / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.diffuse = colorImage.rgb;\n material.alpha = colorImage.a;\n material.emission = fragColor.rgb;\n return material;\n }";
  10670. return materail;
  10671. }
  10672. }
  10673. Object.defineProperties(DynamicWallMaterialProperty.prototype, {
  10674. isConstant: {
  10675. get: function() {
  10676. return false;
  10677. }
  10678. },
  10679. definitionChanged: {
  10680. get: function() {
  10681. return this._definitionChanged;
  10682. }
  10683. },
  10684. color: Cesium.createPropertyDescriptor("color")
  10685. });
  10686. var MaterialType = "wallType" + parseInt(Math.random() * 1e3);
  10687. DynamicWallMaterialProperty.prototype.getType = function(time) {
  10688. return MaterialType;
  10689. };
  10690. DynamicWallMaterialProperty.prototype.getValue = function(time, result) {
  10691. if (!Cesium.defined(result)) {
  10692. result = {};
  10693. }
  10694. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.WHITE, result.color);
  10695. result.image = this.trailImage;
  10696. if (this.duration) {
  10697. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  10698. }
  10699. viewer.scene.requestRender();
  10700. return result;
  10701. };
  10702. DynamicWallMaterialProperty.prototype.equals = function(other) {
  10703. return this === other || other instanceof DynamicWallMaterialProperty && Cesium.Property.equals(this._color, other._color);
  10704. };
  10705. Cesium.Material._materialCache.addMaterial(MaterialType, {
  10706. fabric: {
  10707. type: MaterialType,
  10708. uniforms: {
  10709. color: new Cesium.Color(1, 0, 0, 0.5),
  10710. image: Cesium.Material.DefaultImageId,
  10711. time: -20
  10712. },
  10713. source: _getDirectionWallShader({
  10714. get: true,
  10715. count: 3,
  10716. direction: "vertical",
  10717. order: "-"
  10718. })
  10719. },
  10720. translucent: function(material) {
  10721. return true;
  10722. }
  10723. });
  10724. Cesium.DynamicWallMaterialProperty = DynamicWallMaterialProperty;
  10725. class WallDiffuseMaterialProperty {
  10726. constructor(options2) {
  10727. this._definitionChanged = new Cesium.Event();
  10728. this._color = void 0;
  10729. this.color = options2.color;
  10730. }
  10731. get isConstant() {
  10732. return false;
  10733. }
  10734. get definitionChanged() {
  10735. return this._definitionChanged;
  10736. }
  10737. getType(time) {
  10738. return Cesium.Material.WallDiffuseMaterialType;
  10739. }
  10740. getValue(time, result) {
  10741. if (!Cesium.defined(result)) {
  10742. result = {};
  10743. }
  10744. result.color = Cesium.Property.getValueOrDefault(this._color, time, Cesium.Color.RED, result.color);
  10745. return result;
  10746. }
  10747. equals(other) {
  10748. return this === other || other instanceof WallDiffuseMaterialProperty && Cesium.Property.equals(this._color, other._color);
  10749. }
  10750. }
  10751. Object.defineProperties(WallDiffuseMaterialProperty.prototype, {
  10752. color: Cesium.createPropertyDescriptor("color")
  10753. });
  10754. Cesium.WallDiffuseMaterialProperty = WallDiffuseMaterialProperty;
  10755. Cesium.Material.WallDiffuseMaterialProperty = "WallDiffuseMaterialProperty";
  10756. Cesium.Material.WallDiffuseMaterialType = "WallDiffuseMaterialType";
  10757. Cesium.Material.WallDiffuseMaterialSource = `
  10758. uniform vec4 color;
  10759. czm_material czm_getMaterial(czm_materialInput materialInput){
  10760. czm_material material = czm_getDefaultMaterial(materialInput);
  10761. vec2 st = materialInput.st;
  10762. material.diffuse = color.rgb * 2.0;
  10763. material.alpha = color.a * (1.0 - fract(st.t)) * 0.8;
  10764. return material;
  10765. }
  10766. `;
  10767. Cesium.Material._materialCache.addMaterial(Cesium.Material.WallDiffuseMaterialType, {
  10768. fabric: {
  10769. type: Cesium.Material.WallDiffuseMaterialType,
  10770. uniforms: {
  10771. color: new Cesium.Color(1, 0, 0, 1)
  10772. },
  10773. source: Cesium.Material.WallDiffuseMaterialSource
  10774. },
  10775. translucent: function(material) {
  10776. return true;
  10777. }
  10778. });
  10779. class WallObject {
  10780. constructor(viewer2) {
  10781. if (!viewer2)
  10782. throw new Cesium.DeveloperError("no viewer object!");
  10783. this._viewer = viewer2;
  10784. }
  10785. }
  10786. Object.assign(WallObject.prototype, {
  10787. drawWallByGeoJson: function(geoJsonUrl, options2) {
  10788. return new Promise((resolve2, reject2) => {
  10789. let viewer2 = this._viewer;
  10790. if (!Cesium.defined(geoJsonUrl)) {
  10791. throw new Cesium.DeveloperError("geoJsonUrl is required.");
  10792. }
  10793. options2 = options2 || {};
  10794. options2.id = options2.id || setSessionid$1();
  10795. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  10796. options2.minimunHeights = options2.minimunHeights !== void 0 && typeof options2.minimunHeights === "number" ? options2.minimunHeights : 0;
  10797. options2.maximumHeights = options2.maximumHeights !== void 0 && typeof options2.maximumHeights === "number" ? options2.maximumHeights : 1e3;
  10798. if (options2.color) {
  10799. if (options2.color instanceof Array) {
  10800. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  10801. } else if (typeof options2.color === "string") {
  10802. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  10803. } else {
  10804. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  10805. }
  10806. }
  10807. options2.trailImage = Cesium.defaultValue(options2.trailImage, "jt3dSDK/imgs/wallmaterial/wl.png");
  10808. options2.duration = Cesium.defaultValue(options2.duration, 3e3);
  10809. options2.count = Cesium.defaultValue(options2.count, 1);
  10810. options2.direction = Cesium.defaultValue(options2.direction, "vertical");
  10811. options2.order = Cesium.defaultValue(options2.order, "-");
  10812. fetch(geoJsonUrl).then((res) => {
  10813. return res.json();
  10814. }).then((res) => {
  10815. for (var i2 = 0; i2 < res.features.length; i2++) {
  10816. let coordinates = res.features[i2].geometry.coordinates;
  10817. let positions = coordinates.map((point2) => {
  10818. return Cesium.Cartesian3.fromDegrees(point2[0], point2[1], point2[2] || 0);
  10819. });
  10820. let wall = new Cesium.CustomDataSource(options2.id);
  10821. viewer2.dataSources.add(wall);
  10822. let entity = new Cesium.Entity({
  10823. name: "\u7ACB\u4F53\u5899\u6548\u679C",
  10824. wall: {
  10825. positions,
  10826. maximumHeights: new Array(positions.length).fill(options2.maximumHeights),
  10827. minimunHeights: new Array(positions.length).fill(options2.minimunHeights),
  10828. material: new WallMaterialProperty$1(viewer2, {
  10829. trailImage: options2.trailImage,
  10830. color: options2.color,
  10831. duration: options2.duration,
  10832. param: {
  10833. count: options2.count,
  10834. direction: options2.direction,
  10835. order: options2.order
  10836. }
  10837. })
  10838. }
  10839. });
  10840. wall.entities.add(entity);
  10841. }
  10842. resolve2(options2.id);
  10843. });
  10844. });
  10845. }
  10846. });
  10847. class CircleMaterialProperty$1 {
  10848. constructor(options2) {
  10849. this._viewer = options2.viewer;
  10850. this._definitionChanged = new Cesium.Event();
  10851. this._color = void 0;
  10852. this.color = options2.color || Cesium.Color.BLUE;
  10853. this.count = options2.count || 1;
  10854. this.duration = options2.duration || 1e3;
  10855. this._time = new Date().getTime();
  10856. this._materialTypeName = "jtCircleMaterial";
  10857. this._param = {
  10858. color: this.color._value.toCssColorString(),
  10859. duration: this.duration,
  10860. count: this.count
  10861. };
  10862. Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
  10863. fabric: {
  10864. type: this._materialTypeName,
  10865. uniforms: {
  10866. time: 0,
  10867. color: new Cesium.Color(1, 0, 0, 0.5),
  10868. count: 1
  10869. },
  10870. source: this._getCircleMaterial()
  10871. },
  10872. translucent: function(material) {
  10873. return true;
  10874. }
  10875. });
  10876. }
  10877. _getCircleMaterial() {
  10878. let circleMaterial = "czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * color.rgb;\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(time);\n if (abs(str.z) > 0.001)\n {\n //\u7740\u8272\u5668\u6E32\u67D3\u505C\u6B62\uFF0C\u4E0D\u5728\u7ED8\u5236\u5185\u5BB9 \n discard;\n }\n if (dis > 0.5)\n {\n //\u8D85\u51FA\u534A\u5F84\u8303\u56F4\u65F6\uFF0C\u7740\u8272\u5668\u6E32\u67D3\u505C\u6B62 \n discard;\n } else {\n //\u628A\u534A\u5F84\u5206\u6210count\u4EFD\uFF0C\u6BCF\u4E24\u4EFD\u4E4B\u95F4\u7684\u95F4\u9694\u8DDD\u79BB \n float perDis = 0.5 / count;\n float disNum;\n float bl = 0.0;\n //\u5FAA\u73AF\uFF0C\u6700\u591A999\u4E2A\u73AF \n for (int i = 0; i <= 999; i++)\n {\n //\u5224\u65AD\u662F\u5426\u5C5E\u4E8E\u6570\u91CF\u5185\u7684\u73AF \n if (float(i) <= count)\n {\n disNum = perDis * float(i) - dis + per / count;\n if (disNum > 0.0)\n {\n if (disNum < perDis)\n {\n bl = 1.0 - disNum / perDis;\n } else if (disNum - perDis < perDis) {\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = color.a * pow(bl, 3.0);\n }\n }\n }\n }\n return material;\n}\n";
  10879. return circleMaterial;
  10880. }
  10881. }
  10882. Object.assign(CircleMaterialProperty$1.prototype, {
  10883. getType: function(time) {
  10884. return this._materialTypeName;
  10885. },
  10886. getValue: function(time, result) {
  10887. if (!Cesium.defined(result)) {
  10888. result = {};
  10889. }
  10890. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
  10891. result.count = this.count;
  10892. if (this.duration) {
  10893. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  10894. }
  10895. this._viewer.scene.requestRender();
  10896. return result;
  10897. },
  10898. equals: function(other) {
  10899. return this === other || other instanceof CircleMaterialProperty$1 && Cesium.Property.equals(this._color, other._color);
  10900. }
  10901. });
  10902. Object.defineProperties(CircleMaterialProperty$1.prototype, {
  10903. isConstant: {
  10904. get: function() {
  10905. return false;
  10906. }
  10907. },
  10908. definitionChanged: {
  10909. get: function() {
  10910. return this._definitionChanged;
  10911. }
  10912. },
  10913. color: Cesium.createPropertyDescriptor("color")
  10914. });
  10915. class CircleRippleMaterialProperty {
  10916. constructor(options2) {
  10917. this._definitionChanged = new Cesium.Event();
  10918. this._color = void 0;
  10919. this._speed = void 0;
  10920. this.color = options2.color;
  10921. this.speed = options2.speed;
  10922. this.count = options2.count;
  10923. this.gradient = options2.gradient;
  10924. }
  10925. get isConstant() {
  10926. return false;
  10927. }
  10928. get definitionChanged() {
  10929. return this._definitionChanged;
  10930. }
  10931. getType(time) {
  10932. return Cesium.Material.CircleRippleMaterialType;
  10933. }
  10934. getValue(time, result) {
  10935. if (!Cesium.defined(result)) {
  10936. result = {};
  10937. }
  10938. result.color = Cesium.Property.getValueOrDefault(this._color, time, Cesium.Color.RED, result.color);
  10939. result.speed = Cesium.Property.getValueOrDefault(this._speed, time, 10, result.speed);
  10940. result.count = this.count;
  10941. result.gradient = this.gradient;
  10942. return result;
  10943. }
  10944. equals(other) {
  10945. return this === other || other instanceof CircleRippleMaterialProperty && Cesium.Property.equals(this._color, other._color) && Cesium.Property.equals(this._speed, other._speed) && Cesium.Property.equals(this.count, other.count) && Cesium.Property.equals(this.gradient, other.gradient);
  10946. }
  10947. }
  10948. Object.defineProperties(CircleRippleMaterialProperty.prototype, {
  10949. color: Cesium.createPropertyDescriptor("color"),
  10950. speed: Cesium.createPropertyDescriptor("speed"),
  10951. count: Cesium.createPropertyDescriptor("count"),
  10952. gradient: Cesium.createPropertyDescriptor("gradient")
  10953. });
  10954. Cesium.CircleRippleMaterialProperty = CircleRippleMaterialProperty;
  10955. Cesium.Material.CircleRippleMaterialProperty = "CircleRippleMaterialProperty";
  10956. Cesium.Material.CircleRippleMaterialType = "CircleRippleMaterialType";
  10957. Cesium.Material.CircleRippleMaterialSource = `
  10958. uniform vec4 color;
  10959. uniform float speed;
  10960. uniform float count;
  10961. uniform float gradient;
  10962. czm_material czm_getMaterial(czm_materialInput materialInput)
  10963. {
  10964. czm_material material = czm_getDefaultMaterial(materialInput);
  10965. material.diffuse = 1.5 * color.rgb;
  10966. vec2 st = materialInput.st;
  10967. float dis = distance(st, vec2(0.5, 0.5));
  10968. float per = fract(czm_frameNumber * speed / 1000.0);
  10969. if(count == 1.0){
  10970. if(dis > per * 0.5){
  10971. discard;
  10972. }else {
  10973. material.alpha = color.a * dis / per / 2.0;
  10974. }
  10975. } else {
  10976. vec3 str = materialInput.str;
  10977. if(abs(str.z) > 0.001){
  10978. discard;
  10979. }
  10980. if(dis > 0.5){
  10981. discard;
  10982. } else {
  10983. float perDis = 0.5 / count;
  10984. float disNum;
  10985. float bl = 0.0;
  10986. for(int i = 0; i <= 999; i++){
  10987. if(float(i) <= count){
  10988. disNum = perDis * float(i) - dis + per / count;
  10989. if(disNum > 0.0){
  10990. if(disNum < perDis){
  10991. bl = 1.0 - disNum / perDis;
  10992. }
  10993. else if(disNum - perDis < perDis){
  10994. bl = 1.0 - abs(1.0 - disNum / perDis);
  10995. }
  10996. material.alpha = pow(bl,(1.0 + 10.0 * (1.0 - gradient)));
  10997. }
  10998. }
  10999. }
  11000. }
  11001. }
  11002. return material;
  11003. }
  11004. `;
  11005. Cesium.Material._materialCache.addMaterial(Cesium.Material.CircleRippleMaterialType, {
  11006. fabric: {
  11007. type: Cesium.Material.CircleRippleMaterialType,
  11008. uniforms: {
  11009. color: new Cesium.Color(1, 0, 0, 1),
  11010. speed: 3,
  11011. count: 4,
  11012. gradient: 0.2
  11013. },
  11014. source: Cesium.Material.CircleRippleMaterialSource
  11015. },
  11016. translucent: function(material) {
  11017. return true;
  11018. }
  11019. });
  11020. class CircleObject {
  11021. constructor(viewer2) {
  11022. if (!viewer2)
  11023. throw new Cesium.DeveloperError("no viewer object!");
  11024. this._viewer = viewer2;
  11025. }
  11026. }
  11027. Object.assign(CircleObject.prototype, {
  11028. drawCircle: function(centerPoint, radius, options2) {
  11029. return new Promise((resolve2, reject2) => {
  11030. let viewer2 = this._viewer;
  11031. if (!Cesium.defined(centerPoint)) {
  11032. throw new Cesium.DeveloperError("centerPoint is required.");
  11033. }
  11034. if (!Cesium.defined(radius)) {
  11035. throw new Cesium.DeveloperError("radius is required.");
  11036. }
  11037. let position2;
  11038. if (centerPoint instanceof Cesium.Cartesian3) {
  11039. position2 = centerPoint;
  11040. } else {
  11041. position2 = Cesium.Cartesian3.fromDegrees(centerPoint[0], centerPoint[1], centerPoint[2] || 0);
  11042. }
  11043. if (typeof radius === "number" && radius > 0) {
  11044. radius = radius;
  11045. } else {
  11046. radius = 100;
  11047. }
  11048. options2 = options2 || {};
  11049. options2.id = options2.id || setSessionid$1();
  11050. options2.clampToGround = Cesium.defaultValue(options2.clampToGround, true);
  11051. options2.CircleType = Cesium.defaultValue(options2.CircleType, "ColorCircle");
  11052. options2.duration = Cesium.defaultValue(options2.duration, 3e3);
  11053. options2.count = Cesium.defaultValue(options2.count, 1);
  11054. if (options2.color) {
  11055. if (options2.color instanceof Array) {
  11056. options2.color = new Cesium.Color(options2.color[0] / 255, options2.color[1] / 255, options2.color[2] / 255, options2.color[3]);
  11057. } else if (typeof options2.color === "string") {
  11058. options2.color = new Cesium.Color.fromCssColorString(options2.color);
  11059. } else {
  11060. options2.color = new Cesium.Color.fromCssColorString("#FFFF00");
  11061. }
  11062. }
  11063. if (options2.outlineColor) {
  11064. if (options2.outlineColor instanceof Array) {
  11065. options2.outlineColor = new Cesium.Color(options2.outlineColor[0] / 255, options2.outlineColor[1] / 255, options2.outlineColor[2] / 255, options2.outlineColor[3]);
  11066. } else if (typeof options2.outlineColor === "string") {
  11067. options2.outlineColor = new Cesium.Color.fromCssColorString(options2.outlineColor);
  11068. } else {
  11069. options2.outlineColor = new Cesium.Color.fromCssColorString("#FFFF00");
  11070. }
  11071. }
  11072. options2.outlineWidth = Cesium.defaultValue(options2.outlineWidth, 0);
  11073. let polygonMaterial = options2.color;
  11074. options2.outlineColor;
  11075. if (options2.CircleType === "DynamicCircle") {
  11076. polygonMaterial = new Cesium.CircleRippleMaterialProperty({
  11077. color: options2.color,
  11078. speed: options2.duration / 1e3,
  11079. count: options2.count,
  11080. gradient: 0.2
  11081. });
  11082. }
  11083. let entity = new Cesium.Entity({
  11084. id: options2.id,
  11085. position: position2,
  11086. ellipse: {
  11087. semiMinorAxis: radius,
  11088. semiMajorAxis: radius,
  11089. material: polygonMaterial,
  11090. outline: true,
  11091. outlineColor: options2.outlineColor,
  11092. outlineWidth: options2.outlineWidth
  11093. }
  11094. });
  11095. let flyEntity = viewer2.entities.add(entity);
  11096. resolve2(entity, flyEntity);
  11097. });
  11098. }
  11099. });
  11100. Cesium.Primitive.prototype.setUseGeometry = function(geometry2) {
  11101. this._useGeometry = geometry2;
  11102. };
  11103. Cesium.Primitive.prototype.getUseGeometry = function() {
  11104. return this._useGeometry;
  11105. };
  11106. class SketchViewModel {
  11107. constructor(viewer2, options2) {
  11108. this._viewer = viewer2;
  11109. this._init(options2);
  11110. }
  11111. _init(options2) {
  11112. this._viewer.scene.globe.depthTestAgainstTerrain = true;
  11113. this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  11114. this._entities = this._viewer.entities;
  11115. this._pointEntitys = [];
  11116. this._sketchPointImage = void 0;
  11117. this._iconNormal = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcEAYAAAAinQPXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAB2FJREFUWMO9mHtQlNcZxn/nW65GxHtEqTEajUxVoLYRSIyipHG4qG0lajtxVIRFubgqXuOI28ZE7FAvCLKLSNKxg/FSIzdvqNE62kaRitqpYMxovBGigo4I4n6nfwjsCrsLrtjnn53vnPe87/Oc9/2+854VdBhCd6ZP6dMHlAXO/lOngrzMLz/8EEQ0ASNGANNY2aOHxYIdfHr3LuBCwPnzQIKcf/AgiJ8pQV99BfmvR4+orHxZVsLxpZFT0qd07gyP7zqrej3IInF47lwQkTLV3d1xv3KXWPT4MYhLzMzIgHpn10+Sk+Gw74w+jx79HwSGnzUYhg4FED4FBcBq/jtokOOC2oSb0FZUgHpKVoeHQ9GtGM/y8lcgMLxf5juDBwNDlOWnTgGvUdWz5wsQ7c179fUWzz9y0tX1BdZPILeqCpTtil9QEOT9c876K1faWqS07XeMzJFuboCXkpaX1w5hqxl14QJIKYRWCzLV5OXtDQXbon3c3c2/TeMoYvncucAgPrl40Y7fA0zv1QtMydKwb58FL7toRwbDYo3/0utB3OD8qlX2hIkLqalwO0b9+fLlUHJOG9vQ0P4EjfyFIdPZGfqsURampIBIlxsWLLBtL/NltF4PhUIrVq92QGDIeEOmpye4pYju164Bq6n29LTiopy8tDTIL48pSExsDq/Oj9is/eAD4CRbli1DMEFUBAYCewnUaJD8jr2lpQjpJ7M2bBBi0+L47Tt2mP2G5xhNaWnAHrLj461tKF1rasA0rW5b//6w/0rigQcPWhrZKVFXP8TkybaFyb3kXbkCbiO6fpyU1Dwq58vNG3U6BJvEiYMHEcwQW8aNA3pT7O4OaPmTiwuCnlwcNQrEDRGYmytloilj5vr1Zv+mNXVhSUnmOFYEVnt6gtM9t+8mTbKlwo5AoWdySIjteWUcIwwG2LX7o6lPnkiZULTlj/7+wEThm5oKbCBeCOANUisqkNRxLCEBSSzrYmOB3jw6c8Yi3kL5K51OyvkZGXUTJz7LSH09CIPwMBpt85CHhMf48Q4IJFPofHzsbMAAJfjIEQtXC9TZWi0wkEuKAmjEyspKpNN2pyVBQULZaIjbvXmzUDb6xF0zGJCqv+no6NGAK5fLyiz8JssVcXEWgQLUsZZxWmGbrLTN057Agfh7eNiefhpRb7h922LgOzFp2DDzxnJXrsvLE0rqOW3sTz+12h4lLfRZhuQybuXmWmQkgPzhwy0o1jlV37ljh+e3/L1LF0cEXqX04UPb0075rlovLwtBHuqZ5845T5Z37UqbEAPkzOfsUvlHXZ35saFnQ4++fe04eIfftv64tEfgdvkXeweprFIvBQaaebJH+f3x4xbPvsRPnixlQlHGtDFjWq2Wuqj0yz4+QKk4FxNjMVXD2998Y0FRKEsCAuzwzBKv2eZpR6DspxQcPWpnvrNYoNNBZOTOnRoN0ilJMzYjA3ibsKoqoIxezs6gLJbpxcVSTbyePurwYSkT76VPKSgAWQslJcAmenTrBszgP7W1wBlRmZICY2SydHIC8ZCvdTo7Ak+ri44dcySDNDTs2mVufluhThoGD4bHp6or4uOb3zWJnoqwMGAVLnfuACHscHJCiFRmhISA0BMcFob52PDC/8EDkLfkR5GRQmycN8/t8mXw8O73WVwctnvdJ3SqrQXNSJeY3bttaWhHJxMxzDh97VqQAwheutR2IC6pm/z8oOBm7LcVFVJNKNo0oUsXhBKmGR0VBfI0vkFBINzExxoNEKP+ePYsktefFmVnC2Vjvm5SZSVEpGUNefNNUH8ti8rKQCziaOfOVuL2563PP4eCjJhxK1a8hMCJJ7NTPDxAXWIaefEi0J2r/ftbMfyryDhxAkZ2u1EaHAx6oReq2rb/JiTLZKkoUHLf2//YMWCGnPf++1YM7zHw+nVQ1mlKhg2DvPeiltr+GLaj2W524Kd6zZ4NhGOQ0ophI6GSkr4Gq61VGyjx7vdZQoIdYY1xVZ06RKttS1gTHLkPLjVmGo3AJZToaCsGjSWrPFBKfH3bvta0uyR3ySlGIxS4a7trte1l244MtoRpT93XSUk0l0oruFDbqROYUtQ9X3xhLr2WaBpX4+WnOTl2hHkw9eZN0Li5dLP6Dehogc1dexslK/7MynffhbNDvZXnWq9GNJWyiKC69TlphvobtWbOHNgnZonq6hdl+xL/yTQhbKUxeOtWEP9melSUFYMWJSv/IAtNprZLUu4Rf9u6FQpdo49bfRXaBQcy2BL1p+XURYtAZrLwhx+sGDSWrDpc3ZeVBbJMPt22zY6wRj/1oep08zXMUXRABpsQFmqcHhICYiLlhw4BBWiFA/5FOXmhoc8u0Pv3vyyrDshgEwqLYnKLi4FO5OfkvPh66UdudnZHCXsFAptQ96XMW7jQTsm2xAF23roFlD6NXLy4o9m8AoHFR7SxNTWgjGOsVovtxqBxXAzEbc4cKCycN+/+/Y7n88oRvjarcNYsCDtprP/+ewjvZ1xz9SpERBp3zpz5qqP/D5zQE33tptaiAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA0LTA5VDE2OjQyOjI5KzA4OjAwjRBbGwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNC0wOVQxNjo0MjoyOSswODowMPxN46cAAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uXzJhcHo1b3VpcnV4L2Rpbmd3ZWkuc3ZncY9vkgAAAABJRU5ErkJggg==";
  11118. this._iconBlue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkEyMUE1MDg3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkEyMUE1MDc3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/grmkAAAhxSURBVHjazFoLUFVFGN49597LBdFUEpEQI0IpyxIfqU1ZkY/pNZg1RZlWY2lW4yMncxq18oHZ0+lhOaWZUo0zPjIr8W1NiubI+AxBIkRQQsQE7us8tv3P7qGL7gXOPRdzZ3bmcnf3+7/v/Lv/+f/lYkIIMpur2yBktQVO5yM7LRybIvsOFKFGCeHyQz/dFO2Ousflcg6UJSlVlqVEjHEMjNMH5tE0vVLT9ZJAQNnn9fm3d+9z3xEYioR9bNcjW9Z8Gtv35l7PUAFjnU5HLytrFUU9TgV9XXD4+PJhoyfV2/GIFO4TGD8my1lVuGXSHYNuPdyhfbv5VkVAgzWwFjAACzAvp0fwoV++uz6lxzXLolzOW1AEmz+gHCwtq3i2z52Pn2jtlgvXI1LpgQ0jeqYm74y0CGiACdjUxkir3KxMlsoKNj6WmNAlV5Kk9qiNGmBTG6vAlhV+rd1aUuGeNSNSeiSuolGo2X1cdDogbThQ79h21CMfP6NKtR4dw/edYiTSK8GhZ/aO0R7KiFV7dnPpzeFQXkppWeWY9MGj8+ifektbqzVC8KbVH6UNHdJvOw2nHUIB7vrDI89df861p0SRsUSjuiSzB4qxyYzx0TVEdBUNTnVqs7I6B4beEKOFwqThuu7X/IJ7hj/yYlGoM9NqIakpSVH7t67c3C4muq8IyKcQ9EpuddSK3xqcSHJR7g7WsSkCm8+YiSEgRuU9gMbd3k5578kufrcTC8U0eLwF/e99anhJ6Sm/HSHSid/Xv5CclJAjAjlXr+GHP6x07z9JZCSDCBfzBJapBomJabJfdKqFCiGa4RkQgrQA6p+MtbVTEn2dY2XhUz956szM6wdkLRFtsVZFrReeeaRTQte46aIxT4DgrA9ABJKRw42QTLsjimqATgUZwpxNO/0OGz3KmMvWuBFgABZgimwBB+ASbtSSp0zIHutyOuNEg9NW/e06UE49YRBi5LFB2NxaMoQg5iGJfza+Y+MwlwlmogALMIXpD+UAXIBTOEKi4rt0zg51sFft8TjN7YQbnzrbVpeeD8Q+w3fYFCQba9ha5kHABGyRTcrlCeBkVQjO/Wxeb3rA00WDb62rcbHzAARML0hBAloK+lyQ4TEHx2B4BragUS69vl06/6aLnk6LQuQ+vdMyRQMHT/ql/D9VGfEQi00PGFDYwqsP8/AsMQyJbTvABhuiFb3TU+8Otb1CCXFd1SF2gGhg/f56Bw4+B9iCJ0J5Bv93fgAbbIimd7yq/UDgZklITLQ7RTSwp9grs7MgBYXYMEQ0OTtBWBR7d5FX+NQ5J0tCHG63K0GYglSpkrklGkXY1GGKMbdo8d+qkBfn5LB0RpwOeDlc2mo9NNYHbyOMIuCRptvNsCGqXxgnS2dEoslhxMrgSDXOSbL0HlFVzSv6vlMMJigorWGpnJ2ymzRdTrENGxY4NSeE+PwBYQ3ds6tDN1IewvvFRMLQwTBMPB2lxTuEaTvnRKwI0S/U1ZeLBganRWtGwteYAOoR8EgQFsUe3DNamNpzTroVIWp1TW2xaCCrf6xKzDScaP89SRKGGBLkCSMjVo1aZRS1IZrOOalWhCgHjxTvEw3ckhylD7rOobF6ghZJphhk1TO80DK8Yab1KgJssCHMKhgnxYqQQM7i5bv9AaVONDh7VFzAqCWMekLhRZIFzzQWWLzIMjAY3qwsii2+YakDTsDNkkdoRVZbXHLyN9EglKdjh8QoUBSBcaIDEYU91cbtRi7yUFCF2OgBha9lBRZg3nWjuPQFLsDJqkfAtfWfr1jzDSHiR/zuk/GBjO5YQyqtQDU/5WYKCjo/Oicd/JmPw1xYA2sBA7AAM8RFBAEuwMnqYTei3Q95vx47U1VzTJj3uDBZNzXRl9EdUTE+SshnECJcFPOWwraNxj0GYo3OyLM1PgQYgAWYIlvAAbgAp3AKK6XyTPXZ56bOm0f3p/BFFEdr7LwZSd5xQ9wKUukUo/u4h8SdecCHzPmwdtOMJF9ciHodbE+cvmA+cAm1rVoSAsD1m3fmH127cfvSUJOiXRh98nS8/8dpXb0DknWNKB5qzsOIKlwYdIULpWMwB+ZunNrVC2tDeQIa2P552+4jfFsROxd0sbRfm5/31dyMPumZLQWkwsqA9EOTCzqCzdTGvKB7MCNWTU9s/oIOWsHh41tvGz5uNv34Fxdi64IOvNaxQ/t2aXvzVixKTUnqezkSRBqhCm4bMW7GhboGuJw7H+qQW7nEBoALFPCvOx8cP+toYUl+W4v4o6h0L9iiNkvBdnNXplYvsSEtOFddc75owLCxc6jLd7aVCMDulzlmDtgCm6FSEju38RAxztJUumTkoy+9faqyqjDSIgDzgezJi6gN+P9Is1HKjpBGz9T+U1cy+ulXZ9XU/lMRKRGABZjUEyeseCJcIY1i6BY4NmHagjlen/+CXREUow6wADMcEeEKQTxxq96wadfvCz9cvpBuBSVcEbCWYuQAFmCGSgrbSojx0qW9KmfxV5u/zP1+MTEqI6vlCNFhLWAAFsdEl1sIvIAgdTn98muL1mzZtXe1VYCtv+xbDWsBg2OR/0OIKaaB9ooHsqcsoXt8h4Uwu+P+xyfD/zwqOIatHw7YFQJvVthSUICVDxs9Kae0rOJwS2vKyk8fgbmwhq/V7fKwLYSLgWLoPLz9s59//c3mwjKMPTZ+5hswl6ceWiQ4REQIF2OE5QOHCo9NfCVndoPHW3vxHPgOxmAOzOVr0BUlhIuB0Hn2+5937p/77hcLgsMyfF7wwbKFMAZz+Fx0RQoJDsvvL8ndYYZlM8y+8/HKbXbDbKgW8ftd+qQJLQcglFZCaE3qFn81wogEh1mYE/F74bb64RnFAm/DDwy6mPdrkJLzKGfLpsj+vwIMACSZzfDJFmOPAAAAAElFTkSuQmCC";
  11119. this._iconGreen = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjI1NDIwOUU3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjI1NDIwOUQ3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgEE4igAAAgKSURBVHjazFoJbFRVFP3L/OlMoQXKImAFm0JbFtFKShEQI6UsggmkGKghIKTIIgZUohIDKEuLaFTQiIKyKKghqSyyF0pZbcHQsJVpoRkKbYFAW+iU2f78/313+qY+hvc78+dPkZfcMJ377rn3/Pve/fe9gVUUhfENY5eBjNbhvlnI6Bmh+KT5NzBhGigg9sb5vX3NpohhRqMwgOe4eJ7nurIsGwl69MDskiRXS7Jc7naLpx1OV/4z/V67CKpw+Gf1ZiQv9/vWyc8lTkMEpgiCIVGLrSh6ShGhX4ovlG5Mz5jToCcjXKhPIGvyOOG2JW/OywNfuBAd1WqFVhIwwAZsAQOwAPNxZoQ9f+yPHnHdn94QYRSeZ8I4XG7xnLWianq/oZOuBrvkQs0IZz27a2RCfLeCcJOAAZiAjXyM0hqblslcRfHuiV07d9zKcVwU00IDsJGPLeBLS3zBLi3O8nfuyLjuXbegKtTsOrY4Ldz22u2GPFue4bL7MlfrqWXh+xhDjNLL2EtOj0r3jI8Z70kyJcnN4aC4RGtF9eSklzIOoD/lQEsrGCLs/m3f9nxlUP98VE6j1QDz6/P5xZWLI06KJ3lGwIWdB2tfZEgkJB4oVwwzWBgsLY1d6hoWPUxSw0Tl2na8sHjYiAnvlKntmaD3SHxcrDG1f9/1aiScspOZYZ1hGm4dHnmSRyRglk+i/ITQwVywAVvAoA3kMyolufc6iEHv0uKuntkxu1ts5xyacY2nhh1TNsZcpBTxjBl2K4AQ2eD8MiITWXFDmULiYJhUNlXak7DH0d7QnvrUr1feWtgjZdxa2hILKiOzp01o1/mp9gtoOrtsZ0eXjjYXMYhEa/RFKyxmLCaCmBF/NhF633xkCxiABZg0XxADxBJq1eLnz8ycYhSE9jTl3Iq5EWeYM/wjwUPQvj1CEwHP8SMFWIBJbX9QDBALzrNmIhGdOsZkqm3sTfWbhKbgTcSSMhBLiiYcMc9I2CMswARsmk8Uy5s4r5qIsFt/WN6nVaQ5iaZcVLkoQjEpjbD++4IM+hFUQniCDMYBTMCm+USxJP6+bkVfFWRVIny/Pj3TaIpiezF3SjzFN619AaNwRLABSwzhnSOWGxLABh80sz5J8a+qLS81IsY20a1TaIrc2lzhoX3A+2Ui6FcxkRn+4f3j9UEZbdtEDcCUgycSaTbF0RQnGk7wTY79S2xIbSvGIDCPNxynPnUckyYiBpPJ2JmmKBVLuSYCXIA9EWxWWAIPYZeJZdS4cEwGTXtEMBhMNEWthHonVieB5gix2Aft/NIYk6Y9wqHmMGzH4HANHBOn6T3i8UgO2vcxfIzibTdI0Tv88Lw+NMTUHBHF6XJTz9CJQqLs7ZdkLHoIkbbyf71YgpBAbdtxTIoWInK9reEGTTGk9RCpqfGTCDJ6skE2kxL2QRk4JlkLEc+dmrorNEVGTIbo7VxFgowUQlYU4oxCnFMAe0LMBJFmgmPyaCEinrt45TRNkRyZLA8SBkleMj5CMvGclCBJMIQdJgAC2OCDZoZjErUQcees3njK5RZtNOWy2GUu1sk2nidcOAiPX2aUAHvC/1yCBDDh1Khyw2KDmLBF8Bkpt1bWXSm/fpKmhOPp9OjpIhyKGCcWHxkPpQj4b2oPQcJnj7AAMy06jbo/IBaISWtGwF3Dj5tzf1PIIyQx1nRf40phUiTmQWMQTaTI/ePx2wPEPvAF7xWEAViAqXIRoUAsEJPWze6tdn8dOF5y63ZNCbXv4SKVvYl7HSkKItPQGMwjpFx+4he8V5AtYAAWYNJ8QQwQC0bQfLASq2/duTvjveXL0fqkvog6GDooR3sdtWdFZomsjW18Xj5SdhXBwYOADdgW9CpwAJbK3nDMWpC9AmJRW1aBiABww8GCwkt/7s5fpzbJzJmZ9XHrnYfiDtkHSgMlph59CSXC9y8phA7m5sXl2cFWLRMwwPe+w6cuYvqKngs6uFp4tvDApmUv9ktKC1RZSxwl3I66HYaD9QcNFtHC+RpAaDuShCR5RPQIz7h24zy9zb3lQFjFF0oPpY6Yuhh9vIaJ6Lqgg6y1jY5q1bPowOZV8XGxyY+jQUQVqjh15NSP6m0P4HLuntom13KJDQD1CPDa0NezFl2ylBe2NInLZdYi8IV8WvGCDJi9YC+JoXDW3qm5V5aSPmUJSnlBS5EA7P5pk5eAL/Cp1pLouY2HinEXtdLlo96Y+3ll9W1LuEkA5tjMeauQD/h9pNkqpYdIU2bq7tvKM976cFFN3f2qcJEALMBEmbiqJROhEmkig5ZAycz3s5c4nK56vSQQhg2wADMUEqESYXCTcWfX/qNnVn6zcSVaCmKoJMAWYeQAFmCqNYUtRYTBTcftnNWbDv68dedqVMZlrQBgA7aAAVgYk3ncRBTcNd189+NVuXlHi7ZpBTh07PQ2sAUMjKX8H0R8ZKB7qhqbOX8tWuNHNJTZI2MmzYPfPKowhq5rDL1E4M0q4w7qRnrGnBxrRdWFQDYVN25ehLlgg21lvXHoJoLJwInjHrz9M9/+5LPmyjLoJmYt/BTm4tZDCkcMYSGCyXjL8tnzlpJZH+QsfmB31PnPge9AB3NgLrZhnigimAyUzrs79xX8s+zLn7LJsgyfs7/esBJ0MAfPZZ5IImRZ/mrt1iO+suwrs1989+thvWVWbYT9fhc9aQUdB6CUVkNpje3SqQPDMgpZZmFO2O+FW+o/niEsyDb8qt7Rd78GLTmucrp80vz/K8AAYAEv1AHM/GwAAAAASUVORK5CYII=";
  11120. this._iconViolet = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzFDREU3Mjk3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzFDREU3Mjg3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppb+WxIAAAhcSURBVHjazFoLcFTVGb6vvdnNY0lEEJOIxhCSKTEFKSC1osIgjqIyA62mZfAxWJU+tC3TVh2lHSGhtNOKOqK0ii+0QwcfFB+IAsKIITpJhUBDHhMiSSBCTMgm2d377PnungubnXOT3L0b6rlzmM2e83/n+87/n/+ecxbeNE3OLvLFV3Fui3KiivNSkhmTNb7EpagQQvzxg++VBvxpc2XZN1MUhEJRFHJ5nk9HO5mwAV03OnTDaFYUtTocie66pOymOjSlYnzeq0d2bn02c9oVxXcTAct8PqnYja2qakeJoFdqDx3dNH/xij4vHhGSnYHlSxf5Out3rrjmqqmHglkZa9yKQIENbIEBLGCeT4/wB/f+c1LBpXkvpsm+73IpLFFF/bKltf2esjl3NI005JL1iNBSs23B5MKJe1ItAgWYwCZj3OiWm5vOQmvt9ttzJ4zbLAhCFjdKBdhkjNcwlht+Iw0tof6zrQsKLs19jWShIeM40hASure3S727O0WloV/QehTeSo/ZsilPzjCC11+k5yzM0/yTs4yhcAgvtaW1Y2nJ7MU7yJ/GcKE1EiH8B1ueLrr2+9N3kXQadAIM7f1abK84LEcOnBFFXuREMpk8TyrHx4jhMQ1OJ5x0U+f8s8boeY9MUbLmjNedMEm6Du2rqp17w5KfNTitmRGvkcKCfHnW9NK/O4kwIjp37JdfpDUv+jSgVw+IASHAofpRef/gSttQ0Rc2sAUGq5Axs2ZM+85GcPAaWkLT528/MDF/QiXLWPtG4Rt/tM+v1vSLMi9zPl4iniCVeASeEPjB82QQj8Az8IjOaZxqapxiKpzvygy9aMs1EekCmTnrX7WdfHjSjEUbWCE2Io88cPeSnAkXjV3J9ERY5xuX7PNrNQOin0/j0kiVUQUI8llVSnjs79FHpjawBQawgMkaCxzAJdmsJT50X/ky2ecby5yllTWy+p9+MY2PkYonb60RUuER1udBoixBMgcsYDK3P4QDuIBTMkLSxo+7oNxpYfe80eaLhZPMSSSkUAU8vPWvFVr2QrdimD7xfWw7nzUZMgdMYLPGJFx+DE5uhfCbn1s9JSM9UMJqbF9TJ5O5tNZEooh48o4Lk66fwWJIJZjAZtkQLsVvbFxTapm7ECKWTSmax2oYONgjRKp7RSluYbsRwRITS9cxQcDGGCybKSWF1zuFl5MQeUwwcwaroXtbmyTRWLdFkJekKxGDwo3nz4nB+iEVY7D6Z4/JmgluroSkB/wFrIa+z7rE2DyeWwfJiEhcO2fXD3n69p9mzjrl5EqI5PfLE5hv0qZ+gach4TacRhJmwFaaB5i8KCfJ1RrxSZKfuW3oUflE8l49kvg3xmCeX2KcXK0RMut8yo7BqSqUk+DqPaJpepjpqmyfaSbs30wPx24WFsZww2koIWYkqjDP0PKkDAO7WOuheyevBRgGxQS2XJjO3LZTTqYbIUZvqO84qyFz9lidyohtzenjRYT92LiZsy9kbocpJ8ONEO1UV3cjqyHn1nxNw+6V1tgsJicmdkaJCbDxgJ1zW77G6k85aW6EqF/WNVYzc3lZtuGfGdQ1sgXHVtwW4zbM4sPJ3tYDE9gYg2VDOaluhCiV6zftjypqiNWY92iponKKdZ7QaHUjJl6EbQ8sYOY+Uqo43LCEwAncXHmkuaWtu7H5q09ZjTieZv/kEhWHIpXURDHx6ydxLcT3OSdCsQ5YwAxeyz76ggs4ufUIXNv3/MtbXzfjj5BxZeK6aYpvaoYetUhECRnVqhoNNyvkTIP5WbNOh7H+sAUGsIDpcBFhggs4uV3sVrb79459R052dh1hGgZEs+hfP4hIU9P1iEUmapFSDGWQqPjnLHlDoQKiHGyBASxgssYCB3ABp2QOVmrHyVOn7/3V6tUkPpkvImlsmln83nXh4NJcNWKGuYgRIxcTpcQIx1fynd2OvrCBbfG710WA5bA2wvevrFgDLk5hNZwQAPd9uKfq8Jvbd210BPCL3GVPfS9a+PbVYWF6QA8bEBSrYYgzI1a1Ptvfk4q+l791dRi2Tp5Awdjvf7y/joaV6eWCLpPUy6p2vPTElWUl84bLSOH6XqHn3Xapd9fXotLUJ+jdmrUBFHMkU56UaQTnkkRxc54WKAkaw2HVHjr60awb7nycfDxGhXi6oIPXsoNZGUUHdry8rrAgf9r52CCSDFU7a8Gdv+sN9eNyrsdpkbu5xAZALwE8NueW5Y8drm+uGm0R/21oOYCxyJgtGHuoK1O3l9jYFnxzqqunYcb8ZauIy/eMlghgT5+3dBXGwphOWxIvt/HIGKfJVrr5xh/+/E9tHZ31qRYBzIXlD64jY+D3kSGzlBchZz3TfSbUvPiu3z7W1X2mPVUigAVM4okmN55IVshZMSQEjtz364pV4Ui016sIghECFjCTEZGsEI5u3E5t++CTz9c+uWktCQU1WRGwJRiVwAKm06ZwtIRYL11SOyvXv/ThC5vfWW/iaOf2PEJsYAsMYFFM7nwLwQsIW5cTv/j9uq07PzmwxS3AR3urt8AWGBTL/H8IscX04zp4YflDG0iM73aRZnfffMeD+M2jnWJ4Ovx7FYI3K0IKB7Dj8xevqGxpbT80nE3r8RN16Asbamt45eFZCBWDw1AP3v7lP330j0OlZbTdvvzhP6Av3XroqeCQEiFUjJWWaw7WH7n/N5WP9w+EuxP74Du0oQ/6UhvuWyWEikHqPP3O+3u+eOIv/6iIT8v4XPG3F9eiDX1oX+5bKSQ+Lf91w+bddlq20+yfn3n1Y69p1qmk/H6XzLRJjgNIpR1IrfkXj7+Q4zkzPs2iT8rvhUfrP54RLHgbv82Ps+/XsCWnWc7TmKzx/yfAAHo1CtU9myPWAAAAAElFTkSuQmCC";
  11121. this._sketchEntityName = "sketchEntity";
  11122. this._sketchTempPoints = [];
  11123. this._sketchPoints = [];
  11124. this._sketchOutputPoints = [];
  11125. this._sketchTempPolyline = void 0;
  11126. this._sketchPolyline = void 0;
  11127. this._sketchTempPolygon = void 0;
  11128. this._sketchPolygon = void 0;
  11129. this._sketchTempAltituePolyline = void 0;
  11130. this._sketchAltitudePolyline = void 0;
  11131. this._sketchAltitudeInitHeight = 0;
  11132. this._sketchTempSpatialPolyline = void 0;
  11133. this._sketchSpatialPolyline = void 0;
  11134. this._sketchTempCircle = void 0;
  11135. this._sketchCircle = void 0;
  11136. this._sketchTempRectangle = void 0;
  11137. this._sketchRectangle = void 0;
  11138. this._sketchTempTriangleAltitudePolyline = void 0;
  11139. this._sketchTriangleAltituePolyline = void 0;
  11140. this._sketchTempSpatialTriangle = void 0;
  11141. this._sketchSpatialTriangle = void 0;
  11142. this._lineLabel = void 0;
  11143. this._polygonLabel = void 0;
  11144. options2 = options2 || {};
  11145. if (options2.isDrawPoint) {
  11146. this._isDrawPoint = options2.isDrawPoint;
  11147. } else {
  11148. this._isDrawPoint = false;
  11149. }
  11150. if (options2.isRetainDrawPoint) {
  11151. this._isRetainDrawPoint = options2.isRetainDrawPoint;
  11152. } else {
  11153. this._isRetainDrawPoint = false;
  11154. }
  11155. this._param = {
  11156. moveLineWidth: 2,
  11157. lineWidth: 2,
  11158. moveAltitudeLineWidth: 2,
  11159. altitudeLineWidth: 2,
  11160. spatialLineWidth: 2,
  11161. moveEllipseColor: [0, 255, 0, 0.5],
  11162. moveEllipseOutline: true,
  11163. moveEllipseOutlineColor: [255, 0, 0, 0.5],
  11164. moveEllipseOutlineWidth: 1,
  11165. spatialLineWidth: 2,
  11166. ellipseColor: [0, 0, 255, 0.5],
  11167. ellipseOutline: true,
  11168. ellipseOutlineColor: [255, 0, 0, 0.5],
  11169. ellipseOutlineWidth: 1
  11170. };
  11171. this._setMoveLineStyle(void 0);
  11172. this._setLineStyle(void 0);
  11173. this._setMovePolygonStyle(void 0);
  11174. this._setPolygonStyle(void 0);
  11175. this._setMoveAltitudeLineStyle(void 0);
  11176. this._setAltitudeLineStyle(void 0);
  11177. this._setMoveEllipseStyle(void 0);
  11178. this._setEllipseStyle(void 0);
  11179. this._setSpatialLineStyle(void 0);
  11180. if (options2 && options2.iconType) {
  11181. switch (options2.iconType) {
  11182. case SketchViewModel.SketchIconType.Normal:
  11183. this._sketchPointImage = this._iconNormal;
  11184. break;
  11185. case SketchViewModel.SketchIconType.Blue:
  11186. this._sketchPointImage = this._iconBlue;
  11187. break;
  11188. case SketchViewModel.SketchIconType.Green:
  11189. this._sketchPointImage = this._iconGreen;
  11190. break;
  11191. case SketchViewModel.SketchIconType.Violet:
  11192. this._sketchPointImage = this._iconViolet;
  11193. break;
  11194. default:
  11195. this._sketchPointImage = this._iconNormal;
  11196. break;
  11197. }
  11198. } else {
  11199. this._sketchPointImage = this._iconNormal;
  11200. }
  11201. }
  11202. _arcToDegree(arc) {
  11203. return arc / Math.PI * 180;
  11204. }
  11205. _toColor(red, green, blue, alpha) {
  11206. let normalColor = new Cesium.Color(0, 0, 0, 1);
  11207. if (typeof red != "number")
  11208. return normalColor;
  11209. if (typeof green != "number")
  11210. return normalColor;
  11211. if (typeof blue != "number")
  11212. return normalColor;
  11213. if (typeof alpha != "number")
  11214. return normalColor;
  11215. if (red < 0 || red > 255 || green < 0 || green > 255 || blue < 0 || blue > 255 || alpha < 0 || alpha > 1)
  11216. return normalColor;
  11217. return new Cesium.Color(red / 255, green / 255, blue / 255, alpha);
  11218. }
  11219. _toColorFromArray(array) {
  11220. if (!array || array.length === void 0 || array.length === 0)
  11221. return new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1);
  11222. let r2 = 255, g = 255, b = 255, a = 1;
  11223. if (array.length === 1) {
  11224. r2 = parseInt(array[0]);
  11225. } else if (array.length === 2) {
  11226. r2 = parseInt(array[0]);
  11227. g = parseInt(array[1]);
  11228. } else if (array.length === 3) {
  11229. r2 = parseInt(array[0]);
  11230. g = parseInt(array[1]);
  11231. b = parseInt(array[2]);
  11232. } else if (array.length >= 4) {
  11233. r2 = parseInt(array[0]);
  11234. g = parseInt(array[1]);
  11235. b = parseInt(array[2]);
  11236. a = parseFloat(array[3]);
  11237. }
  11238. return new Cesium.Color(r2 / 255, g / 255, b / 255, a);
  11239. }
  11240. _updateScene() {
  11241. this._viewer.scene.requestRender();
  11242. }
  11243. _getScreenClickPosition(screenPosition) {
  11244. let resCartesian = void 0;
  11245. let ray = this._viewer.scene.camera.getPickRay(screenPosition);
  11246. let position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  11247. Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  11248. if (Cesium.defined(position2)) {
  11249. resCartesian = {
  11250. x: position2.x,
  11251. y: position2.y,
  11252. z: position2.z
  11253. };
  11254. }
  11255. return resCartesian;
  11256. }
  11257. _getScreenClickPositionAndHeight(screenPoint) {
  11258. var lng = void 0, lat = void 0, height2 = void 0;
  11259. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  11260. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  11261. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  11262. var feature2 = this._viewer.scene.pick(screenPoint);
  11263. if (feature2 == void 0) {
  11264. lng = this._arcToDegree(cartographic.longitude);
  11265. lat = this._arcToDegree(cartographic.latitude);
  11266. height2 = cartographic.height;
  11267. } else {
  11268. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  11269. if (Cesium.defined(cartesian)) {
  11270. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  11271. lng = this._arcToDegree(cartographic.longitude);
  11272. lat = this._arcToDegree(cartographic.latitude);
  11273. height2 = cartographic.height;
  11274. }
  11275. }
  11276. return {
  11277. lng,
  11278. lat,
  11279. height: height2
  11280. };
  11281. }
  11282. _transfromFromScreenPoint(screenPosition) {
  11283. let location = this._getScreenClickPositionAndHeight(screenPosition);
  11284. var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
  11285. return {
  11286. gLocation: location,
  11287. sLocation: cartesian
  11288. };
  11289. }
  11290. _removeEntityByName(entityName) {
  11291. var entities2 = this._entities;
  11292. if (!entities2 || !entities2.values)
  11293. return;
  11294. var delEntitys = [];
  11295. for (var i2 = 0; i2 < entities2.values.length; i2++) {
  11296. if (entities2.values[i2].name == entityName) {
  11297. delEntitys.push(entities2.values[i2]);
  11298. }
  11299. }
  11300. for (var i2 = 0; i2 < delEntitys.length; i2++) {
  11301. entities2.remove(delEntitys[i2]);
  11302. }
  11303. this._updateScene();
  11304. }
  11305. _removeEntityByObject(objEntity) {
  11306. if (!Cesium.defined(objEntity))
  11307. return;
  11308. this._entities.remove(objEntity);
  11309. }
  11310. _createPoint(coord, label) {
  11311. let _self = this;
  11312. let entity = new Cesium.Entity({
  11313. name: _self._sketchEntityName + "_Point",
  11314. position: coord,
  11315. billboard: {
  11316. image: _self._sketchPointImage,
  11317. horizontalOrigin: Cesium.HorizontalOrigin.center,
  11318. verticalOrigin: Cesium.VerticalOrigin.bottom,
  11319. scale: 0.5,
  11320. pixelOffset: new Cesium.Cartesian2(0, -11),
  11321. disableDepthTestDistance: Number.POSITIVE_INFINITY
  11322. }
  11323. });
  11324. if (label) {
  11325. entity.label = {
  11326. text: label,
  11327. font: "12px sans-serif",
  11328. fillColor: this._toColor(255, 255, 255, 1),
  11329. outlineColor: this._toColor(0, 154, 94, 1),
  11330. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  11331. outlineWidth: 1,
  11332. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  11333. pixelOffset: new Cesium.Cartesian2(0, -28),
  11334. showBackground: true,
  11335. backgroundColor: this._toColor(0, 0, 0, 0.6),
  11336. disableDepthTestDistance: Number.POSITIVE_INFINITY
  11337. };
  11338. }
  11339. this._entities.add(entity);
  11340. this._pointEntitys.push(entity);
  11341. this._updateScene();
  11342. }
  11343. _removePointEntitys() {
  11344. this._removeEntityByName(this._sketchEntityName + "_Point");
  11345. this._pointEntitys = [];
  11346. }
  11347. _createTempPolyline() {
  11348. let _self = this;
  11349. if (!Cesium.defined(this._sketchTempPolyline)) {
  11350. this._sketchTempPolyline = new Cesium.Entity({
  11351. name: _self._sketchEntityName,
  11352. polyline: {
  11353. show: true,
  11354. positions: new Cesium.CallbackProperty(function() {
  11355. return _self._sketchTempPoints;
  11356. }, false),
  11357. material: _self._tempLineMaterial,
  11358. width: _self._param.moveLineWidth,
  11359. clampToGround: true
  11360. }
  11361. });
  11362. this._entities.add(this._sketchTempPolyline);
  11363. this._updateScene();
  11364. }
  11365. }
  11366. _createPolyline() {
  11367. let _self = this;
  11368. if (!Cesium.defined(this._sketchPolyline)) {
  11369. this._sketchPolyline = new Cesium.Entity({
  11370. name: _self._sketchEntityName,
  11371. polyline: {
  11372. show: true,
  11373. positions: _self._sketchPoints,
  11374. material: _self._lineMaterial,
  11375. width: _self._param.lineWidth,
  11376. clampToGround: true
  11377. }
  11378. });
  11379. this._entities.add(this._sketchPolyline);
  11380. this._updateScene();
  11381. }
  11382. }
  11383. _createTempSpatialPolyline() {
  11384. let _self = this;
  11385. if (!Cesium.defined(this._sketchTempSpatialPolyline)) {
  11386. this._sketchTempSpatialPolyline = new Cesium.Entity({
  11387. name: _self._sketchEntityName,
  11388. polyline: {
  11389. show: true,
  11390. positions: new Cesium.CallbackProperty(function() {
  11391. return _self._sketchTempPoints;
  11392. }, false),
  11393. material: _self._tempLineMaterial,
  11394. width: _self._param.moveLineWidth,
  11395. clampToGround: false
  11396. }
  11397. });
  11398. this._entities.add(this._sketchTempSpatialPolyline);
  11399. this._updateScene();
  11400. }
  11401. }
  11402. _createSpatialPolyline() {
  11403. let _self = this;
  11404. if (!Cesium.defined(this._sketchSpatialPolyline)) {
  11405. this._sketchSpatialPolyline = new Cesium.Entity({
  11406. name: _self._sketchEntityName,
  11407. polyline: {
  11408. show: true,
  11409. positions: _self._sketchPoints,
  11410. material: _self._spatialLineMaterial,
  11411. width: _self._param.spatialLineWidth,
  11412. clampToGround: false
  11413. }
  11414. });
  11415. this._entities.add(this._sketchSpatialPolyline);
  11416. this._updateScene();
  11417. }
  11418. }
  11419. _createTempPolygon() {
  11420. let _self = this;
  11421. if (!Cesium.defined(this._sketchTempPolygon)) {
  11422. this._sketchTempPolygon = new Cesium.Entity({
  11423. name: _self._sketchEntityName,
  11424. polygon: {
  11425. show: true,
  11426. hierarchy: new Cesium.CallbackProperty(function() {
  11427. return {
  11428. positions: _self._sketchTempPoints
  11429. };
  11430. }, false),
  11431. material: _self._tempPolygonMaterial,
  11432. classificationType: Cesium.ClassificationType.BOTH
  11433. }
  11434. });
  11435. this._entities.add(this._sketchTempPolygon);
  11436. this._updateScene();
  11437. }
  11438. }
  11439. _createPolygon() {
  11440. let _self = this;
  11441. if (!Cesium.defined(this._sketchPolygon)) {
  11442. this._sketchPoints.push(this._sketchPoints[0]);
  11443. this._sketchPolygon = new Cesium.Entity({
  11444. name: _self._sketchEntityName,
  11445. polygon: {
  11446. show: true,
  11447. hierarchy: {
  11448. positions: _self._sketchPoints
  11449. },
  11450. material: _self._polygonMaterial,
  11451. classificationType: Cesium.ClassificationType.BOTH
  11452. },
  11453. polyline: {
  11454. show: true,
  11455. positions: _self._sketchPoints,
  11456. material: _self._lineMaterial,
  11457. width: _self._param.lineWidth,
  11458. clampToGround: true
  11459. }
  11460. });
  11461. this._entities.add(this._sketchPolygon);
  11462. this._updateScene();
  11463. }
  11464. }
  11465. _createPolygonBody(options2) {
  11466. let _self = this;
  11467. let appendHeight = parseFloat(100);
  11468. if (options2 && options2.height && typeof options2.height === "number")
  11469. appendHeight = parseFloat(options2.height);
  11470. let wallColor = [255, 255, 0, 1];
  11471. let polygonColor = [0, 0, 255, 0.65];
  11472. if (options2 && options2.color && this._checkColorAndAlpha(options2.color))
  11473. polygonColor = this._checkColorAndAlpha(options2.color);
  11474. if (!Cesium.defined(this._sketchPolygon)) {
  11475. let shaderSource = "czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n material.diffuse = color.rgb;\n material.alpha = color.a;\n return material;\n}";
  11476. let wallMaterial = new Cesium.Material({
  11477. fabric: {
  11478. type: "wallMaterial",
  11479. uniforms: {
  11480. color: _self._toColorFromArray(wallColor),
  11481. speed: 100
  11482. },
  11483. source: shaderSource
  11484. }
  11485. });
  11486. new Cesium.MaterialAppearance({
  11487. material: wallMaterial
  11488. });
  11489. let polygonAppearance = new Cesium.MaterialAppearance({
  11490. material: new Cesium.Material({
  11491. fabric: {
  11492. type: "Color",
  11493. uniforms: {
  11494. color: _self._toColorFromArray(polygonColor)
  11495. }
  11496. }
  11497. })
  11498. });
  11499. let wallMinimumHeights = [];
  11500. let wallMaximumHeights = [];
  11501. for (let i2 = 0; i2 < _self._sketchOutputPoints.length; i2++) {
  11502. let height3 = parseFloat(_self._sketchOutputPoints[i2].height);
  11503. wallMinimumHeights.push(height3);
  11504. wallMaximumHeights.push(height3 + appendHeight);
  11505. }
  11506. let height2 = parseFloat(_self._sketchOutputPoints[0].height);
  11507. wallMinimumHeights.push(height2);
  11508. wallMaximumHeights.push(height2 + appendHeight);
  11509. let tempPoints = [];
  11510. for (let i2 = 0; i2 < _self._sketchPoints.length; i2++) {
  11511. tempPoints.push(_self._sketchPoints[i2]);
  11512. }
  11513. tempPoints.push(_self._sketchPoints[0]);
  11514. new Cesium.WallGeometry({
  11515. positions: tempPoints,
  11516. maximumHeights: wallMaximumHeights,
  11517. minimumHeights: wallMinimumHeights
  11518. });
  11519. let polygonGeometry = new Cesium.PolygonGeometry({
  11520. polygonHierarchy: new Cesium.PolygonHierarchy(tempPoints),
  11521. perPositionHeight: true,
  11522. extrudedHeight: Math.max.apply(null, wallMaximumHeights)
  11523. });
  11524. let polygonPrimitive = new Cesium.Primitive({
  11525. geometryInstances: new Cesium.GeometryInstance({
  11526. geometry: polygonGeometry
  11527. }),
  11528. appearance: polygonAppearance,
  11529. releaseGeometryInstances: false
  11530. });
  11531. polygonPrimitive.setUseGeometry({
  11532. cPoints: _self._sketchPoints,
  11533. gPoints: _self._sketchOutputPoints,
  11534. height: appendHeight,
  11535. color: polygonColor
  11536. });
  11537. this._viewer.scene.primitives.add(polygonPrimitive);
  11538. }
  11539. }
  11540. _callUpdaeEllipseCenterPosition() {
  11541. let _self = this;
  11542. return function() {
  11543. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11544. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11545. _self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  11546. return _self._sketchEllipseCenterPosition;
  11547. };
  11548. }
  11549. _callUpdateAltitudePolylinePositions() {
  11550. let _self = this;
  11551. return function() {
  11552. _self._sketchAltitudePolylinePostions = [];
  11553. _self._sketchAltitudePolylinePostions.push(_self._sketchTempPoints[0]);
  11554. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11555. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11556. let point_temp = Cesium.Cartesian3.fromDegrees(
  11557. Cesium.Math.toDegrees(
  11558. point1cartographic.longitude
  11559. ),
  11560. Cesium.Math.toDegrees(point1cartographic.latitude),
  11561. point2cartographic.height
  11562. );
  11563. _self._sketchAltitudePolylinePostions.push(point_temp);
  11564. return _self._sketchAltitudePolylinePostions;
  11565. };
  11566. }
  11567. _callUpdateEllipseMinorAxis() {
  11568. let _self = this;
  11569. return function() {
  11570. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11571. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11572. let geodesic = new Cesium.EllipsoidGeodesic();
  11573. geodesic.setEndPoints(point1cartographic, point2cartographic);
  11574. _self._sketchEllipseRadius = geodesic.surfaceDistance;
  11575. if (_self._sketchEllipseRadius <= 0)
  11576. _self._sketchEllipseRadius = 1;
  11577. return _self._sketchEllipseRadius;
  11578. };
  11579. }
  11580. _callUpdateEllipseHeight() {
  11581. let _self = this;
  11582. return function() {
  11583. let cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11584. let cartographic1 = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11585. let height_temp = cartographic1.height - cartographic.height;
  11586. _self._sketchEllipseHeight = height_temp + _self._sketchAltitudeInitHeight;
  11587. return _self._sketchEllipseHeight;
  11588. };
  11589. }
  11590. _createTempAltitudePolyline() {
  11591. let _self = this;
  11592. if (!Cesium.defined(this._sketchTempAltituePolyline)) {
  11593. this._sketchTempAltituePolyline = new Cesium.Entity({
  11594. name: _self._sketchEntityName,
  11595. position: new Cesium.CallbackProperty(
  11596. _self._callUpdaeEllipseCenterPosition(),
  11597. false
  11598. ),
  11599. polyline: {
  11600. show: true,
  11601. positions: new Cesium.CallbackProperty(
  11602. _self._callUpdateAltitudePolylinePositions(),
  11603. false
  11604. ),
  11605. material: _self._tempAlititudeLineMaterial,
  11606. width: _self._param.moveAltitudeLineWidth,
  11607. clampToGround: false
  11608. },
  11609. ellipse: {
  11610. show: true,
  11611. semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
  11612. semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
  11613. height: new Cesium.CallbackProperty(_self._callUpdateEllipseHeight(), false),
  11614. material: _self._toColorFromArray(_self._param.moveEllipseColor),
  11615. outline: _self._param.moveEllipseOutline,
  11616. outlineWidth: _self._param.moveEllipseOutlineWidth,
  11617. outlineColor: _self._toColorFromArray(_self._param.moveEllipseOutlineColor)
  11618. }
  11619. });
  11620. _self._entities.add(_self._sketchTempAltituePolyline);
  11621. }
  11622. }
  11623. _createAltitudePolyline() {
  11624. let _self = this;
  11625. if (!Cesium.defined(this._sketchAltitudePolyline)) {
  11626. this._sketchAltitudePolyline = new Cesium.Entity({
  11627. name: _self._sketchEntityName,
  11628. position: _self._sketchEllipseCenterPosition,
  11629. polyline: {
  11630. show: true,
  11631. positions: _self._sketchAltitudePolylinePostions,
  11632. material: _self._altitudeLineMaterial,
  11633. width: _self._param.altitudeLineWidth,
  11634. clampToGround: false
  11635. },
  11636. ellipse: {
  11637. show: true,
  11638. semiMinorAxis: _self._sketchEllipseRadius,
  11639. semiMajorAxis: _self._sketchEllipseRadius,
  11640. height: _self._sketchEllipseHeight,
  11641. material: _self._toColorFromArray(_self._param.ellipseColor),
  11642. outline: _self._param.ellipseOutline,
  11643. outlineWidth: _self._param.ellipseOutlineWidth,
  11644. outlineColor: _self._toColorFromArray(_self._param.ellipseOutlineColor)
  11645. }
  11646. });
  11647. _self._entities.add(_self._sketchAltitudePolyline);
  11648. }
  11649. }
  11650. _callEllipseOutlineCoordinate() {
  11651. let _self = this;
  11652. return function() {
  11653. let positionCenter = _self._sketchEllipseCenterPosition;
  11654. let positionRotate = _self._sketchTempPoints[1];
  11655. _self._ellipseOutlineCoordinates = [];
  11656. for (let angle = 5; angle < 360; ) {
  11657. let newPosition = _self._rotatedPointByAngle(positionRotate, positionCenter, angle);
  11658. _self._ellipseOutlineCoordinates.push(newPosition);
  11659. angle = angle + 5;
  11660. }
  11661. _self._ellipseOutlineCoordinates.push(_self._ellipseOutlineCoordinates[0]);
  11662. return _self._ellipseOutlineCoordinates;
  11663. };
  11664. }
  11665. _createTempCircle(centerPosition) {
  11666. let _self = this;
  11667. if (!Cesium.defined(this._sketchTempCircle)) {
  11668. _self._sketchEllipseCenterPosition = centerPosition.clone();
  11669. this._sketchTempCircle = new Cesium.Entity({
  11670. name: _self._sketchEntityName,
  11671. position: centerPosition,
  11672. polyline: {
  11673. show: true,
  11674. positions: new Cesium.CallbackProperty(_self._callEllipseOutlineCoordinate(), false),
  11675. material: _self._tempLineMaterial,
  11676. width: _self._param.moveLineWidth,
  11677. clampToGround: true
  11678. },
  11679. ellipse: {
  11680. show: true,
  11681. semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
  11682. semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(), false),
  11683. material: _self._tempPolygonMaterial,
  11684. classificationType: Cesium.ClassificationType.BOTH
  11685. }
  11686. });
  11687. _self._entities.add(_self._sketchTempCircle);
  11688. }
  11689. }
  11690. _rotatedPointByAngle(position_A, position_B, angle) {
  11691. var localToWorld_Matrix = Cesium.Transforms.eastNorthUpToFixedFrame(position_B);
  11692. var worldToLocal_Matrix = Cesium.Matrix4.inverse(localToWorld_Matrix, new Cesium.Matrix4());
  11693. Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_B, new Cesium.Cartesian3());
  11694. var localPosition_A = Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_A, new Cesium.Cartesian3());
  11695. var new_x = localPosition_A.x * Math.cos(Cesium.Math.toRadians(angle)) + localPosition_A.y * Math.sin(Cesium.Math.toRadians(angle));
  11696. var new_y = localPosition_A.y * Math.cos(Cesium.Math.toRadians(angle)) - localPosition_A.x * Math.sin(Cesium.Math.toRadians(angle));
  11697. var new_z = localPosition_A.z;
  11698. return Cesium.Matrix4.multiplyByPoint(
  11699. localToWorld_Matrix,
  11700. new Cesium.Cartesian3(new_x, new_y, new_z),
  11701. new Cesium.Cartesian3()
  11702. );
  11703. }
  11704. _createCircle() {
  11705. let _self = this;
  11706. if (!Cesium.defined(this._sketchCircle)) {
  11707. this._sketchCircle = new Cesium.Entity({
  11708. name: _self._sketchEntityName,
  11709. position: _self._sketchEllipseCenterPosition,
  11710. polyline: {
  11711. show: true,
  11712. positions: _self._ellipseOutlineCoordinates,
  11713. material: _self._lineMaterial,
  11714. width: _self._param.lineWidth,
  11715. clampToGround: true
  11716. },
  11717. ellipse: {
  11718. show: true,
  11719. semiMinorAxis: _self._sketchEllipseRadius,
  11720. semiMajorAxis: _self._sketchEllipseRadius,
  11721. material: _self._polygonMaterial,
  11722. classificationType: Cesium.ClassificationType.BOTH
  11723. }
  11724. });
  11725. _self._entities.add(_self._sketchCircle);
  11726. }
  11727. }
  11728. _callUpdateRectangleCoordinates() {
  11729. let _self = this;
  11730. return function() {
  11731. let lng0 = parseFloat(_self._sketchTempPoints[0].lng);
  11732. let lat0 = parseFloat(_self._sketchTempPoints[0].lat);
  11733. let lng1 = parseFloat(_self._sketchTempPoints[1].lng);
  11734. let lat1 = parseFloat(_self._sketchTempPoints[1].lat);
  11735. _self._rectangleCoordinates = [0, 0, 1, 1];
  11736. if (lng0 < lng1) {
  11737. _self._rectangleCoordinates[0] = lng0;
  11738. _self._rectangleCoordinates[2] = lng1;
  11739. } else {
  11740. _self._rectangleCoordinates[0] = lng1;
  11741. _self._rectangleCoordinates[2] = lng0;
  11742. }
  11743. if (lat0 < lat1) {
  11744. _self._rectangleCoordinates[1] = lat0;
  11745. _self._rectangleCoordinates[3] = lat1;
  11746. } else {
  11747. _self._rectangleCoordinates[1] = lat1;
  11748. _self._rectangleCoordinates[3] = lat0;
  11749. }
  11750. let rectangle = Cesium.Rectangle.fromDegrees(
  11751. _self._rectangleCoordinates[0],
  11752. _self._rectangleCoordinates[1],
  11753. _self._rectangleCoordinates[2],
  11754. _self._rectangleCoordinates[3]
  11755. );
  11756. let res = _self._calculateRectangleOutlineCoordinates(rectangle);
  11757. _self._rectangleOutlineCoordinates = res.cPoints;
  11758. _self._sketchOutputPoints = res.gPoints;
  11759. return rectangle;
  11760. };
  11761. }
  11762. _calculateRectangleOutlineCoordinates(rectangle) {
  11763. let south_east = Cesium.Rectangle.southeast(rectangle);
  11764. let se2 = Cesium.Cartographic.toCartesian(south_east);
  11765. let south_west = Cesium.Rectangle.southwest(rectangle);
  11766. let sw = Cesium.Cartographic.toCartesian(south_west);
  11767. let north_east = Cesium.Rectangle.northeast(rectangle);
  11768. let ne2 = Cesium.Cartographic.toCartesian(north_east);
  11769. let north_west = Cesium.Rectangle.northwest(rectangle);
  11770. let nw = Cesium.Cartographic.toCartesian(north_west);
  11771. let gPoints = [];
  11772. gPoints.push({
  11773. lng: Cesium.Math.toDegrees(south_west.longitude),
  11774. lat: Cesium.Math.toDegrees(south_west.latitude),
  11775. height: south_west.height
  11776. });
  11777. gPoints.push({
  11778. lng: Cesium.Math.toDegrees(south_east.longitude),
  11779. lat: Cesium.Math.toDegrees(south_east.latitude),
  11780. height: south_east.height
  11781. });
  11782. gPoints.push({
  11783. lng: Cesium.Math.toDegrees(north_east.longitude),
  11784. lat: Cesium.Math.toDegrees(north_east.latitude),
  11785. height: north_east.height
  11786. });
  11787. gPoints.push({
  11788. lng: Cesium.Math.toDegrees(north_west.longitude),
  11789. lat: Cesium.Math.toDegrees(north_west.latitude),
  11790. height: north_west.height
  11791. });
  11792. gPoints.push({
  11793. lng: Cesium.Math.toDegrees(south_west.longitude),
  11794. lat: Cesium.Math.toDegrees(south_west.latitude),
  11795. height: south_west.height
  11796. });
  11797. return {
  11798. cPoints: [sw, se2, ne2, nw, sw],
  11799. gPoints
  11800. };
  11801. }
  11802. _callUpdateRectangleOutlineCoordinates() {
  11803. let _self = this;
  11804. return function() {
  11805. return _self._rectangleOutlineCoordinates;
  11806. };
  11807. }
  11808. _createTempRectangle() {
  11809. let _self = this;
  11810. if (!Cesium.defined(this._sketchTempRectangle)) {
  11811. this._sketchTempRectangle = new Cesium.Entity({
  11812. name: _self._sketchEntityName,
  11813. polyline: {
  11814. show: true,
  11815. positions: new Cesium.CallbackProperty(_self._callUpdateRectangleOutlineCoordinates(), false),
  11816. material: _self._tempLineMaterial,
  11817. width: _self._param.moveLineWidth,
  11818. clampToGround: true
  11819. },
  11820. rectangle: {
  11821. show: true,
  11822. coordinates: new Cesium.CallbackProperty(_self._callUpdateRectangleCoordinates(), false),
  11823. material: _self._tempPolygonMaterial,
  11824. classificationType: Cesium.ClassificationType.BOTH
  11825. }
  11826. });
  11827. _self._entities.add(_self._sketchTempRectangle);
  11828. }
  11829. }
  11830. _createRectangle() {
  11831. let _self = this;
  11832. if (!Cesium.defined(this._sketchRectangle)) {
  11833. this._sketchRectangle = new Cesium.Entity({
  11834. name: _self._sketchEntityName,
  11835. polyline: {
  11836. show: true,
  11837. positions: _self._rectangleOutlineCoordinates,
  11838. material: _self._lineMaterial,
  11839. width: _self._param.lineWidth,
  11840. clampToGround: true
  11841. },
  11842. rectangle: {
  11843. show: true,
  11844. coordinates: Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]),
  11845. material: _self._polygonMaterial,
  11846. classificationType: Cesium.ClassificationType.BOTH
  11847. }
  11848. });
  11849. _self._entities.add(_self._sketchRectangle);
  11850. }
  11851. }
  11852. _callUpdaeTriangleEllipseCenterPosition() {
  11853. let _self = this;
  11854. return function() {
  11855. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11856. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
  11857. _self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  11858. return _self._sketchEllipseCenterPosition;
  11859. };
  11860. }
  11861. _callUpdateTriangleAltitudePolylinePositions() {
  11862. let _self = this;
  11863. return function() {
  11864. _self._sketchAltitudePolylinePostions = [];
  11865. _self._sketchAltitudePolylinePostions.push(_self._sketchTempPoints[1]);
  11866. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11867. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
  11868. let point_temp = Cesium.Cartesian3.fromDegrees(
  11869. Cesium.Math.toDegrees(
  11870. point1cartographic.longitude
  11871. ),
  11872. Cesium.Math.toDegrees(point1cartographic.latitude),
  11873. point2cartographic.height
  11874. );
  11875. _self._sketchAltitudePolylinePostions.push(point_temp);
  11876. return _self._sketchAltitudePolylinePostions;
  11877. };
  11878. }
  11879. _callUpdateTriangleEllipseMinorAxis() {
  11880. let _self = this;
  11881. return function() {
  11882. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11883. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
  11884. let geodesic = new Cesium.EllipsoidGeodesic();
  11885. geodesic.setEndPoints(point1cartographic, point2cartographic);
  11886. _self._sketchEllipseRadius = geodesic.surfaceDistance;
  11887. if (_self._sketchEllipseRadius <= 0)
  11888. _self._sketchEllipseRadius = 1;
  11889. return _self._sketchEllipseRadius;
  11890. };
  11891. }
  11892. _callUpdateTriangleEllipseHeight() {
  11893. let _self = this;
  11894. return function() {
  11895. let cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11896. let cartographic1 = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[2]);
  11897. let height_temp = cartographic1.height - cartographic.height;
  11898. _self._sketchEllipseHeight = height_temp + _self._sketchAltitudeInitHeight;
  11899. return _self._sketchEllipseHeight;
  11900. };
  11901. }
  11902. _callUpdateTriangleSpatialPolylinePositions() {
  11903. let _self = this;
  11904. return function() {
  11905. _self._sketchTriangleSpatialPolylinePositions = [];
  11906. _self._sketchTriangleSpatialPolylinePositions.push(_self._sketchTempPoints[0]);
  11907. _self._sketchTriangleSpatialPolylinePositions.push(_self._sketchEllipseCenterPosition);
  11908. return _self._sketchTriangleSpatialPolylinePositions;
  11909. };
  11910. }
  11911. _createTriangleSpatialPolyline() {
  11912. let _self = this;
  11913. this._sketchSpatialPolyline = new Cesium.Entity({
  11914. name: _self._sketchEntityName,
  11915. polyline: {
  11916. show: true,
  11917. positions: _self._sketchTriangleSpatialPolylinePositions,
  11918. material: _self._spatialLineMaterial,
  11919. width: _self._param.spatialLineWidth,
  11920. clampToGround: false
  11921. }
  11922. });
  11923. this._entities.add(this._sketchSpatialPolyline);
  11924. }
  11925. _createTempTriangleAltitudePolylineAndSpatialPolyline() {
  11926. let _self = this;
  11927. if (!Cesium.defined(this._sketchTempTriangleAltitudePolyline) && !Cesium.defined(this._sketchTempSpatialPolyline)) {
  11928. this._sketchTempTriangleAltitudePolyline = new Cesium.Entity({
  11929. name: _self._sketchEntityName,
  11930. position: new Cesium.CallbackProperty(
  11931. _self._callUpdaeTriangleEllipseCenterPosition(),
  11932. false
  11933. ),
  11934. polyline: {
  11935. show: true,
  11936. positions: new Cesium.CallbackProperty(
  11937. _self._callUpdateTriangleAltitudePolylinePositions(),
  11938. false
  11939. ),
  11940. material: _self._tempAlititudeLineMaterial,
  11941. width: _self._param.moveAltitudeLineWidth,
  11942. clampToGround: false
  11943. },
  11944. ellipse: {
  11945. show: true,
  11946. semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateTriangleEllipseMinorAxis(), false),
  11947. semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateTriangleEllipseMinorAxis(), false),
  11948. height: new Cesium.CallbackProperty(_self._callUpdateTriangleEllipseHeight(), false),
  11949. material: _self._toColorFromArray(_self._param.moveEllipseColor),
  11950. outline: _self._param.moveEllipseOutline,
  11951. outlineWidth: _self._param.moveEllipseOutlineWidth,
  11952. outlineColor: _self._toColorFromArray(_self._param.moveEllipseOutlineColor)
  11953. }
  11954. });
  11955. _self._entities.add(_self._sketchTempTriangleAltitudePolyline);
  11956. _self._sketchTempSpatialPolyline = new Cesium.Entity({
  11957. name: _self._sketchEntityName,
  11958. polyline: {
  11959. show: true,
  11960. positions: new Cesium.CallbackProperty(_self._callUpdateTriangleSpatialPolylinePositions(), false),
  11961. material: _self._tempLineMaterial,
  11962. width: _self._param.moveLineWidth,
  11963. clampToGround: false
  11964. }
  11965. });
  11966. _self._entities.add(_self._sketchTempSpatialPolyline);
  11967. }
  11968. }
  11969. _createTempSpatialTriangle() {
  11970. let _self = this;
  11971. if (!Cesium.defined(this._sketchTempSpatialTriangle)) {
  11972. this._sketchTempSpatialTriangle = new Cesium.Entity({
  11973. name: _self._sketchEntityName,
  11974. polyline: {
  11975. show: true,
  11976. positions: new Cesium.CallbackProperty(function() {
  11977. _self._sketchSpatialTrianglePositions = [];
  11978. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
  11979. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[1].clone());
  11980. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  11981. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  11982. let point_temp = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  11983. _self._sketchSpatialTrianglePositions.push(point_temp);
  11984. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
  11985. return _self._sketchSpatialTrianglePositions;
  11986. }, false),
  11987. material: _self._tempLineMaterial,
  11988. width: _self._param.moveLineWidth,
  11989. clampToGround: false
  11990. }
  11991. });
  11992. this._entities.add(this._sketchTempSpatialTriangle);
  11993. this._updateScene();
  11994. }
  11995. }
  11996. _createSpatialTriangle() {
  11997. let _self = this;
  11998. if (!Cesium.defined(this._sketchSpatialTriangle)) {
  11999. this._sketchSpatialTriangle = new Cesium.Entity({
  12000. name: _self._sketchEntityName,
  12001. polyline: {
  12002. show: true,
  12003. positions: _self._sketchSpatialTrianglePositions,
  12004. material: _self._lineMaterial,
  12005. width: _self._param.lineWidth,
  12006. clampToGround: false
  12007. }
  12008. });
  12009. this._entities.add(this._sketchSpatialTriangle);
  12010. this._updateScene();
  12011. }
  12012. }
  12013. _setMoveLineStyle(options2) {
  12014. let _self = this;
  12015. let color2 = [255, 255, 255, 1];
  12016. let lineWidth = 3;
  12017. let isOutline = false;
  12018. let power = 0.2;
  12019. let outlineColor = [255, 0, 0, 1];
  12020. let outlineWidth = 1;
  12021. if (options2 && options2.color && options2.color.length === 4)
  12022. color2 = options2.color;
  12023. if (options2 && options2.outline && typeof options2.outline === "boolean")
  12024. isOutline = options2.outline;
  12025. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12026. outlineColor = options2.outlineColor;
  12027. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12028. outlineWidth = options2.outlineWidth;
  12029. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12030. lineWidth = options2.lineWidth;
  12031. if (options2 && options2.power)
  12032. power = options2.power;
  12033. if (isOutline) {
  12034. this._tempLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12035. color: _self._toColorFromArray(color2),
  12036. outlineColor: _self._toColorFromArray(outlineColor),
  12037. outlineWidth
  12038. });
  12039. } else {
  12040. if (power === void 0) {
  12041. this._tempLineMaterial = new Cesium.PolylineDashMaterialProperty({
  12042. color: _self._toColorFromArray(color2)
  12043. });
  12044. } else {
  12045. this._tempLineMaterial = new Cesium.PolylineGlowMaterialProperty({
  12046. color: _self._toColorFromArray(color2),
  12047. glowPower: power
  12048. });
  12049. }
  12050. }
  12051. this._param.moveLineWidth = lineWidth;
  12052. }
  12053. _setLineStyle(options2) {
  12054. let _self = this;
  12055. let color2 = [255, 255, 255, 1];
  12056. let lineWidth = 2;
  12057. let outlineColor = [0, 255, 0, 0.6];
  12058. let outlineWidth = 1;
  12059. if (options2 && options2.color && options2.color.length === 4)
  12060. color2 = options2.color;
  12061. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12062. outlineColor = options2.outlineColor;
  12063. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12064. outlineWidth = options2.outlineWidth;
  12065. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12066. lineWidth = options2.lineWidth;
  12067. this._lineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12068. color: _self._toColorFromArray(color2),
  12069. outlineColor: _self._toColorFromArray(outlineColor),
  12070. outlineWidth
  12071. });
  12072. this._param.lineWidth = lineWidth;
  12073. }
  12074. _setSpatialLineStyle(options2) {
  12075. let _self = this;
  12076. let color2 = [255, 255, 0, 1];
  12077. let lineWidth = 2;
  12078. let outlineColor = [255, 255, 255, 1];
  12079. let outlineWidth = 1;
  12080. if (options2 && options2.color && options2.color.length === 4)
  12081. color2 = options2.color;
  12082. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12083. outlineColor = options2.outlineColor;
  12084. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12085. outlineWidth = options2.outlineWidth;
  12086. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12087. lineWidth = options2.lineWidth;
  12088. this._spatialLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12089. color: _self._toColorFromArray(color2),
  12090. outlineColor: _self._toColorFromArray(outlineColor),
  12091. outlineWidth
  12092. });
  12093. this._param.spatialLineWidth = lineWidth;
  12094. }
  12095. _setMovePolygonStyle(options2) {
  12096. let polygonColor = [255, 0, 0, 0.3];
  12097. if (options2 && options2.color && options2.color.length === 4)
  12098. polygonColor = options2.color;
  12099. this._tempPolygonMaterial = new Cesium.ColorMaterialProperty(this._toColorFromArray(polygonColor));
  12100. }
  12101. _setPolygonStyle(options2) {
  12102. let polygonColor = [0, 0, 255, 0.3];
  12103. if (options2 && options2.color && options2.color.length === 4)
  12104. polygonColor = options2.color;
  12105. this._polygonMaterial = new Cesium.ColorMaterialProperty(this._toColorFromArray(polygonColor));
  12106. }
  12107. _setMoveAltitudeLineStyle(options2) {
  12108. let _self = this;
  12109. let color2 = [255, 255, 255, 1];
  12110. let lineWidth = 2;
  12111. let isOutline = true;
  12112. let outlineColor = [255, 255, 0, 1];
  12113. let outlineWidth = 1;
  12114. if (options2 && options2.color && options2.color.length === 4)
  12115. color2 = options2.color;
  12116. if (options2 && options2.outline && typeof options2.outline === "boolean")
  12117. isOutline = options2.outline;
  12118. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12119. outlineColor = options2.outlineColor;
  12120. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12121. outlineWidth = options2.outlineWidth;
  12122. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12123. lineWidth = options2.lineWidth;
  12124. if (isOutline) {
  12125. this._tempAlititudeLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12126. color: _self._toColorFromArray(color2),
  12127. outlineColor: _self._toColorFromArray(outlineColor),
  12128. outlineWidth
  12129. });
  12130. } else {
  12131. this._tempAlititudeLineMaterial = new Cesium.PolylineDashMaterialProperty({
  12132. color: _self._toColorFromArray(color2)
  12133. });
  12134. }
  12135. this._param.moveAltitudeLineWidth = lineWidth;
  12136. }
  12137. _setAltitudeLineStyle(options2) {
  12138. let _self = this;
  12139. let color2 = [255, 255, 255, 1];
  12140. let lineWidth = 2;
  12141. let outlineColor = [0, 0, 255, 1];
  12142. let outlineWidth = 1;
  12143. if (options2 && options2.color && options2.color.length === 4)
  12144. color2 = options2.color;
  12145. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12146. outlineColor = options2.outlineColor;
  12147. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12148. outlineWidth = options2.outlineWidth;
  12149. if (options2 && options2.lineWidth && typeof options2.lineWidth === "number")
  12150. lineWidth = options2.lineWidth;
  12151. this._altitudeLineMaterial = new Cesium.PolylineOutlineMaterialProperty({
  12152. color: _self._toColorFromArray(color2),
  12153. outlineColor: _self._toColorFromArray(outlineColor),
  12154. outlineWidth
  12155. });
  12156. this._param.altitudeLineWidth = lineWidth;
  12157. }
  12158. _setMoveEllipseStyle(options2) {
  12159. if (options2 && options2.color && options2.color.length === 4)
  12160. this._param.moveEllipseColor = options2.color;
  12161. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12162. this._param.moveEllipseOutlineWidth = options2.outlineWidth;
  12163. if (options2 && options2.outline && typeof options2.outline === "boolean")
  12164. this._param.moveEllipseOutline = options2.outline;
  12165. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12166. this._param.moveEllipseOutlineColor = options2.outlineColor;
  12167. }
  12168. _setEllipseStyle(options2) {
  12169. if (options2 && options2.color && options2.color.length === 4)
  12170. this._param.ellipseColor = options2.color;
  12171. if (options2 && options2.outlineWidth && typeof options2.outlineWidth === "number")
  12172. this._param.ellipseOutlineWidth = options2.outlineWidth;
  12173. if (options2 && options2.outline && typeof options2.outline === "boolean")
  12174. this._param.ellipseOutline = options2.outline;
  12175. if (options2 && options2.outlineColor && options2.outlineColor.length === 4)
  12176. this._param.ellipseOutlineColor = options2.outlineColor;
  12177. }
  12178. _clear(isAll) {
  12179. if (isAll != void 0 && isAll === true) {
  12180. this._removeEntityByName(this._sketchEntityName);
  12181. this._removePointEntitys();
  12182. }
  12183. this._sketchTempPoints = [];
  12184. this._sketchPoints = [];
  12185. this._sketchOutputPoints = [];
  12186. this._sketchTempPolyline = void 0;
  12187. this._sketchPolyline = void 0;
  12188. this._sketchTempPolygon = void 0;
  12189. this._sketchPolygon = void 0;
  12190. this._sketchTempAltituePolyline = void 0;
  12191. this._sketchAltitudePolyline = void 0;
  12192. this._sketchTempSpatialPolyline = void 0;
  12193. this._sketchSpatialPolyline = void 0;
  12194. this._sketchTempCircle = void 0;
  12195. this._sketchCircle = void 0;
  12196. this._sketchTempRectangle = void 0;
  12197. this._sketchRectangle = void 0;
  12198. this._sketchTempTriangleAltitudePolyline = void 0;
  12199. this._sketchTriangleAltituePolyline = void 0;
  12200. this._sketchTempSpatialTriangle = void 0;
  12201. this._sketchSpatialTriangle = void 0;
  12202. }
  12203. _checkAppOrWeb() {
  12204. if (window.navigator.userAgent.match(
  12205. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  12206. )) {
  12207. return SketchViewModel.RuntimeEnvironment.App;
  12208. } else {
  12209. return SketchViewModel.RuntimeEnvironment.Web;
  12210. }
  12211. }
  12212. _isRuntimeApp() {
  12213. if (this._checkAppOrWeb() === SketchViewModel.RuntimeEnvironment.App) {
  12214. return true;
  12215. }
  12216. return false;
  12217. }
  12218. }
  12219. Object.assign(SketchViewModel.prototype, {
  12220. setMoveLineStyle: function(options2) {
  12221. this._setMoveLineStyle(options2);
  12222. },
  12223. setLineStyle: function(options2) {
  12224. this._setLineStyle(options2);
  12225. },
  12226. setSpatialLineStyle: function() {
  12227. this._setSpatialLineStyle(options);
  12228. },
  12229. setMovePolygonStyle: function(options2) {
  12230. this._setMovePolygonStyle(options2);
  12231. },
  12232. setPolygonStyle: function(options2) {
  12233. this._setPolygonStyle(options2);
  12234. },
  12235. setMoveAltitudeLineStyle: function(options2) {
  12236. this._setMoveAltitudeLineStyle(options2);
  12237. },
  12238. setAltitudeLineStyle: function(options2) {
  12239. this._setAltitudeLineStyle(options2);
  12240. },
  12241. setMoveEllipseStyle: function(options2) {
  12242. this._setMoveEllipseStyle(options2);
  12243. },
  12244. setEllipseStyle: function(options2) {
  12245. this._setEllipseStyle(options2);
  12246. },
  12247. setLabel: function(options2) {
  12248. if (!options2) {
  12249. options2 = {
  12250. lineLabel: void 0,
  12251. polygonLabel: void 0
  12252. };
  12253. }
  12254. if (options2.lineLabel)
  12255. this._lineLabel = options2.lineLabel;
  12256. if (options2.polygonLabel)
  12257. this._lineLabel = options2.polygonLabel;
  12258. }
  12259. });
  12260. Object.assign(SketchViewModel.prototype, {
  12261. _registerLeftClickEvent: function(handler, callChange) {
  12262. let _self = this;
  12263. if (!handler)
  12264. return;
  12265. handler.setInputAction(function(event2) {
  12266. _self._lock = true;
  12267. if (_self._timer != null)
  12268. clearTimeout(_self._timer);
  12269. _self._timer = setTimeout(function() {
  12270. if (callChange)
  12271. callChange(event2);
  12272. _self._lock = false;
  12273. }, 200);
  12274. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  12275. },
  12276. _registerLeftDoubleClickEvent: function(handler, callChange) {
  12277. let _self = this;
  12278. if (!handler)
  12279. return;
  12280. handler.setInputAction(function(event2) {
  12281. if (_self._timer != null)
  12282. clearTimeout(_self._timer);
  12283. _self._lock = false;
  12284. if (callChange)
  12285. callChange(event2);
  12286. }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  12287. },
  12288. _registerMouseMoveEvent: function(handler, callChange) {
  12289. let _self = this;
  12290. if (!handler)
  12291. return;
  12292. handler.setInputAction(function(event2) {
  12293. if (_self._lock === void 0 || _self._lock === false) {
  12294. if (callChange)
  12295. callChange(event2);
  12296. }
  12297. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  12298. },
  12299. _registerRightClickEvent: function(handler, callChange) {
  12300. if (!handler)
  12301. return;
  12302. handler.setInputAction(function(event2) {
  12303. if (callChange)
  12304. callChange(event2);
  12305. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  12306. },
  12307. _clearEvent: function(handler) {
  12308. if (!handler)
  12309. return;
  12310. handler.destroy();
  12311. handler = null;
  12312. }
  12313. });
  12314. Object.assign(SketchViewModel.prototype, {
  12315. _sketchDrawPoint(handler, options2) {
  12316. let _self = this;
  12317. this._registerLeftClickEvent(handler, function(event2) {
  12318. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12319. if (!Cesium.defined(loc2.sLocation))
  12320. return;
  12321. if (_self._isDrawPoint) {
  12322. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12323. }
  12324. _self._clearEvent(handler);
  12325. if (options2.onComplete)
  12326. options2.onComplete(loc2.sLocation, loc2.gLocation);
  12327. });
  12328. },
  12329. _sketchDrawMultiplePoint(handler, options2) {
  12330. let _self = this;
  12331. this._registerLeftClickEvent(handler, function(event2) {
  12332. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12333. if (!Cesium.defined(loc2.sLocation))
  12334. return;
  12335. if (_self._isDrawPoint) {
  12336. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12337. }
  12338. _self._sketchPoints.push(loc2.sLocation);
  12339. _self._sketchOutputPoints.push(loc2.gLocation);
  12340. if (options2.onAdded)
  12341. options2.onAdded(loc2.sLocation, loc2.gLocation);
  12342. });
  12343. this._registerRightClickEvent(handler, function(event2) {
  12344. if (_self._sketchPoints.length > 0) {
  12345. _self._sketchPoints.pop();
  12346. _self._sketchOutputPoints.pop();
  12347. if (options2.onUndo)
  12348. options2.onUndo();
  12349. }
  12350. });
  12351. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12352. _self._clearEvent();
  12353. if (options2.onComplete)
  12354. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12355. });
  12356. },
  12357. _sketchDrawPolyline(handler, options2) {
  12358. let _self = this;
  12359. this._registerLeftClickEvent(handler, function(event2) {
  12360. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12361. if (!Cesium.defined(loc2.sLocation))
  12362. return;
  12363. if (_self._isDrawPoint) {
  12364. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12365. }
  12366. if (_self._sketchTempPoints.length === 0) {
  12367. _self._createTempPolyline();
  12368. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12369. }
  12370. _self._sketchTempPoints.push(loc2.sLocation);
  12371. _self._sketchPoints.push(loc2.sLocation.clone());
  12372. _self._sketchOutputPoints.push(loc2.gLocation);
  12373. if (options2.onAdded)
  12374. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  12375. });
  12376. this._registerMouseMoveEvent(handler, function(event2) {
  12377. if (_self._isRuntimeApp())
  12378. return;
  12379. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12380. if (!Cesium.defined(loc2.sLocation))
  12381. return;
  12382. if (Cesium.defined(_self._sketchTempPolyline)) {
  12383. _self._sketchTempPoints.pop();
  12384. _self._sketchTempPoints.push(loc2.sLocation);
  12385. if (options2.onMoving)
  12386. options2.onMoving(loc2.sLocation);
  12387. }
  12388. });
  12389. this._registerRightClickEvent(handler, function(event2) {
  12390. if (_self._sketchTempPoints.length > 2) {
  12391. _self._sketchPoints.pop();
  12392. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  12393. if (_self._isDrawPoint) {
  12394. let lastPointEntity = _self._pointEntitys[_self._pointEntitys.length - 1];
  12395. _self._entities.remove(lastPointEntity);
  12396. _self._pointEntitys.pop();
  12397. }
  12398. if (options2.onUndo)
  12399. options2.onUndo();
  12400. }
  12401. });
  12402. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12403. if (_self._isRuntimeApp())
  12404. return;
  12405. if (_self._sketchPoints.length < 2) {
  12406. if (options2.onError)
  12407. options2.onError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12408. return;
  12409. }
  12410. _self._removeEntityByObject(_self._sketchTempPolyline);
  12411. _self._createPolyline();
  12412. if (!_self._isRetainDrawPoint)
  12413. _self._removePointEntitys();
  12414. _self._clearEvent(handler);
  12415. if (options2.onComplete)
  12416. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12417. });
  12418. },
  12419. _sketchDrawSpatialPolyline(handler, options2) {
  12420. let _self = this;
  12421. this._registerLeftClickEvent(handler, function(event2) {
  12422. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12423. if (!Cesium.defined(loc2.sLocation))
  12424. return;
  12425. if (_self._isDrawPoint) {
  12426. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12427. }
  12428. if (_self._sketchTempPoints.length === 0) {
  12429. _self._createTempSpatialPolyline();
  12430. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12431. }
  12432. _self._sketchTempPoints.push(loc2.sLocation);
  12433. _self._sketchPoints.push(loc2.sLocation.clone());
  12434. _self._sketchOutputPoints.push(loc2.gLocation);
  12435. if (options2.onAdded)
  12436. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  12437. });
  12438. this._registerMouseMoveEvent(handler, function(event2) {
  12439. if (_self._isRuntimeApp())
  12440. return;
  12441. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12442. if (!Cesium.defined(loc2.sLocation))
  12443. return;
  12444. if (Cesium.defined(_self._sketchTempSpatialPolyline)) {
  12445. _self._sketchTempPoints.pop();
  12446. _self._sketchTempPoints.push(loc2.sLocation);
  12447. if (options2.onMoving)
  12448. options2.onMoving(loc2.sLocation);
  12449. }
  12450. });
  12451. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12452. if (_self._isRuntimeApp())
  12453. return;
  12454. if (_self._sketchPoints.length < 2) {
  12455. if (options2.onError)
  12456. options2.onError("\u7ED8\u5236\u70B9\u5C11\u4E8E2\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12457. return;
  12458. }
  12459. _self._removeEntityByObject(_self._sketchTempSpatialPolyline);
  12460. _self._createSpatialPolyline();
  12461. _self._removePointEntitys();
  12462. _self._clearEvent(handler);
  12463. if (options2.onComplete)
  12464. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12465. });
  12466. this._registerRightClickEvent(handler, function(event2) {
  12467. if (_self._sketchTempPoints.length > 2) {
  12468. _self._sketchPoints.pop();
  12469. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  12470. if (options2.onUndo)
  12471. options2.onUndo();
  12472. }
  12473. });
  12474. },
  12475. _sketchDrawPolygon(handler, options2) {
  12476. let _self = this;
  12477. this._registerLeftClickEvent(handler, function(event2) {
  12478. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12479. if (!Cesium.defined(loc2.sLocation))
  12480. return;
  12481. if (_self._isDrawPoint) {
  12482. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12483. }
  12484. if (_self._sketchTempPoints.length === 0) {
  12485. _self._createTempPolygon();
  12486. _self._createTempPolyline();
  12487. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12488. }
  12489. _self._sketchTempPoints.push(loc2.sLocation);
  12490. _self._sketchPoints.push(loc2.sLocation.clone());
  12491. _self._sketchOutputPoints.push(loc2.gLocation);
  12492. if (options2.onAdded)
  12493. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  12494. });
  12495. this._registerMouseMoveEvent(handler, function(event2) {
  12496. if (_self._isRuntimeApp())
  12497. return;
  12498. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12499. if (!Cesium.defined(loc2.sLocation))
  12500. return;
  12501. if (Cesium.defined(_self._sketchTempPolygon)) {
  12502. _self._sketchTempPoints.pop();
  12503. _self._sketchTempPoints.push(loc2.sLocation);
  12504. if (options2.onMoving)
  12505. options2.onMoving(loc2.sLocation);
  12506. }
  12507. });
  12508. this._registerRightClickEvent(handler, function(event2) {
  12509. if (_self._sketchTempPoints.length > 2) {
  12510. _self._sketchPoints.pop();
  12511. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  12512. if (_self._isDrawPoint) {
  12513. let lastPointEntity = _self._pointEntitys[_self._pointEntitys.length - 1];
  12514. _self._entities.remove(lastPointEntity);
  12515. _self._pointEntitys.pop();
  12516. }
  12517. if (options2.onUndo)
  12518. options2.onUndo();
  12519. }
  12520. });
  12521. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12522. if (_self._isRuntimeApp())
  12523. return;
  12524. if (_self._sketchPoints.length < 3) {
  12525. if (options2.onError)
  12526. options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12527. return;
  12528. }
  12529. _self._removeEntityByObject(_self._sketchTempPolygon);
  12530. _self._removeEntityByObject(_self._sketchTempPolyline);
  12531. _self._createPolygon();
  12532. if (!_self._isRetainDrawPoint)
  12533. _self._removePointEntitys();
  12534. _self._clearEvent(handler);
  12535. if (options2.onComplete)
  12536. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12537. });
  12538. },
  12539. _sketchDrawCircle: function(handler, options2) {
  12540. let _self = this;
  12541. this._registerLeftClickEvent(handler, function(event2) {
  12542. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12543. if (!Cesium.defined(loc2.sLocation))
  12544. return;
  12545. if (_self._sketchTempPoints.length === 0) {
  12546. if (_self._isDrawPoint) {
  12547. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12548. }
  12549. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12550. _self._sketchTempPoints.push(loc2.sLocation);
  12551. _self._sketchPoints.push(loc2.sLocation.clone());
  12552. _self._sketchOutputPoints.push(loc2.gLocation);
  12553. _self._createTempCircle(loc2.sLocation);
  12554. if (options2.onAdded)
  12555. options2.onAdded(loc2.sLocation);
  12556. } else {
  12557. if (_self._isRuntimeApp()) {
  12558. _self._sketchTempPoints.pop();
  12559. _self._sketchTempPoints.push(loc2.sLocation);
  12560. let positionCenter = _self._sketchEllipseCenterPosition;
  12561. let positionRotate = _self._sketchTempPoints[1];
  12562. _self._ellipseOutlineCoordinates = [];
  12563. for (let angle = 5; angle < 360; ) {
  12564. let newPosition = _self._rotatedPointByAngle(positionRotate, positionCenter, angle);
  12565. _self._ellipseOutlineCoordinates.push(newPosition);
  12566. angle = angle + 5;
  12567. }
  12568. _self._ellipseOutlineCoordinates.push(_self._ellipseOutlineCoordinates[0]);
  12569. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  12570. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  12571. let geodesic = new Cesium.EllipsoidGeodesic();
  12572. geodesic.setEndPoints(point1cartographic, point2cartographic);
  12573. _self._sketchEllipseRadius = geodesic.surfaceDistance;
  12574. if (_self._sketchEllipseRadius <= 0)
  12575. _self._sketchEllipseRadius = 1;
  12576. }
  12577. _self._removePointEntitys();
  12578. _self._removeEntityByObject(_self._sketchTempCircle);
  12579. _self._createCircle();
  12580. _self._clearEvent(handler);
  12581. if (options2.onComplete)
  12582. options2.onComplete(_self._sketchOutputPoints[0], _self._sketchEllipseRadius);
  12583. }
  12584. });
  12585. this._registerMouseMoveEvent(handler, function(event2) {
  12586. if (_self._isRuntimeApp())
  12587. return;
  12588. if (!Cesium.defined(_self._sketchTempCircle))
  12589. return;
  12590. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  12591. if (cartesian == void 0)
  12592. return;
  12593. _self._sketchTempPoints.pop();
  12594. _self._sketchTempPoints.push(cartesian);
  12595. });
  12596. },
  12597. _sketchDrawHeightPolyline: function(handler, options2) {
  12598. let _self = this;
  12599. this._registerLeftClickEvent(handler, function(event2) {
  12600. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12601. if (!Cesium.defined(loc2.sLocation))
  12602. return;
  12603. if (_self._sketchTempPoints.length === 0) {
  12604. if (_self._isDrawPoint) {
  12605. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12606. }
  12607. _self._sketchAltitudeInitHeight = loc2.gLocation.height;
  12608. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12609. _self._sketchTempPoints.push(loc2.sLocation);
  12610. _self._sketchPoints.push(loc2.sLocation.clone());
  12611. if (options2.onAdded)
  12612. options2.onAdded(loc2.sLocation);
  12613. } else {
  12614. if (_self._isRuntimeApp()) {
  12615. _self._sketchTempPoints.pop();
  12616. _self._sketchTempPoints.push(loc2.sLocation);
  12617. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  12618. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  12619. _self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  12620. _self._sketchAltitudePolylinePostions = [];
  12621. _self._sketchAltitudePolylinePostions.push(_self._sketchTempPoints[0]);
  12622. let point_temp = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  12623. _self._sketchAltitudePolylinePostions.push(point_temp);
  12624. let geodesic = new Cesium.EllipsoidGeodesic();
  12625. geodesic.setEndPoints(point1cartographic, point2cartographic);
  12626. _self._sketchEllipseRadius = geodesic.surfaceDistance;
  12627. if (_self._sketchEllipseRadius <= 0)
  12628. _self._sketchEllipseRadius = 1;
  12629. let height_temp = point2cartographic.height - point1cartographic.height;
  12630. _self._sketchEllipseHeight = height_temp + _self._sketchAltitudeInitHeight;
  12631. }
  12632. _self._removePointEntitys();
  12633. _self._removeEntityByObject(_self._sketchTempAltituePolyline);
  12634. _self._createAltitudePolyline();
  12635. _self._clearEvent(handler);
  12636. if (options2.onComplete) {
  12637. options2.onComplete(_self._sketchAltitudePolylinePostions, _self._sketchEllipseCenterPosition);
  12638. }
  12639. }
  12640. });
  12641. this._registerMouseMoveEvent(handler, function(event2) {
  12642. if (_self._isRuntimeApp())
  12643. return;
  12644. if (_self._sketchTempPoints == void 0 || _self._sketchTempPoints.length == 0)
  12645. return;
  12646. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  12647. if (cartesian == void 0)
  12648. return;
  12649. if (_self._sketchTempPoints.length >= 2) {
  12650. if (!Cesium.defined(_self._sketchTempAltituePolyline)) {
  12651. _self._createTempAltitudePolyline();
  12652. } else {
  12653. _self._sketchTempPoints.pop();
  12654. _self._sketchTempPoints.push(cartesian);
  12655. }
  12656. if (options2.onMoving) {
  12657. options2.onMoving(_self._sketchAltitudePolylinePostions, _self._sketchEllipseCenterPosition);
  12658. }
  12659. }
  12660. });
  12661. },
  12662. _sketchDrawRectangle: function(handler, options2) {
  12663. let _self = this;
  12664. this._registerLeftClickEvent(handler, function(event2) {
  12665. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12666. if (!Cesium.defined(loc2.sLocation))
  12667. return;
  12668. if (_self._sketchTempPoints.length === 0) {
  12669. if (_self._isDrawPoint) {
  12670. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12671. }
  12672. _self._sketchTempPoints.push(loc2.gLocation);
  12673. _self._sketchTempPoints.push(loc2.gLocation);
  12674. _self._sketchPoints.push(loc2.gLocation);
  12675. _self._createTempRectangle();
  12676. if (options2.onAdded)
  12677. options2.onAdded(loc2.sLocation);
  12678. } else {
  12679. if (_self._isRuntimeApp()) {
  12680. _self._sketchTempPoints.pop();
  12681. _self._sketchTempPoints.push(loc2.gLocation);
  12682. let lng0 = parseFloat(_self._sketchTempPoints[0].lng);
  12683. let lat0 = parseFloat(_self._sketchTempPoints[0].lat);
  12684. let lng1 = parseFloat(_self._sketchTempPoints[1].lng);
  12685. let lat1 = parseFloat(_self._sketchTempPoints[1].lat);
  12686. _self._rectangleCoordinates = [0, 0, 1, 1];
  12687. if (lng0 < lng1) {
  12688. _self._rectangleCoordinates[0] = lng0;
  12689. _self._rectangleCoordinates[2] = lng1;
  12690. } else {
  12691. _self._rectangleCoordinates[0] = lng1;
  12692. _self._rectangleCoordinates[2] = lng0;
  12693. }
  12694. if (lat0 < lat1) {
  12695. _self._rectangleCoordinates[1] = lat0;
  12696. _self._rectangleCoordinates[3] = lat1;
  12697. } else {
  12698. _self._rectangleCoordinates[1] = lat1;
  12699. _self._rectangleCoordinates[3] = lat0;
  12700. }
  12701. let rectangle = Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]);
  12702. let res = _self._calculateRectangleOutlineCoordinates(rectangle);
  12703. _self._rectangleOutlineCoordinates = res.cPoints;
  12704. _self._sketchOutputPoints = res.gPoints;
  12705. }
  12706. _self._removePointEntitys();
  12707. _self._removeEntityByObject(_self._sketchTempRectangle);
  12708. _self._createRectangle();
  12709. handler.destroy();
  12710. handler = null;
  12711. if (options2.onComplete)
  12712. options2.onComplete(_self._sketchOutputPoints);
  12713. }
  12714. });
  12715. this._registerMouseMoveEvent(handler, function(event2) {
  12716. if (_self._isRuntimeApp())
  12717. return;
  12718. if (!Cesium.defined(_self._sketchTempRectangle))
  12719. return;
  12720. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12721. if (!Cesium.defined(loc2.sLocation))
  12722. return;
  12723. _self._sketchTempPoints.pop();
  12724. _self._sketchTempPoints.push(loc2.gLocation);
  12725. });
  12726. },
  12727. _sketchDrawTriangle: function(handler, options2) {
  12728. let _self = this;
  12729. handler.setInputAction(function(event2) {
  12730. if (Cesium.defined(_self._sketchTempAltituePolyline))
  12731. return;
  12732. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12733. if (!Cesium.defined(loc2.sLocation))
  12734. return;
  12735. if (_self._sketchPoints.length == 0) {
  12736. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12737. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12738. _self._sketchTempPoints.push(loc2.sLocation);
  12739. _self._sketchPoints.push(loc2.sLocation);
  12740. _self._createTempPolyline();
  12741. } else if (_self._sketchPoints.length === 1) {
  12742. _self._createPoint(loc2.sLocation, "\u9AD8\u5EA6\u8D77\u70B9");
  12743. _self._entities.remove(_self._sketchTempPolyline);
  12744. _self._sketchPoints.push(loc2.sLocation);
  12745. _self._createPolyline();
  12746. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12747. _self._sketchPoints.push(loc2.sLocation);
  12748. _self._sketchAltitudeInitHeight = loc2.gLocation.height;
  12749. _self._createTempTriangleAltitudePolylineAndSpatialPolyline();
  12750. }
  12751. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  12752. handler.setInputAction(function(event2) {
  12753. if (_self._sketchPoints === void 0 || _self._sketchPoints.length === 0)
  12754. return;
  12755. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  12756. if (cartesian == void 0)
  12757. return;
  12758. _self._sketchTempPoints.pop();
  12759. _self._sketchTempPoints.push(cartesian);
  12760. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  12761. handler.setInputAction(function(event2) {
  12762. if (_self._sketchPoints.length < 2) {
  12763. if (options2.onError)
  12764. options2.onError("\u7ED8\u5236\u56FE\u5F62\u4E0D\u5B8C\u6574\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12765. return;
  12766. }
  12767. _self._removePointEntitys();
  12768. _self._removeEntityByObject(_self._sketchTempTriangleAltitudePolyline);
  12769. _self._removeEntityByObject(_self._sketchTempSpatialPolyline);
  12770. _self._createAltitudePolyline();
  12771. _self._createTriangleSpatialPolyline();
  12772. handler.destroy();
  12773. handler = null;
  12774. options2.onComplete(
  12775. _self._sketchPoints,
  12776. _self._sketchTriangleSpatialPolylinePositions,
  12777. _self._sketchAltitudePolylinePostions,
  12778. _self._sketchEllipseCenterPosition
  12779. );
  12780. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  12781. },
  12782. _sketchDrawPolygonBody(handler, options2) {
  12783. let _self = this;
  12784. this._registerLeftClickEvent(handler, function(event2) {
  12785. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12786. if (!Cesium.defined(loc2.sLocation))
  12787. return;
  12788. if (_self._isDrawPoint) {
  12789. _self._createPoint(loc2.sLocation, _self._lineLabel);
  12790. }
  12791. if (_self._sketchTempPoints.length === 0) {
  12792. _self._createTempPolygon();
  12793. _self._createTempPolyline();
  12794. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12795. }
  12796. _self._sketchTempPoints.push(loc2.sLocation);
  12797. _self._sketchPoints.push(loc2.sLocation.clone());
  12798. _self._sketchOutputPoints.push(loc2.gLocation);
  12799. if (options2.onAdded)
  12800. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  12801. });
  12802. this._registerMouseMoveEvent(handler, function(event2) {
  12803. if (_self._isRuntimeApp())
  12804. return;
  12805. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  12806. if (!Cesium.defined(loc2.sLocation))
  12807. return;
  12808. if (Cesium.defined(_self._sketchTempPolygon)) {
  12809. _self._sketchTempPoints.pop();
  12810. _self._sketchTempPoints.push(loc2.sLocation);
  12811. if (options2.onMoving)
  12812. options2.onMoving(loc2.sLocation);
  12813. }
  12814. });
  12815. this._registerRightClickEvent(handler, function(event2) {
  12816. if (_self._sketchTempPoints.length > 2) {
  12817. _self._sketchPoints.pop();
  12818. _self._sketchOutputPoints.pop();
  12819. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  12820. if (options2.onUndo)
  12821. options2.onUndo(_self._sketchPoints);
  12822. }
  12823. });
  12824. this._registerLeftDoubleClickEvent(handler, function(event2) {
  12825. if (_self._isRuntimeApp())
  12826. return;
  12827. if (_self._sketchPoints.length < 3) {
  12828. if (options2.onError)
  12829. options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  12830. return;
  12831. }
  12832. _self._removeEntityByObject(_self._sketchTempPolygon);
  12833. _self._removeEntityByObject(_self._sketchTempPolyline);
  12834. _self._createPolygonBody({
  12835. height: 30,
  12836. color: [255, 255, 0, 0.9]
  12837. });
  12838. _self._removePointEntitys();
  12839. _self._clearEvent(handler);
  12840. if (options2.onComplete)
  12841. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  12842. });
  12843. },
  12844. _sketchDrawTriangleA: function(handler, options2) {
  12845. let _self = this;
  12846. this._registerLeftClickEvent(handler, function(event2) {
  12847. if (Cesium.defined(_self._sketchTempAltituePolyline))
  12848. return;
  12849. let loc2 = _self._transfromFromScreenPoint(event2.position);
  12850. if (!Cesium.defined(loc2.sLocation))
  12851. return;
  12852. if (_self._sketchPoints.length == 0) {
  12853. if (_self._isDrawPoint) {
  12854. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  12855. }
  12856. _self._sketchTempPoints.push(loc2.sLocation.clone());
  12857. _self._sketchTempPoints.push(loc2.sLocation);
  12858. _self._sketchPoints.push(loc2.sLocation);
  12859. _self._createTempSpatialTriangle();
  12860. if (options2.onAdded)
  12861. options2.onAdded(loc2.sLocation);
  12862. } else if (_self._sketchPoints.length > 0) {
  12863. if (_self._isRuntimeApp()) {
  12864. _self._sketchTempPoints.pop();
  12865. _self._sketchTempPoints.push(loc2.sLocation);
  12866. _self._sketchSpatialTrianglePositions = [];
  12867. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
  12868. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[1].clone());
  12869. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  12870. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  12871. let point_temp = Cesium.Cartesian3.fromDegrees(Cesium.Math.toDegrees(point1cartographic.longitude), Cesium.Math.toDegrees(point1cartographic.latitude), point2cartographic.height);
  12872. _self._sketchSpatialTrianglePositions.push(point_temp);
  12873. _self._sketchSpatialTrianglePositions.push(_self._sketchTempPoints[0].clone());
  12874. }
  12875. _self._removePointEntitys();
  12876. _self._removeEntityByObject(_self._sketchTempSpatialTriangle);
  12877. _self._createSpatialTriangle();
  12878. _self._clearEvent(handler);
  12879. if (options2.onComplete)
  12880. options2.onComplete(_self._sketchSpatialTrianglePositions);
  12881. }
  12882. });
  12883. this._registerMouseMoveEvent(handler, function(event2) {
  12884. if (_self._isRuntimeApp())
  12885. return;
  12886. if (_self._sketchPoints === void 0 || _self._sketchPoints.length === 0)
  12887. return;
  12888. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  12889. if (cartesian == void 0)
  12890. return;
  12891. _self._sketchTempPoints.pop();
  12892. _self._sketchTempPoints.push(cartesian);
  12893. if (options2.onMoving)
  12894. options2.onMoving(cartesian);
  12895. });
  12896. },
  12897. sketchTools: function(toolsType, options2) {
  12898. let _self = this;
  12899. this._clear();
  12900. _self._sketchEventHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  12901. switch (toolsType) {
  12902. case SketchViewModel.SketchType.Point:
  12903. _self._sketchDrawPoint(_self._sketchEventHandler, options2);
  12904. break;
  12905. case SketchViewModel.SketchType.Line:
  12906. _self._sketchDrawPolyline(_self._sketchEventHandler, options2);
  12907. break;
  12908. case SketchViewModel.SketchType.Polygon:
  12909. _self._sketchDrawPolygon(_self._sketchEventHandler, options2);
  12910. break;
  12911. case SketchViewModel.SketchType.Height:
  12912. _self._sketchDrawHeightPolyline(_self._sketchEventHandler, options2);
  12913. break;
  12914. case SketchViewModel.SketchType.Spatial:
  12915. _self._sketchDrawSpatialPolyline(_self._sketchEventHandler, options2);
  12916. break;
  12917. case SketchViewModel.SketchType.Circle:
  12918. _self._sketchDrawCircle(_self._sketchEventHandler, options2);
  12919. break;
  12920. case SketchViewModel.SketchType.Rectangle:
  12921. _self._sketchDrawRectangle(_self._sketchEventHandler, options2);
  12922. break;
  12923. case SketchViewModel.SketchType.Triangle:
  12924. _self._sketchDrawTriangleA(_self._sketchEventHandler, options2);
  12925. break;
  12926. case SketchViewModel.SketchType.PolygonBody:
  12927. _self._sketchDrawPolygonBody(_self._sketchEventHandler, options2);
  12928. break;
  12929. case SketchViewModel.SketchType.MultiplePoint:
  12930. _self._sketchDrawMultiplePoint(_self._sketchEventHandler, options2);
  12931. break;
  12932. }
  12933. },
  12934. sketchDrawFeacture: function(points2, type2, options2) {
  12935. let _self = this;
  12936. if (points2 === void 0 || points2.length === void 0 || points2.length < 2) {
  12937. if (options2 && options2.onError)
  12938. options2.onError("\u8F93\u5165\u7684\u5750\u6807\u96C6\u5408\u5F02\u5E38\uFF01");
  12939. return;
  12940. }
  12941. this._sketchPoints = [];
  12942. for (let i2 = 0; i2 < points2.length; ) {
  12943. this._sketchPoints.push(Cesium.Cartesian3.fromDegrees(points2[i2], points2[i2 + 1], points2[i2 + 2]));
  12944. i2 = i2 + 3;
  12945. }
  12946. switch (type2) {
  12947. case SketchViewModel.SketchType.DrawPoint:
  12948. _self._createPoint(_self._sketchPoints[0], _self._lineLabel);
  12949. if (options2 && options2.onComplete)
  12950. options2.onComplete(_self._pointEntitys);
  12951. break;
  12952. case SketchViewModel.SketchType.DrawMultiplePoint:
  12953. for (let i2 = 0; i2 < _self._sketchPoints.length; i2++) {
  12954. _self._createPoint(_self._sketchPoints[i2], _self._lineLabel);
  12955. }
  12956. if (options2 && options2.onComplete)
  12957. options2.onComplete(_self._pointEntitys);
  12958. break;
  12959. case SketchViewModel.SketchType.DrawPolyline:
  12960. if (_self._sketchPoints.length < 2) {
  12961. if (options2 && options2.onError)
  12962. options2.onError("\u70B9\u6570\u5C11\u4E8E2\u4E2A\uFF0C\u65E0\u6CD5\u7ED8\u5236\uFF01");
  12963. } else {
  12964. _self._createPolyline();
  12965. if (options2 && options2.onComplete)
  12966. options2.onComplete(_self._sketchPolyline);
  12967. }
  12968. break;
  12969. case SketchViewModel.SketchType.DrawPolygon:
  12970. if (_self._sketchPoints.length < 3) {
  12971. if (options2 && options2.onError)
  12972. options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u65E0\u6CD5\u7ED8\u5236\uFF01");
  12973. } else {
  12974. _self._createPolygon();
  12975. if (options2 && options2.onComplete)
  12976. options2.onComplete(_self._sketchPolygon);
  12977. }
  12978. break;
  12979. default:
  12980. if (options2 && options2.onError)
  12981. options2.onError("\u7ED8\u5236\u7C7B\u578B\u5F02\u5E38\uFF01");
  12982. break;
  12983. }
  12984. },
  12985. sketchClear: function() {
  12986. this._clear(true);
  12987. this._clearEvent(this._sketchEventHandler);
  12988. },
  12989. sketchInit: function() {
  12990. this._clear(false);
  12991. }
  12992. });
  12993. Object.assign(SketchViewModel.prototype, {
  12994. _checkColor: function(color2) {
  12995. if (color2 === void 0 || color2 === null)
  12996. return false;
  12997. if (typeof color2 != "number")
  12998. return false;
  12999. let intColor = parseInt(color2);
  13000. if (intColor < 0 || intColor > 255)
  13001. return false;
  13002. return true;
  13003. },
  13004. _checkAlpha: function(alpha) {
  13005. if (alpha === void 0 || alpha === null)
  13006. return false;
  13007. if (typeof alpha != "number")
  13008. return false;
  13009. let floatAlpha = parseFloat(alpha);
  13010. if (floatAlpha < 0 || floatAlpha > 1)
  13011. return false;
  13012. return true;
  13013. },
  13014. _checkColorAndAlpha: function(colorAndAlpah) {
  13015. let setColor = void 0;
  13016. if (!colorAndAlpah || colorAndAlpah.length === void 0 || colorAndAlpah.length === 0)
  13017. return void 0;
  13018. if (colorAndAlpah.length === 1 && this._checkColor(colorAndAlpah[0])) {
  13019. setColor = [colorAndAlpah[0], 0, 0, 1];
  13020. } else if (colorAndAlpah.length === 2 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  13021. colorAndAlpah[1]
  13022. )) {
  13023. setColor = [colorAndAlpah[0], colorAndAlpah[1], 0, 1];
  13024. } else if (colorAndAlpah.length === 3 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  13025. colorAndAlpah[1]
  13026. ) && this._checkColor(colorAndAlpah[2])) {
  13027. setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], 1];
  13028. } else if (colorAndAlpah.length === 4 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  13029. colorAndAlpah[1]
  13030. ) && this._checkColor(colorAndAlpah[2]) && this._checkAlpha(
  13031. colorAndAlpah[3]
  13032. )) {
  13033. setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], colorAndAlpah[3]];
  13034. }
  13035. return setColor;
  13036. },
  13037. sketchEditPickPolygonBody: function(options2) {
  13038. let _self = this;
  13039. let primitive = _self._sketchPickPolygonBody;
  13040. if (primitive === void 0) {
  13041. if (options2.onComplete)
  13042. options2.onComplete("\u672A\u62FE\u53D6\u5BF9\u8C61\u6216\u62FE\u53D6\u7684\u5BF9\u8C61\u4E0D\u7B26\u5408\u8981\u6C42\uFF01");
  13043. return;
  13044. }
  13045. let color2 = primitive._useGeometry.color;
  13046. let height2 = primitive._useGeometry.height;
  13047. this._sketchPoints = primitive._useGeometry.cPoints;
  13048. this._sketchOutputPoints = primitive._useGeometry.gPoints;
  13049. if (options2 && options2.height && typeof options2.height === "number")
  13050. height2 = parseInt(options2.height);
  13051. if (options2 && options2.color && this._checkColorAndAlpha(options2.color))
  13052. color2 = this._checkColorAndAlpha(options2.color);
  13053. this._viewer.scene.primitives.remove(primitive);
  13054. this._createPolygonBody({
  13055. color: color2,
  13056. height: height2
  13057. });
  13058. if (options2.onComplete)
  13059. options2.onComplete(void 0);
  13060. },
  13061. sketchRemovePickPolygonBody: function(onComplete) {
  13062. let _self = this;
  13063. let primitive = _self._sketchPickPolygonBody;
  13064. if (primitive === void 0) {
  13065. if (onComplete)
  13066. onComplete("\u672A\u62FE\u53D6\u5BF9\u8C61\u6216\u62FE\u53D6\u7684\u5BF9\u8C61\u4E0D\u7B26\u5408\u8981\u6C42\uFF01");
  13067. return;
  13068. }
  13069. this._viewer.scene.primitives.remove(primitive);
  13070. if (onComplete)
  13071. onComplete(void 0);
  13072. },
  13073. sketchPick: function(onComplete) {
  13074. let _self = this;
  13075. let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  13076. handler.setInputAction(function(event2) {
  13077. let pickObj = _self._viewer.scene.pick(event2.position);
  13078. if (pickObj && pickObj.primitive && pickObj.primitive._useGeometry != void 0) {
  13079. _self._sketchPickPolygonBody = pickObj.primitive;
  13080. if (onComplete)
  13081. onComplete({
  13082. color: pickObj.primitive._useGeometry.color,
  13083. height: pickObj.primitive._useGeometry.height
  13084. });
  13085. } else {
  13086. _self._sketchPickPolygonBody = void 0;
  13087. if (onComplete)
  13088. onComplete(void 0);
  13089. }
  13090. handler.destroy();
  13091. handler = null;
  13092. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  13093. }
  13094. });
  13095. SketchViewModel.SketchType = Object.freeze({
  13096. Point: "point",
  13097. MultiplePoint: "multiplePoint",
  13098. Line: "line",
  13099. Polygon: "polygon",
  13100. Height: "height",
  13101. Spatial: "spatial",
  13102. Circle: "circle",
  13103. Rectangle: "rectangle",
  13104. Triangle: "triangle",
  13105. PolygonBody: "polygonBody",
  13106. DrawPoint: "drawPoint",
  13107. DrawMultiplePoint: "drawMultiplePoint",
  13108. DrawPolyline: "drawPolyline",
  13109. DrawPolygon: "drawPolygon"
  13110. });
  13111. SketchViewModel.SketchIconType = Object.freeze({
  13112. Normal: "normal",
  13113. Blue: "blue",
  13114. Green: "green",
  13115. Violet: "violter"
  13116. });
  13117. SketchViewModel.RuntimeEnvironment = Object.freeze({
  13118. App: "app",
  13119. Web: "web"
  13120. });
  13121. class CommonTools {
  13122. constructor(viewer2, options2) {
  13123. this._viewer = viewer2;
  13124. options2 = options2 || {};
  13125. if (options2.isDrawPoint) {
  13126. this._isDrawPoint = options2.isDrawPoint;
  13127. } else {
  13128. this._isDrawPoint = false;
  13129. }
  13130. if (options2.isRetainDrawPoint) {
  13131. this._isRetainDrawPoint = options2.isRetainDrawPoint;
  13132. } else {
  13133. this._isRetainDrawPoint = false;
  13134. }
  13135. if (options2.isClear) {
  13136. this._isClear = options2.isClear;
  13137. } else {
  13138. this._isClear = false;
  13139. }
  13140. this._sketchViewModel = new SketchViewModel(viewer2, {
  13141. iconType: SketchViewModel.SketchIconType.Blue,
  13142. isDrawPoint: this._isDrawPoint,
  13143. isRetainDrawPoint: this._isRetainDrawPoint
  13144. });
  13145. let buttonDiv = document.getElementById("drawButtonDiv");
  13146. if (buttonDiv) {
  13147. document.body.removeChild(buttonDiv);
  13148. }
  13149. this._init();
  13150. }
  13151. _init() {
  13152. this._measureEntityName = "MeasureEntity";
  13153. this._entities = this._viewer.entities;
  13154. this._measurePointImage = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcEAYAAAAinQPXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAB2FJREFUWMO9mHtQlNcZxn/nW65GxHtEqTEajUxVoLYRSIyipHG4qG0lajtxVIRFubgqXuOI28ZE7FAvCLKLSNKxg/FSIzdvqNE62kaRitqpYMxovBGigo4I4n6nfwjsCrsLrtjnn53vnPe87/Oc9/2+854VdBhCd6ZP6dMHlAXO/lOngrzMLz/8EEQ0ASNGANNY2aOHxYIdfHr3LuBCwPnzQIKcf/AgiJ8pQV99BfmvR4+orHxZVsLxpZFT0qd07gyP7zqrej3IInF47lwQkTLV3d1xv3KXWPT4MYhLzMzIgHpn10+Sk+Gw74w+jx79HwSGnzUYhg4FED4FBcBq/jtokOOC2oSb0FZUgHpKVoeHQ9GtGM/y8lcgMLxf5juDBwNDlOWnTgGvUdWz5wsQ7c179fUWzz9y0tX1BdZPILeqCpTtil9QEOT9c876K1faWqS07XeMzJFuboCXkpaX1w5hqxl14QJIKYRWCzLV5OXtDQXbon3c3c2/TeMoYvncucAgPrl40Y7fA0zv1QtMydKwb58FL7toRwbDYo3/0utB3OD8qlX2hIkLqalwO0b9+fLlUHJOG9vQ0P4EjfyFIdPZGfqsURampIBIlxsWLLBtL/NltF4PhUIrVq92QGDIeEOmpye4pYju164Bq6n29LTiopy8tDTIL48pSExsDq/Oj9is/eAD4CRbli1DMEFUBAYCewnUaJD8jr2lpQjpJ7M2bBBi0+L47Tt2mP2G5xhNaWnAHrLj461tKF1rasA0rW5b//6w/0rigQcPWhrZKVFXP8TkybaFyb3kXbkCbiO6fpyU1Dwq58vNG3U6BJvEiYMHEcwQW8aNA3pT7O4OaPmTiwuCnlwcNQrEDRGYmytloilj5vr1Zv+mNXVhSUnmOFYEVnt6gtM9t+8mTbKlwo5AoWdySIjteWUcIwwG2LX7o6lPnkiZULTlj/7+wEThm5oKbCBeCOANUisqkNRxLCEBSSzrYmOB3jw6c8Yi3kL5K51OyvkZGXUTJz7LSH09CIPwMBpt85CHhMf48Q4IJFPofHzsbMAAJfjIEQtXC9TZWi0wkEuKAmjEyspKpNN2pyVBQULZaIjbvXmzUDb6xF0zGJCqv+no6NGAK5fLyiz8JssVcXEWgQLUsZZxWmGbrLTN057Agfh7eNiefhpRb7h922LgOzFp2DDzxnJXrsvLE0rqOW3sTz+12h4lLfRZhuQybuXmWmQkgPzhwy0o1jlV37ljh+e3/L1LF0cEXqX04UPb0075rlovLwtBHuqZ5845T5Z37UqbEAPkzOfsUvlHXZ35saFnQ4++fe04eIfftv64tEfgdvkXeweprFIvBQaaebJH+f3x4xbPvsRPnixlQlHGtDFjWq2Wuqj0yz4+QKk4FxNjMVXD2998Y0FRKEsCAuzwzBKv2eZpR6DspxQcPWpnvrNYoNNBZOTOnRoN0ilJMzYjA3ibsKoqoIxezs6gLJbpxcVSTbyePurwYSkT76VPKSgAWQslJcAmenTrBszgP7W1wBlRmZICY2SydHIC8ZCvdTo7Ak+ri44dcySDNDTs2mVufluhThoGD4bHp6or4uOb3zWJnoqwMGAVLnfuACHscHJCiFRmhISA0BMcFob52PDC/8EDkLfkR5GRQmycN8/t8mXw8O73WVwctnvdJ3SqrQXNSJeY3bttaWhHJxMxzDh97VqQAwheutR2IC6pm/z8oOBm7LcVFVJNKNo0oUsXhBKmGR0VBfI0vkFBINzExxoNEKP+ePYsktefFmVnC2Vjvm5SZSVEpGUNefNNUH8ti8rKQCziaOfOVuL2563PP4eCjJhxK1a8hMCJJ7NTPDxAXWIaefEi0J2r/ftbMfyryDhxAkZ2u1EaHAx6oReq2rb/JiTLZKkoUHLf2//YMWCGnPf++1YM7zHw+nVQ1mlKhg2DvPeiltr+GLaj2W524Kd6zZ4NhGOQ0ophI6GSkr4Gq61VGyjx7vdZQoIdYY1xVZ06RKttS1gTHLkPLjVmGo3AJZToaCsGjSWrPFBKfH3bvta0uyR3ySlGIxS4a7trte1l244MtoRpT93XSUk0l0oruFDbqROYUtQ9X3xhLr2WaBpX4+WnOTl2hHkw9eZN0Li5dLP6Dehogc1dexslK/7MynffhbNDvZXnWq9GNJWyiKC69TlphvobtWbOHNgnZonq6hdl+xL/yTQhbKUxeOtWEP9melSUFYMWJSv/IAtNprZLUu4Rf9u6FQpdo49bfRXaBQcy2BL1p+XURYtAZrLwhx+sGDSWrDpc3ZeVBbJMPt22zY6wRj/1oep08zXMUXRABpsQFmqcHhICYiLlhw4BBWiFA/5FOXmhoc8u0Pv3vyyrDshgEwqLYnKLi4FO5OfkvPh66UdudnZHCXsFAptQ96XMW7jQTsm2xAF23roFlD6NXLy4o9m8AoHFR7SxNTWgjGOsVovtxqBxXAzEbc4cKCycN+/+/Y7n88oRvjarcNYsCDtprP/+ewjvZ1xz9SpERBp3zpz5qqP/D5zQE33tptaiAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA0LTA5VDE2OjQyOjI5KzA4OjAwjRBbGwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNC0wOVQxNjo0MjoyOSswODowMPxN46cAAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uXzJhcHo1b3VpcnV4L2Rpbmd3ZWkuc3ZncY9vkgAAAABJRU5ErkJggg==";
  13155. this._iconBlue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkEyMUE1MDg3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkEyMUE1MDc3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/grmkAAAhxSURBVHjazFoLUFVFGN49597LBdFUEpEQI0IpyxIfqU1ZkY/pNZg1RZlWY2lW4yMncxq18oHZ0+lhOaWZUo0zPjIr8W1NiubI+AxBIkRQQsQE7us8tv3P7qGL7gXOPRdzZ3bmcnf3+7/v/Lv/+f/lYkIIMpur2yBktQVO5yM7LRybIvsOFKFGCeHyQz/dFO2Ousflcg6UJSlVlqVEjHEMjNMH5tE0vVLT9ZJAQNnn9fm3d+9z3xEYioR9bNcjW9Z8Gtv35l7PUAFjnU5HLytrFUU9TgV9XXD4+PJhoyfV2/GIFO4TGD8my1lVuGXSHYNuPdyhfbv5VkVAgzWwFjAACzAvp0fwoV++uz6lxzXLolzOW1AEmz+gHCwtq3i2z52Pn2jtlgvXI1LpgQ0jeqYm74y0CGiACdjUxkir3KxMlsoKNj6WmNAlV5Kk9qiNGmBTG6vAlhV+rd1aUuGeNSNSeiSuolGo2X1cdDogbThQ79h21CMfP6NKtR4dw/edYiTSK8GhZ/aO0R7KiFV7dnPpzeFQXkppWeWY9MGj8+ifektbqzVC8KbVH6UNHdJvOw2nHUIB7vrDI89df861p0SRsUSjuiSzB4qxyYzx0TVEdBUNTnVqs7I6B4beEKOFwqThuu7X/IJ7hj/yYlGoM9NqIakpSVH7t67c3C4muq8IyKcQ9EpuddSK3xqcSHJR7g7WsSkCm8+YiSEgRuU9gMbd3k5578kufrcTC8U0eLwF/e99anhJ6Sm/HSHSid/Xv5CclJAjAjlXr+GHP6x07z9JZCSDCBfzBJapBomJabJfdKqFCiGa4RkQgrQA6p+MtbVTEn2dY2XhUz956szM6wdkLRFtsVZFrReeeaRTQte46aIxT4DgrA9ABJKRw42QTLsjimqATgUZwpxNO/0OGz3KmMvWuBFgABZgimwBB+ASbtSSp0zIHutyOuNEg9NW/e06UE49YRBi5LFB2NxaMoQg5iGJfza+Y+MwlwlmogALMIXpD+UAXIBTOEKi4rt0zg51sFft8TjN7YQbnzrbVpeeD8Q+w3fYFCQba9ha5kHABGyRTcrlCeBkVQjO/Wxeb3rA00WDb62rcbHzAARML0hBAloK+lyQ4TEHx2B4BragUS69vl06/6aLnk6LQuQ+vdMyRQMHT/ql/D9VGfEQi00PGFDYwqsP8/AsMQyJbTvABhuiFb3TU+8Otb1CCXFd1SF2gGhg/f56Bw4+B9iCJ0J5Bv93fgAbbIimd7yq/UDgZklITLQ7RTSwp9grs7MgBYXYMEQ0OTtBWBR7d5FX+NQ5J0tCHG63K0GYglSpkrklGkXY1GGKMbdo8d+qkBfn5LB0RpwOeDlc2mo9NNYHbyOMIuCRptvNsCGqXxgnS2dEoslhxMrgSDXOSbL0HlFVzSv6vlMMJigorWGpnJ2ymzRdTrENGxY4NSeE+PwBYQ3ds6tDN1IewvvFRMLQwTBMPB2lxTuEaTvnRKwI0S/U1ZeLBganRWtGwteYAOoR8EgQFsUe3DNamNpzTroVIWp1TW2xaCCrf6xKzDScaP89SRKGGBLkCSMjVo1aZRS1IZrOOalWhCgHjxTvEw3ckhylD7rOobF6ghZJphhk1TO80DK8Yab1KgJssCHMKhgnxYqQQM7i5bv9AaVONDh7VFzAqCWMekLhRZIFzzQWWLzIMjAY3qwsii2+YakDTsDNkkdoRVZbXHLyN9EglKdjh8QoUBSBcaIDEYU91cbtRi7yUFCF2OgBha9lBRZg3nWjuPQFLsDJqkfAtfWfr1jzDSHiR/zuk/GBjO5YQyqtQDU/5WYKCjo/Oicd/JmPw1xYA2sBA7AAM8RFBAEuwMnqYTei3Q95vx47U1VzTJj3uDBZNzXRl9EdUTE+SshnECJcFPOWwraNxj0GYo3OyLM1PgQYgAWYIlvAAbgAp3AKK6XyTPXZ56bOm0f3p/BFFEdr7LwZSd5xQ9wKUukUo/u4h8SdecCHzPmwdtOMJF9ciHodbE+cvmA+cAm1rVoSAsD1m3fmH127cfvSUJOiXRh98nS8/8dpXb0DknWNKB5qzsOIKlwYdIULpWMwB+ZunNrVC2tDeQIa2P552+4jfFsROxd0sbRfm5/31dyMPumZLQWkwsqA9EOTCzqCzdTGvKB7MCNWTU9s/oIOWsHh41tvGz5uNv34Fxdi64IOvNaxQ/t2aXvzVixKTUnqezkSRBqhCm4bMW7GhboGuJw7H+qQW7nEBoALFPCvOx8cP+toYUl+W4v4o6h0L9iiNkvBdnNXplYvsSEtOFddc75owLCxc6jLd7aVCMDulzlmDtgCm6FSEju38RAxztJUumTkoy+9faqyqjDSIgDzgezJi6gN+P9Is1HKjpBGz9T+U1cy+ulXZ9XU/lMRKRGABZjUEyeseCJcIY1i6BY4NmHagjlen/+CXREUow6wADMcEeEKQTxxq96wadfvCz9cvpBuBSVcEbCWYuQAFmCGSgrbSojx0qW9KmfxV5u/zP1+MTEqI6vlCNFhLWAAFsdEl1sIvIAgdTn98muL1mzZtXe1VYCtv+xbDWsBg2OR/0OIKaaB9ooHsqcsoXt8h4Uwu+P+xyfD/zwqOIatHw7YFQJvVthSUICVDxs9Kae0rOJwS2vKyk8fgbmwhq/V7fKwLYSLgWLoPLz9s59//c3mwjKMPTZ+5hswl6ceWiQ4REQIF2OE5QOHCo9NfCVndoPHW3vxHPgOxmAOzOVr0BUlhIuB0Hn2+5937p/77hcLgsMyfF7wwbKFMAZz+Fx0RQoJDsvvL8ndYYZlM8y+8/HKbXbDbKgW8ftd+qQJLQcglFZCaE3qFn81wogEh1mYE/F74bb64RnFAm/DDwy6mPdrkJLzKGfLpsj+vwIMACSZzfDJFmOPAAAAAElFTkSuQmCC";
  13156. this._iconGreen = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjI1NDIwOUU3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjI1NDIwOUQ3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgEE4igAAAgKSURBVHjazFoJbFRVFP3L/OlMoQXKImAFm0JbFtFKShEQI6UsggmkGKghIKTIIgZUohIDKEuLaFTQiIKyKKghqSyyF0pZbcHQsJVpoRkKbYFAW+iU2f78/313+qY+hvc78+dPkZfcMJ377rn3/Pve/fe9gVUUhfENY5eBjNbhvlnI6Bmh+KT5NzBhGigg9sb5vX3NpohhRqMwgOe4eJ7nurIsGwl69MDskiRXS7Jc7naLpx1OV/4z/V67CKpw+Gf1ZiQv9/vWyc8lTkMEpgiCIVGLrSh6ShGhX4ovlG5Mz5jToCcjXKhPIGvyOOG2JW/OywNfuBAd1WqFVhIwwAZsAQOwAPNxZoQ9f+yPHnHdn94QYRSeZ8I4XG7xnLWianq/oZOuBrvkQs0IZz27a2RCfLeCcJOAAZiAjXyM0hqblslcRfHuiV07d9zKcVwU00IDsJGPLeBLS3zBLi3O8nfuyLjuXbegKtTsOrY4Ldz22u2GPFue4bL7MlfrqWXh+xhDjNLL2EtOj0r3jI8Z70kyJcnN4aC4RGtF9eSklzIOoD/lQEsrGCLs/m3f9nxlUP98VE6j1QDz6/P5xZWLI06KJ3lGwIWdB2tfZEgkJB4oVwwzWBgsLY1d6hoWPUxSw0Tl2na8sHjYiAnvlKntmaD3SHxcrDG1f9/1aiScspOZYZ1hGm4dHnmSRyRglk+i/ITQwVywAVvAoA3kMyolufc6iEHv0uKuntkxu1ts5xyacY2nhh1TNsZcpBTxjBl2K4AQ2eD8MiITWXFDmULiYJhUNlXak7DH0d7QnvrUr1feWtgjZdxa2hILKiOzp01o1/mp9gtoOrtsZ0eXjjYXMYhEa/RFKyxmLCaCmBF/NhF633xkCxiABZg0XxADxBJq1eLnz8ycYhSE9jTl3Iq5EWeYM/wjwUPQvj1CEwHP8SMFWIBJbX9QDBALzrNmIhGdOsZkqm3sTfWbhKbgTcSSMhBLiiYcMc9I2CMswARsmk8Uy5s4r5qIsFt/WN6nVaQ5iaZcVLkoQjEpjbD++4IM+hFUQniCDMYBTMCm+USxJP6+bkVfFWRVIny/Pj3TaIpiezF3SjzFN619AaNwRLABSwzhnSOWGxLABh80sz5J8a+qLS81IsY20a1TaIrc2lzhoX3A+2Ui6FcxkRn+4f3j9UEZbdtEDcCUgycSaTbF0RQnGk7wTY79S2xIbSvGIDCPNxynPnUckyYiBpPJ2JmmKBVLuSYCXIA9EWxWWAIPYZeJZdS4cEwGTXtEMBhMNEWthHonVieB5gix2Aft/NIYk6Y9wqHmMGzH4HANHBOn6T3i8UgO2vcxfIzibTdI0Tv88Lw+NMTUHBHF6XJTz9CJQqLs7ZdkLHoIkbbyf71YgpBAbdtxTIoWInK9reEGTTGk9RCpqfGTCDJ6skE2kxL2QRk4JlkLEc+dmrorNEVGTIbo7VxFgowUQlYU4oxCnFMAe0LMBJFmgmPyaCEinrt45TRNkRyZLA8SBkleMj5CMvGclCBJMIQdJgAC2OCDZoZjErUQcees3njK5RZtNOWy2GUu1sk2nidcOAiPX2aUAHvC/1yCBDDh1Khyw2KDmLBF8Bkpt1bWXSm/fpKmhOPp9OjpIhyKGCcWHxkPpQj4b2oPQcJnj7AAMy06jbo/IBaISWtGwF3Dj5tzf1PIIyQx1nRf40phUiTmQWMQTaTI/ePx2wPEPvAF7xWEAViAqXIRoUAsEJPWze6tdn8dOF5y63ZNCbXv4SKVvYl7HSkKItPQGMwjpFx+4he8V5AtYAAWYNJ8QQwQC0bQfLASq2/duTvjveXL0fqkvog6GDooR3sdtWdFZomsjW18Xj5SdhXBwYOADdgW9CpwAJbK3nDMWpC9AmJRW1aBiABww8GCwkt/7s5fpzbJzJmZ9XHrnYfiDtkHSgMlph59CSXC9y8phA7m5sXl2cFWLRMwwPe+w6cuYvqKngs6uFp4tvDApmUv9ktKC1RZSxwl3I66HYaD9QcNFtHC+RpAaDuShCR5RPQIz7h24zy9zb3lQFjFF0oPpY6Yuhh9vIaJ6Lqgg6y1jY5q1bPowOZV8XGxyY+jQUQVqjh15NSP6m0P4HLuntom13KJDQD1CPDa0NezFl2ylBe2NInLZdYi8IV8WvGCDJi9YC+JoXDW3qm5V5aSPmUJSnlBS5EA7P5pk5eAL/Cp1pLouY2HinEXtdLlo96Y+3ll9W1LuEkA5tjMeauQD/h9pNkqpYdIU2bq7tvKM976cFFN3f2qcJEALMBEmbiqJROhEmkig5ZAycz3s5c4nK56vSQQhg2wADMUEqESYXCTcWfX/qNnVn6zcSVaCmKoJMAWYeQAFmCqNYUtRYTBTcftnNWbDv68dedqVMZlrQBgA7aAAVgYk3ncRBTcNd189+NVuXlHi7ZpBTh07PQ2sAUMjKX8H0R8ZKB7qhqbOX8tWuNHNJTZI2MmzYPfPKowhq5rDL1E4M0q4w7qRnrGnBxrRdWFQDYVN25ehLlgg21lvXHoJoLJwInjHrz9M9/+5LPmyjLoJmYt/BTm4tZDCkcMYSGCyXjL8tnzlpJZH+QsfmB31PnPge9AB3NgLrZhnigimAyUzrs79xX8s+zLn7LJsgyfs7/esBJ0MAfPZZ5IImRZ/mrt1iO+suwrs1989+thvWVWbYT9fhc9aQUdB6CUVkNpje3SqQPDMgpZZmFO2O+FW+o/niEsyDb8qt7Rd78GLTmucrp80vz/K8AAYAEv1AHM/GwAAAAASUVORK5CYII=";
  13157. this._iconViolet = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzFDREU3Mjk3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzFDREU3Mjg3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppb+WxIAAAhcSURBVHjazFoLcFTVGb6vvdnNY0lEEJOIxhCSKTEFKSC1osIgjqIyA62mZfAxWJU+tC3TVh2lHSGhtNOKOqK0ii+0QwcfFB+IAsKIITpJhUBDHhMiSSBCTMgm2d377PnungubnXOT3L0b6rlzmM2e83/n+87/n/+ecxbeNE3OLvLFV3Fui3KiivNSkhmTNb7EpagQQvzxg++VBvxpc2XZN1MUhEJRFHJ5nk9HO5mwAV03OnTDaFYUtTocie66pOymOjSlYnzeq0d2bn02c9oVxXcTAct8PqnYja2qakeJoFdqDx3dNH/xij4vHhGSnYHlSxf5Out3rrjmqqmHglkZa9yKQIENbIEBLGCeT4/wB/f+c1LBpXkvpsm+73IpLFFF/bKltf2esjl3NI005JL1iNBSs23B5MKJe1ItAgWYwCZj3OiWm5vOQmvt9ttzJ4zbLAhCFjdKBdhkjNcwlht+Iw0tof6zrQsKLs19jWShIeM40hASure3S727O0WloV/QehTeSo/ZsilPzjCC11+k5yzM0/yTs4yhcAgvtaW1Y2nJ7MU7yJ/GcKE1EiH8B1ueLrr2+9N3kXQadAIM7f1abK84LEcOnBFFXuREMpk8TyrHx4jhMQ1OJ5x0U+f8s8boeY9MUbLmjNedMEm6Du2rqp17w5KfNTitmRGvkcKCfHnW9NK/O4kwIjp37JdfpDUv+jSgVw+IASHAofpRef/gSttQ0Rc2sAUGq5Axs2ZM+85GcPAaWkLT528/MDF/QiXLWPtG4Rt/tM+v1vSLMi9zPl4iniCVeASeEPjB82QQj8Az8IjOaZxqapxiKpzvygy9aMs1EekCmTnrX7WdfHjSjEUbWCE2Io88cPeSnAkXjV3J9ERY5xuX7PNrNQOin0/j0kiVUQUI8llVSnjs79FHpjawBQawgMkaCxzAJdmsJT50X/ky2ecby5yllTWy+p9+MY2PkYonb60RUuER1udBoixBMgcsYDK3P4QDuIBTMkLSxo+7oNxpYfe80eaLhZPMSSSkUAU8vPWvFVr2QrdimD7xfWw7nzUZMgdMYLPGJFx+DE5uhfCbn1s9JSM9UMJqbF9TJ5O5tNZEooh48o4Lk66fwWJIJZjAZtkQLsVvbFxTapm7ECKWTSmax2oYONgjRKp7RSluYbsRwRITS9cxQcDGGCybKSWF1zuFl5MQeUwwcwaroXtbmyTRWLdFkJekKxGDwo3nz4nB+iEVY7D6Z4/JmgluroSkB/wFrIa+z7rE2DyeWwfJiEhcO2fXD3n69p9mzjrl5EqI5PfLE5hv0qZ+gach4TacRhJmwFaaB5i8KCfJ1RrxSZKfuW3oUflE8l49kvg3xmCeX2KcXK0RMut8yo7BqSqUk+DqPaJpepjpqmyfaSbs30wPx24WFsZww2koIWYkqjDP0PKkDAO7WOuheyevBRgGxQS2XJjO3LZTTqYbIUZvqO84qyFz9lidyohtzenjRYT92LiZsy9kbocpJ8ONEO1UV3cjqyHn1nxNw+6V1tgsJicmdkaJCbDxgJ1zW77G6k85aW6EqF/WNVYzc3lZtuGfGdQ1sgXHVtwW4zbM4sPJ3tYDE9gYg2VDOaluhCiV6zftjypqiNWY92iponKKdZ7QaHUjJl6EbQ8sYOY+Uqo43LCEwAncXHmkuaWtu7H5q09ZjTieZv/kEhWHIpXURDHx6ydxLcT3OSdCsQ5YwAxeyz76ggs4ufUIXNv3/MtbXzfjj5BxZeK6aYpvaoYetUhECRnVqhoNNyvkTIP5WbNOh7H+sAUGsIDpcBFhggs4uV3sVrb79459R052dh1hGgZEs+hfP4hIU9P1iEUmapFSDGWQqPjnLHlDoQKiHGyBASxgssYCB3ABp2QOVmrHyVOn7/3V6tUkPpkvImlsmln83nXh4NJcNWKGuYgRIxcTpcQIx1fynd2OvrCBbfG710WA5bA2wvevrFgDLk5hNZwQAPd9uKfq8Jvbd210BPCL3GVPfS9a+PbVYWF6QA8bEBSrYYgzI1a1Ptvfk4q+l791dRi2Tp5Awdjvf7y/joaV6eWCLpPUy6p2vPTElWUl84bLSOH6XqHn3Xapd9fXotLUJ+jdmrUBFHMkU56UaQTnkkRxc54WKAkaw2HVHjr60awb7nycfDxGhXi6oIPXsoNZGUUHdry8rrAgf9r52CCSDFU7a8Gdv+sN9eNyrsdpkbu5xAZALwE8NueW5Y8drm+uGm0R/21oOYCxyJgtGHuoK1O3l9jYFnxzqqunYcb8ZauIy/eMlghgT5+3dBXGwphOWxIvt/HIGKfJVrr5xh/+/E9tHZ31qRYBzIXlD64jY+D3kSGzlBchZz3TfSbUvPiu3z7W1X2mPVUigAVM4okmN55IVshZMSQEjtz364pV4Ui016sIghECFjCTEZGsEI5u3E5t++CTz9c+uWktCQU1WRGwJRiVwAKm06ZwtIRYL11SOyvXv/ThC5vfWW/iaOf2PEJsYAsMYFFM7nwLwQsIW5cTv/j9uq07PzmwxS3AR3urt8AWGBTL/H8IscX04zp4YflDG0iM73aRZnfffMeD+M2jnWJ4Ovx7FYI3K0IKB7Dj8xevqGxpbT80nE3r8RN16Asbamt45eFZCBWDw1AP3v7lP330j0OlZbTdvvzhP6Av3XroqeCQEiFUjJWWaw7WH7n/N5WP9w+EuxP74Du0oQ/6UhvuWyWEikHqPP3O+3u+eOIv/6iIT8v4XPG3F9eiDX1oX+5bKSQ+Lf91w+bddlq20+yfn3n1Y69p1qmk/H6XzLRJjgNIpR1IrfkXj7+Q4zkzPs2iT8rvhUfrP54RLHgbv82Ps+/XsCWnWc7TmKzx/yfAAHo1CtU9myPWAAAAAElFTkSuQmCC";
  13158. this._measureTempPoints = [];
  13159. }
  13160. _updateScene() {
  13161. this._viewer.scene.requestRender();
  13162. }
  13163. _removeEntityByName(entityName) {
  13164. let entities2 = this._entities;
  13165. if (!entities2 || !entities2.values)
  13166. return;
  13167. let delEntitys = [];
  13168. for (let i2 = 0; i2 < entities2.values.length; i2++) {
  13169. if (entities2.values[i2].name == entityName) {
  13170. delEntitys.push(entities2.values[i2]);
  13171. }
  13172. }
  13173. for (let i2 = 0; i2 < delEntitys.length; i2++) {
  13174. entities2.remove(delEntitys[i2]);
  13175. }
  13176. this._updateScene();
  13177. }
  13178. _clear(isAll) {
  13179. if (isAll != void 0 && isAll === true) {
  13180. this._removeEntityByName(this._measureEntityName);
  13181. if (this._sketchViewModel != void 0) {
  13182. this._sketchViewModel.sketchClear();
  13183. }
  13184. }
  13185. this._measureTempPoints = [];
  13186. this._altitudeDynamicLabel = void 0;
  13187. this._tooltipRemove();
  13188. let buttonDiv = document.getElementById("drawButtonDiv");
  13189. if (buttonDiv) {
  13190. document.body.removeChild(buttonDiv);
  13191. }
  13192. }
  13193. _toColor(red, green, blue, alpha) {
  13194. return new Cesium.Color(red / 255, green / 255, blue / 255, alpha);
  13195. }
  13196. _cartesianToGeography(cartesian) {
  13197. let ellipsoid = Cesium.Ellipsoid.WGS84;
  13198. let cartographic = ellipsoid.cartesianToCartographic(cartesian);
  13199. let latitude = Cesium.Math.toDegrees(cartographic.latitude);
  13200. let longitude = Cesium.Math.toDegrees(cartographic.longitude);
  13201. let altitude = cartographic.height;
  13202. return {
  13203. lon: longitude,
  13204. lat: latitude,
  13205. hei: altitude
  13206. };
  13207. }
  13208. _createPoint(coord, label) {
  13209. let _self = this;
  13210. let entity = new Cesium.Entity({
  13211. name: _self._measureEntityName,
  13212. position: coord,
  13213. billboard: {
  13214. image: _self._iconBlue,
  13215. horizontalOrigin: Cesium.HorizontalOrigin.center,
  13216. verticalOrigin: Cesium.VerticalOrigin.bottom,
  13217. scale: 0.5,
  13218. pixelOffset: new Cesium.Cartesian2(0, -11),
  13219. disableDepthTestDistance: Number.POSITIVE_INFINITY
  13220. }
  13221. });
  13222. if (label) {
  13223. entity.label = {
  13224. text: label,
  13225. font: "30px SimHei",
  13226. scale: 0.5,
  13227. fillColor: this._toColor(255, 255, 255, 1),
  13228. outlineColor: this._toColor(14, 30, 79, 1),
  13229. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  13230. outlineWidth: 2,
  13231. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  13232. showBackground: true,
  13233. backgroundColor: _self._toColor(0, 0, 0, 0.6),
  13234. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  13235. pixelOffset: new Cesium.Cartesian2(0, -28)
  13236. };
  13237. }
  13238. this._entities.add(entity);
  13239. this._updateScene();
  13240. return entity;
  13241. }
  13242. _createLabel(coord, label) {
  13243. let _self = this;
  13244. let entity = new Cesium.Entity({
  13245. name: _self._measureEntityName,
  13246. position: coord,
  13247. label: {
  13248. text: label,
  13249. font: "30px SimHei",
  13250. scale: 0.5,
  13251. fillColor: this._toColor(255, 255, 255, 1),
  13252. outlineColor: this._toColor(14, 30, 79, 1),
  13253. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  13254. outlineWidth: 2,
  13255. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  13256. showBackground: true,
  13257. backgroundColor: _self._toColor(0, 0, 0, 0.6),
  13258. disableDepthTestDistance: Number.POSITIVE_INFINITY,
  13259. pixelOffset: new Cesium.Cartesian2(0, -14)
  13260. }
  13261. });
  13262. this._entities.add(entity);
  13263. this._updateScene();
  13264. }
  13265. _createAltitudeDynamicLabel() {
  13266. let _self = this;
  13267. this._altitudeDynamicLabel = new Cesium.Entity({
  13268. name: _self._measureEntityName,
  13269. position: new Cesium.CallbackProperty(function() {
  13270. return _self._altitudeLabelPosition;
  13271. }, false),
  13272. label: {
  13273. text: new Cesium.CallbackProperty(function() {
  13274. return _self._altitudeLabelText;
  13275. }, false),
  13276. font: "12px sans-serif",
  13277. fillColor: this._toColor(255, 255, 255, 1),
  13278. outlineColor: this._toColor(0, 154, 94, 1),
  13279. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  13280. outlineWidth: 1,
  13281. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  13282. pixelOffset: new Cesium.Cartesian2(0, -28),
  13283. showBackground: true,
  13284. backgroundColor: this._toColor(0, 0, 0, 0.6),
  13285. disableDepthTestDistance: Number.POSITIVE_INFINITY
  13286. }
  13287. });
  13288. this._entities.add(this._altitudeDynamicLabel);
  13289. this._updateScene();
  13290. }
  13291. _measureDistance(positions) {
  13292. let distance2 = 0;
  13293. for (let i2 = 0; i2 < positions.length - 1; i2++) {
  13294. let point1cartographic = Cesium.Cartographic.fromCartesian(positions[i2]);
  13295. let point2cartographic = Cesium.Cartographic.fromCartesian(positions[i2 + 1]);
  13296. let geodesic = new Cesium.EllipsoidGeodesic();
  13297. geodesic.setEndPoints(point1cartographic, point2cartographic);
  13298. let s = geodesic.surfaceDistance;
  13299. s = Math.sqrt(Math.pow(s, 2) + Math.pow(
  13300. point2cartographic.height - point1cartographic.height,
  13301. 2
  13302. ));
  13303. distance2 = distance2 + s;
  13304. }
  13305. if (distance2 < 1e3)
  13306. return distance2.toFixed(2) + "\u7C73";
  13307. else
  13308. return (distance2 / 1e3).toFixed(2) + "\u516C\u91CC";
  13309. }
  13310. _measureSpaceDistance(positions) {
  13311. let distance2 = 0;
  13312. for (let i2 = 0; i2 < positions.length - 1; i2++) {
  13313. let point1 = positions[i2];
  13314. let point2 = positions[i2 + 1];
  13315. let sx = Math.abs(point1.x - point2.x);
  13316. let sy = Math.abs(point1.y - point2.y);
  13317. let sz = Math.abs(point1.z - point2.z);
  13318. let s = Math.sqrt(Math.pow(sx, 2) + Math.pow(sy, 2) + Math.pow(sz, 2));
  13319. distance2 = distance2 + s;
  13320. }
  13321. if (distance2 < 1e3)
  13322. return distance2.toFixed(2) + "\u7C73";
  13323. else
  13324. return (distance2 / 1e3).toFixed(2) + "\u516C\u91CC";
  13325. }
  13326. _measureAreaBearing(from3, to) {
  13327. let radiansPerDegree = Math.PI / 180;
  13328. let degreesPerRadian = 180 / Math.PI;
  13329. let lat1 = from3.lat * radiansPerDegree;
  13330. let lon1 = from3.lon * radiansPerDegree;
  13331. let lat2 = to.lat * radiansPerDegree;
  13332. let lon2 = to.lon * radiansPerDegree;
  13333. let angle = -Math.atan2(Math.sin(lon1 - lon2) * Math.cos(lat2), Math.cos(lat1) * Math.sin(
  13334. lat2
  13335. ) - Math.sin(lat1) * Math.cos(lat2) * Math.cos(lon1 - lon2));
  13336. if (angle < 0) {
  13337. angle += Math.PI * 2;
  13338. }
  13339. angle = angle * degreesPerRadian;
  13340. return angle;
  13341. }
  13342. _calculateAreaAngle(p1, p2, p3) {
  13343. let bearing21 = this._measureAreaBearing(p2, p1);
  13344. let bearing23 = this._measureAreaBearing(p2, p3);
  13345. let angle = bearing21 - bearing23;
  13346. if (angle < 0) {
  13347. angle += 360;
  13348. }
  13349. return angle;
  13350. }
  13351. _calculateDistance(point1, point2) {
  13352. let point1cartographic = Cesium.Cartographic.fromCartesian(point1);
  13353. let point2cartographic = Cesium.Cartographic.fromCartesian(point2);
  13354. let geodesic = new Cesium.EllipsoidGeodesic();
  13355. geodesic.setEndPoints(point1cartographic, point2cartographic);
  13356. let s = geodesic.surfaceDistance;
  13357. s = Math.sqrt(Math.pow(s, 2) + Math.pow(point2cartographic.height - point1cartographic.height, 2));
  13358. return s;
  13359. }
  13360. _measureArea(points2, cartesianPoints) {
  13361. let self2 = this;
  13362. let res = 0;
  13363. for (let i2 = 0; i2 < points2.length - 2; i2++) {
  13364. let j = (i2 + 1) % points2.length;
  13365. let k = (i2 + 2) % points2.length;
  13366. let totalAngle = self2._calculateAreaAngle(points2[i2], points2[j], points2[k]);
  13367. let dis_temp1 = self2._calculateDistance(cartesianPoints[i2], cartesianPoints[j]);
  13368. let dis_temp2 = self2._calculateDistance(cartesianPoints[j], cartesianPoints[k]);
  13369. res += dis_temp1 * dis_temp2 * Math.abs(Math.sin(totalAngle));
  13370. }
  13371. return res;
  13372. }
  13373. _calculatePolylineAltitudeHeight(points2) {
  13374. if (points2 === void 0 || points2.length < 2)
  13375. return -1;
  13376. let cartographic = Cesium.Cartographic.fromCartesian(points2[0]);
  13377. let cartographic1 = Cesium.Cartographic.fromCartesian(points2[1]);
  13378. let height_temp = cartographic1.height - cartographic.height;
  13379. return Math.abs(height_temp).toFixed(2) + "\u7C73";
  13380. }
  13381. _setMousePointerStyle() {
  13382. document.querySelector("body").style.cursor = "crosshair";
  13383. }
  13384. _initMousePointerStyle() {
  13385. document.querySelector("body").style.cursor = "default";
  13386. }
  13387. _checkAppOrWeb() {
  13388. if (window.navigator.userAgent.match(
  13389. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  13390. )) {
  13391. return CommonTools.RuntimeEnvironment.App;
  13392. } else {
  13393. return CommonTools.RuntimeEnvironment.Web;
  13394. }
  13395. }
  13396. _isRuntimeApp() {
  13397. if (this._checkAppOrWeb() === CommonTools.RuntimeEnvironment.App) {
  13398. return true;
  13399. }
  13400. return false;
  13401. }
  13402. _isRuntimeWeb() {
  13403. if (this._checkAppOrWeb() === CommonTools.RuntimeEnvironment.Web) {
  13404. return true;
  13405. }
  13406. return false;
  13407. }
  13408. _createOperationMainDom() {
  13409. let buttonDiv = document.createElement("div");
  13410. buttonDiv.id = "drawButtonDiv";
  13411. buttonDiv.style.width = "80px";
  13412. buttonDiv.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
  13413. buttonDiv.style.borderRadius = "5px";
  13414. buttonDiv.style.display = "flex";
  13415. buttonDiv.style.flexDirection = "column";
  13416. buttonDiv.style.padding = "8px";
  13417. buttonDiv.style.justifyContent = "center";
  13418. buttonDiv.style.position = "absolute";
  13419. buttonDiv.style.bottom = "150px";
  13420. buttonDiv.style.right = "10px";
  13421. let btnUndo = document.createElement("button");
  13422. btnUndo.id = "btnDrawBackout";
  13423. btnUndo.style.height = "30px";
  13424. btnUndo.style.marginBottom = "8px";
  13425. btnUndo.style.backgroundColor = "rgba(52, 137, 255, 1.0)";
  13426. btnUndo.style.color = "rgb(255, 255, 255)";
  13427. btnUndo.style.border = "0px solid red";
  13428. btnUndo.style.borderRadius = "5px";
  13429. btnUndo.innerHTML = "\u56DE\u9000";
  13430. btnUndo.style.fontSize = "13px";
  13431. btnUndo.style.cursor = "pointer";
  13432. buttonDiv.appendChild(btnUndo);
  13433. let btnCompletion = document.createElement("button");
  13434. btnCompletion.id = "btnDrawComplete";
  13435. btnCompletion.style.height = "30px";
  13436. btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
  13437. btnCompletion.style.color = "rgb(255, 255, 255)";
  13438. btnCompletion.style.border = "0px solid red";
  13439. btnCompletion.style.borderRadius = "5px";
  13440. btnCompletion.innerHTML = "\u5B8C\u6210";
  13441. btnCompletion.style.fontSize = "13px";
  13442. btnCompletion.style.cursor = "pointer";
  13443. buttonDiv.appendChild(btnCompletion);
  13444. document.body.appendChild(buttonDiv);
  13445. }
  13446. _showTooltipMessage(message) {
  13447. let msgMainDom = document.getElementById("messageMainDom");
  13448. if (msgMainDom !== null && msgMainDom !== void 0) {
  13449. document.body.removeChild(msgMainDom);
  13450. }
  13451. msgMainDom = document.createElement("div");
  13452. msgMainDom.style.width = "30%";
  13453. msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
  13454. msgMainDom.style.height = "45px";
  13455. msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
  13456. msgMainDom.style.borderRadius = "8px";
  13457. msgMainDom.style.display = "flex";
  13458. msgMainDom.style.alignItems = "center";
  13459. msgMainDom.style.paddingLeft = "10px";
  13460. msgMainDom.style.color = "rgb(91, 188, 48)";
  13461. msgMainDom.style.fontSize = "14px";
  13462. msgMainDom.style.fontWeight = "600";
  13463. msgMainDom.style.position = "absolute";
  13464. msgMainDom.style.left = "35%";
  13465. msgMainDom.style.transition = "transform 1s";
  13466. msgMainDom.style.transform = "translateY(-90px)";
  13467. msgMainDom.style.top = "0px";
  13468. msgMainDom.style.zIndex = 1e3;
  13469. document.body.appendChild(msgMainDom);
  13470. let strHtml = "";
  13471. strHtml += "<div style='";
  13472. strHtml += "background-color: rgb(88, 185, 45);";
  13473. strHtml += "color: rgb(255, 255, 255);";
  13474. strHtml += "height: 24px;";
  13475. strHtml += "width: 24px;";
  13476. strHtml += "border-radius: 20px;";
  13477. strHtml += "display: flex;";
  13478. strHtml += "justify-content: center;";
  13479. strHtml += "align-items: center;";
  13480. strHtml += "font-size: 14px;";
  13481. strHtml += "margin-right: 18px;";
  13482. strHtml += "'>&#10003</div>";
  13483. strHtml += "<div>" + message + "</div>";
  13484. msgMainDom.innerHTML = strHtml;
  13485. msgMainDom.addEventListener("transitionend", function() {
  13486. setTimeout(function() {
  13487. document.body.removeChild(msgMainDom);
  13488. }, 1e3);
  13489. }, false);
  13490. setTimeout(function() {
  13491. msgMainDom.style.transform = "translateY(50px)";
  13492. }, 100);
  13493. }
  13494. }
  13495. Object.assign(CommonTools.prototype, {
  13496. _tooltipInit: function(text) {
  13497. this._tooltipId = "tooltipJt";
  13498. let tooltipObj = document.getElementById(this._tooltipId);
  13499. if (tooltipObj === null) {
  13500. tooltipObj = document.createElement("div");
  13501. tooltipObj.id = this._tooltipId;
  13502. document.body.appendChild(tooltipObj);
  13503. let divStyle = "";
  13504. divStyle += "top: 30px;";
  13505. divStyle += "left: 30px;";
  13506. divStyle += "position: absolute;";
  13507. divStyle += "display: flex;";
  13508. divStyle += "align-items: center;";
  13509. divStyle += "width: 12x0px;";
  13510. divStyle += "height: auto;";
  13511. divStyle += "background-color: rgba(0, 0, 0, 0.65);";
  13512. divStyle += "border-radius: 5px;";
  13513. divStyle += "color: rgb(255, 255, 255);";
  13514. divStyle += "font-size: 12px;";
  13515. divStyle += "font-family: 'Alimama_ShuHeiTi_Bold';";
  13516. divStyle += "padding: 8px;";
  13517. divStyle += "border:solid 1px rgb(255,0,0);";
  13518. tooltipObj.setAttribute("style", divStyle);
  13519. }
  13520. if (text != void 0)
  13521. tooltipObj.innerHTML = text;
  13522. document.onmousemove = function(event2) {
  13523. tooltipObj.style.left = event2.clientX + 10 + "px";
  13524. tooltipObj.style.top = event2.clientY - tooltipObj.offsetHeight / 2 + "px";
  13525. };
  13526. },
  13527. _tooltipRemove: function() {
  13528. let tooltipObj = document.getElementById(this._tooltipId);
  13529. if (tooltipObj != null) {
  13530. document.body.removeChild(tooltipObj);
  13531. }
  13532. },
  13533. _tooltipSetText: function(text) {
  13534. let tooltipObj = document.getElementById(this._tooltipId);
  13535. if (tooltipObj != null) {
  13536. tooltipObj.innerHTML = text;
  13537. }
  13538. }
  13539. });
  13540. Object.assign(CommonTools.prototype, {
  13541. clear: function() {
  13542. this._clear(true);
  13543. this._initMousePointerStyle();
  13544. }
  13545. });
  13546. Object.assign(CommonTools.prototype, {
  13547. measureLength: function(callError) {
  13548. let _self = this;
  13549. this._tempEntitys = [];
  13550. this._clear(this._isClear);
  13551. this._setMousePointerStyle();
  13552. if (this._isRuntimeApp()) {
  13553. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13554. } else {
  13555. this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13556. }
  13557. if (this._isRuntimeWeb()) {
  13558. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
  13559. onAdded: function(cPoints, gPoints) {
  13560. if (cPoints.length === 1) {
  13561. _self._createPoint(cPoints[0], "\u8D77\u70B9");
  13562. } else {
  13563. let distince = _self._measureDistance(cPoints);
  13564. let tempPoints = [cPoints[cPoints.length - 2], cPoints[cPoints.length - 1]];
  13565. distince += " +" + _self._measureDistance(tempPoints);
  13566. _self._tempEntitys.push(_self._createPoint(
  13567. cPoints[cPoints.length - 1],
  13568. distince
  13569. ));
  13570. }
  13571. },
  13572. onUndo: function() {
  13573. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13574. _self._tempEntitys.pop();
  13575. },
  13576. onMoving: function(cPoint, scPoint) {
  13577. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  13578. },
  13579. onError: function(error) {
  13580. if (callError)
  13581. callError(error);
  13582. },
  13583. onComplete: function(cPoints, gPoints) {
  13584. _self._initMousePointerStyle();
  13585. _self._tooltipRemove();
  13586. }
  13587. });
  13588. } else {
  13589. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
  13590. onAdded: function(cPoints, gPoints) {
  13591. if (cPoints.length === 1) {
  13592. _self._tooltipRemove();
  13593. _self._createPoint(cPoints[0], "\u8D77\u70B9");
  13594. let buttonDiv = document.getElementById("drawButtonDiv");
  13595. if (buttonDiv == null) {
  13596. _self._createOperationMainDom();
  13597. document.getElementById("btnDrawBackout").onclick = () => {
  13598. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  13599. _self._sketchViewModel._sketchPoints.pop();
  13600. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  13601. if (_self._sketchViewModel._isDrawPoint) {
  13602. let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
  13603. _self._sketchViewModel._entities.remove(lastPointEntity);
  13604. _self._sketchViewModel._pointEntitys.pop();
  13605. }
  13606. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13607. _self._tempEntitys.pop();
  13608. }
  13609. };
  13610. document.getElementById("btnDrawComplete").onclick = () => {
  13611. if (_self._sketchViewModel._sketchPoints.length < 2) {
  13612. if (callError)
  13613. callError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  13614. return;
  13615. }
  13616. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
  13617. _self._sketchViewModel._createPolyline();
  13618. if (!_self._sketchViewModel._isRetainDrawPoint)
  13619. _self._sketchViewModel._removePointEntitys();
  13620. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  13621. _self._initMousePointerStyle();
  13622. _self._tooltipRemove();
  13623. let buttonDiv2 = document.getElementById("drawButtonDiv");
  13624. if (buttonDiv2) {
  13625. document.body.removeChild(buttonDiv2);
  13626. }
  13627. };
  13628. }
  13629. } else {
  13630. let distince = _self._measureDistance(cPoints);
  13631. let tempPoints = [cPoints[cPoints.length - 2], cPoints[cPoints.length - 1]];
  13632. distince += " +" + _self._measureDistance(tempPoints);
  13633. _self._tempEntitys.push(_self._createPoint(cPoints[cPoints.length - 1], distince));
  13634. }
  13635. }
  13636. });
  13637. }
  13638. },
  13639. measureSpatialLength: function(callError) {
  13640. let _self = this;
  13641. this._clear(this._isClear);
  13642. this._setMousePointerStyle();
  13643. if (this._isRuntimeApp()) {
  13644. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13645. } else {
  13646. this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13647. }
  13648. this._tempEntitys = [];
  13649. if (this._isRuntimeWeb()) {
  13650. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Spatial, {
  13651. onAdded: function(cPoints, gPoints) {
  13652. if (cPoints.length === 1) {
  13653. _self._createPoint(cPoints[0], "\u8D77\u70B9");
  13654. } else {
  13655. let distince = _self._measureSpaceDistance(cPoints);
  13656. _self._tempEntitys.push(_self._createPoint(
  13657. cPoints[cPoints.length - 1],
  13658. distince
  13659. ));
  13660. }
  13661. },
  13662. onUndo: function() {
  13663. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13664. _self._tempEntitys.pop();
  13665. },
  13666. onMoving: function(cPoint, scPoint) {
  13667. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  13668. },
  13669. onError: function(error) {
  13670. if (callError)
  13671. callError(error);
  13672. },
  13673. onComplete: function(cPoints, gPoints) {
  13674. _self._initMousePointerStyle();
  13675. _self._tooltipRemove();
  13676. }
  13677. });
  13678. } else {
  13679. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Spatial, {
  13680. onAdded: function(cPoints, gPoints) {
  13681. if (cPoints.length === 1) {
  13682. _self._tooltipRemove();
  13683. _self._createPoint(cPoints[0], "\u8D77\u70B9");
  13684. let buttonDiv = document.getElementById("drawButtonDiv");
  13685. if (buttonDiv == null) {
  13686. _self._createOperationMainDom();
  13687. document.getElementById("btnDrawBackout").onclick = () => {
  13688. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  13689. _self._sketchViewModel._sketchPoints.pop();
  13690. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  13691. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13692. _self._tempEntitys.pop();
  13693. }
  13694. };
  13695. document.getElementById("btnDrawComplete").onclick = () => {
  13696. if (_self._sketchViewModel._sketchPoints.length < 2) {
  13697. if (callError)
  13698. callError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  13699. return;
  13700. }
  13701. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempSpatialPolyline);
  13702. _self._sketchViewModel._createSpatialPolyline();
  13703. _self._sketchViewModel._removePointEntitys();
  13704. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  13705. _self._initMousePointerStyle();
  13706. _self._tooltipRemove();
  13707. let buttonDiv2 = document.getElementById("drawButtonDiv");
  13708. if (buttonDiv2) {
  13709. document.body.removeChild(buttonDiv2);
  13710. }
  13711. };
  13712. }
  13713. } else {
  13714. let distince = _self._measureSpaceDistance(cPoints);
  13715. _self._tempEntitys.push(_self._createPoint(cPoints[cPoints.length - 1], distince));
  13716. }
  13717. }
  13718. });
  13719. }
  13720. },
  13721. measureArea: function(callError) {
  13722. let _self = this;
  13723. this._clear(this._isClear);
  13724. this._setMousePointerStyle();
  13725. if (this._isRuntimeApp()) {
  13726. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13727. } else {
  13728. this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u6D4B\u91CF");
  13729. }
  13730. var _areaLabel = "";
  13731. if (this._isRuntimeWeb()) {
  13732. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
  13733. onAdded: function(cPoints, gPoints) {
  13734. _self._measureTempPoints.push(_self._cartesianToGeography(cPoints[cPoints.length - 1]));
  13735. if (cPoints.length === 1) {
  13736. _areaLabel = "\u8D77\u70B9";
  13737. _self._createPoint(cPoints[0], new Cesium.CallbackProperty(function() {
  13738. var lable = _areaLabel;
  13739. return lable;
  13740. }, false));
  13741. } else if (cPoints.length >= 3) {
  13742. let area = _self._measureArea(_self._measureTempPoints, cPoints);
  13743. if (area > 1e5) {
  13744. _areaLabel = (area / 1e5).toFixed(2) + "km\xB2";
  13745. } else {
  13746. _areaLabel = area.toFixed(2) + "m\xB2";
  13747. }
  13748. }
  13749. },
  13750. onUndo: function() {
  13751. _self._measureTempPoints.pop();
  13752. if (_self._measureTempPoints.length === 1)
  13753. _self._areaLabel = "\u8D77\u70B9";
  13754. },
  13755. onMoving: function(cPoint, scPoint) {
  13756. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  13757. },
  13758. onError: function(error) {
  13759. if (callError)
  13760. callError(error);
  13761. },
  13762. onComplete: function(cPoints, gPoints) {
  13763. _self._initMousePointerStyle();
  13764. _self._tooltipRemove();
  13765. }
  13766. });
  13767. } else {
  13768. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
  13769. onAdded: function(cPoints, gPoints) {
  13770. _self._measureTempPoints.push(_self._cartesianToGeography(cPoints[cPoints.length - 1]));
  13771. if (cPoints.length === 1) {
  13772. _self._tooltipRemove();
  13773. _areaLabel = "\u8D77\u70B9";
  13774. _self._createPoint(cPoints[0], new Cesium.CallbackProperty(function() {
  13775. var lable = _areaLabel;
  13776. return lable;
  13777. }, false));
  13778. let buttonDiv = document.getElementById("drawButtonDiv");
  13779. if (buttonDiv == null) {
  13780. _self._createOperationMainDom();
  13781. document.getElementById("btnDrawBackout").onclick = () => {
  13782. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  13783. _self._sketchViewModel._sketchPoints.pop();
  13784. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  13785. if (_self._sketchViewModel._isDrawPoint) {
  13786. let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
  13787. _self._entities.remove(lastPointEntity);
  13788. _self._sketchViewModel._pointEntitys.pop();
  13789. }
  13790. _self._measureTempPoints.pop();
  13791. if (_self._measureTempPoints.length === 1)
  13792. _self._areaLabel = "\u8D77\u70B9";
  13793. }
  13794. };
  13795. document.getElementById("btnDrawComplete").onclick = () => {
  13796. if (_self._sketchViewModel._sketchPoints.length < 3) {
  13797. if (callError)
  13798. callError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  13799. return;
  13800. }
  13801. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolygon);
  13802. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
  13803. _self._sketchViewModel._createPolygon();
  13804. if (!_self._sketchViewModel._isRetainDrawPoint)
  13805. _self._sketchViewModel._removePointEntitys();
  13806. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  13807. _self._initMousePointerStyle();
  13808. _self._tooltipRemove();
  13809. let buttonDiv2 = document.getElementById("drawButtonDiv");
  13810. if (buttonDiv2) {
  13811. document.body.removeChild(buttonDiv2);
  13812. }
  13813. };
  13814. }
  13815. } else if (cPoints.length >= 3) {
  13816. let area = _self._measureArea(_self._measureTempPoints, cPoints);
  13817. if (area > 1e5) {
  13818. _areaLabel = (area / 1e5).toFixed(2) + "km\xB2";
  13819. } else {
  13820. _areaLabel = area.toFixed(2) + "m\xB2";
  13821. }
  13822. }
  13823. }
  13824. });
  13825. }
  13826. },
  13827. measureHeight: function(callError) {
  13828. let _self = this;
  13829. this._clear(this._isClear);
  13830. this._setMousePointerStyle();
  13831. if (this._isRuntimeApp()) {
  13832. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  13833. } else {
  13834. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  13835. }
  13836. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Height, {
  13837. onAdded: function(cPoint) {
  13838. if (_self._isRuntimeApp()) {
  13839. _self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13840. } else {
  13841. _self._tooltipSetText("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13842. }
  13843. },
  13844. onMoving: function(cPoints, centerPoint) {
  13845. let height2 = _self._calculatePolylineAltitudeHeight(cPoints);
  13846. _self._altitudeLabelPosition = centerPoint;
  13847. _self._altitudeLabelText = height2;
  13848. if (_self._altitudeDynamicLabel === void 0) {
  13849. _self._createAltitudeDynamicLabel();
  13850. }
  13851. },
  13852. onError: function(error) {
  13853. if (callError)
  13854. callError(error);
  13855. },
  13856. onComplete: function(cPoints, centerPoint) {
  13857. let height2 = _self._calculatePolylineAltitudeHeight(cPoints);
  13858. _self._entities.remove(_self._altitudeDynamicLabel);
  13859. _self._createLabel(centerPoint, height2);
  13860. _self._initMousePointerStyle();
  13861. _self._tooltipRemove();
  13862. }
  13863. });
  13864. },
  13865. measureTriangle: function(callError) {
  13866. let _self = this;
  13867. this._clear(this._isClear);
  13868. this._setMousePointerStyle();
  13869. if (this._isRuntimeApp()) {
  13870. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  13871. } else {
  13872. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  13873. }
  13874. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Triangle, {
  13875. onAdded: function(cPoint) {
  13876. if (_self._isRuntimeApp()) {
  13877. _self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13878. } else {
  13879. _self._tooltipSetText("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13880. }
  13881. },
  13882. onMoving: function(cPoint) {
  13883. _self._tooltipSetText("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u6D4B\u91CF");
  13884. },
  13885. onError: function(error) {
  13886. if (callError)
  13887. callError(error);
  13888. },
  13889. onComplete: function(positions) {
  13890. _self._initMousePointerStyle();
  13891. _self._tooltipRemove();
  13892. let sPoints = [positions[0], positions[1]];
  13893. let sDistince = _self._measureSpaceDistance(sPoints);
  13894. let hPoints = [positions[1], positions[2]];
  13895. let hDistince = _self._measureSpaceDistance(hPoints);
  13896. let hePoints = [positions[2], positions[0]];
  13897. let height2 = _self._calculatePolylineAltitudeHeight(hePoints);
  13898. _self._createLabel(positions[0], "\u659C\u8DDD:" + sDistince);
  13899. _self._createLabel(positions[1], "\u5E73\u8DDD:" + hDistince);
  13900. _self._createLabel(positions[2], "\u9AD8\u5EA6:" + height2);
  13901. }
  13902. });
  13903. }
  13904. });
  13905. Object.assign(CommonTools.prototype, {
  13906. queryByPoint: function(callComplete) {
  13907. let _self = this;
  13908. this._setMousePointerStyle();
  13909. this._clear(this._isClear);
  13910. if (this._isRuntimeApp()) {
  13911. this._showTooltipMessage("\u70B9\u51FB\u4F4D\u7F6E\u8FDB\u884C\u67E5\u8BE2");
  13912. } else {
  13913. this._tooltipInit("\u5355\u51FB\u4F4D\u7F6E\u8FDB\u884C\u67E5\u8BE2");
  13914. }
  13915. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Point, {
  13916. onComplete: function(cPoint, gPoint) {
  13917. _self._initMousePointerStyle();
  13918. _self._tooltipRemove();
  13919. _self._createPoint(cPoint);
  13920. let coordinates = gPoint.lng + "," + gPoint.lat;
  13921. if (callComplete)
  13922. callComplete(coordinates);
  13923. }
  13924. });
  13925. },
  13926. queryByMultiplePoint: function(callComplete) {
  13927. let _self = this;
  13928. this._setMousePointerStyle();
  13929. this._clear(this._isClear);
  13930. this._tooltipInit("\u70B9\u51FB\u4F4D\u7F6E\u7ED8\u5236<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  13931. this._tempEntitys = [];
  13932. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.MultiplePoint, {
  13933. onAdded: function(cPoint, gPoint) {
  13934. let res = gPoint.lng.toFixed(6) + "," + gPoint.lat.toFixed(6);
  13935. _self._tempEntitys.push(_self._createPoint(cPoint, res));
  13936. },
  13937. onUndo: function() {
  13938. _self._viewer.entities.remove(_self._tempEntitys[_self._tempEntitys.length - 1]);
  13939. _self._tempEntitys.pop();
  13940. },
  13941. onComplete: function(cPoints, gPoints) {
  13942. _self._initMousePointerStyle();
  13943. _self._tooltipRemove();
  13944. let res = [];
  13945. for (let i2 = 0; i2 < gPoints.length; i2++) {
  13946. res.push(gPoints[i2].lng);
  13947. res.push(gPoints[i2].lat);
  13948. }
  13949. if (callComplete)
  13950. callComplete(res);
  13951. }
  13952. });
  13953. },
  13954. queryByLine: function(callComplete, callError) {
  13955. let _self = this;
  13956. this._clear(this._isClear);
  13957. this._setMousePointerStyle();
  13958. if (this._isRuntimeApp()) {
  13959. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  13960. } else {
  13961. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u7EBF");
  13962. }
  13963. if (this._isRuntimeWeb()) {
  13964. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
  13965. onAdded: function(cPoints, gPoints) {
  13966. },
  13967. onMoving: function(cPoint, scPoint) {
  13968. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236\u5F00\u59CB\u67E5\u8BE2");
  13969. },
  13970. onError: function(error) {
  13971. if (callError)
  13972. callError(error);
  13973. },
  13974. onComplete: function(cPoints, gPoints) {
  13975. _self._initMousePointerStyle();
  13976. _self._tooltipRemove();
  13977. let coordinates = void 0;
  13978. for (let i2 = 0; i2 < gPoints.length; i2++) {
  13979. let point2 = gPoints[i2];
  13980. if (coordinates === void 0)
  13981. coordinates = point2.lng + "," + point2.lat;
  13982. else
  13983. coordinates += "," + point2.lng + "," + point2.lat;
  13984. }
  13985. if (callComplete)
  13986. callComplete(coordinates);
  13987. }
  13988. });
  13989. } else {
  13990. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Line, {
  13991. onAdded: function(cPoints, gPoints) {
  13992. if (cPoints.length === 1) {
  13993. _self._tooltipRemove();
  13994. let buttonDiv = document.getElementById("drawButtonDiv");
  13995. if (buttonDiv == null) {
  13996. _self._createOperationMainDom();
  13997. document.getElementById("btnDrawBackout").onclick = () => {
  13998. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  13999. _self._sketchViewModel._sketchPoints.pop();
  14000. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  14001. if (_self._sketchViewModel._isDrawPoint) {
  14002. let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
  14003. _self._sketchViewModel._entities.remove(lastPointEntity);
  14004. _self._sketchViewModel._pointEntitys.pop();
  14005. }
  14006. }
  14007. };
  14008. document.getElementById("btnDrawComplete").onclick = () => {
  14009. if (_self._sketchViewModel._sketchPoints.length < 2) {
  14010. if (callError)
  14011. callError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  14012. return;
  14013. }
  14014. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
  14015. _self._sketchViewModel._createPolyline();
  14016. if (!_self._sketchViewModel._isRetainDrawPoint)
  14017. _self._sketchViewModel._removePointEntitys();
  14018. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  14019. _self._initMousePointerStyle();
  14020. _self._tooltipRemove();
  14021. let coordinates = void 0;
  14022. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14023. let point2 = gPoints[i2];
  14024. if (coordinates === void 0)
  14025. coordinates = point2.lng + "," + point2.lat;
  14026. else
  14027. coordinates += "," + point2.lng + "," + point2.lat;
  14028. }
  14029. let buttonDiv2 = document.getElementById("drawButtonDiv");
  14030. if (buttonDiv2) {
  14031. document.body.removeChild(buttonDiv2);
  14032. }
  14033. if (callComplete)
  14034. callComplete(coordinates);
  14035. };
  14036. }
  14037. }
  14038. }
  14039. });
  14040. }
  14041. },
  14042. queryByPolygon: function(callComplete, callError) {
  14043. let _self = this;
  14044. this._clear(this._isClear);
  14045. this._setMousePointerStyle();
  14046. if (this._isRuntimeApp()) {
  14047. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u533A\u57DF");
  14048. } else {
  14049. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u533A\u57DF");
  14050. }
  14051. if (this._isRuntimeWeb()) {
  14052. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
  14053. onMoving: function(cPoint, scPoint) {
  14054. _self._tooltipSetText("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236\u5F00\u59CB\u67E5\u8BE2");
  14055. },
  14056. onError: function(error) {
  14057. if (callError)
  14058. callError(error);
  14059. },
  14060. onComplete: function(cPoints, gPoints) {
  14061. _self._initMousePointerStyle();
  14062. _self._tooltipRemove();
  14063. let coordinates = void 0;
  14064. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14065. let point2 = gPoints[i2];
  14066. if (coordinates === void 0)
  14067. coordinates = point2.lng + "," + point2.lat;
  14068. else
  14069. coordinates += "," + point2.lng + "," + point2.lat;
  14070. }
  14071. coordinates += "," + gPoints[0].lng + "," + gPoints[0].lat;
  14072. if (callComplete)
  14073. callComplete(coordinates);
  14074. }
  14075. });
  14076. } else {
  14077. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Polygon, {
  14078. onAdded: function(cPoints, gPoints) {
  14079. if (cPoints.length === 1) {
  14080. _self._tooltipRemove();
  14081. let buttonDiv = document.getElementById("drawButtonDiv");
  14082. if (buttonDiv == null) {
  14083. _self._createOperationMainDom();
  14084. document.getElementById("btnDrawBackout").onclick = () => {
  14085. if (_self._sketchViewModel._sketchTempPoints.length > 2) {
  14086. _self._sketchViewModel._sketchPoints.pop();
  14087. _self._sketchViewModel._sketchTempPoints.splice(_self._sketchViewModel._sketchTempPoints.length - 1, 1);
  14088. if (_self._sketchViewModel._isDrawPoint) {
  14089. let lastPointEntity = _self._sketchViewModel._pointEntitys[_self._sketchViewModel._pointEntitys.length - 1];
  14090. _self._entities.remove(lastPointEntity);
  14091. _self._sketchViewModel._pointEntitys.pop();
  14092. }
  14093. }
  14094. };
  14095. document.getElementById("btnDrawComplete").onclick = () => {
  14096. if (_self._sketchViewModel._sketchPoints.length < 3) {
  14097. if (callError)
  14098. callError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  14099. return;
  14100. }
  14101. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolygon);
  14102. _self._sketchViewModel._removeEntityByObject(_self._sketchViewModel._sketchTempPolyline);
  14103. _self._sketchViewModel._createPolygon();
  14104. if (!_self._sketchViewModel._isRetainDrawPoint)
  14105. _self._sketchViewModel._removePointEntitys();
  14106. _self._sketchViewModel._clearEvent(_self._sketchViewModel._sketchEventHandler);
  14107. _self._initMousePointerStyle();
  14108. _self._tooltipRemove();
  14109. let coordinates = void 0;
  14110. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14111. let point2 = gPoints[i2];
  14112. if (coordinates === void 0)
  14113. coordinates = point2.lng + "," + point2.lat;
  14114. else
  14115. coordinates += "," + point2.lng + "," + point2.lat;
  14116. }
  14117. coordinates += "," + gPoints[0].lng + "," + gPoints[0].lat;
  14118. let buttonDiv2 = document.getElementById("drawButtonDiv");
  14119. if (buttonDiv2) {
  14120. document.body.removeChild(buttonDiv2);
  14121. }
  14122. if (callComplete)
  14123. callComplete(coordinates);
  14124. };
  14125. }
  14126. }
  14127. }
  14128. });
  14129. }
  14130. },
  14131. queryByCircle: function(callComplete) {
  14132. let _self = this;
  14133. this._clear(this._isClear);
  14134. this._setMousePointerStyle();
  14135. if (this._isRuntimeApp()) {
  14136. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u5706");
  14137. } else {
  14138. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u5706");
  14139. }
  14140. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Circle, {
  14141. onAdded: function(center2) {
  14142. if (_self._isRuntimeApp()) {
  14143. _self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u7ED8\u5236");
  14144. } else {
  14145. _self._tooltipInit("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236");
  14146. }
  14147. },
  14148. onComplete: function(center2, radius) {
  14149. _self._initMousePointerStyle();
  14150. _self._tooltipRemove();
  14151. if (callComplete)
  14152. callComplete(center2.lng + "," + center2.lat, radius);
  14153. }
  14154. });
  14155. },
  14156. queryByRectangle: function(callComplete) {
  14157. let _self = this;
  14158. this._clear(this._isClear);
  14159. this._setMousePointerStyle();
  14160. if (this._isRuntimeApp()) {
  14161. this._showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236\u77E9\u5F62");
  14162. } else {
  14163. this._tooltipInit("\u5355\u51FB\u5F00\u59CB\u7ED8\u5236\u77E9\u5F62");
  14164. }
  14165. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.Rectangle, {
  14166. onAdded: function(center2) {
  14167. if (_self._isRuntimeApp()) {
  14168. _self._showTooltipMessage("\u518D\u6B21\u70B9\u51FB\u7ED3\u675F\u7ED8\u5236");
  14169. } else {
  14170. _self._tooltipInit("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236");
  14171. }
  14172. },
  14173. onComplete: function(gPoints) {
  14174. _self._initMousePointerStyle();
  14175. _self._tooltipRemove();
  14176. let coordinates = void 0;
  14177. for (let i2 = 0; i2 < gPoints.length; i2++) {
  14178. let point2 = gPoints[i2];
  14179. if (coordinates === void 0)
  14180. coordinates = point2.lng + "," + point2.lat;
  14181. else
  14182. coordinates += "," + point2.lng + "," + point2.lat;
  14183. }
  14184. if (callComplete)
  14185. callComplete(coordinates);
  14186. }
  14187. });
  14188. }
  14189. });
  14190. Object.assign(CommonTools.prototype, {
  14191. drawPolygonBody: function(callComplete) {
  14192. let _self = this;
  14193. this._clear(this._isClear);
  14194. this._setMousePointerStyle();
  14195. this._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  14196. this._sketchViewModel.sketchTools(SketchViewModel.SketchType.PolygonBody, {
  14197. onAdded: function(cPoints, gPoints) {
  14198. if (cPoints.length === 0) {
  14199. _self._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  14200. } else if (cPoints.length < 3) {
  14201. _self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000");
  14202. } else {
  14203. _self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  14204. }
  14205. },
  14206. onUndo: function(cPoints) {
  14207. if (cPoints.length === 0) {
  14208. _self._tooltipInit("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  14209. } else if (cPoints.length < 3) {
  14210. _self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000");
  14211. } else {
  14212. _self._tooltipInit("\u53F3\u952E\u5355\u51FB\u56DE\u9000<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  14213. }
  14214. },
  14215. onComplete: function(cPoints, gPoints) {
  14216. _self._initMousePointerStyle();
  14217. _self._tooltipRemove();
  14218. if (callComplete)
  14219. callComplete();
  14220. }
  14221. });
  14222. },
  14223. drawPointFeacture: function(points2, options2) {
  14224. this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawPoint, options2);
  14225. },
  14226. drawMultiplePointFeacture: function(points2, options2) {
  14227. this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawMultiplePoint, options2);
  14228. },
  14229. drawPolylineFeacture: function(points2, options2) {
  14230. this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawPolyline, options2);
  14231. },
  14232. drawPolygonFeacture: function(points2, options2) {
  14233. this._sketchViewModel.sketchDrawFeacture(points2, SketchViewModel.SketchType.DrawPolygon, options2);
  14234. }
  14235. });
  14236. Object.assign(CommonTools.prototype, {
  14237. tooltipInit: function(text) {
  14238. this._tooltipInit(text);
  14239. },
  14240. tooltipRemove: function() {
  14241. this._tooltipRemove();
  14242. },
  14243. tooltipSetText: function(text) {
  14244. this._tooltipSetText(text);
  14245. }
  14246. });
  14247. Object.assign(CommonTools.prototype, {
  14248. pickPolygonBody: function(callComplete) {
  14249. this._sketchViewModel.sketchPick(function(options2) {
  14250. if (options2 === void 0) {
  14251. if (callComplete)
  14252. callComplete(void 0);
  14253. } else {
  14254. if (callComplete)
  14255. callComplete({
  14256. color: options2.color,
  14257. height: options2.height
  14258. });
  14259. }
  14260. });
  14261. },
  14262. setPolygonBody: function(options2) {
  14263. this._sketchViewModel.sketchEditPickPolygonBody({
  14264. color: options2.color,
  14265. height: options2.height,
  14266. onComplete: options2.onComplete
  14267. });
  14268. },
  14269. removePolygonBody: function(onComplete) {
  14270. this._sketchViewModel.sketchRemovePickPolygonBody(onComplete);
  14271. }
  14272. });
  14273. CommonTools.RuntimeEnvironment = Object.freeze({
  14274. App: "app",
  14275. Web: "web"
  14276. });
  14277. const composeEventHandlers = (theirsHandler, oursHandler, { checkForDefaultPrevented = true } = {}) => {
  14278. const handleEvent = (event2) => {
  14279. const shouldPrevent = theirsHandler == null ? void 0 : theirsHandler(event2);
  14280. if (checkForDefaultPrevented === false || !shouldPrevent) {
  14281. return oursHandler == null ? void 0 : oursHandler(event2);
  14282. }
  14283. };
  14284. return handleEvent;
  14285. };
  14286. var _a;
  14287. const isClient = typeof window !== "undefined";
  14288. const isString$1 = (val) => typeof val === "string";
  14289. const noop$3 = () => {
  14290. };
  14291. const isIOS = isClient && ((_a = window == null ? void 0 : window.navigator) == null ? void 0 : _a.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
  14292. function resolveUnref(r2) {
  14293. return typeof r2 === "function" ? r2() : unref(r2);
  14294. }
  14295. function identity(arg) {
  14296. return arg;
  14297. }
  14298. function tryOnScopeDispose(fn2) {
  14299. if (getCurrentScope()) {
  14300. onScopeDispose(fn2);
  14301. return true;
  14302. }
  14303. return false;
  14304. }
  14305. function tryOnMounted(fn2, sync = true) {
  14306. if (getCurrentInstance())
  14307. onMounted(fn2);
  14308. else if (sync)
  14309. fn2();
  14310. else
  14311. nextTick(fn2);
  14312. }
  14313. function useTimeoutFn(cb, interval, options2 = {}) {
  14314. const {
  14315. immediate = true
  14316. } = options2;
  14317. const isPending = ref(false);
  14318. let timer = null;
  14319. function clear() {
  14320. if (timer) {
  14321. clearTimeout(timer);
  14322. timer = null;
  14323. }
  14324. }
  14325. function stop() {
  14326. isPending.value = false;
  14327. clear();
  14328. }
  14329. function start2(...args) {
  14330. clear();
  14331. isPending.value = true;
  14332. timer = setTimeout(() => {
  14333. isPending.value = false;
  14334. timer = null;
  14335. cb(...args);
  14336. }, resolveUnref(interval));
  14337. }
  14338. if (immediate) {
  14339. isPending.value = true;
  14340. if (isClient)
  14341. start2();
  14342. }
  14343. tryOnScopeDispose(stop);
  14344. return {
  14345. isPending: readonly(isPending),
  14346. start: start2,
  14347. stop
  14348. };
  14349. }
  14350. function unrefElement(elRef) {
  14351. var _a2;
  14352. const plain = resolveUnref(elRef);
  14353. return (_a2 = plain == null ? void 0 : plain.$el) != null ? _a2 : plain;
  14354. }
  14355. const defaultWindow = isClient ? window : void 0;
  14356. function useEventListener(...args) {
  14357. let target;
  14358. let events;
  14359. let listeners;
  14360. let options2;
  14361. if (isString$1(args[0]) || Array.isArray(args[0])) {
  14362. [events, listeners, options2] = args;
  14363. target = defaultWindow;
  14364. } else {
  14365. [target, events, listeners, options2] = args;
  14366. }
  14367. if (!target)
  14368. return noop$3;
  14369. if (!Array.isArray(events))
  14370. events = [events];
  14371. if (!Array.isArray(listeners))
  14372. listeners = [listeners];
  14373. const cleanups = [];
  14374. const cleanup = () => {
  14375. cleanups.forEach((fn2) => fn2());
  14376. cleanups.length = 0;
  14377. };
  14378. const register = (el, event2, listener, options22) => {
  14379. el.addEventListener(event2, listener, options22);
  14380. return () => el.removeEventListener(event2, listener, options22);
  14381. };
  14382. const stopWatch = watch(() => [unrefElement(target), resolveUnref(options2)], ([el, options22]) => {
  14383. cleanup();
  14384. if (!el)
  14385. return;
  14386. cleanups.push(...events.flatMap((event2) => {
  14387. return listeners.map((listener) => register(el, event2, listener, options22));
  14388. }));
  14389. }, { immediate: true, flush: "post" });
  14390. const stop = () => {
  14391. stopWatch();
  14392. cleanup();
  14393. };
  14394. tryOnScopeDispose(stop);
  14395. return stop;
  14396. }
  14397. let _iOSWorkaround = false;
  14398. function onClickOutside(target, handler, options2 = {}) {
  14399. const { window: window2 = defaultWindow, ignore = [], capture = true, detectIframe = false } = options2;
  14400. if (!window2)
  14401. return;
  14402. if (isIOS && !_iOSWorkaround) {
  14403. _iOSWorkaround = true;
  14404. Array.from(window2.document.body.children).forEach((el) => el.addEventListener("click", noop$3));
  14405. }
  14406. let shouldListen = true;
  14407. const shouldIgnore = (event2) => {
  14408. return ignore.some((target2) => {
  14409. if (typeof target2 === "string") {
  14410. return Array.from(window2.document.querySelectorAll(target2)).some((el) => el === event2.target || event2.composedPath().includes(el));
  14411. } else {
  14412. const el = unrefElement(target2);
  14413. return el && (event2.target === el || event2.composedPath().includes(el));
  14414. }
  14415. });
  14416. };
  14417. const listener = (event2) => {
  14418. const el = unrefElement(target);
  14419. if (!el || el === event2.target || event2.composedPath().includes(el))
  14420. return;
  14421. if (event2.detail === 0)
  14422. shouldListen = !shouldIgnore(event2);
  14423. if (!shouldListen) {
  14424. shouldListen = true;
  14425. return;
  14426. }
  14427. handler(event2);
  14428. };
  14429. const cleanup = [
  14430. useEventListener(window2, "click", listener, { passive: true, capture }),
  14431. useEventListener(window2, "pointerdown", (e) => {
  14432. const el = unrefElement(target);
  14433. if (el)
  14434. shouldListen = !e.composedPath().includes(el) && !shouldIgnore(e);
  14435. }, { passive: true }),
  14436. detectIframe && useEventListener(window2, "blur", (event2) => {
  14437. var _a2;
  14438. const el = unrefElement(target);
  14439. if (((_a2 = window2.document.activeElement) == null ? void 0 : _a2.tagName) === "IFRAME" && !(el == null ? void 0 : el.contains(window2.document.activeElement)))
  14440. handler(event2);
  14441. })
  14442. ].filter(Boolean);
  14443. const stop = () => cleanup.forEach((fn2) => fn2());
  14444. return stop;
  14445. }
  14446. function useSupported(callback2, sync = false) {
  14447. const isSupported = ref();
  14448. const update = () => isSupported.value = Boolean(callback2());
  14449. update();
  14450. tryOnMounted(update, sync);
  14451. return isSupported;
  14452. }
  14453. const _global = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  14454. const globalKey = "__vueuse_ssr_handlers__";
  14455. _global[globalKey] = _global[globalKey] || {};
  14456. _global[globalKey];
  14457. var __getOwnPropSymbols$g = Object.getOwnPropertySymbols;
  14458. var __hasOwnProp$g = Object.prototype.hasOwnProperty;
  14459. var __propIsEnum$g = Object.prototype.propertyIsEnumerable;
  14460. var __objRest$2 = (source, exclude) => {
  14461. var target = {};
  14462. for (var prop in source)
  14463. if (__hasOwnProp$g.call(source, prop) && exclude.indexOf(prop) < 0)
  14464. target[prop] = source[prop];
  14465. if (source != null && __getOwnPropSymbols$g)
  14466. for (var prop of __getOwnPropSymbols$g(source)) {
  14467. if (exclude.indexOf(prop) < 0 && __propIsEnum$g.call(source, prop))
  14468. target[prop] = source[prop];
  14469. }
  14470. return target;
  14471. };
  14472. function useResizeObserver(target, callback2, options2 = {}) {
  14473. const _a2 = options2, { window: window2 = defaultWindow } = _a2, observerOptions = __objRest$2(_a2, ["window"]);
  14474. let observer;
  14475. const isSupported = useSupported(() => window2 && "ResizeObserver" in window2);
  14476. const cleanup = () => {
  14477. if (observer) {
  14478. observer.disconnect();
  14479. observer = void 0;
  14480. }
  14481. };
  14482. const stopWatch = watch(() => unrefElement(target), (el) => {
  14483. cleanup();
  14484. if (isSupported.value && window2 && el) {
  14485. observer = new ResizeObserver(callback2);
  14486. observer.observe(el, observerOptions);
  14487. }
  14488. }, { immediate: true, flush: "post" });
  14489. const stop = () => {
  14490. cleanup();
  14491. stopWatch();
  14492. };
  14493. tryOnScopeDispose(stop);
  14494. return {
  14495. isSupported,
  14496. stop
  14497. };
  14498. }
  14499. var SwipeDirection;
  14500. (function(SwipeDirection2) {
  14501. SwipeDirection2["UP"] = "UP";
  14502. SwipeDirection2["RIGHT"] = "RIGHT";
  14503. SwipeDirection2["DOWN"] = "DOWN";
  14504. SwipeDirection2["LEFT"] = "LEFT";
  14505. SwipeDirection2["NONE"] = "NONE";
  14506. })(SwipeDirection || (SwipeDirection = {}));
  14507. var __defProp2 = Object.defineProperty;
  14508. var __getOwnPropSymbols = Object.getOwnPropertySymbols;
  14509. var __hasOwnProp = Object.prototype.hasOwnProperty;
  14510. var __propIsEnum = Object.prototype.propertyIsEnumerable;
  14511. var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
  14512. var __spreadValues = (a, b) => {
  14513. for (var prop in b || (b = {}))
  14514. if (__hasOwnProp.call(b, prop))
  14515. __defNormalProp2(a, prop, b[prop]);
  14516. if (__getOwnPropSymbols)
  14517. for (var prop of __getOwnPropSymbols(b)) {
  14518. if (__propIsEnum.call(b, prop))
  14519. __defNormalProp2(a, prop, b[prop]);
  14520. }
  14521. return a;
  14522. };
  14523. const _TransitionPresets = {
  14524. easeInSine: [0.12, 0, 0.39, 0],
  14525. easeOutSine: [0.61, 1, 0.88, 1],
  14526. easeInOutSine: [0.37, 0, 0.63, 1],
  14527. easeInQuad: [0.11, 0, 0.5, 0],
  14528. easeOutQuad: [0.5, 1, 0.89, 1],
  14529. easeInOutQuad: [0.45, 0, 0.55, 1],
  14530. easeInCubic: [0.32, 0, 0.67, 0],
  14531. easeOutCubic: [0.33, 1, 0.68, 1],
  14532. easeInOutCubic: [0.65, 0, 0.35, 1],
  14533. easeInQuart: [0.5, 0, 0.75, 0],
  14534. easeOutQuart: [0.25, 1, 0.5, 1],
  14535. easeInOutQuart: [0.76, 0, 0.24, 1],
  14536. easeInQuint: [0.64, 0, 0.78, 0],
  14537. easeOutQuint: [0.22, 1, 0.36, 1],
  14538. easeInOutQuint: [0.83, 0, 0.17, 1],
  14539. easeInExpo: [0.7, 0, 0.84, 0],
  14540. easeOutExpo: [0.16, 1, 0.3, 1],
  14541. easeInOutExpo: [0.87, 0, 0.13, 1],
  14542. easeInCirc: [0.55, 0, 1, 0.45],
  14543. easeOutCirc: [0, 0.55, 0.45, 1],
  14544. easeInOutCirc: [0.85, 0, 0.15, 1],
  14545. easeInBack: [0.36, 0, 0.66, -0.56],
  14546. easeOutBack: [0.34, 1.56, 0.64, 1],
  14547. easeInOutBack: [0.68, -0.6, 0.32, 1.6]
  14548. };
  14549. __spreadValues({
  14550. linear: identity
  14551. }, _TransitionPresets);
  14552. const isFirefox = () => isClient && /firefox/i.test(window.navigator.userAgent);
  14553. const getClientXY = (event2) => {
  14554. let clientX;
  14555. let clientY;
  14556. if (event2.type === "touchend") {
  14557. clientY = event2.changedTouches[0].clientY;
  14558. clientX = event2.changedTouches[0].clientX;
  14559. } else if (event2.type.startsWith("touch")) {
  14560. clientY = event2.touches[0].clientY;
  14561. clientX = event2.touches[0].clientX;
  14562. } else {
  14563. clientY = event2.clientY;
  14564. clientX = event2.clientX;
  14565. }
  14566. return {
  14567. clientX,
  14568. clientY
  14569. };
  14570. };
  14571. const NOOP = () => {
  14572. };
  14573. const hasOwnProperty$9 = Object.prototype.hasOwnProperty;
  14574. const hasOwn = (val, key) => hasOwnProperty$9.call(val, key);
  14575. const isArray$2 = Array.isArray;
  14576. const isFunction$3 = (val) => typeof val === "function";
  14577. const isString = (val) => typeof val === "string";
  14578. const isObject$5 = (val) => val !== null && typeof val === "object";
  14579. const isPromise$2 = (val) => {
  14580. return isObject$5(val) && isFunction$3(val.then) && isFunction$3(val.catch);
  14581. };
  14582. const objectToString$1 = Object.prototype.toString;
  14583. const toTypeString = (value) => objectToString$1.call(value);
  14584. const toRawType = (value) => {
  14585. return toTypeString(value).slice(8, -1);
  14586. };
  14587. const cacheStringFunction = (fn2) => {
  14588. const cache = /* @__PURE__ */ Object.create(null);
  14589. return (str) => {
  14590. const hit = cache[str];
  14591. return hit || (cache[str] = fn2(str));
  14592. };
  14593. };
  14594. const camelizeRE = /-(\w)/g;
  14595. const camelize = cacheStringFunction((str) => {
  14596. return str.replace(camelizeRE, (_, c) => c ? c.toUpperCase() : "");
  14597. });
  14598. var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
  14599. var freeGlobal$1 = freeGlobal;
  14600. var freeSelf = typeof self == "object" && self && self.Object === Object && self;
  14601. var root = freeGlobal$1 || freeSelf || Function("return this")();
  14602. var root$1 = root;
  14603. var Symbol$1 = root$1.Symbol;
  14604. var Symbol$2 = Symbol$1;
  14605. var objectProto$b = Object.prototype;
  14606. var hasOwnProperty$8 = objectProto$b.hasOwnProperty;
  14607. var nativeObjectToString$1 = objectProto$b.toString;
  14608. var symToStringTag$1 = Symbol$2 ? Symbol$2.toStringTag : void 0;
  14609. function getRawTag(value) {
  14610. var isOwn = hasOwnProperty$8.call(value, symToStringTag$1), tag = value[symToStringTag$1];
  14611. try {
  14612. value[symToStringTag$1] = void 0;
  14613. var unmasked = true;
  14614. } catch (e) {
  14615. }
  14616. var result = nativeObjectToString$1.call(value);
  14617. if (unmasked) {
  14618. if (isOwn) {
  14619. value[symToStringTag$1] = tag;
  14620. } else {
  14621. delete value[symToStringTag$1];
  14622. }
  14623. }
  14624. return result;
  14625. }
  14626. var objectProto$a = Object.prototype;
  14627. var nativeObjectToString = objectProto$a.toString;
  14628. function objectToString(value) {
  14629. return nativeObjectToString.call(value);
  14630. }
  14631. var nullTag = "[object Null]", undefinedTag = "[object Undefined]";
  14632. var symToStringTag = Symbol$2 ? Symbol$2.toStringTag : void 0;
  14633. function baseGetTag(value) {
  14634. if (value == null) {
  14635. return value === void 0 ? undefinedTag : nullTag;
  14636. }
  14637. return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
  14638. }
  14639. function isObjectLike(value) {
  14640. return value != null && typeof value == "object";
  14641. }
  14642. var symbolTag$1 = "[object Symbol]";
  14643. function isSymbol(value) {
  14644. return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag$1;
  14645. }
  14646. function arrayMap(array, iteratee) {
  14647. var index2 = -1, length = array == null ? 0 : array.length, result = Array(length);
  14648. while (++index2 < length) {
  14649. result[index2] = iteratee(array[index2], index2, array);
  14650. }
  14651. return result;
  14652. }
  14653. var isArray = Array.isArray;
  14654. var isArray$1 = isArray;
  14655. var INFINITY$1 = 1 / 0;
  14656. var symbolProto$1 = Symbol$2 ? Symbol$2.prototype : void 0, symbolToString = symbolProto$1 ? symbolProto$1.toString : void 0;
  14657. function baseToString(value) {
  14658. if (typeof value == "string") {
  14659. return value;
  14660. }
  14661. if (isArray$1(value)) {
  14662. return arrayMap(value, baseToString) + "";
  14663. }
  14664. if (isSymbol(value)) {
  14665. return symbolToString ? symbolToString.call(value) : "";
  14666. }
  14667. var result = value + "";
  14668. return result == "0" && 1 / value == -INFINITY$1 ? "-0" : result;
  14669. }
  14670. var reWhitespace = /\s/;
  14671. function trimmedEndIndex(string) {
  14672. var index2 = string.length;
  14673. while (index2-- && reWhitespace.test(string.charAt(index2))) {
  14674. }
  14675. return index2;
  14676. }
  14677. var reTrimStart = /^\s+/;
  14678. function baseTrim(string) {
  14679. return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
  14680. }
  14681. function isObject$4(value) {
  14682. var type2 = typeof value;
  14683. return value != null && (type2 == "object" || type2 == "function");
  14684. }
  14685. var NAN = 0 / 0;
  14686. var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
  14687. var reIsBinary = /^0b[01]+$/i;
  14688. var reIsOctal = /^0o[0-7]+$/i;
  14689. var freeParseInt = parseInt;
  14690. function toNumber(value) {
  14691. if (typeof value == "number") {
  14692. return value;
  14693. }
  14694. if (isSymbol(value)) {
  14695. return NAN;
  14696. }
  14697. if (isObject$4(value)) {
  14698. var other = typeof value.valueOf == "function" ? value.valueOf() : value;
  14699. value = isObject$4(other) ? other + "" : other;
  14700. }
  14701. if (typeof value != "string") {
  14702. return value === 0 ? value : +value;
  14703. }
  14704. value = baseTrim(value);
  14705. var isBinary = reIsBinary.test(value);
  14706. return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
  14707. }
  14708. var asyncTag = "[object AsyncFunction]", funcTag$1 = "[object Function]", genTag = "[object GeneratorFunction]", proxyTag = "[object Proxy]";
  14709. function isFunction$2(value) {
  14710. if (!isObject$4(value)) {
  14711. return false;
  14712. }
  14713. var tag = baseGetTag(value);
  14714. return tag == funcTag$1 || tag == genTag || tag == asyncTag || tag == proxyTag;
  14715. }
  14716. var coreJsData = root$1["__core-js_shared__"];
  14717. var coreJsData$1 = coreJsData;
  14718. var maskSrcKey = function() {
  14719. var uid = /[^.]+$/.exec(coreJsData$1 && coreJsData$1.keys && coreJsData$1.keys.IE_PROTO || "");
  14720. return uid ? "Symbol(src)_1." + uid : "";
  14721. }();
  14722. function isMasked(func) {
  14723. return !!maskSrcKey && maskSrcKey in func;
  14724. }
  14725. var funcProto$1 = Function.prototype;
  14726. var funcToString$1 = funcProto$1.toString;
  14727. function toSource(func) {
  14728. if (func != null) {
  14729. try {
  14730. return funcToString$1.call(func);
  14731. } catch (e) {
  14732. }
  14733. try {
  14734. return func + "";
  14735. } catch (e) {
  14736. }
  14737. }
  14738. return "";
  14739. }
  14740. var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
  14741. var reIsHostCtor = /^\[object .+?Constructor\]$/;
  14742. var funcProto = Function.prototype, objectProto$9 = Object.prototype;
  14743. var funcToString = funcProto.toString;
  14744. var hasOwnProperty$7 = objectProto$9.hasOwnProperty;
  14745. var reIsNative = RegExp(
  14746. "^" + funcToString.call(hasOwnProperty$7).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
  14747. );
  14748. function baseIsNative(value) {
  14749. if (!isObject$4(value) || isMasked(value)) {
  14750. return false;
  14751. }
  14752. var pattern = isFunction$2(value) ? reIsNative : reIsHostCtor;
  14753. return pattern.test(toSource(value));
  14754. }
  14755. function getValue(object, key) {
  14756. return object == null ? void 0 : object[key];
  14757. }
  14758. function getNative(object, key) {
  14759. var value = getValue(object, key);
  14760. return baseIsNative(value) ? value : void 0;
  14761. }
  14762. var WeakMap$1 = getNative(root$1, "WeakMap");
  14763. var WeakMap$2 = WeakMap$1;
  14764. var MAX_SAFE_INTEGER$1 = 9007199254740991;
  14765. var reIsUint = /^(?:0|[1-9]\d*)$/;
  14766. function isIndex(value, length) {
  14767. var type2 = typeof value;
  14768. length = length == null ? MAX_SAFE_INTEGER$1 : length;
  14769. return !!length && (type2 == "number" || type2 != "symbol" && reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
  14770. }
  14771. function eq(value, other) {
  14772. return value === other || value !== value && other !== other;
  14773. }
  14774. var MAX_SAFE_INTEGER = 9007199254740991;
  14775. function isLength(value) {
  14776. return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
  14777. }
  14778. function isArrayLike(value) {
  14779. return value != null && isLength(value.length) && !isFunction$2(value);
  14780. }
  14781. var objectProto$8 = Object.prototype;
  14782. function isPrototype(value) {
  14783. var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto$8;
  14784. return value === proto;
  14785. }
  14786. function baseTimes(n, iteratee) {
  14787. var index2 = -1, result = Array(n);
  14788. while (++index2 < n) {
  14789. result[index2] = iteratee(index2);
  14790. }
  14791. return result;
  14792. }
  14793. var argsTag$2 = "[object Arguments]";
  14794. function baseIsArguments(value) {
  14795. return isObjectLike(value) && baseGetTag(value) == argsTag$2;
  14796. }
  14797. var objectProto$7 = Object.prototype;
  14798. var hasOwnProperty$6 = objectProto$7.hasOwnProperty;
  14799. var propertyIsEnumerable$1 = objectProto$7.propertyIsEnumerable;
  14800. var isArguments = baseIsArguments(function() {
  14801. return arguments;
  14802. }()) ? baseIsArguments : function(value) {
  14803. return isObjectLike(value) && hasOwnProperty$6.call(value, "callee") && !propertyIsEnumerable$1.call(value, "callee");
  14804. };
  14805. var isArguments$1 = isArguments;
  14806. function stubFalse() {
  14807. return false;
  14808. }
  14809. var freeExports$1 = typeof exports == "object" && exports && !exports.nodeType && exports;
  14810. var freeModule$1 = freeExports$1 && typeof module == "object" && module && !module.nodeType && module;
  14811. var moduleExports$1 = freeModule$1 && freeModule$1.exports === freeExports$1;
  14812. var Buffer$1 = moduleExports$1 ? root$1.Buffer : void 0;
  14813. var nativeIsBuffer = Buffer$1 ? Buffer$1.isBuffer : void 0;
  14814. var isBuffer = nativeIsBuffer || stubFalse;
  14815. var isBuffer$1 = isBuffer;
  14816. var argsTag$1 = "[object Arguments]", arrayTag$1 = "[object Array]", boolTag$1 = "[object Boolean]", dateTag$1 = "[object Date]", errorTag$1 = "[object Error]", funcTag = "[object Function]", mapTag$2 = "[object Map]", numberTag$1 = "[object Number]", objectTag$2 = "[object Object]", regexpTag$1 = "[object RegExp]", setTag$2 = "[object Set]", stringTag$1 = "[object String]", weakMapTag$1 = "[object WeakMap]";
  14817. var arrayBufferTag$1 = "[object ArrayBuffer]", dataViewTag$2 = "[object DataView]", float32Tag = "[object Float32Array]", float64Tag = "[object Float64Array]", int8Tag = "[object Int8Array]", int16Tag = "[object Int16Array]", int32Tag = "[object Int32Array]", uint8Tag = "[object Uint8Array]", uint8ClampedTag = "[object Uint8ClampedArray]", uint16Tag = "[object Uint16Array]", uint32Tag = "[object Uint32Array]";
  14818. var typedArrayTags = {};
  14819. typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
  14820. typedArrayTags[argsTag$1] = typedArrayTags[arrayTag$1] = typedArrayTags[arrayBufferTag$1] = typedArrayTags[boolTag$1] = typedArrayTags[dataViewTag$2] = typedArrayTags[dateTag$1] = typedArrayTags[errorTag$1] = typedArrayTags[funcTag] = typedArrayTags[mapTag$2] = typedArrayTags[numberTag$1] = typedArrayTags[objectTag$2] = typedArrayTags[regexpTag$1] = typedArrayTags[setTag$2] = typedArrayTags[stringTag$1] = typedArrayTags[weakMapTag$1] = false;
  14821. function baseIsTypedArray(value) {
  14822. return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
  14823. }
  14824. function baseUnary(func) {
  14825. return function(value) {
  14826. return func(value);
  14827. };
  14828. }
  14829. var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
  14830. var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
  14831. var moduleExports = freeModule && freeModule.exports === freeExports;
  14832. var freeProcess = moduleExports && freeGlobal$1.process;
  14833. var nodeUtil = function() {
  14834. try {
  14835. var types = freeModule && freeModule.require && freeModule.require("util").types;
  14836. if (types) {
  14837. return types;
  14838. }
  14839. return freeProcess && freeProcess.binding && freeProcess.binding("util");
  14840. } catch (e) {
  14841. }
  14842. }();
  14843. var nodeUtil$1 = nodeUtil;
  14844. var nodeIsTypedArray = nodeUtil$1 && nodeUtil$1.isTypedArray;
  14845. var isTypedArray$2 = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
  14846. var isTypedArray$3 = isTypedArray$2;
  14847. var objectProto$6 = Object.prototype;
  14848. var hasOwnProperty$5 = objectProto$6.hasOwnProperty;
  14849. function arrayLikeKeys(value, inherited) {
  14850. var isArr = isArray$1(value), isArg = !isArr && isArguments$1(value), isBuff = !isArr && !isArg && isBuffer$1(value), isType = !isArr && !isArg && !isBuff && isTypedArray$3(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
  14851. for (var key in value) {
  14852. if ((inherited || hasOwnProperty$5.call(value, key)) && !(skipIndexes && (key == "length" || isBuff && (key == "offset" || key == "parent") || isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || isIndex(key, length)))) {
  14853. result.push(key);
  14854. }
  14855. }
  14856. return result;
  14857. }
  14858. function overArg(func, transform3) {
  14859. return function(arg) {
  14860. return func(transform3(arg));
  14861. };
  14862. }
  14863. var nativeKeys = overArg(Object.keys, Object);
  14864. var nativeKeys$1 = nativeKeys;
  14865. var objectProto$5 = Object.prototype;
  14866. var hasOwnProperty$4 = objectProto$5.hasOwnProperty;
  14867. function baseKeys(object) {
  14868. if (!isPrototype(object)) {
  14869. return nativeKeys$1(object);
  14870. }
  14871. var result = [];
  14872. for (var key in Object(object)) {
  14873. if (hasOwnProperty$4.call(object, key) && key != "constructor") {
  14874. result.push(key);
  14875. }
  14876. }
  14877. return result;
  14878. }
  14879. function keys$2(object) {
  14880. return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
  14881. }
  14882. var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, reIsPlainProp = /^\w*$/;
  14883. function isKey(value, object) {
  14884. if (isArray$1(value)) {
  14885. return false;
  14886. }
  14887. var type2 = typeof value;
  14888. if (type2 == "number" || type2 == "symbol" || type2 == "boolean" || value == null || isSymbol(value)) {
  14889. return true;
  14890. }
  14891. return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
  14892. }
  14893. var nativeCreate = getNative(Object, "create");
  14894. var nativeCreate$1 = nativeCreate;
  14895. function hashClear() {
  14896. this.__data__ = nativeCreate$1 ? nativeCreate$1(null) : {};
  14897. this.size = 0;
  14898. }
  14899. function hashDelete(key) {
  14900. var result = this.has(key) && delete this.__data__[key];
  14901. this.size -= result ? 1 : 0;
  14902. return result;
  14903. }
  14904. var HASH_UNDEFINED$2 = "__lodash_hash_undefined__";
  14905. var objectProto$4 = Object.prototype;
  14906. var hasOwnProperty$3 = objectProto$4.hasOwnProperty;
  14907. function hashGet(key) {
  14908. var data = this.__data__;
  14909. if (nativeCreate$1) {
  14910. var result = data[key];
  14911. return result === HASH_UNDEFINED$2 ? void 0 : result;
  14912. }
  14913. return hasOwnProperty$3.call(data, key) ? data[key] : void 0;
  14914. }
  14915. var objectProto$3 = Object.prototype;
  14916. var hasOwnProperty$2 = objectProto$3.hasOwnProperty;
  14917. function hashHas(key) {
  14918. var data = this.__data__;
  14919. return nativeCreate$1 ? data[key] !== void 0 : hasOwnProperty$2.call(data, key);
  14920. }
  14921. var HASH_UNDEFINED$1 = "__lodash_hash_undefined__";
  14922. function hashSet(key, value) {
  14923. var data = this.__data__;
  14924. this.size += this.has(key) ? 0 : 1;
  14925. data[key] = nativeCreate$1 && value === void 0 ? HASH_UNDEFINED$1 : value;
  14926. return this;
  14927. }
  14928. function Hash(entries) {
  14929. var index2 = -1, length = entries == null ? 0 : entries.length;
  14930. this.clear();
  14931. while (++index2 < length) {
  14932. var entry = entries[index2];
  14933. this.set(entry[0], entry[1]);
  14934. }
  14935. }
  14936. Hash.prototype.clear = hashClear;
  14937. Hash.prototype["delete"] = hashDelete;
  14938. Hash.prototype.get = hashGet;
  14939. Hash.prototype.has = hashHas;
  14940. Hash.prototype.set = hashSet;
  14941. function listCacheClear() {
  14942. this.__data__ = [];
  14943. this.size = 0;
  14944. }
  14945. function assocIndexOf(array, key) {
  14946. var length = array.length;
  14947. while (length--) {
  14948. if (eq(array[length][0], key)) {
  14949. return length;
  14950. }
  14951. }
  14952. return -1;
  14953. }
  14954. var arrayProto = Array.prototype;
  14955. var splice = arrayProto.splice;
  14956. function listCacheDelete(key) {
  14957. var data = this.__data__, index2 = assocIndexOf(data, key);
  14958. if (index2 < 0) {
  14959. return false;
  14960. }
  14961. var lastIndex = data.length - 1;
  14962. if (index2 == lastIndex) {
  14963. data.pop();
  14964. } else {
  14965. splice.call(data, index2, 1);
  14966. }
  14967. --this.size;
  14968. return true;
  14969. }
  14970. function listCacheGet(key) {
  14971. var data = this.__data__, index2 = assocIndexOf(data, key);
  14972. return index2 < 0 ? void 0 : data[index2][1];
  14973. }
  14974. function listCacheHas(key) {
  14975. return assocIndexOf(this.__data__, key) > -1;
  14976. }
  14977. function listCacheSet(key, value) {
  14978. var data = this.__data__, index2 = assocIndexOf(data, key);
  14979. if (index2 < 0) {
  14980. ++this.size;
  14981. data.push([key, value]);
  14982. } else {
  14983. data[index2][1] = value;
  14984. }
  14985. return this;
  14986. }
  14987. function ListCache(entries) {
  14988. var index2 = -1, length = entries == null ? 0 : entries.length;
  14989. this.clear();
  14990. while (++index2 < length) {
  14991. var entry = entries[index2];
  14992. this.set(entry[0], entry[1]);
  14993. }
  14994. }
  14995. ListCache.prototype.clear = listCacheClear;
  14996. ListCache.prototype["delete"] = listCacheDelete;
  14997. ListCache.prototype.get = listCacheGet;
  14998. ListCache.prototype.has = listCacheHas;
  14999. ListCache.prototype.set = listCacheSet;
  15000. var Map$2 = getNative(root$1, "Map");
  15001. var Map$3 = Map$2;
  15002. function mapCacheClear() {
  15003. this.size = 0;
  15004. this.__data__ = {
  15005. "hash": new Hash(),
  15006. "map": new (Map$3 || ListCache)(),
  15007. "string": new Hash()
  15008. };
  15009. }
  15010. function isKeyable(value) {
  15011. var type2 = typeof value;
  15012. return type2 == "string" || type2 == "number" || type2 == "symbol" || type2 == "boolean" ? value !== "__proto__" : value === null;
  15013. }
  15014. function getMapData(map, key) {
  15015. var data = map.__data__;
  15016. return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
  15017. }
  15018. function mapCacheDelete(key) {
  15019. var result = getMapData(this, key)["delete"](key);
  15020. this.size -= result ? 1 : 0;
  15021. return result;
  15022. }
  15023. function mapCacheGet(key) {
  15024. return getMapData(this, key).get(key);
  15025. }
  15026. function mapCacheHas(key) {
  15027. return getMapData(this, key).has(key);
  15028. }
  15029. function mapCacheSet(key, value) {
  15030. var data = getMapData(this, key), size = data.size;
  15031. data.set(key, value);
  15032. this.size += data.size == size ? 0 : 1;
  15033. return this;
  15034. }
  15035. function MapCache(entries) {
  15036. var index2 = -1, length = entries == null ? 0 : entries.length;
  15037. this.clear();
  15038. while (++index2 < length) {
  15039. var entry = entries[index2];
  15040. this.set(entry[0], entry[1]);
  15041. }
  15042. }
  15043. MapCache.prototype.clear = mapCacheClear;
  15044. MapCache.prototype["delete"] = mapCacheDelete;
  15045. MapCache.prototype.get = mapCacheGet;
  15046. MapCache.prototype.has = mapCacheHas;
  15047. MapCache.prototype.set = mapCacheSet;
  15048. var FUNC_ERROR_TEXT$1 = "Expected a function";
  15049. function memoize(func, resolver) {
  15050. if (typeof func != "function" || resolver != null && typeof resolver != "function") {
  15051. throw new TypeError(FUNC_ERROR_TEXT$1);
  15052. }
  15053. var memoized = function() {
  15054. var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
  15055. if (cache.has(key)) {
  15056. return cache.get(key);
  15057. }
  15058. var result = func.apply(this, args);
  15059. memoized.cache = cache.set(key, result) || cache;
  15060. return result;
  15061. };
  15062. memoized.cache = new (memoize.Cache || MapCache)();
  15063. return memoized;
  15064. }
  15065. memoize.Cache = MapCache;
  15066. var MAX_MEMOIZE_SIZE = 500;
  15067. function memoizeCapped(func) {
  15068. var result = memoize(func, function(key) {
  15069. if (cache.size === MAX_MEMOIZE_SIZE) {
  15070. cache.clear();
  15071. }
  15072. return key;
  15073. });
  15074. var cache = result.cache;
  15075. return result;
  15076. }
  15077. var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
  15078. var reEscapeChar = /\\(\\)?/g;
  15079. var stringToPath = memoizeCapped(function(string) {
  15080. var result = [];
  15081. if (string.charCodeAt(0) === 46) {
  15082. result.push("");
  15083. }
  15084. string.replace(rePropName, function(match, number, quote, subString) {
  15085. result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
  15086. });
  15087. return result;
  15088. });
  15089. var stringToPath$1 = stringToPath;
  15090. function toString$3(value) {
  15091. return value == null ? "" : baseToString(value);
  15092. }
  15093. function castPath(value, object) {
  15094. if (isArray$1(value)) {
  15095. return value;
  15096. }
  15097. return isKey(value, object) ? [value] : stringToPath$1(toString$3(value));
  15098. }
  15099. var INFINITY = 1 / 0;
  15100. function toKey(value) {
  15101. if (typeof value == "string" || isSymbol(value)) {
  15102. return value;
  15103. }
  15104. var result = value + "";
  15105. return result == "0" && 1 / value == -INFINITY ? "-0" : result;
  15106. }
  15107. function baseGet(object, path) {
  15108. path = castPath(path, object);
  15109. var index2 = 0, length = path.length;
  15110. while (object != null && index2 < length) {
  15111. object = object[toKey(path[index2++])];
  15112. }
  15113. return index2 && index2 == length ? object : void 0;
  15114. }
  15115. function get$2(object, path, defaultValue2) {
  15116. var result = object == null ? void 0 : baseGet(object, path);
  15117. return result === void 0 ? defaultValue2 : result;
  15118. }
  15119. function arrayPush(array, values3) {
  15120. var index2 = -1, length = values3.length, offset = array.length;
  15121. while (++index2 < length) {
  15122. array[offset + index2] = values3[index2];
  15123. }
  15124. return array;
  15125. }
  15126. function castArray() {
  15127. if (!arguments.length) {
  15128. return [];
  15129. }
  15130. var value = arguments[0];
  15131. return isArray$1(value) ? value : [value];
  15132. }
  15133. function stackClear() {
  15134. this.__data__ = new ListCache();
  15135. this.size = 0;
  15136. }
  15137. function stackDelete(key) {
  15138. var data = this.__data__, result = data["delete"](key);
  15139. this.size = data.size;
  15140. return result;
  15141. }
  15142. function stackGet(key) {
  15143. return this.__data__.get(key);
  15144. }
  15145. function stackHas(key) {
  15146. return this.__data__.has(key);
  15147. }
  15148. var LARGE_ARRAY_SIZE = 200;
  15149. function stackSet(key, value) {
  15150. var data = this.__data__;
  15151. if (data instanceof ListCache) {
  15152. var pairs = data.__data__;
  15153. if (!Map$3 || pairs.length < LARGE_ARRAY_SIZE - 1) {
  15154. pairs.push([key, value]);
  15155. this.size = ++data.size;
  15156. return this;
  15157. }
  15158. data = this.__data__ = new MapCache(pairs);
  15159. }
  15160. data.set(key, value);
  15161. this.size = data.size;
  15162. return this;
  15163. }
  15164. function Stack(entries) {
  15165. var data = this.__data__ = new ListCache(entries);
  15166. this.size = data.size;
  15167. }
  15168. Stack.prototype.clear = stackClear;
  15169. Stack.prototype["delete"] = stackDelete;
  15170. Stack.prototype.get = stackGet;
  15171. Stack.prototype.has = stackHas;
  15172. Stack.prototype.set = stackSet;
  15173. function arrayFilter(array, predicate) {
  15174. var index2 = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
  15175. while (++index2 < length) {
  15176. var value = array[index2];
  15177. if (predicate(value, index2, array)) {
  15178. result[resIndex++] = value;
  15179. }
  15180. }
  15181. return result;
  15182. }
  15183. function stubArray() {
  15184. return [];
  15185. }
  15186. var objectProto$2 = Object.prototype;
  15187. var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
  15188. var nativeGetSymbols = Object.getOwnPropertySymbols;
  15189. var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
  15190. if (object == null) {
  15191. return [];
  15192. }
  15193. object = Object(object);
  15194. return arrayFilter(nativeGetSymbols(object), function(symbol) {
  15195. return propertyIsEnumerable.call(object, symbol);
  15196. });
  15197. };
  15198. var getSymbols$1 = getSymbols;
  15199. function baseGetAllKeys(object, keysFunc, symbolsFunc) {
  15200. var result = keysFunc(object);
  15201. return isArray$1(object) ? result : arrayPush(result, symbolsFunc(object));
  15202. }
  15203. function getAllKeys(object) {
  15204. return baseGetAllKeys(object, keys$2, getSymbols$1);
  15205. }
  15206. var DataView$1 = getNative(root$1, "DataView");
  15207. var DataView$2 = DataView$1;
  15208. var Promise$1 = getNative(root$1, "Promise");
  15209. var Promise$2 = Promise$1;
  15210. var Set$2 = getNative(root$1, "Set");
  15211. var Set$3 = Set$2;
  15212. var mapTag$1 = "[object Map]", objectTag$1 = "[object Object]", promiseTag = "[object Promise]", setTag$1 = "[object Set]", weakMapTag = "[object WeakMap]";
  15213. var dataViewTag$1 = "[object DataView]";
  15214. var dataViewCtorString = toSource(DataView$2), mapCtorString = toSource(Map$3), promiseCtorString = toSource(Promise$2), setCtorString = toSource(Set$3), weakMapCtorString = toSource(WeakMap$2);
  15215. var getTag = baseGetTag;
  15216. if (DataView$2 && getTag(new DataView$2(new ArrayBuffer(1))) != dataViewTag$1 || Map$3 && getTag(new Map$3()) != mapTag$1 || Promise$2 && getTag(Promise$2.resolve()) != promiseTag || Set$3 && getTag(new Set$3()) != setTag$1 || WeakMap$2 && getTag(new WeakMap$2()) != weakMapTag) {
  15217. getTag = function(value) {
  15218. var result = baseGetTag(value), Ctor = result == objectTag$1 ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
  15219. if (ctorString) {
  15220. switch (ctorString) {
  15221. case dataViewCtorString:
  15222. return dataViewTag$1;
  15223. case mapCtorString:
  15224. return mapTag$1;
  15225. case promiseCtorString:
  15226. return promiseTag;
  15227. case setCtorString:
  15228. return setTag$1;
  15229. case weakMapCtorString:
  15230. return weakMapTag;
  15231. }
  15232. }
  15233. return result;
  15234. };
  15235. }
  15236. var getTag$1 = getTag;
  15237. var Uint8Array$1 = root$1.Uint8Array;
  15238. var Uint8Array$2 = Uint8Array$1;
  15239. var HASH_UNDEFINED = "__lodash_hash_undefined__";
  15240. function setCacheAdd(value) {
  15241. this.__data__.set(value, HASH_UNDEFINED);
  15242. return this;
  15243. }
  15244. function setCacheHas(value) {
  15245. return this.__data__.has(value);
  15246. }
  15247. function SetCache(values3) {
  15248. var index2 = -1, length = values3 == null ? 0 : values3.length;
  15249. this.__data__ = new MapCache();
  15250. while (++index2 < length) {
  15251. this.add(values3[index2]);
  15252. }
  15253. }
  15254. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
  15255. SetCache.prototype.has = setCacheHas;
  15256. function arraySome(array, predicate) {
  15257. var index2 = -1, length = array == null ? 0 : array.length;
  15258. while (++index2 < length) {
  15259. if (predicate(array[index2], index2, array)) {
  15260. return true;
  15261. }
  15262. }
  15263. return false;
  15264. }
  15265. function cacheHas(cache, key) {
  15266. return cache.has(key);
  15267. }
  15268. var COMPARE_PARTIAL_FLAG$3 = 1, COMPARE_UNORDERED_FLAG$1 = 2;
  15269. function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
  15270. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$3, arrLength = array.length, othLength = other.length;
  15271. if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
  15272. return false;
  15273. }
  15274. var arrStacked = stack.get(array);
  15275. var othStacked = stack.get(other);
  15276. if (arrStacked && othStacked) {
  15277. return arrStacked == other && othStacked == array;
  15278. }
  15279. var index2 = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG$1 ? new SetCache() : void 0;
  15280. stack.set(array, other);
  15281. stack.set(other, array);
  15282. while (++index2 < arrLength) {
  15283. var arrValue = array[index2], othValue = other[index2];
  15284. if (customizer) {
  15285. var compared = isPartial ? customizer(othValue, arrValue, index2, other, array, stack) : customizer(arrValue, othValue, index2, array, other, stack);
  15286. }
  15287. if (compared !== void 0) {
  15288. if (compared) {
  15289. continue;
  15290. }
  15291. result = false;
  15292. break;
  15293. }
  15294. if (seen) {
  15295. if (!arraySome(other, function(othValue2, othIndex) {
  15296. if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
  15297. return seen.push(othIndex);
  15298. }
  15299. })) {
  15300. result = false;
  15301. break;
  15302. }
  15303. } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
  15304. result = false;
  15305. break;
  15306. }
  15307. }
  15308. stack["delete"](array);
  15309. stack["delete"](other);
  15310. return result;
  15311. }
  15312. function mapToArray(map) {
  15313. var index2 = -1, result = Array(map.size);
  15314. map.forEach(function(value, key) {
  15315. result[++index2] = [key, value];
  15316. });
  15317. return result;
  15318. }
  15319. function setToArray(set4) {
  15320. var index2 = -1, result = Array(set4.size);
  15321. set4.forEach(function(value) {
  15322. result[++index2] = value;
  15323. });
  15324. return result;
  15325. }
  15326. var COMPARE_PARTIAL_FLAG$2 = 1, COMPARE_UNORDERED_FLAG = 2;
  15327. var boolTag = "[object Boolean]", dateTag = "[object Date]", errorTag = "[object Error]", mapTag = "[object Map]", numberTag = "[object Number]", regexpTag = "[object RegExp]", setTag = "[object Set]", stringTag = "[object String]", symbolTag = "[object Symbol]";
  15328. var arrayBufferTag = "[object ArrayBuffer]", dataViewTag = "[object DataView]";
  15329. var symbolProto = Symbol$2 ? Symbol$2.prototype : void 0, symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
  15330. function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
  15331. switch (tag) {
  15332. case dataViewTag:
  15333. if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
  15334. return false;
  15335. }
  15336. object = object.buffer;
  15337. other = other.buffer;
  15338. case arrayBufferTag:
  15339. if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array$2(object), new Uint8Array$2(other))) {
  15340. return false;
  15341. }
  15342. return true;
  15343. case boolTag:
  15344. case dateTag:
  15345. case numberTag:
  15346. return eq(+object, +other);
  15347. case errorTag:
  15348. return object.name == other.name && object.message == other.message;
  15349. case regexpTag:
  15350. case stringTag:
  15351. return object == other + "";
  15352. case mapTag:
  15353. var convert = mapToArray;
  15354. case setTag:
  15355. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$2;
  15356. convert || (convert = setToArray);
  15357. if (object.size != other.size && !isPartial) {
  15358. return false;
  15359. }
  15360. var stacked = stack.get(object);
  15361. if (stacked) {
  15362. return stacked == other;
  15363. }
  15364. bitmask |= COMPARE_UNORDERED_FLAG;
  15365. stack.set(object, other);
  15366. var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
  15367. stack["delete"](object);
  15368. return result;
  15369. case symbolTag:
  15370. if (symbolValueOf) {
  15371. return symbolValueOf.call(object) == symbolValueOf.call(other);
  15372. }
  15373. }
  15374. return false;
  15375. }
  15376. var COMPARE_PARTIAL_FLAG$1 = 1;
  15377. var objectProto$1 = Object.prototype;
  15378. var hasOwnProperty$1 = objectProto$1.hasOwnProperty;
  15379. function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
  15380. var isPartial = bitmask & COMPARE_PARTIAL_FLAG$1, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
  15381. if (objLength != othLength && !isPartial) {
  15382. return false;
  15383. }
  15384. var index2 = objLength;
  15385. while (index2--) {
  15386. var key = objProps[index2];
  15387. if (!(isPartial ? key in other : hasOwnProperty$1.call(other, key))) {
  15388. return false;
  15389. }
  15390. }
  15391. var objStacked = stack.get(object);
  15392. var othStacked = stack.get(other);
  15393. if (objStacked && othStacked) {
  15394. return objStacked == other && othStacked == object;
  15395. }
  15396. var result = true;
  15397. stack.set(object, other);
  15398. stack.set(other, object);
  15399. var skipCtor = isPartial;
  15400. while (++index2 < objLength) {
  15401. key = objProps[index2];
  15402. var objValue = object[key], othValue = other[key];
  15403. if (customizer) {
  15404. var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
  15405. }
  15406. if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
  15407. result = false;
  15408. break;
  15409. }
  15410. skipCtor || (skipCtor = key == "constructor");
  15411. }
  15412. if (result && !skipCtor) {
  15413. var objCtor = object.constructor, othCtor = other.constructor;
  15414. if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
  15415. result = false;
  15416. }
  15417. }
  15418. stack["delete"](object);
  15419. stack["delete"](other);
  15420. return result;
  15421. }
  15422. var COMPARE_PARTIAL_FLAG = 1;
  15423. var argsTag = "[object Arguments]", arrayTag = "[object Array]", objectTag = "[object Object]";
  15424. var objectProto = Object.prototype;
  15425. var hasOwnProperty = objectProto.hasOwnProperty;
  15426. function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
  15427. var objIsArr = isArray$1(object), othIsArr = isArray$1(other), objTag = objIsArr ? arrayTag : getTag$1(object), othTag = othIsArr ? arrayTag : getTag$1(other);
  15428. objTag = objTag == argsTag ? objectTag : objTag;
  15429. othTag = othTag == argsTag ? objectTag : othTag;
  15430. var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
  15431. if (isSameTag && isBuffer$1(object)) {
  15432. if (!isBuffer$1(other)) {
  15433. return false;
  15434. }
  15435. objIsArr = true;
  15436. objIsObj = false;
  15437. }
  15438. if (isSameTag && !objIsObj) {
  15439. stack || (stack = new Stack());
  15440. return objIsArr || isTypedArray$3(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
  15441. }
  15442. if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
  15443. var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
  15444. if (objIsWrapped || othIsWrapped) {
  15445. var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
  15446. stack || (stack = new Stack());
  15447. return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
  15448. }
  15449. }
  15450. if (!isSameTag) {
  15451. return false;
  15452. }
  15453. stack || (stack = new Stack());
  15454. return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
  15455. }
  15456. function baseIsEqual(value, other, bitmask, customizer, stack) {
  15457. if (value === other) {
  15458. return true;
  15459. }
  15460. if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
  15461. return value !== value && other !== other;
  15462. }
  15463. return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
  15464. }
  15465. var now = function() {
  15466. return root$1.Date.now();
  15467. };
  15468. var now$1 = now;
  15469. var FUNC_ERROR_TEXT = "Expected a function";
  15470. var nativeMax = Math.max, nativeMin = Math.min;
  15471. function debounce$2(func, wait, options2) {
  15472. var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
  15473. if (typeof func != "function") {
  15474. throw new TypeError(FUNC_ERROR_TEXT);
  15475. }
  15476. wait = toNumber(wait) || 0;
  15477. if (isObject$4(options2)) {
  15478. leading = !!options2.leading;
  15479. maxing = "maxWait" in options2;
  15480. maxWait = maxing ? nativeMax(toNumber(options2.maxWait) || 0, wait) : maxWait;
  15481. trailing = "trailing" in options2 ? !!options2.trailing : trailing;
  15482. }
  15483. function invokeFunc(time) {
  15484. var args = lastArgs, thisArg = lastThis;
  15485. lastArgs = lastThis = void 0;
  15486. lastInvokeTime = time;
  15487. result = func.apply(thisArg, args);
  15488. return result;
  15489. }
  15490. function leadingEdge(time) {
  15491. lastInvokeTime = time;
  15492. timerId = setTimeout(timerExpired, wait);
  15493. return leading ? invokeFunc(time) : result;
  15494. }
  15495. function remainingWait(time) {
  15496. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
  15497. return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
  15498. }
  15499. function shouldInvoke(time) {
  15500. var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
  15501. return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
  15502. }
  15503. function timerExpired() {
  15504. var time = now$1();
  15505. if (shouldInvoke(time)) {
  15506. return trailingEdge(time);
  15507. }
  15508. timerId = setTimeout(timerExpired, remainingWait(time));
  15509. }
  15510. function trailingEdge(time) {
  15511. timerId = void 0;
  15512. if (trailing && lastArgs) {
  15513. return invokeFunc(time);
  15514. }
  15515. lastArgs = lastThis = void 0;
  15516. return result;
  15517. }
  15518. function cancel() {
  15519. if (timerId !== void 0) {
  15520. clearTimeout(timerId);
  15521. }
  15522. lastInvokeTime = 0;
  15523. lastArgs = lastCallTime = lastThis = timerId = void 0;
  15524. }
  15525. function flush() {
  15526. return timerId === void 0 ? result : trailingEdge(now$1());
  15527. }
  15528. function debounced() {
  15529. var time = now$1(), isInvoking = shouldInvoke(time);
  15530. lastArgs = arguments;
  15531. lastThis = this;
  15532. lastCallTime = time;
  15533. if (isInvoking) {
  15534. if (timerId === void 0) {
  15535. return leadingEdge(lastCallTime);
  15536. }
  15537. if (maxing) {
  15538. clearTimeout(timerId);
  15539. timerId = setTimeout(timerExpired, wait);
  15540. return invokeFunc(lastCallTime);
  15541. }
  15542. }
  15543. if (timerId === void 0) {
  15544. timerId = setTimeout(timerExpired, wait);
  15545. }
  15546. return result;
  15547. }
  15548. debounced.cancel = cancel;
  15549. debounced.flush = flush;
  15550. return debounced;
  15551. }
  15552. function fromPairs(pairs) {
  15553. var index2 = -1, length = pairs == null ? 0 : pairs.length, result = {};
  15554. while (++index2 < length) {
  15555. var pair = pairs[index2];
  15556. result[pair[0]] = pair[1];
  15557. }
  15558. return result;
  15559. }
  15560. function isEqual(value, other) {
  15561. return baseIsEqual(value, other);
  15562. }
  15563. function isNil(value) {
  15564. return value == null;
  15565. }
  15566. function isUndefined$1(value) {
  15567. return value === void 0;
  15568. }
  15569. const isUndefined = (val) => val === void 0;
  15570. const isBoolean = (val) => typeof val === "boolean";
  15571. const isNumber = (val) => typeof val === "number";
  15572. const isElement = (e) => {
  15573. if (typeof Element === "undefined")
  15574. return false;
  15575. return e instanceof Element;
  15576. };
  15577. const isStringNumber = (val) => {
  15578. if (!isString(val)) {
  15579. return false;
  15580. }
  15581. return !Number.isNaN(Number(val));
  15582. };
  15583. const escapeStringRegexp = (string = "") => string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
  15584. const keysOf = (arr) => Object.keys(arr);
  15585. class ElementPlusError extends Error {
  15586. constructor(m) {
  15587. super(m);
  15588. this.name = "ElementPlusError";
  15589. }
  15590. }
  15591. function throwError(scope, m) {
  15592. throw new ElementPlusError(`[${scope}] ${m}`);
  15593. }
  15594. function debugWarn(scope, message) {
  15595. }
  15596. const classNameToArray = (cls = "") => cls.split(" ").filter((item) => !!item.trim());
  15597. const hasClass$2 = (el, cls) => {
  15598. if (!el || !cls)
  15599. return false;
  15600. if (cls.includes(" "))
  15601. throw new Error("className should not contain space.");
  15602. return el.classList.contains(cls);
  15603. };
  15604. const addClass$2 = (el, cls) => {
  15605. if (!el || !cls.trim())
  15606. return;
  15607. el.classList.add(...classNameToArray(cls));
  15608. };
  15609. const removeClass$2 = (el, cls) => {
  15610. if (!el || !cls.trim())
  15611. return;
  15612. el.classList.remove(...classNameToArray(cls));
  15613. };
  15614. const getStyle = (element, styleName) => {
  15615. var _a2;
  15616. if (!isClient || !element || !styleName)
  15617. return "";
  15618. let key = camelize(styleName);
  15619. if (key === "float")
  15620. key = "cssFloat";
  15621. try {
  15622. const style = element.style[key];
  15623. if (style)
  15624. return style;
  15625. const computed2 = (_a2 = document.defaultView) == null ? void 0 : _a2.getComputedStyle(element, "");
  15626. return computed2 ? computed2[key] : "";
  15627. } catch (e) {
  15628. return element.style[key];
  15629. }
  15630. };
  15631. function addUnit(value, defaultUnit = "px") {
  15632. if (!value)
  15633. return "";
  15634. if (isNumber(value) || isStringNumber(value)) {
  15635. return `${value}${defaultUnit}`;
  15636. } else if (isString(value)) {
  15637. return value;
  15638. }
  15639. }
  15640. let scrollBarWidth;
  15641. const getScrollBarWidth = (namespace) => {
  15642. var _a2;
  15643. if (!isClient)
  15644. return 0;
  15645. if (scrollBarWidth !== void 0)
  15646. return scrollBarWidth;
  15647. const outer = document.createElement("div");
  15648. outer.className = `${namespace}-scrollbar__wrap`;
  15649. outer.style.visibility = "hidden";
  15650. outer.style.width = "100px";
  15651. outer.style.position = "absolute";
  15652. outer.style.top = "-9999px";
  15653. document.body.appendChild(outer);
  15654. const widthNoScroll = outer.offsetWidth;
  15655. outer.style.overflow = "scroll";
  15656. const inner = document.createElement("div");
  15657. inner.style.width = "100%";
  15658. outer.appendChild(inner);
  15659. const widthWithScroll = inner.offsetWidth;
  15660. (_a2 = outer.parentNode) == null ? void 0 : _a2.removeChild(outer);
  15661. scrollBarWidth = widthNoScroll - widthWithScroll;
  15662. return scrollBarWidth;
  15663. };
  15664. function scrollIntoView(container, selected) {
  15665. if (!isClient)
  15666. return;
  15667. if (!selected) {
  15668. container.scrollTop = 0;
  15669. return;
  15670. }
  15671. const offsetParents = [];
  15672. let pointer = selected.offsetParent;
  15673. while (pointer !== null && container !== pointer && container.contains(pointer)) {
  15674. offsetParents.push(pointer);
  15675. pointer = pointer.offsetParent;
  15676. }
  15677. const top = selected.offsetTop + offsetParents.reduce((prev, curr) => prev + curr.offsetTop, 0);
  15678. const bottom = top + selected.offsetHeight;
  15679. const viewRectTop = container.scrollTop;
  15680. const viewRectBottom = viewRectTop + container.clientHeight;
  15681. if (top < viewRectTop) {
  15682. container.scrollTop = top;
  15683. } else if (bottom > viewRectBottom) {
  15684. container.scrollTop = bottom - container.clientHeight;
  15685. }
  15686. }
  15687. /*! Element Plus Icons Vue v2.1.0 */
  15688. var export_helper_default = (sfc, props) => {
  15689. let target = sfc.__vccOpts || sfc;
  15690. for (let [key, val] of props)
  15691. target[key] = val;
  15692. return target;
  15693. };
  15694. var arrow_down_vue_vue_type_script_lang_default = {
  15695. name: "ArrowDown"
  15696. };
  15697. var _hoisted_16$2 = {
  15698. xmlns: "http://www.w3.org/2000/svg",
  15699. viewBox: "0 0 1024 1024"
  15700. }, _hoisted_26$2 = /* @__PURE__ */ createElementVNode(
  15701. "path",
  15702. {
  15703. fill: "currentColor",
  15704. d: "M831.872 340.864 512 652.672 192.128 340.864a30.592 30.592 0 0 0-42.752 0 29.12 29.12 0 0 0 0 41.6L489.664 714.24a32 32 0 0 0 44.672 0l340.288-331.712a29.12 29.12 0 0 0 0-41.728 30.592 30.592 0 0 0-42.752 0z"
  15705. },
  15706. null,
  15707. -1
  15708. ), _hoisted_36$2 = [
  15709. _hoisted_26$2
  15710. ];
  15711. function _sfc_render6(_ctx, _cache, $props, $setup, $data, $options) {
  15712. return openBlock(), createElementBlock("svg", _hoisted_16$2, _hoisted_36$2);
  15713. }
  15714. var arrow_down_default = /* @__PURE__ */ export_helper_default(arrow_down_vue_vue_type_script_lang_default, [["render", _sfc_render6], ["__file", "arrow-down.vue"]]);
  15715. var arrow_right_vue_vue_type_script_lang_default = {
  15716. name: "ArrowRight"
  15717. };
  15718. var _hoisted_110 = {
  15719. xmlns: "http://www.w3.org/2000/svg",
  15720. viewBox: "0 0 1024 1024"
  15721. }, _hoisted_210 = /* @__PURE__ */ createElementVNode(
  15722. "path",
  15723. {
  15724. fill: "currentColor",
  15725. d: "M340.864 149.312a30.592 30.592 0 0 0 0 42.752L652.736 512 340.864 831.872a30.592 30.592 0 0 0 0 42.752 29.12 29.12 0 0 0 41.728 0L714.24 534.336a32 32 0 0 0 0-44.672L382.592 149.376a29.12 29.12 0 0 0-41.728 0z"
  15726. },
  15727. null,
  15728. -1
  15729. ), _hoisted_310 = [
  15730. _hoisted_210
  15731. ];
  15732. function _sfc_render10(_ctx, _cache, $props, $setup, $data, $options) {
  15733. return openBlock(), createElementBlock("svg", _hoisted_110, _hoisted_310);
  15734. }
  15735. var arrow_right_default = /* @__PURE__ */ export_helper_default(arrow_right_vue_vue_type_script_lang_default, [["render", _sfc_render10], ["__file", "arrow-right.vue"]]);
  15736. var arrow_up_vue_vue_type_script_lang_default = {
  15737. name: "ArrowUp"
  15738. };
  15739. var _hoisted_112 = {
  15740. xmlns: "http://www.w3.org/2000/svg",
  15741. viewBox: "0 0 1024 1024"
  15742. }, _hoisted_212 = /* @__PURE__ */ createElementVNode(
  15743. "path",
  15744. {
  15745. fill: "currentColor",
  15746. d: "m488.832 344.32-339.84 356.672a32 32 0 0 0 0 44.16l.384.384a29.44 29.44 0 0 0 42.688 0l320-335.872 319.872 335.872a29.44 29.44 0 0 0 42.688 0l.384-.384a32 32 0 0 0 0-44.16L535.168 344.32a32 32 0 0 0-46.336 0z"
  15747. },
  15748. null,
  15749. -1
  15750. ), _hoisted_312 = [
  15751. _hoisted_212
  15752. ];
  15753. function _sfc_render12(_ctx, _cache, $props, $setup, $data, $options) {
  15754. return openBlock(), createElementBlock("svg", _hoisted_112, _hoisted_312);
  15755. }
  15756. var arrow_up_default = /* @__PURE__ */ export_helper_default(arrow_up_vue_vue_type_script_lang_default, [["render", _sfc_render12], ["__file", "arrow-up.vue"]]);
  15757. var circle_check_vue_vue_type_script_lang_default = {
  15758. name: "CircleCheck"
  15759. };
  15760. var _hoisted_149 = {
  15761. xmlns: "http://www.w3.org/2000/svg",
  15762. viewBox: "0 0 1024 1024"
  15763. }, _hoisted_249 = /* @__PURE__ */ createElementVNode(
  15764. "path",
  15765. {
  15766. fill: "currentColor",
  15767. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  15768. },
  15769. null,
  15770. -1
  15771. ), _hoisted_348 = /* @__PURE__ */ createElementVNode(
  15772. "path",
  15773. {
  15774. fill: "currentColor",
  15775. d: "M745.344 361.344a32 32 0 0 1 45.312 45.312l-288 288a32 32 0 0 1-45.312 0l-160-160a32 32 0 1 1 45.312-45.312L480 626.752l265.344-265.408z"
  15776. },
  15777. null,
  15778. -1
  15779. ), _hoisted_415 = [
  15780. _hoisted_249,
  15781. _hoisted_348
  15782. ];
  15783. function _sfc_render49(_ctx, _cache, $props, $setup, $data, $options) {
  15784. return openBlock(), createElementBlock("svg", _hoisted_149, _hoisted_415);
  15785. }
  15786. var circle_check_default = /* @__PURE__ */ export_helper_default(circle_check_vue_vue_type_script_lang_default, [["render", _sfc_render49], ["__file", "circle-check.vue"]]);
  15787. var circle_close_vue_vue_type_script_lang_default = {
  15788. name: "CircleClose"
  15789. };
  15790. var _hoisted_151 = {
  15791. xmlns: "http://www.w3.org/2000/svg",
  15792. viewBox: "0 0 1024 1024"
  15793. }, _hoisted_251 = /* @__PURE__ */ createElementVNode(
  15794. "path",
  15795. {
  15796. fill: "currentColor",
  15797. d: "m466.752 512-90.496-90.496a32 32 0 0 1 45.248-45.248L512 466.752l90.496-90.496a32 32 0 1 1 45.248 45.248L557.248 512l90.496 90.496a32 32 0 1 1-45.248 45.248L512 557.248l-90.496 90.496a32 32 0 0 1-45.248-45.248L466.752 512z"
  15798. },
  15799. null,
  15800. -1
  15801. ), _hoisted_350 = /* @__PURE__ */ createElementVNode(
  15802. "path",
  15803. {
  15804. fill: "currentColor",
  15805. d: "M512 896a384 384 0 1 0 0-768 384 384 0 0 0 0 768zm0 64a448 448 0 1 1 0-896 448 448 0 0 1 0 896z"
  15806. },
  15807. null,
  15808. -1
  15809. ), _hoisted_416 = [
  15810. _hoisted_251,
  15811. _hoisted_350
  15812. ];
  15813. function _sfc_render51(_ctx, _cache, $props, $setup, $data, $options) {
  15814. return openBlock(), createElementBlock("svg", _hoisted_151, _hoisted_416);
  15815. }
  15816. var circle_close_default = /* @__PURE__ */ export_helper_default(circle_close_vue_vue_type_script_lang_default, [["render", _sfc_render51], ["__file", "circle-close.vue"]]);
  15817. var close_vue_vue_type_script_lang_default = {
  15818. name: "Close"
  15819. };
  15820. var _hoisted_156 = {
  15821. xmlns: "http://www.w3.org/2000/svg",
  15822. viewBox: "0 0 1024 1024"
  15823. }, _hoisted_256 = /* @__PURE__ */ createElementVNode(
  15824. "path",
  15825. {
  15826. fill: "currentColor",
  15827. d: "M764.288 214.592 512 466.88 259.712 214.592a31.936 31.936 0 0 0-45.12 45.12L466.752 512 214.528 764.224a31.936 31.936 0 1 0 45.12 45.184L512 557.184l252.288 252.288a31.936 31.936 0 0 0 45.12-45.12L557.12 512.064l252.288-252.352a31.936 31.936 0 1 0-45.12-45.184z"
  15828. },
  15829. null,
  15830. -1
  15831. ), _hoisted_355 = [
  15832. _hoisted_256
  15833. ];
  15834. function _sfc_render56(_ctx, _cache, $props, $setup, $data, $options) {
  15835. return openBlock(), createElementBlock("svg", _hoisted_156, _hoisted_355);
  15836. }
  15837. var close_default = /* @__PURE__ */ export_helper_default(close_vue_vue_type_script_lang_default, [["render", _sfc_render56], ["__file", "close.vue"]]);
  15838. var delete_vue_vue_type_script_lang_default = {
  15839. name: "Delete"
  15840. };
  15841. var _hoisted_180 = {
  15842. xmlns: "http://www.w3.org/2000/svg",
  15843. viewBox: "0 0 1024 1024"
  15844. }, _hoisted_280 = /* @__PURE__ */ createElementVNode(
  15845. "path",
  15846. {
  15847. fill: "currentColor",
  15848. d: "M160 256H96a32 32 0 0 1 0-64h256V95.936a32 32 0 0 1 32-32h256a32 32 0 0 1 32 32V192h256a32 32 0 1 1 0 64h-64v672a32 32 0 0 1-32 32H192a32 32 0 0 1-32-32V256zm448-64v-64H416v64h192zM224 896h576V256H224v640zm192-128a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32zm192 0a32 32 0 0 1-32-32V416a32 32 0 0 1 64 0v320a32 32 0 0 1-32 32z"
  15849. },
  15850. null,
  15851. -1
  15852. ), _hoisted_379 = [
  15853. _hoisted_280
  15854. ];
  15855. function _sfc_render80(_ctx, _cache, $props, $setup, $data, $options) {
  15856. return openBlock(), createElementBlock("svg", _hoisted_180, _hoisted_379);
  15857. }
  15858. var delete_default = /* @__PURE__ */ export_helper_default(delete_vue_vue_type_script_lang_default, [["render", _sfc_render80], ["__file", "delete.vue"]]);
  15859. var edit_vue_vue_type_script_lang_default = {
  15860. name: "Edit"
  15861. };
  15862. var _hoisted_194 = {
  15863. xmlns: "http://www.w3.org/2000/svg",
  15864. viewBox: "0 0 1024 1024"
  15865. }, _hoisted_294 = /* @__PURE__ */ createElementVNode(
  15866. "path",
  15867. {
  15868. fill: "currentColor",
  15869. d: "M832 512a32 32 0 1 1 64 0v352a32 32 0 0 1-32 32H160a32 32 0 0 1-32-32V160a32 32 0 0 1 32-32h352a32 32 0 0 1 0 64H192v640h640V512z"
  15870. },
  15871. null,
  15872. -1
  15873. ), _hoisted_393 = /* @__PURE__ */ createElementVNode(
  15874. "path",
  15875. {
  15876. fill: "currentColor",
  15877. d: "m469.952 554.24 52.8-7.552L847.104 222.4a32 32 0 1 0-45.248-45.248L477.44 501.44l-7.552 52.8zm422.4-422.4a96 96 0 0 1 0 135.808l-331.84 331.84a32 32 0 0 1-18.112 9.088L436.8 623.68a32 32 0 0 1-36.224-36.224l15.104-105.6a32 32 0 0 1 9.024-18.112l331.904-331.84a96 96 0 0 1 135.744 0z"
  15878. },
  15879. null,
  15880. -1
  15881. ), _hoisted_431 = [
  15882. _hoisted_294,
  15883. _hoisted_393
  15884. ];
  15885. function _sfc_render94(_ctx, _cache, $props, $setup, $data, $options) {
  15886. return openBlock(), createElementBlock("svg", _hoisted_194, _hoisted_431);
  15887. }
  15888. var edit_default = /* @__PURE__ */ export_helper_default(edit_vue_vue_type_script_lang_default, [["render", _sfc_render94], ["__file", "edit.vue"]]);
  15889. var hide_vue_vue_type_script_lang_default = {
  15890. name: "Hide"
  15891. };
  15892. var _hoisted_1133 = {
  15893. xmlns: "http://www.w3.org/2000/svg",
  15894. viewBox: "0 0 1024 1024"
  15895. }, _hoisted_2133 = /* @__PURE__ */ createElementVNode(
  15896. "path",
  15897. {
  15898. fill: "currentColor",
  15899. d: "M876.8 156.8c0-9.6-3.2-16-9.6-22.4-6.4-6.4-12.8-9.6-22.4-9.6-9.6 0-16 3.2-22.4 9.6L736 220.8c-64-32-137.6-51.2-224-60.8-160 16-288 73.6-377.6 176C44.8 438.4 0 496 0 512s48 73.6 134.4 176c22.4 25.6 44.8 48 73.6 67.2l-86.4 89.6c-6.4 6.4-9.6 12.8-9.6 22.4 0 9.6 3.2 16 9.6 22.4 6.4 6.4 12.8 9.6 22.4 9.6 9.6 0 16-3.2 22.4-9.6l704-710.4c3.2-6.4 6.4-12.8 6.4-22.4Zm-646.4 528c-76.8-70.4-128-128-153.6-172.8 28.8-48 80-105.6 153.6-172.8C304 272 400 230.4 512 224c64 3.2 124.8 19.2 176 44.8l-54.4 54.4C598.4 300.8 560 288 512 288c-64 0-115.2 22.4-160 64s-64 96-64 160c0 48 12.8 89.6 35.2 124.8L256 707.2c-9.6-6.4-19.2-16-25.6-22.4Zm140.8-96c-12.8-22.4-19.2-48-19.2-76.8 0-44.8 16-83.2 48-112 32-28.8 67.2-48 112-48 28.8 0 54.4 6.4 73.6 19.2L371.2 588.8ZM889.599 336c-12.8-16-28.8-28.8-41.6-41.6l-48 48c73.6 67.2 124.8 124.8 150.4 169.6-28.8 48-80 105.6-153.6 172.8-73.6 67.2-172.8 108.8-284.8 115.2-51.2-3.2-99.2-12.8-140.8-28.8l-48 48c57.6 22.4 118.4 38.4 188.8 44.8 160-16 288-73.6 377.6-176C979.199 585.6 1024 528 1024 512s-48.001-73.6-134.401-176Z"
  15900. },
  15901. null,
  15902. -1
  15903. ), _hoisted_3132 = /* @__PURE__ */ createElementVNode(
  15904. "path",
  15905. {
  15906. fill: "currentColor",
  15907. d: "M511.998 672c-12.8 0-25.6-3.2-38.4-6.4l-51.2 51.2c28.8 12.8 57.6 19.2 89.6 19.2 64 0 115.2-22.4 160-64 41.6-41.6 64-96 64-160 0-32-6.4-64-19.2-89.6l-51.2 51.2c3.2 12.8 6.4 25.6 6.4 38.4 0 44.8-16 83.2-48 112-32 28.8-67.2 48-112 48Z"
  15908. },
  15909. null,
  15910. -1
  15911. ), _hoisted_438 = [
  15912. _hoisted_2133,
  15913. _hoisted_3132
  15914. ];
  15915. function _sfc_render133(_ctx, _cache, $props, $setup, $data, $options) {
  15916. return openBlock(), createElementBlock("svg", _hoisted_1133, _hoisted_438);
  15917. }
  15918. var hide_default = /* @__PURE__ */ export_helper_default(hide_vue_vue_type_script_lang_default, [["render", _sfc_render133], ["__file", "hide.vue"]]);
  15919. var loading_vue_vue_type_script_lang_default = {
  15920. name: "Loading"
  15921. };
  15922. var _hoisted_1150 = {
  15923. xmlns: "http://www.w3.org/2000/svg",
  15924. viewBox: "0 0 1024 1024"
  15925. }, _hoisted_2150 = /* @__PURE__ */ createElementVNode(
  15926. "path",
  15927. {
  15928. fill: "currentColor",
  15929. d: "M512 64a32 32 0 0 1 32 32v192a32 32 0 0 1-64 0V96a32 32 0 0 1 32-32zm0 640a32 32 0 0 1 32 32v192a32 32 0 1 1-64 0V736a32 32 0 0 1 32-32zm448-192a32 32 0 0 1-32 32H736a32 32 0 1 1 0-64h192a32 32 0 0 1 32 32zm-640 0a32 32 0 0 1-32 32H96a32 32 0 0 1 0-64h192a32 32 0 0 1 32 32zM195.2 195.2a32 32 0 0 1 45.248 0L376.32 331.008a32 32 0 0 1-45.248 45.248L195.2 240.448a32 32 0 0 1 0-45.248zm452.544 452.544a32 32 0 0 1 45.248 0L828.8 783.552a32 32 0 0 1-45.248 45.248L647.744 692.992a32 32 0 0 1 0-45.248zM828.8 195.264a32 32 0 0 1 0 45.184L692.992 376.32a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0zm-452.544 452.48a32 32 0 0 1 0 45.248L240.448 828.8a32 32 0 0 1-45.248-45.248l135.808-135.808a32 32 0 0 1 45.248 0z"
  15930. },
  15931. null,
  15932. -1
  15933. ), _hoisted_3149 = [
  15934. _hoisted_2150
  15935. ];
  15936. function _sfc_render150(_ctx, _cache, $props, $setup, $data, $options) {
  15937. return openBlock(), createElementBlock("svg", _hoisted_1150, _hoisted_3149);
  15938. }
  15939. var loading_default = /* @__PURE__ */ export_helper_default(loading_vue_vue_type_script_lang_default, [["render", _sfc_render150], ["__file", "loading.vue"]]);
  15940. var minus_vue_vue_type_script_lang_default = {
  15941. name: "Minus"
  15942. };
  15943. var _hoisted_1169 = {
  15944. xmlns: "http://www.w3.org/2000/svg",
  15945. viewBox: "0 0 1024 1024"
  15946. }, _hoisted_2169 = /* @__PURE__ */ createElementVNode(
  15947. "path",
  15948. {
  15949. fill: "currentColor",
  15950. d: "M128 544h768a32 32 0 1 0 0-64H128a32 32 0 0 0 0 64z"
  15951. },
  15952. null,
  15953. -1
  15954. ), _hoisted_3168 = [
  15955. _hoisted_2169
  15956. ];
  15957. function _sfc_render169(_ctx, _cache, $props, $setup, $data, $options) {
  15958. return openBlock(), createElementBlock("svg", _hoisted_1169, _hoisted_3168);
  15959. }
  15960. var minus_default = /* @__PURE__ */ export_helper_default(minus_vue_vue_type_script_lang_default, [["render", _sfc_render169], ["__file", "minus.vue"]]);
  15961. var plus_vue_vue_type_script_lang_default = {
  15962. name: "Plus"
  15963. };
  15964. var _hoisted_1201 = {
  15965. xmlns: "http://www.w3.org/2000/svg",
  15966. viewBox: "0 0 1024 1024"
  15967. }, _hoisted_2201 = /* @__PURE__ */ createElementVNode(
  15968. "path",
  15969. {
  15970. fill: "currentColor",
  15971. d: "M480 480V128a32 32 0 0 1 64 0v352h352a32 32 0 1 1 0 64H544v352a32 32 0 1 1-64 0V544H128a32 32 0 0 1 0-64h352z"
  15972. },
  15973. null,
  15974. -1
  15975. ), _hoisted_3200 = [
  15976. _hoisted_2201
  15977. ];
  15978. function _sfc_render201(_ctx, _cache, $props, $setup, $data, $options) {
  15979. return openBlock(), createElementBlock("svg", _hoisted_1201, _hoisted_3200);
  15980. }
  15981. var plus_default = /* @__PURE__ */ export_helper_default(plus_vue_vue_type_script_lang_default, [["render", _sfc_render201], ["__file", "plus.vue"]]);
  15982. var setting_vue_vue_type_script_lang_default = {
  15983. name: "Setting"
  15984. };
  15985. var _hoisted_1231 = {
  15986. xmlns: "http://www.w3.org/2000/svg",
  15987. viewBox: "0 0 1024 1024"
  15988. }, _hoisted_2231 = /* @__PURE__ */ createElementVNode(
  15989. "path",
  15990. {
  15991. fill: "currentColor",
  15992. d: "M600.704 64a32 32 0 0 1 30.464 22.208l35.2 109.376c14.784 7.232 28.928 15.36 42.432 24.512l112.384-24.192a32 32 0 0 1 34.432 15.36L944.32 364.8a32 32 0 0 1-4.032 37.504l-77.12 85.12a357.12 357.12 0 0 1 0 49.024l77.12 85.248a32 32 0 0 1 4.032 37.504l-88.704 153.6a32 32 0 0 1-34.432 15.296L708.8 803.904c-13.44 9.088-27.648 17.28-42.368 24.512l-35.264 109.376A32 32 0 0 1 600.704 960H423.296a32 32 0 0 1-30.464-22.208L357.696 828.48a351.616 351.616 0 0 1-42.56-24.64l-112.32 24.256a32 32 0 0 1-34.432-15.36L79.68 659.2a32 32 0 0 1 4.032-37.504l77.12-85.248a357.12 357.12 0 0 1 0-48.896l-77.12-85.248A32 32 0 0 1 79.68 364.8l88.704-153.6a32 32 0 0 1 34.432-15.296l112.32 24.256c13.568-9.152 27.776-17.408 42.56-24.64l35.2-109.312A32 32 0 0 1 423.232 64H600.64zm-23.424 64H446.72l-36.352 113.088-24.512 11.968a294.113 294.113 0 0 0-34.816 20.096l-22.656 15.36-116.224-25.088-65.28 113.152 79.68 88.192-1.92 27.136a293.12 293.12 0 0 0 0 40.192l1.92 27.136-79.808 88.192 65.344 113.152 116.224-25.024 22.656 15.296a294.113 294.113 0 0 0 34.816 20.096l24.512 11.968L446.72 896h130.688l36.48-113.152 24.448-11.904a288.282 288.282 0 0 0 34.752-20.096l22.592-15.296 116.288 25.024 65.28-113.152-79.744-88.192 1.92-27.136a293.12 293.12 0 0 0 0-40.256l-1.92-27.136 79.808-88.128-65.344-113.152-116.288 24.96-22.592-15.232a287.616 287.616 0 0 0-34.752-20.096l-24.448-11.904L577.344 128zM512 320a192 192 0 1 1 0 384 192 192 0 0 1 0-384zm0 64a128 128 0 1 0 0 256 128 128 0 0 0 0-256z"
  15993. },
  15994. null,
  15995. -1
  15996. ), _hoisted_3230 = [
  15997. _hoisted_2231
  15998. ];
  15999. function _sfc_render231(_ctx, _cache, $props, $setup, $data, $options) {
  16000. return openBlock(), createElementBlock("svg", _hoisted_1231, _hoisted_3230);
  16001. }
  16002. var setting_default = /* @__PURE__ */ export_helper_default(setting_vue_vue_type_script_lang_default, [["render", _sfc_render231], ["__file", "setting.vue"]]);
  16003. var view_vue_vue_type_script_lang_default = {
  16004. name: "View"
  16005. };
  16006. var _hoisted_1283 = {
  16007. xmlns: "http://www.w3.org/2000/svg",
  16008. viewBox: "0 0 1024 1024"
  16009. }, _hoisted_2283 = /* @__PURE__ */ createElementVNode(
  16010. "path",
  16011. {
  16012. fill: "currentColor",
  16013. d: "M512 160c320 0 512 352 512 352S832 864 512 864 0 512 0 512s192-352 512-352zm0 64c-225.28 0-384.128 208.064-436.8 288 52.608 79.872 211.456 288 436.8 288 225.28 0 384.128-208.064 436.8-288-52.608-79.872-211.456-288-436.8-288zm0 64a224 224 0 1 1 0 448 224 224 0 0 1 0-448zm0 64a160.192 160.192 0 0 0-160 160c0 88.192 71.744 160 160 160s160-71.808 160-160-71.744-160-160-160z"
  16014. },
  16015. null,
  16016. -1
  16017. ), _hoisted_3282 = [
  16018. _hoisted_2283
  16019. ];
  16020. function _sfc_render283(_ctx, _cache, $props, $setup, $data, $options) {
  16021. return openBlock(), createElementBlock("svg", _hoisted_1283, _hoisted_3282);
  16022. }
  16023. var view_default = /* @__PURE__ */ export_helper_default(view_vue_vue_type_script_lang_default, [["render", _sfc_render283], ["__file", "view.vue"]]);
  16024. const epPropKey = "__epPropKey";
  16025. const definePropType = (val) => val;
  16026. const isEpProp = (val) => isObject$5(val) && !!val[epPropKey];
  16027. const buildProp = (prop, key) => {
  16028. if (!isObject$5(prop) || isEpProp(prop))
  16029. return prop;
  16030. const { values: values3, required, default: defaultValue2, type: type2, validator } = prop;
  16031. const _validator = values3 || validator ? (val) => {
  16032. let valid = false;
  16033. let allowedValues = [];
  16034. if (values3) {
  16035. allowedValues = Array.from(values3);
  16036. if (hasOwn(prop, "default")) {
  16037. allowedValues.push(defaultValue2);
  16038. }
  16039. valid || (valid = allowedValues.includes(val));
  16040. }
  16041. if (validator)
  16042. valid || (valid = validator(val));
  16043. if (!valid && allowedValues.length > 0) {
  16044. const allowValuesText = [...new Set(allowedValues)].map((value) => JSON.stringify(value)).join(", ");
  16045. warn(`Invalid prop: validation failed${key ? ` for prop "${key}"` : ""}. Expected one of [${allowValuesText}], got value ${JSON.stringify(val)}.`);
  16046. }
  16047. return valid;
  16048. } : void 0;
  16049. const epProp = {
  16050. type: type2,
  16051. required: !!required,
  16052. validator: _validator,
  16053. [epPropKey]: true
  16054. };
  16055. if (hasOwn(prop, "default"))
  16056. epProp.default = defaultValue2;
  16057. return epProp;
  16058. };
  16059. const buildProps = (props) => fromPairs(Object.entries(props).map(([key, option]) => [
  16060. key,
  16061. buildProp(option, key)
  16062. ]));
  16063. const iconPropType = definePropType([
  16064. String,
  16065. Object,
  16066. Function
  16067. ]);
  16068. const CloseComponents = {
  16069. Close: close_default
  16070. };
  16071. const ValidateComponentsMap = {
  16072. validating: loading_default,
  16073. success: circle_check_default,
  16074. error: circle_close_default
  16075. };
  16076. const withInstall = (main, extra) => {
  16077. main.install = (app) => {
  16078. for (const comp of [main, ...Object.values(extra != null ? extra : {})]) {
  16079. app.component(comp.name, comp);
  16080. }
  16081. };
  16082. if (extra) {
  16083. for (const [key, comp] of Object.entries(extra)) {
  16084. main[key] = comp;
  16085. }
  16086. }
  16087. return main;
  16088. };
  16089. const withNoopInstall = (component) => {
  16090. component.install = NOOP;
  16091. return component;
  16092. };
  16093. const composeRefs = (...refs) => {
  16094. return (el) => {
  16095. refs.forEach((ref2) => {
  16096. if (isFunction$3(ref2)) {
  16097. ref2(el);
  16098. } else {
  16099. ref2.value = el;
  16100. }
  16101. });
  16102. };
  16103. };
  16104. const EVENT_CODE = {
  16105. tab: "Tab",
  16106. enter: "Enter",
  16107. space: "Space",
  16108. left: "ArrowLeft",
  16109. up: "ArrowUp",
  16110. right: "ArrowRight",
  16111. down: "ArrowDown",
  16112. esc: "Escape",
  16113. delete: "Delete",
  16114. backspace: "Backspace",
  16115. numpadEnter: "NumpadEnter",
  16116. pageUp: "PageUp",
  16117. pageDown: "PageDown",
  16118. home: "Home",
  16119. end: "End"
  16120. };
  16121. const UPDATE_MODEL_EVENT = "update:modelValue";
  16122. const CHANGE_EVENT = "change";
  16123. const INPUT_EVENT = "input";
  16124. const componentSizes = ["", "default", "small", "large"];
  16125. const componentSizeMap = {
  16126. large: 40,
  16127. default: 32,
  16128. small: 24
  16129. };
  16130. const getComponentSize = (size) => {
  16131. return componentSizeMap[size || "default"];
  16132. };
  16133. const isValidComponentSize = (val) => ["", ...componentSizes].includes(val);
  16134. var PatchFlags = /* @__PURE__ */ ((PatchFlags2) => {
  16135. PatchFlags2[PatchFlags2["TEXT"] = 1] = "TEXT";
  16136. PatchFlags2[PatchFlags2["CLASS"] = 2] = "CLASS";
  16137. PatchFlags2[PatchFlags2["STYLE"] = 4] = "STYLE";
  16138. PatchFlags2[PatchFlags2["PROPS"] = 8] = "PROPS";
  16139. PatchFlags2[PatchFlags2["FULL_PROPS"] = 16] = "FULL_PROPS";
  16140. PatchFlags2[PatchFlags2["HYDRATE_EVENTS"] = 32] = "HYDRATE_EVENTS";
  16141. PatchFlags2[PatchFlags2["STABLE_FRAGMENT"] = 64] = "STABLE_FRAGMENT";
  16142. PatchFlags2[PatchFlags2["KEYED_FRAGMENT"] = 128] = "KEYED_FRAGMENT";
  16143. PatchFlags2[PatchFlags2["UNKEYED_FRAGMENT"] = 256] = "UNKEYED_FRAGMENT";
  16144. PatchFlags2[PatchFlags2["NEED_PATCH"] = 512] = "NEED_PATCH";
  16145. PatchFlags2[PatchFlags2["DYNAMIC_SLOTS"] = 1024] = "DYNAMIC_SLOTS";
  16146. PatchFlags2[PatchFlags2["HOISTED"] = -1] = "HOISTED";
  16147. PatchFlags2[PatchFlags2["BAIL"] = -2] = "BAIL";
  16148. return PatchFlags2;
  16149. })(PatchFlags || {});
  16150. const isKorean = (text) => /([\uAC00-\uD7AF\u3130-\u318F])+/gi.test(text);
  16151. const generateId = () => Math.floor(Math.random() * 1e4);
  16152. const mutable = (val) => val;
  16153. const DEFAULT_EXCLUDE_KEYS = ["class", "style"];
  16154. const LISTENER_PREFIX = /^on[A-Z]/;
  16155. const useAttrs = (params = {}) => {
  16156. const { excludeListeners = false, excludeKeys } = params;
  16157. const allExcludeKeys = computed$1(() => {
  16158. return ((excludeKeys == null ? void 0 : excludeKeys.value) || []).concat(DEFAULT_EXCLUDE_KEYS);
  16159. });
  16160. const instance = getCurrentInstance();
  16161. if (!instance) {
  16162. return computed$1(() => ({}));
  16163. }
  16164. return computed$1(() => {
  16165. var _a2;
  16166. return fromPairs(Object.entries((_a2 = instance.proxy) == null ? void 0 : _a2.$attrs).filter(([key]) => !allExcludeKeys.value.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))));
  16167. });
  16168. };
  16169. const useDeprecated = ({ from: from3, replacement, scope, version: version2, ref: ref2, type: type2 = "API" }, condition) => {
  16170. watch(() => unref(condition), (val) => {
  16171. }, {
  16172. immediate: true
  16173. });
  16174. };
  16175. const useDraggable = (targetRef, dragRef, draggable2) => {
  16176. let transform3 = {
  16177. offsetX: 0,
  16178. offsetY: 0
  16179. };
  16180. const onMousedown = (e) => {
  16181. const downX = e.clientX;
  16182. const downY = e.clientY;
  16183. const { offsetX, offsetY } = transform3;
  16184. const targetRect = targetRef.value.getBoundingClientRect();
  16185. const targetLeft = targetRect.left;
  16186. const targetTop = targetRect.top;
  16187. const targetWidth = targetRect.width;
  16188. const targetHeight = targetRect.height;
  16189. const clientWidth = document.documentElement.clientWidth;
  16190. const clientHeight = document.documentElement.clientHeight;
  16191. const minLeft = -targetLeft + offsetX;
  16192. const minTop = -targetTop + offsetY;
  16193. const maxLeft = clientWidth - targetLeft - targetWidth + offsetX;
  16194. const maxTop = clientHeight - targetTop - targetHeight + offsetY;
  16195. const onMousemove = (e2) => {
  16196. const moveX = Math.min(Math.max(offsetX + e2.clientX - downX, minLeft), maxLeft);
  16197. const moveY = Math.min(Math.max(offsetY + e2.clientY - downY, minTop), maxTop);
  16198. transform3 = {
  16199. offsetX: moveX,
  16200. offsetY: moveY
  16201. };
  16202. targetRef.value.style.transform = `translate(${addUnit(moveX)}, ${addUnit(moveY)})`;
  16203. };
  16204. const onMouseup = () => {
  16205. document.removeEventListener("mousemove", onMousemove);
  16206. document.removeEventListener("mouseup", onMouseup);
  16207. };
  16208. document.addEventListener("mousemove", onMousemove);
  16209. document.addEventListener("mouseup", onMouseup);
  16210. };
  16211. const onDraggable = () => {
  16212. if (dragRef.value && targetRef.value) {
  16213. dragRef.value.addEventListener("mousedown", onMousedown);
  16214. }
  16215. };
  16216. const offDraggable = () => {
  16217. if (dragRef.value && targetRef.value) {
  16218. dragRef.value.removeEventListener("mousedown", onMousedown);
  16219. }
  16220. };
  16221. onMounted(() => {
  16222. watchEffect(() => {
  16223. if (draggable2.value) {
  16224. onDraggable();
  16225. } else {
  16226. offDraggable();
  16227. }
  16228. });
  16229. });
  16230. onBeforeUnmount(() => {
  16231. offDraggable();
  16232. });
  16233. };
  16234. const useFocus = (el) => {
  16235. return {
  16236. focus: () => {
  16237. var _a2, _b;
  16238. (_b = (_a2 = el.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  16239. }
  16240. };
  16241. };
  16242. var English = {
  16243. name: "en",
  16244. el: {
  16245. colorpicker: {
  16246. confirm: "OK",
  16247. clear: "Clear",
  16248. defaultLabel: "color picker",
  16249. description: "current color is {color}. press enter to select a new color."
  16250. },
  16251. datepicker: {
  16252. now: "Now",
  16253. today: "Today",
  16254. cancel: "Cancel",
  16255. clear: "Clear",
  16256. confirm: "OK",
  16257. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  16258. monthTablePrompt: "Use the arrow keys and enter to select the month",
  16259. yearTablePrompt: "Use the arrow keys and enter to select the year",
  16260. selectedDate: "Selected date",
  16261. selectDate: "Select date",
  16262. selectTime: "Select time",
  16263. startDate: "Start Date",
  16264. startTime: "Start Time",
  16265. endDate: "End Date",
  16266. endTime: "End Time",
  16267. prevYear: "Previous Year",
  16268. nextYear: "Next Year",
  16269. prevMonth: "Previous Month",
  16270. nextMonth: "Next Month",
  16271. year: "",
  16272. month1: "January",
  16273. month2: "February",
  16274. month3: "March",
  16275. month4: "April",
  16276. month5: "May",
  16277. month6: "June",
  16278. month7: "July",
  16279. month8: "August",
  16280. month9: "September",
  16281. month10: "October",
  16282. month11: "November",
  16283. month12: "December",
  16284. week: "week",
  16285. weeks: {
  16286. sun: "Sun",
  16287. mon: "Mon",
  16288. tue: "Tue",
  16289. wed: "Wed",
  16290. thu: "Thu",
  16291. fri: "Fri",
  16292. sat: "Sat"
  16293. },
  16294. weeksFull: {
  16295. sun: "Sunday",
  16296. mon: "Monday",
  16297. tue: "Tuesday",
  16298. wed: "Wednesday",
  16299. thu: "Thursday",
  16300. fri: "Friday",
  16301. sat: "Saturday"
  16302. },
  16303. months: {
  16304. jan: "Jan",
  16305. feb: "Feb",
  16306. mar: "Mar",
  16307. apr: "Apr",
  16308. may: "May",
  16309. jun: "Jun",
  16310. jul: "Jul",
  16311. aug: "Aug",
  16312. sep: "Sep",
  16313. oct: "Oct",
  16314. nov: "Nov",
  16315. dec: "Dec"
  16316. }
  16317. },
  16318. inputNumber: {
  16319. decrease: "decrease number",
  16320. increase: "increase number"
  16321. },
  16322. select: {
  16323. loading: "Loading",
  16324. noMatch: "No matching data",
  16325. noData: "No data",
  16326. placeholder: "Select"
  16327. },
  16328. dropdown: {
  16329. toggleDropdown: "Toggle Dropdown"
  16330. },
  16331. cascader: {
  16332. noMatch: "No matching data",
  16333. loading: "Loading",
  16334. placeholder: "Select",
  16335. noData: "No data"
  16336. },
  16337. pagination: {
  16338. goto: "Go to",
  16339. pagesize: "/page",
  16340. total: "Total {total}",
  16341. pageClassifier: "",
  16342. page: "Page",
  16343. prev: "Go to previous page",
  16344. next: "Go to next page",
  16345. currentPage: "page {pager}",
  16346. prevPages: "Previous {pager} pages",
  16347. nextPages: "Next {pager} pages",
  16348. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  16349. },
  16350. dialog: {
  16351. close: "Close this dialog"
  16352. },
  16353. drawer: {
  16354. close: "Close this dialog"
  16355. },
  16356. messagebox: {
  16357. title: "Message",
  16358. confirm: "OK",
  16359. cancel: "Cancel",
  16360. error: "Illegal input",
  16361. close: "Close this dialog"
  16362. },
  16363. upload: {
  16364. deleteTip: "press delete to remove",
  16365. delete: "Delete",
  16366. preview: "Preview",
  16367. continue: "Continue"
  16368. },
  16369. slider: {
  16370. defaultLabel: "slider between {min} and {max}",
  16371. defaultRangeStartLabel: "pick start value",
  16372. defaultRangeEndLabel: "pick end value"
  16373. },
  16374. table: {
  16375. emptyText: "No Data",
  16376. confirmFilter: "Confirm",
  16377. resetFilter: "Reset",
  16378. clearFilter: "All",
  16379. sumText: "Sum"
  16380. },
  16381. tree: {
  16382. emptyText: "No Data"
  16383. },
  16384. transfer: {
  16385. noMatch: "No matching data",
  16386. noData: "No data",
  16387. titles: ["List 1", "List 2"],
  16388. filterPlaceholder: "Enter keyword",
  16389. noCheckedFormat: "{total} items",
  16390. hasCheckedFormat: "{checked}/{total} checked"
  16391. },
  16392. image: {
  16393. error: "FAILED"
  16394. },
  16395. pageHeader: {
  16396. title: "Back"
  16397. },
  16398. popconfirm: {
  16399. confirmButtonText: "Yes",
  16400. cancelButtonText: "No"
  16401. }
  16402. }
  16403. };
  16404. const buildTranslator = (locale) => (path, option) => translate(path, option, unref(locale));
  16405. const translate = (path, option, locale) => get$2(locale, path, path).replace(/\{(\w+)\}/g, (_, key) => {
  16406. var _a2;
  16407. return `${(_a2 = option == null ? void 0 : option[key]) != null ? _a2 : `{${key}}`}`;
  16408. });
  16409. const buildLocaleContext = (locale) => {
  16410. const lang = computed$1(() => unref(locale).name);
  16411. const localeRef = isRef(locale) ? locale : ref(locale);
  16412. return {
  16413. lang,
  16414. locale: localeRef,
  16415. t: buildTranslator(locale)
  16416. };
  16417. };
  16418. const localeContextKey = Symbol("localeContextKey");
  16419. const useLocale = (localeOverrides) => {
  16420. const locale = localeOverrides || inject(localeContextKey, ref());
  16421. return buildLocaleContext(computed$1(() => locale.value || English));
  16422. };
  16423. let activeEffectScope;
  16424. function recordEffectScope(effect, scope = activeEffectScope) {
  16425. if (scope && scope.active) {
  16426. scope.effects.push(effect);
  16427. }
  16428. }
  16429. const createDep = (effects) => {
  16430. const dep = new Set(effects);
  16431. dep.w = 0;
  16432. dep.n = 0;
  16433. return dep;
  16434. };
  16435. const wasTracked = (dep) => (dep.w & trackOpBit) > 0;
  16436. const newTracked = (dep) => (dep.n & trackOpBit) > 0;
  16437. const initDepMarkers = ({ deps }) => {
  16438. if (deps.length) {
  16439. for (let i2 = 0; i2 < deps.length; i2++) {
  16440. deps[i2].w |= trackOpBit;
  16441. }
  16442. }
  16443. };
  16444. const finalizeDepMarkers = (effect) => {
  16445. const { deps } = effect;
  16446. if (deps.length) {
  16447. let ptr = 0;
  16448. for (let i2 = 0; i2 < deps.length; i2++) {
  16449. const dep = deps[i2];
  16450. if (wasTracked(dep) && !newTracked(dep)) {
  16451. dep.delete(effect);
  16452. } else {
  16453. deps[ptr++] = dep;
  16454. }
  16455. dep.w &= ~trackOpBit;
  16456. dep.n &= ~trackOpBit;
  16457. }
  16458. deps.length = ptr;
  16459. }
  16460. };
  16461. let effectTrackDepth = 0;
  16462. let trackOpBit = 1;
  16463. const maxMarkerBits = 30;
  16464. let activeEffect;
  16465. class ReactiveEffect {
  16466. constructor(fn2, scheduler = null, scope) {
  16467. this.fn = fn2;
  16468. this.scheduler = scheduler;
  16469. this.active = true;
  16470. this.deps = [];
  16471. this.parent = void 0;
  16472. recordEffectScope(this, scope);
  16473. }
  16474. run() {
  16475. if (!this.active) {
  16476. return this.fn();
  16477. }
  16478. let parent = activeEffect;
  16479. let lastShouldTrack = shouldTrack;
  16480. while (parent) {
  16481. if (parent === this) {
  16482. return;
  16483. }
  16484. parent = parent.parent;
  16485. }
  16486. try {
  16487. this.parent = activeEffect;
  16488. activeEffect = this;
  16489. shouldTrack = true;
  16490. trackOpBit = 1 << ++effectTrackDepth;
  16491. if (effectTrackDepth <= maxMarkerBits) {
  16492. initDepMarkers(this);
  16493. } else {
  16494. cleanupEffect(this);
  16495. }
  16496. return this.fn();
  16497. } finally {
  16498. if (effectTrackDepth <= maxMarkerBits) {
  16499. finalizeDepMarkers(this);
  16500. }
  16501. trackOpBit = 1 << --effectTrackDepth;
  16502. activeEffect = this.parent;
  16503. shouldTrack = lastShouldTrack;
  16504. this.parent = void 0;
  16505. if (this.deferStop) {
  16506. this.stop();
  16507. }
  16508. }
  16509. }
  16510. stop() {
  16511. if (activeEffect === this) {
  16512. this.deferStop = true;
  16513. } else if (this.active) {
  16514. cleanupEffect(this);
  16515. if (this.onStop) {
  16516. this.onStop();
  16517. }
  16518. this.active = false;
  16519. }
  16520. }
  16521. }
  16522. function cleanupEffect(effect2) {
  16523. const { deps } = effect2;
  16524. if (deps.length) {
  16525. for (let i2 = 0; i2 < deps.length; i2++) {
  16526. deps[i2].delete(effect2);
  16527. }
  16528. deps.length = 0;
  16529. }
  16530. }
  16531. let shouldTrack = true;
  16532. function trackEffects(dep, debuggerEventExtraInfo) {
  16533. let shouldTrack2 = false;
  16534. if (effectTrackDepth <= maxMarkerBits) {
  16535. if (!newTracked(dep)) {
  16536. dep.n |= trackOpBit;
  16537. shouldTrack2 = !wasTracked(dep);
  16538. }
  16539. } else {
  16540. shouldTrack2 = !dep.has(activeEffect);
  16541. }
  16542. if (shouldTrack2) {
  16543. dep.add(activeEffect);
  16544. activeEffect.deps.push(dep);
  16545. }
  16546. }
  16547. function triggerEffects(dep, debuggerEventExtraInfo) {
  16548. const effects = isArray$2(dep) ? dep : [...dep];
  16549. for (const effect2 of effects) {
  16550. if (effect2.computed) {
  16551. triggerEffect(effect2);
  16552. }
  16553. }
  16554. for (const effect2 of effects) {
  16555. if (!effect2.computed) {
  16556. triggerEffect(effect2);
  16557. }
  16558. }
  16559. }
  16560. function triggerEffect(effect2, debuggerEventExtraInfo) {
  16561. if (effect2 !== activeEffect || effect2.allowRecurse) {
  16562. if (effect2.scheduler) {
  16563. effect2.scheduler();
  16564. } else {
  16565. effect2.run();
  16566. }
  16567. }
  16568. }
  16569. function toRaw(observed) {
  16570. const raw = observed && observed["__v_raw"];
  16571. return raw ? toRaw(raw) : observed;
  16572. }
  16573. function trackRefValue(ref2) {
  16574. if (shouldTrack && activeEffect) {
  16575. ref2 = toRaw(ref2);
  16576. {
  16577. trackEffects(ref2.dep || (ref2.dep = createDep()));
  16578. }
  16579. }
  16580. }
  16581. function triggerRefValue(ref2, newVal) {
  16582. ref2 = toRaw(ref2);
  16583. const dep = ref2.dep;
  16584. if (dep) {
  16585. {
  16586. triggerEffects(dep);
  16587. }
  16588. }
  16589. }
  16590. class ComputedRefImpl {
  16591. constructor(getter, _setter, isReadonly, isSSR) {
  16592. this._setter = _setter;
  16593. this.dep = void 0;
  16594. this.__v_isRef = true;
  16595. this["__v_isReadonly"] = false;
  16596. this._dirty = true;
  16597. this.effect = new ReactiveEffect(getter, () => {
  16598. if (!this._dirty) {
  16599. this._dirty = true;
  16600. triggerRefValue(this);
  16601. }
  16602. });
  16603. this.effect.computed = this;
  16604. this.effect.active = this._cacheable = !isSSR;
  16605. this["__v_isReadonly"] = isReadonly;
  16606. }
  16607. get value() {
  16608. const self2 = toRaw(this);
  16609. trackRefValue(self2);
  16610. if (self2._dirty || !self2._cacheable) {
  16611. self2._dirty = false;
  16612. self2._value = self2.effect.run();
  16613. }
  16614. return self2._value;
  16615. }
  16616. set value(newValue) {
  16617. this._setter(newValue);
  16618. }
  16619. }
  16620. function computed(getterOrOptions, debugOptions, isSSR = false) {
  16621. let getter;
  16622. let setter;
  16623. const onlyGetter = isFunction$3(getterOrOptions);
  16624. if (onlyGetter) {
  16625. getter = getterOrOptions;
  16626. setter = NOOP;
  16627. } else {
  16628. getter = getterOrOptions.get;
  16629. setter = getterOrOptions.set;
  16630. }
  16631. const cRef = new ComputedRefImpl(getter, setter, onlyGetter || !setter, isSSR);
  16632. return cRef;
  16633. }
  16634. const defaultNamespace = "el";
  16635. const statePrefix = "is-";
  16636. const _bem = (namespace, block, blockSuffix, element, modifier) => {
  16637. let cls = `${namespace}-${block}`;
  16638. if (blockSuffix) {
  16639. cls += `-${blockSuffix}`;
  16640. }
  16641. if (element) {
  16642. cls += `__${element}`;
  16643. }
  16644. if (modifier) {
  16645. cls += `--${modifier}`;
  16646. }
  16647. return cls;
  16648. };
  16649. const namespaceContextKey = Symbol("namespaceContextKey");
  16650. const useGetDerivedNamespace = (namespaceOverrides) => {
  16651. const derivedNamespace = namespaceOverrides || inject(namespaceContextKey, ref(defaultNamespace));
  16652. const namespace = computed$1(() => {
  16653. return unref(derivedNamespace) || defaultNamespace;
  16654. });
  16655. return namespace;
  16656. };
  16657. const useNamespace = (block, namespaceOverrides) => {
  16658. const namespace = useGetDerivedNamespace(namespaceOverrides);
  16659. const b = (blockSuffix = "") => _bem(namespace.value, block, blockSuffix, "", "");
  16660. const e = (element) => element ? _bem(namespace.value, block, "", element, "") : "";
  16661. const m = (modifier) => modifier ? _bem(namespace.value, block, "", "", modifier) : "";
  16662. const be2 = (blockSuffix, element) => blockSuffix && element ? _bem(namespace.value, block, blockSuffix, element, "") : "";
  16663. const em = (element, modifier) => element && modifier ? _bem(namespace.value, block, "", element, modifier) : "";
  16664. const bm = (blockSuffix, modifier) => blockSuffix && modifier ? _bem(namespace.value, block, blockSuffix, "", modifier) : "";
  16665. const bem = (blockSuffix, element, modifier) => blockSuffix && element && modifier ? _bem(namespace.value, block, blockSuffix, element, modifier) : "";
  16666. const is = (name, ...args) => {
  16667. const state = args.length >= 1 ? args[0] : true;
  16668. return name && state ? `${statePrefix}${name}` : "";
  16669. };
  16670. const cssVar = (object) => {
  16671. const styles = {};
  16672. for (const key in object) {
  16673. if (object[key]) {
  16674. styles[`--${namespace.value}-${key}`] = object[key];
  16675. }
  16676. }
  16677. return styles;
  16678. };
  16679. const cssVarBlock = (object) => {
  16680. const styles = {};
  16681. for (const key in object) {
  16682. if (object[key]) {
  16683. styles[`--${namespace.value}-${block}-${key}`] = object[key];
  16684. }
  16685. }
  16686. return styles;
  16687. };
  16688. const cssVarName = (name) => `--${namespace.value}-${name}`;
  16689. const cssVarBlockName = (name) => `--${namespace.value}-${block}-${name}`;
  16690. return {
  16691. namespace,
  16692. b,
  16693. e,
  16694. m,
  16695. be: be2,
  16696. em,
  16697. bm,
  16698. bem,
  16699. is,
  16700. cssVar,
  16701. cssVarName,
  16702. cssVarBlock,
  16703. cssVarBlockName
  16704. };
  16705. };
  16706. const useLockscreen = (trigger2, options2 = {}) => {
  16707. if (!isRef(trigger2)) {
  16708. throwError("[useLockscreen]", "You need to pass a ref param to this function");
  16709. }
  16710. const ns = options2.ns || useNamespace("popup");
  16711. const hiddenCls = computed(() => ns.bm("parent", "hidden"));
  16712. if (!isClient || hasClass$2(document.body, hiddenCls.value)) {
  16713. return;
  16714. }
  16715. let scrollBarWidth2 = 0;
  16716. let withoutHiddenClass = false;
  16717. let bodyWidth = "0";
  16718. const cleanup = () => {
  16719. setTimeout(() => {
  16720. removeClass$2(document == null ? void 0 : document.body, hiddenCls.value);
  16721. if (withoutHiddenClass && document) {
  16722. document.body.style.width = bodyWidth;
  16723. }
  16724. }, 200);
  16725. };
  16726. watch(trigger2, (val) => {
  16727. if (!val) {
  16728. cleanup();
  16729. return;
  16730. }
  16731. withoutHiddenClass = !hasClass$2(document.body, hiddenCls.value);
  16732. if (withoutHiddenClass) {
  16733. bodyWidth = document.body.style.width;
  16734. }
  16735. scrollBarWidth2 = getScrollBarWidth(ns.namespace.value);
  16736. const bodyHasOverflow = document.documentElement.clientHeight < document.body.scrollHeight;
  16737. const bodyOverflowY = getStyle(document.body, "overflowY");
  16738. if (scrollBarWidth2 > 0 && (bodyHasOverflow || bodyOverflowY === "scroll") && withoutHiddenClass) {
  16739. document.body.style.width = `calc(100% - ${scrollBarWidth2}px)`;
  16740. }
  16741. addClass$2(document.body, hiddenCls.value);
  16742. });
  16743. onScopeDispose(() => cleanup());
  16744. };
  16745. const _prop = buildProp({
  16746. type: definePropType(Boolean),
  16747. default: null
  16748. });
  16749. const _event = buildProp({
  16750. type: definePropType(Function)
  16751. });
  16752. const createModelToggleComposable = (name) => {
  16753. const updateEventKey = `update:${name}`;
  16754. const updateEventKeyRaw = `onUpdate:${name}`;
  16755. const useModelToggleEmits2 = [updateEventKey];
  16756. const useModelToggleProps2 = {
  16757. [name]: _prop,
  16758. [updateEventKeyRaw]: _event
  16759. };
  16760. const useModelToggle2 = ({
  16761. indicator,
  16762. toggleReason,
  16763. shouldHideWhenRouteChanges,
  16764. shouldProceed,
  16765. onShow,
  16766. onHide
  16767. }) => {
  16768. const instance = getCurrentInstance();
  16769. const { emit } = instance;
  16770. const props = instance.props;
  16771. const hasUpdateHandler = computed$1(() => isFunction$3(props[updateEventKeyRaw]));
  16772. const isModelBindingAbsent = computed$1(() => props[name] === null);
  16773. const doShow = (event2) => {
  16774. if (indicator.value === true) {
  16775. return;
  16776. }
  16777. indicator.value = true;
  16778. if (toggleReason) {
  16779. toggleReason.value = event2;
  16780. }
  16781. if (isFunction$3(onShow)) {
  16782. onShow(event2);
  16783. }
  16784. };
  16785. const doHide = (event2) => {
  16786. if (indicator.value === false) {
  16787. return;
  16788. }
  16789. indicator.value = false;
  16790. if (toggleReason) {
  16791. toggleReason.value = event2;
  16792. }
  16793. if (isFunction$3(onHide)) {
  16794. onHide(event2);
  16795. }
  16796. };
  16797. const show = (event2) => {
  16798. if (props.disabled === true || isFunction$3(shouldProceed) && !shouldProceed())
  16799. return;
  16800. const shouldEmit = hasUpdateHandler.value && isClient;
  16801. if (shouldEmit) {
  16802. emit(updateEventKey, true);
  16803. }
  16804. if (isModelBindingAbsent.value || !shouldEmit) {
  16805. doShow(event2);
  16806. }
  16807. };
  16808. const hide = (event2) => {
  16809. if (props.disabled === true || !isClient)
  16810. return;
  16811. const shouldEmit = hasUpdateHandler.value && isClient;
  16812. if (shouldEmit) {
  16813. emit(updateEventKey, false);
  16814. }
  16815. if (isModelBindingAbsent.value || !shouldEmit) {
  16816. doHide(event2);
  16817. }
  16818. };
  16819. const onChange = (val) => {
  16820. if (!isBoolean(val))
  16821. return;
  16822. if (props.disabled && val) {
  16823. if (hasUpdateHandler.value) {
  16824. emit(updateEventKey, false);
  16825. }
  16826. } else if (indicator.value !== val) {
  16827. if (val) {
  16828. doShow();
  16829. } else {
  16830. doHide();
  16831. }
  16832. }
  16833. };
  16834. const toggle = () => {
  16835. if (indicator.value) {
  16836. hide();
  16837. } else {
  16838. show();
  16839. }
  16840. };
  16841. watch(() => props[name], onChange);
  16842. if (shouldHideWhenRouteChanges && instance.appContext.config.globalProperties.$route !== void 0) {
  16843. watch(() => ({
  16844. ...instance.proxy.$route
  16845. }), () => {
  16846. if (shouldHideWhenRouteChanges.value && indicator.value) {
  16847. hide();
  16848. }
  16849. });
  16850. }
  16851. onMounted(() => {
  16852. onChange(props[name]);
  16853. });
  16854. return {
  16855. hide,
  16856. show,
  16857. toggle,
  16858. hasUpdateHandler
  16859. };
  16860. };
  16861. return {
  16862. useModelToggle: useModelToggle2,
  16863. useModelToggleProps: useModelToggleProps2,
  16864. useModelToggleEmits: useModelToggleEmits2
  16865. };
  16866. };
  16867. const useProp = (name) => {
  16868. const vm = getCurrentInstance();
  16869. return computed$1(() => {
  16870. var _a2, _b;
  16871. return (_b = (_a2 = vm == null ? void 0 : vm.proxy) == null ? void 0 : _a2.$props) == null ? void 0 : _b[name];
  16872. });
  16873. };
  16874. var E = "top", R = "bottom", W = "right", P = "left", me = "auto", G = [E, R, W, P], U = "start", J = "end", Xe = "clippingParents", je = "viewport", K = "popper", Ye = "reference", De = G.reduce(function(t2, e) {
  16875. return t2.concat([e + "-" + U, e + "-" + J]);
  16876. }, []), Ee = [].concat(G, [me]).reduce(function(t2, e) {
  16877. return t2.concat([e, e + "-" + U, e + "-" + J]);
  16878. }, []), Ge = "beforeRead", Je = "read", Ke = "afterRead", Qe = "beforeMain", Ze = "main", et = "afterMain", tt = "beforeWrite", nt = "write", rt = "afterWrite", ot = [Ge, Je, Ke, Qe, Ze, et, tt, nt, rt];
  16879. function C(t2) {
  16880. return t2 ? (t2.nodeName || "").toLowerCase() : null;
  16881. }
  16882. function H(t2) {
  16883. if (t2 == null)
  16884. return window;
  16885. if (t2.toString() !== "[object Window]") {
  16886. var e = t2.ownerDocument;
  16887. return e && e.defaultView || window;
  16888. }
  16889. return t2;
  16890. }
  16891. function Q(t2) {
  16892. var e = H(t2).Element;
  16893. return t2 instanceof e || t2 instanceof Element;
  16894. }
  16895. function B(t2) {
  16896. var e = H(t2).HTMLElement;
  16897. return t2 instanceof e || t2 instanceof HTMLElement;
  16898. }
  16899. function Pe(t2) {
  16900. if (typeof ShadowRoot == "undefined")
  16901. return false;
  16902. var e = H(t2).ShadowRoot;
  16903. return t2 instanceof e || t2 instanceof ShadowRoot;
  16904. }
  16905. function Mt(t2) {
  16906. var e = t2.state;
  16907. Object.keys(e.elements).forEach(function(n) {
  16908. var r2 = e.styles[n] || {}, o = e.attributes[n] || {}, i2 = e.elements[n];
  16909. !B(i2) || !C(i2) || (Object.assign(i2.style, r2), Object.keys(o).forEach(function(a) {
  16910. var s = o[a];
  16911. s === false ? i2.removeAttribute(a) : i2.setAttribute(a, s === true ? "" : s);
  16912. }));
  16913. });
  16914. }
  16915. function Rt(t2) {
  16916. var e = t2.state, n = { popper: { position: e.options.strategy, left: "0", top: "0", margin: "0" }, arrow: { position: "absolute" }, reference: {} };
  16917. return Object.assign(e.elements.popper.style, n.popper), e.styles = n, e.elements.arrow && Object.assign(e.elements.arrow.style, n.arrow), function() {
  16918. Object.keys(e.elements).forEach(function(r2) {
  16919. var o = e.elements[r2], i2 = e.attributes[r2] || {}, a = Object.keys(e.styles.hasOwnProperty(r2) ? e.styles[r2] : n[r2]), s = a.reduce(function(f, c) {
  16920. return f[c] = "", f;
  16921. }, {});
  16922. !B(o) || !C(o) || (Object.assign(o.style, s), Object.keys(i2).forEach(function(f) {
  16923. o.removeAttribute(f);
  16924. }));
  16925. });
  16926. };
  16927. }
  16928. var Ae = { name: "applyStyles", enabled: true, phase: "write", fn: Mt, effect: Rt, requires: ["computeStyles"] };
  16929. function q(t2) {
  16930. return t2.split("-")[0];
  16931. }
  16932. var X = Math.max, ve = Math.min, Z = Math.round;
  16933. function ee(t2, e) {
  16934. e === void 0 && (e = false);
  16935. var n = t2.getBoundingClientRect(), r2 = 1, o = 1;
  16936. if (B(t2) && e) {
  16937. var i2 = t2.offsetHeight, a = t2.offsetWidth;
  16938. a > 0 && (r2 = Z(n.width) / a || 1), i2 > 0 && (o = Z(n.height) / i2 || 1);
  16939. }
  16940. return { width: n.width / r2, height: n.height / o, top: n.top / o, right: n.right / r2, bottom: n.bottom / o, left: n.left / r2, x: n.left / r2, y: n.top / o };
  16941. }
  16942. function ke(t2) {
  16943. var e = ee(t2), n = t2.offsetWidth, r2 = t2.offsetHeight;
  16944. return Math.abs(e.width - n) <= 1 && (n = e.width), Math.abs(e.height - r2) <= 1 && (r2 = e.height), { x: t2.offsetLeft, y: t2.offsetTop, width: n, height: r2 };
  16945. }
  16946. function it(t2, e) {
  16947. var n = e.getRootNode && e.getRootNode();
  16948. if (t2.contains(e))
  16949. return true;
  16950. if (n && Pe(n)) {
  16951. var r2 = e;
  16952. do {
  16953. if (r2 && t2.isSameNode(r2))
  16954. return true;
  16955. r2 = r2.parentNode || r2.host;
  16956. } while (r2);
  16957. }
  16958. return false;
  16959. }
  16960. function N(t2) {
  16961. return H(t2).getComputedStyle(t2);
  16962. }
  16963. function Wt(t2) {
  16964. return ["table", "td", "th"].indexOf(C(t2)) >= 0;
  16965. }
  16966. function I(t2) {
  16967. return ((Q(t2) ? t2.ownerDocument : t2.document) || window.document).documentElement;
  16968. }
  16969. function ge(t2) {
  16970. return C(t2) === "html" ? t2 : t2.assignedSlot || t2.parentNode || (Pe(t2) ? t2.host : null) || I(t2);
  16971. }
  16972. function at(t2) {
  16973. return !B(t2) || N(t2).position === "fixed" ? null : t2.offsetParent;
  16974. }
  16975. function Bt(t2) {
  16976. var e = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1, n = navigator.userAgent.indexOf("Trident") !== -1;
  16977. if (n && B(t2)) {
  16978. var r2 = N(t2);
  16979. if (r2.position === "fixed")
  16980. return null;
  16981. }
  16982. var o = ge(t2);
  16983. for (Pe(o) && (o = o.host); B(o) && ["html", "body"].indexOf(C(o)) < 0; ) {
  16984. var i2 = N(o);
  16985. if (i2.transform !== "none" || i2.perspective !== "none" || i2.contain === "paint" || ["transform", "perspective"].indexOf(i2.willChange) !== -1 || e && i2.willChange === "filter" || e && i2.filter && i2.filter !== "none")
  16986. return o;
  16987. o = o.parentNode;
  16988. }
  16989. return null;
  16990. }
  16991. function se(t2) {
  16992. for (var e = H(t2), n = at(t2); n && Wt(n) && N(n).position === "static"; )
  16993. n = at(n);
  16994. return n && (C(n) === "html" || C(n) === "body" && N(n).position === "static") ? e : n || Bt(t2) || e;
  16995. }
  16996. function Le(t2) {
  16997. return ["top", "bottom"].indexOf(t2) >= 0 ? "x" : "y";
  16998. }
  16999. function fe(t2, e, n) {
  17000. return X(t2, ve(e, n));
  17001. }
  17002. function St(t2, e, n) {
  17003. var r2 = fe(t2, e, n);
  17004. return r2 > n ? n : r2;
  17005. }
  17006. function st() {
  17007. return { top: 0, right: 0, bottom: 0, left: 0 };
  17008. }
  17009. function ft(t2) {
  17010. return Object.assign({}, st(), t2);
  17011. }
  17012. function ct(t2, e) {
  17013. return e.reduce(function(n, r2) {
  17014. return n[r2] = t2, n;
  17015. }, {});
  17016. }
  17017. var Tt = function(t2, e) {
  17018. return t2 = typeof t2 == "function" ? t2(Object.assign({}, e.rects, { placement: e.placement })) : t2, ft(typeof t2 != "number" ? t2 : ct(t2, G));
  17019. };
  17020. function Ht(t2) {
  17021. var e, n = t2.state, r2 = t2.name, o = t2.options, i2 = n.elements.arrow, a = n.modifiersData.popperOffsets, s = q(n.placement), f = Le(s), c = [P, W].indexOf(s) >= 0, u = c ? "height" : "width";
  17022. if (!(!i2 || !a)) {
  17023. var m = Tt(o.padding, n), v = ke(i2), l = f === "y" ? E : P, h2 = f === "y" ? R : W, p = n.rects.reference[u] + n.rects.reference[f] - a[f] - n.rects.popper[u], g = a[f] - n.rects.reference[f], x = se(i2), y = x ? f === "y" ? x.clientHeight || 0 : x.clientWidth || 0 : 0, $2 = p / 2 - g / 2, d2 = m[l], b = y - v[u] - m[h2], w = y / 2 - v[u] / 2 + $2, O = fe(d2, w, b), j = f;
  17024. n.modifiersData[r2] = (e = {}, e[j] = O, e.centerOffset = O - w, e);
  17025. }
  17026. }
  17027. function Ct(t2) {
  17028. var e = t2.state, n = t2.options, r2 = n.element, o = r2 === void 0 ? "[data-popper-arrow]" : r2;
  17029. o != null && (typeof o == "string" && (o = e.elements.popper.querySelector(o), !o) || !it(e.elements.popper, o) || (e.elements.arrow = o));
  17030. }
  17031. var pt = { name: "arrow", enabled: true, phase: "main", fn: Ht, effect: Ct, requires: ["popperOffsets"], requiresIfExists: ["preventOverflow"] };
  17032. function te(t2) {
  17033. return t2.split("-")[1];
  17034. }
  17035. var qt = { top: "auto", right: "auto", bottom: "auto", left: "auto" };
  17036. function Vt(t2) {
  17037. var e = t2.x, n = t2.y, r2 = window, o = r2.devicePixelRatio || 1;
  17038. return { x: Z(e * o) / o || 0, y: Z(n * o) / o || 0 };
  17039. }
  17040. function ut(t2) {
  17041. var e, n = t2.popper, r2 = t2.popperRect, o = t2.placement, i2 = t2.variation, a = t2.offsets, s = t2.position, f = t2.gpuAcceleration, c = t2.adaptive, u = t2.roundOffsets, m = t2.isFixed, v = a.x, l = v === void 0 ? 0 : v, h2 = a.y, p = h2 === void 0 ? 0 : h2, g = typeof u == "function" ? u({ x: l, y: p }) : { x: l, y: p };
  17042. l = g.x, p = g.y;
  17043. var x = a.hasOwnProperty("x"), y = a.hasOwnProperty("y"), $2 = P, d2 = E, b = window;
  17044. if (c) {
  17045. var w = se(n), O = "clientHeight", j = "clientWidth";
  17046. if (w === H(n) && (w = I(n), N(w).position !== "static" && s === "absolute" && (O = "scrollHeight", j = "scrollWidth")), w = w, o === E || (o === P || o === W) && i2 === J) {
  17047. d2 = R;
  17048. var A = m && w === b && b.visualViewport ? b.visualViewport.height : w[O];
  17049. p -= A - r2.height, p *= f ? 1 : -1;
  17050. }
  17051. if (o === P || (o === E || o === R) && i2 === J) {
  17052. $2 = W;
  17053. var k = m && w === b && b.visualViewport ? b.visualViewport.width : w[j];
  17054. l -= k - r2.width, l *= f ? 1 : -1;
  17055. }
  17056. }
  17057. var D = Object.assign({ position: s }, c && qt), S = u === true ? Vt({ x: l, y: p }) : { x: l, y: p };
  17058. if (l = S.x, p = S.y, f) {
  17059. var L;
  17060. return Object.assign({}, D, (L = {}, L[d2] = y ? "0" : "", L[$2] = x ? "0" : "", L.transform = (b.devicePixelRatio || 1) <= 1 ? "translate(" + l + "px, " + p + "px)" : "translate3d(" + l + "px, " + p + "px, 0)", L));
  17061. }
  17062. return Object.assign({}, D, (e = {}, e[d2] = y ? p + "px" : "", e[$2] = x ? l + "px" : "", e.transform = "", e));
  17063. }
  17064. function Nt(t2) {
  17065. var e = t2.state, n = t2.options, r2 = n.gpuAcceleration, o = r2 === void 0 ? true : r2, i2 = n.adaptive, a = i2 === void 0 ? true : i2, s = n.roundOffsets, f = s === void 0 ? true : s, c = { placement: q(e.placement), variation: te(e.placement), popper: e.elements.popper, popperRect: e.rects.popper, gpuAcceleration: o, isFixed: e.options.strategy === "fixed" };
  17066. e.modifiersData.popperOffsets != null && (e.styles.popper = Object.assign({}, e.styles.popper, ut(Object.assign({}, c, { offsets: e.modifiersData.popperOffsets, position: e.options.strategy, adaptive: a, roundOffsets: f })))), e.modifiersData.arrow != null && (e.styles.arrow = Object.assign({}, e.styles.arrow, ut(Object.assign({}, c, { offsets: e.modifiersData.arrow, position: "absolute", adaptive: false, roundOffsets: f })))), e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-placement": e.placement });
  17067. }
  17068. var Me = { name: "computeStyles", enabled: true, phase: "beforeWrite", fn: Nt, data: {} }, ye = { passive: true };
  17069. function It(t2) {
  17070. var e = t2.state, n = t2.instance, r2 = t2.options, o = r2.scroll, i2 = o === void 0 ? true : o, a = r2.resize, s = a === void 0 ? true : a, f = H(e.elements.popper), c = [].concat(e.scrollParents.reference, e.scrollParents.popper);
  17071. return i2 && c.forEach(function(u) {
  17072. u.addEventListener("scroll", n.update, ye);
  17073. }), s && f.addEventListener("resize", n.update, ye), function() {
  17074. i2 && c.forEach(function(u) {
  17075. u.removeEventListener("scroll", n.update, ye);
  17076. }), s && f.removeEventListener("resize", n.update, ye);
  17077. };
  17078. }
  17079. var Re = { name: "eventListeners", enabled: true, phase: "write", fn: function() {
  17080. }, effect: It, data: {} }, _t = { left: "right", right: "left", bottom: "top", top: "bottom" };
  17081. function be(t2) {
  17082. return t2.replace(/left|right|bottom|top/g, function(e) {
  17083. return _t[e];
  17084. });
  17085. }
  17086. var zt = { start: "end", end: "start" };
  17087. function lt(t2) {
  17088. return t2.replace(/start|end/g, function(e) {
  17089. return zt[e];
  17090. });
  17091. }
  17092. function We(t2) {
  17093. var e = H(t2), n = e.pageXOffset, r2 = e.pageYOffset;
  17094. return { scrollLeft: n, scrollTop: r2 };
  17095. }
  17096. function Be(t2) {
  17097. return ee(I(t2)).left + We(t2).scrollLeft;
  17098. }
  17099. function Ft(t2) {
  17100. var e = H(t2), n = I(t2), r2 = e.visualViewport, o = n.clientWidth, i2 = n.clientHeight, a = 0, s = 0;
  17101. return r2 && (o = r2.width, i2 = r2.height, /^((?!chrome|android).)*safari/i.test(navigator.userAgent) || (a = r2.offsetLeft, s = r2.offsetTop)), { width: o, height: i2, x: a + Be(t2), y: s };
  17102. }
  17103. function Ut(t2) {
  17104. var e, n = I(t2), r2 = We(t2), o = (e = t2.ownerDocument) == null ? void 0 : e.body, i2 = X(n.scrollWidth, n.clientWidth, o ? o.scrollWidth : 0, o ? o.clientWidth : 0), a = X(n.scrollHeight, n.clientHeight, o ? o.scrollHeight : 0, o ? o.clientHeight : 0), s = -r2.scrollLeft + Be(t2), f = -r2.scrollTop;
  17105. return N(o || n).direction === "rtl" && (s += X(n.clientWidth, o ? o.clientWidth : 0) - i2), { width: i2, height: a, x: s, y: f };
  17106. }
  17107. function Se(t2) {
  17108. var e = N(t2), n = e.overflow, r2 = e.overflowX, o = e.overflowY;
  17109. return /auto|scroll|overlay|hidden/.test(n + o + r2);
  17110. }
  17111. function dt(t2) {
  17112. return ["html", "body", "#document"].indexOf(C(t2)) >= 0 ? t2.ownerDocument.body : B(t2) && Se(t2) ? t2 : dt(ge(t2));
  17113. }
  17114. function ce(t2, e) {
  17115. var n;
  17116. e === void 0 && (e = []);
  17117. var r2 = dt(t2), o = r2 === ((n = t2.ownerDocument) == null ? void 0 : n.body), i2 = H(r2), a = o ? [i2].concat(i2.visualViewport || [], Se(r2) ? r2 : []) : r2, s = e.concat(a);
  17118. return o ? s : s.concat(ce(ge(a)));
  17119. }
  17120. function Te(t2) {
  17121. return Object.assign({}, t2, { left: t2.x, top: t2.y, right: t2.x + t2.width, bottom: t2.y + t2.height });
  17122. }
  17123. function Xt(t2) {
  17124. var e = ee(t2);
  17125. return e.top = e.top + t2.clientTop, e.left = e.left + t2.clientLeft, e.bottom = e.top + t2.clientHeight, e.right = e.left + t2.clientWidth, e.width = t2.clientWidth, e.height = t2.clientHeight, e.x = e.left, e.y = e.top, e;
  17126. }
  17127. function ht(t2, e) {
  17128. return e === je ? Te(Ft(t2)) : Q(e) ? Xt(e) : Te(Ut(I(t2)));
  17129. }
  17130. function Yt(t2) {
  17131. var e = ce(ge(t2)), n = ["absolute", "fixed"].indexOf(N(t2).position) >= 0, r2 = n && B(t2) ? se(t2) : t2;
  17132. return Q(r2) ? e.filter(function(o) {
  17133. return Q(o) && it(o, r2) && C(o) !== "body";
  17134. }) : [];
  17135. }
  17136. function Gt(t2, e, n) {
  17137. var r2 = e === "clippingParents" ? Yt(t2) : [].concat(e), o = [].concat(r2, [n]), i2 = o[0], a = o.reduce(function(s, f) {
  17138. var c = ht(t2, f);
  17139. return s.top = X(c.top, s.top), s.right = ve(c.right, s.right), s.bottom = ve(c.bottom, s.bottom), s.left = X(c.left, s.left), s;
  17140. }, ht(t2, i2));
  17141. return a.width = a.right - a.left, a.height = a.bottom - a.top, a.x = a.left, a.y = a.top, a;
  17142. }
  17143. function mt(t2) {
  17144. var e = t2.reference, n = t2.element, r2 = t2.placement, o = r2 ? q(r2) : null, i2 = r2 ? te(r2) : null, a = e.x + e.width / 2 - n.width / 2, s = e.y + e.height / 2 - n.height / 2, f;
  17145. switch (o) {
  17146. case E:
  17147. f = { x: a, y: e.y - n.height };
  17148. break;
  17149. case R:
  17150. f = { x: a, y: e.y + e.height };
  17151. break;
  17152. case W:
  17153. f = { x: e.x + e.width, y: s };
  17154. break;
  17155. case P:
  17156. f = { x: e.x - n.width, y: s };
  17157. break;
  17158. default:
  17159. f = { x: e.x, y: e.y };
  17160. }
  17161. var c = o ? Le(o) : null;
  17162. if (c != null) {
  17163. var u = c === "y" ? "height" : "width";
  17164. switch (i2) {
  17165. case U:
  17166. f[c] = f[c] - (e[u] / 2 - n[u] / 2);
  17167. break;
  17168. case J:
  17169. f[c] = f[c] + (e[u] / 2 - n[u] / 2);
  17170. break;
  17171. }
  17172. }
  17173. return f;
  17174. }
  17175. function ne(t2, e) {
  17176. e === void 0 && (e = {});
  17177. var n = e, r2 = n.placement, o = r2 === void 0 ? t2.placement : r2, i2 = n.boundary, a = i2 === void 0 ? Xe : i2, s = n.rootBoundary, f = s === void 0 ? je : s, c = n.elementContext, u = c === void 0 ? K : c, m = n.altBoundary, v = m === void 0 ? false : m, l = n.padding, h2 = l === void 0 ? 0 : l, p = ft(typeof h2 != "number" ? h2 : ct(h2, G)), g = u === K ? Ye : K, x = t2.rects.popper, y = t2.elements[v ? g : u], $2 = Gt(Q(y) ? y : y.contextElement || I(t2.elements.popper), a, f), d2 = ee(t2.elements.reference), b = mt({ reference: d2, element: x, strategy: "absolute", placement: o }), w = Te(Object.assign({}, x, b)), O = u === K ? w : d2, j = { top: $2.top - O.top + p.top, bottom: O.bottom - $2.bottom + p.bottom, left: $2.left - O.left + p.left, right: O.right - $2.right + p.right }, A = t2.modifiersData.offset;
  17178. if (u === K && A) {
  17179. var k = A[o];
  17180. Object.keys(j).forEach(function(D) {
  17181. var S = [W, R].indexOf(D) >= 0 ? 1 : -1, L = [E, R].indexOf(D) >= 0 ? "y" : "x";
  17182. j[D] += k[L] * S;
  17183. });
  17184. }
  17185. return j;
  17186. }
  17187. function Jt(t2, e) {
  17188. e === void 0 && (e = {});
  17189. var n = e, r2 = n.placement, o = n.boundary, i2 = n.rootBoundary, a = n.padding, s = n.flipVariations, f = n.allowedAutoPlacements, c = f === void 0 ? Ee : f, u = te(r2), m = u ? s ? De : De.filter(function(h2) {
  17190. return te(h2) === u;
  17191. }) : G, v = m.filter(function(h2) {
  17192. return c.indexOf(h2) >= 0;
  17193. });
  17194. v.length === 0 && (v = m);
  17195. var l = v.reduce(function(h2, p) {
  17196. return h2[p] = ne(t2, { placement: p, boundary: o, rootBoundary: i2, padding: a })[q(p)], h2;
  17197. }, {});
  17198. return Object.keys(l).sort(function(h2, p) {
  17199. return l[h2] - l[p];
  17200. });
  17201. }
  17202. function Kt(t2) {
  17203. if (q(t2) === me)
  17204. return [];
  17205. var e = be(t2);
  17206. return [lt(t2), e, lt(e)];
  17207. }
  17208. function Qt(t2) {
  17209. var e = t2.state, n = t2.options, r2 = t2.name;
  17210. if (!e.modifiersData[r2]._skip) {
  17211. for (var o = n.mainAxis, i2 = o === void 0 ? true : o, a = n.altAxis, s = a === void 0 ? true : a, f = n.fallbackPlacements, c = n.padding, u = n.boundary, m = n.rootBoundary, v = n.altBoundary, l = n.flipVariations, h2 = l === void 0 ? true : l, p = n.allowedAutoPlacements, g = e.options.placement, x = q(g), y = x === g, $2 = f || (y || !h2 ? [be(g)] : Kt(g)), d2 = [g].concat($2).reduce(function(z, V) {
  17212. return z.concat(q(V) === me ? Jt(e, { placement: V, boundary: u, rootBoundary: m, padding: c, flipVariations: h2, allowedAutoPlacements: p }) : V);
  17213. }, []), b = e.rects.reference, w = e.rects.popper, O = /* @__PURE__ */ new Map(), j = true, A = d2[0], k = 0; k < d2.length; k++) {
  17214. var D = d2[k], S = q(D), L = te(D) === U, re = [E, R].indexOf(S) >= 0, oe = re ? "width" : "height", M = ne(e, { placement: D, boundary: u, rootBoundary: m, altBoundary: v, padding: c }), T = re ? L ? W : P : L ? R : E;
  17215. b[oe] > w[oe] && (T = be(T));
  17216. var pe = be(T), _ = [];
  17217. if (i2 && _.push(M[S] <= 0), s && _.push(M[T] <= 0, M[pe] <= 0), _.every(function(z) {
  17218. return z;
  17219. })) {
  17220. A = D, j = false;
  17221. break;
  17222. }
  17223. O.set(D, _);
  17224. }
  17225. if (j)
  17226. for (var ue = h2 ? 3 : 1, xe = function(z) {
  17227. var V = d2.find(function(de) {
  17228. var ae = O.get(de);
  17229. if (ae)
  17230. return ae.slice(0, z).every(function(Y) {
  17231. return Y;
  17232. });
  17233. });
  17234. if (V)
  17235. return A = V, "break";
  17236. }, ie = ue; ie > 0; ie--) {
  17237. var le = xe(ie);
  17238. if (le === "break")
  17239. break;
  17240. }
  17241. e.placement !== A && (e.modifiersData[r2]._skip = true, e.placement = A, e.reset = true);
  17242. }
  17243. }
  17244. var vt = { name: "flip", enabled: true, phase: "main", fn: Qt, requiresIfExists: ["offset"], data: { _skip: false } };
  17245. function gt(t2, e, n) {
  17246. return n === void 0 && (n = { x: 0, y: 0 }), { top: t2.top - e.height - n.y, right: t2.right - e.width + n.x, bottom: t2.bottom - e.height + n.y, left: t2.left - e.width - n.x };
  17247. }
  17248. function yt(t2) {
  17249. return [E, W, R, P].some(function(e) {
  17250. return t2[e] >= 0;
  17251. });
  17252. }
  17253. function Zt(t2) {
  17254. var e = t2.state, n = t2.name, r2 = e.rects.reference, o = e.rects.popper, i2 = e.modifiersData.preventOverflow, a = ne(e, { elementContext: "reference" }), s = ne(e, { altBoundary: true }), f = gt(a, r2), c = gt(s, o, i2), u = yt(f), m = yt(c);
  17255. e.modifiersData[n] = { referenceClippingOffsets: f, popperEscapeOffsets: c, isReferenceHidden: u, hasPopperEscaped: m }, e.attributes.popper = Object.assign({}, e.attributes.popper, { "data-popper-reference-hidden": u, "data-popper-escaped": m });
  17256. }
  17257. var bt = { name: "hide", enabled: true, phase: "main", requiresIfExists: ["preventOverflow"], fn: Zt };
  17258. function en$1(t2, e, n) {
  17259. var r2 = q(t2), o = [P, E].indexOf(r2) >= 0 ? -1 : 1, i2 = typeof n == "function" ? n(Object.assign({}, e, { placement: t2 })) : n, a = i2[0], s = i2[1];
  17260. return a = a || 0, s = (s || 0) * o, [P, W].indexOf(r2) >= 0 ? { x: s, y: a } : { x: a, y: s };
  17261. }
  17262. function tn(t2) {
  17263. var e = t2.state, n = t2.options, r2 = t2.name, o = n.offset, i2 = o === void 0 ? [0, 0] : o, a = Ee.reduce(function(u, m) {
  17264. return u[m] = en$1(m, e.rects, i2), u;
  17265. }, {}), s = a[e.placement], f = s.x, c = s.y;
  17266. e.modifiersData.popperOffsets != null && (e.modifiersData.popperOffsets.x += f, e.modifiersData.popperOffsets.y += c), e.modifiersData[r2] = a;
  17267. }
  17268. var wt = { name: "offset", enabled: true, phase: "main", requires: ["popperOffsets"], fn: tn };
  17269. function nn(t2) {
  17270. var e = t2.state, n = t2.name;
  17271. e.modifiersData[n] = mt({ reference: e.rects.reference, element: e.rects.popper, strategy: "absolute", placement: e.placement });
  17272. }
  17273. var He = { name: "popperOffsets", enabled: true, phase: "read", fn: nn, data: {} };
  17274. function rn(t2) {
  17275. return t2 === "x" ? "y" : "x";
  17276. }
  17277. function on$2(t2) {
  17278. var e = t2.state, n = t2.options, r2 = t2.name, o = n.mainAxis, i2 = o === void 0 ? true : o, a = n.altAxis, s = a === void 0 ? false : a, f = n.boundary, c = n.rootBoundary, u = n.altBoundary, m = n.padding, v = n.tether, l = v === void 0 ? true : v, h2 = n.tetherOffset, p = h2 === void 0 ? 0 : h2, g = ne(e, { boundary: f, rootBoundary: c, padding: m, altBoundary: u }), x = q(e.placement), y = te(e.placement), $2 = !y, d2 = Le(x), b = rn(d2), w = e.modifiersData.popperOffsets, O = e.rects.reference, j = e.rects.popper, A = typeof p == "function" ? p(Object.assign({}, e.rects, { placement: e.placement })) : p, k = typeof A == "number" ? { mainAxis: A, altAxis: A } : Object.assign({ mainAxis: 0, altAxis: 0 }, A), D = e.modifiersData.offset ? e.modifiersData.offset[e.placement] : null, S = { x: 0, y: 0 };
  17279. if (w) {
  17280. if (i2) {
  17281. var L, re = d2 === "y" ? E : P, oe = d2 === "y" ? R : W, M = d2 === "y" ? "height" : "width", T = w[d2], pe = T + g[re], _ = T - g[oe], ue = l ? -j[M] / 2 : 0, xe = y === U ? O[M] : j[M], ie = y === U ? -j[M] : -O[M], le = e.elements.arrow, z = l && le ? ke(le) : { width: 0, height: 0 }, V = e.modifiersData["arrow#persistent"] ? e.modifiersData["arrow#persistent"].padding : st(), de = V[re], ae = V[oe], Y = fe(0, O[M], z[M]), jt = $2 ? O[M] / 2 - ue - Y - de - k.mainAxis : xe - Y - de - k.mainAxis, Dt = $2 ? -O[M] / 2 + ue + Y + ae + k.mainAxis : ie + Y + ae + k.mainAxis, Oe = e.elements.arrow && se(e.elements.arrow), Et = Oe ? d2 === "y" ? Oe.clientTop || 0 : Oe.clientLeft || 0 : 0, Ce = (L = D == null ? void 0 : D[d2]) != null ? L : 0, Pt = T + jt - Ce - Et, At = T + Dt - Ce, qe = fe(l ? ve(pe, Pt) : pe, T, l ? X(_, At) : _);
  17282. w[d2] = qe, S[d2] = qe - T;
  17283. }
  17284. if (s) {
  17285. var Ve, kt = d2 === "x" ? E : P, Lt = d2 === "x" ? R : W, F = w[b], he = b === "y" ? "height" : "width", Ne = F + g[kt], Ie = F - g[Lt], $e = [E, P].indexOf(x) !== -1, _e = (Ve = D == null ? void 0 : D[b]) != null ? Ve : 0, ze = $e ? Ne : F - O[he] - j[he] - _e + k.altAxis, Fe = $e ? F + O[he] + j[he] - _e - k.altAxis : Ie, Ue = l && $e ? St(ze, F, Fe) : fe(l ? ze : Ne, F, l ? Fe : Ie);
  17286. w[b] = Ue, S[b] = Ue - F;
  17287. }
  17288. e.modifiersData[r2] = S;
  17289. }
  17290. }
  17291. var xt = { name: "preventOverflow", enabled: true, phase: "main", fn: on$2, requiresIfExists: ["offset"] };
  17292. function an(t2) {
  17293. return { scrollLeft: t2.scrollLeft, scrollTop: t2.scrollTop };
  17294. }
  17295. function sn(t2) {
  17296. return t2 === H(t2) || !B(t2) ? We(t2) : an(t2);
  17297. }
  17298. function fn(t2) {
  17299. var e = t2.getBoundingClientRect(), n = Z(e.width) / t2.offsetWidth || 1, r2 = Z(e.height) / t2.offsetHeight || 1;
  17300. return n !== 1 || r2 !== 1;
  17301. }
  17302. function cn(t2, e, n) {
  17303. n === void 0 && (n = false);
  17304. var r2 = B(e), o = B(e) && fn(e), i2 = I(e), a = ee(t2, o), s = { scrollLeft: 0, scrollTop: 0 }, f = { x: 0, y: 0 };
  17305. return (r2 || !r2 && !n) && ((C(e) !== "body" || Se(i2)) && (s = sn(e)), B(e) ? (f = ee(e, true), f.x += e.clientLeft, f.y += e.clientTop) : i2 && (f.x = Be(i2))), { x: a.left + s.scrollLeft - f.x, y: a.top + s.scrollTop - f.y, width: a.width, height: a.height };
  17306. }
  17307. function pn(t2) {
  17308. var e = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Set(), r2 = [];
  17309. t2.forEach(function(i2) {
  17310. e.set(i2.name, i2);
  17311. });
  17312. function o(i2) {
  17313. n.add(i2.name);
  17314. var a = [].concat(i2.requires || [], i2.requiresIfExists || []);
  17315. a.forEach(function(s) {
  17316. if (!n.has(s)) {
  17317. var f = e.get(s);
  17318. f && o(f);
  17319. }
  17320. }), r2.push(i2);
  17321. }
  17322. return t2.forEach(function(i2) {
  17323. n.has(i2.name) || o(i2);
  17324. }), r2;
  17325. }
  17326. function un(t2) {
  17327. var e = pn(t2);
  17328. return ot.reduce(function(n, r2) {
  17329. return n.concat(e.filter(function(o) {
  17330. return o.phase === r2;
  17331. }));
  17332. }, []);
  17333. }
  17334. function ln(t2) {
  17335. var e;
  17336. return function() {
  17337. return e || (e = new Promise(function(n) {
  17338. Promise.resolve().then(function() {
  17339. e = void 0, n(t2());
  17340. });
  17341. })), e;
  17342. };
  17343. }
  17344. function dn(t2) {
  17345. var e = t2.reduce(function(n, r2) {
  17346. var o = n[r2.name];
  17347. return n[r2.name] = o ? Object.assign({}, o, r2, { options: Object.assign({}, o.options, r2.options), data: Object.assign({}, o.data, r2.data) }) : r2, n;
  17348. }, {});
  17349. return Object.keys(e).map(function(n) {
  17350. return e[n];
  17351. });
  17352. }
  17353. var Ot = { placement: "bottom", modifiers: [], strategy: "absolute" };
  17354. function $t() {
  17355. for (var t2 = arguments.length, e = new Array(t2), n = 0; n < t2; n++)
  17356. e[n] = arguments[n];
  17357. return !e.some(function(r2) {
  17358. return !(r2 && typeof r2.getBoundingClientRect == "function");
  17359. });
  17360. }
  17361. function we(t2) {
  17362. t2 === void 0 && (t2 = {});
  17363. var e = t2, n = e.defaultModifiers, r2 = n === void 0 ? [] : n, o = e.defaultOptions, i2 = o === void 0 ? Ot : o;
  17364. return function(a, s, f) {
  17365. f === void 0 && (f = i2);
  17366. var c = { placement: "bottom", orderedModifiers: [], options: Object.assign({}, Ot, i2), modifiersData: {}, elements: { reference: a, popper: s }, attributes: {}, styles: {} }, u = [], m = false, v = { state: c, setOptions: function(p) {
  17367. var g = typeof p == "function" ? p(c.options) : p;
  17368. h2(), c.options = Object.assign({}, i2, c.options, g), c.scrollParents = { reference: Q(a) ? ce(a) : a.contextElement ? ce(a.contextElement) : [], popper: ce(s) };
  17369. var x = un(dn([].concat(r2, c.options.modifiers)));
  17370. return c.orderedModifiers = x.filter(function(y) {
  17371. return y.enabled;
  17372. }), l(), v.update();
  17373. }, forceUpdate: function() {
  17374. if (!m) {
  17375. var p = c.elements, g = p.reference, x = p.popper;
  17376. if ($t(g, x)) {
  17377. c.rects = { reference: cn(g, se(x), c.options.strategy === "fixed"), popper: ke(x) }, c.reset = false, c.placement = c.options.placement, c.orderedModifiers.forEach(function(j) {
  17378. return c.modifiersData[j.name] = Object.assign({}, j.data);
  17379. });
  17380. for (var y = 0; y < c.orderedModifiers.length; y++) {
  17381. if (c.reset === true) {
  17382. c.reset = false, y = -1;
  17383. continue;
  17384. }
  17385. var $2 = c.orderedModifiers[y], d2 = $2.fn, b = $2.options, w = b === void 0 ? {} : b, O = $2.name;
  17386. typeof d2 == "function" && (c = d2({ state: c, options: w, name: O, instance: v }) || c);
  17387. }
  17388. }
  17389. }
  17390. }, update: ln(function() {
  17391. return new Promise(function(p) {
  17392. v.forceUpdate(), p(c);
  17393. });
  17394. }), destroy: function() {
  17395. h2(), m = true;
  17396. } };
  17397. if (!$t(a, s))
  17398. return v;
  17399. v.setOptions(f).then(function(p) {
  17400. !m && f.onFirstUpdate && f.onFirstUpdate(p);
  17401. });
  17402. function l() {
  17403. c.orderedModifiers.forEach(function(p) {
  17404. var g = p.name, x = p.options, y = x === void 0 ? {} : x, $2 = p.effect;
  17405. if (typeof $2 == "function") {
  17406. var d2 = $2({ state: c, name: g, instance: v, options: y }), b = function() {
  17407. };
  17408. u.push(d2 || b);
  17409. }
  17410. });
  17411. }
  17412. function h2() {
  17413. u.forEach(function(p) {
  17414. return p();
  17415. }), u = [];
  17416. }
  17417. return v;
  17418. };
  17419. }
  17420. we();
  17421. var mn = [Re, He, Me, Ae];
  17422. we({ defaultModifiers: mn });
  17423. var gn = [Re, He, Me, Ae, wt, vt, xt, pt, bt], yn = we({ defaultModifiers: gn });
  17424. const usePopper = (referenceElementRef, popperElementRef, opts = {}) => {
  17425. const stateUpdater = {
  17426. name: "updateState",
  17427. enabled: true,
  17428. phase: "write",
  17429. fn: ({ state }) => {
  17430. const derivedState = deriveState(state);
  17431. Object.assign(states.value, derivedState);
  17432. },
  17433. requires: ["computeStyles"]
  17434. };
  17435. const options2 = computed$1(() => {
  17436. const { onFirstUpdate, placement, strategy, modifiers } = unref(opts);
  17437. return {
  17438. onFirstUpdate,
  17439. placement: placement || "bottom",
  17440. strategy: strategy || "absolute",
  17441. modifiers: [
  17442. ...modifiers || [],
  17443. stateUpdater,
  17444. { name: "applyStyles", enabled: false }
  17445. ]
  17446. };
  17447. });
  17448. const instanceRef = shallowRef();
  17449. const states = ref({
  17450. styles: {
  17451. popper: {
  17452. position: unref(options2).strategy,
  17453. left: "0",
  17454. top: "0"
  17455. },
  17456. arrow: {
  17457. position: "absolute"
  17458. }
  17459. },
  17460. attributes: {}
  17461. });
  17462. const destroy = () => {
  17463. if (!instanceRef.value)
  17464. return;
  17465. instanceRef.value.destroy();
  17466. instanceRef.value = void 0;
  17467. };
  17468. watch(options2, (newOptions) => {
  17469. const instance = unref(instanceRef);
  17470. if (instance) {
  17471. instance.setOptions(newOptions);
  17472. }
  17473. }, {
  17474. deep: true
  17475. });
  17476. watch([referenceElementRef, popperElementRef], ([referenceElement, popperElement]) => {
  17477. destroy();
  17478. if (!referenceElement || !popperElement)
  17479. return;
  17480. instanceRef.value = yn(referenceElement, popperElement, unref(options2));
  17481. });
  17482. onBeforeUnmount(() => {
  17483. destroy();
  17484. });
  17485. return {
  17486. state: computed$1(() => {
  17487. var _a2;
  17488. return { ...((_a2 = unref(instanceRef)) == null ? void 0 : _a2.state) || {} };
  17489. }),
  17490. styles: computed$1(() => unref(states).styles),
  17491. attributes: computed$1(() => unref(states).attributes),
  17492. update: () => {
  17493. var _a2;
  17494. return (_a2 = unref(instanceRef)) == null ? void 0 : _a2.update();
  17495. },
  17496. forceUpdate: () => {
  17497. var _a2;
  17498. return (_a2 = unref(instanceRef)) == null ? void 0 : _a2.forceUpdate();
  17499. },
  17500. instanceRef: computed$1(() => unref(instanceRef))
  17501. };
  17502. };
  17503. function deriveState(state) {
  17504. const elements = Object.keys(state.elements);
  17505. const styles = fromPairs(elements.map((element) => [element, state.styles[element] || {}]));
  17506. const attributes = fromPairs(elements.map((element) => [element, state.attributes[element]]));
  17507. return {
  17508. styles,
  17509. attributes
  17510. };
  17511. }
  17512. const useSameTarget = (handleClick) => {
  17513. if (!handleClick) {
  17514. return { onClick: NOOP, onMousedown: NOOP, onMouseup: NOOP };
  17515. }
  17516. let mousedownTarget = false;
  17517. let mouseupTarget = false;
  17518. const onClick = (e) => {
  17519. if (mousedownTarget && mouseupTarget) {
  17520. handleClick(e);
  17521. }
  17522. mousedownTarget = mouseupTarget = false;
  17523. };
  17524. const onMousedown = (e) => {
  17525. mousedownTarget = e.target === e.currentTarget;
  17526. };
  17527. const onMouseup = (e) => {
  17528. mouseupTarget = e.target === e.currentTarget;
  17529. };
  17530. return { onClick, onMousedown, onMouseup };
  17531. };
  17532. function useTimeout() {
  17533. let timeoutHandle;
  17534. const registerTimeout = (fn2, delay) => {
  17535. cancelTimeout();
  17536. timeoutHandle = window.setTimeout(fn2, delay);
  17537. };
  17538. const cancelTimeout = () => window.clearTimeout(timeoutHandle);
  17539. tryOnScopeDispose(() => cancelTimeout());
  17540. return {
  17541. registerTimeout,
  17542. cancelTimeout
  17543. };
  17544. }
  17545. const defaultIdInjection = {
  17546. prefix: Math.floor(Math.random() * 1e4),
  17547. current: 0
  17548. };
  17549. const ID_INJECTION_KEY = Symbol("elIdInjection");
  17550. const useIdInjection = () => {
  17551. return getCurrentInstance() ? inject(ID_INJECTION_KEY, defaultIdInjection) : defaultIdInjection;
  17552. };
  17553. const useId = (deterministicId) => {
  17554. const idInjection = useIdInjection();
  17555. const namespace = useGetDerivedNamespace();
  17556. const idRef = computed$1(() => unref(deterministicId) || `${namespace.value}-id-${idInjection.prefix}-${idInjection.current++}`);
  17557. return idRef;
  17558. };
  17559. let registeredEscapeHandlers = [];
  17560. const cachedHandler = (e) => {
  17561. const event2 = e;
  17562. if (event2.key === EVENT_CODE.esc) {
  17563. registeredEscapeHandlers.forEach((registeredHandler) => registeredHandler(event2));
  17564. }
  17565. };
  17566. const useEscapeKeydown = (handler) => {
  17567. onMounted(() => {
  17568. if (registeredEscapeHandlers.length === 0) {
  17569. document.addEventListener("keydown", cachedHandler);
  17570. }
  17571. if (isClient)
  17572. registeredEscapeHandlers.push(handler);
  17573. });
  17574. onBeforeUnmount(() => {
  17575. registeredEscapeHandlers = registeredEscapeHandlers.filter((registeredHandler) => registeredHandler !== handler);
  17576. if (registeredEscapeHandlers.length === 0) {
  17577. if (isClient)
  17578. document.removeEventListener("keydown", cachedHandler);
  17579. }
  17580. });
  17581. };
  17582. let cachedContainer;
  17583. const usePopperContainerId = () => {
  17584. const namespace = useGetDerivedNamespace();
  17585. const idInjection = useIdInjection();
  17586. const id = computed$1(() => {
  17587. return `${namespace.value}-popper-container-${idInjection.prefix}`;
  17588. });
  17589. const selector = computed$1(() => `#${id.value}`);
  17590. return {
  17591. id,
  17592. selector
  17593. };
  17594. };
  17595. const createContainer = (id) => {
  17596. const container = document.createElement("div");
  17597. container.id = id;
  17598. document.body.appendChild(container);
  17599. return container;
  17600. };
  17601. const usePopperContainer = () => {
  17602. const { id, selector } = usePopperContainerId();
  17603. onBeforeMount(() => {
  17604. if (!isClient)
  17605. return;
  17606. if (!cachedContainer && !document.body.querySelector(selector.value)) {
  17607. cachedContainer = createContainer(id.value);
  17608. }
  17609. });
  17610. return {
  17611. id,
  17612. selector
  17613. };
  17614. };
  17615. const useDelayedToggleProps = buildProps({
  17616. showAfter: {
  17617. type: Number,
  17618. default: 0
  17619. },
  17620. hideAfter: {
  17621. type: Number,
  17622. default: 200
  17623. },
  17624. autoClose: {
  17625. type: Number,
  17626. default: 0
  17627. }
  17628. });
  17629. const useDelayedToggle = ({
  17630. showAfter,
  17631. hideAfter,
  17632. autoClose,
  17633. open,
  17634. close
  17635. }) => {
  17636. const { registerTimeout } = useTimeout();
  17637. const {
  17638. registerTimeout: registerTimeoutForAutoClose,
  17639. cancelTimeout: cancelTimeoutForAutoClose
  17640. } = useTimeout();
  17641. const onOpen = (event2) => {
  17642. registerTimeout(() => {
  17643. open(event2);
  17644. const _autoClose = unref(autoClose);
  17645. if (isNumber(_autoClose) && _autoClose > 0) {
  17646. registerTimeoutForAutoClose(() => {
  17647. close(event2);
  17648. }, _autoClose);
  17649. }
  17650. }, unref(showAfter));
  17651. };
  17652. const onClose = (event2) => {
  17653. cancelTimeoutForAutoClose();
  17654. registerTimeout(() => {
  17655. close(event2);
  17656. }, unref(hideAfter));
  17657. };
  17658. return {
  17659. onOpen,
  17660. onClose
  17661. };
  17662. };
  17663. const FORWARD_REF_INJECTION_KEY = Symbol("elForwardRef");
  17664. const useForwardRef = (forwardRef) => {
  17665. const setForwardRef = (el) => {
  17666. forwardRef.value = el;
  17667. };
  17668. provide(FORWARD_REF_INJECTION_KEY, {
  17669. setForwardRef
  17670. });
  17671. };
  17672. const useForwardRefDirective = (setForwardRef) => {
  17673. return {
  17674. mounted(el) {
  17675. setForwardRef(el);
  17676. },
  17677. updated(el) {
  17678. setForwardRef(el);
  17679. },
  17680. unmounted() {
  17681. setForwardRef(null);
  17682. }
  17683. };
  17684. };
  17685. const zIndex = ref(0);
  17686. const defaultInitialZIndex = 2e3;
  17687. const zIndexContextKey = Symbol("zIndexContextKey");
  17688. const useZIndex = (zIndexOverrides) => {
  17689. const zIndexInjection = zIndexOverrides || inject(zIndexContextKey, void 0);
  17690. const initialZIndex = computed$1(() => {
  17691. const zIndexFromInjection = unref(zIndexInjection);
  17692. return isNumber(zIndexFromInjection) ? zIndexFromInjection : defaultInitialZIndex;
  17693. });
  17694. const currentZIndex = computed$1(() => initialZIndex.value + zIndex.value);
  17695. const nextZIndex = () => {
  17696. zIndex.value++;
  17697. return currentZIndex.value;
  17698. };
  17699. return {
  17700. initialZIndex,
  17701. currentZIndex,
  17702. nextZIndex
  17703. };
  17704. };
  17705. function useCursor(input) {
  17706. const selectionRef = ref();
  17707. function recordCursor() {
  17708. if (input.value == void 0)
  17709. return;
  17710. const { selectionStart, selectionEnd, value } = input.value;
  17711. if (selectionStart == null || selectionEnd == null)
  17712. return;
  17713. const beforeTxt = value.slice(0, Math.max(0, selectionStart));
  17714. const afterTxt = value.slice(Math.max(0, selectionEnd));
  17715. selectionRef.value = {
  17716. selectionStart,
  17717. selectionEnd,
  17718. value,
  17719. beforeTxt,
  17720. afterTxt
  17721. };
  17722. }
  17723. function setCursor() {
  17724. if (input.value == void 0 || selectionRef.value == void 0)
  17725. return;
  17726. const { value } = input.value;
  17727. const { beforeTxt, afterTxt, selectionStart } = selectionRef.value;
  17728. if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
  17729. return;
  17730. let startPos = value.length;
  17731. if (value.endsWith(afterTxt)) {
  17732. startPos = value.length - afterTxt.length;
  17733. } else if (value.startsWith(beforeTxt)) {
  17734. startPos = beforeTxt.length;
  17735. } else {
  17736. const beforeLastChar = beforeTxt[selectionStart - 1];
  17737. const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
  17738. if (newIndex !== -1) {
  17739. startPos = newIndex + 1;
  17740. }
  17741. }
  17742. input.value.setSelectionRange(startPos, startPos);
  17743. }
  17744. return [recordCursor, setCursor];
  17745. }
  17746. const useSizeProp = buildProp({
  17747. type: String,
  17748. values: componentSizes,
  17749. required: false
  17750. });
  17751. const SIZE_INJECTION_KEY = Symbol("size");
  17752. const useGlobalSize = () => {
  17753. const injectedSize = inject(SIZE_INJECTION_KEY, {});
  17754. return computed$1(() => {
  17755. return unref(injectedSize.size) || "";
  17756. });
  17757. };
  17758. const configProviderContextKey = Symbol();
  17759. const globalConfig = ref();
  17760. function useGlobalConfig(key, defaultValue2 = void 0) {
  17761. const config = getCurrentInstance() ? inject(configProviderContextKey, globalConfig) : globalConfig;
  17762. if (key) {
  17763. return computed$1(() => {
  17764. var _a2, _b;
  17765. return (_b = (_a2 = config.value) == null ? void 0 : _a2[key]) != null ? _b : defaultValue2;
  17766. });
  17767. } else {
  17768. return config;
  17769. }
  17770. }
  17771. const provideGlobalConfig = (config, app, global2 = false) => {
  17772. var _a2;
  17773. const inSetup = !!getCurrentInstance();
  17774. const oldConfig = inSetup ? useGlobalConfig() : void 0;
  17775. const provideFn = (_a2 = app == null ? void 0 : app.provide) != null ? _a2 : inSetup ? provide : void 0;
  17776. if (!provideFn) {
  17777. return;
  17778. }
  17779. const context = computed$1(() => {
  17780. const cfg = unref(config);
  17781. if (!(oldConfig == null ? void 0 : oldConfig.value))
  17782. return cfg;
  17783. return mergeConfig(oldConfig.value, cfg);
  17784. });
  17785. provideFn(configProviderContextKey, context);
  17786. provideFn(localeContextKey, computed$1(() => context.value.locale));
  17787. provideFn(namespaceContextKey, computed$1(() => context.value.namespace));
  17788. provideFn(zIndexContextKey, computed$1(() => context.value.zIndex));
  17789. provideFn(SIZE_INJECTION_KEY, {
  17790. size: computed$1(() => context.value.size || "")
  17791. });
  17792. if (global2 || !globalConfig.value) {
  17793. globalConfig.value = context.value;
  17794. }
  17795. return context;
  17796. };
  17797. const mergeConfig = (a, b) => {
  17798. var _a2;
  17799. const keys3 = [.../* @__PURE__ */ new Set([...keysOf(a), ...keysOf(b)])];
  17800. const obj = {};
  17801. for (const key of keys3) {
  17802. obj[key] = (_a2 = b[key]) != null ? _a2 : a[key];
  17803. }
  17804. return obj;
  17805. };
  17806. const configProviderProps = buildProps({
  17807. a11y: {
  17808. type: Boolean,
  17809. default: true
  17810. },
  17811. locale: {
  17812. type: definePropType(Object)
  17813. },
  17814. size: useSizeProp,
  17815. button: {
  17816. type: definePropType(Object)
  17817. },
  17818. experimentalFeatures: {
  17819. type: definePropType(Object)
  17820. },
  17821. keyboardNavigation: {
  17822. type: Boolean,
  17823. default: true
  17824. },
  17825. message: {
  17826. type: definePropType(Object)
  17827. },
  17828. zIndex: Number,
  17829. namespace: {
  17830. type: String,
  17831. default: "el"
  17832. }
  17833. });
  17834. const messageConfig = {};
  17835. const ConfigProvider = defineComponent({
  17836. name: "ElConfigProvider",
  17837. props: configProviderProps,
  17838. setup(props, { slots }) {
  17839. watch(() => props.message, (val) => {
  17840. Object.assign(messageConfig, val != null ? val : {});
  17841. }, { immediate: true, deep: true });
  17842. const config = provideGlobalConfig(props);
  17843. return () => renderSlot(slots, "default", { config: config == null ? void 0 : config.value });
  17844. }
  17845. });
  17846. const ElConfigProvider = withInstall(ConfigProvider);
  17847. var _export_sfc$1 = (sfc, props) => {
  17848. const target = sfc.__vccOpts || sfc;
  17849. for (const [key, val] of props) {
  17850. target[key] = val;
  17851. }
  17852. return target;
  17853. };
  17854. const iconProps = buildProps({
  17855. size: {
  17856. type: definePropType([Number, String])
  17857. },
  17858. color: {
  17859. type: String
  17860. }
  17861. });
  17862. const __default__$o = defineComponent({
  17863. name: "ElIcon",
  17864. inheritAttrs: false
  17865. });
  17866. const _sfc_main$B = /* @__PURE__ */ defineComponent({
  17867. ...__default__$o,
  17868. props: iconProps,
  17869. setup(__props) {
  17870. const props = __props;
  17871. const ns = useNamespace("icon");
  17872. const style = computed$1(() => {
  17873. const { size, color: color2 } = props;
  17874. if (!size && !color2)
  17875. return {};
  17876. return {
  17877. fontSize: isUndefined(size) ? void 0 : addUnit(size),
  17878. "--color": color2
  17879. };
  17880. });
  17881. return (_ctx, _cache) => {
  17882. return openBlock(), createElementBlock("i", mergeProps({
  17883. class: unref(ns).b(),
  17884. style: unref(style)
  17885. }, _ctx.$attrs), [
  17886. renderSlot(_ctx.$slots, "default")
  17887. ], 16);
  17888. };
  17889. }
  17890. });
  17891. var Icon = /* @__PURE__ */ _export_sfc$1(_sfc_main$B, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/icon/src/icon.vue"]]);
  17892. const ElIcon = withInstall(Icon);
  17893. const formContextKey = Symbol("formContextKey");
  17894. const formItemContextKey = Symbol("formItemContextKey");
  17895. const useFormSize = (fallback, ignore = {}) => {
  17896. const emptyRef = ref(void 0);
  17897. const size = ignore.prop ? emptyRef : useProp("size");
  17898. const globalConfig2 = ignore.global ? emptyRef : useGlobalSize();
  17899. const form = ignore.form ? { size: void 0 } : inject(formContextKey, void 0);
  17900. const formItem = ignore.formItem ? { size: void 0 } : inject(formItemContextKey, void 0);
  17901. return computed$1(() => size.value || unref(fallback) || (formItem == null ? void 0 : formItem.size) || (form == null ? void 0 : form.size) || globalConfig2.value || "");
  17902. };
  17903. const useFormDisabled = (fallback) => {
  17904. const disabled = useProp("disabled");
  17905. const form = inject(formContextKey, void 0);
  17906. return computed$1(() => disabled.value || unref(fallback) || (form == null ? void 0 : form.disabled) || false);
  17907. };
  17908. const useFormItem = () => {
  17909. const form = inject(formContextKey, void 0);
  17910. const formItem = inject(formItemContextKey, void 0);
  17911. return {
  17912. form,
  17913. formItem
  17914. };
  17915. };
  17916. const useFormItemInputId = (props, {
  17917. formItemContext,
  17918. disableIdGeneration,
  17919. disableIdManagement
  17920. }) => {
  17921. if (!disableIdGeneration) {
  17922. disableIdGeneration = ref(false);
  17923. }
  17924. if (!disableIdManagement) {
  17925. disableIdManagement = ref(false);
  17926. }
  17927. const inputId = ref();
  17928. let idUnwatch = void 0;
  17929. const isLabeledByFormItem = computed$1(() => {
  17930. var _a2;
  17931. return !!(!props.label && formItemContext && formItemContext.inputIds && ((_a2 = formItemContext.inputIds) == null ? void 0 : _a2.length) <= 1);
  17932. });
  17933. onMounted(() => {
  17934. idUnwatch = watch([toRef(props, "id"), disableIdGeneration], ([id, disableIdGeneration2]) => {
  17935. const newId = id != null ? id : !disableIdGeneration2 ? useId().value : void 0;
  17936. if (newId !== inputId.value) {
  17937. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  17938. inputId.value && formItemContext.removeInputId(inputId.value);
  17939. if (!(disableIdManagement == null ? void 0 : disableIdManagement.value) && !disableIdGeneration2 && newId) {
  17940. formItemContext.addInputId(newId);
  17941. }
  17942. }
  17943. inputId.value = newId;
  17944. }
  17945. }, { immediate: true });
  17946. });
  17947. onUnmounted(() => {
  17948. idUnwatch && idUnwatch();
  17949. if (formItemContext == null ? void 0 : formItemContext.removeInputId) {
  17950. inputId.value && formItemContext.removeInputId(inputId.value);
  17951. }
  17952. });
  17953. return {
  17954. isLabeledByFormItem,
  17955. inputId
  17956. };
  17957. };
  17958. let hiddenTextarea = void 0;
  17959. const HIDDEN_STYLE = `
  17960. height:0 !important;
  17961. visibility:hidden !important;
  17962. ${isFirefox() ? "" : "overflow:hidden !important;"}
  17963. position:absolute !important;
  17964. z-index:-1000 !important;
  17965. top:0 !important;
  17966. right:0 !important;
  17967. `;
  17968. const CONTEXT_STYLE = [
  17969. "letter-spacing",
  17970. "line-height",
  17971. "padding-top",
  17972. "padding-bottom",
  17973. "font-family",
  17974. "font-weight",
  17975. "font-size",
  17976. "text-rendering",
  17977. "text-transform",
  17978. "width",
  17979. "text-indent",
  17980. "padding-left",
  17981. "padding-right",
  17982. "border-width",
  17983. "box-sizing"
  17984. ];
  17985. function calculateNodeStyling(targetElement) {
  17986. const style = window.getComputedStyle(targetElement);
  17987. const boxSizing = style.getPropertyValue("box-sizing");
  17988. const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
  17989. const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
  17990. const contextStyle = CONTEXT_STYLE.map((name) => `${name}:${style.getPropertyValue(name)}`).join(";");
  17991. return { contextStyle, paddingSize, borderSize, boxSizing };
  17992. }
  17993. function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
  17994. var _a2;
  17995. if (!hiddenTextarea) {
  17996. hiddenTextarea = document.createElement("textarea");
  17997. document.body.appendChild(hiddenTextarea);
  17998. }
  17999. const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
  18000. hiddenTextarea.setAttribute("style", `${contextStyle};${HIDDEN_STYLE}`);
  18001. hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
  18002. let height2 = hiddenTextarea.scrollHeight;
  18003. const result = {};
  18004. if (boxSizing === "border-box") {
  18005. height2 = height2 + borderSize;
  18006. } else if (boxSizing === "content-box") {
  18007. height2 = height2 - paddingSize;
  18008. }
  18009. hiddenTextarea.value = "";
  18010. const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
  18011. if (isNumber(minRows)) {
  18012. let minHeight = singleRowHeight * minRows;
  18013. if (boxSizing === "border-box") {
  18014. minHeight = minHeight + paddingSize + borderSize;
  18015. }
  18016. height2 = Math.max(minHeight, height2);
  18017. result.minHeight = `${minHeight}px`;
  18018. }
  18019. if (isNumber(maxRows)) {
  18020. let maxHeight = singleRowHeight * maxRows;
  18021. if (boxSizing === "border-box") {
  18022. maxHeight = maxHeight + paddingSize + borderSize;
  18023. }
  18024. height2 = Math.min(maxHeight, height2);
  18025. }
  18026. result.height = `${height2}px`;
  18027. (_a2 = hiddenTextarea.parentNode) == null ? void 0 : _a2.removeChild(hiddenTextarea);
  18028. hiddenTextarea = void 0;
  18029. return result;
  18030. }
  18031. const inputProps = buildProps({
  18032. id: {
  18033. type: String,
  18034. default: void 0
  18035. },
  18036. size: useSizeProp,
  18037. disabled: Boolean,
  18038. modelValue: {
  18039. type: definePropType([
  18040. String,
  18041. Number,
  18042. Object
  18043. ]),
  18044. default: ""
  18045. },
  18046. type: {
  18047. type: String,
  18048. default: "text"
  18049. },
  18050. resize: {
  18051. type: String,
  18052. values: ["none", "both", "horizontal", "vertical"]
  18053. },
  18054. autosize: {
  18055. type: definePropType([Boolean, Object]),
  18056. default: false
  18057. },
  18058. autocomplete: {
  18059. type: String,
  18060. default: "off"
  18061. },
  18062. formatter: {
  18063. type: Function
  18064. },
  18065. parser: {
  18066. type: Function
  18067. },
  18068. placeholder: {
  18069. type: String
  18070. },
  18071. form: {
  18072. type: String
  18073. },
  18074. readonly: {
  18075. type: Boolean,
  18076. default: false
  18077. },
  18078. clearable: {
  18079. type: Boolean,
  18080. default: false
  18081. },
  18082. showPassword: {
  18083. type: Boolean,
  18084. default: false
  18085. },
  18086. showWordLimit: {
  18087. type: Boolean,
  18088. default: false
  18089. },
  18090. suffixIcon: {
  18091. type: iconPropType
  18092. },
  18093. prefixIcon: {
  18094. type: iconPropType
  18095. },
  18096. containerRole: {
  18097. type: String,
  18098. default: void 0
  18099. },
  18100. label: {
  18101. type: String,
  18102. default: void 0
  18103. },
  18104. tabindex: {
  18105. type: [String, Number],
  18106. default: 0
  18107. },
  18108. validateEvent: {
  18109. type: Boolean,
  18110. default: true
  18111. },
  18112. inputStyle: {
  18113. type: definePropType([Object, Array, String]),
  18114. default: () => mutable({})
  18115. }
  18116. });
  18117. const inputEmits = {
  18118. [UPDATE_MODEL_EVENT]: (value) => isString(value),
  18119. input: (value) => isString(value),
  18120. change: (value) => isString(value),
  18121. focus: (evt) => evt instanceof FocusEvent,
  18122. blur: (evt) => evt instanceof FocusEvent,
  18123. clear: () => true,
  18124. mouseleave: (evt) => evt instanceof MouseEvent,
  18125. mouseenter: (evt) => evt instanceof MouseEvent,
  18126. keydown: (evt) => evt instanceof Event,
  18127. compositionstart: (evt) => evt instanceof CompositionEvent,
  18128. compositionupdate: (evt) => evt instanceof CompositionEvent,
  18129. compositionend: (evt) => evt instanceof CompositionEvent
  18130. };
  18131. const _hoisted_1$g = ["role"];
  18132. const _hoisted_2$a = ["id", "type", "disabled", "formatter", "parser", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form"];
  18133. const _hoisted_3$6 = ["id", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form"];
  18134. const __default__$n = defineComponent({
  18135. name: "ElInput",
  18136. inheritAttrs: false
  18137. });
  18138. const _sfc_main$A = /* @__PURE__ */ defineComponent({
  18139. ...__default__$n,
  18140. props: inputProps,
  18141. emits: inputEmits,
  18142. setup(__props, { expose, emit }) {
  18143. const props = __props;
  18144. const rawAttrs = useAttrs$1();
  18145. const slots = useSlots();
  18146. const containerAttrs = computed$1(() => {
  18147. const comboBoxAttrs = {};
  18148. if (props.containerRole === "combobox") {
  18149. comboBoxAttrs["aria-haspopup"] = rawAttrs["aria-haspopup"];
  18150. comboBoxAttrs["aria-owns"] = rawAttrs["aria-owns"];
  18151. comboBoxAttrs["aria-expanded"] = rawAttrs["aria-expanded"];
  18152. }
  18153. return comboBoxAttrs;
  18154. });
  18155. const containerKls = computed$1(() => [
  18156. props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
  18157. nsInput.m(inputSize.value),
  18158. nsInput.is("disabled", inputDisabled.value),
  18159. nsInput.is("exceed", inputExceed.value),
  18160. {
  18161. [nsInput.b("group")]: slots.prepend || slots.append,
  18162. [nsInput.bm("group", "append")]: slots.append,
  18163. [nsInput.bm("group", "prepend")]: slots.prepend,
  18164. [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
  18165. [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
  18166. [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value
  18167. },
  18168. rawAttrs.class
  18169. ]);
  18170. const wrapperKls = computed$1(() => [
  18171. nsInput.e("wrapper"),
  18172. nsInput.is("focus", focused.value)
  18173. ]);
  18174. const attrs = useAttrs({
  18175. excludeKeys: computed$1(() => {
  18176. return Object.keys(containerAttrs.value);
  18177. })
  18178. });
  18179. const { form, formItem } = useFormItem();
  18180. const { inputId } = useFormItemInputId(props, {
  18181. formItemContext: formItem
  18182. });
  18183. const inputSize = useFormSize();
  18184. const inputDisabled = useFormDisabled();
  18185. const nsInput = useNamespace("input");
  18186. const nsTextarea = useNamespace("textarea");
  18187. const input = shallowRef();
  18188. const textarea = shallowRef();
  18189. const focused = ref(false);
  18190. const hovering = ref(false);
  18191. const isComposing = ref(false);
  18192. const passwordVisible = ref(false);
  18193. const countStyle = ref();
  18194. const textareaCalcStyle = shallowRef(props.inputStyle);
  18195. const _ref = computed$1(() => input.value || textarea.value);
  18196. const needStatusIcon = computed$1(() => {
  18197. var _a2;
  18198. return (_a2 = form == null ? void 0 : form.statusIcon) != null ? _a2 : false;
  18199. });
  18200. const validateState = computed$1(() => (formItem == null ? void 0 : formItem.validateState) || "");
  18201. const validateIcon = computed$1(() => validateState.value && ValidateComponentsMap[validateState.value]);
  18202. const passwordIcon = computed$1(() => passwordVisible.value ? view_default : hide_default);
  18203. const containerStyle = computed$1(() => [
  18204. rawAttrs.style,
  18205. props.inputStyle
  18206. ]);
  18207. const textareaStyle = computed$1(() => [
  18208. props.inputStyle,
  18209. textareaCalcStyle.value,
  18210. { resize: props.resize }
  18211. ]);
  18212. const nativeInputValue = computed$1(() => isNil(props.modelValue) ? "" : String(props.modelValue));
  18213. const showClear = computed$1(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (focused.value || hovering.value));
  18214. const showPwdVisible = computed$1(() => props.showPassword && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (!!nativeInputValue.value || focused.value));
  18215. const isWordLimitVisible = computed$1(() => props.showWordLimit && !!attrs.value.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
  18216. const textLength = computed$1(() => nativeInputValue.value.length);
  18217. const inputExceed = computed$1(() => !!isWordLimitVisible.value && textLength.value > Number(attrs.value.maxlength));
  18218. const suffixVisible = computed$1(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
  18219. const [recordCursor, setCursor] = useCursor(input);
  18220. useResizeObserver(textarea, (entries) => {
  18221. onceInitSizeTextarea();
  18222. if (!isWordLimitVisible.value || props.resize !== "both")
  18223. return;
  18224. const entry = entries[0];
  18225. const { width: width2 } = entry.contentRect;
  18226. countStyle.value = {
  18227. right: `calc(100% - ${width2 + 15 + 6}px)`
  18228. };
  18229. });
  18230. const resizeTextarea = () => {
  18231. const { type: type2, autosize } = props;
  18232. if (!isClient || type2 !== "textarea" || !textarea.value)
  18233. return;
  18234. if (autosize) {
  18235. const minRows = isObject$5(autosize) ? autosize.minRows : void 0;
  18236. const maxRows = isObject$5(autosize) ? autosize.maxRows : void 0;
  18237. const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
  18238. textareaCalcStyle.value = {
  18239. overflowY: "hidden",
  18240. ...textareaStyle2
  18241. };
  18242. nextTick(() => {
  18243. textarea.value.offsetHeight;
  18244. textareaCalcStyle.value = textareaStyle2;
  18245. });
  18246. } else {
  18247. textareaCalcStyle.value = {
  18248. minHeight: calcTextareaHeight(textarea.value).minHeight
  18249. };
  18250. }
  18251. };
  18252. const createOnceInitResize = (resizeTextarea2) => {
  18253. let isInit = false;
  18254. return () => {
  18255. var _a2;
  18256. if (isInit || !props.autosize)
  18257. return;
  18258. const isElHidden = ((_a2 = textarea.value) == null ? void 0 : _a2.offsetParent) === null;
  18259. if (!isElHidden) {
  18260. resizeTextarea2();
  18261. isInit = true;
  18262. }
  18263. };
  18264. };
  18265. const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
  18266. const setNativeInputValue = () => {
  18267. const input2 = _ref.value;
  18268. if (!input2 || input2.value === nativeInputValue.value)
  18269. return;
  18270. input2.value = nativeInputValue.value;
  18271. };
  18272. const handleInput = async (event2) => {
  18273. recordCursor();
  18274. let { value } = event2.target;
  18275. if (props.formatter) {
  18276. value = props.parser ? props.parser(value) : value;
  18277. value = props.formatter(value);
  18278. }
  18279. if (isComposing.value)
  18280. return;
  18281. if (value === nativeInputValue.value) {
  18282. setNativeInputValue();
  18283. return;
  18284. }
  18285. emit(UPDATE_MODEL_EVENT, value);
  18286. emit("input", value);
  18287. await nextTick();
  18288. setNativeInputValue();
  18289. setCursor();
  18290. };
  18291. const handleChange = (event2) => {
  18292. emit("change", event2.target.value);
  18293. };
  18294. const handleCompositionStart = (event2) => {
  18295. emit("compositionstart", event2);
  18296. isComposing.value = true;
  18297. };
  18298. const handleCompositionUpdate = (event2) => {
  18299. var _a2;
  18300. emit("compositionupdate", event2);
  18301. const text = (_a2 = event2.target) == null ? void 0 : _a2.value;
  18302. const lastCharacter = text[text.length - 1] || "";
  18303. isComposing.value = !isKorean(lastCharacter);
  18304. };
  18305. const handleCompositionEnd = (event2) => {
  18306. emit("compositionend", event2);
  18307. if (isComposing.value) {
  18308. isComposing.value = false;
  18309. handleInput(event2);
  18310. }
  18311. };
  18312. const handlePasswordVisible = () => {
  18313. passwordVisible.value = !passwordVisible.value;
  18314. focus();
  18315. };
  18316. const focus = async () => {
  18317. var _a2;
  18318. await nextTick();
  18319. (_a2 = _ref.value) == null ? void 0 : _a2.focus();
  18320. };
  18321. const blur = () => {
  18322. var _a2;
  18323. return (_a2 = _ref.value) == null ? void 0 : _a2.blur();
  18324. };
  18325. const handleFocus = (event2) => {
  18326. focused.value = true;
  18327. emit("focus", event2);
  18328. };
  18329. const handleBlur = (event2) => {
  18330. var _a2;
  18331. focused.value = false;
  18332. emit("blur", event2);
  18333. if (props.validateEvent) {
  18334. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  18335. }
  18336. };
  18337. const handleMouseLeave = (evt) => {
  18338. hovering.value = false;
  18339. emit("mouseleave", evt);
  18340. };
  18341. const handleMouseEnter = (evt) => {
  18342. hovering.value = true;
  18343. emit("mouseenter", evt);
  18344. };
  18345. const handleKeydown = (evt) => {
  18346. emit("keydown", evt);
  18347. };
  18348. const select = () => {
  18349. var _a2;
  18350. (_a2 = _ref.value) == null ? void 0 : _a2.select();
  18351. };
  18352. const clear = () => {
  18353. emit(UPDATE_MODEL_EVENT, "");
  18354. emit("change", "");
  18355. emit("clear");
  18356. emit("input", "");
  18357. };
  18358. watch(() => props.modelValue, () => {
  18359. var _a2;
  18360. nextTick(() => resizeTextarea());
  18361. if (props.validateEvent) {
  18362. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  18363. }
  18364. });
  18365. watch(nativeInputValue, () => setNativeInputValue());
  18366. watch(() => props.type, async () => {
  18367. await nextTick();
  18368. setNativeInputValue();
  18369. resizeTextarea();
  18370. });
  18371. onMounted(() => {
  18372. if (!props.formatter && props.parser)
  18373. ;
  18374. setNativeInputValue();
  18375. nextTick(resizeTextarea);
  18376. });
  18377. expose({
  18378. input,
  18379. textarea,
  18380. ref: _ref,
  18381. textareaStyle,
  18382. autosize: toRef(props, "autosize"),
  18383. focus,
  18384. blur,
  18385. select,
  18386. clear,
  18387. resizeTextarea
  18388. });
  18389. return (_ctx, _cache) => {
  18390. return withDirectives((openBlock(), createElementBlock("div", mergeProps(unref(containerAttrs), {
  18391. class: unref(containerKls),
  18392. style: unref(containerStyle),
  18393. role: _ctx.containerRole,
  18394. onMouseenter: handleMouseEnter,
  18395. onMouseleave: handleMouseLeave
  18396. }), [
  18397. createCommentVNode(" input "),
  18398. _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  18399. createCommentVNode(" prepend slot "),
  18400. _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
  18401. key: 0,
  18402. class: normalizeClass(unref(nsInput).be("group", "prepend"))
  18403. }, [
  18404. renderSlot(_ctx.$slots, "prepend")
  18405. ], 2)) : createCommentVNode("v-if", true),
  18406. createElementVNode("div", {
  18407. class: normalizeClass(unref(wrapperKls))
  18408. }, [
  18409. createCommentVNode(" prefix slot "),
  18410. _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
  18411. key: 0,
  18412. class: normalizeClass(unref(nsInput).e("prefix"))
  18413. }, [
  18414. createElementVNode("span", {
  18415. class: normalizeClass(unref(nsInput).e("prefix-inner")),
  18416. onClick: focus
  18417. }, [
  18418. renderSlot(_ctx.$slots, "prefix"),
  18419. _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  18420. key: 0,
  18421. class: normalizeClass(unref(nsInput).e("icon"))
  18422. }, {
  18423. default: withCtx(() => [
  18424. (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
  18425. ]),
  18426. _: 1
  18427. }, 8, ["class"])) : createCommentVNode("v-if", true)
  18428. ], 2)
  18429. ], 2)) : createCommentVNode("v-if", true),
  18430. createElementVNode("input", mergeProps({
  18431. id: unref(inputId),
  18432. ref_key: "input",
  18433. ref: input,
  18434. class: unref(nsInput).e("inner")
  18435. }, unref(attrs), {
  18436. type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
  18437. disabled: unref(inputDisabled),
  18438. formatter: _ctx.formatter,
  18439. parser: _ctx.parser,
  18440. readonly: _ctx.readonly,
  18441. autocomplete: _ctx.autocomplete,
  18442. tabindex: _ctx.tabindex,
  18443. "aria-label": _ctx.label,
  18444. placeholder: _ctx.placeholder,
  18445. style: _ctx.inputStyle,
  18446. form: props.form,
  18447. onCompositionstart: handleCompositionStart,
  18448. onCompositionupdate: handleCompositionUpdate,
  18449. onCompositionend: handleCompositionEnd,
  18450. onInput: handleInput,
  18451. onFocus: handleFocus,
  18452. onBlur: handleBlur,
  18453. onChange: handleChange,
  18454. onKeydown: handleKeydown
  18455. }), null, 16, _hoisted_2$a),
  18456. createCommentVNode(" suffix slot "),
  18457. unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
  18458. key: 1,
  18459. class: normalizeClass(unref(nsInput).e("suffix"))
  18460. }, [
  18461. createElementVNode("span", {
  18462. class: normalizeClass(unref(nsInput).e("suffix-inner")),
  18463. onClick: focus
  18464. }, [
  18465. !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  18466. renderSlot(_ctx.$slots, "suffix"),
  18467. _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
  18468. key: 0,
  18469. class: normalizeClass(unref(nsInput).e("icon"))
  18470. }, {
  18471. default: withCtx(() => [
  18472. (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
  18473. ]),
  18474. _: 1
  18475. }, 8, ["class"])) : createCommentVNode("v-if", true)
  18476. ], 64)) : createCommentVNode("v-if", true),
  18477. unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
  18478. key: 1,
  18479. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
  18480. onMousedown: withModifiers(unref(NOOP), ["prevent"]),
  18481. onClick: clear
  18482. }, {
  18483. default: withCtx(() => [
  18484. createVNode(unref(circle_close_default))
  18485. ]),
  18486. _: 1
  18487. }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
  18488. unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
  18489. key: 2,
  18490. class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
  18491. onClick: handlePasswordVisible
  18492. }, {
  18493. default: withCtx(() => [
  18494. (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
  18495. ]),
  18496. _: 1
  18497. }, 8, ["class"])) : createCommentVNode("v-if", true),
  18498. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  18499. key: 3,
  18500. class: normalizeClass(unref(nsInput).e("count"))
  18501. }, [
  18502. createElementVNode("span", {
  18503. class: normalizeClass(unref(nsInput).e("count-inner"))
  18504. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 3)
  18505. ], 2)) : createCommentVNode("v-if", true),
  18506. unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
  18507. key: 4,
  18508. class: normalizeClass([
  18509. unref(nsInput).e("icon"),
  18510. unref(nsInput).e("validateIcon"),
  18511. unref(nsInput).is("loading", unref(validateState) === "validating")
  18512. ])
  18513. }, {
  18514. default: withCtx(() => [
  18515. (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
  18516. ]),
  18517. _: 1
  18518. }, 8, ["class"])) : createCommentVNode("v-if", true)
  18519. ], 2)
  18520. ], 2)) : createCommentVNode("v-if", true)
  18521. ], 2),
  18522. createCommentVNode(" append slot "),
  18523. _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
  18524. key: 1,
  18525. class: normalizeClass(unref(nsInput).be("group", "append"))
  18526. }, [
  18527. renderSlot(_ctx.$slots, "append")
  18528. ], 2)) : createCommentVNode("v-if", true)
  18529. ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
  18530. createCommentVNode(" textarea "),
  18531. createElementVNode("textarea", mergeProps({
  18532. id: unref(inputId),
  18533. ref_key: "textarea",
  18534. ref: textarea,
  18535. class: unref(nsTextarea).e("inner")
  18536. }, unref(attrs), {
  18537. tabindex: _ctx.tabindex,
  18538. disabled: unref(inputDisabled),
  18539. readonly: _ctx.readonly,
  18540. autocomplete: _ctx.autocomplete,
  18541. style: unref(textareaStyle),
  18542. "aria-label": _ctx.label,
  18543. placeholder: _ctx.placeholder,
  18544. form: props.form,
  18545. onCompositionstart: handleCompositionStart,
  18546. onCompositionupdate: handleCompositionUpdate,
  18547. onCompositionend: handleCompositionEnd,
  18548. onInput: handleInput,
  18549. onFocus: handleFocus,
  18550. onBlur: handleBlur,
  18551. onChange: handleChange,
  18552. onKeydown: handleKeydown
  18553. }), null, 16, _hoisted_3$6),
  18554. unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
  18555. key: 0,
  18556. style: normalizeStyle(countStyle.value),
  18557. class: normalizeClass(unref(nsInput).e("count"))
  18558. }, toDisplayString(unref(textLength)) + " / " + toDisplayString(unref(attrs).maxlength), 7)) : createCommentVNode("v-if", true)
  18559. ], 64))
  18560. ], 16, _hoisted_1$g)), [
  18561. [vShow, _ctx.type !== "hidden"]
  18562. ]);
  18563. };
  18564. }
  18565. });
  18566. var Input = /* @__PURE__ */ _export_sfc$1(_sfc_main$A, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
  18567. const ElInput = withInstall(Input);
  18568. const GAP = 4;
  18569. const BAR_MAP = {
  18570. vertical: {
  18571. offset: "offsetHeight",
  18572. scroll: "scrollTop",
  18573. scrollSize: "scrollHeight",
  18574. size: "height",
  18575. key: "vertical",
  18576. axis: "Y",
  18577. client: "clientY",
  18578. direction: "top"
  18579. },
  18580. horizontal: {
  18581. offset: "offsetWidth",
  18582. scroll: "scrollLeft",
  18583. scrollSize: "scrollWidth",
  18584. size: "width",
  18585. key: "horizontal",
  18586. axis: "X",
  18587. client: "clientX",
  18588. direction: "left"
  18589. }
  18590. };
  18591. const renderThumbStyle = ({
  18592. move,
  18593. size,
  18594. bar
  18595. }) => ({
  18596. [bar.size]: size,
  18597. transform: `translate${bar.axis}(${move}%)`
  18598. });
  18599. const scrollbarContextKey = Symbol("scrollbarContextKey");
  18600. const thumbProps = buildProps({
  18601. vertical: Boolean,
  18602. size: String,
  18603. move: Number,
  18604. ratio: {
  18605. type: Number,
  18606. required: true
  18607. },
  18608. always: Boolean
  18609. });
  18610. const COMPONENT_NAME$4 = "Thumb";
  18611. const _sfc_main$z = /* @__PURE__ */ defineComponent({
  18612. __name: "thumb",
  18613. props: thumbProps,
  18614. setup(__props) {
  18615. const props = __props;
  18616. const scrollbar = inject(scrollbarContextKey);
  18617. const ns = useNamespace("scrollbar");
  18618. if (!scrollbar)
  18619. throwError(COMPONENT_NAME$4, "can not inject scrollbar context");
  18620. const instance = ref();
  18621. const thumb = ref();
  18622. const thumbState = ref({});
  18623. const visible = ref(false);
  18624. let cursorDown = false;
  18625. let cursorLeave = false;
  18626. let originalOnSelectStart = isClient ? document.onselectstart : null;
  18627. const bar = computed$1(() => BAR_MAP[props.vertical ? "vertical" : "horizontal"]);
  18628. const thumbStyle = computed$1(() => renderThumbStyle({
  18629. size: props.size,
  18630. move: props.move,
  18631. bar: bar.value
  18632. }));
  18633. const offsetRatio = computed$1(() => instance.value[bar.value.offset] ** 2 / scrollbar.wrapElement[bar.value.scrollSize] / props.ratio / thumb.value[bar.value.offset]);
  18634. const clickThumbHandler = (e) => {
  18635. var _a2;
  18636. e.stopPropagation();
  18637. if (e.ctrlKey || [1, 2].includes(e.button))
  18638. return;
  18639. (_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges();
  18640. startDrag(e);
  18641. const el = e.currentTarget;
  18642. if (!el)
  18643. return;
  18644. thumbState.value[bar.value.axis] = el[bar.value.offset] - (e[bar.value.client] - el.getBoundingClientRect()[bar.value.direction]);
  18645. };
  18646. const clickTrackHandler = (e) => {
  18647. if (!thumb.value || !instance.value || !scrollbar.wrapElement)
  18648. return;
  18649. const offset = Math.abs(e.target.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]);
  18650. const thumbHalf = thumb.value[bar.value.offset] / 2;
  18651. const thumbPositionPercentage = (offset - thumbHalf) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  18652. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  18653. };
  18654. const startDrag = (e) => {
  18655. e.stopImmediatePropagation();
  18656. cursorDown = true;
  18657. document.addEventListener("mousemove", mouseMoveDocumentHandler);
  18658. document.addEventListener("mouseup", mouseUpDocumentHandler);
  18659. originalOnSelectStart = document.onselectstart;
  18660. document.onselectstart = () => false;
  18661. };
  18662. const mouseMoveDocumentHandler = (e) => {
  18663. if (!instance.value || !thumb.value)
  18664. return;
  18665. if (cursorDown === false)
  18666. return;
  18667. const prevPage = thumbState.value[bar.value.axis];
  18668. if (!prevPage)
  18669. return;
  18670. const offset = (instance.value.getBoundingClientRect()[bar.value.direction] - e[bar.value.client]) * -1;
  18671. const thumbClickPosition = thumb.value[bar.value.offset] - prevPage;
  18672. const thumbPositionPercentage = (offset - thumbClickPosition) * 100 * offsetRatio.value / instance.value[bar.value.offset];
  18673. scrollbar.wrapElement[bar.value.scroll] = thumbPositionPercentage * scrollbar.wrapElement[bar.value.scrollSize] / 100;
  18674. };
  18675. const mouseUpDocumentHandler = () => {
  18676. cursorDown = false;
  18677. thumbState.value[bar.value.axis] = 0;
  18678. document.removeEventListener("mousemove", mouseMoveDocumentHandler);
  18679. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  18680. restoreOnselectstart();
  18681. if (cursorLeave)
  18682. visible.value = false;
  18683. };
  18684. const mouseMoveScrollbarHandler = () => {
  18685. cursorLeave = false;
  18686. visible.value = !!props.size;
  18687. };
  18688. const mouseLeaveScrollbarHandler = () => {
  18689. cursorLeave = true;
  18690. visible.value = cursorDown;
  18691. };
  18692. onBeforeUnmount(() => {
  18693. restoreOnselectstart();
  18694. document.removeEventListener("mouseup", mouseUpDocumentHandler);
  18695. });
  18696. const restoreOnselectstart = () => {
  18697. if (document.onselectstart !== originalOnSelectStart)
  18698. document.onselectstart = originalOnSelectStart;
  18699. };
  18700. useEventListener(toRef(scrollbar, "scrollbarElement"), "mousemove", mouseMoveScrollbarHandler);
  18701. useEventListener(toRef(scrollbar, "scrollbarElement"), "mouseleave", mouseLeaveScrollbarHandler);
  18702. return (_ctx, _cache) => {
  18703. return openBlock(), createBlock(Transition, {
  18704. name: unref(ns).b("fade"),
  18705. persisted: ""
  18706. }, {
  18707. default: withCtx(() => [
  18708. withDirectives(createElementVNode("div", {
  18709. ref_key: "instance",
  18710. ref: instance,
  18711. class: normalizeClass([unref(ns).e("bar"), unref(ns).is(unref(bar).key)]),
  18712. onMousedown: clickTrackHandler
  18713. }, [
  18714. createElementVNode("div", {
  18715. ref_key: "thumb",
  18716. ref: thumb,
  18717. class: normalizeClass(unref(ns).e("thumb")),
  18718. style: normalizeStyle(unref(thumbStyle)),
  18719. onMousedown: clickThumbHandler
  18720. }, null, 38)
  18721. ], 34), [
  18722. [vShow, _ctx.always || visible.value]
  18723. ])
  18724. ]),
  18725. _: 1
  18726. }, 8, ["name"]);
  18727. };
  18728. }
  18729. });
  18730. var Thumb = /* @__PURE__ */ _export_sfc$1(_sfc_main$z, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/thumb.vue"]]);
  18731. const barProps = buildProps({
  18732. always: {
  18733. type: Boolean,
  18734. default: true
  18735. },
  18736. width: String,
  18737. height: String,
  18738. ratioX: {
  18739. type: Number,
  18740. default: 1
  18741. },
  18742. ratioY: {
  18743. type: Number,
  18744. default: 1
  18745. }
  18746. });
  18747. const _sfc_main$y = /* @__PURE__ */ defineComponent({
  18748. __name: "bar",
  18749. props: barProps,
  18750. setup(__props, { expose }) {
  18751. const props = __props;
  18752. const moveX = ref(0);
  18753. const moveY = ref(0);
  18754. const handleScroll = (wrap) => {
  18755. if (wrap) {
  18756. const offsetHeight = wrap.offsetHeight - GAP;
  18757. const offsetWidth = wrap.offsetWidth - GAP;
  18758. moveY.value = wrap.scrollTop * 100 / offsetHeight * props.ratioY;
  18759. moveX.value = wrap.scrollLeft * 100 / offsetWidth * props.ratioX;
  18760. }
  18761. };
  18762. expose({
  18763. handleScroll
  18764. });
  18765. return (_ctx, _cache) => {
  18766. return openBlock(), createElementBlock(Fragment, null, [
  18767. createVNode(Thumb, {
  18768. move: moveX.value,
  18769. ratio: _ctx.ratioX,
  18770. size: _ctx.width,
  18771. always: _ctx.always
  18772. }, null, 8, ["move", "ratio", "size", "always"]),
  18773. createVNode(Thumb, {
  18774. move: moveY.value,
  18775. ratio: _ctx.ratioY,
  18776. size: _ctx.height,
  18777. vertical: "",
  18778. always: _ctx.always
  18779. }, null, 8, ["move", "ratio", "size", "always"])
  18780. ], 64);
  18781. };
  18782. }
  18783. });
  18784. var Bar = /* @__PURE__ */ _export_sfc$1(_sfc_main$y, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/bar.vue"]]);
  18785. const scrollbarProps = buildProps({
  18786. height: {
  18787. type: [String, Number],
  18788. default: ""
  18789. },
  18790. maxHeight: {
  18791. type: [String, Number],
  18792. default: ""
  18793. },
  18794. native: {
  18795. type: Boolean,
  18796. default: false
  18797. },
  18798. wrapStyle: {
  18799. type: definePropType([String, Object, Array]),
  18800. default: ""
  18801. },
  18802. wrapClass: {
  18803. type: [String, Array],
  18804. default: ""
  18805. },
  18806. viewClass: {
  18807. type: [String, Array],
  18808. default: ""
  18809. },
  18810. viewStyle: {
  18811. type: [String, Array, Object],
  18812. default: ""
  18813. },
  18814. noresize: Boolean,
  18815. tag: {
  18816. type: String,
  18817. default: "div"
  18818. },
  18819. always: Boolean,
  18820. minSize: {
  18821. type: Number,
  18822. default: 20
  18823. }
  18824. });
  18825. const scrollbarEmits = {
  18826. scroll: ({
  18827. scrollTop,
  18828. scrollLeft
  18829. }) => [scrollTop, scrollLeft].every(isNumber)
  18830. };
  18831. const COMPONENT_NAME$3 = "ElScrollbar";
  18832. const __default__$m = defineComponent({
  18833. name: COMPONENT_NAME$3
  18834. });
  18835. const _sfc_main$x = /* @__PURE__ */ defineComponent({
  18836. ...__default__$m,
  18837. props: scrollbarProps,
  18838. emits: scrollbarEmits,
  18839. setup(__props, { expose, emit }) {
  18840. const props = __props;
  18841. const ns = useNamespace("scrollbar");
  18842. let stopResizeObserver = void 0;
  18843. let stopResizeListener = void 0;
  18844. const scrollbarRef = ref();
  18845. const wrapRef = ref();
  18846. const resizeRef = ref();
  18847. const sizeWidth = ref("0");
  18848. const sizeHeight = ref("0");
  18849. const barRef = ref();
  18850. const ratioY = ref(1);
  18851. const ratioX = ref(1);
  18852. const style = computed$1(() => {
  18853. const style2 = {};
  18854. if (props.height)
  18855. style2.height = addUnit(props.height);
  18856. if (props.maxHeight)
  18857. style2.maxHeight = addUnit(props.maxHeight);
  18858. return [props.wrapStyle, style2];
  18859. });
  18860. const wrapKls = computed$1(() => {
  18861. return [
  18862. props.wrapClass,
  18863. ns.e("wrap"),
  18864. { [ns.em("wrap", "hidden-default")]: !props.native }
  18865. ];
  18866. });
  18867. const resizeKls = computed$1(() => {
  18868. return [ns.e("view"), props.viewClass];
  18869. });
  18870. const handleScroll = () => {
  18871. var _a2;
  18872. if (wrapRef.value) {
  18873. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrapRef.value);
  18874. emit("scroll", {
  18875. scrollTop: wrapRef.value.scrollTop,
  18876. scrollLeft: wrapRef.value.scrollLeft
  18877. });
  18878. }
  18879. };
  18880. function scrollTo(arg1, arg2) {
  18881. if (isObject$5(arg1)) {
  18882. wrapRef.value.scrollTo(arg1);
  18883. } else if (isNumber(arg1) && isNumber(arg2)) {
  18884. wrapRef.value.scrollTo(arg1, arg2);
  18885. }
  18886. }
  18887. const setScrollTop = (value) => {
  18888. if (!isNumber(value)) {
  18889. return;
  18890. }
  18891. wrapRef.value.scrollTop = value;
  18892. };
  18893. const setScrollLeft = (value) => {
  18894. if (!isNumber(value)) {
  18895. return;
  18896. }
  18897. wrapRef.value.scrollLeft = value;
  18898. };
  18899. const update = () => {
  18900. if (!wrapRef.value)
  18901. return;
  18902. const offsetHeight = wrapRef.value.offsetHeight - GAP;
  18903. const offsetWidth = wrapRef.value.offsetWidth - GAP;
  18904. const originalHeight = offsetHeight ** 2 / wrapRef.value.scrollHeight;
  18905. const originalWidth = offsetWidth ** 2 / wrapRef.value.scrollWidth;
  18906. const height2 = Math.max(originalHeight, props.minSize);
  18907. const width2 = Math.max(originalWidth, props.minSize);
  18908. ratioY.value = originalHeight / (offsetHeight - originalHeight) / (height2 / (offsetHeight - height2));
  18909. ratioX.value = originalWidth / (offsetWidth - originalWidth) / (width2 / (offsetWidth - width2));
  18910. sizeHeight.value = height2 + GAP < offsetHeight ? `${height2}px` : "";
  18911. sizeWidth.value = width2 + GAP < offsetWidth ? `${width2}px` : "";
  18912. };
  18913. watch(() => props.noresize, (noresize) => {
  18914. if (noresize) {
  18915. stopResizeObserver == null ? void 0 : stopResizeObserver();
  18916. stopResizeListener == null ? void 0 : stopResizeListener();
  18917. } else {
  18918. ({ stop: stopResizeObserver } = useResizeObserver(resizeRef, update));
  18919. stopResizeListener = useEventListener("resize", update);
  18920. }
  18921. }, { immediate: true });
  18922. watch(() => [props.maxHeight, props.height], () => {
  18923. if (!props.native)
  18924. nextTick(() => {
  18925. var _a2;
  18926. update();
  18927. if (wrapRef.value) {
  18928. (_a2 = barRef.value) == null ? void 0 : _a2.handleScroll(wrapRef.value);
  18929. }
  18930. });
  18931. });
  18932. provide(scrollbarContextKey, reactive({
  18933. scrollbarElement: scrollbarRef,
  18934. wrapElement: wrapRef
  18935. }));
  18936. onMounted(() => {
  18937. if (!props.native)
  18938. nextTick(() => {
  18939. update();
  18940. });
  18941. });
  18942. onUpdated(() => update());
  18943. expose({
  18944. wrapRef,
  18945. update,
  18946. scrollTo,
  18947. setScrollTop,
  18948. setScrollLeft,
  18949. handleScroll
  18950. });
  18951. return (_ctx, _cache) => {
  18952. return openBlock(), createElementBlock("div", {
  18953. ref_key: "scrollbarRef",
  18954. ref: scrollbarRef,
  18955. class: normalizeClass(unref(ns).b())
  18956. }, [
  18957. createElementVNode("div", {
  18958. ref_key: "wrapRef",
  18959. ref: wrapRef,
  18960. class: normalizeClass(unref(wrapKls)),
  18961. style: normalizeStyle(unref(style)),
  18962. onScroll: handleScroll
  18963. }, [
  18964. (openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), {
  18965. ref_key: "resizeRef",
  18966. ref: resizeRef,
  18967. class: normalizeClass(unref(resizeKls)),
  18968. style: normalizeStyle(_ctx.viewStyle)
  18969. }, {
  18970. default: withCtx(() => [
  18971. renderSlot(_ctx.$slots, "default")
  18972. ]),
  18973. _: 3
  18974. }, 8, ["class", "style"]))
  18975. ], 38),
  18976. !_ctx.native ? (openBlock(), createBlock(Bar, {
  18977. key: 0,
  18978. ref_key: "barRef",
  18979. ref: barRef,
  18980. height: sizeHeight.value,
  18981. width: sizeWidth.value,
  18982. always: _ctx.always,
  18983. "ratio-x": ratioX.value,
  18984. "ratio-y": ratioY.value
  18985. }, null, 8, ["height", "width", "always", "ratio-x", "ratio-y"])) : createCommentVNode("v-if", true)
  18986. ], 2);
  18987. };
  18988. }
  18989. });
  18990. var Scrollbar = /* @__PURE__ */ _export_sfc$1(_sfc_main$x, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/scrollbar/src/scrollbar.vue"]]);
  18991. const ElScrollbar = withInstall(Scrollbar);
  18992. const POPPER_INJECTION_KEY = Symbol("popper");
  18993. const POPPER_CONTENT_INJECTION_KEY = Symbol("popperContent");
  18994. const roleTypes = [
  18995. "dialog",
  18996. "grid",
  18997. "group",
  18998. "listbox",
  18999. "menu",
  19000. "navigation",
  19001. "tooltip",
  19002. "tree"
  19003. ];
  19004. const popperProps = buildProps({
  19005. role: {
  19006. type: String,
  19007. values: roleTypes,
  19008. default: "tooltip"
  19009. }
  19010. });
  19011. const __default__$l = defineComponent({
  19012. name: "ElPopper",
  19013. inheritAttrs: false
  19014. });
  19015. const _sfc_main$w = /* @__PURE__ */ defineComponent({
  19016. ...__default__$l,
  19017. props: popperProps,
  19018. setup(__props, { expose }) {
  19019. const props = __props;
  19020. const triggerRef2 = ref();
  19021. const popperInstanceRef = ref();
  19022. const contentRef = ref();
  19023. const referenceRef = ref();
  19024. const role = computed$1(() => props.role);
  19025. const popperProvides = {
  19026. triggerRef: triggerRef2,
  19027. popperInstanceRef,
  19028. contentRef,
  19029. referenceRef,
  19030. role
  19031. };
  19032. expose(popperProvides);
  19033. provide(POPPER_INJECTION_KEY, popperProvides);
  19034. return (_ctx, _cache) => {
  19035. return renderSlot(_ctx.$slots, "default");
  19036. };
  19037. }
  19038. });
  19039. var Popper = /* @__PURE__ */ _export_sfc$1(_sfc_main$w, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/popper.vue"]]);
  19040. const popperArrowProps = buildProps({
  19041. arrowOffset: {
  19042. type: Number,
  19043. default: 5
  19044. }
  19045. });
  19046. const __default__$k = defineComponent({
  19047. name: "ElPopperArrow",
  19048. inheritAttrs: false
  19049. });
  19050. const _sfc_main$v = /* @__PURE__ */ defineComponent({
  19051. ...__default__$k,
  19052. props: popperArrowProps,
  19053. setup(__props, { expose }) {
  19054. const props = __props;
  19055. const ns = useNamespace("popper");
  19056. const { arrowOffset, arrowRef, arrowStyle } = inject(POPPER_CONTENT_INJECTION_KEY, void 0);
  19057. watch(() => props.arrowOffset, (val) => {
  19058. arrowOffset.value = val;
  19059. });
  19060. onBeforeUnmount(() => {
  19061. arrowRef.value = void 0;
  19062. });
  19063. expose({
  19064. arrowRef
  19065. });
  19066. return (_ctx, _cache) => {
  19067. return openBlock(), createElementBlock("span", {
  19068. ref_key: "arrowRef",
  19069. ref: arrowRef,
  19070. class: normalizeClass(unref(ns).e("arrow")),
  19071. style: normalizeStyle(unref(arrowStyle)),
  19072. "data-popper-arrow": ""
  19073. }, null, 6);
  19074. };
  19075. }
  19076. });
  19077. var ElPopperArrow = /* @__PURE__ */ _export_sfc$1(_sfc_main$v, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/arrow.vue"]]);
  19078. const NAME = "ElOnlyChild";
  19079. const OnlyChild = defineComponent({
  19080. name: NAME,
  19081. setup(_, {
  19082. slots,
  19083. attrs
  19084. }) {
  19085. var _a2;
  19086. const forwardRefInjection = inject(FORWARD_REF_INJECTION_KEY);
  19087. const forwardRefDirective = useForwardRefDirective((_a2 = forwardRefInjection == null ? void 0 : forwardRefInjection.setForwardRef) != null ? _a2 : NOOP);
  19088. return () => {
  19089. var _a22;
  19090. const defaultSlot = (_a22 = slots.default) == null ? void 0 : _a22.call(slots, attrs);
  19091. if (!defaultSlot)
  19092. return null;
  19093. if (defaultSlot.length > 1) {
  19094. return null;
  19095. }
  19096. const firstLegitNode = findFirstLegitChild(defaultSlot);
  19097. if (!firstLegitNode) {
  19098. return null;
  19099. }
  19100. return withDirectives(cloneVNode(firstLegitNode, attrs), [[forwardRefDirective]]);
  19101. };
  19102. }
  19103. });
  19104. function findFirstLegitChild(node) {
  19105. if (!node)
  19106. return null;
  19107. const children = node;
  19108. for (const child of children) {
  19109. if (isObject$5(child)) {
  19110. switch (child.type) {
  19111. case Comment$1:
  19112. continue;
  19113. case Text$1:
  19114. case "svg":
  19115. return wrapTextContent(child);
  19116. case Fragment:
  19117. return findFirstLegitChild(child.children);
  19118. default:
  19119. return child;
  19120. }
  19121. }
  19122. return wrapTextContent(child);
  19123. }
  19124. return null;
  19125. }
  19126. function wrapTextContent(s) {
  19127. const ns = useNamespace("only-child");
  19128. return createVNode("span", {
  19129. "class": ns.e("content")
  19130. }, [s]);
  19131. }
  19132. const popperTriggerProps = buildProps({
  19133. virtualRef: {
  19134. type: definePropType(Object)
  19135. },
  19136. virtualTriggering: Boolean,
  19137. onMouseenter: {
  19138. type: definePropType(Function)
  19139. },
  19140. onMouseleave: {
  19141. type: definePropType(Function)
  19142. },
  19143. onClick: {
  19144. type: definePropType(Function)
  19145. },
  19146. onKeydown: {
  19147. type: definePropType(Function)
  19148. },
  19149. onFocus: {
  19150. type: definePropType(Function)
  19151. },
  19152. onBlur: {
  19153. type: definePropType(Function)
  19154. },
  19155. onContextmenu: {
  19156. type: definePropType(Function)
  19157. },
  19158. id: String,
  19159. open: Boolean
  19160. });
  19161. const __default__$j = defineComponent({
  19162. name: "ElPopperTrigger",
  19163. inheritAttrs: false
  19164. });
  19165. const _sfc_main$u = /* @__PURE__ */ defineComponent({
  19166. ...__default__$j,
  19167. props: popperTriggerProps,
  19168. setup(__props, { expose }) {
  19169. const props = __props;
  19170. const { role, triggerRef: triggerRef2 } = inject(POPPER_INJECTION_KEY, void 0);
  19171. useForwardRef(triggerRef2);
  19172. const ariaControls = computed$1(() => {
  19173. return ariaHaspopup.value ? props.id : void 0;
  19174. });
  19175. const ariaDescribedby = computed$1(() => {
  19176. if (role && role.value === "tooltip") {
  19177. return props.open && props.id ? props.id : void 0;
  19178. }
  19179. return void 0;
  19180. });
  19181. const ariaHaspopup = computed$1(() => {
  19182. if (role && role.value !== "tooltip") {
  19183. return role.value;
  19184. }
  19185. return void 0;
  19186. });
  19187. const ariaExpanded = computed$1(() => {
  19188. return ariaHaspopup.value ? `${props.open}` : void 0;
  19189. });
  19190. let virtualTriggerAriaStopWatch = void 0;
  19191. onMounted(() => {
  19192. watch(() => props.virtualRef, (virtualEl) => {
  19193. if (virtualEl) {
  19194. triggerRef2.value = unrefElement(virtualEl);
  19195. }
  19196. }, {
  19197. immediate: true
  19198. });
  19199. watch(triggerRef2, (el, prevEl) => {
  19200. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  19201. virtualTriggerAriaStopWatch = void 0;
  19202. if (isElement(el)) {
  19203. [
  19204. "onMouseenter",
  19205. "onMouseleave",
  19206. "onClick",
  19207. "onKeydown",
  19208. "onFocus",
  19209. "onBlur",
  19210. "onContextmenu"
  19211. ].forEach((eventName) => {
  19212. var _a2;
  19213. const handler = props[eventName];
  19214. if (handler) {
  19215. el.addEventListener(eventName.slice(2).toLowerCase(), handler);
  19216. (_a2 = prevEl == null ? void 0 : prevEl.removeEventListener) == null ? void 0 : _a2.call(prevEl, eventName.slice(2).toLowerCase(), handler);
  19217. }
  19218. });
  19219. virtualTriggerAriaStopWatch = watch([ariaControls, ariaDescribedby, ariaHaspopup, ariaExpanded], (watches) => {
  19220. [
  19221. "aria-controls",
  19222. "aria-describedby",
  19223. "aria-haspopup",
  19224. "aria-expanded"
  19225. ].forEach((key, idx) => {
  19226. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  19227. });
  19228. }, { immediate: true });
  19229. }
  19230. if (isElement(prevEl)) {
  19231. [
  19232. "aria-controls",
  19233. "aria-describedby",
  19234. "aria-haspopup",
  19235. "aria-expanded"
  19236. ].forEach((key) => prevEl.removeAttribute(key));
  19237. }
  19238. }, {
  19239. immediate: true
  19240. });
  19241. });
  19242. onBeforeUnmount(() => {
  19243. virtualTriggerAriaStopWatch == null ? void 0 : virtualTriggerAriaStopWatch();
  19244. virtualTriggerAriaStopWatch = void 0;
  19245. });
  19246. expose({
  19247. triggerRef: triggerRef2
  19248. });
  19249. return (_ctx, _cache) => {
  19250. return !_ctx.virtualTriggering ? (openBlock(), createBlock(unref(OnlyChild), mergeProps({ key: 0 }, _ctx.$attrs, {
  19251. "aria-controls": unref(ariaControls),
  19252. "aria-describedby": unref(ariaDescribedby),
  19253. "aria-expanded": unref(ariaExpanded),
  19254. "aria-haspopup": unref(ariaHaspopup)
  19255. }), {
  19256. default: withCtx(() => [
  19257. renderSlot(_ctx.$slots, "default")
  19258. ]),
  19259. _: 3
  19260. }, 16, ["aria-controls", "aria-describedby", "aria-expanded", "aria-haspopup"])) : createCommentVNode("v-if", true);
  19261. };
  19262. }
  19263. });
  19264. var ElPopperTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$u, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/trigger.vue"]]);
  19265. const FOCUS_AFTER_TRAPPED = "focus-trap.focus-after-trapped";
  19266. const FOCUS_AFTER_RELEASED = "focus-trap.focus-after-released";
  19267. const FOCUSOUT_PREVENTED = "focus-trap.focusout-prevented";
  19268. const FOCUS_AFTER_TRAPPED_OPTS = {
  19269. cancelable: true,
  19270. bubbles: false
  19271. };
  19272. const FOCUSOUT_PREVENTED_OPTS = {
  19273. cancelable: true,
  19274. bubbles: false
  19275. };
  19276. const ON_TRAP_FOCUS_EVT = "focusAfterTrapped";
  19277. const ON_RELEASE_FOCUS_EVT = "focusAfterReleased";
  19278. const FOCUS_TRAP_INJECTION_KEY = Symbol("elFocusTrap");
  19279. const focusReason = ref();
  19280. const lastUserFocusTimestamp = ref(0);
  19281. const lastAutomatedFocusTimestamp = ref(0);
  19282. let focusReasonUserCount = 0;
  19283. const obtainAllFocusableElements = (element) => {
  19284. const nodes = [];
  19285. const walker = document.createTreeWalker(element, NodeFilter.SHOW_ELEMENT, {
  19286. acceptNode: (node) => {
  19287. const isHiddenInput = node.tagName === "INPUT" && node.type === "hidden";
  19288. if (node.disabled || node.hidden || isHiddenInput)
  19289. return NodeFilter.FILTER_SKIP;
  19290. return node.tabIndex >= 0 || node === document.activeElement ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
  19291. }
  19292. });
  19293. while (walker.nextNode())
  19294. nodes.push(walker.currentNode);
  19295. return nodes;
  19296. };
  19297. const getVisibleElement = (elements, container) => {
  19298. for (const element of elements) {
  19299. if (!isHidden(element, container))
  19300. return element;
  19301. }
  19302. };
  19303. const isHidden = (element, container) => {
  19304. if (getComputedStyle(element).visibility === "hidden")
  19305. return true;
  19306. while (element) {
  19307. if (container && element === container)
  19308. return false;
  19309. if (getComputedStyle(element).display === "none")
  19310. return true;
  19311. element = element.parentElement;
  19312. }
  19313. return false;
  19314. };
  19315. const getEdges = (container) => {
  19316. const focusable = obtainAllFocusableElements(container);
  19317. const first = getVisibleElement(focusable, container);
  19318. const last = getVisibleElement(focusable.reverse(), container);
  19319. return [first, last];
  19320. };
  19321. const isSelectable = (element) => {
  19322. return element instanceof HTMLInputElement && "select" in element;
  19323. };
  19324. const tryFocus = (element, shouldSelect) => {
  19325. if (element && element.focus) {
  19326. const prevFocusedElement = document.activeElement;
  19327. element.focus({ preventScroll: true });
  19328. lastAutomatedFocusTimestamp.value = window.performance.now();
  19329. if (element !== prevFocusedElement && isSelectable(element) && shouldSelect) {
  19330. element.select();
  19331. }
  19332. }
  19333. };
  19334. function removeFromStack(list, item) {
  19335. const copy2 = [...list];
  19336. const idx = list.indexOf(item);
  19337. if (idx !== -1) {
  19338. copy2.splice(idx, 1);
  19339. }
  19340. return copy2;
  19341. }
  19342. const createFocusableStack = () => {
  19343. let stack = [];
  19344. const push = (layer) => {
  19345. const currentLayer = stack[0];
  19346. if (currentLayer && layer !== currentLayer) {
  19347. currentLayer.pause();
  19348. }
  19349. stack = removeFromStack(stack, layer);
  19350. stack.unshift(layer);
  19351. };
  19352. const remove2 = (layer) => {
  19353. var _a2, _b;
  19354. stack = removeFromStack(stack, layer);
  19355. (_b = (_a2 = stack[0]) == null ? void 0 : _a2.resume) == null ? void 0 : _b.call(_a2);
  19356. };
  19357. return {
  19358. push,
  19359. remove: remove2
  19360. };
  19361. };
  19362. const focusFirstDescendant = (elements, shouldSelect = false) => {
  19363. const prevFocusedElement = document.activeElement;
  19364. for (const element of elements) {
  19365. tryFocus(element, shouldSelect);
  19366. if (document.activeElement !== prevFocusedElement)
  19367. return;
  19368. }
  19369. };
  19370. const focusableStack = createFocusableStack();
  19371. const isFocusCausedByUserEvent = () => {
  19372. return lastUserFocusTimestamp.value > lastAutomatedFocusTimestamp.value;
  19373. };
  19374. const notifyFocusReasonPointer = () => {
  19375. focusReason.value = "pointer";
  19376. lastUserFocusTimestamp.value = window.performance.now();
  19377. };
  19378. const notifyFocusReasonKeydown = () => {
  19379. focusReason.value = "keyboard";
  19380. lastUserFocusTimestamp.value = window.performance.now();
  19381. };
  19382. const useFocusReason = () => {
  19383. onMounted(() => {
  19384. if (focusReasonUserCount === 0) {
  19385. document.addEventListener("mousedown", notifyFocusReasonPointer);
  19386. document.addEventListener("touchstart", notifyFocusReasonPointer);
  19387. document.addEventListener("keydown", notifyFocusReasonKeydown);
  19388. }
  19389. focusReasonUserCount++;
  19390. });
  19391. onBeforeUnmount(() => {
  19392. focusReasonUserCount--;
  19393. if (focusReasonUserCount <= 0) {
  19394. document.removeEventListener("mousedown", notifyFocusReasonPointer);
  19395. document.removeEventListener("touchstart", notifyFocusReasonPointer);
  19396. document.removeEventListener("keydown", notifyFocusReasonKeydown);
  19397. }
  19398. });
  19399. return {
  19400. focusReason,
  19401. lastUserFocusTimestamp,
  19402. lastAutomatedFocusTimestamp
  19403. };
  19404. };
  19405. const createFocusOutPreventedEvent = (detail) => {
  19406. return new CustomEvent(FOCUSOUT_PREVENTED, {
  19407. ...FOCUSOUT_PREVENTED_OPTS,
  19408. detail
  19409. });
  19410. };
  19411. const _sfc_main$t = defineComponent({
  19412. name: "ElFocusTrap",
  19413. inheritAttrs: false,
  19414. props: {
  19415. loop: Boolean,
  19416. trapped: Boolean,
  19417. focusTrapEl: Object,
  19418. focusStartEl: {
  19419. type: [Object, String],
  19420. default: "first"
  19421. }
  19422. },
  19423. emits: [
  19424. ON_TRAP_FOCUS_EVT,
  19425. ON_RELEASE_FOCUS_EVT,
  19426. "focusin",
  19427. "focusout",
  19428. "focusout-prevented",
  19429. "release-requested"
  19430. ],
  19431. setup(props, { emit }) {
  19432. const forwardRef = ref();
  19433. let lastFocusBeforeTrapped;
  19434. let lastFocusAfterTrapped;
  19435. const { focusReason: focusReason2 } = useFocusReason();
  19436. useEscapeKeydown((event2) => {
  19437. if (props.trapped && !focusLayer.paused) {
  19438. emit("release-requested", event2);
  19439. }
  19440. });
  19441. const focusLayer = {
  19442. paused: false,
  19443. pause() {
  19444. this.paused = true;
  19445. },
  19446. resume() {
  19447. this.paused = false;
  19448. }
  19449. };
  19450. const onKeydown = (e) => {
  19451. if (!props.loop && !props.trapped)
  19452. return;
  19453. if (focusLayer.paused)
  19454. return;
  19455. const { key, altKey, ctrlKey, metaKey, currentTarget, shiftKey } = e;
  19456. const { loop } = props;
  19457. const isTabbing = key === EVENT_CODE.tab && !altKey && !ctrlKey && !metaKey;
  19458. const currentFocusingEl = document.activeElement;
  19459. if (isTabbing && currentFocusingEl) {
  19460. const container = currentTarget;
  19461. const [first, last] = getEdges(container);
  19462. const isTabbable = first && last;
  19463. if (!isTabbable) {
  19464. if (currentFocusingEl === container) {
  19465. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  19466. focusReason: focusReason2.value
  19467. });
  19468. emit("focusout-prevented", focusoutPreventedEvent);
  19469. if (!focusoutPreventedEvent.defaultPrevented) {
  19470. e.preventDefault();
  19471. }
  19472. }
  19473. } else {
  19474. if (!shiftKey && currentFocusingEl === last) {
  19475. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  19476. focusReason: focusReason2.value
  19477. });
  19478. emit("focusout-prevented", focusoutPreventedEvent);
  19479. if (!focusoutPreventedEvent.defaultPrevented) {
  19480. e.preventDefault();
  19481. if (loop)
  19482. tryFocus(first, true);
  19483. }
  19484. } else if (shiftKey && [first, container].includes(currentFocusingEl)) {
  19485. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  19486. focusReason: focusReason2.value
  19487. });
  19488. emit("focusout-prevented", focusoutPreventedEvent);
  19489. if (!focusoutPreventedEvent.defaultPrevented) {
  19490. e.preventDefault();
  19491. if (loop)
  19492. tryFocus(last, true);
  19493. }
  19494. }
  19495. }
  19496. }
  19497. };
  19498. provide(FOCUS_TRAP_INJECTION_KEY, {
  19499. focusTrapRef: forwardRef,
  19500. onKeydown
  19501. });
  19502. watch(() => props.focusTrapEl, (focusTrapEl) => {
  19503. if (focusTrapEl) {
  19504. forwardRef.value = focusTrapEl;
  19505. }
  19506. }, { immediate: true });
  19507. watch([forwardRef], ([forwardRef2], [oldForwardRef]) => {
  19508. if (forwardRef2) {
  19509. forwardRef2.addEventListener("keydown", onKeydown);
  19510. forwardRef2.addEventListener("focusin", onFocusIn);
  19511. forwardRef2.addEventListener("focusout", onFocusOut);
  19512. }
  19513. if (oldForwardRef) {
  19514. oldForwardRef.removeEventListener("keydown", onKeydown);
  19515. oldForwardRef.removeEventListener("focusin", onFocusIn);
  19516. oldForwardRef.removeEventListener("focusout", onFocusOut);
  19517. }
  19518. });
  19519. const trapOnFocus = (e) => {
  19520. emit(ON_TRAP_FOCUS_EVT, e);
  19521. };
  19522. const releaseOnFocus = (e) => emit(ON_RELEASE_FOCUS_EVT, e);
  19523. const onFocusIn = (e) => {
  19524. const trapContainer = unref(forwardRef);
  19525. if (!trapContainer)
  19526. return;
  19527. const target = e.target;
  19528. const relatedTarget = e.relatedTarget;
  19529. const isFocusedInTrap = target && trapContainer.contains(target);
  19530. if (!props.trapped) {
  19531. const isPrevFocusedInTrap = relatedTarget && trapContainer.contains(relatedTarget);
  19532. if (!isPrevFocusedInTrap) {
  19533. lastFocusBeforeTrapped = relatedTarget;
  19534. }
  19535. }
  19536. if (isFocusedInTrap)
  19537. emit("focusin", e);
  19538. if (focusLayer.paused)
  19539. return;
  19540. if (props.trapped) {
  19541. if (isFocusedInTrap) {
  19542. lastFocusAfterTrapped = target;
  19543. } else {
  19544. tryFocus(lastFocusAfterTrapped, true);
  19545. }
  19546. }
  19547. };
  19548. const onFocusOut = (e) => {
  19549. const trapContainer = unref(forwardRef);
  19550. if (focusLayer.paused || !trapContainer)
  19551. return;
  19552. if (props.trapped) {
  19553. const relatedTarget = e.relatedTarget;
  19554. if (!isNil(relatedTarget) && !trapContainer.contains(relatedTarget)) {
  19555. setTimeout(() => {
  19556. if (!focusLayer.paused && props.trapped) {
  19557. const focusoutPreventedEvent = createFocusOutPreventedEvent({
  19558. focusReason: focusReason2.value
  19559. });
  19560. emit("focusout-prevented", focusoutPreventedEvent);
  19561. if (!focusoutPreventedEvent.defaultPrevented) {
  19562. tryFocus(lastFocusAfterTrapped, true);
  19563. }
  19564. }
  19565. }, 0);
  19566. }
  19567. } else {
  19568. const target = e.target;
  19569. const isFocusedInTrap = target && trapContainer.contains(target);
  19570. if (!isFocusedInTrap)
  19571. emit("focusout", e);
  19572. }
  19573. };
  19574. async function startTrap() {
  19575. await nextTick();
  19576. const trapContainer = unref(forwardRef);
  19577. if (trapContainer) {
  19578. focusableStack.push(focusLayer);
  19579. const prevFocusedElement = trapContainer.contains(document.activeElement) ? lastFocusBeforeTrapped : document.activeElement;
  19580. lastFocusBeforeTrapped = prevFocusedElement;
  19581. const isPrevFocusContained = trapContainer.contains(prevFocusedElement);
  19582. if (!isPrevFocusContained) {
  19583. const focusEvent = new Event(FOCUS_AFTER_TRAPPED, FOCUS_AFTER_TRAPPED_OPTS);
  19584. trapContainer.addEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  19585. trapContainer.dispatchEvent(focusEvent);
  19586. if (!focusEvent.defaultPrevented) {
  19587. nextTick(() => {
  19588. let focusStartEl = props.focusStartEl;
  19589. if (!isString(focusStartEl)) {
  19590. tryFocus(focusStartEl);
  19591. if (document.activeElement !== focusStartEl) {
  19592. focusStartEl = "first";
  19593. }
  19594. }
  19595. if (focusStartEl === "first") {
  19596. focusFirstDescendant(obtainAllFocusableElements(trapContainer), true);
  19597. }
  19598. if (document.activeElement === prevFocusedElement || focusStartEl === "container") {
  19599. tryFocus(trapContainer);
  19600. }
  19601. });
  19602. }
  19603. }
  19604. }
  19605. }
  19606. function stopTrap() {
  19607. const trapContainer = unref(forwardRef);
  19608. if (trapContainer) {
  19609. trapContainer.removeEventListener(FOCUS_AFTER_TRAPPED, trapOnFocus);
  19610. const releasedEvent = new CustomEvent(FOCUS_AFTER_RELEASED, {
  19611. ...FOCUS_AFTER_TRAPPED_OPTS,
  19612. detail: {
  19613. focusReason: focusReason2.value
  19614. }
  19615. });
  19616. trapContainer.addEventListener(FOCUS_AFTER_RELEASED, releaseOnFocus);
  19617. trapContainer.dispatchEvent(releasedEvent);
  19618. if (!releasedEvent.defaultPrevented && (focusReason2.value == "keyboard" || !isFocusCausedByUserEvent() || trapContainer.contains(document.activeElement))) {
  19619. tryFocus(lastFocusBeforeTrapped != null ? lastFocusBeforeTrapped : document.body);
  19620. }
  19621. trapContainer.removeEventListener(FOCUS_AFTER_RELEASED, trapOnFocus);
  19622. focusableStack.remove(focusLayer);
  19623. }
  19624. }
  19625. onMounted(() => {
  19626. if (props.trapped) {
  19627. startTrap();
  19628. }
  19629. watch(() => props.trapped, (trapped) => {
  19630. if (trapped) {
  19631. startTrap();
  19632. } else {
  19633. stopTrap();
  19634. }
  19635. });
  19636. });
  19637. onBeforeUnmount(() => {
  19638. if (props.trapped) {
  19639. stopTrap();
  19640. }
  19641. });
  19642. return {
  19643. onKeydown
  19644. };
  19645. }
  19646. });
  19647. function _sfc_render$7(_ctx, _cache, $props, $setup, $data, $options) {
  19648. return renderSlot(_ctx.$slots, "default", { handleKeydown: _ctx.onKeydown });
  19649. }
  19650. var ElFocusTrap = /* @__PURE__ */ _export_sfc$1(_sfc_main$t, [["render", _sfc_render$7], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/focus-trap/src/focus-trap.vue"]]);
  19651. const POSITIONING_STRATEGIES = ["fixed", "absolute"];
  19652. const popperCoreConfigProps = buildProps({
  19653. boundariesPadding: {
  19654. type: Number,
  19655. default: 0
  19656. },
  19657. fallbackPlacements: {
  19658. type: definePropType(Array),
  19659. default: void 0
  19660. },
  19661. gpuAcceleration: {
  19662. type: Boolean,
  19663. default: true
  19664. },
  19665. offset: {
  19666. type: Number,
  19667. default: 12
  19668. },
  19669. placement: {
  19670. type: String,
  19671. values: Ee,
  19672. default: "bottom"
  19673. },
  19674. popperOptions: {
  19675. type: definePropType(Object),
  19676. default: () => ({})
  19677. },
  19678. strategy: {
  19679. type: String,
  19680. values: POSITIONING_STRATEGIES,
  19681. default: "absolute"
  19682. }
  19683. });
  19684. const popperContentProps = buildProps({
  19685. ...popperCoreConfigProps,
  19686. id: String,
  19687. style: {
  19688. type: definePropType([String, Array, Object])
  19689. },
  19690. className: {
  19691. type: definePropType([String, Array, Object])
  19692. },
  19693. effect: {
  19694. type: String,
  19695. default: "dark"
  19696. },
  19697. visible: Boolean,
  19698. enterable: {
  19699. type: Boolean,
  19700. default: true
  19701. },
  19702. pure: Boolean,
  19703. focusOnShow: {
  19704. type: Boolean,
  19705. default: false
  19706. },
  19707. trapping: {
  19708. type: Boolean,
  19709. default: false
  19710. },
  19711. popperClass: {
  19712. type: definePropType([String, Array, Object])
  19713. },
  19714. popperStyle: {
  19715. type: definePropType([String, Array, Object])
  19716. },
  19717. referenceEl: {
  19718. type: definePropType(Object)
  19719. },
  19720. triggerTargetEl: {
  19721. type: definePropType(Object)
  19722. },
  19723. stopPopperMouseEvent: {
  19724. type: Boolean,
  19725. default: true
  19726. },
  19727. ariaLabel: {
  19728. type: String,
  19729. default: void 0
  19730. },
  19731. virtualTriggering: Boolean,
  19732. zIndex: Number
  19733. });
  19734. const popperContentEmits = {
  19735. mouseenter: (evt) => evt instanceof MouseEvent,
  19736. mouseleave: (evt) => evt instanceof MouseEvent,
  19737. focus: () => true,
  19738. blur: () => true,
  19739. close: () => true
  19740. };
  19741. const buildPopperOptions = (props, modifiers = []) => {
  19742. const { placement, strategy, popperOptions } = props;
  19743. const options2 = {
  19744. placement,
  19745. strategy,
  19746. ...popperOptions,
  19747. modifiers: [...genModifiers(props), ...modifiers]
  19748. };
  19749. deriveExtraModifiers(options2, popperOptions == null ? void 0 : popperOptions.modifiers);
  19750. return options2;
  19751. };
  19752. const unwrapMeasurableEl = ($el) => {
  19753. if (!isClient)
  19754. return;
  19755. return unrefElement($el);
  19756. };
  19757. function genModifiers(options2) {
  19758. const { offset, gpuAcceleration, fallbackPlacements } = options2;
  19759. return [
  19760. {
  19761. name: "offset",
  19762. options: {
  19763. offset: [0, offset != null ? offset : 12]
  19764. }
  19765. },
  19766. {
  19767. name: "preventOverflow",
  19768. options: {
  19769. padding: {
  19770. top: 2,
  19771. bottom: 2,
  19772. left: 5,
  19773. right: 5
  19774. }
  19775. }
  19776. },
  19777. {
  19778. name: "flip",
  19779. options: {
  19780. padding: 5,
  19781. fallbackPlacements
  19782. }
  19783. },
  19784. {
  19785. name: "computeStyles",
  19786. options: {
  19787. gpuAcceleration
  19788. }
  19789. }
  19790. ];
  19791. }
  19792. function deriveExtraModifiers(options2, modifiers) {
  19793. if (modifiers) {
  19794. options2.modifiers = [...options2.modifiers, ...modifiers != null ? modifiers : []];
  19795. }
  19796. }
  19797. const DEFAULT_ARROW_OFFSET = 0;
  19798. const usePopperContent = (props) => {
  19799. const { popperInstanceRef, contentRef, triggerRef: triggerRef2, role } = inject(POPPER_INJECTION_KEY, void 0);
  19800. const arrowRef = ref();
  19801. const arrowOffset = ref();
  19802. const eventListenerModifier = computed$1(() => {
  19803. return {
  19804. name: "eventListeners",
  19805. enabled: !!props.visible
  19806. };
  19807. });
  19808. const arrowModifier = computed$1(() => {
  19809. var _a2;
  19810. const arrowEl = unref(arrowRef);
  19811. const offset = (_a2 = unref(arrowOffset)) != null ? _a2 : DEFAULT_ARROW_OFFSET;
  19812. return {
  19813. name: "arrow",
  19814. enabled: !isUndefined$1(arrowEl),
  19815. options: {
  19816. element: arrowEl,
  19817. padding: offset
  19818. }
  19819. };
  19820. });
  19821. const options2 = computed$1(() => {
  19822. return {
  19823. onFirstUpdate: () => {
  19824. update();
  19825. },
  19826. ...buildPopperOptions(props, [
  19827. unref(arrowModifier),
  19828. unref(eventListenerModifier)
  19829. ])
  19830. };
  19831. });
  19832. const computedReference = computed$1(() => unwrapMeasurableEl(props.referenceEl) || unref(triggerRef2));
  19833. const { attributes, state, styles, update, forceUpdate, instanceRef } = usePopper(computedReference, contentRef, options2);
  19834. watch(instanceRef, (instance) => popperInstanceRef.value = instance);
  19835. onMounted(() => {
  19836. watch(() => {
  19837. var _a2;
  19838. return (_a2 = unref(computedReference)) == null ? void 0 : _a2.getBoundingClientRect();
  19839. }, () => {
  19840. update();
  19841. });
  19842. });
  19843. return {
  19844. attributes,
  19845. arrowRef,
  19846. contentRef,
  19847. instanceRef,
  19848. state,
  19849. styles,
  19850. role,
  19851. forceUpdate,
  19852. update
  19853. };
  19854. };
  19855. const usePopperContentDOM = (props, {
  19856. attributes,
  19857. styles,
  19858. role
  19859. }) => {
  19860. const { nextZIndex } = useZIndex();
  19861. const ns = useNamespace("popper");
  19862. const contentAttrs = computed$1(() => unref(attributes).popper);
  19863. const contentZIndex = ref(props.zIndex || nextZIndex());
  19864. const contentClass = computed$1(() => [
  19865. ns.b(),
  19866. ns.is("pure", props.pure),
  19867. ns.is(props.effect),
  19868. props.popperClass
  19869. ]);
  19870. const contentStyle = computed$1(() => {
  19871. return [
  19872. { zIndex: unref(contentZIndex) },
  19873. props.popperStyle || {},
  19874. unref(styles).popper
  19875. ];
  19876. });
  19877. const ariaModal = computed$1(() => role.value === "dialog" ? "false" : void 0);
  19878. const arrowStyle = computed$1(() => unref(styles).arrow || {});
  19879. const updateZIndex = () => {
  19880. contentZIndex.value = props.zIndex || nextZIndex();
  19881. };
  19882. return {
  19883. ariaModal,
  19884. arrowStyle,
  19885. contentAttrs,
  19886. contentClass,
  19887. contentStyle,
  19888. contentZIndex,
  19889. updateZIndex
  19890. };
  19891. };
  19892. const usePopperContentFocusTrap = (props, emit) => {
  19893. const trapped = ref(false);
  19894. const focusStartRef = ref();
  19895. const onFocusAfterTrapped = () => {
  19896. emit("focus");
  19897. };
  19898. const onFocusAfterReleased = (event2) => {
  19899. var _a2;
  19900. if (((_a2 = event2.detail) == null ? void 0 : _a2.focusReason) !== "pointer") {
  19901. focusStartRef.value = "first";
  19902. emit("blur");
  19903. }
  19904. };
  19905. const onFocusInTrap = (event2) => {
  19906. if (props.visible && !trapped.value) {
  19907. if (event2.target) {
  19908. focusStartRef.value = event2.target;
  19909. }
  19910. trapped.value = true;
  19911. }
  19912. };
  19913. const onFocusoutPrevented = (event2) => {
  19914. if (!props.trapping) {
  19915. if (event2.detail.focusReason === "pointer") {
  19916. event2.preventDefault();
  19917. }
  19918. trapped.value = false;
  19919. }
  19920. };
  19921. const onReleaseRequested = () => {
  19922. trapped.value = false;
  19923. emit("close");
  19924. };
  19925. return {
  19926. focusStartRef,
  19927. trapped,
  19928. onFocusAfterReleased,
  19929. onFocusAfterTrapped,
  19930. onFocusInTrap,
  19931. onFocusoutPrevented,
  19932. onReleaseRequested
  19933. };
  19934. };
  19935. const __default__$i = defineComponent({
  19936. name: "ElPopperContent"
  19937. });
  19938. const _sfc_main$s = /* @__PURE__ */ defineComponent({
  19939. ...__default__$i,
  19940. props: popperContentProps,
  19941. emits: popperContentEmits,
  19942. setup(__props, { expose, emit }) {
  19943. const props = __props;
  19944. const {
  19945. focusStartRef,
  19946. trapped,
  19947. onFocusAfterReleased,
  19948. onFocusAfterTrapped,
  19949. onFocusInTrap,
  19950. onFocusoutPrevented,
  19951. onReleaseRequested
  19952. } = usePopperContentFocusTrap(props, emit);
  19953. const { attributes, arrowRef, contentRef, styles, instanceRef, role, update } = usePopperContent(props);
  19954. const {
  19955. ariaModal,
  19956. arrowStyle,
  19957. contentAttrs,
  19958. contentClass,
  19959. contentStyle,
  19960. updateZIndex
  19961. } = usePopperContentDOM(props, {
  19962. styles,
  19963. attributes,
  19964. role
  19965. });
  19966. const formItemContext = inject(formItemContextKey, void 0);
  19967. const arrowOffset = ref();
  19968. provide(POPPER_CONTENT_INJECTION_KEY, {
  19969. arrowStyle,
  19970. arrowRef,
  19971. arrowOffset
  19972. });
  19973. if (formItemContext && (formItemContext.addInputId || formItemContext.removeInputId)) {
  19974. provide(formItemContextKey, {
  19975. ...formItemContext,
  19976. addInputId: NOOP,
  19977. removeInputId: NOOP
  19978. });
  19979. }
  19980. let triggerTargetAriaStopWatch = void 0;
  19981. const updatePopper = (shouldUpdateZIndex = true) => {
  19982. update();
  19983. shouldUpdateZIndex && updateZIndex();
  19984. };
  19985. const togglePopperAlive = () => {
  19986. updatePopper(false);
  19987. if (props.visible && props.focusOnShow) {
  19988. trapped.value = true;
  19989. } else if (props.visible === false) {
  19990. trapped.value = false;
  19991. }
  19992. };
  19993. onMounted(() => {
  19994. watch(() => props.triggerTargetEl, (triggerTargetEl, prevTriggerTargetEl) => {
  19995. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  19996. triggerTargetAriaStopWatch = void 0;
  19997. const el = unref(triggerTargetEl || contentRef.value);
  19998. const prevEl = unref(prevTriggerTargetEl || contentRef.value);
  19999. if (isElement(el)) {
  20000. triggerTargetAriaStopWatch = watch([role, () => props.ariaLabel, ariaModal, () => props.id], (watches) => {
  20001. ["role", "aria-label", "aria-modal", "id"].forEach((key, idx) => {
  20002. isNil(watches[idx]) ? el.removeAttribute(key) : el.setAttribute(key, watches[idx]);
  20003. });
  20004. }, { immediate: true });
  20005. }
  20006. if (prevEl !== el && isElement(prevEl)) {
  20007. ["role", "aria-label", "aria-modal", "id"].forEach((key) => {
  20008. prevEl.removeAttribute(key);
  20009. });
  20010. }
  20011. }, { immediate: true });
  20012. watch(() => props.visible, togglePopperAlive, { immediate: true });
  20013. });
  20014. onBeforeUnmount(() => {
  20015. triggerTargetAriaStopWatch == null ? void 0 : triggerTargetAriaStopWatch();
  20016. triggerTargetAriaStopWatch = void 0;
  20017. });
  20018. expose({
  20019. popperContentRef: contentRef,
  20020. popperInstanceRef: instanceRef,
  20021. updatePopper,
  20022. contentStyle
  20023. });
  20024. return (_ctx, _cache) => {
  20025. return openBlock(), createElementBlock("div", mergeProps({
  20026. ref_key: "contentRef",
  20027. ref: contentRef
  20028. }, unref(contentAttrs), {
  20029. style: unref(contentStyle),
  20030. class: unref(contentClass),
  20031. tabindex: "-1",
  20032. onMouseenter: _cache[0] || (_cache[0] = (e) => _ctx.$emit("mouseenter", e)),
  20033. onMouseleave: _cache[1] || (_cache[1] = (e) => _ctx.$emit("mouseleave", e))
  20034. }), [
  20035. createVNode(unref(ElFocusTrap), {
  20036. trapped: unref(trapped),
  20037. "trap-on-focus-in": true,
  20038. "focus-trap-el": unref(contentRef),
  20039. "focus-start-el": unref(focusStartRef),
  20040. onFocusAfterTrapped: unref(onFocusAfterTrapped),
  20041. onFocusAfterReleased: unref(onFocusAfterReleased),
  20042. onFocusin: unref(onFocusInTrap),
  20043. onFocusoutPrevented: unref(onFocusoutPrevented),
  20044. onReleaseRequested: unref(onReleaseRequested)
  20045. }, {
  20046. default: withCtx(() => [
  20047. renderSlot(_ctx.$slots, "default")
  20048. ]),
  20049. _: 3
  20050. }, 8, ["trapped", "focus-trap-el", "focus-start-el", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusin", "onFocusoutPrevented", "onReleaseRequested"])
  20051. ], 16);
  20052. };
  20053. }
  20054. });
  20055. var ElPopperContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$s, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/popper/src/content.vue"]]);
  20056. const ElPopper = withInstall(Popper);
  20057. const TOOLTIP_INJECTION_KEY = Symbol("elTooltip");
  20058. const useTooltipContentProps = buildProps({
  20059. ...useDelayedToggleProps,
  20060. ...popperContentProps,
  20061. appendTo: {
  20062. type: definePropType([String, Object])
  20063. },
  20064. content: {
  20065. type: String,
  20066. default: ""
  20067. },
  20068. rawContent: {
  20069. type: Boolean,
  20070. default: false
  20071. },
  20072. persistent: Boolean,
  20073. ariaLabel: String,
  20074. visible: {
  20075. type: definePropType(Boolean),
  20076. default: null
  20077. },
  20078. transition: String,
  20079. teleported: {
  20080. type: Boolean,
  20081. default: true
  20082. },
  20083. disabled: Boolean
  20084. });
  20085. const useTooltipTriggerProps = buildProps({
  20086. ...popperTriggerProps,
  20087. disabled: Boolean,
  20088. trigger: {
  20089. type: definePropType([String, Array]),
  20090. default: "hover"
  20091. },
  20092. triggerKeys: {
  20093. type: definePropType(Array),
  20094. default: () => [EVENT_CODE.enter, EVENT_CODE.space]
  20095. }
  20096. });
  20097. const {
  20098. useModelToggleProps: useTooltipModelToggleProps,
  20099. useModelToggleEmits: useTooltipModelToggleEmits,
  20100. useModelToggle: useTooltipModelToggle
  20101. } = createModelToggleComposable("visible");
  20102. const useTooltipProps = buildProps({
  20103. ...popperProps,
  20104. ...useTooltipModelToggleProps,
  20105. ...useTooltipContentProps,
  20106. ...useTooltipTriggerProps,
  20107. ...popperArrowProps,
  20108. showArrow: {
  20109. type: Boolean,
  20110. default: true
  20111. }
  20112. });
  20113. const tooltipEmits = [
  20114. ...useTooltipModelToggleEmits,
  20115. "before-show",
  20116. "before-hide",
  20117. "show",
  20118. "hide",
  20119. "open",
  20120. "close"
  20121. ];
  20122. const isTriggerType = (trigger2, type2) => {
  20123. if (isArray$2(trigger2)) {
  20124. return trigger2.includes(type2);
  20125. }
  20126. return trigger2 === type2;
  20127. };
  20128. const whenTrigger = (trigger2, type2, handler) => {
  20129. return (e) => {
  20130. isTriggerType(unref(trigger2), type2) && handler(e);
  20131. };
  20132. };
  20133. const __default__$h = defineComponent({
  20134. name: "ElTooltipTrigger"
  20135. });
  20136. const _sfc_main$r = /* @__PURE__ */ defineComponent({
  20137. ...__default__$h,
  20138. props: useTooltipTriggerProps,
  20139. setup(__props, { expose }) {
  20140. const props = __props;
  20141. const ns = useNamespace("tooltip");
  20142. const { controlled, id, open, onOpen, onClose, onToggle } = inject(TOOLTIP_INJECTION_KEY, void 0);
  20143. const triggerRef2 = ref(null);
  20144. const stopWhenControlledOrDisabled = () => {
  20145. if (unref(controlled) || props.disabled) {
  20146. return true;
  20147. }
  20148. };
  20149. const trigger2 = toRef(props, "trigger");
  20150. const onMouseenter = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "hover", onOpen));
  20151. const onMouseleave = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "hover", onClose));
  20152. const onClick = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "click", (e) => {
  20153. if (e.button === 0) {
  20154. onToggle(e);
  20155. }
  20156. }));
  20157. const onFocus = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "focus", onOpen));
  20158. const onBlur = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "focus", onClose));
  20159. const onContextMenu = composeEventHandlers(stopWhenControlledOrDisabled, whenTrigger(trigger2, "contextmenu", (e) => {
  20160. e.preventDefault();
  20161. onToggle(e);
  20162. }));
  20163. const onKeydown = composeEventHandlers(stopWhenControlledOrDisabled, (e) => {
  20164. const { code } = e;
  20165. if (props.triggerKeys.includes(code)) {
  20166. e.preventDefault();
  20167. onToggle(e);
  20168. }
  20169. });
  20170. expose({
  20171. triggerRef: triggerRef2
  20172. });
  20173. return (_ctx, _cache) => {
  20174. return openBlock(), createBlock(unref(ElPopperTrigger), {
  20175. id: unref(id),
  20176. "virtual-ref": _ctx.virtualRef,
  20177. open: unref(open),
  20178. "virtual-triggering": _ctx.virtualTriggering,
  20179. class: normalizeClass(unref(ns).e("trigger")),
  20180. onBlur: unref(onBlur),
  20181. onClick: unref(onClick),
  20182. onContextmenu: unref(onContextMenu),
  20183. onFocus: unref(onFocus),
  20184. onMouseenter: unref(onMouseenter),
  20185. onMouseleave: unref(onMouseleave),
  20186. onKeydown: unref(onKeydown)
  20187. }, {
  20188. default: withCtx(() => [
  20189. renderSlot(_ctx.$slots, "default")
  20190. ]),
  20191. _: 3
  20192. }, 8, ["id", "virtual-ref", "open", "virtual-triggering", "class", "onBlur", "onClick", "onContextmenu", "onFocus", "onMouseenter", "onMouseleave", "onKeydown"]);
  20193. };
  20194. }
  20195. });
  20196. var ElTooltipTrigger = /* @__PURE__ */ _export_sfc$1(_sfc_main$r, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/trigger.vue"]]);
  20197. const __default__$g = defineComponent({
  20198. name: "ElTooltipContent",
  20199. inheritAttrs: false
  20200. });
  20201. const _sfc_main$q = /* @__PURE__ */ defineComponent({
  20202. ...__default__$g,
  20203. props: useTooltipContentProps,
  20204. setup(__props, { expose }) {
  20205. const props = __props;
  20206. const { selector } = usePopperContainerId();
  20207. const ns = useNamespace("tooltip");
  20208. const contentRef = ref(null);
  20209. const destroyed = ref(false);
  20210. const {
  20211. controlled,
  20212. id,
  20213. open,
  20214. trigger: trigger2,
  20215. onClose,
  20216. onOpen,
  20217. onShow,
  20218. onHide,
  20219. onBeforeShow,
  20220. onBeforeHide
  20221. } = inject(TOOLTIP_INJECTION_KEY, void 0);
  20222. const transitionClass = computed$1(() => {
  20223. return props.transition || `${ns.namespace.value}-fade-in-linear`;
  20224. });
  20225. const persistentRef = computed$1(() => {
  20226. return props.persistent;
  20227. });
  20228. onBeforeUnmount(() => {
  20229. destroyed.value = true;
  20230. });
  20231. const shouldRender = computed$1(() => {
  20232. return unref(persistentRef) ? true : unref(open);
  20233. });
  20234. const shouldShow = computed$1(() => {
  20235. return props.disabled ? false : unref(open);
  20236. });
  20237. const appendTo = computed$1(() => {
  20238. return props.appendTo || selector.value;
  20239. });
  20240. const contentStyle = computed$1(() => {
  20241. var _a2;
  20242. return (_a2 = props.style) != null ? _a2 : {};
  20243. });
  20244. const ariaHidden = computed$1(() => !unref(open));
  20245. const onTransitionLeave = () => {
  20246. onHide();
  20247. };
  20248. const stopWhenControlled = () => {
  20249. if (unref(controlled))
  20250. return true;
  20251. };
  20252. const onContentEnter = composeEventHandlers(stopWhenControlled, () => {
  20253. if (props.enterable && unref(trigger2) === "hover") {
  20254. onOpen();
  20255. }
  20256. });
  20257. const onContentLeave = composeEventHandlers(stopWhenControlled, () => {
  20258. if (unref(trigger2) === "hover") {
  20259. onClose();
  20260. }
  20261. });
  20262. const onBeforeEnter = () => {
  20263. var _a2, _b;
  20264. (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  20265. onBeforeShow == null ? void 0 : onBeforeShow();
  20266. };
  20267. const onBeforeLeave = () => {
  20268. onBeforeHide == null ? void 0 : onBeforeHide();
  20269. };
  20270. const onAfterShow = () => {
  20271. onShow();
  20272. stopHandle = onClickOutside(computed$1(() => {
  20273. var _a2;
  20274. return (_a2 = contentRef.value) == null ? void 0 : _a2.popperContentRef;
  20275. }), () => {
  20276. if (unref(controlled))
  20277. return;
  20278. const $trigger = unref(trigger2);
  20279. if ($trigger !== "hover") {
  20280. onClose();
  20281. }
  20282. });
  20283. };
  20284. const onBlur = () => {
  20285. if (!props.virtualTriggering) {
  20286. onClose();
  20287. }
  20288. };
  20289. let stopHandle;
  20290. watch(() => unref(open), (val) => {
  20291. if (!val) {
  20292. stopHandle == null ? void 0 : stopHandle();
  20293. }
  20294. }, {
  20295. flush: "post"
  20296. });
  20297. watch(() => props.content, () => {
  20298. var _a2, _b;
  20299. (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  20300. });
  20301. expose({
  20302. contentRef
  20303. });
  20304. return (_ctx, _cache) => {
  20305. return openBlock(), createBlock(Teleport, {
  20306. disabled: !_ctx.teleported,
  20307. to: unref(appendTo)
  20308. }, [
  20309. createVNode(Transition, {
  20310. name: unref(transitionClass),
  20311. onAfterLeave: onTransitionLeave,
  20312. onBeforeEnter,
  20313. onAfterEnter: onAfterShow,
  20314. onBeforeLeave
  20315. }, {
  20316. default: withCtx(() => [
  20317. unref(shouldRender) ? withDirectives((openBlock(), createBlock(unref(ElPopperContent), mergeProps({
  20318. key: 0,
  20319. id: unref(id),
  20320. ref_key: "contentRef",
  20321. ref: contentRef
  20322. }, _ctx.$attrs, {
  20323. "aria-label": _ctx.ariaLabel,
  20324. "aria-hidden": unref(ariaHidden),
  20325. "boundaries-padding": _ctx.boundariesPadding,
  20326. "fallback-placements": _ctx.fallbackPlacements,
  20327. "gpu-acceleration": _ctx.gpuAcceleration,
  20328. offset: _ctx.offset,
  20329. placement: _ctx.placement,
  20330. "popper-options": _ctx.popperOptions,
  20331. strategy: _ctx.strategy,
  20332. effect: _ctx.effect,
  20333. enterable: _ctx.enterable,
  20334. pure: _ctx.pure,
  20335. "popper-class": _ctx.popperClass,
  20336. "popper-style": [_ctx.popperStyle, unref(contentStyle)],
  20337. "reference-el": _ctx.referenceEl,
  20338. "trigger-target-el": _ctx.triggerTargetEl,
  20339. visible: unref(shouldShow),
  20340. "z-index": _ctx.zIndex,
  20341. onMouseenter: unref(onContentEnter),
  20342. onMouseleave: unref(onContentLeave),
  20343. onBlur,
  20344. onClose: unref(onClose)
  20345. }), {
  20346. default: withCtx(() => [
  20347. !destroyed.value ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  20348. ]),
  20349. _: 3
  20350. }, 16, ["id", "aria-label", "aria-hidden", "boundaries-padding", "fallback-placements", "gpu-acceleration", "offset", "placement", "popper-options", "strategy", "effect", "enterable", "pure", "popper-class", "popper-style", "reference-el", "trigger-target-el", "visible", "z-index", "onMouseenter", "onMouseleave", "onClose"])), [
  20351. [vShow, unref(shouldShow)]
  20352. ]) : createCommentVNode("v-if", true)
  20353. ]),
  20354. _: 3
  20355. }, 8, ["name"])
  20356. ], 8, ["disabled", "to"]);
  20357. };
  20358. }
  20359. });
  20360. var ElTooltipContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$q, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/content.vue"]]);
  20361. const _hoisted_1$f = ["innerHTML"];
  20362. const _hoisted_2$9 = { key: 1 };
  20363. const __default__$f = defineComponent({
  20364. name: "ElTooltip"
  20365. });
  20366. const _sfc_main$p = /* @__PURE__ */ defineComponent({
  20367. ...__default__$f,
  20368. props: useTooltipProps,
  20369. emits: tooltipEmits,
  20370. setup(__props, { expose, emit }) {
  20371. const props = __props;
  20372. usePopperContainer();
  20373. const id = useId();
  20374. const popperRef = ref();
  20375. const contentRef = ref();
  20376. const updatePopper = () => {
  20377. var _a2;
  20378. const popperComponent = unref(popperRef);
  20379. if (popperComponent) {
  20380. (_a2 = popperComponent.popperInstanceRef) == null ? void 0 : _a2.update();
  20381. }
  20382. };
  20383. const open = ref(false);
  20384. const toggleReason = ref();
  20385. const { show, hide, hasUpdateHandler } = useTooltipModelToggle({
  20386. indicator: open,
  20387. toggleReason
  20388. });
  20389. const { onOpen, onClose } = useDelayedToggle({
  20390. showAfter: toRef(props, "showAfter"),
  20391. hideAfter: toRef(props, "hideAfter"),
  20392. autoClose: toRef(props, "autoClose"),
  20393. open: show,
  20394. close: hide
  20395. });
  20396. const controlled = computed$1(() => isBoolean(props.visible) && !hasUpdateHandler.value);
  20397. provide(TOOLTIP_INJECTION_KEY, {
  20398. controlled,
  20399. id,
  20400. open: readonly(open),
  20401. trigger: toRef(props, "trigger"),
  20402. onOpen: (event2) => {
  20403. onOpen(event2);
  20404. },
  20405. onClose: (event2) => {
  20406. onClose(event2);
  20407. },
  20408. onToggle: (event2) => {
  20409. if (unref(open)) {
  20410. onClose(event2);
  20411. } else {
  20412. onOpen(event2);
  20413. }
  20414. },
  20415. onShow: () => {
  20416. emit("show", toggleReason.value);
  20417. },
  20418. onHide: () => {
  20419. emit("hide", toggleReason.value);
  20420. },
  20421. onBeforeShow: () => {
  20422. emit("before-show", toggleReason.value);
  20423. },
  20424. onBeforeHide: () => {
  20425. emit("before-hide", toggleReason.value);
  20426. },
  20427. updatePopper
  20428. });
  20429. watch(() => props.disabled, (disabled) => {
  20430. if (disabled && open.value) {
  20431. open.value = false;
  20432. }
  20433. });
  20434. const isFocusInsideContent = () => {
  20435. var _a2, _b;
  20436. const popperContent = (_b = (_a2 = contentRef.value) == null ? void 0 : _a2.contentRef) == null ? void 0 : _b.popperContentRef;
  20437. return popperContent && popperContent.contains(document.activeElement);
  20438. };
  20439. onDeactivated(() => open.value && hide());
  20440. expose({
  20441. popperRef,
  20442. contentRef,
  20443. isFocusInsideContent,
  20444. updatePopper,
  20445. onOpen,
  20446. onClose,
  20447. hide
  20448. });
  20449. return (_ctx, _cache) => {
  20450. return openBlock(), createBlock(unref(ElPopper), {
  20451. ref_key: "popperRef",
  20452. ref: popperRef,
  20453. role: _ctx.role
  20454. }, {
  20455. default: withCtx(() => [
  20456. createVNode(ElTooltipTrigger, {
  20457. disabled: _ctx.disabled,
  20458. trigger: _ctx.trigger,
  20459. "trigger-keys": _ctx.triggerKeys,
  20460. "virtual-ref": _ctx.virtualRef,
  20461. "virtual-triggering": _ctx.virtualTriggering
  20462. }, {
  20463. default: withCtx(() => [
  20464. _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : createCommentVNode("v-if", true)
  20465. ]),
  20466. _: 3
  20467. }, 8, ["disabled", "trigger", "trigger-keys", "virtual-ref", "virtual-triggering"]),
  20468. createVNode(ElTooltipContent, {
  20469. ref_key: "contentRef",
  20470. ref: contentRef,
  20471. "aria-label": _ctx.ariaLabel,
  20472. "boundaries-padding": _ctx.boundariesPadding,
  20473. content: _ctx.content,
  20474. disabled: _ctx.disabled,
  20475. effect: _ctx.effect,
  20476. enterable: _ctx.enterable,
  20477. "fallback-placements": _ctx.fallbackPlacements,
  20478. "hide-after": _ctx.hideAfter,
  20479. "gpu-acceleration": _ctx.gpuAcceleration,
  20480. offset: _ctx.offset,
  20481. persistent: _ctx.persistent,
  20482. "popper-class": _ctx.popperClass,
  20483. "popper-style": _ctx.popperStyle,
  20484. placement: _ctx.placement,
  20485. "popper-options": _ctx.popperOptions,
  20486. pure: _ctx.pure,
  20487. "raw-content": _ctx.rawContent,
  20488. "reference-el": _ctx.referenceEl,
  20489. "trigger-target-el": _ctx.triggerTargetEl,
  20490. "show-after": _ctx.showAfter,
  20491. strategy: _ctx.strategy,
  20492. teleported: _ctx.teleported,
  20493. transition: _ctx.transition,
  20494. "virtual-triggering": _ctx.virtualTriggering,
  20495. "z-index": _ctx.zIndex,
  20496. "append-to": _ctx.appendTo
  20497. }, {
  20498. default: withCtx(() => [
  20499. renderSlot(_ctx.$slots, "content", {}, () => [
  20500. _ctx.rawContent ? (openBlock(), createElementBlock("span", {
  20501. key: 0,
  20502. innerHTML: _ctx.content
  20503. }, null, 8, _hoisted_1$f)) : (openBlock(), createElementBlock("span", _hoisted_2$9, toDisplayString(_ctx.content), 1))
  20504. ]),
  20505. _ctx.showArrow ? (openBlock(), createBlock(unref(ElPopperArrow), {
  20506. key: 0,
  20507. "arrow-offset": _ctx.arrowOffset
  20508. }, null, 8, ["arrow-offset"])) : createCommentVNode("v-if", true)
  20509. ]),
  20510. _: 3
  20511. }, 8, ["aria-label", "boundaries-padding", "content", "disabled", "effect", "enterable", "fallback-placements", "hide-after", "gpu-acceleration", "offset", "persistent", "popper-class", "popper-style", "placement", "popper-options", "pure", "raw-content", "reference-el", "trigger-target-el", "show-after", "strategy", "teleported", "transition", "virtual-triggering", "z-index", "append-to"])
  20512. ]),
  20513. _: 3
  20514. }, 8, ["role"]);
  20515. };
  20516. }
  20517. });
  20518. var Tooltip = /* @__PURE__ */ _export_sfc$1(_sfc_main$p, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tooltip/src/tooltip.vue"]]);
  20519. const ElTooltip = withInstall(Tooltip);
  20520. const buttonGroupContextKey = Symbol("buttonGroupContextKey");
  20521. const useButton = (props, emit) => {
  20522. useDeprecated({
  20523. from: "type.text",
  20524. replacement: "link",
  20525. version: "3.0.0",
  20526. scope: "props",
  20527. ref: "https://element-plus.org/en-US/component/button.html#button-attributes"
  20528. }, computed$1(() => props.type === "text"));
  20529. const buttonGroupContext = inject(buttonGroupContextKey, void 0);
  20530. const globalConfig2 = useGlobalConfig("button");
  20531. const { form } = useFormItem();
  20532. const _size = useFormSize(computed$1(() => buttonGroupContext == null ? void 0 : buttonGroupContext.size));
  20533. const _disabled = useFormDisabled();
  20534. const _ref = ref();
  20535. const slots = useSlots();
  20536. const _type = computed$1(() => props.type || (buttonGroupContext == null ? void 0 : buttonGroupContext.type) || "");
  20537. const autoInsertSpace = computed$1(() => {
  20538. var _a2, _b, _c;
  20539. return (_c = (_b = props.autoInsertSpace) != null ? _b : (_a2 = globalConfig2.value) == null ? void 0 : _a2.autoInsertSpace) != null ? _c : false;
  20540. });
  20541. const _props = computed$1(() => {
  20542. if (props.tag === "button") {
  20543. return {
  20544. ariaDisabled: _disabled.value || props.loading,
  20545. disabled: _disabled.value || props.loading,
  20546. autofocus: props.autofocus,
  20547. type: props.nativeType
  20548. };
  20549. }
  20550. return {};
  20551. });
  20552. const shouldAddSpace = computed$1(() => {
  20553. var _a2;
  20554. const defaultSlot = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  20555. if (autoInsertSpace.value && (defaultSlot == null ? void 0 : defaultSlot.length) === 1) {
  20556. const slot = defaultSlot[0];
  20557. if ((slot == null ? void 0 : slot.type) === Text$1) {
  20558. const text = slot.children;
  20559. return /^\p{Unified_Ideograph}{2}$/u.test(text.trim());
  20560. }
  20561. }
  20562. return false;
  20563. });
  20564. const handleClick = (evt) => {
  20565. if (props.nativeType === "reset") {
  20566. form == null ? void 0 : form.resetFields();
  20567. }
  20568. emit("click", evt);
  20569. };
  20570. return {
  20571. _disabled,
  20572. _size,
  20573. _type,
  20574. _ref,
  20575. _props,
  20576. shouldAddSpace,
  20577. handleClick
  20578. };
  20579. };
  20580. const buttonTypes = [
  20581. "default",
  20582. "primary",
  20583. "success",
  20584. "warning",
  20585. "info",
  20586. "danger",
  20587. "text",
  20588. ""
  20589. ];
  20590. const buttonNativeTypes = ["button", "submit", "reset"];
  20591. const buttonProps = buildProps({
  20592. size: useSizeProp,
  20593. disabled: Boolean,
  20594. type: {
  20595. type: String,
  20596. values: buttonTypes,
  20597. default: ""
  20598. },
  20599. icon: {
  20600. type: iconPropType
  20601. },
  20602. nativeType: {
  20603. type: String,
  20604. values: buttonNativeTypes,
  20605. default: "button"
  20606. },
  20607. loading: Boolean,
  20608. loadingIcon: {
  20609. type: iconPropType,
  20610. default: () => loading_default
  20611. },
  20612. plain: Boolean,
  20613. text: Boolean,
  20614. link: Boolean,
  20615. bg: Boolean,
  20616. autofocus: Boolean,
  20617. round: Boolean,
  20618. circle: Boolean,
  20619. color: String,
  20620. dark: Boolean,
  20621. autoInsertSpace: {
  20622. type: Boolean,
  20623. default: void 0
  20624. },
  20625. tag: {
  20626. type: definePropType([String, Object]),
  20627. default: "button"
  20628. }
  20629. });
  20630. const buttonEmits = {
  20631. click: (evt) => evt instanceof MouseEvent
  20632. };
  20633. function bound01$1(n, max2) {
  20634. if (isOnePointZero$1(n)) {
  20635. n = "100%";
  20636. }
  20637. var isPercent = isPercentage$1(n);
  20638. n = max2 === 360 ? n : Math.min(max2, Math.max(0, parseFloat(n)));
  20639. if (isPercent) {
  20640. n = parseInt(String(n * max2), 10) / 100;
  20641. }
  20642. if (Math.abs(n - max2) < 1e-6) {
  20643. return 1;
  20644. }
  20645. if (max2 === 360) {
  20646. n = (n < 0 ? n % max2 + max2 : n % max2) / parseFloat(String(max2));
  20647. } else {
  20648. n = n % max2 / parseFloat(String(max2));
  20649. }
  20650. return n;
  20651. }
  20652. function clamp01(val) {
  20653. return Math.min(1, Math.max(0, val));
  20654. }
  20655. function isOnePointZero$1(n) {
  20656. return typeof n === "string" && n.indexOf(".") !== -1 && parseFloat(n) === 1;
  20657. }
  20658. function isPercentage$1(n) {
  20659. return typeof n === "string" && n.indexOf("%") !== -1;
  20660. }
  20661. function boundAlpha(a) {
  20662. a = parseFloat(a);
  20663. if (isNaN(a) || a < 0 || a > 1) {
  20664. a = 1;
  20665. }
  20666. return a;
  20667. }
  20668. function convertToPercentage(n) {
  20669. if (n <= 1) {
  20670. return "".concat(Number(n) * 100, "%");
  20671. }
  20672. return n;
  20673. }
  20674. function pad2(c) {
  20675. return c.length === 1 ? "0" + c : String(c);
  20676. }
  20677. function rgbToRgb(r2, g, b) {
  20678. return {
  20679. r: bound01$1(r2, 255) * 255,
  20680. g: bound01$1(g, 255) * 255,
  20681. b: bound01$1(b, 255) * 255
  20682. };
  20683. }
  20684. function rgbToHsl(r2, g, b) {
  20685. r2 = bound01$1(r2, 255);
  20686. g = bound01$1(g, 255);
  20687. b = bound01$1(b, 255);
  20688. var max2 = Math.max(r2, g, b);
  20689. var min2 = Math.min(r2, g, b);
  20690. var h2 = 0;
  20691. var s = 0;
  20692. var l = (max2 + min2) / 2;
  20693. if (max2 === min2) {
  20694. s = 0;
  20695. h2 = 0;
  20696. } else {
  20697. var d2 = max2 - min2;
  20698. s = l > 0.5 ? d2 / (2 - max2 - min2) : d2 / (max2 + min2);
  20699. switch (max2) {
  20700. case r2:
  20701. h2 = (g - b) / d2 + (g < b ? 6 : 0);
  20702. break;
  20703. case g:
  20704. h2 = (b - r2) / d2 + 2;
  20705. break;
  20706. case b:
  20707. h2 = (r2 - g) / d2 + 4;
  20708. break;
  20709. }
  20710. h2 /= 6;
  20711. }
  20712. return { h: h2, s, l };
  20713. }
  20714. function hue2rgb(p, q2, t2) {
  20715. if (t2 < 0) {
  20716. t2 += 1;
  20717. }
  20718. if (t2 > 1) {
  20719. t2 -= 1;
  20720. }
  20721. if (t2 < 1 / 6) {
  20722. return p + (q2 - p) * (6 * t2);
  20723. }
  20724. if (t2 < 1 / 2) {
  20725. return q2;
  20726. }
  20727. if (t2 < 2 / 3) {
  20728. return p + (q2 - p) * (2 / 3 - t2) * 6;
  20729. }
  20730. return p;
  20731. }
  20732. function hslToRgb(h2, s, l) {
  20733. var r2;
  20734. var g;
  20735. var b;
  20736. h2 = bound01$1(h2, 360);
  20737. s = bound01$1(s, 100);
  20738. l = bound01$1(l, 100);
  20739. if (s === 0) {
  20740. g = l;
  20741. b = l;
  20742. r2 = l;
  20743. } else {
  20744. var q2 = l < 0.5 ? l * (1 + s) : l + s - l * s;
  20745. var p = 2 * l - q2;
  20746. r2 = hue2rgb(p, q2, h2 + 1 / 3);
  20747. g = hue2rgb(p, q2, h2);
  20748. b = hue2rgb(p, q2, h2 - 1 / 3);
  20749. }
  20750. return { r: r2 * 255, g: g * 255, b: b * 255 };
  20751. }
  20752. function rgbToHsv(r2, g, b) {
  20753. r2 = bound01$1(r2, 255);
  20754. g = bound01$1(g, 255);
  20755. b = bound01$1(b, 255);
  20756. var max2 = Math.max(r2, g, b);
  20757. var min2 = Math.min(r2, g, b);
  20758. var h2 = 0;
  20759. var v = max2;
  20760. var d2 = max2 - min2;
  20761. var s = max2 === 0 ? 0 : d2 / max2;
  20762. if (max2 === min2) {
  20763. h2 = 0;
  20764. } else {
  20765. switch (max2) {
  20766. case r2:
  20767. h2 = (g - b) / d2 + (g < b ? 6 : 0);
  20768. break;
  20769. case g:
  20770. h2 = (b - r2) / d2 + 2;
  20771. break;
  20772. case b:
  20773. h2 = (r2 - g) / d2 + 4;
  20774. break;
  20775. }
  20776. h2 /= 6;
  20777. }
  20778. return { h: h2, s, v };
  20779. }
  20780. function hsvToRgb(h2, s, v) {
  20781. h2 = bound01$1(h2, 360) * 6;
  20782. s = bound01$1(s, 100);
  20783. v = bound01$1(v, 100);
  20784. var i2 = Math.floor(h2);
  20785. var f = h2 - i2;
  20786. var p = v * (1 - s);
  20787. var q2 = v * (1 - f * s);
  20788. var t2 = v * (1 - (1 - f) * s);
  20789. var mod = i2 % 6;
  20790. var r2 = [v, q2, p, p, t2, v][mod];
  20791. var g = [t2, v, v, q2, p, p][mod];
  20792. var b = [p, p, t2, v, v, q2][mod];
  20793. return { r: r2 * 255, g: g * 255, b: b * 255 };
  20794. }
  20795. function rgbToHex(r2, g, b, allow3Char) {
  20796. var hex = [
  20797. pad2(Math.round(r2).toString(16)),
  20798. pad2(Math.round(g).toString(16)),
  20799. pad2(Math.round(b).toString(16))
  20800. ];
  20801. if (allow3Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1))) {
  20802. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
  20803. }
  20804. return hex.join("");
  20805. }
  20806. function rgbaToHex(r2, g, b, a, allow4Char) {
  20807. var hex = [
  20808. pad2(Math.round(r2).toString(16)),
  20809. pad2(Math.round(g).toString(16)),
  20810. pad2(Math.round(b).toString(16)),
  20811. pad2(convertDecimalToHex(a))
  20812. ];
  20813. if (allow4Char && hex[0].startsWith(hex[0].charAt(1)) && hex[1].startsWith(hex[1].charAt(1)) && hex[2].startsWith(hex[2].charAt(1)) && hex[3].startsWith(hex[3].charAt(1))) {
  20814. return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
  20815. }
  20816. return hex.join("");
  20817. }
  20818. function convertDecimalToHex(d2) {
  20819. return Math.round(parseFloat(d2) * 255).toString(16);
  20820. }
  20821. function convertHexToDecimal(h2) {
  20822. return parseIntFromHex(h2) / 255;
  20823. }
  20824. function parseIntFromHex(val) {
  20825. return parseInt(val, 16);
  20826. }
  20827. function numberInputToObject(color2) {
  20828. return {
  20829. r: color2 >> 16,
  20830. g: (color2 & 65280) >> 8,
  20831. b: color2 & 255
  20832. };
  20833. }
  20834. var names = {
  20835. aliceblue: "#f0f8ff",
  20836. antiquewhite: "#faebd7",
  20837. aqua: "#00ffff",
  20838. aquamarine: "#7fffd4",
  20839. azure: "#f0ffff",
  20840. beige: "#f5f5dc",
  20841. bisque: "#ffe4c4",
  20842. black: "#000000",
  20843. blanchedalmond: "#ffebcd",
  20844. blue: "#0000ff",
  20845. blueviolet: "#8a2be2",
  20846. brown: "#a52a2a",
  20847. burlywood: "#deb887",
  20848. cadetblue: "#5f9ea0",
  20849. chartreuse: "#7fff00",
  20850. chocolate: "#d2691e",
  20851. coral: "#ff7f50",
  20852. cornflowerblue: "#6495ed",
  20853. cornsilk: "#fff8dc",
  20854. crimson: "#dc143c",
  20855. cyan: "#00ffff",
  20856. darkblue: "#00008b",
  20857. darkcyan: "#008b8b",
  20858. darkgoldenrod: "#b8860b",
  20859. darkgray: "#a9a9a9",
  20860. darkgreen: "#006400",
  20861. darkgrey: "#a9a9a9",
  20862. darkkhaki: "#bdb76b",
  20863. darkmagenta: "#8b008b",
  20864. darkolivegreen: "#556b2f",
  20865. darkorange: "#ff8c00",
  20866. darkorchid: "#9932cc",
  20867. darkred: "#8b0000",
  20868. darksalmon: "#e9967a",
  20869. darkseagreen: "#8fbc8f",
  20870. darkslateblue: "#483d8b",
  20871. darkslategray: "#2f4f4f",
  20872. darkslategrey: "#2f4f4f",
  20873. darkturquoise: "#00ced1",
  20874. darkviolet: "#9400d3",
  20875. deeppink: "#ff1493",
  20876. deepskyblue: "#00bfff",
  20877. dimgray: "#696969",
  20878. dimgrey: "#696969",
  20879. dodgerblue: "#1e90ff",
  20880. firebrick: "#b22222",
  20881. floralwhite: "#fffaf0",
  20882. forestgreen: "#228b22",
  20883. fuchsia: "#ff00ff",
  20884. gainsboro: "#dcdcdc",
  20885. ghostwhite: "#f8f8ff",
  20886. goldenrod: "#daa520",
  20887. gold: "#ffd700",
  20888. gray: "#808080",
  20889. green: "#008000",
  20890. greenyellow: "#adff2f",
  20891. grey: "#808080",
  20892. honeydew: "#f0fff0",
  20893. hotpink: "#ff69b4",
  20894. indianred: "#cd5c5c",
  20895. indigo: "#4b0082",
  20896. ivory: "#fffff0",
  20897. khaki: "#f0e68c",
  20898. lavenderblush: "#fff0f5",
  20899. lavender: "#e6e6fa",
  20900. lawngreen: "#7cfc00",
  20901. lemonchiffon: "#fffacd",
  20902. lightblue: "#add8e6",
  20903. lightcoral: "#f08080",
  20904. lightcyan: "#e0ffff",
  20905. lightgoldenrodyellow: "#fafad2",
  20906. lightgray: "#d3d3d3",
  20907. lightgreen: "#90ee90",
  20908. lightgrey: "#d3d3d3",
  20909. lightpink: "#ffb6c1",
  20910. lightsalmon: "#ffa07a",
  20911. lightseagreen: "#20b2aa",
  20912. lightskyblue: "#87cefa",
  20913. lightslategray: "#778899",
  20914. lightslategrey: "#778899",
  20915. lightsteelblue: "#b0c4de",
  20916. lightyellow: "#ffffe0",
  20917. lime: "#00ff00",
  20918. limegreen: "#32cd32",
  20919. linen: "#faf0e6",
  20920. magenta: "#ff00ff",
  20921. maroon: "#800000",
  20922. mediumaquamarine: "#66cdaa",
  20923. mediumblue: "#0000cd",
  20924. mediumorchid: "#ba55d3",
  20925. mediumpurple: "#9370db",
  20926. mediumseagreen: "#3cb371",
  20927. mediumslateblue: "#7b68ee",
  20928. mediumspringgreen: "#00fa9a",
  20929. mediumturquoise: "#48d1cc",
  20930. mediumvioletred: "#c71585",
  20931. midnightblue: "#191970",
  20932. mintcream: "#f5fffa",
  20933. mistyrose: "#ffe4e1",
  20934. moccasin: "#ffe4b5",
  20935. navajowhite: "#ffdead",
  20936. navy: "#000080",
  20937. oldlace: "#fdf5e6",
  20938. olive: "#808000",
  20939. olivedrab: "#6b8e23",
  20940. orange: "#ffa500",
  20941. orangered: "#ff4500",
  20942. orchid: "#da70d6",
  20943. palegoldenrod: "#eee8aa",
  20944. palegreen: "#98fb98",
  20945. paleturquoise: "#afeeee",
  20946. palevioletred: "#db7093",
  20947. papayawhip: "#ffefd5",
  20948. peachpuff: "#ffdab9",
  20949. peru: "#cd853f",
  20950. pink: "#ffc0cb",
  20951. plum: "#dda0dd",
  20952. powderblue: "#b0e0e6",
  20953. purple: "#800080",
  20954. rebeccapurple: "#663399",
  20955. red: "#ff0000",
  20956. rosybrown: "#bc8f8f",
  20957. royalblue: "#4169e1",
  20958. saddlebrown: "#8b4513",
  20959. salmon: "#fa8072",
  20960. sandybrown: "#f4a460",
  20961. seagreen: "#2e8b57",
  20962. seashell: "#fff5ee",
  20963. sienna: "#a0522d",
  20964. silver: "#c0c0c0",
  20965. skyblue: "#87ceeb",
  20966. slateblue: "#6a5acd",
  20967. slategray: "#708090",
  20968. slategrey: "#708090",
  20969. snow: "#fffafa",
  20970. springgreen: "#00ff7f",
  20971. steelblue: "#4682b4",
  20972. tan: "#d2b48c",
  20973. teal: "#008080",
  20974. thistle: "#d8bfd8",
  20975. tomato: "#ff6347",
  20976. turquoise: "#40e0d0",
  20977. violet: "#ee82ee",
  20978. wheat: "#f5deb3",
  20979. white: "#ffffff",
  20980. whitesmoke: "#f5f5f5",
  20981. yellow: "#ffff00",
  20982. yellowgreen: "#9acd32"
  20983. };
  20984. function inputToRGB(color2) {
  20985. var rgb = { r: 0, g: 0, b: 0 };
  20986. var a = 1;
  20987. var s = null;
  20988. var v = null;
  20989. var l = null;
  20990. var ok = false;
  20991. var format = false;
  20992. if (typeof color2 === "string") {
  20993. color2 = stringInputToObject(color2);
  20994. }
  20995. if (typeof color2 === "object") {
  20996. if (isValidCSSUnit(color2.r) && isValidCSSUnit(color2.g) && isValidCSSUnit(color2.b)) {
  20997. rgb = rgbToRgb(color2.r, color2.g, color2.b);
  20998. ok = true;
  20999. format = String(color2.r).substr(-1) === "%" ? "prgb" : "rgb";
  21000. } else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.v)) {
  21001. s = convertToPercentage(color2.s);
  21002. v = convertToPercentage(color2.v);
  21003. rgb = hsvToRgb(color2.h, s, v);
  21004. ok = true;
  21005. format = "hsv";
  21006. } else if (isValidCSSUnit(color2.h) && isValidCSSUnit(color2.s) && isValidCSSUnit(color2.l)) {
  21007. s = convertToPercentage(color2.s);
  21008. l = convertToPercentage(color2.l);
  21009. rgb = hslToRgb(color2.h, s, l);
  21010. ok = true;
  21011. format = "hsl";
  21012. }
  21013. if (Object.prototype.hasOwnProperty.call(color2, "a")) {
  21014. a = color2.a;
  21015. }
  21016. }
  21017. a = boundAlpha(a);
  21018. return {
  21019. ok,
  21020. format: color2.format || format,
  21021. r: Math.min(255, Math.max(rgb.r, 0)),
  21022. g: Math.min(255, Math.max(rgb.g, 0)),
  21023. b: Math.min(255, Math.max(rgb.b, 0)),
  21024. a
  21025. };
  21026. }
  21027. var CSS_INTEGER = "[-\\+]?\\d+%?";
  21028. var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
  21029. var CSS_UNIT = "(?:".concat(CSS_NUMBER, ")|(?:").concat(CSS_INTEGER, ")");
  21030. var PERMISSIVE_MATCH3 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  21031. var PERMISSIVE_MATCH4 = "[\\s|\\(]+(".concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")[,|\\s]+(").concat(CSS_UNIT, ")\\s*\\)?");
  21032. var matchers = {
  21033. CSS_UNIT: new RegExp(CSS_UNIT),
  21034. rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
  21035. rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
  21036. hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
  21037. hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
  21038. hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
  21039. hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
  21040. hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  21041. hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
  21042. hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
  21043. hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
  21044. };
  21045. function stringInputToObject(color2) {
  21046. color2 = color2.trim().toLowerCase();
  21047. if (color2.length === 0) {
  21048. return false;
  21049. }
  21050. var named = false;
  21051. if (names[color2]) {
  21052. color2 = names[color2];
  21053. named = true;
  21054. } else if (color2 === "transparent") {
  21055. return { r: 0, g: 0, b: 0, a: 0, format: "name" };
  21056. }
  21057. var match = matchers.rgb.exec(color2);
  21058. if (match) {
  21059. return { r: match[1], g: match[2], b: match[3] };
  21060. }
  21061. match = matchers.rgba.exec(color2);
  21062. if (match) {
  21063. return { r: match[1], g: match[2], b: match[3], a: match[4] };
  21064. }
  21065. match = matchers.hsl.exec(color2);
  21066. if (match) {
  21067. return { h: match[1], s: match[2], l: match[3] };
  21068. }
  21069. match = matchers.hsla.exec(color2);
  21070. if (match) {
  21071. return { h: match[1], s: match[2], l: match[3], a: match[4] };
  21072. }
  21073. match = matchers.hsv.exec(color2);
  21074. if (match) {
  21075. return { h: match[1], s: match[2], v: match[3] };
  21076. }
  21077. match = matchers.hsva.exec(color2);
  21078. if (match) {
  21079. return { h: match[1], s: match[2], v: match[3], a: match[4] };
  21080. }
  21081. match = matchers.hex8.exec(color2);
  21082. if (match) {
  21083. return {
  21084. r: parseIntFromHex(match[1]),
  21085. g: parseIntFromHex(match[2]),
  21086. b: parseIntFromHex(match[3]),
  21087. a: convertHexToDecimal(match[4]),
  21088. format: named ? "name" : "hex8"
  21089. };
  21090. }
  21091. match = matchers.hex6.exec(color2);
  21092. if (match) {
  21093. return {
  21094. r: parseIntFromHex(match[1]),
  21095. g: parseIntFromHex(match[2]),
  21096. b: parseIntFromHex(match[3]),
  21097. format: named ? "name" : "hex"
  21098. };
  21099. }
  21100. match = matchers.hex4.exec(color2);
  21101. if (match) {
  21102. return {
  21103. r: parseIntFromHex(match[1] + match[1]),
  21104. g: parseIntFromHex(match[2] + match[2]),
  21105. b: parseIntFromHex(match[3] + match[3]),
  21106. a: convertHexToDecimal(match[4] + match[4]),
  21107. format: named ? "name" : "hex8"
  21108. };
  21109. }
  21110. match = matchers.hex3.exec(color2);
  21111. if (match) {
  21112. return {
  21113. r: parseIntFromHex(match[1] + match[1]),
  21114. g: parseIntFromHex(match[2] + match[2]),
  21115. b: parseIntFromHex(match[3] + match[3]),
  21116. format: named ? "name" : "hex"
  21117. };
  21118. }
  21119. return false;
  21120. }
  21121. function isValidCSSUnit(color2) {
  21122. return Boolean(matchers.CSS_UNIT.exec(String(color2)));
  21123. }
  21124. var TinyColor = function() {
  21125. function TinyColor2(color2, opts) {
  21126. if (color2 === void 0) {
  21127. color2 = "";
  21128. }
  21129. if (opts === void 0) {
  21130. opts = {};
  21131. }
  21132. var _a2;
  21133. if (color2 instanceof TinyColor2) {
  21134. return color2;
  21135. }
  21136. if (typeof color2 === "number") {
  21137. color2 = numberInputToObject(color2);
  21138. }
  21139. this.originalInput = color2;
  21140. var rgb = inputToRGB(color2);
  21141. this.originalInput = color2;
  21142. this.r = rgb.r;
  21143. this.g = rgb.g;
  21144. this.b = rgb.b;
  21145. this.a = rgb.a;
  21146. this.roundA = Math.round(100 * this.a) / 100;
  21147. this.format = (_a2 = opts.format) !== null && _a2 !== void 0 ? _a2 : rgb.format;
  21148. this.gradientType = opts.gradientType;
  21149. if (this.r < 1) {
  21150. this.r = Math.round(this.r);
  21151. }
  21152. if (this.g < 1) {
  21153. this.g = Math.round(this.g);
  21154. }
  21155. if (this.b < 1) {
  21156. this.b = Math.round(this.b);
  21157. }
  21158. this.isValid = rgb.ok;
  21159. }
  21160. TinyColor2.prototype.isDark = function() {
  21161. return this.getBrightness() < 128;
  21162. };
  21163. TinyColor2.prototype.isLight = function() {
  21164. return !this.isDark();
  21165. };
  21166. TinyColor2.prototype.getBrightness = function() {
  21167. var rgb = this.toRgb();
  21168. return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1e3;
  21169. };
  21170. TinyColor2.prototype.getLuminance = function() {
  21171. var rgb = this.toRgb();
  21172. var R2;
  21173. var G2;
  21174. var B2;
  21175. var RsRGB = rgb.r / 255;
  21176. var GsRGB = rgb.g / 255;
  21177. var BsRGB = rgb.b / 255;
  21178. if (RsRGB <= 0.03928) {
  21179. R2 = RsRGB / 12.92;
  21180. } else {
  21181. R2 = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
  21182. }
  21183. if (GsRGB <= 0.03928) {
  21184. G2 = GsRGB / 12.92;
  21185. } else {
  21186. G2 = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
  21187. }
  21188. if (BsRGB <= 0.03928) {
  21189. B2 = BsRGB / 12.92;
  21190. } else {
  21191. B2 = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
  21192. }
  21193. return 0.2126 * R2 + 0.7152 * G2 + 0.0722 * B2;
  21194. };
  21195. TinyColor2.prototype.getAlpha = function() {
  21196. return this.a;
  21197. };
  21198. TinyColor2.prototype.setAlpha = function(alpha) {
  21199. this.a = boundAlpha(alpha);
  21200. this.roundA = Math.round(100 * this.a) / 100;
  21201. return this;
  21202. };
  21203. TinyColor2.prototype.isMonochrome = function() {
  21204. var s = this.toHsl().s;
  21205. return s === 0;
  21206. };
  21207. TinyColor2.prototype.toHsv = function() {
  21208. var hsv = rgbToHsv(this.r, this.g, this.b);
  21209. return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this.a };
  21210. };
  21211. TinyColor2.prototype.toHsvString = function() {
  21212. var hsv = rgbToHsv(this.r, this.g, this.b);
  21213. var h2 = Math.round(hsv.h * 360);
  21214. var s = Math.round(hsv.s * 100);
  21215. var v = Math.round(hsv.v * 100);
  21216. return this.a === 1 ? "hsv(".concat(h2, ", ").concat(s, "%, ").concat(v, "%)") : "hsva(".concat(h2, ", ").concat(s, "%, ").concat(v, "%, ").concat(this.roundA, ")");
  21217. };
  21218. TinyColor2.prototype.toHsl = function() {
  21219. var hsl = rgbToHsl(this.r, this.g, this.b);
  21220. return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this.a };
  21221. };
  21222. TinyColor2.prototype.toHslString = function() {
  21223. var hsl = rgbToHsl(this.r, this.g, this.b);
  21224. var h2 = Math.round(hsl.h * 360);
  21225. var s = Math.round(hsl.s * 100);
  21226. var l = Math.round(hsl.l * 100);
  21227. return this.a === 1 ? "hsl(".concat(h2, ", ").concat(s, "%, ").concat(l, "%)") : "hsla(".concat(h2, ", ").concat(s, "%, ").concat(l, "%, ").concat(this.roundA, ")");
  21228. };
  21229. TinyColor2.prototype.toHex = function(allow3Char) {
  21230. if (allow3Char === void 0) {
  21231. allow3Char = false;
  21232. }
  21233. return rgbToHex(this.r, this.g, this.b, allow3Char);
  21234. };
  21235. TinyColor2.prototype.toHexString = function(allow3Char) {
  21236. if (allow3Char === void 0) {
  21237. allow3Char = false;
  21238. }
  21239. return "#" + this.toHex(allow3Char);
  21240. };
  21241. TinyColor2.prototype.toHex8 = function(allow4Char) {
  21242. if (allow4Char === void 0) {
  21243. allow4Char = false;
  21244. }
  21245. return rgbaToHex(this.r, this.g, this.b, this.a, allow4Char);
  21246. };
  21247. TinyColor2.prototype.toHex8String = function(allow4Char) {
  21248. if (allow4Char === void 0) {
  21249. allow4Char = false;
  21250. }
  21251. return "#" + this.toHex8(allow4Char);
  21252. };
  21253. TinyColor2.prototype.toHexShortString = function(allowShortChar) {
  21254. if (allowShortChar === void 0) {
  21255. allowShortChar = false;
  21256. }
  21257. return this.a === 1 ? this.toHexString(allowShortChar) : this.toHex8String(allowShortChar);
  21258. };
  21259. TinyColor2.prototype.toRgb = function() {
  21260. return {
  21261. r: Math.round(this.r),
  21262. g: Math.round(this.g),
  21263. b: Math.round(this.b),
  21264. a: this.a
  21265. };
  21266. };
  21267. TinyColor2.prototype.toRgbString = function() {
  21268. var r2 = Math.round(this.r);
  21269. var g = Math.round(this.g);
  21270. var b = Math.round(this.b);
  21271. return this.a === 1 ? "rgb(".concat(r2, ", ").concat(g, ", ").concat(b, ")") : "rgba(".concat(r2, ", ").concat(g, ", ").concat(b, ", ").concat(this.roundA, ")");
  21272. };
  21273. TinyColor2.prototype.toPercentageRgb = function() {
  21274. var fmt = function(x) {
  21275. return "".concat(Math.round(bound01$1(x, 255) * 100), "%");
  21276. };
  21277. return {
  21278. r: fmt(this.r),
  21279. g: fmt(this.g),
  21280. b: fmt(this.b),
  21281. a: this.a
  21282. };
  21283. };
  21284. TinyColor2.prototype.toPercentageRgbString = function() {
  21285. var rnd = function(x) {
  21286. return Math.round(bound01$1(x, 255) * 100);
  21287. };
  21288. return this.a === 1 ? "rgb(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%)") : "rgba(".concat(rnd(this.r), "%, ").concat(rnd(this.g), "%, ").concat(rnd(this.b), "%, ").concat(this.roundA, ")");
  21289. };
  21290. TinyColor2.prototype.toName = function() {
  21291. if (this.a === 0) {
  21292. return "transparent";
  21293. }
  21294. if (this.a < 1) {
  21295. return false;
  21296. }
  21297. var hex = "#" + rgbToHex(this.r, this.g, this.b, false);
  21298. for (var _i = 0, _a2 = Object.entries(names); _i < _a2.length; _i++) {
  21299. var _b = _a2[_i], key = _b[0], value = _b[1];
  21300. if (hex === value) {
  21301. return key;
  21302. }
  21303. }
  21304. return false;
  21305. };
  21306. TinyColor2.prototype.toString = function(format) {
  21307. var formatSet = Boolean(format);
  21308. format = format !== null && format !== void 0 ? format : this.format;
  21309. var formattedString = false;
  21310. var hasAlpha = this.a < 1 && this.a >= 0;
  21311. var needsAlphaFormat = !formatSet && hasAlpha && (format.startsWith("hex") || format === "name");
  21312. if (needsAlphaFormat) {
  21313. if (format === "name" && this.a === 0) {
  21314. return this.toName();
  21315. }
  21316. return this.toRgbString();
  21317. }
  21318. if (format === "rgb") {
  21319. formattedString = this.toRgbString();
  21320. }
  21321. if (format === "prgb") {
  21322. formattedString = this.toPercentageRgbString();
  21323. }
  21324. if (format === "hex" || format === "hex6") {
  21325. formattedString = this.toHexString();
  21326. }
  21327. if (format === "hex3") {
  21328. formattedString = this.toHexString(true);
  21329. }
  21330. if (format === "hex4") {
  21331. formattedString = this.toHex8String(true);
  21332. }
  21333. if (format === "hex8") {
  21334. formattedString = this.toHex8String();
  21335. }
  21336. if (format === "name") {
  21337. formattedString = this.toName();
  21338. }
  21339. if (format === "hsl") {
  21340. formattedString = this.toHslString();
  21341. }
  21342. if (format === "hsv") {
  21343. formattedString = this.toHsvString();
  21344. }
  21345. return formattedString || this.toHexString();
  21346. };
  21347. TinyColor2.prototype.toNumber = function() {
  21348. return (Math.round(this.r) << 16) + (Math.round(this.g) << 8) + Math.round(this.b);
  21349. };
  21350. TinyColor2.prototype.clone = function() {
  21351. return new TinyColor2(this.toString());
  21352. };
  21353. TinyColor2.prototype.lighten = function(amount) {
  21354. if (amount === void 0) {
  21355. amount = 10;
  21356. }
  21357. var hsl = this.toHsl();
  21358. hsl.l += amount / 100;
  21359. hsl.l = clamp01(hsl.l);
  21360. return new TinyColor2(hsl);
  21361. };
  21362. TinyColor2.prototype.brighten = function(amount) {
  21363. if (amount === void 0) {
  21364. amount = 10;
  21365. }
  21366. var rgb = this.toRgb();
  21367. rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
  21368. rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
  21369. rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
  21370. return new TinyColor2(rgb);
  21371. };
  21372. TinyColor2.prototype.darken = function(amount) {
  21373. if (amount === void 0) {
  21374. amount = 10;
  21375. }
  21376. var hsl = this.toHsl();
  21377. hsl.l -= amount / 100;
  21378. hsl.l = clamp01(hsl.l);
  21379. return new TinyColor2(hsl);
  21380. };
  21381. TinyColor2.prototype.tint = function(amount) {
  21382. if (amount === void 0) {
  21383. amount = 10;
  21384. }
  21385. return this.mix("white", amount);
  21386. };
  21387. TinyColor2.prototype.shade = function(amount) {
  21388. if (amount === void 0) {
  21389. amount = 10;
  21390. }
  21391. return this.mix("black", amount);
  21392. };
  21393. TinyColor2.prototype.desaturate = function(amount) {
  21394. if (amount === void 0) {
  21395. amount = 10;
  21396. }
  21397. var hsl = this.toHsl();
  21398. hsl.s -= amount / 100;
  21399. hsl.s = clamp01(hsl.s);
  21400. return new TinyColor2(hsl);
  21401. };
  21402. TinyColor2.prototype.saturate = function(amount) {
  21403. if (amount === void 0) {
  21404. amount = 10;
  21405. }
  21406. var hsl = this.toHsl();
  21407. hsl.s += amount / 100;
  21408. hsl.s = clamp01(hsl.s);
  21409. return new TinyColor2(hsl);
  21410. };
  21411. TinyColor2.prototype.greyscale = function() {
  21412. return this.desaturate(100);
  21413. };
  21414. TinyColor2.prototype.spin = function(amount) {
  21415. var hsl = this.toHsl();
  21416. var hue = (hsl.h + amount) % 360;
  21417. hsl.h = hue < 0 ? 360 + hue : hue;
  21418. return new TinyColor2(hsl);
  21419. };
  21420. TinyColor2.prototype.mix = function(color2, amount) {
  21421. if (amount === void 0) {
  21422. amount = 50;
  21423. }
  21424. var rgb1 = this.toRgb();
  21425. var rgb2 = new TinyColor2(color2).toRgb();
  21426. var p = amount / 100;
  21427. var rgba = {
  21428. r: (rgb2.r - rgb1.r) * p + rgb1.r,
  21429. g: (rgb2.g - rgb1.g) * p + rgb1.g,
  21430. b: (rgb2.b - rgb1.b) * p + rgb1.b,
  21431. a: (rgb2.a - rgb1.a) * p + rgb1.a
  21432. };
  21433. return new TinyColor2(rgba);
  21434. };
  21435. TinyColor2.prototype.analogous = function(results, slices) {
  21436. if (results === void 0) {
  21437. results = 6;
  21438. }
  21439. if (slices === void 0) {
  21440. slices = 30;
  21441. }
  21442. var hsl = this.toHsl();
  21443. var part = 360 / slices;
  21444. var ret = [this];
  21445. for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results; ) {
  21446. hsl.h = (hsl.h + part) % 360;
  21447. ret.push(new TinyColor2(hsl));
  21448. }
  21449. return ret;
  21450. };
  21451. TinyColor2.prototype.complement = function() {
  21452. var hsl = this.toHsl();
  21453. hsl.h = (hsl.h + 180) % 360;
  21454. return new TinyColor2(hsl);
  21455. };
  21456. TinyColor2.prototype.monochromatic = function(results) {
  21457. if (results === void 0) {
  21458. results = 6;
  21459. }
  21460. var hsv = this.toHsv();
  21461. var h2 = hsv.h;
  21462. var s = hsv.s;
  21463. var v = hsv.v;
  21464. var res = [];
  21465. var modification = 1 / results;
  21466. while (results--) {
  21467. res.push(new TinyColor2({ h: h2, s, v }));
  21468. v = (v + modification) % 1;
  21469. }
  21470. return res;
  21471. };
  21472. TinyColor2.prototype.splitcomplement = function() {
  21473. var hsl = this.toHsl();
  21474. var h2 = hsl.h;
  21475. return [
  21476. this,
  21477. new TinyColor2({ h: (h2 + 72) % 360, s: hsl.s, l: hsl.l }),
  21478. new TinyColor2({ h: (h2 + 216) % 360, s: hsl.s, l: hsl.l })
  21479. ];
  21480. };
  21481. TinyColor2.prototype.onBackground = function(background) {
  21482. var fg = this.toRgb();
  21483. var bg = new TinyColor2(background).toRgb();
  21484. var alpha = fg.a + bg.a * (1 - fg.a);
  21485. return new TinyColor2({
  21486. r: (fg.r * fg.a + bg.r * bg.a * (1 - fg.a)) / alpha,
  21487. g: (fg.g * fg.a + bg.g * bg.a * (1 - fg.a)) / alpha,
  21488. b: (fg.b * fg.a + bg.b * bg.a * (1 - fg.a)) / alpha,
  21489. a: alpha
  21490. });
  21491. };
  21492. TinyColor2.prototype.triad = function() {
  21493. return this.polyad(3);
  21494. };
  21495. TinyColor2.prototype.tetrad = function() {
  21496. return this.polyad(4);
  21497. };
  21498. TinyColor2.prototype.polyad = function(n) {
  21499. var hsl = this.toHsl();
  21500. var h2 = hsl.h;
  21501. var result = [this];
  21502. var increment = 360 / n;
  21503. for (var i2 = 1; i2 < n; i2++) {
  21504. result.push(new TinyColor2({ h: (h2 + i2 * increment) % 360, s: hsl.s, l: hsl.l }));
  21505. }
  21506. return result;
  21507. };
  21508. TinyColor2.prototype.equals = function(color2) {
  21509. return this.toRgbString() === new TinyColor2(color2).toRgbString();
  21510. };
  21511. return TinyColor2;
  21512. }();
  21513. function darken(color2, amount = 20) {
  21514. return color2.mix("#141414", amount).toString();
  21515. }
  21516. function useButtonCustomStyle(props) {
  21517. const _disabled = useFormDisabled();
  21518. const ns = useNamespace("button");
  21519. return computed$1(() => {
  21520. let styles = {};
  21521. const buttonColor = props.color;
  21522. if (buttonColor) {
  21523. const color2 = new TinyColor(buttonColor);
  21524. const activeBgColor = props.dark ? color2.tint(20).toString() : darken(color2, 20);
  21525. if (props.plain) {
  21526. styles = ns.cssVarBlock({
  21527. "bg-color": props.dark ? darken(color2, 90) : color2.tint(90).toString(),
  21528. "text-color": buttonColor,
  21529. "border-color": props.dark ? darken(color2, 50) : color2.tint(50).toString(),
  21530. "hover-text-color": `var(${ns.cssVarName("color-white")})`,
  21531. "hover-bg-color": buttonColor,
  21532. "hover-border-color": buttonColor,
  21533. "active-bg-color": activeBgColor,
  21534. "active-text-color": `var(${ns.cssVarName("color-white")})`,
  21535. "active-border-color": activeBgColor
  21536. });
  21537. if (_disabled.value) {
  21538. styles[ns.cssVarBlockName("disabled-bg-color")] = props.dark ? darken(color2, 90) : color2.tint(90).toString();
  21539. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? darken(color2, 50) : color2.tint(50).toString();
  21540. styles[ns.cssVarBlockName("disabled-border-color")] = props.dark ? darken(color2, 80) : color2.tint(80).toString();
  21541. }
  21542. } else {
  21543. const hoverBgColor = props.dark ? darken(color2, 30) : color2.tint(30).toString();
  21544. const textColor = color2.isDark() ? `var(${ns.cssVarName("color-white")})` : `var(${ns.cssVarName("color-black")})`;
  21545. styles = ns.cssVarBlock({
  21546. "bg-color": buttonColor,
  21547. "text-color": textColor,
  21548. "border-color": buttonColor,
  21549. "hover-bg-color": hoverBgColor,
  21550. "hover-text-color": textColor,
  21551. "hover-border-color": hoverBgColor,
  21552. "active-bg-color": activeBgColor,
  21553. "active-border-color": activeBgColor
  21554. });
  21555. if (_disabled.value) {
  21556. const disabledButtonColor = props.dark ? darken(color2, 50) : color2.tint(50).toString();
  21557. styles[ns.cssVarBlockName("disabled-bg-color")] = disabledButtonColor;
  21558. styles[ns.cssVarBlockName("disabled-text-color")] = props.dark ? "rgba(255, 255, 255, 0.5)" : `var(${ns.cssVarName("color-white")})`;
  21559. styles[ns.cssVarBlockName("disabled-border-color")] = disabledButtonColor;
  21560. }
  21561. }
  21562. }
  21563. return styles;
  21564. });
  21565. }
  21566. const __default__$e = defineComponent({
  21567. name: "ElButton"
  21568. });
  21569. const _sfc_main$o = /* @__PURE__ */ defineComponent({
  21570. ...__default__$e,
  21571. props: buttonProps,
  21572. emits: buttonEmits,
  21573. setup(__props, { expose, emit }) {
  21574. const props = __props;
  21575. const buttonStyle = useButtonCustomStyle(props);
  21576. const ns = useNamespace("button");
  21577. const { _ref, _size, _type, _disabled, _props, shouldAddSpace, handleClick } = useButton(props, emit);
  21578. expose({
  21579. ref: _ref,
  21580. size: _size,
  21581. type: _type,
  21582. disabled: _disabled,
  21583. shouldAddSpace
  21584. });
  21585. return (_ctx, _cache) => {
  21586. return openBlock(), createBlock(resolveDynamicComponent(_ctx.tag), mergeProps({
  21587. ref_key: "_ref",
  21588. ref: _ref
  21589. }, unref(_props), {
  21590. class: [
  21591. unref(ns).b(),
  21592. unref(ns).m(unref(_type)),
  21593. unref(ns).m(unref(_size)),
  21594. unref(ns).is("disabled", unref(_disabled)),
  21595. unref(ns).is("loading", _ctx.loading),
  21596. unref(ns).is("plain", _ctx.plain),
  21597. unref(ns).is("round", _ctx.round),
  21598. unref(ns).is("circle", _ctx.circle),
  21599. unref(ns).is("text", _ctx.text),
  21600. unref(ns).is("link", _ctx.link),
  21601. unref(ns).is("has-bg", _ctx.bg)
  21602. ],
  21603. style: unref(buttonStyle),
  21604. onClick: unref(handleClick)
  21605. }), {
  21606. default: withCtx(() => [
  21607. _ctx.loading ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  21608. _ctx.$slots.loading ? renderSlot(_ctx.$slots, "loading", { key: 0 }) : (openBlock(), createBlock(unref(ElIcon), {
  21609. key: 1,
  21610. class: normalizeClass(unref(ns).is("loading"))
  21611. }, {
  21612. default: withCtx(() => [
  21613. (openBlock(), createBlock(resolveDynamicComponent(_ctx.loadingIcon)))
  21614. ]),
  21615. _: 1
  21616. }, 8, ["class"]))
  21617. ], 64)) : _ctx.icon || _ctx.$slots.icon ? (openBlock(), createBlock(unref(ElIcon), { key: 1 }, {
  21618. default: withCtx(() => [
  21619. _ctx.icon ? (openBlock(), createBlock(resolveDynamicComponent(_ctx.icon), { key: 0 })) : renderSlot(_ctx.$slots, "icon", { key: 1 })
  21620. ]),
  21621. _: 3
  21622. })) : createCommentVNode("v-if", true),
  21623. _ctx.$slots.default ? (openBlock(), createElementBlock("span", {
  21624. key: 2,
  21625. class: normalizeClass({ [unref(ns).em("text", "expand")]: unref(shouldAddSpace) })
  21626. }, [
  21627. renderSlot(_ctx.$slots, "default")
  21628. ], 2)) : createCommentVNode("v-if", true)
  21629. ]),
  21630. _: 3
  21631. }, 16, ["class", "style", "onClick"]);
  21632. };
  21633. }
  21634. });
  21635. var Button$2 = /* @__PURE__ */ _export_sfc$1(_sfc_main$o, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button.vue"]]);
  21636. const buttonGroupProps = {
  21637. size: buttonProps.size,
  21638. type: buttonProps.type
  21639. };
  21640. const __default__$d = defineComponent({
  21641. name: "ElButtonGroup"
  21642. });
  21643. const _sfc_main$n = /* @__PURE__ */ defineComponent({
  21644. ...__default__$d,
  21645. props: buttonGroupProps,
  21646. setup(__props) {
  21647. const props = __props;
  21648. provide(buttonGroupContextKey, reactive({
  21649. size: toRef(props, "size"),
  21650. type: toRef(props, "type")
  21651. }));
  21652. const ns = useNamespace("button");
  21653. return (_ctx, _cache) => {
  21654. return openBlock(), createElementBlock("div", {
  21655. class: normalizeClass(`${unref(ns).b("group")}`)
  21656. }, [
  21657. renderSlot(_ctx.$slots, "default")
  21658. ], 2);
  21659. };
  21660. }
  21661. });
  21662. var ButtonGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$n, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/button/src/button-group.vue"]]);
  21663. const ElButton = withInstall(Button$2, {
  21664. ButtonGroup
  21665. });
  21666. const ElButtonGroup = withNoopInstall(ButtonGroup);
  21667. const nodeList = /* @__PURE__ */ new Map();
  21668. let startClick;
  21669. if (isClient) {
  21670. document.addEventListener("mousedown", (e) => startClick = e);
  21671. document.addEventListener("mouseup", (e) => {
  21672. for (const handlers of nodeList.values()) {
  21673. for (const { documentHandler } of handlers) {
  21674. documentHandler(e, startClick);
  21675. }
  21676. }
  21677. });
  21678. }
  21679. function createDocumentHandler(el, binding) {
  21680. let excludes = [];
  21681. if (Array.isArray(binding.arg)) {
  21682. excludes = binding.arg;
  21683. } else if (isElement(binding.arg)) {
  21684. excludes.push(binding.arg);
  21685. }
  21686. return function(mouseup, mousedown) {
  21687. const popperRef = binding.instance.popperRef;
  21688. const mouseUpTarget = mouseup.target;
  21689. const mouseDownTarget = mousedown == null ? void 0 : mousedown.target;
  21690. const isBound = !binding || !binding.instance;
  21691. const isTargetExists = !mouseUpTarget || !mouseDownTarget;
  21692. const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget);
  21693. const isSelf = el === mouseUpTarget;
  21694. const isTargetExcluded = excludes.length && excludes.some((item) => item == null ? void 0 : item.contains(mouseUpTarget)) || excludes.length && excludes.includes(mouseDownTarget);
  21695. const isContainedByPopper = popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget));
  21696. if (isBound || isTargetExists || isContainedByEl || isSelf || isTargetExcluded || isContainedByPopper) {
  21697. return;
  21698. }
  21699. binding.value(mouseup, mousedown);
  21700. };
  21701. }
  21702. const ClickOutside = {
  21703. beforeMount(el, binding) {
  21704. if (!nodeList.has(el)) {
  21705. nodeList.set(el, []);
  21706. }
  21707. nodeList.get(el).push({
  21708. documentHandler: createDocumentHandler(el, binding),
  21709. bindingFn: binding.value
  21710. });
  21711. },
  21712. updated(el, binding) {
  21713. if (!nodeList.has(el)) {
  21714. nodeList.set(el, []);
  21715. }
  21716. const handlers = nodeList.get(el);
  21717. const oldHandlerIndex = handlers.findIndex((item) => item.bindingFn === binding.oldValue);
  21718. const newHandler = {
  21719. documentHandler: createDocumentHandler(el, binding),
  21720. bindingFn: binding.value
  21721. };
  21722. if (oldHandlerIndex >= 0) {
  21723. handlers.splice(oldHandlerIndex, 1, newHandler);
  21724. } else {
  21725. handlers.push(newHandler);
  21726. }
  21727. },
  21728. unmounted(el) {
  21729. nodeList.delete(el);
  21730. }
  21731. };
  21732. const REPEAT_INTERVAL = 100;
  21733. const REPEAT_DELAY = 600;
  21734. const vRepeatClick = {
  21735. beforeMount(el, binding) {
  21736. const value = binding.value;
  21737. const { interval = REPEAT_INTERVAL, delay = REPEAT_DELAY } = isFunction$3(value) ? {} : value;
  21738. let intervalId;
  21739. let delayId;
  21740. const handler = () => isFunction$3(value) ? value() : value.handler();
  21741. const clear = () => {
  21742. if (delayId) {
  21743. clearTimeout(delayId);
  21744. delayId = void 0;
  21745. }
  21746. if (intervalId) {
  21747. clearInterval(intervalId);
  21748. intervalId = void 0;
  21749. }
  21750. };
  21751. el.addEventListener("mousedown", (evt) => {
  21752. if (evt.button !== 0)
  21753. return;
  21754. clear();
  21755. handler();
  21756. document.addEventListener("mouseup", () => clear(), {
  21757. once: true
  21758. });
  21759. delayId = setTimeout(() => {
  21760. intervalId = setInterval(() => {
  21761. handler();
  21762. }, interval);
  21763. }, delay);
  21764. });
  21765. }
  21766. };
  21767. const radioPropsBase = buildProps({
  21768. size: useSizeProp,
  21769. disabled: Boolean,
  21770. label: {
  21771. type: [String, Number, Boolean],
  21772. default: ""
  21773. }
  21774. });
  21775. const radioProps = buildProps({
  21776. ...radioPropsBase,
  21777. modelValue: {
  21778. type: [String, Number, Boolean],
  21779. default: ""
  21780. },
  21781. name: {
  21782. type: String,
  21783. default: ""
  21784. },
  21785. border: Boolean
  21786. });
  21787. const radioEmits = {
  21788. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val),
  21789. [CHANGE_EVENT]: (val) => isString(val) || isNumber(val) || isBoolean(val)
  21790. };
  21791. const radioGroupKey = Symbol("radioGroupKey");
  21792. const useRadio = (props, emit) => {
  21793. const radioRef = ref();
  21794. const radioGroup = inject(radioGroupKey, void 0);
  21795. const isGroup = computed$1(() => !!radioGroup);
  21796. const modelValue = computed$1({
  21797. get() {
  21798. return isGroup.value ? radioGroup.modelValue : props.modelValue;
  21799. },
  21800. set(val) {
  21801. if (isGroup.value) {
  21802. radioGroup.changeEvent(val);
  21803. } else {
  21804. emit && emit(UPDATE_MODEL_EVENT, val);
  21805. }
  21806. radioRef.value.checked = props.modelValue === props.label;
  21807. }
  21808. });
  21809. const size = useFormSize(computed$1(() => radioGroup == null ? void 0 : radioGroup.size));
  21810. const disabled = useFormDisabled(computed$1(() => radioGroup == null ? void 0 : radioGroup.disabled));
  21811. const focus = ref(false);
  21812. const tabIndex = computed$1(() => {
  21813. return disabled.value || isGroup.value && modelValue.value !== props.label ? -1 : 0;
  21814. });
  21815. return {
  21816. radioRef,
  21817. isGroup,
  21818. radioGroup,
  21819. focus,
  21820. size,
  21821. disabled,
  21822. tabIndex,
  21823. modelValue
  21824. };
  21825. };
  21826. const _hoisted_1$e = ["value", "name", "disabled"];
  21827. const __default__$c = defineComponent({
  21828. name: "ElRadio"
  21829. });
  21830. const _sfc_main$m = /* @__PURE__ */ defineComponent({
  21831. ...__default__$c,
  21832. props: radioProps,
  21833. emits: radioEmits,
  21834. setup(__props, { emit }) {
  21835. const props = __props;
  21836. const ns = useNamespace("radio");
  21837. const { radioRef, radioGroup, focus, size, disabled, modelValue } = useRadio(props, emit);
  21838. function handleChange() {
  21839. nextTick(() => emit("change", modelValue.value));
  21840. }
  21841. return (_ctx, _cache) => {
  21842. var _a2;
  21843. return openBlock(), createElementBlock("label", {
  21844. class: normalizeClass([
  21845. unref(ns).b(),
  21846. unref(ns).is("disabled", unref(disabled)),
  21847. unref(ns).is("focus", unref(focus)),
  21848. unref(ns).is("bordered", _ctx.border),
  21849. unref(ns).is("checked", unref(modelValue) === _ctx.label),
  21850. unref(ns).m(unref(size))
  21851. ])
  21852. }, [
  21853. createElementVNode("span", {
  21854. class: normalizeClass([
  21855. unref(ns).e("input"),
  21856. unref(ns).is("disabled", unref(disabled)),
  21857. unref(ns).is("checked", unref(modelValue) === _ctx.label)
  21858. ])
  21859. }, [
  21860. withDirectives(createElementVNode("input", {
  21861. ref_key: "radioRef",
  21862. ref: radioRef,
  21863. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
  21864. class: normalizeClass(unref(ns).e("original")),
  21865. value: _ctx.label,
  21866. name: _ctx.name || ((_a2 = unref(radioGroup)) == null ? void 0 : _a2.name),
  21867. disabled: unref(disabled),
  21868. type: "radio",
  21869. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  21870. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false),
  21871. onChange: handleChange
  21872. }, null, 42, _hoisted_1$e), [
  21873. [vModelRadio, unref(modelValue)]
  21874. ]),
  21875. createElementVNode("span", {
  21876. class: normalizeClass(unref(ns).e("inner"))
  21877. }, null, 2)
  21878. ], 2),
  21879. createElementVNode("span", {
  21880. class: normalizeClass(unref(ns).e("label")),
  21881. onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
  21882. }, ["stop"]))
  21883. }, [
  21884. renderSlot(_ctx.$slots, "default", {}, () => [
  21885. createTextVNode(toDisplayString(_ctx.label), 1)
  21886. ])
  21887. ], 34)
  21888. ], 2);
  21889. };
  21890. }
  21891. });
  21892. var Radio = /* @__PURE__ */ _export_sfc$1(_sfc_main$m, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio.vue"]]);
  21893. const radioButtonProps = buildProps({
  21894. ...radioPropsBase,
  21895. name: {
  21896. type: String,
  21897. default: ""
  21898. }
  21899. });
  21900. const _hoisted_1$d = ["value", "name", "disabled"];
  21901. const __default__$b = defineComponent({
  21902. name: "ElRadioButton"
  21903. });
  21904. const _sfc_main$l = /* @__PURE__ */ defineComponent({
  21905. ...__default__$b,
  21906. props: radioButtonProps,
  21907. setup(__props) {
  21908. const props = __props;
  21909. const ns = useNamespace("radio");
  21910. const { radioRef, focus, size, disabled, modelValue, radioGroup } = useRadio(props);
  21911. const activeStyle = computed$1(() => {
  21912. return {
  21913. backgroundColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21914. borderColor: (radioGroup == null ? void 0 : radioGroup.fill) || "",
  21915. boxShadow: (radioGroup == null ? void 0 : radioGroup.fill) ? `-1px 0 0 0 ${radioGroup.fill}` : "",
  21916. color: (radioGroup == null ? void 0 : radioGroup.textColor) || ""
  21917. };
  21918. });
  21919. return (_ctx, _cache) => {
  21920. var _a2;
  21921. return openBlock(), createElementBlock("label", {
  21922. class: normalizeClass([
  21923. unref(ns).b("button"),
  21924. unref(ns).is("active", unref(modelValue) === _ctx.label),
  21925. unref(ns).is("disabled", unref(disabled)),
  21926. unref(ns).is("focus", unref(focus)),
  21927. unref(ns).bm("button", unref(size))
  21928. ])
  21929. }, [
  21930. withDirectives(createElementVNode("input", {
  21931. ref_key: "radioRef",
  21932. ref: radioRef,
  21933. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(modelValue) ? modelValue.value = $event : null),
  21934. class: normalizeClass(unref(ns).be("button", "original-radio")),
  21935. value: _ctx.label,
  21936. type: "radio",
  21937. name: _ctx.name || ((_a2 = unref(radioGroup)) == null ? void 0 : _a2.name),
  21938. disabled: unref(disabled),
  21939. onFocus: _cache[1] || (_cache[1] = ($event) => focus.value = true),
  21940. onBlur: _cache[2] || (_cache[2] = ($event) => focus.value = false)
  21941. }, null, 42, _hoisted_1$d), [
  21942. [vModelRadio, unref(modelValue)]
  21943. ]),
  21944. createElementVNode("span", {
  21945. class: normalizeClass(unref(ns).be("button", "inner")),
  21946. style: normalizeStyle(unref(modelValue) === _ctx.label ? unref(activeStyle) : {}),
  21947. onKeydown: _cache[3] || (_cache[3] = withModifiers(() => {
  21948. }, ["stop"]))
  21949. }, [
  21950. renderSlot(_ctx.$slots, "default", {}, () => [
  21951. createTextVNode(toDisplayString(_ctx.label), 1)
  21952. ])
  21953. ], 38)
  21954. ], 2);
  21955. };
  21956. }
  21957. });
  21958. var RadioButton = /* @__PURE__ */ _export_sfc$1(_sfc_main$l, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-button.vue"]]);
  21959. const radioGroupProps = buildProps({
  21960. id: {
  21961. type: String,
  21962. default: void 0
  21963. },
  21964. size: useSizeProp,
  21965. disabled: Boolean,
  21966. modelValue: {
  21967. type: [String, Number, Boolean],
  21968. default: ""
  21969. },
  21970. fill: {
  21971. type: String,
  21972. default: ""
  21973. },
  21974. label: {
  21975. type: String,
  21976. default: void 0
  21977. },
  21978. textColor: {
  21979. type: String,
  21980. default: ""
  21981. },
  21982. name: {
  21983. type: String,
  21984. default: void 0
  21985. },
  21986. validateEvent: {
  21987. type: Boolean,
  21988. default: true
  21989. }
  21990. });
  21991. const radioGroupEmits = radioEmits;
  21992. const _hoisted_1$c = ["id", "aria-label", "aria-labelledby"];
  21993. const __default__$a = defineComponent({
  21994. name: "ElRadioGroup"
  21995. });
  21996. const _sfc_main$k = /* @__PURE__ */ defineComponent({
  21997. ...__default__$a,
  21998. props: radioGroupProps,
  21999. emits: radioGroupEmits,
  22000. setup(__props, { emit }) {
  22001. const props = __props;
  22002. const ns = useNamespace("radio");
  22003. const radioId = useId();
  22004. const radioGroupRef = ref();
  22005. const { formItem } = useFormItem();
  22006. const { inputId: groupId, isLabeledByFormItem } = useFormItemInputId(props, {
  22007. formItemContext: formItem
  22008. });
  22009. const changeEvent = (value) => {
  22010. emit(UPDATE_MODEL_EVENT, value);
  22011. nextTick(() => emit("change", value));
  22012. };
  22013. onMounted(() => {
  22014. const radios = radioGroupRef.value.querySelectorAll("[type=radio]");
  22015. const firstLabel = radios[0];
  22016. if (!Array.from(radios).some((radio) => radio.checked) && firstLabel) {
  22017. firstLabel.tabIndex = 0;
  22018. }
  22019. });
  22020. const name = computed$1(() => {
  22021. return props.name || radioId.value;
  22022. });
  22023. provide(radioGroupKey, reactive({
  22024. ...toRefs(props),
  22025. changeEvent,
  22026. name
  22027. }));
  22028. watch(() => props.modelValue, () => {
  22029. if (props.validateEvent) {
  22030. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  22031. }
  22032. });
  22033. return (_ctx, _cache) => {
  22034. return openBlock(), createElementBlock("div", {
  22035. id: unref(groupId),
  22036. ref_key: "radioGroupRef",
  22037. ref: radioGroupRef,
  22038. class: normalizeClass(unref(ns).b("group")),
  22039. role: "radiogroup",
  22040. "aria-label": !unref(isLabeledByFormItem) ? _ctx.label || "radio-group" : void 0,
  22041. "aria-labelledby": unref(isLabeledByFormItem) ? unref(formItem).labelId : void 0
  22042. }, [
  22043. renderSlot(_ctx.$slots, "default")
  22044. ], 10, _hoisted_1$c);
  22045. };
  22046. }
  22047. });
  22048. var RadioGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$k, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/radio/src/radio-group.vue"]]);
  22049. withInstall(Radio, {
  22050. RadioButton,
  22051. RadioGroup
  22052. });
  22053. const ElRadioGroup = withNoopInstall(RadioGroup);
  22054. const ElRadioButton = withNoopInstall(RadioButton);
  22055. const tagProps = buildProps({
  22056. closable: Boolean,
  22057. type: {
  22058. type: String,
  22059. values: ["success", "info", "warning", "danger", ""],
  22060. default: ""
  22061. },
  22062. hit: Boolean,
  22063. disableTransitions: Boolean,
  22064. color: {
  22065. type: String,
  22066. default: ""
  22067. },
  22068. size: {
  22069. type: String,
  22070. values: componentSizes,
  22071. default: ""
  22072. },
  22073. effect: {
  22074. type: String,
  22075. values: ["dark", "light", "plain"],
  22076. default: "light"
  22077. },
  22078. round: Boolean
  22079. });
  22080. const tagEmits = {
  22081. close: (evt) => evt instanceof MouseEvent,
  22082. click: (evt) => evt instanceof MouseEvent
  22083. };
  22084. const __default__$9 = defineComponent({
  22085. name: "ElTag"
  22086. });
  22087. const _sfc_main$j = /* @__PURE__ */ defineComponent({
  22088. ...__default__$9,
  22089. props: tagProps,
  22090. emits: tagEmits,
  22091. setup(__props, { emit }) {
  22092. const props = __props;
  22093. const tagSize = useFormSize();
  22094. const ns = useNamespace("tag");
  22095. const classes = computed$1(() => {
  22096. const { type: type2, hit, effect, closable, round: round2 } = props;
  22097. return [
  22098. ns.b(),
  22099. ns.is("closable", closable),
  22100. ns.m(type2),
  22101. ns.m(tagSize.value),
  22102. ns.m(effect),
  22103. ns.is("hit", hit),
  22104. ns.is("round", round2)
  22105. ];
  22106. });
  22107. const handleClose = (event2) => {
  22108. emit("close", event2);
  22109. };
  22110. const handleClick = (event2) => {
  22111. emit("click", event2);
  22112. };
  22113. return (_ctx, _cache) => {
  22114. return _ctx.disableTransitions ? (openBlock(), createElementBlock("span", {
  22115. key: 0,
  22116. class: normalizeClass(unref(classes)),
  22117. style: normalizeStyle({ backgroundColor: _ctx.color }),
  22118. onClick: handleClick
  22119. }, [
  22120. createElementVNode("span", {
  22121. class: normalizeClass(unref(ns).e("content"))
  22122. }, [
  22123. renderSlot(_ctx.$slots, "default")
  22124. ], 2),
  22125. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  22126. key: 0,
  22127. class: normalizeClass(unref(ns).e("close")),
  22128. onClick: withModifiers(handleClose, ["stop"])
  22129. }, {
  22130. default: withCtx(() => [
  22131. createVNode(unref(close_default))
  22132. ]),
  22133. _: 1
  22134. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  22135. ], 6)) : (openBlock(), createBlock(Transition, {
  22136. key: 1,
  22137. name: `${unref(ns).namespace.value}-zoom-in-center`,
  22138. appear: ""
  22139. }, {
  22140. default: withCtx(() => [
  22141. createElementVNode("span", {
  22142. class: normalizeClass(unref(classes)),
  22143. style: normalizeStyle({ backgroundColor: _ctx.color }),
  22144. onClick: handleClick
  22145. }, [
  22146. createElementVNode("span", {
  22147. class: normalizeClass(unref(ns).e("content"))
  22148. }, [
  22149. renderSlot(_ctx.$slots, "default")
  22150. ], 2),
  22151. _ctx.closable ? (openBlock(), createBlock(unref(ElIcon), {
  22152. key: 0,
  22153. class: normalizeClass(unref(ns).e("close")),
  22154. onClick: withModifiers(handleClose, ["stop"])
  22155. }, {
  22156. default: withCtx(() => [
  22157. createVNode(unref(close_default))
  22158. ]),
  22159. _: 1
  22160. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  22161. ], 6)
  22162. ]),
  22163. _: 3
  22164. }, 8, ["name"]));
  22165. };
  22166. }
  22167. });
  22168. var Tag = /* @__PURE__ */ _export_sfc$1(_sfc_main$j, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/tag/src/tag.vue"]]);
  22169. const ElTag = withInstall(Tag);
  22170. const emitChangeFn = (value) => typeof isNumber(value);
  22171. const collapseProps = buildProps({
  22172. accordion: Boolean,
  22173. modelValue: {
  22174. type: definePropType([Array, String, Number]),
  22175. default: () => mutable([])
  22176. }
  22177. });
  22178. const collapseEmits = {
  22179. [UPDATE_MODEL_EVENT]: emitChangeFn,
  22180. [CHANGE_EVENT]: emitChangeFn
  22181. };
  22182. const collapseContextKey = Symbol("collapseContextKey");
  22183. const useCollapse = (props, emit) => {
  22184. const activeNames = ref(castArray(props.modelValue));
  22185. const setActiveNames = (_activeNames) => {
  22186. activeNames.value = _activeNames;
  22187. const value = props.accordion ? activeNames.value[0] : activeNames.value;
  22188. emit(UPDATE_MODEL_EVENT, value);
  22189. emit(CHANGE_EVENT, value);
  22190. };
  22191. const handleItemClick = (name) => {
  22192. if (props.accordion) {
  22193. setActiveNames([activeNames.value[0] === name ? "" : name]);
  22194. } else {
  22195. const _activeNames = [...activeNames.value];
  22196. const index2 = _activeNames.indexOf(name);
  22197. if (index2 > -1) {
  22198. _activeNames.splice(index2, 1);
  22199. } else {
  22200. _activeNames.push(name);
  22201. }
  22202. setActiveNames(_activeNames);
  22203. }
  22204. };
  22205. watch(() => props.modelValue, () => activeNames.value = castArray(props.modelValue), { deep: true });
  22206. provide(collapseContextKey, {
  22207. activeNames,
  22208. handleItemClick
  22209. });
  22210. return {
  22211. activeNames,
  22212. setActiveNames
  22213. };
  22214. };
  22215. const useCollapseDOM = () => {
  22216. const ns = useNamespace("collapse");
  22217. const rootKls = computed$1(() => ns.b());
  22218. return {
  22219. rootKls
  22220. };
  22221. };
  22222. const __default__$8 = defineComponent({
  22223. name: "ElCollapse"
  22224. });
  22225. const _sfc_main$i = /* @__PURE__ */ defineComponent({
  22226. ...__default__$8,
  22227. props: collapseProps,
  22228. emits: collapseEmits,
  22229. setup(__props, { expose, emit }) {
  22230. const props = __props;
  22231. const { activeNames, setActiveNames } = useCollapse(props, emit);
  22232. const { rootKls } = useCollapseDOM();
  22233. expose({
  22234. activeNames,
  22235. setActiveNames
  22236. });
  22237. return (_ctx, _cache) => {
  22238. return openBlock(), createElementBlock("div", {
  22239. class: normalizeClass(unref(rootKls)),
  22240. role: "tablist",
  22241. "aria-multiselectable": "true"
  22242. }, [
  22243. renderSlot(_ctx.$slots, "default")
  22244. ], 2);
  22245. };
  22246. }
  22247. });
  22248. var Collapse = /* @__PURE__ */ _export_sfc$1(_sfc_main$i, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse.vue"]]);
  22249. const __default__$7 = defineComponent({
  22250. name: "ElCollapseTransition"
  22251. });
  22252. const _sfc_main$h = /* @__PURE__ */ defineComponent({
  22253. ...__default__$7,
  22254. setup(__props) {
  22255. const ns = useNamespace("collapse-transition");
  22256. const on3 = {
  22257. beforeEnter(el) {
  22258. if (!el.dataset)
  22259. el.dataset = {};
  22260. el.dataset.oldPaddingTop = el.style.paddingTop;
  22261. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  22262. el.style.maxHeight = 0;
  22263. el.style.paddingTop = 0;
  22264. el.style.paddingBottom = 0;
  22265. },
  22266. enter(el) {
  22267. el.dataset.oldOverflow = el.style.overflow;
  22268. if (el.scrollHeight !== 0) {
  22269. el.style.maxHeight = `${el.scrollHeight}px`;
  22270. el.style.paddingTop = el.dataset.oldPaddingTop;
  22271. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  22272. } else {
  22273. el.style.maxHeight = 0;
  22274. el.style.paddingTop = el.dataset.oldPaddingTop;
  22275. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  22276. }
  22277. el.style.overflow = "hidden";
  22278. },
  22279. afterEnter(el) {
  22280. el.style.maxHeight = "";
  22281. el.style.overflow = el.dataset.oldOverflow;
  22282. },
  22283. beforeLeave(el) {
  22284. if (!el.dataset)
  22285. el.dataset = {};
  22286. el.dataset.oldPaddingTop = el.style.paddingTop;
  22287. el.dataset.oldPaddingBottom = el.style.paddingBottom;
  22288. el.dataset.oldOverflow = el.style.overflow;
  22289. el.style.maxHeight = `${el.scrollHeight}px`;
  22290. el.style.overflow = "hidden";
  22291. },
  22292. leave(el) {
  22293. if (el.scrollHeight !== 0) {
  22294. el.style.maxHeight = 0;
  22295. el.style.paddingTop = 0;
  22296. el.style.paddingBottom = 0;
  22297. }
  22298. },
  22299. afterLeave(el) {
  22300. el.style.maxHeight = "";
  22301. el.style.overflow = el.dataset.oldOverflow;
  22302. el.style.paddingTop = el.dataset.oldPaddingTop;
  22303. el.style.paddingBottom = el.dataset.oldPaddingBottom;
  22304. }
  22305. };
  22306. return (_ctx, _cache) => {
  22307. return openBlock(), createBlock(Transition, mergeProps({
  22308. name: unref(ns).b()
  22309. }, toHandlers(on3)), {
  22310. default: withCtx(() => [
  22311. renderSlot(_ctx.$slots, "default")
  22312. ]),
  22313. _: 3
  22314. }, 16, ["name"]);
  22315. };
  22316. }
  22317. });
  22318. var CollapseTransition = /* @__PURE__ */ _export_sfc$1(_sfc_main$h, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse-transition/src/collapse-transition.vue"]]);
  22319. CollapseTransition.install = (app) => {
  22320. app.component(CollapseTransition.name, CollapseTransition);
  22321. };
  22322. const _CollapseTransition = CollapseTransition;
  22323. const collapseItemProps = buildProps({
  22324. title: {
  22325. type: String,
  22326. default: ""
  22327. },
  22328. name: {
  22329. type: definePropType([String, Number]),
  22330. default: () => generateId()
  22331. },
  22332. disabled: Boolean
  22333. });
  22334. const useCollapseItem = (props) => {
  22335. const collapse = inject(collapseContextKey);
  22336. const focusing = ref(false);
  22337. const isClick = ref(false);
  22338. const id = ref(generateId());
  22339. const isActive = computed$1(() => collapse == null ? void 0 : collapse.activeNames.value.includes(props.name));
  22340. const handleFocus = () => {
  22341. setTimeout(() => {
  22342. if (!isClick.value) {
  22343. focusing.value = true;
  22344. } else {
  22345. isClick.value = false;
  22346. }
  22347. }, 50);
  22348. };
  22349. const handleHeaderClick = () => {
  22350. if (props.disabled)
  22351. return;
  22352. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  22353. focusing.value = false;
  22354. isClick.value = true;
  22355. };
  22356. const handleEnterClick = () => {
  22357. collapse == null ? void 0 : collapse.handleItemClick(props.name);
  22358. };
  22359. return {
  22360. focusing,
  22361. id,
  22362. isActive,
  22363. handleFocus,
  22364. handleHeaderClick,
  22365. handleEnterClick
  22366. };
  22367. };
  22368. const useCollapseItemDOM = (props, { focusing, isActive, id }) => {
  22369. const ns = useNamespace("collapse");
  22370. const rootKls = computed$1(() => [
  22371. ns.b("item"),
  22372. ns.is("active", unref(isActive)),
  22373. ns.is("disabled", props.disabled)
  22374. ]);
  22375. const headKls = computed$1(() => [
  22376. ns.be("item", "header"),
  22377. ns.is("active", unref(isActive)),
  22378. { focusing: unref(focusing) && !props.disabled }
  22379. ]);
  22380. const arrowKls = computed$1(() => [
  22381. ns.be("item", "arrow"),
  22382. ns.is("active", unref(isActive))
  22383. ]);
  22384. const itemWrapperKls = computed$1(() => ns.be("item", "wrap"));
  22385. const itemContentKls = computed$1(() => ns.be("item", "content"));
  22386. const scopedContentId = computed$1(() => ns.b(`content-${unref(id)}`));
  22387. const scopedHeadId = computed$1(() => ns.b(`head-${unref(id)}`));
  22388. return {
  22389. arrowKls,
  22390. headKls,
  22391. rootKls,
  22392. itemWrapperKls,
  22393. itemContentKls,
  22394. scopedContentId,
  22395. scopedHeadId
  22396. };
  22397. };
  22398. const _hoisted_1$b = ["aria-expanded", "aria-controls", "aria-describedby"];
  22399. const _hoisted_2$8 = ["id", "tabindex"];
  22400. const _hoisted_3$5 = ["id", "aria-hidden", "aria-labelledby"];
  22401. const __default__$6 = defineComponent({
  22402. name: "ElCollapseItem"
  22403. });
  22404. const _sfc_main$g = /* @__PURE__ */ defineComponent({
  22405. ...__default__$6,
  22406. props: collapseItemProps,
  22407. setup(__props, { expose }) {
  22408. const props = __props;
  22409. const {
  22410. focusing,
  22411. id,
  22412. isActive,
  22413. handleFocus,
  22414. handleHeaderClick,
  22415. handleEnterClick
  22416. } = useCollapseItem(props);
  22417. const {
  22418. arrowKls,
  22419. headKls,
  22420. rootKls,
  22421. itemWrapperKls,
  22422. itemContentKls,
  22423. scopedContentId,
  22424. scopedHeadId
  22425. } = useCollapseItemDOM(props, { focusing, isActive, id });
  22426. expose({
  22427. isActive
  22428. });
  22429. return (_ctx, _cache) => {
  22430. return openBlock(), createElementBlock("div", {
  22431. class: normalizeClass(unref(rootKls))
  22432. }, [
  22433. createElementVNode("div", {
  22434. role: "tab",
  22435. "aria-expanded": unref(isActive),
  22436. "aria-controls": unref(scopedContentId),
  22437. "aria-describedby": unref(scopedContentId)
  22438. }, [
  22439. createElementVNode("div", {
  22440. id: unref(scopedHeadId),
  22441. class: normalizeClass(unref(headKls)),
  22442. role: "button",
  22443. tabindex: _ctx.disabled ? -1 : 0,
  22444. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleHeaderClick) && unref(handleHeaderClick)(...args)),
  22445. onKeypress: _cache[1] || (_cache[1] = withKeys(withModifiers((...args) => unref(handleEnterClick) && unref(handleEnterClick)(...args), ["stop", "prevent"]), ["space", "enter"])),
  22446. onFocus: _cache[2] || (_cache[2] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
  22447. onBlur: _cache[3] || (_cache[3] = ($event) => focusing.value = false)
  22448. }, [
  22449. renderSlot(_ctx.$slots, "title", {}, () => [
  22450. createTextVNode(toDisplayString(_ctx.title), 1)
  22451. ]),
  22452. createVNode(unref(ElIcon), {
  22453. class: normalizeClass(unref(arrowKls))
  22454. }, {
  22455. default: withCtx(() => [
  22456. createVNode(unref(arrow_right_default))
  22457. ]),
  22458. _: 1
  22459. }, 8, ["class"])
  22460. ], 42, _hoisted_2$8)
  22461. ], 8, _hoisted_1$b),
  22462. createVNode(unref(_CollapseTransition), null, {
  22463. default: withCtx(() => [
  22464. withDirectives(createElementVNode("div", {
  22465. id: unref(scopedContentId),
  22466. class: normalizeClass(unref(itemWrapperKls)),
  22467. role: "tabpanel",
  22468. "aria-hidden": !unref(isActive),
  22469. "aria-labelledby": unref(scopedHeadId)
  22470. }, [
  22471. createElementVNode("div", {
  22472. class: normalizeClass(unref(itemContentKls))
  22473. }, [
  22474. renderSlot(_ctx.$slots, "default")
  22475. ], 2)
  22476. ], 10, _hoisted_3$5), [
  22477. [vShow, unref(isActive)]
  22478. ])
  22479. ]),
  22480. _: 3
  22481. })
  22482. ], 2);
  22483. };
  22484. }
  22485. });
  22486. var CollapseItem = /* @__PURE__ */ _export_sfc$1(_sfc_main$g, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/collapse/src/collapse-item.vue"]]);
  22487. const ElCollapse = withInstall(Collapse, {
  22488. CollapseItem
  22489. });
  22490. const ElCollapseItem = withNoopInstall(CollapseItem);
  22491. const alphaSliderProps = buildProps({
  22492. color: {
  22493. type: definePropType(Object),
  22494. required: true
  22495. },
  22496. vertical: {
  22497. type: Boolean,
  22498. default: false
  22499. }
  22500. });
  22501. let isDragging = false;
  22502. function draggable(element, options2) {
  22503. if (!isClient)
  22504. return;
  22505. const moveFn = function(event2) {
  22506. var _a2;
  22507. (_a2 = options2.drag) == null ? void 0 : _a2.call(options2, event2);
  22508. };
  22509. const upFn = function(event2) {
  22510. var _a2;
  22511. document.removeEventListener("mousemove", moveFn);
  22512. document.removeEventListener("mouseup", upFn);
  22513. document.removeEventListener("touchmove", moveFn);
  22514. document.removeEventListener("touchend", upFn);
  22515. document.onselectstart = null;
  22516. document.ondragstart = null;
  22517. isDragging = false;
  22518. (_a2 = options2.end) == null ? void 0 : _a2.call(options2, event2);
  22519. };
  22520. const downFn = function(event2) {
  22521. var _a2;
  22522. if (isDragging)
  22523. return;
  22524. event2.preventDefault();
  22525. document.onselectstart = () => false;
  22526. document.ondragstart = () => false;
  22527. document.addEventListener("mousemove", moveFn);
  22528. document.addEventListener("mouseup", upFn);
  22529. document.addEventListener("touchmove", moveFn);
  22530. document.addEventListener("touchend", upFn);
  22531. isDragging = true;
  22532. (_a2 = options2.start) == null ? void 0 : _a2.call(options2, event2);
  22533. };
  22534. element.addEventListener("mousedown", downFn);
  22535. element.addEventListener("touchstart", downFn);
  22536. }
  22537. const useAlphaSlider = (props) => {
  22538. const instance = getCurrentInstance();
  22539. const thumb = shallowRef();
  22540. const bar = shallowRef();
  22541. function handleClick(event2) {
  22542. const target = event2.target;
  22543. if (target !== thumb.value) {
  22544. handleDrag(event2);
  22545. }
  22546. }
  22547. function handleDrag(event2) {
  22548. if (!bar.value || !thumb.value)
  22549. return;
  22550. const el = instance.vnode.el;
  22551. const rect = el.getBoundingClientRect();
  22552. const { clientX, clientY } = getClientXY(event2);
  22553. if (!props.vertical) {
  22554. let left = clientX - rect.left;
  22555. left = Math.max(thumb.value.offsetWidth / 2, left);
  22556. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  22557. props.color.set("alpha", Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 100));
  22558. } else {
  22559. let top = clientY - rect.top;
  22560. top = Math.max(thumb.value.offsetHeight / 2, top);
  22561. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  22562. props.color.set("alpha", Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 100));
  22563. }
  22564. }
  22565. return {
  22566. thumb,
  22567. bar,
  22568. handleDrag,
  22569. handleClick
  22570. };
  22571. };
  22572. const useAlphaSliderDOM = (props, {
  22573. bar,
  22574. thumb,
  22575. handleDrag
  22576. }) => {
  22577. const instance = getCurrentInstance();
  22578. const ns = useNamespace("color-alpha-slider");
  22579. const thumbLeft = ref(0);
  22580. const thumbTop = ref(0);
  22581. const background = ref();
  22582. function getThumbLeft() {
  22583. if (!thumb.value)
  22584. return 0;
  22585. if (props.vertical)
  22586. return 0;
  22587. const el = instance.vnode.el;
  22588. const alpha = props.color.get("alpha");
  22589. if (!el)
  22590. return 0;
  22591. return Math.round(alpha * (el.offsetWidth - thumb.value.offsetWidth / 2) / 100);
  22592. }
  22593. function getThumbTop() {
  22594. if (!thumb.value)
  22595. return 0;
  22596. const el = instance.vnode.el;
  22597. if (!props.vertical)
  22598. return 0;
  22599. const alpha = props.color.get("alpha");
  22600. if (!el)
  22601. return 0;
  22602. return Math.round(alpha * (el.offsetHeight - thumb.value.offsetHeight / 2) / 100);
  22603. }
  22604. function getBackground() {
  22605. if (props.color && props.color.value) {
  22606. const { r: r2, g, b } = props.color.toRgb();
  22607. return `linear-gradient(to right, rgba(${r2}, ${g}, ${b}, 0) 0%, rgba(${r2}, ${g}, ${b}, 1) 100%)`;
  22608. }
  22609. return "";
  22610. }
  22611. function update() {
  22612. thumbLeft.value = getThumbLeft();
  22613. thumbTop.value = getThumbTop();
  22614. background.value = getBackground();
  22615. }
  22616. onMounted(() => {
  22617. if (!bar.value || !thumb.value)
  22618. return;
  22619. const dragConfig = {
  22620. drag: (event2) => {
  22621. handleDrag(event2);
  22622. },
  22623. end: (event2) => {
  22624. handleDrag(event2);
  22625. }
  22626. };
  22627. draggable(bar.value, dragConfig);
  22628. draggable(thumb.value, dragConfig);
  22629. update();
  22630. });
  22631. watch(() => props.color.get("alpha"), () => update());
  22632. watch(() => props.color.value, () => update());
  22633. const rootKls = computed$1(() => [ns.b(), ns.is("vertical", props.vertical)]);
  22634. const barKls = computed$1(() => ns.e("bar"));
  22635. const thumbKls = computed$1(() => ns.e("thumb"));
  22636. const barStyle = computed$1(() => ({ background: background.value }));
  22637. const thumbStyle = computed$1(() => ({
  22638. left: addUnit(thumbLeft.value),
  22639. top: addUnit(thumbTop.value)
  22640. }));
  22641. return { rootKls, barKls, barStyle, thumbKls, thumbStyle, update };
  22642. };
  22643. const COMPONENT_NAME$2 = "ElColorAlphaSlider";
  22644. const __default__$5 = defineComponent({
  22645. name: COMPONENT_NAME$2
  22646. });
  22647. const _sfc_main$f = /* @__PURE__ */ defineComponent({
  22648. ...__default__$5,
  22649. props: alphaSliderProps,
  22650. setup(__props, { expose }) {
  22651. const props = __props;
  22652. const { bar, thumb, handleDrag, handleClick } = useAlphaSlider(props);
  22653. const { rootKls, barKls, barStyle, thumbKls, thumbStyle, update } = useAlphaSliderDOM(props, {
  22654. bar,
  22655. thumb,
  22656. handleDrag
  22657. });
  22658. expose({
  22659. update,
  22660. bar,
  22661. thumb
  22662. });
  22663. return (_ctx, _cache) => {
  22664. return openBlock(), createElementBlock("div", {
  22665. class: normalizeClass(unref(rootKls))
  22666. }, [
  22667. createElementVNode("div", {
  22668. ref_key: "bar",
  22669. ref: bar,
  22670. class: normalizeClass(unref(barKls)),
  22671. style: normalizeStyle(unref(barStyle)),
  22672. onClick: _cache[0] || (_cache[0] = (...args) => unref(handleClick) && unref(handleClick)(...args))
  22673. }, null, 6),
  22674. createElementVNode("div", {
  22675. ref_key: "thumb",
  22676. ref: thumb,
  22677. class: normalizeClass(unref(thumbKls)),
  22678. style: normalizeStyle(unref(thumbStyle))
  22679. }, null, 6)
  22680. ], 2);
  22681. };
  22682. }
  22683. });
  22684. var AlphaSlider = /* @__PURE__ */ _export_sfc$1(_sfc_main$f, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/alpha-slider.vue"]]);
  22685. const _sfc_main$e = defineComponent({
  22686. name: "ElColorHueSlider",
  22687. props: {
  22688. color: {
  22689. type: Object,
  22690. required: true
  22691. },
  22692. vertical: Boolean
  22693. },
  22694. setup(props) {
  22695. const ns = useNamespace("color-hue-slider");
  22696. const instance = getCurrentInstance();
  22697. const thumb = ref();
  22698. const bar = ref();
  22699. const thumbLeft = ref(0);
  22700. const thumbTop = ref(0);
  22701. const hueValue = computed$1(() => {
  22702. return props.color.get("hue");
  22703. });
  22704. watch(() => hueValue.value, () => {
  22705. update();
  22706. });
  22707. function handleClick(event2) {
  22708. const target = event2.target;
  22709. if (target !== thumb.value) {
  22710. handleDrag(event2);
  22711. }
  22712. }
  22713. function handleDrag(event2) {
  22714. if (!bar.value || !thumb.value)
  22715. return;
  22716. const el = instance.vnode.el;
  22717. const rect = el.getBoundingClientRect();
  22718. const { clientX, clientY } = getClientXY(event2);
  22719. let hue;
  22720. if (!props.vertical) {
  22721. let left = clientX - rect.left;
  22722. left = Math.min(left, rect.width - thumb.value.offsetWidth / 2);
  22723. left = Math.max(thumb.value.offsetWidth / 2, left);
  22724. hue = Math.round((left - thumb.value.offsetWidth / 2) / (rect.width - thumb.value.offsetWidth) * 360);
  22725. } else {
  22726. let top = clientY - rect.top;
  22727. top = Math.min(top, rect.height - thumb.value.offsetHeight / 2);
  22728. top = Math.max(thumb.value.offsetHeight / 2, top);
  22729. hue = Math.round((top - thumb.value.offsetHeight / 2) / (rect.height - thumb.value.offsetHeight) * 360);
  22730. }
  22731. props.color.set("hue", hue);
  22732. }
  22733. function getThumbLeft() {
  22734. if (!thumb.value)
  22735. return 0;
  22736. const el = instance.vnode.el;
  22737. if (props.vertical)
  22738. return 0;
  22739. const hue = props.color.get("hue");
  22740. if (!el)
  22741. return 0;
  22742. return Math.round(hue * (el.offsetWidth - thumb.value.offsetWidth / 2) / 360);
  22743. }
  22744. function getThumbTop() {
  22745. if (!thumb.value)
  22746. return 0;
  22747. const el = instance.vnode.el;
  22748. if (!props.vertical)
  22749. return 0;
  22750. const hue = props.color.get("hue");
  22751. if (!el)
  22752. return 0;
  22753. return Math.round(hue * (el.offsetHeight - thumb.value.offsetHeight / 2) / 360);
  22754. }
  22755. function update() {
  22756. thumbLeft.value = getThumbLeft();
  22757. thumbTop.value = getThumbTop();
  22758. }
  22759. onMounted(() => {
  22760. if (!bar.value || !thumb.value)
  22761. return;
  22762. const dragConfig = {
  22763. drag: (event2) => {
  22764. handleDrag(event2);
  22765. },
  22766. end: (event2) => {
  22767. handleDrag(event2);
  22768. }
  22769. };
  22770. draggable(bar.value, dragConfig);
  22771. draggable(thumb.value, dragConfig);
  22772. update();
  22773. });
  22774. return {
  22775. bar,
  22776. thumb,
  22777. thumbLeft,
  22778. thumbTop,
  22779. hueValue,
  22780. handleClick,
  22781. update,
  22782. ns
  22783. };
  22784. }
  22785. });
  22786. function _sfc_render$6(_ctx, _cache, $props, $setup, $data, $options) {
  22787. return openBlock(), createElementBlock("div", {
  22788. class: normalizeClass([_ctx.ns.b(), _ctx.ns.is("vertical", _ctx.vertical)])
  22789. }, [
  22790. createElementVNode("div", {
  22791. ref: "bar",
  22792. class: normalizeClass(_ctx.ns.e("bar")),
  22793. onClick: _cache[0] || (_cache[0] = (...args) => _ctx.handleClick && _ctx.handleClick(...args))
  22794. }, null, 2),
  22795. createElementVNode("div", {
  22796. ref: "thumb",
  22797. class: normalizeClass(_ctx.ns.e("thumb")),
  22798. style: normalizeStyle({
  22799. left: _ctx.thumbLeft + "px",
  22800. top: _ctx.thumbTop + "px"
  22801. })
  22802. }, null, 6)
  22803. ], 2);
  22804. }
  22805. var HueSlider = /* @__PURE__ */ _export_sfc$1(_sfc_main$e, [["render", _sfc_render$6], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/hue-slider.vue"]]);
  22806. const colorPickerProps = buildProps({
  22807. modelValue: String,
  22808. id: String,
  22809. showAlpha: Boolean,
  22810. colorFormat: String,
  22811. disabled: Boolean,
  22812. size: useSizeProp,
  22813. popperClass: {
  22814. type: String,
  22815. default: ""
  22816. },
  22817. label: {
  22818. type: String,
  22819. default: void 0
  22820. },
  22821. tabindex: {
  22822. type: [String, Number],
  22823. default: 0
  22824. },
  22825. predefine: {
  22826. type: definePropType(Array)
  22827. },
  22828. validateEvent: {
  22829. type: Boolean,
  22830. default: true
  22831. }
  22832. });
  22833. const colorPickerEmits = {
  22834. [UPDATE_MODEL_EVENT]: (val) => isString(val) || isNil(val),
  22835. [CHANGE_EVENT]: (val) => isString(val) || isNil(val),
  22836. activeChange: (val) => isString(val) || isNil(val)
  22837. };
  22838. const colorPickerContextKey = Symbol("colorPickerContextKey");
  22839. const hsv2hsl = function(hue, sat, val) {
  22840. return [
  22841. hue,
  22842. sat * val / ((hue = (2 - sat) * val) < 1 ? hue : 2 - hue) || 0,
  22843. hue / 2
  22844. ];
  22845. };
  22846. const isOnePointZero = function(n) {
  22847. return typeof n === "string" && n.includes(".") && Number.parseFloat(n) === 1;
  22848. };
  22849. const isPercentage = function(n) {
  22850. return typeof n === "string" && n.includes("%");
  22851. };
  22852. const bound01 = function(value, max2) {
  22853. if (isOnePointZero(value))
  22854. value = "100%";
  22855. const processPercent = isPercentage(value);
  22856. value = Math.min(max2, Math.max(0, Number.parseFloat(`${value}`)));
  22857. if (processPercent) {
  22858. value = Number.parseInt(`${value * max2}`, 10) / 100;
  22859. }
  22860. if (Math.abs(value - max2) < 1e-6) {
  22861. return 1;
  22862. }
  22863. return value % max2 / Number.parseFloat(max2);
  22864. };
  22865. const INT_HEX_MAP = {
  22866. 10: "A",
  22867. 11: "B",
  22868. 12: "C",
  22869. 13: "D",
  22870. 14: "E",
  22871. 15: "F"
  22872. };
  22873. const hexOne = (value) => {
  22874. value = Math.min(Math.round(value), 255);
  22875. const high = Math.floor(value / 16);
  22876. const low = value % 16;
  22877. return `${INT_HEX_MAP[high] || high}${INT_HEX_MAP[low] || low}`;
  22878. };
  22879. const toHex = function({ r: r2, g, b }) {
  22880. if (Number.isNaN(+r2) || Number.isNaN(+g) || Number.isNaN(+b))
  22881. return "";
  22882. return `#${hexOne(r2)}${hexOne(g)}${hexOne(b)}`;
  22883. };
  22884. const HEX_INT_MAP = {
  22885. A: 10,
  22886. B: 11,
  22887. C: 12,
  22888. D: 13,
  22889. E: 14,
  22890. F: 15
  22891. };
  22892. const parseHexChannel = function(hex) {
  22893. if (hex.length === 2) {
  22894. return (HEX_INT_MAP[hex[0].toUpperCase()] || +hex[0]) * 16 + (HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1]);
  22895. }
  22896. return HEX_INT_MAP[hex[1].toUpperCase()] || +hex[1];
  22897. };
  22898. const hsl2hsv = function(hue, sat, light) {
  22899. sat = sat / 100;
  22900. light = light / 100;
  22901. let smin = sat;
  22902. const lmin = Math.max(light, 0.01);
  22903. light *= 2;
  22904. sat *= light <= 1 ? light : 2 - light;
  22905. smin *= lmin <= 1 ? lmin : 2 - lmin;
  22906. const v = (light + sat) / 2;
  22907. const sv = light === 0 ? 2 * smin / (lmin + smin) : 2 * sat / (light + sat);
  22908. return {
  22909. h: hue,
  22910. s: sv * 100,
  22911. v: v * 100
  22912. };
  22913. };
  22914. const rgb2hsv = (r2, g, b) => {
  22915. r2 = bound01(r2, 255);
  22916. g = bound01(g, 255);
  22917. b = bound01(b, 255);
  22918. const max2 = Math.max(r2, g, b);
  22919. const min2 = Math.min(r2, g, b);
  22920. let h2;
  22921. const v = max2;
  22922. const d2 = max2 - min2;
  22923. const s = max2 === 0 ? 0 : d2 / max2;
  22924. if (max2 === min2) {
  22925. h2 = 0;
  22926. } else {
  22927. switch (max2) {
  22928. case r2: {
  22929. h2 = (g - b) / d2 + (g < b ? 6 : 0);
  22930. break;
  22931. }
  22932. case g: {
  22933. h2 = (b - r2) / d2 + 2;
  22934. break;
  22935. }
  22936. case b: {
  22937. h2 = (r2 - g) / d2 + 4;
  22938. break;
  22939. }
  22940. }
  22941. h2 /= 6;
  22942. }
  22943. return { h: h2 * 360, s: s * 100, v: v * 100 };
  22944. };
  22945. const hsv2rgb = function(h2, s, v) {
  22946. h2 = bound01(h2, 360) * 6;
  22947. s = bound01(s, 100);
  22948. v = bound01(v, 100);
  22949. const i2 = Math.floor(h2);
  22950. const f = h2 - i2;
  22951. const p = v * (1 - s);
  22952. const q2 = v * (1 - f * s);
  22953. const t2 = v * (1 - (1 - f) * s);
  22954. const mod = i2 % 6;
  22955. const r2 = [v, q2, p, p, t2, v][mod];
  22956. const g = [t2, v, v, q2, p, p][mod];
  22957. const b = [p, p, t2, v, v, q2][mod];
  22958. return {
  22959. r: Math.round(r2 * 255),
  22960. g: Math.round(g * 255),
  22961. b: Math.round(b * 255)
  22962. };
  22963. };
  22964. class Color$1 {
  22965. constructor(options2 = {}) {
  22966. this._hue = 0;
  22967. this._saturation = 100;
  22968. this._value = 100;
  22969. this._alpha = 100;
  22970. this.enableAlpha = false;
  22971. this.format = "hex";
  22972. this.value = "";
  22973. for (const option in options2) {
  22974. if (hasOwn(options2, option)) {
  22975. this[option] = options2[option];
  22976. }
  22977. }
  22978. if (options2.value) {
  22979. this.fromString(options2.value);
  22980. } else {
  22981. this.doOnChange();
  22982. }
  22983. }
  22984. set(prop, value) {
  22985. if (arguments.length === 1 && typeof prop === "object") {
  22986. for (const p in prop) {
  22987. if (hasOwn(prop, p)) {
  22988. this.set(p, prop[p]);
  22989. }
  22990. }
  22991. return;
  22992. }
  22993. this[`_${prop}`] = value;
  22994. this.doOnChange();
  22995. }
  22996. get(prop) {
  22997. if (prop === "alpha") {
  22998. return Math.floor(this[`_${prop}`]);
  22999. }
  23000. return this[`_${prop}`];
  23001. }
  23002. toRgb() {
  23003. return hsv2rgb(this._hue, this._saturation, this._value);
  23004. }
  23005. fromString(value) {
  23006. if (!value) {
  23007. this._hue = 0;
  23008. this._saturation = 100;
  23009. this._value = 100;
  23010. this.doOnChange();
  23011. return;
  23012. }
  23013. const fromHSV = (h2, s, v) => {
  23014. this._hue = Math.max(0, Math.min(360, h2));
  23015. this._saturation = Math.max(0, Math.min(100, s));
  23016. this._value = Math.max(0, Math.min(100, v));
  23017. this.doOnChange();
  23018. };
  23019. if (value.includes("hsl")) {
  23020. const parts = value.replace(/hsla|hsl|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  23021. if (parts.length === 4) {
  23022. this._alpha = Number.parseFloat(parts[3]) * 100;
  23023. } else if (parts.length === 3) {
  23024. this._alpha = 100;
  23025. }
  23026. if (parts.length >= 3) {
  23027. const { h: h2, s, v } = hsl2hsv(parts[0], parts[1], parts[2]);
  23028. fromHSV(h2, s, v);
  23029. }
  23030. } else if (value.includes("hsv")) {
  23031. const parts = value.replace(/hsva|hsv|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  23032. if (parts.length === 4) {
  23033. this._alpha = Number.parseFloat(parts[3]) * 100;
  23034. } else if (parts.length === 3) {
  23035. this._alpha = 100;
  23036. }
  23037. if (parts.length >= 3) {
  23038. fromHSV(parts[0], parts[1], parts[2]);
  23039. }
  23040. } else if (value.includes("rgb")) {
  23041. const parts = value.replace(/rgba|rgb|\(|\)/gm, "").split(/\s|,/g).filter((val) => val !== "").map((val, index2) => index2 > 2 ? Number.parseFloat(val) : Number.parseInt(val, 10));
  23042. if (parts.length === 4) {
  23043. this._alpha = Number.parseFloat(parts[3]) * 100;
  23044. } else if (parts.length === 3) {
  23045. this._alpha = 100;
  23046. }
  23047. if (parts.length >= 3) {
  23048. const { h: h2, s, v } = rgb2hsv(parts[0], parts[1], parts[2]);
  23049. fromHSV(h2, s, v);
  23050. }
  23051. } else if (value.includes("#")) {
  23052. const hex = value.replace("#", "").trim();
  23053. if (!/^[0-9a-fA-F]{3}$|^[0-9a-fA-F]{6}$|^[0-9a-fA-F]{8}$/.test(hex))
  23054. return;
  23055. let r2, g, b;
  23056. if (hex.length === 3) {
  23057. r2 = parseHexChannel(hex[0] + hex[0]);
  23058. g = parseHexChannel(hex[1] + hex[1]);
  23059. b = parseHexChannel(hex[2] + hex[2]);
  23060. } else if (hex.length === 6 || hex.length === 8) {
  23061. r2 = parseHexChannel(hex.slice(0, 2));
  23062. g = parseHexChannel(hex.slice(2, 4));
  23063. b = parseHexChannel(hex.slice(4, 6));
  23064. }
  23065. if (hex.length === 8) {
  23066. this._alpha = parseHexChannel(hex.slice(6)) / 255 * 100;
  23067. } else if (hex.length === 3 || hex.length === 6) {
  23068. this._alpha = 100;
  23069. }
  23070. const { h: h2, s, v } = rgb2hsv(r2, g, b);
  23071. fromHSV(h2, s, v);
  23072. }
  23073. }
  23074. compare(color2) {
  23075. return Math.abs(color2._hue - this._hue) < 2 && Math.abs(color2._saturation - this._saturation) < 1 && Math.abs(color2._value - this._value) < 1 && Math.abs(color2._alpha - this._alpha) < 1;
  23076. }
  23077. doOnChange() {
  23078. const { _hue, _saturation, _value, _alpha, format } = this;
  23079. if (this.enableAlpha) {
  23080. switch (format) {
  23081. case "hsl": {
  23082. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  23083. this.value = `hsla(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%, ${this.get("alpha") / 100})`;
  23084. break;
  23085. }
  23086. case "hsv": {
  23087. this.value = `hsva(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%, ${this.get("alpha") / 100})`;
  23088. break;
  23089. }
  23090. case "hex": {
  23091. this.value = `${toHex(hsv2rgb(_hue, _saturation, _value))}${hexOne(_alpha * 255 / 100)}`;
  23092. break;
  23093. }
  23094. default: {
  23095. const { r: r2, g, b } = hsv2rgb(_hue, _saturation, _value);
  23096. this.value = `rgba(${r2}, ${g}, ${b}, ${this.get("alpha") / 100})`;
  23097. }
  23098. }
  23099. } else {
  23100. switch (format) {
  23101. case "hsl": {
  23102. const hsl = hsv2hsl(_hue, _saturation / 100, _value / 100);
  23103. this.value = `hsl(${_hue}, ${Math.round(hsl[1] * 100)}%, ${Math.round(hsl[2] * 100)}%)`;
  23104. break;
  23105. }
  23106. case "hsv": {
  23107. this.value = `hsv(${_hue}, ${Math.round(_saturation)}%, ${Math.round(_value)}%)`;
  23108. break;
  23109. }
  23110. case "rgb": {
  23111. const { r: r2, g, b } = hsv2rgb(_hue, _saturation, _value);
  23112. this.value = `rgb(${r2}, ${g}, ${b})`;
  23113. break;
  23114. }
  23115. default: {
  23116. this.value = toHex(hsv2rgb(_hue, _saturation, _value));
  23117. }
  23118. }
  23119. }
  23120. }
  23121. }
  23122. const _sfc_main$d = defineComponent({
  23123. props: {
  23124. colors: {
  23125. type: Array,
  23126. required: true
  23127. },
  23128. color: {
  23129. type: Object,
  23130. required: true
  23131. }
  23132. },
  23133. setup(props) {
  23134. const ns = useNamespace("color-predefine");
  23135. const { currentColor } = inject(colorPickerContextKey);
  23136. const rgbaColors = ref(parseColors(props.colors, props.color));
  23137. watch(() => currentColor.value, (val) => {
  23138. const color2 = new Color$1();
  23139. color2.fromString(val);
  23140. rgbaColors.value.forEach((item) => {
  23141. item.selected = color2.compare(item);
  23142. });
  23143. });
  23144. watchEffect(() => {
  23145. rgbaColors.value = parseColors(props.colors, props.color);
  23146. });
  23147. function handleSelect(index2) {
  23148. props.color.fromString(props.colors[index2]);
  23149. }
  23150. function parseColors(colors, color2) {
  23151. return colors.map((value) => {
  23152. const c = new Color$1();
  23153. c.enableAlpha = true;
  23154. c.format = "rgba";
  23155. c.fromString(value);
  23156. c.selected = c.value === color2.value;
  23157. return c;
  23158. });
  23159. }
  23160. return {
  23161. rgbaColors,
  23162. handleSelect,
  23163. ns
  23164. };
  23165. }
  23166. });
  23167. const _hoisted_1$a = ["onClick"];
  23168. function _sfc_render$5(_ctx, _cache, $props, $setup, $data, $options) {
  23169. return openBlock(), createElementBlock("div", {
  23170. class: normalizeClass(_ctx.ns.b())
  23171. }, [
  23172. createElementVNode("div", {
  23173. class: normalizeClass(_ctx.ns.e("colors"))
  23174. }, [
  23175. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.rgbaColors, (item, index2) => {
  23176. return openBlock(), createElementBlock("div", {
  23177. key: _ctx.colors[index2],
  23178. class: normalizeClass([
  23179. _ctx.ns.e("color-selector"),
  23180. _ctx.ns.is("alpha", item._alpha < 100),
  23181. { selected: item.selected }
  23182. ]),
  23183. onClick: ($event) => _ctx.handleSelect(index2)
  23184. }, [
  23185. createElementVNode("div", {
  23186. style: normalizeStyle({ backgroundColor: item.value })
  23187. }, null, 4)
  23188. ], 10, _hoisted_1$a);
  23189. }), 128))
  23190. ], 2)
  23191. ], 2);
  23192. }
  23193. var Predefine = /* @__PURE__ */ _export_sfc$1(_sfc_main$d, [["render", _sfc_render$5], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/predefine.vue"]]);
  23194. const _sfc_main$c = defineComponent({
  23195. name: "ElSlPanel",
  23196. props: {
  23197. color: {
  23198. type: Object,
  23199. required: true
  23200. }
  23201. },
  23202. setup(props) {
  23203. const ns = useNamespace("color-svpanel");
  23204. const instance = getCurrentInstance();
  23205. const cursorTop = ref(0);
  23206. const cursorLeft = ref(0);
  23207. const background = ref("hsl(0, 100%, 50%)");
  23208. const colorValue = computed$1(() => {
  23209. const hue = props.color.get("hue");
  23210. const value = props.color.get("value");
  23211. return { hue, value };
  23212. });
  23213. function update() {
  23214. const saturation = props.color.get("saturation");
  23215. const value = props.color.get("value");
  23216. const el = instance.vnode.el;
  23217. const { clientWidth: width2, clientHeight: height2 } = el;
  23218. cursorLeft.value = saturation * width2 / 100;
  23219. cursorTop.value = (100 - value) * height2 / 100;
  23220. background.value = `hsl(${props.color.get("hue")}, 100%, 50%)`;
  23221. }
  23222. function handleDrag(event2) {
  23223. const el = instance.vnode.el;
  23224. const rect = el.getBoundingClientRect();
  23225. const { clientX, clientY } = getClientXY(event2);
  23226. let left = clientX - rect.left;
  23227. let top = clientY - rect.top;
  23228. left = Math.max(0, left);
  23229. left = Math.min(left, rect.width);
  23230. top = Math.max(0, top);
  23231. top = Math.min(top, rect.height);
  23232. cursorLeft.value = left;
  23233. cursorTop.value = top;
  23234. props.color.set({
  23235. saturation: left / rect.width * 100,
  23236. value: 100 - top / rect.height * 100
  23237. });
  23238. }
  23239. watch(() => colorValue.value, () => {
  23240. update();
  23241. });
  23242. onMounted(() => {
  23243. draggable(instance.vnode.el, {
  23244. drag: (event2) => {
  23245. handleDrag(event2);
  23246. },
  23247. end: (event2) => {
  23248. handleDrag(event2);
  23249. }
  23250. });
  23251. update();
  23252. });
  23253. return {
  23254. cursorTop,
  23255. cursorLeft,
  23256. background,
  23257. colorValue,
  23258. handleDrag,
  23259. update,
  23260. ns
  23261. };
  23262. }
  23263. });
  23264. const _hoisted_1$9 = /* @__PURE__ */ createElementVNode("div", null, null, -1);
  23265. const _hoisted_2$7 = [
  23266. _hoisted_1$9
  23267. ];
  23268. function _sfc_render$4(_ctx, _cache, $props, $setup, $data, $options) {
  23269. return openBlock(), createElementBlock("div", {
  23270. class: normalizeClass(_ctx.ns.b()),
  23271. style: normalizeStyle({
  23272. backgroundColor: _ctx.background
  23273. })
  23274. }, [
  23275. createElementVNode("div", {
  23276. class: normalizeClass(_ctx.ns.e("white"))
  23277. }, null, 2),
  23278. createElementVNode("div", {
  23279. class: normalizeClass(_ctx.ns.e("black"))
  23280. }, null, 2),
  23281. createElementVNode("div", {
  23282. class: normalizeClass(_ctx.ns.e("cursor")),
  23283. style: normalizeStyle({
  23284. top: _ctx.cursorTop + "px",
  23285. left: _ctx.cursorLeft + "px"
  23286. })
  23287. }, _hoisted_2$7, 6)
  23288. ], 6);
  23289. }
  23290. var SvPanel = /* @__PURE__ */ _export_sfc$1(_sfc_main$c, [["render", _sfc_render$4], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/components/sv-panel.vue"]]);
  23291. const _hoisted_1$8 = ["id", "aria-label", "aria-labelledby", "aria-description", "tabindex", "onKeydown"];
  23292. const __default__$4 = defineComponent({
  23293. name: "ElColorPicker"
  23294. });
  23295. const _sfc_main$b = /* @__PURE__ */ defineComponent({
  23296. ...__default__$4,
  23297. props: colorPickerProps,
  23298. emits: colorPickerEmits,
  23299. setup(__props, { expose, emit }) {
  23300. const props = __props;
  23301. const { t: t2 } = useLocale();
  23302. const ns = useNamespace("color");
  23303. const { formItem } = useFormItem();
  23304. const colorSize = useFormSize();
  23305. const colorDisabled = useFormDisabled();
  23306. const { inputId: buttonId, isLabeledByFormItem } = useFormItemInputId(props, {
  23307. formItemContext: formItem
  23308. });
  23309. const hue = ref();
  23310. const sv = ref();
  23311. const alpha = ref();
  23312. const popper = ref();
  23313. let shouldActiveChange = true;
  23314. const color2 = reactive(new Color$1({
  23315. enableAlpha: props.showAlpha,
  23316. format: props.colorFormat || "",
  23317. value: props.modelValue
  23318. }));
  23319. const showPicker = ref(false);
  23320. const showPanelColor = ref(false);
  23321. const customInput = ref("");
  23322. const displayedColor = computed$1(() => {
  23323. if (!props.modelValue && !showPanelColor.value) {
  23324. return "transparent";
  23325. }
  23326. return displayedRgb(color2, props.showAlpha);
  23327. });
  23328. const currentColor = computed$1(() => {
  23329. return !props.modelValue && !showPanelColor.value ? "" : color2.value;
  23330. });
  23331. const buttonAriaLabel = computed$1(() => {
  23332. return !isLabeledByFormItem.value ? props.label || t2("el.colorpicker.defaultLabel") : void 0;
  23333. });
  23334. const buttonAriaLabelledby = computed$1(() => {
  23335. return isLabeledByFormItem.value ? formItem == null ? void 0 : formItem.labelId : void 0;
  23336. });
  23337. const btnKls = computed$1(() => {
  23338. return [
  23339. ns.b("picker"),
  23340. ns.is("disabled", colorDisabled.value),
  23341. ns.bm("picker", colorSize.value)
  23342. ];
  23343. });
  23344. function displayedRgb(color22, showAlpha) {
  23345. if (!(color22 instanceof Color$1)) {
  23346. throw new TypeError("color should be instance of _color Class");
  23347. }
  23348. const { r: r2, g, b } = color22.toRgb();
  23349. return showAlpha ? `rgba(${r2}, ${g}, ${b}, ${color22.get("alpha") / 100})` : `rgb(${r2}, ${g}, ${b})`;
  23350. }
  23351. function setShowPicker(value) {
  23352. showPicker.value = value;
  23353. }
  23354. const debounceSetShowPicker = debounce$2(setShowPicker, 100);
  23355. function show() {
  23356. if (colorDisabled.value)
  23357. return;
  23358. setShowPicker(true);
  23359. }
  23360. function hide() {
  23361. debounceSetShowPicker(false);
  23362. resetColor();
  23363. }
  23364. function resetColor() {
  23365. nextTick(() => {
  23366. if (props.modelValue) {
  23367. color2.fromString(props.modelValue);
  23368. } else {
  23369. color2.value = "";
  23370. nextTick(() => {
  23371. showPanelColor.value = false;
  23372. });
  23373. }
  23374. });
  23375. }
  23376. function handleTrigger() {
  23377. if (colorDisabled.value)
  23378. return;
  23379. debounceSetShowPicker(!showPicker.value);
  23380. }
  23381. function handleConfirm() {
  23382. color2.fromString(customInput.value);
  23383. }
  23384. function confirmValue() {
  23385. const value = color2.value;
  23386. emit(UPDATE_MODEL_EVENT, value);
  23387. emit("change", value);
  23388. if (props.validateEvent) {
  23389. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  23390. }
  23391. debounceSetShowPicker(false);
  23392. nextTick(() => {
  23393. const newColor = new Color$1({
  23394. enableAlpha: props.showAlpha,
  23395. format: props.colorFormat || "",
  23396. value: props.modelValue
  23397. });
  23398. if (!color2.compare(newColor)) {
  23399. resetColor();
  23400. }
  23401. });
  23402. }
  23403. function clear() {
  23404. debounceSetShowPicker(false);
  23405. emit(UPDATE_MODEL_EVENT, null);
  23406. emit("change", null);
  23407. if (props.modelValue !== null && props.validateEvent) {
  23408. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  23409. }
  23410. resetColor();
  23411. }
  23412. onMounted(() => {
  23413. if (props.modelValue) {
  23414. customInput.value = currentColor.value;
  23415. }
  23416. });
  23417. watch(() => props.modelValue, (newVal) => {
  23418. if (!newVal) {
  23419. showPanelColor.value = false;
  23420. } else if (newVal && newVal !== color2.value) {
  23421. shouldActiveChange = false;
  23422. color2.fromString(newVal);
  23423. }
  23424. });
  23425. watch(() => currentColor.value, (val) => {
  23426. customInput.value = val;
  23427. shouldActiveChange && emit("activeChange", val);
  23428. shouldActiveChange = true;
  23429. });
  23430. watch(() => color2.value, () => {
  23431. if (!props.modelValue && !showPanelColor.value) {
  23432. showPanelColor.value = true;
  23433. }
  23434. });
  23435. watch(() => showPicker.value, () => {
  23436. nextTick(() => {
  23437. var _a2, _b, _c;
  23438. (_a2 = hue.value) == null ? void 0 : _a2.update();
  23439. (_b = sv.value) == null ? void 0 : _b.update();
  23440. (_c = alpha.value) == null ? void 0 : _c.update();
  23441. });
  23442. });
  23443. provide(colorPickerContextKey, {
  23444. currentColor
  23445. });
  23446. expose({
  23447. color: color2,
  23448. show,
  23449. hide
  23450. });
  23451. return (_ctx, _cache) => {
  23452. return openBlock(), createBlock(unref(ElTooltip), {
  23453. ref_key: "popper",
  23454. ref: popper,
  23455. visible: showPicker.value,
  23456. "show-arrow": false,
  23457. "fallback-placements": ["bottom", "top", "right", "left"],
  23458. offset: 0,
  23459. "gpu-acceleration": false,
  23460. "popper-class": [unref(ns).be("picker", "panel"), unref(ns).b("dropdown"), _ctx.popperClass],
  23461. "stop-popper-mouse-event": false,
  23462. effect: "light",
  23463. trigger: "click",
  23464. transition: `${unref(ns).namespace.value}-zoom-in-top`,
  23465. persistent: ""
  23466. }, {
  23467. content: withCtx(() => [
  23468. withDirectives((openBlock(), createElementBlock("div", null, [
  23469. createElementVNode("div", {
  23470. class: normalizeClass(unref(ns).be("dropdown", "main-wrapper"))
  23471. }, [
  23472. createVNode(HueSlider, {
  23473. ref_key: "hue",
  23474. ref: hue,
  23475. class: "hue-slider",
  23476. color: unref(color2),
  23477. vertical: ""
  23478. }, null, 8, ["color"]),
  23479. createVNode(SvPanel, {
  23480. ref: "svPanel",
  23481. color: unref(color2)
  23482. }, null, 8, ["color"])
  23483. ], 2),
  23484. _ctx.showAlpha ? (openBlock(), createBlock(AlphaSlider, {
  23485. key: 0,
  23486. ref_key: "alpha",
  23487. ref: alpha,
  23488. color: unref(color2)
  23489. }, null, 8, ["color"])) : createCommentVNode("v-if", true),
  23490. _ctx.predefine ? (openBlock(), createBlock(Predefine, {
  23491. key: 1,
  23492. ref: "predefine",
  23493. color: unref(color2),
  23494. colors: _ctx.predefine
  23495. }, null, 8, ["color", "colors"])) : createCommentVNode("v-if", true),
  23496. createElementVNode("div", {
  23497. class: normalizeClass(unref(ns).be("dropdown", "btns"))
  23498. }, [
  23499. createElementVNode("span", {
  23500. class: normalizeClass(unref(ns).be("dropdown", "value"))
  23501. }, [
  23502. createVNode(unref(ElInput), {
  23503. modelValue: customInput.value,
  23504. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => customInput.value = $event),
  23505. "validate-event": false,
  23506. size: "small",
  23507. onKeyup: withKeys(handleConfirm, ["enter"]),
  23508. onBlur: handleConfirm
  23509. }, null, 8, ["modelValue", "onKeyup"])
  23510. ], 2),
  23511. createVNode(unref(ElButton), {
  23512. class: normalizeClass(unref(ns).be("dropdown", "link-btn")),
  23513. text: "",
  23514. size: "small",
  23515. onClick: clear
  23516. }, {
  23517. default: withCtx(() => [
  23518. createTextVNode(toDisplayString(unref(t2)("el.colorpicker.clear")), 1)
  23519. ]),
  23520. _: 1
  23521. }, 8, ["class"]),
  23522. createVNode(unref(ElButton), {
  23523. plain: "",
  23524. size: "small",
  23525. class: normalizeClass(unref(ns).be("dropdown", "btn")),
  23526. onClick: confirmValue
  23527. }, {
  23528. default: withCtx(() => [
  23529. createTextVNode(toDisplayString(unref(t2)("el.colorpicker.confirm")), 1)
  23530. ]),
  23531. _: 1
  23532. }, 8, ["class"])
  23533. ], 2)
  23534. ])), [
  23535. [unref(ClickOutside), hide]
  23536. ])
  23537. ]),
  23538. default: withCtx(() => [
  23539. createElementVNode("div", {
  23540. id: unref(buttonId),
  23541. class: normalizeClass(unref(btnKls)),
  23542. role: "button",
  23543. "aria-label": unref(buttonAriaLabel),
  23544. "aria-labelledby": unref(buttonAriaLabelledby),
  23545. "aria-description": unref(t2)("el.colorpicker.description", { color: _ctx.modelValue || "" }),
  23546. tabindex: _ctx.tabindex,
  23547. onKeydown: withKeys(handleTrigger, ["enter"])
  23548. }, [
  23549. unref(colorDisabled) ? (openBlock(), createElementBlock("div", {
  23550. key: 0,
  23551. class: normalizeClass(unref(ns).be("picker", "mask"))
  23552. }, null, 2)) : createCommentVNode("v-if", true),
  23553. createElementVNode("div", {
  23554. class: normalizeClass(unref(ns).be("picker", "trigger")),
  23555. onClick: handleTrigger
  23556. }, [
  23557. createElementVNode("span", {
  23558. class: normalizeClass([unref(ns).be("picker", "color"), unref(ns).is("alpha", _ctx.showAlpha)])
  23559. }, [
  23560. createElementVNode("span", {
  23561. class: normalizeClass(unref(ns).be("picker", "color-inner")),
  23562. style: normalizeStyle({
  23563. backgroundColor: unref(displayedColor)
  23564. })
  23565. }, [
  23566. withDirectives(createVNode(unref(ElIcon), {
  23567. class: normalizeClass([unref(ns).be("picker", "icon"), unref(ns).is("icon-arrow-down")])
  23568. }, {
  23569. default: withCtx(() => [
  23570. createVNode(unref(arrow_down_default))
  23571. ]),
  23572. _: 1
  23573. }, 8, ["class"]), [
  23574. [vShow, _ctx.modelValue || showPanelColor.value]
  23575. ]),
  23576. !_ctx.modelValue && !showPanelColor.value ? (openBlock(), createBlock(unref(ElIcon), {
  23577. key: 0,
  23578. class: normalizeClass([unref(ns).be("picker", "empty"), unref(ns).is("icon-close")])
  23579. }, {
  23580. default: withCtx(() => [
  23581. createVNode(unref(close_default))
  23582. ]),
  23583. _: 1
  23584. }, 8, ["class"])) : createCommentVNode("v-if", true)
  23585. ], 6)
  23586. ], 2)
  23587. ], 2)
  23588. ], 42, _hoisted_1$8)
  23589. ]),
  23590. _: 1
  23591. }, 8, ["visible", "popper-class", "transition"]);
  23592. };
  23593. }
  23594. });
  23595. var ColorPicker = /* @__PURE__ */ _export_sfc$1(_sfc_main$b, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/color-picker/src/color-picker.vue"]]);
  23596. const ElColorPicker = withInstall(ColorPicker);
  23597. const overlayProps = buildProps({
  23598. mask: {
  23599. type: Boolean,
  23600. default: true
  23601. },
  23602. customMaskEvent: {
  23603. type: Boolean,
  23604. default: false
  23605. },
  23606. overlayClass: {
  23607. type: definePropType([
  23608. String,
  23609. Array,
  23610. Object
  23611. ])
  23612. },
  23613. zIndex: {
  23614. type: definePropType([String, Number])
  23615. }
  23616. });
  23617. const overlayEmits = {
  23618. click: (evt) => evt instanceof MouseEvent
  23619. };
  23620. const BLOCK = "overlay";
  23621. var Overlay = defineComponent({
  23622. name: "ElOverlay",
  23623. props: overlayProps,
  23624. emits: overlayEmits,
  23625. setup(props, { slots, emit }) {
  23626. const ns = useNamespace(BLOCK);
  23627. const onMaskClick = (e) => {
  23628. emit("click", e);
  23629. };
  23630. const { onClick, onMousedown, onMouseup } = useSameTarget(props.customMaskEvent ? void 0 : onMaskClick);
  23631. return () => {
  23632. return props.mask ? createVNode("div", {
  23633. class: [ns.b(), props.overlayClass],
  23634. style: {
  23635. zIndex: props.zIndex
  23636. },
  23637. onClick,
  23638. onMousedown,
  23639. onMouseup
  23640. }, [renderSlot(slots, "default")], PatchFlags.STYLE | PatchFlags.CLASS | PatchFlags.PROPS, ["onClick", "onMouseup", "onMousedown"]) : h("div", {
  23641. class: props.overlayClass,
  23642. style: {
  23643. zIndex: props.zIndex,
  23644. position: "fixed",
  23645. top: "0px",
  23646. right: "0px",
  23647. bottom: "0px",
  23648. left: "0px"
  23649. }
  23650. }, [renderSlot(slots, "default")]);
  23651. };
  23652. }
  23653. });
  23654. const ElOverlay = Overlay;
  23655. const dialogInjectionKey = Symbol("dialogInjectionKey");
  23656. const dialogContentProps = buildProps({
  23657. center: {
  23658. type: Boolean,
  23659. default: false
  23660. },
  23661. alignCenter: {
  23662. type: Boolean,
  23663. default: false
  23664. },
  23665. closeIcon: {
  23666. type: iconPropType
  23667. },
  23668. customClass: {
  23669. type: String,
  23670. default: ""
  23671. },
  23672. draggable: {
  23673. type: Boolean,
  23674. default: false
  23675. },
  23676. fullscreen: {
  23677. type: Boolean,
  23678. default: false
  23679. },
  23680. showClose: {
  23681. type: Boolean,
  23682. default: true
  23683. },
  23684. title: {
  23685. type: String,
  23686. default: ""
  23687. }
  23688. });
  23689. const dialogContentEmits = {
  23690. close: () => true
  23691. };
  23692. const _hoisted_1$7 = ["aria-label"];
  23693. const _hoisted_2$6 = ["id"];
  23694. const __default__$3 = defineComponent({ name: "ElDialogContent" });
  23695. const _sfc_main$a = /* @__PURE__ */ defineComponent({
  23696. ...__default__$3,
  23697. props: dialogContentProps,
  23698. emits: dialogContentEmits,
  23699. setup(__props) {
  23700. const props = __props;
  23701. const { t: t2 } = useLocale();
  23702. const { Close } = CloseComponents;
  23703. const { dialogRef, headerRef, bodyId, ns, style } = inject(dialogInjectionKey);
  23704. const { focusTrapRef } = inject(FOCUS_TRAP_INJECTION_KEY);
  23705. const composedDialogRef = composeRefs(focusTrapRef, dialogRef);
  23706. const draggable2 = computed$1(() => props.draggable);
  23707. useDraggable(dialogRef, headerRef, draggable2);
  23708. return (_ctx, _cache) => {
  23709. return openBlock(), createElementBlock("div", {
  23710. ref: unref(composedDialogRef),
  23711. class: normalizeClass([
  23712. unref(ns).b(),
  23713. unref(ns).is("fullscreen", _ctx.fullscreen),
  23714. unref(ns).is("draggable", unref(draggable2)),
  23715. unref(ns).is("align-center", _ctx.alignCenter),
  23716. { [unref(ns).m("center")]: _ctx.center },
  23717. _ctx.customClass
  23718. ]),
  23719. style: normalizeStyle(unref(style)),
  23720. tabindex: "-1"
  23721. }, [
  23722. createElementVNode("header", {
  23723. ref_key: "headerRef",
  23724. ref: headerRef,
  23725. class: normalizeClass(unref(ns).e("header"))
  23726. }, [
  23727. renderSlot(_ctx.$slots, "header", {}, () => [
  23728. createElementVNode("span", {
  23729. role: "heading",
  23730. class: normalizeClass(unref(ns).e("title"))
  23731. }, toDisplayString(_ctx.title), 3)
  23732. ]),
  23733. _ctx.showClose ? (openBlock(), createElementBlock("button", {
  23734. key: 0,
  23735. "aria-label": unref(t2)("el.dialog.close"),
  23736. class: normalizeClass(unref(ns).e("headerbtn")),
  23737. type: "button",
  23738. onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
  23739. }, [
  23740. createVNode(unref(ElIcon), {
  23741. class: normalizeClass(unref(ns).e("close"))
  23742. }, {
  23743. default: withCtx(() => [
  23744. (openBlock(), createBlock(resolveDynamicComponent(_ctx.closeIcon || unref(Close))))
  23745. ]),
  23746. _: 1
  23747. }, 8, ["class"])
  23748. ], 10, _hoisted_1$7)) : createCommentVNode("v-if", true)
  23749. ], 2),
  23750. createElementVNode("div", {
  23751. id: unref(bodyId),
  23752. class: normalizeClass(unref(ns).e("body"))
  23753. }, [
  23754. renderSlot(_ctx.$slots, "default")
  23755. ], 10, _hoisted_2$6),
  23756. _ctx.$slots.footer ? (openBlock(), createElementBlock("footer", {
  23757. key: 0,
  23758. class: normalizeClass(unref(ns).e("footer"))
  23759. }, [
  23760. renderSlot(_ctx.$slots, "footer")
  23761. ], 2)) : createCommentVNode("v-if", true)
  23762. ], 6);
  23763. };
  23764. }
  23765. });
  23766. var ElDialogContent = /* @__PURE__ */ _export_sfc$1(_sfc_main$a, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog-content.vue"]]);
  23767. const dialogProps = buildProps({
  23768. ...dialogContentProps,
  23769. appendToBody: {
  23770. type: Boolean,
  23771. default: false
  23772. },
  23773. beforeClose: {
  23774. type: definePropType(Function)
  23775. },
  23776. destroyOnClose: {
  23777. type: Boolean,
  23778. default: false
  23779. },
  23780. closeOnClickModal: {
  23781. type: Boolean,
  23782. default: true
  23783. },
  23784. closeOnPressEscape: {
  23785. type: Boolean,
  23786. default: true
  23787. },
  23788. lockScroll: {
  23789. type: Boolean,
  23790. default: true
  23791. },
  23792. modal: {
  23793. type: Boolean,
  23794. default: true
  23795. },
  23796. openDelay: {
  23797. type: Number,
  23798. default: 0
  23799. },
  23800. closeDelay: {
  23801. type: Number,
  23802. default: 0
  23803. },
  23804. top: {
  23805. type: String
  23806. },
  23807. modelValue: {
  23808. type: Boolean,
  23809. default: false
  23810. },
  23811. modalClass: String,
  23812. width: {
  23813. type: [String, Number]
  23814. },
  23815. zIndex: {
  23816. type: Number
  23817. },
  23818. trapFocus: {
  23819. type: Boolean,
  23820. default: false
  23821. }
  23822. });
  23823. const dialogEmits = {
  23824. open: () => true,
  23825. opened: () => true,
  23826. close: () => true,
  23827. closed: () => true,
  23828. [UPDATE_MODEL_EVENT]: (value) => isBoolean(value),
  23829. openAutoFocus: () => true,
  23830. closeAutoFocus: () => true
  23831. };
  23832. const useDialog = (props, targetRef) => {
  23833. const instance = getCurrentInstance();
  23834. const emit = instance.emit;
  23835. const { nextZIndex } = useZIndex();
  23836. let lastPosition = "";
  23837. const titleId = useId();
  23838. const bodyId = useId();
  23839. const visible = ref(false);
  23840. const closed = ref(false);
  23841. const rendered = ref(false);
  23842. const zIndex2 = ref(props.zIndex || nextZIndex());
  23843. let openTimer = void 0;
  23844. let closeTimer = void 0;
  23845. const namespace = useGlobalConfig("namespace", defaultNamespace);
  23846. const style = computed$1(() => {
  23847. const style2 = {};
  23848. const varPrefix = `--${namespace.value}-dialog`;
  23849. if (!props.fullscreen) {
  23850. if (props.top) {
  23851. style2[`${varPrefix}-margin-top`] = props.top;
  23852. }
  23853. if (props.width) {
  23854. style2[`${varPrefix}-width`] = addUnit(props.width);
  23855. }
  23856. }
  23857. return style2;
  23858. });
  23859. const overlayDialogStyle = computed$1(() => {
  23860. if (props.alignCenter) {
  23861. return { display: "flex" };
  23862. }
  23863. return {};
  23864. });
  23865. function afterEnter() {
  23866. emit("opened");
  23867. }
  23868. function afterLeave() {
  23869. emit("closed");
  23870. emit(UPDATE_MODEL_EVENT, false);
  23871. if (props.destroyOnClose) {
  23872. rendered.value = false;
  23873. }
  23874. }
  23875. function beforeLeave() {
  23876. emit("close");
  23877. }
  23878. function open() {
  23879. closeTimer == null ? void 0 : closeTimer();
  23880. openTimer == null ? void 0 : openTimer();
  23881. if (props.openDelay && props.openDelay > 0) {
  23882. ({ stop: openTimer } = useTimeoutFn(() => doOpen(), props.openDelay));
  23883. } else {
  23884. doOpen();
  23885. }
  23886. }
  23887. function close() {
  23888. openTimer == null ? void 0 : openTimer();
  23889. closeTimer == null ? void 0 : closeTimer();
  23890. if (props.closeDelay && props.closeDelay > 0) {
  23891. ({ stop: closeTimer } = useTimeoutFn(() => doClose(), props.closeDelay));
  23892. } else {
  23893. doClose();
  23894. }
  23895. }
  23896. function handleClose() {
  23897. function hide(shouldCancel) {
  23898. if (shouldCancel)
  23899. return;
  23900. closed.value = true;
  23901. visible.value = false;
  23902. }
  23903. if (props.beforeClose) {
  23904. props.beforeClose(hide);
  23905. } else {
  23906. close();
  23907. }
  23908. }
  23909. function onModalClick() {
  23910. if (props.closeOnClickModal) {
  23911. handleClose();
  23912. }
  23913. }
  23914. function doOpen() {
  23915. if (!isClient)
  23916. return;
  23917. visible.value = true;
  23918. }
  23919. function doClose() {
  23920. visible.value = false;
  23921. }
  23922. function onOpenAutoFocus() {
  23923. emit("openAutoFocus");
  23924. }
  23925. function onCloseAutoFocus() {
  23926. emit("closeAutoFocus");
  23927. }
  23928. function onFocusoutPrevented(event2) {
  23929. var _a2;
  23930. if (((_a2 = event2.detail) == null ? void 0 : _a2.focusReason) === "pointer") {
  23931. event2.preventDefault();
  23932. }
  23933. }
  23934. if (props.lockScroll) {
  23935. useLockscreen(visible);
  23936. }
  23937. function onCloseRequested() {
  23938. if (props.closeOnPressEscape) {
  23939. handleClose();
  23940. }
  23941. }
  23942. watch(() => props.modelValue, (val) => {
  23943. if (val) {
  23944. closed.value = false;
  23945. open();
  23946. rendered.value = true;
  23947. zIndex2.value = props.zIndex ? zIndex2.value++ : nextZIndex();
  23948. nextTick(() => {
  23949. emit("open");
  23950. if (targetRef.value) {
  23951. targetRef.value.scrollTop = 0;
  23952. }
  23953. });
  23954. } else {
  23955. if (visible.value) {
  23956. close();
  23957. }
  23958. }
  23959. });
  23960. watch(() => props.fullscreen, (val) => {
  23961. if (!targetRef.value)
  23962. return;
  23963. if (val) {
  23964. lastPosition = targetRef.value.style.transform;
  23965. targetRef.value.style.transform = "";
  23966. } else {
  23967. targetRef.value.style.transform = lastPosition;
  23968. }
  23969. });
  23970. onMounted(() => {
  23971. if (props.modelValue) {
  23972. visible.value = true;
  23973. rendered.value = true;
  23974. open();
  23975. }
  23976. });
  23977. return {
  23978. afterEnter,
  23979. afterLeave,
  23980. beforeLeave,
  23981. handleClose,
  23982. onModalClick,
  23983. close,
  23984. doClose,
  23985. onOpenAutoFocus,
  23986. onCloseAutoFocus,
  23987. onCloseRequested,
  23988. onFocusoutPrevented,
  23989. titleId,
  23990. bodyId,
  23991. closed,
  23992. style,
  23993. overlayDialogStyle,
  23994. rendered,
  23995. visible,
  23996. zIndex: zIndex2
  23997. };
  23998. };
  23999. const _hoisted_1$6 = ["aria-label", "aria-labelledby", "aria-describedby"];
  24000. const __default__$2 = defineComponent({
  24001. name: "ElDialog",
  24002. inheritAttrs: false
  24003. });
  24004. const _sfc_main$9 = /* @__PURE__ */ defineComponent({
  24005. ...__default__$2,
  24006. props: dialogProps,
  24007. emits: dialogEmits,
  24008. setup(__props, { expose }) {
  24009. const props = __props;
  24010. const slots = useSlots();
  24011. useDeprecated({
  24012. scope: "el-dialog",
  24013. from: "the title slot",
  24014. replacement: "the header slot",
  24015. version: "3.0.0",
  24016. ref: "https://element-plus.org/en-US/component/dialog.html#slots"
  24017. }, computed$1(() => !!slots.title));
  24018. useDeprecated({
  24019. scope: "el-dialog",
  24020. from: "custom-class",
  24021. replacement: "class",
  24022. version: "2.3.0",
  24023. ref: "https://element-plus.org/en-US/component/dialog.html#attributes",
  24024. type: "Attribute"
  24025. }, computed$1(() => !!props.customClass));
  24026. const ns = useNamespace("dialog");
  24027. const dialogRef = ref();
  24028. const headerRef = ref();
  24029. const dialogContentRef = ref();
  24030. const {
  24031. visible,
  24032. titleId,
  24033. bodyId,
  24034. style,
  24035. overlayDialogStyle,
  24036. rendered,
  24037. zIndex: zIndex2,
  24038. afterEnter,
  24039. afterLeave,
  24040. beforeLeave,
  24041. handleClose,
  24042. onModalClick,
  24043. onOpenAutoFocus,
  24044. onCloseAutoFocus,
  24045. onCloseRequested,
  24046. onFocusoutPrevented
  24047. } = useDialog(props, dialogRef);
  24048. provide(dialogInjectionKey, {
  24049. dialogRef,
  24050. headerRef,
  24051. bodyId,
  24052. ns,
  24053. rendered,
  24054. style
  24055. });
  24056. const overlayEvent = useSameTarget(onModalClick);
  24057. const draggable2 = computed$1(() => props.draggable && !props.fullscreen);
  24058. expose({
  24059. visible,
  24060. dialogContentRef
  24061. });
  24062. return (_ctx, _cache) => {
  24063. return openBlock(), createBlock(Teleport, {
  24064. to: "body",
  24065. disabled: !_ctx.appendToBody
  24066. }, [
  24067. createVNode(Transition, {
  24068. name: "dialog-fade",
  24069. onAfterEnter: unref(afterEnter),
  24070. onAfterLeave: unref(afterLeave),
  24071. onBeforeLeave: unref(beforeLeave),
  24072. persisted: ""
  24073. }, {
  24074. default: withCtx(() => [
  24075. withDirectives(createVNode(unref(ElOverlay), {
  24076. "custom-mask-event": "",
  24077. mask: _ctx.modal,
  24078. "overlay-class": _ctx.modalClass,
  24079. "z-index": unref(zIndex2)
  24080. }, {
  24081. default: withCtx(() => [
  24082. createElementVNode("div", {
  24083. role: "dialog",
  24084. "aria-modal": "true",
  24085. "aria-label": _ctx.title || void 0,
  24086. "aria-labelledby": !_ctx.title ? unref(titleId) : void 0,
  24087. "aria-describedby": unref(bodyId),
  24088. class: normalizeClass(`${unref(ns).namespace.value}-overlay-dialog`),
  24089. style: normalizeStyle(unref(overlayDialogStyle)),
  24090. onClick: _cache[0] || (_cache[0] = (...args) => unref(overlayEvent).onClick && unref(overlayEvent).onClick(...args)),
  24091. onMousedown: _cache[1] || (_cache[1] = (...args) => unref(overlayEvent).onMousedown && unref(overlayEvent).onMousedown(...args)),
  24092. onMouseup: _cache[2] || (_cache[2] = (...args) => unref(overlayEvent).onMouseup && unref(overlayEvent).onMouseup(...args))
  24093. }, [
  24094. createVNode(unref(ElFocusTrap), {
  24095. loop: "",
  24096. trapped: unref(visible),
  24097. "focus-start-el": "container",
  24098. onFocusAfterTrapped: unref(onOpenAutoFocus),
  24099. onFocusAfterReleased: unref(onCloseAutoFocus),
  24100. onFocusoutPrevented: unref(onFocusoutPrevented),
  24101. onReleaseRequested: unref(onCloseRequested)
  24102. }, {
  24103. default: withCtx(() => [
  24104. unref(rendered) ? (openBlock(), createBlock(ElDialogContent, mergeProps({
  24105. key: 0,
  24106. ref_key: "dialogContentRef",
  24107. ref: dialogContentRef
  24108. }, _ctx.$attrs, {
  24109. "custom-class": _ctx.customClass,
  24110. center: _ctx.center,
  24111. "align-center": _ctx.alignCenter,
  24112. "close-icon": _ctx.closeIcon,
  24113. draggable: unref(draggable2),
  24114. fullscreen: _ctx.fullscreen,
  24115. "show-close": _ctx.showClose,
  24116. title: _ctx.title,
  24117. onClose: unref(handleClose)
  24118. }), createSlots({
  24119. header: withCtx(() => [
  24120. !_ctx.$slots.title ? renderSlot(_ctx.$slots, "header", {
  24121. key: 0,
  24122. close: unref(handleClose),
  24123. titleId: unref(titleId),
  24124. titleClass: unref(ns).e("title")
  24125. }) : renderSlot(_ctx.$slots, "title", { key: 1 })
  24126. ]),
  24127. default: withCtx(() => [
  24128. renderSlot(_ctx.$slots, "default")
  24129. ]),
  24130. _: 2
  24131. }, [
  24132. _ctx.$slots.footer ? {
  24133. name: "footer",
  24134. fn: withCtx(() => [
  24135. renderSlot(_ctx.$slots, "footer")
  24136. ])
  24137. } : void 0
  24138. ]), 1040, ["custom-class", "center", "align-center", "close-icon", "draggable", "fullscreen", "show-close", "title", "onClose"])) : createCommentVNode("v-if", true)
  24139. ]),
  24140. _: 3
  24141. }, 8, ["trapped", "onFocusAfterTrapped", "onFocusAfterReleased", "onFocusoutPrevented", "onReleaseRequested"])
  24142. ], 46, _hoisted_1$6)
  24143. ]),
  24144. _: 3
  24145. }, 8, ["mask", "overlay-class", "z-index"]), [
  24146. [vShow, unref(visible)]
  24147. ])
  24148. ]),
  24149. _: 3
  24150. }, 8, ["onAfterEnter", "onAfterLeave", "onBeforeLeave"])
  24151. ], 8, ["disabled"]);
  24152. };
  24153. }
  24154. });
  24155. var Dialog = /* @__PURE__ */ _export_sfc$1(_sfc_main$9, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/dialog/src/dialog.vue"]]);
  24156. const ElDialog = withInstall(Dialog);
  24157. const inputNumberProps = buildProps({
  24158. id: {
  24159. type: String,
  24160. default: void 0
  24161. },
  24162. step: {
  24163. type: Number,
  24164. default: 1
  24165. },
  24166. stepStrictly: Boolean,
  24167. max: {
  24168. type: Number,
  24169. default: Number.POSITIVE_INFINITY
  24170. },
  24171. min: {
  24172. type: Number,
  24173. default: Number.NEGATIVE_INFINITY
  24174. },
  24175. modelValue: Number,
  24176. readonly: Boolean,
  24177. disabled: Boolean,
  24178. size: useSizeProp,
  24179. controls: {
  24180. type: Boolean,
  24181. default: true
  24182. },
  24183. controlsPosition: {
  24184. type: String,
  24185. default: "",
  24186. values: ["", "right"]
  24187. },
  24188. valueOnClear: {
  24189. type: [String, Number, null],
  24190. validator: (val) => val === null || isNumber(val) || ["min", "max"].includes(val),
  24191. default: null
  24192. },
  24193. name: String,
  24194. label: String,
  24195. placeholder: String,
  24196. precision: {
  24197. type: Number,
  24198. validator: (val) => val >= 0 && val === Number.parseInt(`${val}`, 10)
  24199. },
  24200. validateEvent: {
  24201. type: Boolean,
  24202. default: true
  24203. }
  24204. });
  24205. const inputNumberEmits = {
  24206. [CHANGE_EVENT]: (cur, prev) => prev !== cur,
  24207. blur: (e) => e instanceof FocusEvent,
  24208. focus: (e) => e instanceof FocusEvent,
  24209. [INPUT_EVENT]: (val) => isNumber(val) || isNil(val),
  24210. [UPDATE_MODEL_EVENT]: (val) => isNumber(val) || isNil(val)
  24211. };
  24212. const _hoisted_1$5 = ["aria-label", "onKeydown"];
  24213. const _hoisted_2$5 = ["aria-label", "onKeydown"];
  24214. const __default__$1 = defineComponent({
  24215. name: "ElInputNumber"
  24216. });
  24217. const _sfc_main$8 = /* @__PURE__ */ defineComponent({
  24218. ...__default__$1,
  24219. props: inputNumberProps,
  24220. emits: inputNumberEmits,
  24221. setup(__props, { expose, emit }) {
  24222. const props = __props;
  24223. const { t: t2 } = useLocale();
  24224. const ns = useNamespace("input-number");
  24225. const input = ref();
  24226. const data = reactive({
  24227. currentValue: props.modelValue,
  24228. userInput: null
  24229. });
  24230. const { formItem } = useFormItem();
  24231. const minDisabled = computed$1(() => isNumber(props.modelValue) && props.modelValue <= props.min);
  24232. const maxDisabled = computed$1(() => isNumber(props.modelValue) && props.modelValue >= props.max);
  24233. const numPrecision = computed$1(() => {
  24234. const stepPrecision = getPrecision(props.step);
  24235. if (!isUndefined(props.precision)) {
  24236. if (stepPrecision > props.precision)
  24237. ;
  24238. return props.precision;
  24239. } else {
  24240. return Math.max(getPrecision(props.modelValue), stepPrecision);
  24241. }
  24242. });
  24243. const controlsAtRight = computed$1(() => {
  24244. return props.controls && props.controlsPosition === "right";
  24245. });
  24246. const inputNumberSize = useFormSize();
  24247. const inputNumberDisabled = useFormDisabled();
  24248. const displayValue = computed$1(() => {
  24249. if (data.userInput !== null) {
  24250. return data.userInput;
  24251. }
  24252. let currentValue = data.currentValue;
  24253. if (isNil(currentValue))
  24254. return "";
  24255. if (isNumber(currentValue)) {
  24256. if (Number.isNaN(currentValue))
  24257. return "";
  24258. if (!isUndefined(props.precision)) {
  24259. currentValue = currentValue.toFixed(props.precision);
  24260. }
  24261. }
  24262. return currentValue;
  24263. });
  24264. const toPrecision = (num, pre) => {
  24265. if (isUndefined(pre))
  24266. pre = numPrecision.value;
  24267. if (pre === 0)
  24268. return Math.round(num);
  24269. let snum = String(num);
  24270. const pointPos = snum.indexOf(".");
  24271. if (pointPos === -1)
  24272. return num;
  24273. const nums = snum.replace(".", "").split("");
  24274. const datum = nums[pointPos + pre];
  24275. if (!datum)
  24276. return num;
  24277. const length = snum.length;
  24278. if (snum.charAt(length - 1) === "5") {
  24279. snum = `${snum.slice(0, Math.max(0, length - 1))}6`;
  24280. }
  24281. return Number.parseFloat(Number(snum).toFixed(pre));
  24282. };
  24283. const getPrecision = (value) => {
  24284. if (isNil(value))
  24285. return 0;
  24286. const valueString = value.toString();
  24287. const dotPosition = valueString.indexOf(".");
  24288. let precision = 0;
  24289. if (dotPosition !== -1) {
  24290. precision = valueString.length - dotPosition - 1;
  24291. }
  24292. return precision;
  24293. };
  24294. const ensurePrecision = (val, coefficient = 1) => {
  24295. if (!isNumber(val))
  24296. return data.currentValue;
  24297. return toPrecision(val + props.step * coefficient);
  24298. };
  24299. const increase = () => {
  24300. if (props.readonly || inputNumberDisabled.value || maxDisabled.value)
  24301. return;
  24302. const value = Number(displayValue.value) || 0;
  24303. const newVal = ensurePrecision(value);
  24304. setCurrentValue(newVal);
  24305. emit(INPUT_EVENT, data.currentValue);
  24306. };
  24307. const decrease = () => {
  24308. if (props.readonly || inputNumberDisabled.value || minDisabled.value)
  24309. return;
  24310. const value = Number(displayValue.value) || 0;
  24311. const newVal = ensurePrecision(value, -1);
  24312. setCurrentValue(newVal);
  24313. emit(INPUT_EVENT, data.currentValue);
  24314. };
  24315. const verifyValue = (value, update) => {
  24316. const { max: max2, min: min2, step, precision, stepStrictly, valueOnClear } = props;
  24317. let newVal = Number(value);
  24318. if (isNil(value) || Number.isNaN(newVal)) {
  24319. return null;
  24320. }
  24321. if (value === "") {
  24322. if (valueOnClear === null) {
  24323. return null;
  24324. }
  24325. newVal = isString(valueOnClear) ? { min: min2, max: max2 }[valueOnClear] : valueOnClear;
  24326. }
  24327. if (stepStrictly) {
  24328. newVal = toPrecision(Math.round(newVal / step) * step, precision);
  24329. }
  24330. if (!isUndefined(precision)) {
  24331. newVal = toPrecision(newVal, precision);
  24332. }
  24333. if (newVal > max2 || newVal < min2) {
  24334. newVal = newVal > max2 ? max2 : min2;
  24335. update && emit(UPDATE_MODEL_EVENT, newVal);
  24336. }
  24337. return newVal;
  24338. };
  24339. const setCurrentValue = (value, emitChange = true) => {
  24340. var _a2;
  24341. const oldVal = data.currentValue;
  24342. const newVal = verifyValue(value);
  24343. if (!emitChange) {
  24344. emit(UPDATE_MODEL_EVENT, newVal);
  24345. return;
  24346. }
  24347. if (oldVal === newVal)
  24348. return;
  24349. data.userInput = null;
  24350. emit(UPDATE_MODEL_EVENT, newVal);
  24351. emit(CHANGE_EVENT, newVal, oldVal);
  24352. if (props.validateEvent) {
  24353. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  24354. }
  24355. data.currentValue = newVal;
  24356. };
  24357. const handleInput = (value) => {
  24358. data.userInput = value;
  24359. const newVal = value === "" ? null : Number(value);
  24360. emit(INPUT_EVENT, newVal);
  24361. setCurrentValue(newVal, false);
  24362. };
  24363. const handleInputChange = (value) => {
  24364. const newVal = value !== "" ? Number(value) : "";
  24365. if (isNumber(newVal) && !Number.isNaN(newVal) || value === "") {
  24366. setCurrentValue(newVal);
  24367. }
  24368. data.userInput = null;
  24369. };
  24370. const focus = () => {
  24371. var _a2, _b;
  24372. (_b = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  24373. };
  24374. const blur = () => {
  24375. var _a2, _b;
  24376. (_b = (_a2 = input.value) == null ? void 0 : _a2.blur) == null ? void 0 : _b.call(_a2);
  24377. };
  24378. const handleFocus = (event2) => {
  24379. emit("focus", event2);
  24380. };
  24381. const handleBlur = (event2) => {
  24382. var _a2;
  24383. emit("blur", event2);
  24384. if (props.validateEvent) {
  24385. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "blur").catch((err) => debugWarn());
  24386. }
  24387. };
  24388. watch(() => props.modelValue, (value) => {
  24389. const userInput = verifyValue(data.userInput);
  24390. const newValue = verifyValue(value, true);
  24391. if (!isNumber(userInput) && (!userInput || userInput !== newValue)) {
  24392. data.currentValue = newValue;
  24393. data.userInput = null;
  24394. }
  24395. }, { immediate: true });
  24396. onMounted(() => {
  24397. var _a2;
  24398. const { min: min2, max: max2, modelValue } = props;
  24399. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  24400. innerInput.setAttribute("role", "spinbutton");
  24401. if (Number.isFinite(max2)) {
  24402. innerInput.setAttribute("aria-valuemax", String(max2));
  24403. } else {
  24404. innerInput.removeAttribute("aria-valuemax");
  24405. }
  24406. if (Number.isFinite(min2)) {
  24407. innerInput.setAttribute("aria-valuemin", String(min2));
  24408. } else {
  24409. innerInput.removeAttribute("aria-valuemin");
  24410. }
  24411. innerInput.setAttribute("aria-valuenow", String(data.currentValue));
  24412. innerInput.setAttribute("aria-disabled", String(inputNumberDisabled.value));
  24413. if (!isNumber(modelValue) && modelValue != null) {
  24414. let val = Number(modelValue);
  24415. if (Number.isNaN(val)) {
  24416. val = null;
  24417. }
  24418. emit(UPDATE_MODEL_EVENT, val);
  24419. }
  24420. });
  24421. onUpdated(() => {
  24422. var _a2;
  24423. const innerInput = (_a2 = input.value) == null ? void 0 : _a2.input;
  24424. innerInput == null ? void 0 : innerInput.setAttribute("aria-valuenow", `${data.currentValue}`);
  24425. });
  24426. expose({
  24427. focus,
  24428. blur
  24429. });
  24430. return (_ctx, _cache) => {
  24431. return openBlock(), createElementBlock("div", {
  24432. class: normalizeClass([
  24433. unref(ns).b(),
  24434. unref(ns).m(unref(inputNumberSize)),
  24435. unref(ns).is("disabled", unref(inputNumberDisabled)),
  24436. unref(ns).is("without-controls", !_ctx.controls),
  24437. unref(ns).is("controls-right", unref(controlsAtRight))
  24438. ]),
  24439. onDragstart: _cache[1] || (_cache[1] = withModifiers(() => {
  24440. }, ["prevent"]))
  24441. }, [
  24442. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  24443. key: 0,
  24444. role: "button",
  24445. "aria-label": unref(t2)("el.inputNumber.decrease"),
  24446. class: normalizeClass([unref(ns).e("decrease"), unref(ns).is("disabled", unref(minDisabled))]),
  24447. onKeydown: withKeys(decrease, ["enter"])
  24448. }, [
  24449. createVNode(unref(ElIcon), null, {
  24450. default: withCtx(() => [
  24451. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_down_default), { key: 0 })) : (openBlock(), createBlock(unref(minus_default), { key: 1 }))
  24452. ]),
  24453. _: 1
  24454. })
  24455. ], 42, _hoisted_1$5)), [
  24456. [unref(vRepeatClick), decrease]
  24457. ]) : createCommentVNode("v-if", true),
  24458. _ctx.controls ? withDirectives((openBlock(), createElementBlock("span", {
  24459. key: 1,
  24460. role: "button",
  24461. "aria-label": unref(t2)("el.inputNumber.increase"),
  24462. class: normalizeClass([unref(ns).e("increase"), unref(ns).is("disabled", unref(maxDisabled))]),
  24463. onKeydown: withKeys(increase, ["enter"])
  24464. }, [
  24465. createVNode(unref(ElIcon), null, {
  24466. default: withCtx(() => [
  24467. unref(controlsAtRight) ? (openBlock(), createBlock(unref(arrow_up_default), { key: 0 })) : (openBlock(), createBlock(unref(plus_default), { key: 1 }))
  24468. ]),
  24469. _: 1
  24470. })
  24471. ], 42, _hoisted_2$5)), [
  24472. [unref(vRepeatClick), increase]
  24473. ]) : createCommentVNode("v-if", true),
  24474. createVNode(unref(ElInput), {
  24475. id: _ctx.id,
  24476. ref_key: "input",
  24477. ref: input,
  24478. type: "number",
  24479. step: _ctx.step,
  24480. "model-value": unref(displayValue),
  24481. placeholder: _ctx.placeholder,
  24482. readonly: _ctx.readonly,
  24483. disabled: unref(inputNumberDisabled),
  24484. size: unref(inputNumberSize),
  24485. max: _ctx.max,
  24486. min: _ctx.min,
  24487. name: _ctx.name,
  24488. label: _ctx.label,
  24489. "validate-event": false,
  24490. onWheel: _cache[0] || (_cache[0] = withModifiers(() => {
  24491. }, ["prevent"])),
  24492. onKeydown: [
  24493. withKeys(withModifiers(increase, ["prevent"]), ["up"]),
  24494. withKeys(withModifiers(decrease, ["prevent"]), ["down"])
  24495. ],
  24496. onBlur: handleBlur,
  24497. onFocus: handleFocus,
  24498. onInput: handleInput,
  24499. onChange: handleInputChange
  24500. }, null, 8, ["id", "step", "model-value", "placeholder", "readonly", "disabled", "size", "max", "min", "name", "label", "onKeydown"])
  24501. ], 34);
  24502. };
  24503. }
  24504. });
  24505. var InputNumber = /* @__PURE__ */ _export_sfc$1(_sfc_main$8, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input-number/src/input-number.vue"]]);
  24506. const ElInputNumber = withInstall(InputNumber);
  24507. const selectGroupKey = Symbol("ElSelectGroup");
  24508. const selectKey = Symbol("ElSelect");
  24509. function useOption(props, states) {
  24510. const select = inject(selectKey);
  24511. const selectGroup = inject(selectGroupKey, { disabled: false });
  24512. const isObject3 = computed$1(() => {
  24513. return Object.prototype.toString.call(props.value).toLowerCase() === "[object object]";
  24514. });
  24515. const itemSelected = computed$1(() => {
  24516. if (!select.props.multiple) {
  24517. return isEqual2(props.value, select.props.modelValue);
  24518. } else {
  24519. return contains(select.props.modelValue, props.value);
  24520. }
  24521. });
  24522. const limitReached = computed$1(() => {
  24523. if (select.props.multiple) {
  24524. const modelValue = select.props.modelValue || [];
  24525. return !itemSelected.value && modelValue.length >= select.props.multipleLimit && select.props.multipleLimit > 0;
  24526. } else {
  24527. return false;
  24528. }
  24529. });
  24530. const currentLabel = computed$1(() => {
  24531. return props.label || (isObject3.value ? "" : props.value);
  24532. });
  24533. const currentValue = computed$1(() => {
  24534. return props.value || props.label || "";
  24535. });
  24536. const isDisabled3 = computed$1(() => {
  24537. return props.disabled || states.groupDisabled || limitReached.value;
  24538. });
  24539. const instance = getCurrentInstance();
  24540. const contains = (arr = [], target) => {
  24541. if (!isObject3.value) {
  24542. return arr && arr.includes(target);
  24543. } else {
  24544. const valueKey = select.props.valueKey;
  24545. return arr && arr.some((item) => {
  24546. return toRaw$1(get$2(item, valueKey)) === get$2(target, valueKey);
  24547. });
  24548. }
  24549. };
  24550. const isEqual2 = (a, b) => {
  24551. if (!isObject3.value) {
  24552. return a === b;
  24553. } else {
  24554. const { valueKey } = select.props;
  24555. return get$2(a, valueKey) === get$2(b, valueKey);
  24556. }
  24557. };
  24558. const hoverItem = () => {
  24559. if (!props.disabled && !selectGroup.disabled) {
  24560. select.hoverIndex = select.optionsArray.indexOf(instance.proxy);
  24561. }
  24562. };
  24563. watch(() => currentLabel.value, () => {
  24564. if (!props.created && !select.props.remote)
  24565. select.setSelected();
  24566. });
  24567. watch(() => props.value, (val, oldVal) => {
  24568. const { remote, valueKey } = select.props;
  24569. if (!Object.is(val, oldVal)) {
  24570. select.onOptionDestroy(oldVal, instance.proxy);
  24571. select.onOptionCreate(instance.proxy);
  24572. }
  24573. if (!props.created && !remote) {
  24574. if (valueKey && typeof val === "object" && typeof oldVal === "object" && val[valueKey] === oldVal[valueKey]) {
  24575. return;
  24576. }
  24577. select.setSelected();
  24578. }
  24579. });
  24580. watch(() => selectGroup.disabled, () => {
  24581. states.groupDisabled = selectGroup.disabled;
  24582. }, { immediate: true });
  24583. const { queryChange } = toRaw$1(select);
  24584. watch(queryChange, (changes) => {
  24585. const { query } = unref(changes);
  24586. const regexp = new RegExp(escapeStringRegexp(query), "i");
  24587. states.visible = regexp.test(currentLabel.value) || props.created;
  24588. if (!states.visible) {
  24589. select.filteredOptionsCount--;
  24590. }
  24591. }, { immediate: true });
  24592. return {
  24593. select,
  24594. currentLabel,
  24595. currentValue,
  24596. itemSelected,
  24597. isDisabled: isDisabled3,
  24598. hoverItem
  24599. };
  24600. }
  24601. const _sfc_main$7 = defineComponent({
  24602. name: "ElOption",
  24603. componentName: "ElOption",
  24604. props: {
  24605. value: {
  24606. required: true,
  24607. type: [String, Number, Boolean, Object]
  24608. },
  24609. label: [String, Number],
  24610. created: Boolean,
  24611. disabled: {
  24612. type: Boolean,
  24613. default: false
  24614. }
  24615. },
  24616. setup(props) {
  24617. const ns = useNamespace("select");
  24618. const states = reactive({
  24619. index: -1,
  24620. groupDisabled: false,
  24621. visible: true,
  24622. hitState: false,
  24623. hover: false
  24624. });
  24625. const { currentLabel, itemSelected, isDisabled: isDisabled3, select, hoverItem } = useOption(props, states);
  24626. const { visible, hover } = toRefs(states);
  24627. const vm = getCurrentInstance().proxy;
  24628. select.onOptionCreate(vm);
  24629. onBeforeUnmount(() => {
  24630. const key = vm.value;
  24631. const { selected } = select;
  24632. const selectedOptions = select.props.multiple ? selected : [selected];
  24633. const doesSelected = selectedOptions.some((item) => {
  24634. return item.value === vm.value;
  24635. });
  24636. nextTick(() => {
  24637. if (select.cachedOptions.get(key) === vm && !doesSelected) {
  24638. select.cachedOptions.delete(key);
  24639. }
  24640. });
  24641. select.onOptionDestroy(key, vm);
  24642. });
  24643. function selectOptionClick() {
  24644. if (props.disabled !== true && states.groupDisabled !== true) {
  24645. select.handleOptionSelect(vm, true);
  24646. }
  24647. }
  24648. return {
  24649. ns,
  24650. currentLabel,
  24651. itemSelected,
  24652. isDisabled: isDisabled3,
  24653. select,
  24654. hoverItem,
  24655. visible,
  24656. hover,
  24657. selectOptionClick,
  24658. states
  24659. };
  24660. }
  24661. });
  24662. function _sfc_render$3(_ctx, _cache, $props, $setup, $data, $options) {
  24663. return withDirectives((openBlock(), createElementBlock("li", {
  24664. class: normalizeClass([
  24665. _ctx.ns.be("dropdown", "item"),
  24666. _ctx.ns.is("disabled", _ctx.isDisabled),
  24667. {
  24668. selected: _ctx.itemSelected,
  24669. hover: _ctx.hover
  24670. }
  24671. ]),
  24672. onMouseenter: _cache[0] || (_cache[0] = (...args) => _ctx.hoverItem && _ctx.hoverItem(...args)),
  24673. onClick: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.selectOptionClick && _ctx.selectOptionClick(...args), ["stop"]))
  24674. }, [
  24675. renderSlot(_ctx.$slots, "default", {}, () => [
  24676. createElementVNode("span", null, toDisplayString(_ctx.currentLabel), 1)
  24677. ])
  24678. ], 34)), [
  24679. [vShow, _ctx.visible]
  24680. ]);
  24681. }
  24682. var Option = /* @__PURE__ */ _export_sfc$1(_sfc_main$7, [["render", _sfc_render$3], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option.vue"]]);
  24683. const _sfc_main$6 = defineComponent({
  24684. name: "ElSelectDropdown",
  24685. componentName: "ElSelectDropdown",
  24686. setup() {
  24687. const select = inject(selectKey);
  24688. const ns = useNamespace("select");
  24689. const popperClass = computed$1(() => select.props.popperClass);
  24690. const isMultiple = computed$1(() => select.props.multiple);
  24691. const isFitInputWidth = computed$1(() => select.props.fitInputWidth);
  24692. const minWidth = ref("");
  24693. function updateMinWidth() {
  24694. var _a2;
  24695. minWidth.value = `${(_a2 = select.selectWrapper) == null ? void 0 : _a2.offsetWidth}px`;
  24696. }
  24697. onMounted(() => {
  24698. updateMinWidth();
  24699. useResizeObserver(select.selectWrapper, updateMinWidth);
  24700. });
  24701. return {
  24702. ns,
  24703. minWidth,
  24704. popperClass,
  24705. isMultiple,
  24706. isFitInputWidth
  24707. };
  24708. }
  24709. });
  24710. function _sfc_render$2(_ctx, _cache, $props, $setup, $data, $options) {
  24711. return openBlock(), createElementBlock("div", {
  24712. class: normalizeClass([_ctx.ns.b("dropdown"), _ctx.ns.is("multiple", _ctx.isMultiple), _ctx.popperClass]),
  24713. style: normalizeStyle({ [_ctx.isFitInputWidth ? "width" : "minWidth"]: _ctx.minWidth })
  24714. }, [
  24715. renderSlot(_ctx.$slots, "default")
  24716. ], 6);
  24717. }
  24718. var ElSelectMenu = /* @__PURE__ */ _export_sfc$1(_sfc_main$6, [["render", _sfc_render$2], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select-dropdown.vue"]]);
  24719. function useSelectStates(props) {
  24720. const { t: t2 } = useLocale();
  24721. return reactive({
  24722. options: /* @__PURE__ */ new Map(),
  24723. cachedOptions: /* @__PURE__ */ new Map(),
  24724. createdLabel: null,
  24725. createdSelected: false,
  24726. selected: props.multiple ? [] : {},
  24727. inputLength: 20,
  24728. inputWidth: 0,
  24729. optionsCount: 0,
  24730. filteredOptionsCount: 0,
  24731. visible: false,
  24732. softFocus: false,
  24733. selectedLabel: "",
  24734. hoverIndex: -1,
  24735. query: "",
  24736. previousQuery: null,
  24737. inputHovering: false,
  24738. cachedPlaceHolder: "",
  24739. currentPlaceholder: t2("el.select.placeholder"),
  24740. menuVisibleOnFocus: false,
  24741. isOnComposition: false,
  24742. isSilentBlur: false,
  24743. prefixWidth: 11,
  24744. tagInMultiLine: false,
  24745. mouseEnter: false
  24746. });
  24747. }
  24748. const useSelect = (props, states, ctx) => {
  24749. const { t: t2 } = useLocale();
  24750. const ns = useNamespace("select");
  24751. useDeprecated({
  24752. from: "suffixTransition",
  24753. replacement: "override style scheme",
  24754. version: "2.3.0",
  24755. scope: "props",
  24756. ref: "https://element-plus.org/en-US/component/select.html#select-attributes"
  24757. }, computed$1(() => props.suffixTransition === false));
  24758. const reference = ref(null);
  24759. const input = ref(null);
  24760. const iOSInput = ref(null);
  24761. const tooltipRef = ref(null);
  24762. const tags = ref(null);
  24763. const selectWrapper = ref(null);
  24764. const scrollbar = ref(null);
  24765. const hoverOption = ref(-1);
  24766. const queryChange = shallowRef({ query: "" });
  24767. const groupQueryChange = shallowRef("");
  24768. const optionList = ref([]);
  24769. let originClientHeight = 0;
  24770. const { form, formItem } = useFormItem();
  24771. const readonly2 = computed$1(() => !props.filterable || props.multiple || !states.visible);
  24772. const selectDisabled = computed$1(() => props.disabled || (form == null ? void 0 : form.disabled));
  24773. const showClose = computed$1(() => {
  24774. const hasValue = props.multiple ? Array.isArray(props.modelValue) && props.modelValue.length > 0 : props.modelValue !== void 0 && props.modelValue !== null && props.modelValue !== "";
  24775. const criteria = props.clearable && !selectDisabled.value && states.inputHovering && hasValue;
  24776. return criteria;
  24777. });
  24778. const iconComponent = computed$1(() => props.remote && props.filterable && !props.remoteShowSuffix ? "" : props.suffixIcon);
  24779. const iconReverse = computed$1(() => ns.is("reverse", iconComponent.value && states.visible && props.suffixTransition));
  24780. const debounce$12 = computed$1(() => props.remote ? 300 : 0);
  24781. const emptyText = computed$1(() => {
  24782. if (props.loading) {
  24783. return props.loadingText || t2("el.select.loading");
  24784. } else {
  24785. if (props.remote && states.query === "" && states.options.size === 0)
  24786. return false;
  24787. if (props.filterable && states.query && states.options.size > 0 && states.filteredOptionsCount === 0) {
  24788. return props.noMatchText || t2("el.select.noMatch");
  24789. }
  24790. if (states.options.size === 0) {
  24791. return props.noDataText || t2("el.select.noData");
  24792. }
  24793. }
  24794. return null;
  24795. });
  24796. const optionsArray = computed$1(() => {
  24797. const list = Array.from(states.options.values());
  24798. const newList = [];
  24799. optionList.value.forEach((item) => {
  24800. const index2 = list.findIndex((i2) => i2.currentLabel === item);
  24801. if (index2 > -1) {
  24802. newList.push(list[index2]);
  24803. }
  24804. });
  24805. return newList.length ? newList : list;
  24806. });
  24807. const cachedOptionsArray = computed$1(() => Array.from(states.cachedOptions.values()));
  24808. const showNewOption = computed$1(() => {
  24809. const hasExistingOption = optionsArray.value.filter((option) => {
  24810. return !option.created;
  24811. }).some((option) => {
  24812. return option.currentLabel === states.query;
  24813. });
  24814. return props.filterable && props.allowCreate && states.query !== "" && !hasExistingOption;
  24815. });
  24816. const selectSize = useFormSize();
  24817. const collapseTagSize = computed$1(() => ["small"].includes(selectSize.value) ? "small" : "default");
  24818. const dropMenuVisible = computed$1({
  24819. get() {
  24820. return states.visible && emptyText.value !== false;
  24821. },
  24822. set(val) {
  24823. states.visible = val;
  24824. }
  24825. });
  24826. watch([() => selectDisabled.value, () => selectSize.value, () => form == null ? void 0 : form.size], () => {
  24827. nextTick(() => {
  24828. resetInputHeight();
  24829. });
  24830. });
  24831. watch(() => props.placeholder, (val) => {
  24832. states.cachedPlaceHolder = states.currentPlaceholder = val;
  24833. });
  24834. watch(() => props.modelValue, (val, oldVal) => {
  24835. if (props.multiple) {
  24836. resetInputHeight();
  24837. if (val && val.length > 0 || input.value && states.query !== "") {
  24838. states.currentPlaceholder = "";
  24839. } else {
  24840. states.currentPlaceholder = states.cachedPlaceHolder;
  24841. }
  24842. if (props.filterable && !props.reserveKeyword) {
  24843. states.query = "";
  24844. handleQueryChange(states.query);
  24845. }
  24846. }
  24847. setSelected();
  24848. if (props.filterable && !props.multiple) {
  24849. states.inputLength = 20;
  24850. }
  24851. if (!isEqual(val, oldVal) && props.validateEvent) {
  24852. formItem == null ? void 0 : formItem.validate("change").catch((err) => debugWarn());
  24853. }
  24854. }, {
  24855. flush: "post",
  24856. deep: true
  24857. });
  24858. watch(() => states.visible, (val) => {
  24859. var _a2, _b, _c, _d, _e;
  24860. if (!val) {
  24861. if (props.filterable) {
  24862. if (isFunction$3(props.filterMethod)) {
  24863. props.filterMethod("");
  24864. }
  24865. if (isFunction$3(props.remoteMethod)) {
  24866. props.remoteMethod("");
  24867. }
  24868. }
  24869. input.value && input.value.blur();
  24870. states.query = "";
  24871. states.previousQuery = null;
  24872. states.selectedLabel = "";
  24873. states.inputLength = 20;
  24874. states.menuVisibleOnFocus = false;
  24875. resetHoverIndex();
  24876. nextTick(() => {
  24877. if (input.value && input.value.value === "" && states.selected.length === 0) {
  24878. states.currentPlaceholder = states.cachedPlaceHolder;
  24879. }
  24880. });
  24881. if (!props.multiple) {
  24882. if (states.selected) {
  24883. if (props.filterable && props.allowCreate && states.createdSelected && states.createdLabel) {
  24884. states.selectedLabel = states.createdLabel;
  24885. } else {
  24886. states.selectedLabel = states.selected.currentLabel;
  24887. }
  24888. if (props.filterable)
  24889. states.query = states.selectedLabel;
  24890. }
  24891. if (props.filterable) {
  24892. states.currentPlaceholder = states.cachedPlaceHolder;
  24893. }
  24894. }
  24895. } else {
  24896. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  24897. if (props.filterable) {
  24898. states.filteredOptionsCount = states.optionsCount;
  24899. states.query = props.remote ? "" : states.selectedLabel;
  24900. (_d = (_c = iOSInput.value) == null ? void 0 : _c.focus) == null ? void 0 : _d.call(_c);
  24901. if (props.multiple) {
  24902. (_e = input.value) == null ? void 0 : _e.focus();
  24903. } else {
  24904. if (states.selectedLabel) {
  24905. states.currentPlaceholder = `${states.selectedLabel}`;
  24906. states.selectedLabel = "";
  24907. }
  24908. }
  24909. handleQueryChange(states.query);
  24910. if (!props.multiple && !props.remote) {
  24911. queryChange.value.query = "";
  24912. triggerRef(queryChange);
  24913. triggerRef(groupQueryChange);
  24914. }
  24915. }
  24916. }
  24917. ctx.emit("visible-change", val);
  24918. });
  24919. watch(() => states.options.entries(), () => {
  24920. var _a2, _b, _c;
  24921. if (!isClient)
  24922. return;
  24923. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  24924. if (props.multiple) {
  24925. resetInputHeight();
  24926. }
  24927. const inputs = ((_c = selectWrapper.value) == null ? void 0 : _c.querySelectorAll("input")) || [];
  24928. if (!Array.from(inputs).includes(document.activeElement)) {
  24929. setSelected();
  24930. }
  24931. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  24932. checkDefaultFirstOption();
  24933. }
  24934. }, {
  24935. flush: "post"
  24936. });
  24937. watch(() => states.hoverIndex, (val) => {
  24938. if (isNumber(val) && val > -1) {
  24939. hoverOption.value = optionsArray.value[val] || {};
  24940. } else {
  24941. hoverOption.value = {};
  24942. }
  24943. optionsArray.value.forEach((option) => {
  24944. option.hover = hoverOption.value === option;
  24945. });
  24946. });
  24947. const resetInputHeight = () => {
  24948. nextTick(() => {
  24949. var _a2, _b;
  24950. if (!reference.value)
  24951. return;
  24952. const input2 = reference.value.$el.querySelector("input");
  24953. originClientHeight = originClientHeight || (input2.clientHeight > 0 ? input2.clientHeight + 2 : 0);
  24954. const _tags = tags.value;
  24955. const gotSize = getComponentSize(selectSize.value || (form == null ? void 0 : form.size));
  24956. const sizeInMap = selectSize.value || gotSize === originClientHeight || originClientHeight <= 0 ? gotSize : originClientHeight;
  24957. const isElHidden = input2.offsetParent === null;
  24958. !isElHidden && (input2.style.height = `${(states.selected.length === 0 ? sizeInMap : Math.max(_tags ? _tags.clientHeight + (_tags.clientHeight > sizeInMap ? 6 : 0) : 0, sizeInMap)) - 2}px`);
  24959. states.tagInMultiLine = Number.parseFloat(input2.style.height) >= sizeInMap;
  24960. if (states.visible && emptyText.value !== false) {
  24961. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  24962. }
  24963. });
  24964. };
  24965. const handleQueryChange = async (val) => {
  24966. if (states.previousQuery === val || states.isOnComposition)
  24967. return;
  24968. if (states.previousQuery === null && (isFunction$3(props.filterMethod) || isFunction$3(props.remoteMethod))) {
  24969. states.previousQuery = val;
  24970. return;
  24971. }
  24972. states.previousQuery = val;
  24973. nextTick(() => {
  24974. var _a2, _b;
  24975. if (states.visible)
  24976. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  24977. });
  24978. states.hoverIndex = -1;
  24979. if (props.multiple && props.filterable) {
  24980. nextTick(() => {
  24981. const length = input.value.value.length * 15 + 20;
  24982. states.inputLength = props.collapseTags ? Math.min(50, length) : length;
  24983. managePlaceholder();
  24984. resetInputHeight();
  24985. });
  24986. }
  24987. if (props.remote && isFunction$3(props.remoteMethod)) {
  24988. states.hoverIndex = -1;
  24989. props.remoteMethod(val);
  24990. } else if (isFunction$3(props.filterMethod)) {
  24991. props.filterMethod(val);
  24992. triggerRef(groupQueryChange);
  24993. } else {
  24994. states.filteredOptionsCount = states.optionsCount;
  24995. queryChange.value.query = val;
  24996. triggerRef(queryChange);
  24997. triggerRef(groupQueryChange);
  24998. }
  24999. if (props.defaultFirstOption && (props.filterable || props.remote) && states.filteredOptionsCount) {
  25000. await nextTick();
  25001. checkDefaultFirstOption();
  25002. }
  25003. };
  25004. const managePlaceholder = () => {
  25005. if (states.currentPlaceholder !== "") {
  25006. states.currentPlaceholder = input.value.value ? "" : states.cachedPlaceHolder;
  25007. }
  25008. };
  25009. const checkDefaultFirstOption = () => {
  25010. const optionsInDropdown = optionsArray.value.filter((n) => n.visible && !n.disabled && !n.states.groupDisabled);
  25011. const userCreatedOption = optionsInDropdown.find((n) => n.created);
  25012. const firstOriginOption = optionsInDropdown[0];
  25013. states.hoverIndex = getValueIndex(optionsArray.value, userCreatedOption || firstOriginOption);
  25014. };
  25015. const setSelected = () => {
  25016. var _a2;
  25017. if (!props.multiple) {
  25018. const option = getOption(props.modelValue);
  25019. if ((_a2 = option.props) == null ? void 0 : _a2.created) {
  25020. states.createdLabel = option.props.value;
  25021. states.createdSelected = true;
  25022. } else {
  25023. states.createdSelected = false;
  25024. }
  25025. states.selectedLabel = option.currentLabel;
  25026. states.selected = option;
  25027. if (props.filterable)
  25028. states.query = states.selectedLabel;
  25029. return;
  25030. } else {
  25031. states.selectedLabel = "";
  25032. }
  25033. const result = [];
  25034. if (Array.isArray(props.modelValue)) {
  25035. props.modelValue.forEach((value) => {
  25036. result.push(getOption(value));
  25037. });
  25038. }
  25039. states.selected = result;
  25040. nextTick(() => {
  25041. resetInputHeight();
  25042. });
  25043. };
  25044. const getOption = (value) => {
  25045. let option;
  25046. const isObjectValue = toRawType(value).toLowerCase() === "object";
  25047. const isNull = toRawType(value).toLowerCase() === "null";
  25048. const isUndefined2 = toRawType(value).toLowerCase() === "undefined";
  25049. for (let i2 = states.cachedOptions.size - 1; i2 >= 0; i2--) {
  25050. const cachedOption = cachedOptionsArray.value[i2];
  25051. const isEqualValue = isObjectValue ? get$2(cachedOption.value, props.valueKey) === get$2(value, props.valueKey) : cachedOption.value === value;
  25052. if (isEqualValue) {
  25053. option = {
  25054. value,
  25055. currentLabel: cachedOption.currentLabel,
  25056. isDisabled: cachedOption.isDisabled
  25057. };
  25058. break;
  25059. }
  25060. }
  25061. if (option)
  25062. return option;
  25063. const label = isObjectValue ? value.label : !isNull && !isUndefined2 ? value : "";
  25064. const newOption = {
  25065. value,
  25066. currentLabel: label
  25067. };
  25068. if (props.multiple) {
  25069. newOption.hitState = false;
  25070. }
  25071. return newOption;
  25072. };
  25073. const resetHoverIndex = () => {
  25074. setTimeout(() => {
  25075. const valueKey = props.valueKey;
  25076. if (!props.multiple) {
  25077. states.hoverIndex = optionsArray.value.findIndex((item) => {
  25078. return getValueKey(item) === getValueKey(states.selected);
  25079. });
  25080. } else {
  25081. if (states.selected.length > 0) {
  25082. states.hoverIndex = Math.min.apply(null, states.selected.map((selected) => {
  25083. return optionsArray.value.findIndex((item) => {
  25084. return get$2(item, valueKey) === get$2(selected, valueKey);
  25085. });
  25086. }));
  25087. } else {
  25088. states.hoverIndex = -1;
  25089. }
  25090. }
  25091. }, 300);
  25092. };
  25093. const handleResize = () => {
  25094. var _a2, _b;
  25095. resetInputWidth();
  25096. (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.updatePopper) == null ? void 0 : _b.call(_a2);
  25097. if (props.multiple)
  25098. resetInputHeight();
  25099. };
  25100. const resetInputWidth = () => {
  25101. var _a2;
  25102. states.inputWidth = (_a2 = reference.value) == null ? void 0 : _a2.$el.offsetWidth;
  25103. };
  25104. const onInputChange = () => {
  25105. if (props.filterable && states.query !== states.selectedLabel) {
  25106. states.query = states.selectedLabel;
  25107. handleQueryChange(states.query);
  25108. }
  25109. };
  25110. const debouncedOnInputChange = debounce$2(() => {
  25111. onInputChange();
  25112. }, debounce$12.value);
  25113. const debouncedQueryChange = debounce$2((e) => {
  25114. handleQueryChange(e.target.value);
  25115. }, debounce$12.value);
  25116. const emitChange = (val) => {
  25117. if (!isEqual(props.modelValue, val)) {
  25118. ctx.emit(CHANGE_EVENT, val);
  25119. }
  25120. };
  25121. const deletePrevTag = (e) => {
  25122. if (e.code === EVENT_CODE.delete)
  25123. return;
  25124. if (e.target.value.length <= 0 && !toggleLastOptionHitState()) {
  25125. const value = props.modelValue.slice();
  25126. value.pop();
  25127. ctx.emit(UPDATE_MODEL_EVENT, value);
  25128. emitChange(value);
  25129. }
  25130. if (e.target.value.length === 1 && props.modelValue.length === 0) {
  25131. states.currentPlaceholder = states.cachedPlaceHolder;
  25132. }
  25133. };
  25134. const deleteTag = (event2, tag) => {
  25135. const index2 = states.selected.indexOf(tag);
  25136. if (index2 > -1 && !selectDisabled.value) {
  25137. const value = props.modelValue.slice();
  25138. value.splice(index2, 1);
  25139. ctx.emit(UPDATE_MODEL_EVENT, value);
  25140. emitChange(value);
  25141. ctx.emit("remove-tag", tag.value);
  25142. }
  25143. event2.stopPropagation();
  25144. };
  25145. const deleteSelected = (event2) => {
  25146. event2.stopPropagation();
  25147. const value = props.multiple ? [] : "";
  25148. if (!isString(value)) {
  25149. for (const item of states.selected) {
  25150. if (item.isDisabled)
  25151. value.push(item.value);
  25152. }
  25153. }
  25154. ctx.emit(UPDATE_MODEL_EVENT, value);
  25155. emitChange(value);
  25156. states.hoverIndex = -1;
  25157. states.visible = false;
  25158. ctx.emit("clear");
  25159. };
  25160. const handleOptionSelect = (option, byClick) => {
  25161. var _a2;
  25162. if (props.multiple) {
  25163. const value = (props.modelValue || []).slice();
  25164. const optionIndex = getValueIndex(value, option.value);
  25165. if (optionIndex > -1) {
  25166. value.splice(optionIndex, 1);
  25167. } else if (props.multipleLimit <= 0 || value.length < props.multipleLimit) {
  25168. value.push(option.value);
  25169. }
  25170. ctx.emit(UPDATE_MODEL_EVENT, value);
  25171. emitChange(value);
  25172. if (option.created) {
  25173. states.query = "";
  25174. handleQueryChange("");
  25175. states.inputLength = 20;
  25176. }
  25177. if (props.filterable)
  25178. (_a2 = input.value) == null ? void 0 : _a2.focus();
  25179. } else {
  25180. ctx.emit(UPDATE_MODEL_EVENT, option.value);
  25181. emitChange(option.value);
  25182. states.visible = false;
  25183. }
  25184. states.isSilentBlur = byClick;
  25185. setSoftFocus();
  25186. if (states.visible)
  25187. return;
  25188. nextTick(() => {
  25189. scrollToOption(option);
  25190. });
  25191. };
  25192. const getValueIndex = (arr = [], value) => {
  25193. if (!isObject$5(value))
  25194. return arr.indexOf(value);
  25195. const valueKey = props.valueKey;
  25196. let index2 = -1;
  25197. arr.some((item, i2) => {
  25198. if (toRaw$1(get$2(item, valueKey)) === get$2(value, valueKey)) {
  25199. index2 = i2;
  25200. return true;
  25201. }
  25202. return false;
  25203. });
  25204. return index2;
  25205. };
  25206. const setSoftFocus = () => {
  25207. states.softFocus = true;
  25208. const _input = input.value || reference.value;
  25209. if (_input) {
  25210. _input == null ? void 0 : _input.focus();
  25211. }
  25212. };
  25213. const scrollToOption = (option) => {
  25214. var _a2, _b, _c, _d, _e;
  25215. const targetOption = Array.isArray(option) ? option[0] : option;
  25216. let target = null;
  25217. if (targetOption == null ? void 0 : targetOption.value) {
  25218. const options2 = optionsArray.value.filter((item) => item.value === targetOption.value);
  25219. if (options2.length > 0) {
  25220. target = options2[0].$el;
  25221. }
  25222. }
  25223. if (tooltipRef.value && target) {
  25224. const menu = (_d = (_c = (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef) == null ? void 0 : _c.querySelector) == null ? void 0 : _d.call(_c, `.${ns.be("dropdown", "wrap")}`);
  25225. if (menu) {
  25226. scrollIntoView(menu, target);
  25227. }
  25228. }
  25229. (_e = scrollbar.value) == null ? void 0 : _e.handleScroll();
  25230. };
  25231. const onOptionCreate = (vm) => {
  25232. states.optionsCount++;
  25233. states.filteredOptionsCount++;
  25234. states.options.set(vm.value, vm);
  25235. states.cachedOptions.set(vm.value, vm);
  25236. };
  25237. const onOptionDestroy = (key, vm) => {
  25238. if (states.options.get(key) === vm) {
  25239. states.optionsCount--;
  25240. states.filteredOptionsCount--;
  25241. states.options.delete(key);
  25242. }
  25243. };
  25244. const resetInputState = (e) => {
  25245. if (e.code !== EVENT_CODE.backspace)
  25246. toggleLastOptionHitState(false);
  25247. states.inputLength = input.value.value.length * 15 + 20;
  25248. resetInputHeight();
  25249. };
  25250. const toggleLastOptionHitState = (hit) => {
  25251. if (!Array.isArray(states.selected))
  25252. return;
  25253. const option = states.selected[states.selected.length - 1];
  25254. if (!option)
  25255. return;
  25256. if (hit === true || hit === false) {
  25257. option.hitState = hit;
  25258. return hit;
  25259. }
  25260. option.hitState = !option.hitState;
  25261. return option.hitState;
  25262. };
  25263. const handleComposition = (event2) => {
  25264. const text = event2.target.value;
  25265. if (event2.type === "compositionend") {
  25266. states.isOnComposition = false;
  25267. nextTick(() => handleQueryChange(text));
  25268. } else {
  25269. const lastCharacter = text[text.length - 1] || "";
  25270. states.isOnComposition = !isKorean(lastCharacter);
  25271. }
  25272. };
  25273. const handleMenuEnter = () => {
  25274. nextTick(() => scrollToOption(states.selected));
  25275. };
  25276. const handleFocus = (event2) => {
  25277. if (!states.softFocus) {
  25278. if (props.automaticDropdown || props.filterable) {
  25279. if (props.filterable && !states.visible) {
  25280. states.menuVisibleOnFocus = true;
  25281. }
  25282. states.visible = true;
  25283. }
  25284. ctx.emit("focus", event2);
  25285. } else {
  25286. states.softFocus = false;
  25287. }
  25288. };
  25289. const blur = () => {
  25290. var _a2, _b, _c;
  25291. states.visible = false;
  25292. (_a2 = reference.value) == null ? void 0 : _a2.blur();
  25293. (_c = (_b = iOSInput.value) == null ? void 0 : _b.blur) == null ? void 0 : _c.call(_b);
  25294. };
  25295. const handleBlur = (event2) => {
  25296. nextTick(() => {
  25297. if (states.isSilentBlur) {
  25298. states.isSilentBlur = false;
  25299. } else {
  25300. ctx.emit("blur", event2);
  25301. }
  25302. });
  25303. states.softFocus = false;
  25304. };
  25305. const handleClearClick = (event2) => {
  25306. deleteSelected(event2);
  25307. };
  25308. const handleClose = () => {
  25309. states.visible = false;
  25310. };
  25311. const handleKeydownEscape = (event2) => {
  25312. if (states.visible) {
  25313. event2.preventDefault();
  25314. event2.stopPropagation();
  25315. states.visible = false;
  25316. }
  25317. };
  25318. const toggleMenu = (e) => {
  25319. var _a2;
  25320. if (e && !states.mouseEnter) {
  25321. return;
  25322. }
  25323. if (!selectDisabled.value) {
  25324. if (states.menuVisibleOnFocus) {
  25325. states.menuVisibleOnFocus = false;
  25326. } else {
  25327. if (!tooltipRef.value || !tooltipRef.value.isFocusInsideContent()) {
  25328. states.visible = !states.visible;
  25329. }
  25330. }
  25331. if (states.visible) {
  25332. (_a2 = input.value || reference.value) == null ? void 0 : _a2.focus();
  25333. }
  25334. }
  25335. };
  25336. const selectOption = () => {
  25337. if (!states.visible) {
  25338. toggleMenu();
  25339. } else {
  25340. if (optionsArray.value[states.hoverIndex]) {
  25341. handleOptionSelect(optionsArray.value[states.hoverIndex], void 0);
  25342. }
  25343. }
  25344. };
  25345. const getValueKey = (item) => {
  25346. return isObject$5(item.value) ? get$2(item.value, props.valueKey) : item.value;
  25347. };
  25348. const optionsAllDisabled = computed$1(() => optionsArray.value.filter((option) => option.visible).every((option) => option.disabled));
  25349. const showTagList = computed$1(() => states.selected.slice(0, props.maxCollapseTags));
  25350. const collapseTagList = computed$1(() => states.selected.slice(props.maxCollapseTags));
  25351. const navigateOptions = (direction) => {
  25352. if (!states.visible) {
  25353. states.visible = true;
  25354. return;
  25355. }
  25356. if (states.options.size === 0 || states.filteredOptionsCount === 0)
  25357. return;
  25358. if (states.isOnComposition)
  25359. return;
  25360. if (!optionsAllDisabled.value) {
  25361. if (direction === "next") {
  25362. states.hoverIndex++;
  25363. if (states.hoverIndex === states.options.size) {
  25364. states.hoverIndex = 0;
  25365. }
  25366. } else if (direction === "prev") {
  25367. states.hoverIndex--;
  25368. if (states.hoverIndex < 0) {
  25369. states.hoverIndex = states.options.size - 1;
  25370. }
  25371. }
  25372. const option = optionsArray.value[states.hoverIndex];
  25373. if (option.disabled === true || option.states.groupDisabled === true || !option.visible) {
  25374. navigateOptions(direction);
  25375. }
  25376. nextTick(() => scrollToOption(hoverOption.value));
  25377. }
  25378. };
  25379. const handleMouseEnter = () => {
  25380. states.mouseEnter = true;
  25381. };
  25382. const handleMouseLeave = () => {
  25383. states.mouseEnter = false;
  25384. };
  25385. return {
  25386. optionList,
  25387. optionsArray,
  25388. selectSize,
  25389. handleResize,
  25390. debouncedOnInputChange,
  25391. debouncedQueryChange,
  25392. deletePrevTag,
  25393. deleteTag,
  25394. deleteSelected,
  25395. handleOptionSelect,
  25396. scrollToOption,
  25397. readonly: readonly2,
  25398. resetInputHeight,
  25399. showClose,
  25400. iconComponent,
  25401. iconReverse,
  25402. showNewOption,
  25403. collapseTagSize,
  25404. setSelected,
  25405. managePlaceholder,
  25406. selectDisabled,
  25407. emptyText,
  25408. toggleLastOptionHitState,
  25409. resetInputState,
  25410. handleComposition,
  25411. onOptionCreate,
  25412. onOptionDestroy,
  25413. handleMenuEnter,
  25414. handleFocus,
  25415. blur,
  25416. handleBlur,
  25417. handleClearClick,
  25418. handleClose,
  25419. handleKeydownEscape,
  25420. toggleMenu,
  25421. selectOption,
  25422. getValueKey,
  25423. navigateOptions,
  25424. dropMenuVisible,
  25425. queryChange,
  25426. groupQueryChange,
  25427. showTagList,
  25428. collapseTagList,
  25429. reference,
  25430. input,
  25431. iOSInput,
  25432. tooltipRef,
  25433. tags,
  25434. selectWrapper,
  25435. scrollbar,
  25436. handleMouseEnter,
  25437. handleMouseLeave
  25438. };
  25439. };
  25440. var ElOptions = defineComponent({
  25441. name: "ElOptions",
  25442. emits: ["update-options"],
  25443. setup(_, { slots, emit }) {
  25444. let cachedOptions = [];
  25445. function isSameOptions(a, b) {
  25446. if (a.length !== b.length)
  25447. return false;
  25448. for (const [index2] of a.entries()) {
  25449. if (a[index2] != b[index2]) {
  25450. return false;
  25451. }
  25452. }
  25453. return true;
  25454. }
  25455. return () => {
  25456. var _a2, _b;
  25457. const children = (_a2 = slots.default) == null ? void 0 : _a2.call(slots);
  25458. const filteredOptions = [];
  25459. function filterOptions(children2) {
  25460. if (!Array.isArray(children2))
  25461. return;
  25462. children2.forEach((item) => {
  25463. var _a22, _b2, _c, _d;
  25464. const name = (_a22 = (item == null ? void 0 : item.type) || {}) == null ? void 0 : _a22.name;
  25465. if (name === "ElOptionGroup") {
  25466. filterOptions(!isString(item.children) && !Array.isArray(item.children) && isFunction$3((_b2 = item.children) == null ? void 0 : _b2.default) ? (_c = item.children) == null ? void 0 : _c.default() : item.children);
  25467. } else if (name === "ElOption") {
  25468. filteredOptions.push((_d = item.props) == null ? void 0 : _d.label);
  25469. } else if (Array.isArray(item.children)) {
  25470. filterOptions(item.children);
  25471. }
  25472. });
  25473. }
  25474. if (children.length) {
  25475. filterOptions((_b = children[0]) == null ? void 0 : _b.children);
  25476. }
  25477. if (!isSameOptions(filteredOptions, cachedOptions)) {
  25478. cachedOptions = filteredOptions;
  25479. emit("update-options", filteredOptions);
  25480. }
  25481. return children;
  25482. };
  25483. }
  25484. });
  25485. const COMPONENT_NAME$1 = "ElSelect";
  25486. const _sfc_main$5 = defineComponent({
  25487. name: COMPONENT_NAME$1,
  25488. componentName: COMPONENT_NAME$1,
  25489. components: {
  25490. ElInput,
  25491. ElSelectMenu,
  25492. ElOption: Option,
  25493. ElOptions,
  25494. ElTag,
  25495. ElScrollbar,
  25496. ElTooltip,
  25497. ElIcon
  25498. },
  25499. directives: { ClickOutside },
  25500. props: {
  25501. name: String,
  25502. id: String,
  25503. modelValue: {
  25504. type: [Array, String, Number, Boolean, Object],
  25505. default: void 0
  25506. },
  25507. autocomplete: {
  25508. type: String,
  25509. default: "off"
  25510. },
  25511. automaticDropdown: Boolean,
  25512. size: {
  25513. type: String,
  25514. validator: isValidComponentSize
  25515. },
  25516. effect: {
  25517. type: String,
  25518. default: "light"
  25519. },
  25520. disabled: Boolean,
  25521. clearable: Boolean,
  25522. filterable: Boolean,
  25523. allowCreate: Boolean,
  25524. loading: Boolean,
  25525. popperClass: {
  25526. type: String,
  25527. default: ""
  25528. },
  25529. popperOptions: {
  25530. type: Object,
  25531. default: () => ({})
  25532. },
  25533. remote: Boolean,
  25534. loadingText: String,
  25535. noMatchText: String,
  25536. noDataText: String,
  25537. remoteMethod: Function,
  25538. filterMethod: Function,
  25539. multiple: Boolean,
  25540. multipleLimit: {
  25541. type: Number,
  25542. default: 0
  25543. },
  25544. placeholder: {
  25545. type: String
  25546. },
  25547. defaultFirstOption: Boolean,
  25548. reserveKeyword: {
  25549. type: Boolean,
  25550. default: true
  25551. },
  25552. valueKey: {
  25553. type: String,
  25554. default: "value"
  25555. },
  25556. collapseTags: Boolean,
  25557. collapseTagsTooltip: {
  25558. type: Boolean,
  25559. default: false
  25560. },
  25561. maxCollapseTags: {
  25562. type: Number,
  25563. default: 1
  25564. },
  25565. teleported: useTooltipContentProps.teleported,
  25566. persistent: {
  25567. type: Boolean,
  25568. default: true
  25569. },
  25570. clearIcon: {
  25571. type: iconPropType,
  25572. default: circle_close_default
  25573. },
  25574. fitInputWidth: {
  25575. type: Boolean,
  25576. default: false
  25577. },
  25578. suffixIcon: {
  25579. type: iconPropType,
  25580. default: arrow_down_default
  25581. },
  25582. tagType: { ...tagProps.type, default: "info" },
  25583. validateEvent: {
  25584. type: Boolean,
  25585. default: true
  25586. },
  25587. remoteShowSuffix: {
  25588. type: Boolean,
  25589. default: false
  25590. },
  25591. suffixTransition: {
  25592. type: Boolean,
  25593. default: true
  25594. },
  25595. placement: {
  25596. type: String,
  25597. values: Ee,
  25598. default: "bottom-start"
  25599. }
  25600. },
  25601. emits: [
  25602. UPDATE_MODEL_EVENT,
  25603. CHANGE_EVENT,
  25604. "remove-tag",
  25605. "clear",
  25606. "visible-change",
  25607. "focus",
  25608. "blur"
  25609. ],
  25610. setup(props, ctx) {
  25611. const nsSelect = useNamespace("select");
  25612. const nsInput = useNamespace("input");
  25613. const { t: t2 } = useLocale();
  25614. const states = useSelectStates(props);
  25615. const {
  25616. optionList,
  25617. optionsArray,
  25618. selectSize,
  25619. readonly: readonly2,
  25620. handleResize,
  25621. collapseTagSize,
  25622. debouncedOnInputChange,
  25623. debouncedQueryChange,
  25624. deletePrevTag,
  25625. deleteTag,
  25626. deleteSelected,
  25627. handleOptionSelect,
  25628. scrollToOption,
  25629. setSelected,
  25630. resetInputHeight,
  25631. managePlaceholder,
  25632. showClose,
  25633. selectDisabled,
  25634. iconComponent,
  25635. iconReverse,
  25636. showNewOption,
  25637. emptyText,
  25638. toggleLastOptionHitState,
  25639. resetInputState,
  25640. handleComposition,
  25641. onOptionCreate,
  25642. onOptionDestroy,
  25643. handleMenuEnter,
  25644. handleFocus,
  25645. blur,
  25646. handleBlur,
  25647. handleClearClick,
  25648. handleClose,
  25649. handleKeydownEscape,
  25650. toggleMenu,
  25651. selectOption,
  25652. getValueKey,
  25653. navigateOptions,
  25654. dropMenuVisible,
  25655. reference,
  25656. input,
  25657. iOSInput,
  25658. tooltipRef,
  25659. tags,
  25660. selectWrapper,
  25661. scrollbar,
  25662. queryChange,
  25663. groupQueryChange,
  25664. handleMouseEnter,
  25665. handleMouseLeave,
  25666. showTagList,
  25667. collapseTagList
  25668. } = useSelect(props, states, ctx);
  25669. const { focus } = useFocus(reference);
  25670. const {
  25671. inputWidth,
  25672. selected,
  25673. inputLength,
  25674. filteredOptionsCount,
  25675. visible,
  25676. softFocus,
  25677. selectedLabel,
  25678. hoverIndex,
  25679. query,
  25680. inputHovering,
  25681. currentPlaceholder,
  25682. menuVisibleOnFocus,
  25683. isOnComposition,
  25684. isSilentBlur,
  25685. options: options2,
  25686. cachedOptions,
  25687. optionsCount,
  25688. prefixWidth,
  25689. tagInMultiLine
  25690. } = toRefs(states);
  25691. const wrapperKls = computed$1(() => {
  25692. const classList = [nsSelect.b()];
  25693. const _selectSize = unref(selectSize);
  25694. if (_selectSize) {
  25695. classList.push(nsSelect.m(_selectSize));
  25696. }
  25697. if (props.disabled) {
  25698. classList.push(nsSelect.m("disabled"));
  25699. }
  25700. return classList;
  25701. });
  25702. const selectTagsStyle = computed$1(() => ({
  25703. maxWidth: `${unref(inputWidth) - 32}px`,
  25704. width: "100%"
  25705. }));
  25706. const tagTextStyle = computed$1(() => {
  25707. const maxWidth = unref(inputWidth) > 123 ? unref(inputWidth) - 123 : unref(inputWidth) - 75;
  25708. return { maxWidth: `${maxWidth}px` };
  25709. });
  25710. provide(selectKey, reactive({
  25711. props,
  25712. options: options2,
  25713. optionsArray,
  25714. cachedOptions,
  25715. optionsCount,
  25716. filteredOptionsCount,
  25717. hoverIndex,
  25718. handleOptionSelect,
  25719. onOptionCreate,
  25720. onOptionDestroy,
  25721. selectWrapper,
  25722. selected,
  25723. setSelected,
  25724. queryChange,
  25725. groupQueryChange
  25726. }));
  25727. onMounted(() => {
  25728. states.cachedPlaceHolder = currentPlaceholder.value = props.placeholder || (() => t2("el.select.placeholder"));
  25729. if (props.multiple && Array.isArray(props.modelValue) && props.modelValue.length > 0) {
  25730. currentPlaceholder.value = "";
  25731. }
  25732. useResizeObserver(selectWrapper, handleResize);
  25733. if (props.remote && props.multiple) {
  25734. resetInputHeight();
  25735. }
  25736. nextTick(() => {
  25737. const refEl = reference.value && reference.value.$el;
  25738. if (!refEl)
  25739. return;
  25740. inputWidth.value = refEl.getBoundingClientRect().width;
  25741. if (ctx.slots.prefix) {
  25742. const prefix = refEl.querySelector(`.${nsInput.e("prefix")}`);
  25743. prefixWidth.value = Math.max(prefix.getBoundingClientRect().width + 5, 30);
  25744. }
  25745. });
  25746. setSelected();
  25747. });
  25748. if (props.multiple && !Array.isArray(props.modelValue)) {
  25749. ctx.emit(UPDATE_MODEL_EVENT, []);
  25750. }
  25751. if (!props.multiple && Array.isArray(props.modelValue)) {
  25752. ctx.emit(UPDATE_MODEL_EVENT, "");
  25753. }
  25754. const popperPaneRef = computed$1(() => {
  25755. var _a2, _b;
  25756. return (_b = (_a2 = tooltipRef.value) == null ? void 0 : _a2.popperRef) == null ? void 0 : _b.contentRef;
  25757. });
  25758. const onOptionsRendered = (v) => {
  25759. optionList.value = v;
  25760. };
  25761. return {
  25762. isIOS,
  25763. onOptionsRendered,
  25764. tagInMultiLine,
  25765. prefixWidth,
  25766. selectSize,
  25767. readonly: readonly2,
  25768. handleResize,
  25769. collapseTagSize,
  25770. debouncedOnInputChange,
  25771. debouncedQueryChange,
  25772. deletePrevTag,
  25773. deleteTag,
  25774. deleteSelected,
  25775. handleOptionSelect,
  25776. scrollToOption,
  25777. inputWidth,
  25778. selected,
  25779. inputLength,
  25780. filteredOptionsCount,
  25781. visible,
  25782. softFocus,
  25783. selectedLabel,
  25784. hoverIndex,
  25785. query,
  25786. inputHovering,
  25787. currentPlaceholder,
  25788. menuVisibleOnFocus,
  25789. isOnComposition,
  25790. isSilentBlur,
  25791. options: options2,
  25792. resetInputHeight,
  25793. managePlaceholder,
  25794. showClose,
  25795. selectDisabled,
  25796. iconComponent,
  25797. iconReverse,
  25798. showNewOption,
  25799. emptyText,
  25800. toggleLastOptionHitState,
  25801. resetInputState,
  25802. handleComposition,
  25803. handleMenuEnter,
  25804. handleFocus,
  25805. blur,
  25806. handleBlur,
  25807. handleClearClick,
  25808. handleClose,
  25809. handleKeydownEscape,
  25810. toggleMenu,
  25811. selectOption,
  25812. getValueKey,
  25813. navigateOptions,
  25814. dropMenuVisible,
  25815. focus,
  25816. reference,
  25817. input,
  25818. iOSInput,
  25819. tooltipRef,
  25820. popperPaneRef,
  25821. tags,
  25822. selectWrapper,
  25823. scrollbar,
  25824. wrapperKls,
  25825. selectTagsStyle,
  25826. nsSelect,
  25827. tagTextStyle,
  25828. handleMouseEnter,
  25829. handleMouseLeave,
  25830. showTagList,
  25831. collapseTagList
  25832. };
  25833. }
  25834. });
  25835. const _hoisted_1$4 = ["disabled", "autocomplete"];
  25836. const _hoisted_2$4 = ["disabled"];
  25837. const _hoisted_3$4 = { style: { "height": "100%", "display": "flex", "justify-content": "center", "align-items": "center" } };
  25838. function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
  25839. const _component_el_tag = resolveComponent("el-tag");
  25840. const _component_el_tooltip = resolveComponent("el-tooltip");
  25841. const _component_el_icon = resolveComponent("el-icon");
  25842. const _component_el_input = resolveComponent("el-input");
  25843. const _component_el_option = resolveComponent("el-option");
  25844. const _component_el_options = resolveComponent("el-options");
  25845. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  25846. const _component_el_select_menu = resolveComponent("el-select-menu");
  25847. const _directive_click_outside = resolveDirective("click-outside");
  25848. return withDirectives((openBlock(), createElementBlock("div", {
  25849. ref: "selectWrapper",
  25850. class: normalizeClass(_ctx.wrapperKls),
  25851. onMouseenter: _cache[21] || (_cache[21] = (...args) => _ctx.handleMouseEnter && _ctx.handleMouseEnter(...args)),
  25852. onMouseleave: _cache[22] || (_cache[22] = (...args) => _ctx.handleMouseLeave && _ctx.handleMouseLeave(...args)),
  25853. onClick: _cache[23] || (_cache[23] = withModifiers((...args) => _ctx.toggleMenu && _ctx.toggleMenu(...args), ["stop"]))
  25854. }, [
  25855. createVNode(_component_el_tooltip, {
  25856. ref: "tooltipRef",
  25857. visible: _ctx.dropMenuVisible,
  25858. placement: _ctx.placement,
  25859. teleported: _ctx.teleported,
  25860. "popper-class": [_ctx.nsSelect.e("popper"), _ctx.popperClass],
  25861. "popper-options": _ctx.popperOptions,
  25862. "fallback-placements": ["bottom-start", "top-start", "right", "left"],
  25863. effect: _ctx.effect,
  25864. pure: "",
  25865. trigger: "click",
  25866. transition: `${_ctx.nsSelect.namespace.value}-zoom-in-top`,
  25867. "stop-popper-mouse-event": false,
  25868. "gpu-acceleration": false,
  25869. persistent: _ctx.persistent,
  25870. onShow: _ctx.handleMenuEnter
  25871. }, {
  25872. default: withCtx(() => [
  25873. createElementVNode("div", {
  25874. class: "select-trigger",
  25875. onMouseenter: _cache[19] || (_cache[19] = ($event) => _ctx.inputHovering = true),
  25876. onMouseleave: _cache[20] || (_cache[20] = ($event) => _ctx.inputHovering = false)
  25877. }, [
  25878. _ctx.multiple ? (openBlock(), createElementBlock("div", {
  25879. key: 0,
  25880. ref: "tags",
  25881. class: normalizeClass([
  25882. _ctx.nsSelect.e("tags"),
  25883. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  25884. ]),
  25885. style: normalizeStyle(_ctx.selectTagsStyle)
  25886. }, [
  25887. _ctx.collapseTags && _ctx.selected.length ? (openBlock(), createBlock(Transition, {
  25888. key: 0,
  25889. onAfterLeave: _ctx.resetInputHeight
  25890. }, {
  25891. default: withCtx(() => [
  25892. createElementVNode("span", {
  25893. class: normalizeClass([
  25894. _ctx.nsSelect.b("tags-wrapper"),
  25895. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  25896. ])
  25897. }, [
  25898. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.showTagList, (item) => {
  25899. return openBlock(), createBlock(_component_el_tag, {
  25900. key: _ctx.getValueKey(item),
  25901. closable: !_ctx.selectDisabled && !item.isDisabled,
  25902. size: _ctx.collapseTagSize,
  25903. hit: item.hitState,
  25904. type: _ctx.tagType,
  25905. "disable-transitions": "",
  25906. onClose: ($event) => _ctx.deleteTag($event, item)
  25907. }, {
  25908. default: withCtx(() => [
  25909. createElementVNode("span", {
  25910. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  25911. style: normalizeStyle(_ctx.tagTextStyle)
  25912. }, toDisplayString(item.currentLabel), 7)
  25913. ]),
  25914. _: 2
  25915. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  25916. }), 128)),
  25917. _ctx.selected.length > _ctx.maxCollapseTags ? (openBlock(), createBlock(_component_el_tag, {
  25918. key: 0,
  25919. closable: false,
  25920. size: _ctx.collapseTagSize,
  25921. type: _ctx.tagType,
  25922. "disable-transitions": ""
  25923. }, {
  25924. default: withCtx(() => [
  25925. _ctx.collapseTagsTooltip ? (openBlock(), createBlock(_component_el_tooltip, {
  25926. key: 0,
  25927. disabled: _ctx.dropMenuVisible,
  25928. "fallback-placements": ["bottom", "top", "right", "left"],
  25929. effect: _ctx.effect,
  25930. placement: "bottom",
  25931. teleported: _ctx.teleported
  25932. }, {
  25933. default: withCtx(() => [
  25934. createElementVNode("span", {
  25935. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  25936. }, "+ " + toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3)
  25937. ]),
  25938. content: withCtx(() => [
  25939. createElementVNode("div", {
  25940. class: normalizeClass(_ctx.nsSelect.e("collapse-tags"))
  25941. }, [
  25942. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.collapseTagList, (item) => {
  25943. return openBlock(), createElementBlock("div", {
  25944. key: _ctx.getValueKey(item),
  25945. class: normalizeClass(_ctx.nsSelect.e("collapse-tag"))
  25946. }, [
  25947. createVNode(_component_el_tag, {
  25948. class: "in-tooltip",
  25949. closable: !_ctx.selectDisabled && !item.isDisabled,
  25950. size: _ctx.collapseTagSize,
  25951. hit: item.hitState,
  25952. type: _ctx.tagType,
  25953. "disable-transitions": "",
  25954. style: { margin: "2px" },
  25955. onClose: ($event) => _ctx.deleteTag($event, item)
  25956. }, {
  25957. default: withCtx(() => [
  25958. createElementVNode("span", {
  25959. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  25960. style: normalizeStyle({
  25961. maxWidth: _ctx.inputWidth - 75 + "px"
  25962. })
  25963. }, toDisplayString(item.currentLabel), 7)
  25964. ]),
  25965. _: 2
  25966. }, 1032, ["closable", "size", "hit", "type", "onClose"])
  25967. ], 2);
  25968. }), 128))
  25969. ], 2)
  25970. ]),
  25971. _: 1
  25972. }, 8, ["disabled", "effect", "teleported"])) : (openBlock(), createElementBlock("span", {
  25973. key: 1,
  25974. class: normalizeClass(_ctx.nsSelect.e("tags-text"))
  25975. }, "+ " + toDisplayString(_ctx.selected.length - _ctx.maxCollapseTags), 3))
  25976. ]),
  25977. _: 1
  25978. }, 8, ["size", "type"])) : createCommentVNode("v-if", true)
  25979. ], 2)
  25980. ]),
  25981. _: 1
  25982. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  25983. !_ctx.collapseTags ? (openBlock(), createBlock(Transition, {
  25984. key: 1,
  25985. onAfterLeave: _ctx.resetInputHeight
  25986. }, {
  25987. default: withCtx(() => [
  25988. createElementVNode("span", {
  25989. class: normalizeClass([
  25990. _ctx.nsSelect.b("tags-wrapper"),
  25991. { "has-prefix": _ctx.prefixWidth && _ctx.selected.length }
  25992. ])
  25993. }, [
  25994. (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.selected, (item) => {
  25995. return openBlock(), createBlock(_component_el_tag, {
  25996. key: _ctx.getValueKey(item),
  25997. closable: !_ctx.selectDisabled && !item.isDisabled,
  25998. size: _ctx.collapseTagSize,
  25999. hit: item.hitState,
  26000. type: _ctx.tagType,
  26001. "disable-transitions": "",
  26002. onClose: ($event) => _ctx.deleteTag($event, item)
  26003. }, {
  26004. default: withCtx(() => [
  26005. createElementVNode("span", {
  26006. class: normalizeClass(_ctx.nsSelect.e("tags-text")),
  26007. style: normalizeStyle({ maxWidth: _ctx.inputWidth - 75 + "px" })
  26008. }, toDisplayString(item.currentLabel), 7)
  26009. ]),
  26010. _: 2
  26011. }, 1032, ["closable", "size", "hit", "type", "onClose"]);
  26012. }), 128))
  26013. ], 2)
  26014. ]),
  26015. _: 1
  26016. }, 8, ["onAfterLeave"])) : createCommentVNode("v-if", true),
  26017. _ctx.filterable ? withDirectives((openBlock(), createElementBlock("input", {
  26018. key: 2,
  26019. ref: "input",
  26020. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.query = $event),
  26021. type: "text",
  26022. class: normalizeClass([
  26023. _ctx.nsSelect.e("input"),
  26024. _ctx.nsSelect.is(_ctx.selectSize),
  26025. _ctx.nsSelect.is("disabled", _ctx.selectDisabled)
  26026. ]),
  26027. disabled: _ctx.selectDisabled,
  26028. autocomplete: _ctx.autocomplete,
  26029. style: normalizeStyle({
  26030. marginLeft: _ctx.prefixWidth && !_ctx.selected.length || _ctx.tagInMultiLine ? `${_ctx.prefixWidth}px` : "",
  26031. flexGrow: 1,
  26032. width: `${_ctx.inputLength / (_ctx.inputWidth - 32)}%`,
  26033. maxWidth: `${_ctx.inputWidth - 42}px`
  26034. }),
  26035. onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.handleFocus && _ctx.handleFocus(...args)),
  26036. onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.handleBlur && _ctx.handleBlur(...args)),
  26037. onKeyup: _cache[3] || (_cache[3] = (...args) => _ctx.managePlaceholder && _ctx.managePlaceholder(...args)),
  26038. onKeydown: [
  26039. _cache[4] || (_cache[4] = (...args) => _ctx.resetInputState && _ctx.resetInputState(...args)),
  26040. _cache[5] || (_cache[5] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["prevent"]), ["down"])),
  26041. _cache[6] || (_cache[6] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["prevent"]), ["up"])),
  26042. _cache[7] || (_cache[7] = withKeys((...args) => _ctx.handleKeydownEscape && _ctx.handleKeydownEscape(...args), ["esc"])),
  26043. _cache[8] || (_cache[8] = withKeys(withModifiers((...args) => _ctx.selectOption && _ctx.selectOption(...args), ["stop", "prevent"]), ["enter"])),
  26044. _cache[9] || (_cache[9] = withKeys((...args) => _ctx.deletePrevTag && _ctx.deletePrevTag(...args), ["delete"])),
  26045. _cache[10] || (_cache[10] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  26046. ],
  26047. onCompositionstart: _cache[11] || (_cache[11] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  26048. onCompositionupdate: _cache[12] || (_cache[12] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  26049. onCompositionend: _cache[13] || (_cache[13] = (...args) => _ctx.handleComposition && _ctx.handleComposition(...args)),
  26050. onInput: _cache[14] || (_cache[14] = (...args) => _ctx.debouncedQueryChange && _ctx.debouncedQueryChange(...args))
  26051. }, null, 46, _hoisted_1$4)), [
  26052. [vModelText, _ctx.query]
  26053. ]) : createCommentVNode("v-if", true)
  26054. ], 6)) : createCommentVNode("v-if", true),
  26055. createCommentVNode(" fix: https://github.com/element-plus/element-plus/issues/11415 "),
  26056. _ctx.isIOS && !_ctx.multiple && _ctx.filterable && _ctx.readonly ? (openBlock(), createElementBlock("input", {
  26057. key: 1,
  26058. ref: "iOSInput",
  26059. class: normalizeClass([
  26060. _ctx.nsSelect.e("input"),
  26061. _ctx.nsSelect.is(_ctx.selectSize),
  26062. _ctx.nsSelect.em("input", "iOS")
  26063. ]),
  26064. disabled: _ctx.selectDisabled,
  26065. type: "text"
  26066. }, null, 10, _hoisted_2$4)) : createCommentVNode("v-if", true),
  26067. createVNode(_component_el_input, {
  26068. id: _ctx.id,
  26069. ref: "reference",
  26070. modelValue: _ctx.selectedLabel,
  26071. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => _ctx.selectedLabel = $event),
  26072. type: "text",
  26073. placeholder: typeof _ctx.currentPlaceholder === "function" ? _ctx.currentPlaceholder() : _ctx.currentPlaceholder,
  26074. name: _ctx.name,
  26075. autocomplete: _ctx.autocomplete,
  26076. size: _ctx.selectSize,
  26077. disabled: _ctx.selectDisabled,
  26078. readonly: _ctx.readonly,
  26079. "validate-event": false,
  26080. class: normalizeClass([_ctx.nsSelect.is("focus", _ctx.visible)]),
  26081. tabindex: _ctx.multiple && _ctx.filterable ? -1 : void 0,
  26082. onFocus: _ctx.handleFocus,
  26083. onBlur: _ctx.handleBlur,
  26084. onInput: _ctx.debouncedOnInputChange,
  26085. onPaste: _ctx.debouncedOnInputChange,
  26086. onCompositionstart: _ctx.handleComposition,
  26087. onCompositionupdate: _ctx.handleComposition,
  26088. onCompositionend: _ctx.handleComposition,
  26089. onKeydown: [
  26090. _cache[16] || (_cache[16] = withKeys(withModifiers(($event) => _ctx.navigateOptions("next"), ["stop", "prevent"]), ["down"])),
  26091. _cache[17] || (_cache[17] = withKeys(withModifiers(($event) => _ctx.navigateOptions("prev"), ["stop", "prevent"]), ["up"])),
  26092. withKeys(withModifiers(_ctx.selectOption, ["stop", "prevent"]), ["enter"]),
  26093. withKeys(_ctx.handleKeydownEscape, ["esc"]),
  26094. _cache[18] || (_cache[18] = withKeys(($event) => _ctx.visible = false, ["tab"]))
  26095. ]
  26096. }, createSlots({
  26097. suffix: withCtx(() => [
  26098. _ctx.iconComponent && !_ctx.showClose ? (openBlock(), createBlock(_component_el_icon, {
  26099. key: 0,
  26100. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon"), _ctx.iconReverse])
  26101. }, {
  26102. default: withCtx(() => [
  26103. (openBlock(), createBlock(resolveDynamicComponent(_ctx.iconComponent)))
  26104. ]),
  26105. _: 1
  26106. }, 8, ["class"])) : createCommentVNode("v-if", true),
  26107. _ctx.showClose && _ctx.clearIcon ? (openBlock(), createBlock(_component_el_icon, {
  26108. key: 1,
  26109. class: normalizeClass([_ctx.nsSelect.e("caret"), _ctx.nsSelect.e("icon")]),
  26110. onClick: _ctx.handleClearClick
  26111. }, {
  26112. default: withCtx(() => [
  26113. (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
  26114. ]),
  26115. _: 1
  26116. }, 8, ["class", "onClick"])) : createCommentVNode("v-if", true)
  26117. ]),
  26118. _: 2
  26119. }, [
  26120. _ctx.$slots.prefix ? {
  26121. name: "prefix",
  26122. fn: withCtx(() => [
  26123. createElementVNode("div", _hoisted_3$4, [
  26124. renderSlot(_ctx.$slots, "prefix")
  26125. ])
  26126. ])
  26127. } : void 0
  26128. ]), 1032, ["id", "modelValue", "placeholder", "name", "autocomplete", "size", "disabled", "readonly", "class", "tabindex", "onFocus", "onBlur", "onInput", "onPaste", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onKeydown"])
  26129. ], 32)
  26130. ]),
  26131. content: withCtx(() => [
  26132. createVNode(_component_el_select_menu, null, {
  26133. default: withCtx(() => [
  26134. withDirectives(createVNode(_component_el_scrollbar, {
  26135. ref: "scrollbar",
  26136. tag: "ul",
  26137. "wrap-class": _ctx.nsSelect.be("dropdown", "wrap"),
  26138. "view-class": _ctx.nsSelect.be("dropdown", "list"),
  26139. class: normalizeClass([
  26140. _ctx.nsSelect.is("empty", !_ctx.allowCreate && Boolean(_ctx.query) && _ctx.filteredOptionsCount === 0)
  26141. ])
  26142. }, {
  26143. default: withCtx(() => [
  26144. _ctx.showNewOption ? (openBlock(), createBlock(_component_el_option, {
  26145. key: 0,
  26146. value: _ctx.query,
  26147. created: true
  26148. }, null, 8, ["value"])) : createCommentVNode("v-if", true),
  26149. createVNode(_component_el_options, { onUpdateOptions: _ctx.onOptionsRendered }, {
  26150. default: withCtx(() => [
  26151. renderSlot(_ctx.$slots, "default")
  26152. ]),
  26153. _: 3
  26154. }, 8, ["onUpdateOptions"])
  26155. ]),
  26156. _: 3
  26157. }, 8, ["wrap-class", "view-class", "class"]), [
  26158. [vShow, _ctx.options.size > 0 && !_ctx.loading]
  26159. ]),
  26160. _ctx.emptyText && (!_ctx.allowCreate || _ctx.loading || _ctx.allowCreate && _ctx.options.size === 0) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
  26161. _ctx.$slots.empty ? renderSlot(_ctx.$slots, "empty", { key: 0 }) : (openBlock(), createElementBlock("p", {
  26162. key: 1,
  26163. class: normalizeClass(_ctx.nsSelect.be("dropdown", "empty"))
  26164. }, toDisplayString(_ctx.emptyText), 3))
  26165. ], 64)) : createCommentVNode("v-if", true)
  26166. ]),
  26167. _: 3
  26168. })
  26169. ]),
  26170. _: 3
  26171. }, 8, ["visible", "placement", "teleported", "popper-class", "popper-options", "effect", "transition", "persistent", "onShow"])
  26172. ], 34)), [
  26173. [_directive_click_outside, _ctx.handleClose, _ctx.popperPaneRef]
  26174. ]);
  26175. }
  26176. var Select = /* @__PURE__ */ _export_sfc$1(_sfc_main$5, [["render", _sfc_render$1], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/select.vue"]]);
  26177. const _sfc_main$4 = defineComponent({
  26178. name: "ElOptionGroup",
  26179. componentName: "ElOptionGroup",
  26180. props: {
  26181. label: String,
  26182. disabled: {
  26183. type: Boolean,
  26184. default: false
  26185. }
  26186. },
  26187. setup(props) {
  26188. const ns = useNamespace("select");
  26189. const visible = ref(true);
  26190. const instance = getCurrentInstance();
  26191. const children = ref([]);
  26192. provide(selectGroupKey, reactive({
  26193. ...toRefs(props)
  26194. }));
  26195. const select = inject(selectKey);
  26196. onMounted(() => {
  26197. children.value = flattedChildren(instance.subTree);
  26198. });
  26199. const flattedChildren = (node) => {
  26200. const children2 = [];
  26201. if (Array.isArray(node.children)) {
  26202. node.children.forEach((child) => {
  26203. var _a2;
  26204. if (child.type && child.type.name === "ElOption" && child.component && child.component.proxy) {
  26205. children2.push(child.component.proxy);
  26206. } else if ((_a2 = child.children) == null ? void 0 : _a2.length) {
  26207. children2.push(...flattedChildren(child));
  26208. }
  26209. });
  26210. }
  26211. return children2;
  26212. };
  26213. const { groupQueryChange } = toRaw$1(select);
  26214. watch(groupQueryChange, () => {
  26215. visible.value = children.value.some((option) => option.visible === true);
  26216. }, { flush: "post" });
  26217. return {
  26218. visible,
  26219. ns
  26220. };
  26221. }
  26222. });
  26223. function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
  26224. return withDirectives((openBlock(), createElementBlock("ul", {
  26225. class: normalizeClass(_ctx.ns.be("group", "wrap"))
  26226. }, [
  26227. createElementVNode("li", {
  26228. class: normalizeClass(_ctx.ns.be("group", "title"))
  26229. }, toDisplayString(_ctx.label), 3),
  26230. createElementVNode("li", null, [
  26231. createElementVNode("ul", {
  26232. class: normalizeClass(_ctx.ns.b("group"))
  26233. }, [
  26234. renderSlot(_ctx.$slots, "default")
  26235. ], 2)
  26236. ])
  26237. ], 2)), [
  26238. [vShow, _ctx.visible]
  26239. ]);
  26240. }
  26241. var OptionGroup = /* @__PURE__ */ _export_sfc$1(_sfc_main$4, [["render", _sfc_render], ["__file", "/home/runner/work/element-plus/element-plus/packages/components/select/src/option-group.vue"]]);
  26242. const ElSelect = withInstall(Select, {
  26243. Option,
  26244. OptionGroup
  26245. });
  26246. const ElOption = withNoopInstall(Option);
  26247. withNoopInstall(OptionGroup);
  26248. const switchProps = buildProps({
  26249. modelValue: {
  26250. type: [Boolean, String, Number],
  26251. default: false
  26252. },
  26253. value: {
  26254. type: [Boolean, String, Number],
  26255. default: false
  26256. },
  26257. disabled: {
  26258. type: Boolean,
  26259. default: false
  26260. },
  26261. width: {
  26262. type: [String, Number],
  26263. default: ""
  26264. },
  26265. inlinePrompt: {
  26266. type: Boolean,
  26267. default: false
  26268. },
  26269. activeIcon: {
  26270. type: iconPropType
  26271. },
  26272. inactiveIcon: {
  26273. type: iconPropType
  26274. },
  26275. activeText: {
  26276. type: String,
  26277. default: ""
  26278. },
  26279. inactiveText: {
  26280. type: String,
  26281. default: ""
  26282. },
  26283. activeColor: {
  26284. type: String,
  26285. default: ""
  26286. },
  26287. inactiveColor: {
  26288. type: String,
  26289. default: ""
  26290. },
  26291. borderColor: {
  26292. type: String,
  26293. default: ""
  26294. },
  26295. activeValue: {
  26296. type: [Boolean, String, Number],
  26297. default: true
  26298. },
  26299. inactiveValue: {
  26300. type: [Boolean, String, Number],
  26301. default: false
  26302. },
  26303. name: {
  26304. type: String,
  26305. default: ""
  26306. },
  26307. validateEvent: {
  26308. type: Boolean,
  26309. default: true
  26310. },
  26311. id: String,
  26312. loading: {
  26313. type: Boolean,
  26314. default: false
  26315. },
  26316. beforeChange: {
  26317. type: definePropType(Function)
  26318. },
  26319. size: {
  26320. type: String,
  26321. validator: isValidComponentSize
  26322. },
  26323. tabindex: {
  26324. type: [String, Number]
  26325. }
  26326. });
  26327. const switchEmits = {
  26328. [UPDATE_MODEL_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  26329. [CHANGE_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val),
  26330. [INPUT_EVENT]: (val) => isBoolean(val) || isString(val) || isNumber(val)
  26331. };
  26332. const _hoisted_1$3 = ["onClick"];
  26333. const _hoisted_2$3 = ["id", "aria-checked", "aria-disabled", "name", "true-value", "false-value", "disabled", "tabindex", "onKeydown"];
  26334. const _hoisted_3$3 = ["aria-hidden"];
  26335. const _hoisted_4$3 = ["aria-hidden"];
  26336. const _hoisted_5$3 = ["aria-hidden"];
  26337. const COMPONENT_NAME = "ElSwitch";
  26338. const __default__ = defineComponent({
  26339. name: COMPONENT_NAME
  26340. });
  26341. const _sfc_main$3 = /* @__PURE__ */ defineComponent({
  26342. ...__default__,
  26343. props: switchProps,
  26344. emits: switchEmits,
  26345. setup(__props, { expose, emit }) {
  26346. const props = __props;
  26347. const vm = getCurrentInstance();
  26348. const { formItem } = useFormItem();
  26349. const switchSize = useFormSize();
  26350. const ns = useNamespace("switch");
  26351. useDeprecated({
  26352. from: '"value"',
  26353. replacement: '"model-value" or "v-model"',
  26354. scope: COMPONENT_NAME,
  26355. version: "2.3.0",
  26356. ref: "https://element-plus.org/en-US/component/switch.html#attributes",
  26357. type: "Attribute"
  26358. }, computed$1(() => {
  26359. var _a2;
  26360. return !!((_a2 = vm.vnode.props) == null ? void 0 : _a2.value);
  26361. }));
  26362. const { inputId } = useFormItemInputId(props, {
  26363. formItemContext: formItem
  26364. });
  26365. const switchDisabled = useFormDisabled(computed$1(() => props.loading));
  26366. const isControlled = ref(props.modelValue !== false);
  26367. const input = ref();
  26368. const core = ref();
  26369. const switchKls = computed$1(() => [
  26370. ns.b(),
  26371. ns.m(switchSize.value),
  26372. ns.is("disabled", switchDisabled.value),
  26373. ns.is("checked", checked.value)
  26374. ]);
  26375. const coreStyle = computed$1(() => ({
  26376. width: addUnit(props.width)
  26377. }));
  26378. watch(() => props.modelValue, () => {
  26379. isControlled.value = true;
  26380. });
  26381. watch(() => props.value, () => {
  26382. isControlled.value = false;
  26383. });
  26384. const actualValue = computed$1(() => {
  26385. return isControlled.value ? props.modelValue : props.value;
  26386. });
  26387. const checked = computed$1(() => actualValue.value === props.activeValue);
  26388. if (![props.activeValue, props.inactiveValue].includes(actualValue.value)) {
  26389. emit(UPDATE_MODEL_EVENT, props.inactiveValue);
  26390. emit(CHANGE_EVENT, props.inactiveValue);
  26391. emit(INPUT_EVENT, props.inactiveValue);
  26392. }
  26393. watch(checked, (val) => {
  26394. var _a2;
  26395. input.value.checked = val;
  26396. if (props.validateEvent) {
  26397. (_a2 = formItem == null ? void 0 : formItem.validate) == null ? void 0 : _a2.call(formItem, "change").catch((err) => debugWarn());
  26398. }
  26399. });
  26400. const handleChange = () => {
  26401. const val = checked.value ? props.inactiveValue : props.activeValue;
  26402. emit(UPDATE_MODEL_EVENT, val);
  26403. emit(CHANGE_EVENT, val);
  26404. emit(INPUT_EVENT, val);
  26405. nextTick(() => {
  26406. input.value.checked = checked.value;
  26407. });
  26408. };
  26409. const switchValue = () => {
  26410. if (switchDisabled.value)
  26411. return;
  26412. const { beforeChange } = props;
  26413. if (!beforeChange) {
  26414. handleChange();
  26415. return;
  26416. }
  26417. const shouldChange = beforeChange();
  26418. const isPromiseOrBool = [
  26419. isPromise$2(shouldChange),
  26420. isBoolean(shouldChange)
  26421. ].includes(true);
  26422. if (!isPromiseOrBool) {
  26423. throwError(COMPONENT_NAME, "beforeChange must return type `Promise<boolean>` or `boolean`");
  26424. }
  26425. if (isPromise$2(shouldChange)) {
  26426. shouldChange.then((result) => {
  26427. if (result) {
  26428. handleChange();
  26429. }
  26430. }).catch((e) => {
  26431. });
  26432. } else if (shouldChange) {
  26433. handleChange();
  26434. }
  26435. };
  26436. const styles = computed$1(() => {
  26437. return ns.cssVarBlock({
  26438. ...props.activeColor ? { "on-color": props.activeColor } : null,
  26439. ...props.inactiveColor ? { "off-color": props.inactiveColor } : null,
  26440. ...props.borderColor ? { "border-color": props.borderColor } : null
  26441. });
  26442. });
  26443. const focus = () => {
  26444. var _a2, _b;
  26445. (_b = (_a2 = input.value) == null ? void 0 : _a2.focus) == null ? void 0 : _b.call(_a2);
  26446. };
  26447. onMounted(() => {
  26448. input.value.checked = checked.value;
  26449. });
  26450. expose({
  26451. focus,
  26452. checked
  26453. });
  26454. return (_ctx, _cache) => {
  26455. return openBlock(), createElementBlock("div", {
  26456. class: normalizeClass(unref(switchKls)),
  26457. style: normalizeStyle(unref(styles)),
  26458. onClick: withModifiers(switchValue, ["prevent"])
  26459. }, [
  26460. createElementVNode("input", {
  26461. id: unref(inputId),
  26462. ref_key: "input",
  26463. ref: input,
  26464. class: normalizeClass(unref(ns).e("input")),
  26465. type: "checkbox",
  26466. role: "switch",
  26467. "aria-checked": unref(checked),
  26468. "aria-disabled": unref(switchDisabled),
  26469. name: _ctx.name,
  26470. "true-value": _ctx.activeValue,
  26471. "false-value": _ctx.inactiveValue,
  26472. disabled: unref(switchDisabled),
  26473. tabindex: _ctx.tabindex,
  26474. onChange: handleChange,
  26475. onKeydown: withKeys(switchValue, ["enter"])
  26476. }, null, 42, _hoisted_2$3),
  26477. !_ctx.inlinePrompt && (_ctx.inactiveIcon || _ctx.inactiveText) ? (openBlock(), createElementBlock("span", {
  26478. key: 0,
  26479. class: normalizeClass([
  26480. unref(ns).e("label"),
  26481. unref(ns).em("label", "left"),
  26482. unref(ns).is("active", !unref(checked))
  26483. ])
  26484. }, [
  26485. _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  26486. default: withCtx(() => [
  26487. (openBlock(), createBlock(resolveDynamicComponent(_ctx.inactiveIcon)))
  26488. ]),
  26489. _: 1
  26490. })) : createCommentVNode("v-if", true),
  26491. !_ctx.inactiveIcon && _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  26492. key: 1,
  26493. "aria-hidden": unref(checked)
  26494. }, toDisplayString(_ctx.inactiveText), 9, _hoisted_3$3)) : createCommentVNode("v-if", true)
  26495. ], 2)) : createCommentVNode("v-if", true),
  26496. createElementVNode("span", {
  26497. ref_key: "core",
  26498. ref: core,
  26499. class: normalizeClass(unref(ns).e("core")),
  26500. style: normalizeStyle(unref(coreStyle))
  26501. }, [
  26502. _ctx.inlinePrompt ? (openBlock(), createElementBlock("div", {
  26503. key: 0,
  26504. class: normalizeClass(unref(ns).e("inner"))
  26505. }, [
  26506. _ctx.activeIcon || _ctx.inactiveIcon ? (openBlock(), createBlock(unref(ElIcon), {
  26507. key: 0,
  26508. class: normalizeClass(unref(ns).is("icon"))
  26509. }, {
  26510. default: withCtx(() => [
  26511. (openBlock(), createBlock(resolveDynamicComponent(unref(checked) ? _ctx.activeIcon : _ctx.inactiveIcon)))
  26512. ]),
  26513. _: 1
  26514. }, 8, ["class"])) : _ctx.activeText || _ctx.inactiveText ? (openBlock(), createElementBlock("span", {
  26515. key: 1,
  26516. class: normalizeClass(unref(ns).is("text")),
  26517. "aria-hidden": !unref(checked)
  26518. }, toDisplayString(unref(checked) ? _ctx.activeText : _ctx.inactiveText), 11, _hoisted_4$3)) : createCommentVNode("v-if", true)
  26519. ], 2)) : createCommentVNode("v-if", true),
  26520. createElementVNode("div", {
  26521. class: normalizeClass(unref(ns).e("action"))
  26522. }, [
  26523. _ctx.loading ? (openBlock(), createBlock(unref(ElIcon), {
  26524. key: 0,
  26525. class: normalizeClass(unref(ns).is("loading"))
  26526. }, {
  26527. default: withCtx(() => [
  26528. createVNode(unref(loading_default))
  26529. ]),
  26530. _: 1
  26531. }, 8, ["class"])) : createCommentVNode("v-if", true)
  26532. ], 2)
  26533. ], 6),
  26534. !_ctx.inlinePrompt && (_ctx.activeIcon || _ctx.activeText) ? (openBlock(), createElementBlock("span", {
  26535. key: 1,
  26536. class: normalizeClass([
  26537. unref(ns).e("label"),
  26538. unref(ns).em("label", "right"),
  26539. unref(ns).is("active", unref(checked))
  26540. ])
  26541. }, [
  26542. _ctx.activeIcon ? (openBlock(), createBlock(unref(ElIcon), { key: 0 }, {
  26543. default: withCtx(() => [
  26544. (openBlock(), createBlock(resolveDynamicComponent(_ctx.activeIcon)))
  26545. ]),
  26546. _: 1
  26547. })) : createCommentVNode("v-if", true),
  26548. !_ctx.activeIcon && _ctx.activeText ? (openBlock(), createElementBlock("span", {
  26549. key: 1,
  26550. "aria-hidden": !unref(checked)
  26551. }, toDisplayString(_ctx.activeText), 9, _hoisted_5$3)) : createCommentVNode("v-if", true)
  26552. ], 2)) : createCommentVNode("v-if", true)
  26553. ], 14, _hoisted_1$3);
  26554. };
  26555. }
  26556. });
  26557. var Switch = /* @__PURE__ */ _export_sfc$1(_sfc_main$3, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/switch/src/switch.vue"]]);
  26558. const ElSwitch = withInstall(Switch);
  26559. /*! Element Plus v2.3.4 */
  26560. var zhCn = {
  26561. name: "zh-cn",
  26562. el: {
  26563. colorpicker: {
  26564. confirm: "\u786E\u5B9A",
  26565. clear: "\u6E05\u7A7A"
  26566. },
  26567. datepicker: {
  26568. now: "\u6B64\u523B",
  26569. today: "\u4ECA\u5929",
  26570. cancel: "\u53D6\u6D88",
  26571. clear: "\u6E05\u7A7A",
  26572. confirm: "\u786E\u5B9A",
  26573. selectDate: "\u9009\u62E9\u65E5\u671F",
  26574. selectTime: "\u9009\u62E9\u65F6\u95F4",
  26575. startDate: "\u5F00\u59CB\u65E5\u671F",
  26576. startTime: "\u5F00\u59CB\u65F6\u95F4",
  26577. endDate: "\u7ED3\u675F\u65E5\u671F",
  26578. endTime: "\u7ED3\u675F\u65F6\u95F4",
  26579. prevYear: "\u524D\u4E00\u5E74",
  26580. nextYear: "\u540E\u4E00\u5E74",
  26581. prevMonth: "\u4E0A\u4E2A\u6708",
  26582. nextMonth: "\u4E0B\u4E2A\u6708",
  26583. year: "\u5E74",
  26584. month1: "1 \u6708",
  26585. month2: "2 \u6708",
  26586. month3: "3 \u6708",
  26587. month4: "4 \u6708",
  26588. month5: "5 \u6708",
  26589. month6: "6 \u6708",
  26590. month7: "7 \u6708",
  26591. month8: "8 \u6708",
  26592. month9: "9 \u6708",
  26593. month10: "10 \u6708",
  26594. month11: "11 \u6708",
  26595. month12: "12 \u6708",
  26596. weeks: {
  26597. sun: "\u65E5",
  26598. mon: "\u4E00",
  26599. tue: "\u4E8C",
  26600. wed: "\u4E09",
  26601. thu: "\u56DB",
  26602. fri: "\u4E94",
  26603. sat: "\u516D"
  26604. },
  26605. months: {
  26606. jan: "\u4E00\u6708",
  26607. feb: "\u4E8C\u6708",
  26608. mar: "\u4E09\u6708",
  26609. apr: "\u56DB\u6708",
  26610. may: "\u4E94\u6708",
  26611. jun: "\u516D\u6708",
  26612. jul: "\u4E03\u6708",
  26613. aug: "\u516B\u6708",
  26614. sep: "\u4E5D\u6708",
  26615. oct: "\u5341\u6708",
  26616. nov: "\u5341\u4E00\u6708",
  26617. dec: "\u5341\u4E8C\u6708"
  26618. }
  26619. },
  26620. select: {
  26621. loading: "\u52A0\u8F7D\u4E2D",
  26622. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  26623. noData: "\u65E0\u6570\u636E",
  26624. placeholder: "\u8BF7\u9009\u62E9"
  26625. },
  26626. cascader: {
  26627. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  26628. loading: "\u52A0\u8F7D\u4E2D",
  26629. placeholder: "\u8BF7\u9009\u62E9",
  26630. noData: "\u6682\u65E0\u6570\u636E"
  26631. },
  26632. pagination: {
  26633. goto: "\u524D\u5F80",
  26634. pagesize: "\u6761/\u9875",
  26635. total: "\u5171 {total} \u6761",
  26636. pageClassifier: "\u9875",
  26637. page: "\u9875",
  26638. prev: "\u4E0A\u4E00\u9875",
  26639. next: "\u4E0B\u4E00\u9875",
  26640. currentPage: "\u7B2C {pager} \u9875",
  26641. prevPages: "\u5411\u524D {pager} \u9875",
  26642. nextPages: "\u5411\u540E {pager} \u9875",
  26643. deprecationWarning: "\u4F60\u4F7F\u7528\u4E86\u4E00\u4E9B\u5DF2\u88AB\u5E9F\u5F03\u7684\u7528\u6CD5\uFF0C\u8BF7\u53C2\u8003 el-pagination \u7684\u5B98\u65B9\u6587\u6863"
  26644. },
  26645. messagebox: {
  26646. title: "\u63D0\u793A",
  26647. confirm: "\u786E\u5B9A",
  26648. cancel: "\u53D6\u6D88",
  26649. error: "\u8F93\u5165\u7684\u6570\u636E\u4E0D\u5408\u6CD5!"
  26650. },
  26651. upload: {
  26652. deleteTip: "\u6309 delete \u952E\u53EF\u5220\u9664",
  26653. delete: "\u5220\u9664",
  26654. preview: "\u67E5\u770B\u56FE\u7247",
  26655. continue: "\u7EE7\u7EED\u4E0A\u4F20"
  26656. },
  26657. table: {
  26658. emptyText: "\u6682\u65E0\u6570\u636E",
  26659. confirmFilter: "\u7B5B\u9009",
  26660. resetFilter: "\u91CD\u7F6E",
  26661. clearFilter: "\u5168\u90E8",
  26662. sumText: "\u5408\u8BA1"
  26663. },
  26664. tree: {
  26665. emptyText: "\u6682\u65E0\u6570\u636E"
  26666. },
  26667. transfer: {
  26668. noMatch: "\u65E0\u5339\u914D\u6570\u636E",
  26669. noData: "\u65E0\u6570\u636E",
  26670. titles: ["\u5217\u8868 1", "\u5217\u8868 2"],
  26671. filterPlaceholder: "\u8BF7\u8F93\u5165\u641C\u7D22\u5185\u5BB9",
  26672. noCheckedFormat: "\u5171 {total} \u9879",
  26673. hasCheckedFormat: "\u5DF2\u9009 {checked}/{total} \u9879"
  26674. },
  26675. image: {
  26676. error: "\u52A0\u8F7D\u5931\u8D25"
  26677. },
  26678. pageHeader: {
  26679. title: "\u8FD4\u56DE"
  26680. },
  26681. popconfirm: {
  26682. confirmButtonText: "\u786E\u5B9A",
  26683. cancelButtonText: "\u53D6\u6D88"
  26684. }
  26685. }
  26686. };
  26687. /*! Element Plus v2.3.4 */
  26688. var en = {
  26689. name: "en",
  26690. el: {
  26691. colorpicker: {
  26692. confirm: "OK",
  26693. clear: "Clear",
  26694. defaultLabel: "color picker",
  26695. description: "current color is {color}. press enter to select a new color."
  26696. },
  26697. datepicker: {
  26698. now: "Now",
  26699. today: "Today",
  26700. cancel: "Cancel",
  26701. clear: "Clear",
  26702. confirm: "OK",
  26703. dateTablePrompt: "Use the arrow keys and enter to select the day of the month",
  26704. monthTablePrompt: "Use the arrow keys and enter to select the month",
  26705. yearTablePrompt: "Use the arrow keys and enter to select the year",
  26706. selectedDate: "Selected date",
  26707. selectDate: "Select date",
  26708. selectTime: "Select time",
  26709. startDate: "Start Date",
  26710. startTime: "Start Time",
  26711. endDate: "End Date",
  26712. endTime: "End Time",
  26713. prevYear: "Previous Year",
  26714. nextYear: "Next Year",
  26715. prevMonth: "Previous Month",
  26716. nextMonth: "Next Month",
  26717. year: "",
  26718. month1: "January",
  26719. month2: "February",
  26720. month3: "March",
  26721. month4: "April",
  26722. month5: "May",
  26723. month6: "June",
  26724. month7: "July",
  26725. month8: "August",
  26726. month9: "September",
  26727. month10: "October",
  26728. month11: "November",
  26729. month12: "December",
  26730. week: "week",
  26731. weeks: {
  26732. sun: "Sun",
  26733. mon: "Mon",
  26734. tue: "Tue",
  26735. wed: "Wed",
  26736. thu: "Thu",
  26737. fri: "Fri",
  26738. sat: "Sat"
  26739. },
  26740. weeksFull: {
  26741. sun: "Sunday",
  26742. mon: "Monday",
  26743. tue: "Tuesday",
  26744. wed: "Wednesday",
  26745. thu: "Thursday",
  26746. fri: "Friday",
  26747. sat: "Saturday"
  26748. },
  26749. months: {
  26750. jan: "Jan",
  26751. feb: "Feb",
  26752. mar: "Mar",
  26753. apr: "Apr",
  26754. may: "May",
  26755. jun: "Jun",
  26756. jul: "Jul",
  26757. aug: "Aug",
  26758. sep: "Sep",
  26759. oct: "Oct",
  26760. nov: "Nov",
  26761. dec: "Dec"
  26762. }
  26763. },
  26764. inputNumber: {
  26765. decrease: "decrease number",
  26766. increase: "increase number"
  26767. },
  26768. select: {
  26769. loading: "Loading",
  26770. noMatch: "No matching data",
  26771. noData: "No data",
  26772. placeholder: "Select"
  26773. },
  26774. dropdown: {
  26775. toggleDropdown: "Toggle Dropdown"
  26776. },
  26777. cascader: {
  26778. noMatch: "No matching data",
  26779. loading: "Loading",
  26780. placeholder: "Select",
  26781. noData: "No data"
  26782. },
  26783. pagination: {
  26784. goto: "Go to",
  26785. pagesize: "/page",
  26786. total: "Total {total}",
  26787. pageClassifier: "",
  26788. page: "Page",
  26789. prev: "Go to previous page",
  26790. next: "Go to next page",
  26791. currentPage: "page {pager}",
  26792. prevPages: "Previous {pager} pages",
  26793. nextPages: "Next {pager} pages",
  26794. deprecationWarning: "Deprecated usages detected, please refer to the el-pagination documentation for more details"
  26795. },
  26796. dialog: {
  26797. close: "Close this dialog"
  26798. },
  26799. drawer: {
  26800. close: "Close this dialog"
  26801. },
  26802. messagebox: {
  26803. title: "Message",
  26804. confirm: "OK",
  26805. cancel: "Cancel",
  26806. error: "Illegal input",
  26807. close: "Close this dialog"
  26808. },
  26809. upload: {
  26810. deleteTip: "press delete to remove",
  26811. delete: "Delete",
  26812. preview: "Preview",
  26813. continue: "Continue"
  26814. },
  26815. slider: {
  26816. defaultLabel: "slider between {min} and {max}",
  26817. defaultRangeStartLabel: "pick start value",
  26818. defaultRangeEndLabel: "pick end value"
  26819. },
  26820. table: {
  26821. emptyText: "No Data",
  26822. confirmFilter: "Confirm",
  26823. resetFilter: "Reset",
  26824. clearFilter: "All",
  26825. sumText: "Sum"
  26826. },
  26827. tree: {
  26828. emptyText: "No Data"
  26829. },
  26830. transfer: {
  26831. noMatch: "No matching data",
  26832. noData: "No data",
  26833. titles: ["List 1", "List 2"],
  26834. filterPlaceholder: "Enter keyword",
  26835. noCheckedFormat: "{total} items",
  26836. hasCheckedFormat: "{checked}/{total} checked"
  26837. },
  26838. image: {
  26839. error: "FAILED"
  26840. },
  26841. pageHeader: {
  26842. title: "Back"
  26843. },
  26844. popconfirm: {
  26845. confirmButtonText: "Yes",
  26846. cancelButtonText: "No"
  26847. }
  26848. }
  26849. };
  26850. var jquery = { exports: {} };
  26851. /*!
  26852. * jQuery JavaScript Library v3.7.0
  26853. * https://jquery.com/
  26854. *
  26855. * Copyright OpenJS Foundation and other contributors
  26856. * Released under the MIT license
  26857. * https://jquery.org/license
  26858. *
  26859. * Date: 2023-05-11T18:29Z
  26860. */
  26861. (function(module2) {
  26862. (function(global2, factory3) {
  26863. {
  26864. module2.exports = global2.document ? factory3(global2, true) : function(w) {
  26865. if (!w.document) {
  26866. throw new Error("jQuery requires a window with a document");
  26867. }
  26868. return factory3(w);
  26869. };
  26870. }
  26871. })(typeof window !== "undefined" ? window : commonjsGlobal, function(window2, noGlobal) {
  26872. var arr = [];
  26873. var getProto = Object.getPrototypeOf;
  26874. var slice = arr.slice;
  26875. var flat2 = arr.flat ? function(array) {
  26876. return arr.flat.call(array);
  26877. } : function(array) {
  26878. return arr.concat.apply([], array);
  26879. };
  26880. var push = arr.push;
  26881. var indexOf = arr.indexOf;
  26882. var class2type = {};
  26883. var toString2 = class2type.toString;
  26884. var hasOwn2 = class2type.hasOwnProperty;
  26885. var fnToString = hasOwn2.toString;
  26886. var ObjectFunctionString = fnToString.call(Object);
  26887. var support = {};
  26888. var isFunction2 = function isFunction3(obj) {
  26889. return typeof obj === "function" && typeof obj.nodeType !== "number" && typeof obj.item !== "function";
  26890. };
  26891. var isWindow = function isWindow2(obj) {
  26892. return obj != null && obj === obj.window;
  26893. };
  26894. var document2 = window2.document;
  26895. var preservedScriptAttributes = {
  26896. type: true,
  26897. src: true,
  26898. nonce: true,
  26899. noModule: true
  26900. };
  26901. function DOMEval(code, node, doc) {
  26902. doc = doc || document2;
  26903. var i2, val, script = doc.createElement("script");
  26904. script.text = code;
  26905. if (node) {
  26906. for (i2 in preservedScriptAttributes) {
  26907. val = node[i2] || node.getAttribute && node.getAttribute(i2);
  26908. if (val) {
  26909. script.setAttribute(i2, val);
  26910. }
  26911. }
  26912. }
  26913. doc.head.appendChild(script).parentNode.removeChild(script);
  26914. }
  26915. function toType(obj) {
  26916. if (obj == null) {
  26917. return obj + "";
  26918. }
  26919. return typeof obj === "object" || typeof obj === "function" ? class2type[toString2.call(obj)] || "object" : typeof obj;
  26920. }
  26921. var version2 = "3.7.0", rhtmlSuffix = /HTML$/i, jQuery = function(selector, context) {
  26922. return new jQuery.fn.init(selector, context);
  26923. };
  26924. jQuery.fn = jQuery.prototype = {
  26925. jquery: version2,
  26926. constructor: jQuery,
  26927. length: 0,
  26928. toArray: function() {
  26929. return slice.call(this);
  26930. },
  26931. get: function(num) {
  26932. if (num == null) {
  26933. return slice.call(this);
  26934. }
  26935. return num < 0 ? this[num + this.length] : this[num];
  26936. },
  26937. pushStack: function(elems) {
  26938. var ret = jQuery.merge(this.constructor(), elems);
  26939. ret.prevObject = this;
  26940. return ret;
  26941. },
  26942. each: function(callback2) {
  26943. return jQuery.each(this, callback2);
  26944. },
  26945. map: function(callback2) {
  26946. return this.pushStack(jQuery.map(this, function(elem, i2) {
  26947. return callback2.call(elem, i2, elem);
  26948. }));
  26949. },
  26950. slice: function() {
  26951. return this.pushStack(slice.apply(this, arguments));
  26952. },
  26953. first: function() {
  26954. return this.eq(0);
  26955. },
  26956. last: function() {
  26957. return this.eq(-1);
  26958. },
  26959. even: function() {
  26960. return this.pushStack(jQuery.grep(this, function(_elem, i2) {
  26961. return (i2 + 1) % 2;
  26962. }));
  26963. },
  26964. odd: function() {
  26965. return this.pushStack(jQuery.grep(this, function(_elem, i2) {
  26966. return i2 % 2;
  26967. }));
  26968. },
  26969. eq: function(i2) {
  26970. var len = this.length, j = +i2 + (i2 < 0 ? len : 0);
  26971. return this.pushStack(j >= 0 && j < len ? [this[j]] : []);
  26972. },
  26973. end: function() {
  26974. return this.prevObject || this.constructor();
  26975. },
  26976. push,
  26977. sort: arr.sort,
  26978. splice: arr.splice
  26979. };
  26980. jQuery.extend = jQuery.fn.extend = function() {
  26981. var options2, name, src, copy2, copyIsArray, clone, target = arguments[0] || {}, i2 = 1, length = arguments.length, deep = false;
  26982. if (typeof target === "boolean") {
  26983. deep = target;
  26984. target = arguments[i2] || {};
  26985. i2++;
  26986. }
  26987. if (typeof target !== "object" && !isFunction2(target)) {
  26988. target = {};
  26989. }
  26990. if (i2 === length) {
  26991. target = this;
  26992. i2--;
  26993. }
  26994. for (; i2 < length; i2++) {
  26995. if ((options2 = arguments[i2]) != null) {
  26996. for (name in options2) {
  26997. copy2 = options2[name];
  26998. if (name === "__proto__" || target === copy2) {
  26999. continue;
  27000. }
  27001. if (deep && copy2 && (jQuery.isPlainObject(copy2) || (copyIsArray = Array.isArray(copy2)))) {
  27002. src = target[name];
  27003. if (copyIsArray && !Array.isArray(src)) {
  27004. clone = [];
  27005. } else if (!copyIsArray && !jQuery.isPlainObject(src)) {
  27006. clone = {};
  27007. } else {
  27008. clone = src;
  27009. }
  27010. copyIsArray = false;
  27011. target[name] = jQuery.extend(deep, clone, copy2);
  27012. } else if (copy2 !== void 0) {
  27013. target[name] = copy2;
  27014. }
  27015. }
  27016. }
  27017. }
  27018. return target;
  27019. };
  27020. jQuery.extend({
  27021. expando: "jQuery" + (version2 + Math.random()).replace(/\D/g, ""),
  27022. isReady: true,
  27023. error: function(msg) {
  27024. throw new Error(msg);
  27025. },
  27026. noop: function() {
  27027. },
  27028. isPlainObject: function(obj) {
  27029. var proto, Ctor;
  27030. if (!obj || toString2.call(obj) !== "[object Object]") {
  27031. return false;
  27032. }
  27033. proto = getProto(obj);
  27034. if (!proto) {
  27035. return true;
  27036. }
  27037. Ctor = hasOwn2.call(proto, "constructor") && proto.constructor;
  27038. return typeof Ctor === "function" && fnToString.call(Ctor) === ObjectFunctionString;
  27039. },
  27040. isEmptyObject: function(obj) {
  27041. var name;
  27042. for (name in obj) {
  27043. return false;
  27044. }
  27045. return true;
  27046. },
  27047. globalEval: function(code, options2, doc) {
  27048. DOMEval(code, { nonce: options2 && options2.nonce }, doc);
  27049. },
  27050. each: function(obj, callback2) {
  27051. var length, i2 = 0;
  27052. if (isArrayLike2(obj)) {
  27053. length = obj.length;
  27054. for (; i2 < length; i2++) {
  27055. if (callback2.call(obj[i2], i2, obj[i2]) === false) {
  27056. break;
  27057. }
  27058. }
  27059. } else {
  27060. for (i2 in obj) {
  27061. if (callback2.call(obj[i2], i2, obj[i2]) === false) {
  27062. break;
  27063. }
  27064. }
  27065. }
  27066. return obj;
  27067. },
  27068. text: function(elem) {
  27069. var node, ret = "", i2 = 0, nodeType = elem.nodeType;
  27070. if (!nodeType) {
  27071. while (node = elem[i2++]) {
  27072. ret += jQuery.text(node);
  27073. }
  27074. } else if (nodeType === 1 || nodeType === 9 || nodeType === 11) {
  27075. return elem.textContent;
  27076. } else if (nodeType === 3 || nodeType === 4) {
  27077. return elem.nodeValue;
  27078. }
  27079. return ret;
  27080. },
  27081. makeArray: function(arr2, results) {
  27082. var ret = results || [];
  27083. if (arr2 != null) {
  27084. if (isArrayLike2(Object(arr2))) {
  27085. jQuery.merge(
  27086. ret,
  27087. typeof arr2 === "string" ? [arr2] : arr2
  27088. );
  27089. } else {
  27090. push.call(ret, arr2);
  27091. }
  27092. }
  27093. return ret;
  27094. },
  27095. inArray: function(elem, arr2, i2) {
  27096. return arr2 == null ? -1 : indexOf.call(arr2, elem, i2);
  27097. },
  27098. isXMLDoc: function(elem) {
  27099. var namespace = elem && elem.namespaceURI, docElem = elem && (elem.ownerDocument || elem).documentElement;
  27100. return !rhtmlSuffix.test(namespace || docElem && docElem.nodeName || "HTML");
  27101. },
  27102. merge: function(first, second) {
  27103. var len = +second.length, j = 0, i2 = first.length;
  27104. for (; j < len; j++) {
  27105. first[i2++] = second[j];
  27106. }
  27107. first.length = i2;
  27108. return first;
  27109. },
  27110. grep: function(elems, callback2, invert) {
  27111. var callbackInverse, matches = [], i2 = 0, length = elems.length, callbackExpect = !invert;
  27112. for (; i2 < length; i2++) {
  27113. callbackInverse = !callback2(elems[i2], i2);
  27114. if (callbackInverse !== callbackExpect) {
  27115. matches.push(elems[i2]);
  27116. }
  27117. }
  27118. return matches;
  27119. },
  27120. map: function(elems, callback2, arg) {
  27121. var length, value, i2 = 0, ret = [];
  27122. if (isArrayLike2(elems)) {
  27123. length = elems.length;
  27124. for (; i2 < length; i2++) {
  27125. value = callback2(elems[i2], i2, arg);
  27126. if (value != null) {
  27127. ret.push(value);
  27128. }
  27129. }
  27130. } else {
  27131. for (i2 in elems) {
  27132. value = callback2(elems[i2], i2, arg);
  27133. if (value != null) {
  27134. ret.push(value);
  27135. }
  27136. }
  27137. }
  27138. return flat2(ret);
  27139. },
  27140. guid: 1,
  27141. support
  27142. });
  27143. if (typeof Symbol === "function") {
  27144. jQuery.fn[Symbol.iterator] = arr[Symbol.iterator];
  27145. }
  27146. jQuery.each(
  27147. "Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),
  27148. function(_i, name) {
  27149. class2type["[object " + name + "]"] = name.toLowerCase();
  27150. }
  27151. );
  27152. function isArrayLike2(obj) {
  27153. var length = !!obj && "length" in obj && obj.length, type2 = toType(obj);
  27154. if (isFunction2(obj) || isWindow(obj)) {
  27155. return false;
  27156. }
  27157. return type2 === "array" || length === 0 || typeof length === "number" && length > 0 && length - 1 in obj;
  27158. }
  27159. function nodeName(elem, name) {
  27160. return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
  27161. }
  27162. var pop = arr.pop;
  27163. var sort = arr.sort;
  27164. var splice2 = arr.splice;
  27165. var whitespace = "[\\x20\\t\\r\\n\\f]";
  27166. var rtrimCSS = new RegExp(
  27167. "^" + whitespace + "+|((?:^|[^\\\\])(?:\\\\.)*)" + whitespace + "+$",
  27168. "g"
  27169. );
  27170. jQuery.contains = function(a, b) {
  27171. var bup = b && b.parentNode;
  27172. return a === bup || !!(bup && bup.nodeType === 1 && (a.contains ? a.contains(bup) : a.compareDocumentPosition && a.compareDocumentPosition(bup) & 16));
  27173. };
  27174. var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
  27175. function fcssescape(ch, asCodePoint) {
  27176. if (asCodePoint) {
  27177. if (ch === "\0") {
  27178. return "\uFFFD";
  27179. }
  27180. return ch.slice(0, -1) + "\\" + ch.charCodeAt(ch.length - 1).toString(16) + " ";
  27181. }
  27182. return "\\" + ch;
  27183. }
  27184. jQuery.escapeSelector = function(sel) {
  27185. return (sel + "").replace(rcssescape, fcssescape);
  27186. };
  27187. var preferredDoc = document2, pushNative = push;
  27188. (function() {
  27189. var i2, Expr, outermostContext, sortInput, hasDuplicate, push2 = pushNative, document3, documentElement2, documentIsHTML, rbuggyQSA, matches, expando = jQuery.expando, dirruns = 0, done = 0, classCache = createCache(), tokenCache = createCache(), compilerCache = createCache(), nonnativeSelectorCache = createCache(), sortOrder = function(a, b) {
  27190. if (a === b) {
  27191. hasDuplicate = true;
  27192. }
  27193. return 0;
  27194. }, booleans = "checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped", identifier = "(?:\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+", attributes = "\\[" + whitespace + "*(" + identifier + ")(?:" + whitespace + "*([*^$|!~]?=)" + whitespace + `*(?:'((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)"|(` + identifier + "))|)" + whitespace + "*\\]", pseudos = ":(" + identifier + `)(?:\\((('((?:\\\\.|[^\\\\'])*)'|"((?:\\\\.|[^\\\\"])*)")|((?:\\\\.|[^\\\\()[\\]]|` + attributes + ")*)|.*)\\)|)", rwhitespace = new RegExp(whitespace + "+", "g"), rcomma = new RegExp("^" + whitespace + "*," + whitespace + "*"), rleadingCombinator = new RegExp("^" + whitespace + "*([>+~]|" + whitespace + ")" + whitespace + "*"), rdescend = new RegExp(whitespace + "|>"), rpseudo = new RegExp(pseudos), ridentifier = new RegExp("^" + identifier + "$"), matchExpr = {
  27195. ID: new RegExp("^#(" + identifier + ")"),
  27196. CLASS: new RegExp("^\\.(" + identifier + ")"),
  27197. TAG: new RegExp("^(" + identifier + "|[*])"),
  27198. ATTR: new RegExp("^" + attributes),
  27199. PSEUDO: new RegExp("^" + pseudos),
  27200. CHILD: new RegExp(
  27201. "^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\(" + whitespace + "*(even|odd|(([+-]|)(\\d*)n|)" + whitespace + "*(?:([+-]|)" + whitespace + "*(\\d+)|))" + whitespace + "*\\)|)",
  27202. "i"
  27203. ),
  27204. bool: new RegExp("^(?:" + booleans + ")$", "i"),
  27205. needsContext: new RegExp("^" + whitespace + "*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\(" + whitespace + "*((?:-\\d)?\\d*)" + whitespace + "*\\)|)(?=[^-]|$)", "i")
  27206. }, rinputs = /^(?:input|select|textarea|button)$/i, rheader = /^h\d$/i, rquickExpr2 = /^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/, rsibling = /[+~]/, runescape = new RegExp("\\\\[\\da-fA-F]{1,6}" + whitespace + "?|\\\\([^\\r\\n\\f])", "g"), funescape = function(escape2, nonHex) {
  27207. var high = "0x" + escape2.slice(1) - 65536;
  27208. if (nonHex) {
  27209. return nonHex;
  27210. }
  27211. return high < 0 ? String.fromCharCode(high + 65536) : String.fromCharCode(high >> 10 | 55296, high & 1023 | 56320);
  27212. }, unloadHandler = function() {
  27213. setDocument();
  27214. }, inDisabledFieldset = addCombinator(
  27215. function(elem) {
  27216. return elem.disabled === true && nodeName(elem, "fieldset");
  27217. },
  27218. { dir: "parentNode", next: "legend" }
  27219. );
  27220. function safeActiveElement() {
  27221. try {
  27222. return document3.activeElement;
  27223. } catch (err) {
  27224. }
  27225. }
  27226. try {
  27227. push2.apply(
  27228. arr = slice.call(preferredDoc.childNodes),
  27229. preferredDoc.childNodes
  27230. );
  27231. arr[preferredDoc.childNodes.length].nodeType;
  27232. } catch (e) {
  27233. push2 = {
  27234. apply: function(target, els) {
  27235. pushNative.apply(target, slice.call(els));
  27236. },
  27237. call: function(target) {
  27238. pushNative.apply(target, slice.call(arguments, 1));
  27239. }
  27240. };
  27241. }
  27242. function find2(selector, context, results, seed) {
  27243. var m, i3, elem, nid, match, groups, newSelector, newContext = context && context.ownerDocument, nodeType = context ? context.nodeType : 9;
  27244. results = results || [];
  27245. if (typeof selector !== "string" || !selector || nodeType !== 1 && nodeType !== 9 && nodeType !== 11) {
  27246. return results;
  27247. }
  27248. if (!seed) {
  27249. setDocument(context);
  27250. context = context || document3;
  27251. if (documentIsHTML) {
  27252. if (nodeType !== 11 && (match = rquickExpr2.exec(selector))) {
  27253. if (m = match[1]) {
  27254. if (nodeType === 9) {
  27255. if (elem = context.getElementById(m)) {
  27256. if (elem.id === m) {
  27257. push2.call(results, elem);
  27258. return results;
  27259. }
  27260. } else {
  27261. return results;
  27262. }
  27263. } else {
  27264. if (newContext && (elem = newContext.getElementById(m)) && find2.contains(context, elem) && elem.id === m) {
  27265. push2.call(results, elem);
  27266. return results;
  27267. }
  27268. }
  27269. } else if (match[2]) {
  27270. push2.apply(results, context.getElementsByTagName(selector));
  27271. return results;
  27272. } else if ((m = match[3]) && context.getElementsByClassName) {
  27273. push2.apply(results, context.getElementsByClassName(m));
  27274. return results;
  27275. }
  27276. }
  27277. if (!nonnativeSelectorCache[selector + " "] && (!rbuggyQSA || !rbuggyQSA.test(selector))) {
  27278. newSelector = selector;
  27279. newContext = context;
  27280. if (nodeType === 1 && (rdescend.test(selector) || rleadingCombinator.test(selector))) {
  27281. newContext = rsibling.test(selector) && testContext(context.parentNode) || context;
  27282. if (newContext != context || !support.scope) {
  27283. if (nid = context.getAttribute("id")) {
  27284. nid = jQuery.escapeSelector(nid);
  27285. } else {
  27286. context.setAttribute("id", nid = expando);
  27287. }
  27288. }
  27289. groups = tokenize(selector);
  27290. i3 = groups.length;
  27291. while (i3--) {
  27292. groups[i3] = (nid ? "#" + nid : ":scope") + " " + toSelector(groups[i3]);
  27293. }
  27294. newSelector = groups.join(",");
  27295. }
  27296. try {
  27297. push2.apply(
  27298. results,
  27299. newContext.querySelectorAll(newSelector)
  27300. );
  27301. return results;
  27302. } catch (qsaError) {
  27303. nonnativeSelectorCache(selector, true);
  27304. } finally {
  27305. if (nid === expando) {
  27306. context.removeAttribute("id");
  27307. }
  27308. }
  27309. }
  27310. }
  27311. }
  27312. return select(selector.replace(rtrimCSS, "$1"), context, results, seed);
  27313. }
  27314. function createCache() {
  27315. var keys3 = [];
  27316. function cache(key, value) {
  27317. if (keys3.push(key + " ") > Expr.cacheLength) {
  27318. delete cache[keys3.shift()];
  27319. }
  27320. return cache[key + " "] = value;
  27321. }
  27322. return cache;
  27323. }
  27324. function markFunction(fn2) {
  27325. fn2[expando] = true;
  27326. return fn2;
  27327. }
  27328. function assert(fn2) {
  27329. var el = document3.createElement("fieldset");
  27330. try {
  27331. return !!fn2(el);
  27332. } catch (e) {
  27333. return false;
  27334. } finally {
  27335. if (el.parentNode) {
  27336. el.parentNode.removeChild(el);
  27337. }
  27338. el = null;
  27339. }
  27340. }
  27341. function createInputPseudo(type2) {
  27342. return function(elem) {
  27343. return nodeName(elem, "input") && elem.type === type2;
  27344. };
  27345. }
  27346. function createButtonPseudo(type2) {
  27347. return function(elem) {
  27348. return (nodeName(elem, "input") || nodeName(elem, "button")) && elem.type === type2;
  27349. };
  27350. }
  27351. function createDisabledPseudo(disabled) {
  27352. return function(elem) {
  27353. if ("form" in elem) {
  27354. if (elem.parentNode && elem.disabled === false) {
  27355. if ("label" in elem) {
  27356. if ("label" in elem.parentNode) {
  27357. return elem.parentNode.disabled === disabled;
  27358. } else {
  27359. return elem.disabled === disabled;
  27360. }
  27361. }
  27362. return elem.isDisabled === disabled || elem.isDisabled !== !disabled && inDisabledFieldset(elem) === disabled;
  27363. }
  27364. return elem.disabled === disabled;
  27365. } else if ("label" in elem) {
  27366. return elem.disabled === disabled;
  27367. }
  27368. return false;
  27369. };
  27370. }
  27371. function createPositionalPseudo(fn2) {
  27372. return markFunction(function(argument) {
  27373. argument = +argument;
  27374. return markFunction(function(seed, matches2) {
  27375. var j, matchIndexes = fn2([], seed.length, argument), i3 = matchIndexes.length;
  27376. while (i3--) {
  27377. if (seed[j = matchIndexes[i3]]) {
  27378. seed[j] = !(matches2[j] = seed[j]);
  27379. }
  27380. }
  27381. });
  27382. });
  27383. }
  27384. function testContext(context) {
  27385. return context && typeof context.getElementsByTagName !== "undefined" && context;
  27386. }
  27387. function setDocument(node) {
  27388. var subWindow, doc = node ? node.ownerDocument || node : preferredDoc;
  27389. if (doc == document3 || doc.nodeType !== 9 || !doc.documentElement) {
  27390. return document3;
  27391. }
  27392. document3 = doc;
  27393. documentElement2 = document3.documentElement;
  27394. documentIsHTML = !jQuery.isXMLDoc(document3);
  27395. matches = documentElement2.matches || documentElement2.webkitMatchesSelector || documentElement2.msMatchesSelector;
  27396. if (preferredDoc != document3 && (subWindow = document3.defaultView) && subWindow.top !== subWindow) {
  27397. subWindow.addEventListener("unload", unloadHandler);
  27398. }
  27399. support.getById = assert(function(el) {
  27400. documentElement2.appendChild(el).id = jQuery.expando;
  27401. return !document3.getElementsByName || !document3.getElementsByName(jQuery.expando).length;
  27402. });
  27403. support.disconnectedMatch = assert(function(el) {
  27404. return matches.call(el, "*");
  27405. });
  27406. support.scope = assert(function() {
  27407. return document3.querySelectorAll(":scope");
  27408. });
  27409. support.cssHas = assert(function() {
  27410. try {
  27411. document3.querySelector(":has(*,:jqfake)");
  27412. return false;
  27413. } catch (e) {
  27414. return true;
  27415. }
  27416. });
  27417. if (support.getById) {
  27418. Expr.filter.ID = function(id) {
  27419. var attrId = id.replace(runescape, funescape);
  27420. return function(elem) {
  27421. return elem.getAttribute("id") === attrId;
  27422. };
  27423. };
  27424. Expr.find.ID = function(id, context) {
  27425. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  27426. var elem = context.getElementById(id);
  27427. return elem ? [elem] : [];
  27428. }
  27429. };
  27430. } else {
  27431. Expr.filter.ID = function(id) {
  27432. var attrId = id.replace(runescape, funescape);
  27433. return function(elem) {
  27434. var node2 = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id");
  27435. return node2 && node2.value === attrId;
  27436. };
  27437. };
  27438. Expr.find.ID = function(id, context) {
  27439. if (typeof context.getElementById !== "undefined" && documentIsHTML) {
  27440. var node2, i3, elems, elem = context.getElementById(id);
  27441. if (elem) {
  27442. node2 = elem.getAttributeNode("id");
  27443. if (node2 && node2.value === id) {
  27444. return [elem];
  27445. }
  27446. elems = context.getElementsByName(id);
  27447. i3 = 0;
  27448. while (elem = elems[i3++]) {
  27449. node2 = elem.getAttributeNode("id");
  27450. if (node2 && node2.value === id) {
  27451. return [elem];
  27452. }
  27453. }
  27454. }
  27455. return [];
  27456. }
  27457. };
  27458. }
  27459. Expr.find.TAG = function(tag, context) {
  27460. if (typeof context.getElementsByTagName !== "undefined") {
  27461. return context.getElementsByTagName(tag);
  27462. } else {
  27463. return context.querySelectorAll(tag);
  27464. }
  27465. };
  27466. Expr.find.CLASS = function(className, context) {
  27467. if (typeof context.getElementsByClassName !== "undefined" && documentIsHTML) {
  27468. return context.getElementsByClassName(className);
  27469. }
  27470. };
  27471. rbuggyQSA = [];
  27472. assert(function(el) {
  27473. var input;
  27474. documentElement2.appendChild(el).innerHTML = "<a id='" + expando + "' href='' disabled='disabled'></a><select id='" + expando + "-\r\\' disabled='disabled'><option selected=''></option></select>";
  27475. if (!el.querySelectorAll("[selected]").length) {
  27476. rbuggyQSA.push("\\[" + whitespace + "*(?:value|" + booleans + ")");
  27477. }
  27478. if (!el.querySelectorAll("[id~=" + expando + "-]").length) {
  27479. rbuggyQSA.push("~=");
  27480. }
  27481. if (!el.querySelectorAll("a#" + expando + "+*").length) {
  27482. rbuggyQSA.push(".#.+[+~]");
  27483. }
  27484. if (!el.querySelectorAll(":checked").length) {
  27485. rbuggyQSA.push(":checked");
  27486. }
  27487. input = document3.createElement("input");
  27488. input.setAttribute("type", "hidden");
  27489. el.appendChild(input).setAttribute("name", "D");
  27490. documentElement2.appendChild(el).disabled = true;
  27491. if (el.querySelectorAll(":disabled").length !== 2) {
  27492. rbuggyQSA.push(":enabled", ":disabled");
  27493. }
  27494. input = document3.createElement("input");
  27495. input.setAttribute("name", "");
  27496. el.appendChild(input);
  27497. if (!el.querySelectorAll("[name='']").length) {
  27498. rbuggyQSA.push("\\[" + whitespace + "*name" + whitespace + "*=" + whitespace + `*(?:''|"")`);
  27499. }
  27500. });
  27501. if (!support.cssHas) {
  27502. rbuggyQSA.push(":has");
  27503. }
  27504. rbuggyQSA = rbuggyQSA.length && new RegExp(rbuggyQSA.join("|"));
  27505. sortOrder = function(a, b) {
  27506. if (a === b) {
  27507. hasDuplicate = true;
  27508. return 0;
  27509. }
  27510. var compare = !a.compareDocumentPosition - !b.compareDocumentPosition;
  27511. if (compare) {
  27512. return compare;
  27513. }
  27514. compare = (a.ownerDocument || a) == (b.ownerDocument || b) ? a.compareDocumentPosition(b) : 1;
  27515. if (compare & 1 || !support.sortDetached && b.compareDocumentPosition(a) === compare) {
  27516. if (a === document3 || a.ownerDocument == preferredDoc && find2.contains(preferredDoc, a)) {
  27517. return -1;
  27518. }
  27519. if (b === document3 || b.ownerDocument == preferredDoc && find2.contains(preferredDoc, b)) {
  27520. return 1;
  27521. }
  27522. return sortInput ? indexOf.call(sortInput, a) - indexOf.call(sortInput, b) : 0;
  27523. }
  27524. return compare & 4 ? -1 : 1;
  27525. };
  27526. return document3;
  27527. }
  27528. find2.matches = function(expr, elements) {
  27529. return find2(expr, null, null, elements);
  27530. };
  27531. find2.matchesSelector = function(elem, expr) {
  27532. setDocument(elem);
  27533. if (documentIsHTML && !nonnativeSelectorCache[expr + " "] && (!rbuggyQSA || !rbuggyQSA.test(expr))) {
  27534. try {
  27535. var ret = matches.call(elem, expr);
  27536. if (ret || support.disconnectedMatch || elem.document && elem.document.nodeType !== 11) {
  27537. return ret;
  27538. }
  27539. } catch (e) {
  27540. nonnativeSelectorCache(expr, true);
  27541. }
  27542. }
  27543. return find2(expr, document3, null, [elem]).length > 0;
  27544. };
  27545. find2.contains = function(context, elem) {
  27546. if ((context.ownerDocument || context) != document3) {
  27547. setDocument(context);
  27548. }
  27549. return jQuery.contains(context, elem);
  27550. };
  27551. find2.attr = function(elem, name) {
  27552. if ((elem.ownerDocument || elem) != document3) {
  27553. setDocument(elem);
  27554. }
  27555. var fn2 = Expr.attrHandle[name.toLowerCase()], val = fn2 && hasOwn2.call(Expr.attrHandle, name.toLowerCase()) ? fn2(elem, name, !documentIsHTML) : void 0;
  27556. if (val !== void 0) {
  27557. return val;
  27558. }
  27559. return elem.getAttribute(name);
  27560. };
  27561. find2.error = function(msg) {
  27562. throw new Error("Syntax error, unrecognized expression: " + msg);
  27563. };
  27564. jQuery.uniqueSort = function(results) {
  27565. var elem, duplicates = [], j = 0, i3 = 0;
  27566. hasDuplicate = !support.sortStable;
  27567. sortInput = !support.sortStable && slice.call(results, 0);
  27568. sort.call(results, sortOrder);
  27569. if (hasDuplicate) {
  27570. while (elem = results[i3++]) {
  27571. if (elem === results[i3]) {
  27572. j = duplicates.push(i3);
  27573. }
  27574. }
  27575. while (j--) {
  27576. splice2.call(results, duplicates[j], 1);
  27577. }
  27578. }
  27579. sortInput = null;
  27580. return results;
  27581. };
  27582. jQuery.fn.uniqueSort = function() {
  27583. return this.pushStack(jQuery.uniqueSort(slice.apply(this)));
  27584. };
  27585. Expr = jQuery.expr = {
  27586. cacheLength: 50,
  27587. createPseudo: markFunction,
  27588. match: matchExpr,
  27589. attrHandle: {},
  27590. find: {},
  27591. relative: {
  27592. ">": { dir: "parentNode", first: true },
  27593. " ": { dir: "parentNode" },
  27594. "+": { dir: "previousSibling", first: true },
  27595. "~": { dir: "previousSibling" }
  27596. },
  27597. preFilter: {
  27598. ATTR: function(match) {
  27599. match[1] = match[1].replace(runescape, funescape);
  27600. match[3] = (match[3] || match[4] || match[5] || "").replace(runescape, funescape);
  27601. if (match[2] === "~=") {
  27602. match[3] = " " + match[3] + " ";
  27603. }
  27604. return match.slice(0, 4);
  27605. },
  27606. CHILD: function(match) {
  27607. match[1] = match[1].toLowerCase();
  27608. if (match[1].slice(0, 3) === "nth") {
  27609. if (!match[3]) {
  27610. find2.error(match[0]);
  27611. }
  27612. match[4] = +(match[4] ? match[5] + (match[6] || 1) : 2 * (match[3] === "even" || match[3] === "odd"));
  27613. match[5] = +(match[7] + match[8] || match[3] === "odd");
  27614. } else if (match[3]) {
  27615. find2.error(match[0]);
  27616. }
  27617. return match;
  27618. },
  27619. PSEUDO: function(match) {
  27620. var excess, unquoted = !match[6] && match[2];
  27621. if (matchExpr.CHILD.test(match[0])) {
  27622. return null;
  27623. }
  27624. if (match[3]) {
  27625. match[2] = match[4] || match[5] || "";
  27626. } else if (unquoted && rpseudo.test(unquoted) && (excess = tokenize(unquoted, true)) && (excess = unquoted.indexOf(")", unquoted.length - excess) - unquoted.length)) {
  27627. match[0] = match[0].slice(0, excess);
  27628. match[2] = unquoted.slice(0, excess);
  27629. }
  27630. return match.slice(0, 3);
  27631. }
  27632. },
  27633. filter: {
  27634. TAG: function(nodeNameSelector) {
  27635. var expectedNodeName = nodeNameSelector.replace(runescape, funescape).toLowerCase();
  27636. return nodeNameSelector === "*" ? function() {
  27637. return true;
  27638. } : function(elem) {
  27639. return nodeName(elem, expectedNodeName);
  27640. };
  27641. },
  27642. CLASS: function(className) {
  27643. var pattern = classCache[className + " "];
  27644. return pattern || (pattern = new RegExp("(^|" + whitespace + ")" + className + "(" + whitespace + "|$)")) && classCache(className, function(elem) {
  27645. return pattern.test(
  27646. typeof elem.className === "string" && elem.className || typeof elem.getAttribute !== "undefined" && elem.getAttribute("class") || ""
  27647. );
  27648. });
  27649. },
  27650. ATTR: function(name, operator, check) {
  27651. return function(elem) {
  27652. var result = find2.attr(elem, name);
  27653. if (result == null) {
  27654. return operator === "!=";
  27655. }
  27656. if (!operator) {
  27657. return true;
  27658. }
  27659. result += "";
  27660. if (operator === "=") {
  27661. return result === check;
  27662. }
  27663. if (operator === "!=") {
  27664. return result !== check;
  27665. }
  27666. if (operator === "^=") {
  27667. return check && result.indexOf(check) === 0;
  27668. }
  27669. if (operator === "*=") {
  27670. return check && result.indexOf(check) > -1;
  27671. }
  27672. if (operator === "$=") {
  27673. return check && result.slice(-check.length) === check;
  27674. }
  27675. if (operator === "~=") {
  27676. return (" " + result.replace(rwhitespace, " ") + " ").indexOf(check) > -1;
  27677. }
  27678. if (operator === "|=") {
  27679. return result === check || result.slice(0, check.length + 1) === check + "-";
  27680. }
  27681. return false;
  27682. };
  27683. },
  27684. CHILD: function(type2, what, _argument, first, last) {
  27685. var simple = type2.slice(0, 3) !== "nth", forward = type2.slice(-4) !== "last", ofType = what === "of-type";
  27686. return first === 1 && last === 0 ? function(elem) {
  27687. return !!elem.parentNode;
  27688. } : function(elem, _context, xml) {
  27689. var cache, outerCache, node, nodeIndex, start2, dir2 = simple !== forward ? "nextSibling" : "previousSibling", parent = elem.parentNode, name = ofType && elem.nodeName.toLowerCase(), useCache = !xml && !ofType, diff = false;
  27690. if (parent) {
  27691. if (simple) {
  27692. while (dir2) {
  27693. node = elem;
  27694. while (node = node[dir2]) {
  27695. if (ofType ? nodeName(node, name) : node.nodeType === 1) {
  27696. return false;
  27697. }
  27698. }
  27699. start2 = dir2 = type2 === "only" && !start2 && "nextSibling";
  27700. }
  27701. return true;
  27702. }
  27703. start2 = [forward ? parent.firstChild : parent.lastChild];
  27704. if (forward && useCache) {
  27705. outerCache = parent[expando] || (parent[expando] = {});
  27706. cache = outerCache[type2] || [];
  27707. nodeIndex = cache[0] === dirruns && cache[1];
  27708. diff = nodeIndex && cache[2];
  27709. node = nodeIndex && parent.childNodes[nodeIndex];
  27710. while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start2.pop()) {
  27711. if (node.nodeType === 1 && ++diff && node === elem) {
  27712. outerCache[type2] = [dirruns, nodeIndex, diff];
  27713. break;
  27714. }
  27715. }
  27716. } else {
  27717. if (useCache) {
  27718. outerCache = elem[expando] || (elem[expando] = {});
  27719. cache = outerCache[type2] || [];
  27720. nodeIndex = cache[0] === dirruns && cache[1];
  27721. diff = nodeIndex;
  27722. }
  27723. if (diff === false) {
  27724. while (node = ++nodeIndex && node && node[dir2] || (diff = nodeIndex = 0) || start2.pop()) {
  27725. if ((ofType ? nodeName(node, name) : node.nodeType === 1) && ++diff) {
  27726. if (useCache) {
  27727. outerCache = node[expando] || (node[expando] = {});
  27728. outerCache[type2] = [dirruns, diff];
  27729. }
  27730. if (node === elem) {
  27731. break;
  27732. }
  27733. }
  27734. }
  27735. }
  27736. }
  27737. diff -= last;
  27738. return diff === first || diff % first === 0 && diff / first >= 0;
  27739. }
  27740. };
  27741. },
  27742. PSEUDO: function(pseudo, argument) {
  27743. var args, fn2 = Expr.pseudos[pseudo] || Expr.setFilters[pseudo.toLowerCase()] || find2.error("unsupported pseudo: " + pseudo);
  27744. if (fn2[expando]) {
  27745. return fn2(argument);
  27746. }
  27747. if (fn2.length > 1) {
  27748. args = [pseudo, pseudo, "", argument];
  27749. return Expr.setFilters.hasOwnProperty(pseudo.toLowerCase()) ? markFunction(function(seed, matches2) {
  27750. var idx, matched = fn2(seed, argument), i3 = matched.length;
  27751. while (i3--) {
  27752. idx = indexOf.call(seed, matched[i3]);
  27753. seed[idx] = !(matches2[idx] = matched[i3]);
  27754. }
  27755. }) : function(elem) {
  27756. return fn2(elem, 0, args);
  27757. };
  27758. }
  27759. return fn2;
  27760. }
  27761. },
  27762. pseudos: {
  27763. not: markFunction(function(selector) {
  27764. var input = [], results = [], matcher = compile(selector.replace(rtrimCSS, "$1"));
  27765. return matcher[expando] ? markFunction(function(seed, matches2, _context, xml) {
  27766. var elem, unmatched = matcher(seed, null, xml, []), i3 = seed.length;
  27767. while (i3--) {
  27768. if (elem = unmatched[i3]) {
  27769. seed[i3] = !(matches2[i3] = elem);
  27770. }
  27771. }
  27772. }) : function(elem, _context, xml) {
  27773. input[0] = elem;
  27774. matcher(input, null, xml, results);
  27775. input[0] = null;
  27776. return !results.pop();
  27777. };
  27778. }),
  27779. has: markFunction(function(selector) {
  27780. return function(elem) {
  27781. return find2(selector, elem).length > 0;
  27782. };
  27783. }),
  27784. contains: markFunction(function(text) {
  27785. text = text.replace(runescape, funescape);
  27786. return function(elem) {
  27787. return (elem.textContent || jQuery.text(elem)).indexOf(text) > -1;
  27788. };
  27789. }),
  27790. lang: markFunction(function(lang) {
  27791. if (!ridentifier.test(lang || "")) {
  27792. find2.error("unsupported lang: " + lang);
  27793. }
  27794. lang = lang.replace(runescape, funescape).toLowerCase();
  27795. return function(elem) {
  27796. var elemLang;
  27797. do {
  27798. if (elemLang = documentIsHTML ? elem.lang : elem.getAttribute("xml:lang") || elem.getAttribute("lang")) {
  27799. elemLang = elemLang.toLowerCase();
  27800. return elemLang === lang || elemLang.indexOf(lang + "-") === 0;
  27801. }
  27802. } while ((elem = elem.parentNode) && elem.nodeType === 1);
  27803. return false;
  27804. };
  27805. }),
  27806. target: function(elem) {
  27807. var hash = window2.location && window2.location.hash;
  27808. return hash && hash.slice(1) === elem.id;
  27809. },
  27810. root: function(elem) {
  27811. return elem === documentElement2;
  27812. },
  27813. focus: function(elem) {
  27814. return elem === safeActiveElement() && document3.hasFocus() && !!(elem.type || elem.href || ~elem.tabIndex);
  27815. },
  27816. enabled: createDisabledPseudo(false),
  27817. disabled: createDisabledPseudo(true),
  27818. checked: function(elem) {
  27819. return nodeName(elem, "input") && !!elem.checked || nodeName(elem, "option") && !!elem.selected;
  27820. },
  27821. selected: function(elem) {
  27822. if (elem.parentNode) {
  27823. elem.parentNode.selectedIndex;
  27824. }
  27825. return elem.selected === true;
  27826. },
  27827. empty: function(elem) {
  27828. for (elem = elem.firstChild; elem; elem = elem.nextSibling) {
  27829. if (elem.nodeType < 6) {
  27830. return false;
  27831. }
  27832. }
  27833. return true;
  27834. },
  27835. parent: function(elem) {
  27836. return !Expr.pseudos.empty(elem);
  27837. },
  27838. header: function(elem) {
  27839. return rheader.test(elem.nodeName);
  27840. },
  27841. input: function(elem) {
  27842. return rinputs.test(elem.nodeName);
  27843. },
  27844. button: function(elem) {
  27845. return nodeName(elem, "input") && elem.type === "button" || nodeName(elem, "button");
  27846. },
  27847. text: function(elem) {
  27848. var attr;
  27849. return nodeName(elem, "input") && elem.type === "text" && ((attr = elem.getAttribute("type")) == null || attr.toLowerCase() === "text");
  27850. },
  27851. first: createPositionalPseudo(function() {
  27852. return [0];
  27853. }),
  27854. last: createPositionalPseudo(function(_matchIndexes, length) {
  27855. return [length - 1];
  27856. }),
  27857. eq: createPositionalPseudo(function(_matchIndexes, length, argument) {
  27858. return [argument < 0 ? argument + length : argument];
  27859. }),
  27860. even: createPositionalPseudo(function(matchIndexes, length) {
  27861. var i3 = 0;
  27862. for (; i3 < length; i3 += 2) {
  27863. matchIndexes.push(i3);
  27864. }
  27865. return matchIndexes;
  27866. }),
  27867. odd: createPositionalPseudo(function(matchIndexes, length) {
  27868. var i3 = 1;
  27869. for (; i3 < length; i3 += 2) {
  27870. matchIndexes.push(i3);
  27871. }
  27872. return matchIndexes;
  27873. }),
  27874. lt: createPositionalPseudo(function(matchIndexes, length, argument) {
  27875. var i3;
  27876. if (argument < 0) {
  27877. i3 = argument + length;
  27878. } else if (argument > length) {
  27879. i3 = length;
  27880. } else {
  27881. i3 = argument;
  27882. }
  27883. for (; --i3 >= 0; ) {
  27884. matchIndexes.push(i3);
  27885. }
  27886. return matchIndexes;
  27887. }),
  27888. gt: createPositionalPseudo(function(matchIndexes, length, argument) {
  27889. var i3 = argument < 0 ? argument + length : argument;
  27890. for (; ++i3 < length; ) {
  27891. matchIndexes.push(i3);
  27892. }
  27893. return matchIndexes;
  27894. })
  27895. }
  27896. };
  27897. Expr.pseudos.nth = Expr.pseudos.eq;
  27898. for (i2 in { radio: true, checkbox: true, file: true, password: true, image: true }) {
  27899. Expr.pseudos[i2] = createInputPseudo(i2);
  27900. }
  27901. for (i2 in { submit: true, reset: true }) {
  27902. Expr.pseudos[i2] = createButtonPseudo(i2);
  27903. }
  27904. function setFilters() {
  27905. }
  27906. setFilters.prototype = Expr.filters = Expr.pseudos;
  27907. Expr.setFilters = new setFilters();
  27908. function tokenize(selector, parseOnly) {
  27909. var matched, match, tokens, type2, soFar, groups, preFilters, cached = tokenCache[selector + " "];
  27910. if (cached) {
  27911. return parseOnly ? 0 : cached.slice(0);
  27912. }
  27913. soFar = selector;
  27914. groups = [];
  27915. preFilters = Expr.preFilter;
  27916. while (soFar) {
  27917. if (!matched || (match = rcomma.exec(soFar))) {
  27918. if (match) {
  27919. soFar = soFar.slice(match[0].length) || soFar;
  27920. }
  27921. groups.push(tokens = []);
  27922. }
  27923. matched = false;
  27924. if (match = rleadingCombinator.exec(soFar)) {
  27925. matched = match.shift();
  27926. tokens.push({
  27927. value: matched,
  27928. type: match[0].replace(rtrimCSS, " ")
  27929. });
  27930. soFar = soFar.slice(matched.length);
  27931. }
  27932. for (type2 in Expr.filter) {
  27933. if ((match = matchExpr[type2].exec(soFar)) && (!preFilters[type2] || (match = preFilters[type2](match)))) {
  27934. matched = match.shift();
  27935. tokens.push({
  27936. value: matched,
  27937. type: type2,
  27938. matches: match
  27939. });
  27940. soFar = soFar.slice(matched.length);
  27941. }
  27942. }
  27943. if (!matched) {
  27944. break;
  27945. }
  27946. }
  27947. if (parseOnly) {
  27948. return soFar.length;
  27949. }
  27950. return soFar ? find2.error(selector) : tokenCache(selector, groups).slice(0);
  27951. }
  27952. function toSelector(tokens) {
  27953. var i3 = 0, len = tokens.length, selector = "";
  27954. for (; i3 < len; i3++) {
  27955. selector += tokens[i3].value;
  27956. }
  27957. return selector;
  27958. }
  27959. function addCombinator(matcher, combinator, base2) {
  27960. var dir2 = combinator.dir, skip = combinator.next, key = skip || dir2, checkNonElements = base2 && key === "parentNode", doneName = done++;
  27961. return combinator.first ? function(elem, context, xml) {
  27962. while (elem = elem[dir2]) {
  27963. if (elem.nodeType === 1 || checkNonElements) {
  27964. return matcher(elem, context, xml);
  27965. }
  27966. }
  27967. return false;
  27968. } : function(elem, context, xml) {
  27969. var oldCache, outerCache, newCache = [dirruns, doneName];
  27970. if (xml) {
  27971. while (elem = elem[dir2]) {
  27972. if (elem.nodeType === 1 || checkNonElements) {
  27973. if (matcher(elem, context, xml)) {
  27974. return true;
  27975. }
  27976. }
  27977. }
  27978. } else {
  27979. while (elem = elem[dir2]) {
  27980. if (elem.nodeType === 1 || checkNonElements) {
  27981. outerCache = elem[expando] || (elem[expando] = {});
  27982. if (skip && nodeName(elem, skip)) {
  27983. elem = elem[dir2] || elem;
  27984. } else if ((oldCache = outerCache[key]) && oldCache[0] === dirruns && oldCache[1] === doneName) {
  27985. return newCache[2] = oldCache[2];
  27986. } else {
  27987. outerCache[key] = newCache;
  27988. if (newCache[2] = matcher(elem, context, xml)) {
  27989. return true;
  27990. }
  27991. }
  27992. }
  27993. }
  27994. }
  27995. return false;
  27996. };
  27997. }
  27998. function elementMatcher(matchers2) {
  27999. return matchers2.length > 1 ? function(elem, context, xml) {
  28000. var i3 = matchers2.length;
  28001. while (i3--) {
  28002. if (!matchers2[i3](elem, context, xml)) {
  28003. return false;
  28004. }
  28005. }
  28006. return true;
  28007. } : matchers2[0];
  28008. }
  28009. function multipleContexts(selector, contexts, results) {
  28010. var i3 = 0, len = contexts.length;
  28011. for (; i3 < len; i3++) {
  28012. find2(selector, contexts[i3], results);
  28013. }
  28014. return results;
  28015. }
  28016. function condense(unmatched, map, filter, context, xml) {
  28017. var elem, newUnmatched = [], i3 = 0, len = unmatched.length, mapped = map != null;
  28018. for (; i3 < len; i3++) {
  28019. if (elem = unmatched[i3]) {
  28020. if (!filter || filter(elem, context, xml)) {
  28021. newUnmatched.push(elem);
  28022. if (mapped) {
  28023. map.push(i3);
  28024. }
  28025. }
  28026. }
  28027. }
  28028. return newUnmatched;
  28029. }
  28030. function setMatcher(preFilter, selector, matcher, postFilter, postFinder, postSelector) {
  28031. if (postFilter && !postFilter[expando]) {
  28032. postFilter = setMatcher(postFilter);
  28033. }
  28034. if (postFinder && !postFinder[expando]) {
  28035. postFinder = setMatcher(postFinder, postSelector);
  28036. }
  28037. return markFunction(function(seed, results, context, xml) {
  28038. var temp, i3, elem, matcherOut, preMap = [], postMap = [], preexisting = results.length, elems = seed || multipleContexts(
  28039. selector || "*",
  28040. context.nodeType ? [context] : context,
  28041. []
  28042. ), matcherIn = preFilter && (seed || !selector) ? condense(elems, preMap, preFilter, context, xml) : elems;
  28043. if (matcher) {
  28044. matcherOut = postFinder || (seed ? preFilter : preexisting || postFilter) ? [] : results;
  28045. matcher(matcherIn, matcherOut, context, xml);
  28046. } else {
  28047. matcherOut = matcherIn;
  28048. }
  28049. if (postFilter) {
  28050. temp = condense(matcherOut, postMap);
  28051. postFilter(temp, [], context, xml);
  28052. i3 = temp.length;
  28053. while (i3--) {
  28054. if (elem = temp[i3]) {
  28055. matcherOut[postMap[i3]] = !(matcherIn[postMap[i3]] = elem);
  28056. }
  28057. }
  28058. }
  28059. if (seed) {
  28060. if (postFinder || preFilter) {
  28061. if (postFinder) {
  28062. temp = [];
  28063. i3 = matcherOut.length;
  28064. while (i3--) {
  28065. if (elem = matcherOut[i3]) {
  28066. temp.push(matcherIn[i3] = elem);
  28067. }
  28068. }
  28069. postFinder(null, matcherOut = [], temp, xml);
  28070. }
  28071. i3 = matcherOut.length;
  28072. while (i3--) {
  28073. if ((elem = matcherOut[i3]) && (temp = postFinder ? indexOf.call(seed, elem) : preMap[i3]) > -1) {
  28074. seed[temp] = !(results[temp] = elem);
  28075. }
  28076. }
  28077. }
  28078. } else {
  28079. matcherOut = condense(
  28080. matcherOut === results ? matcherOut.splice(preexisting, matcherOut.length) : matcherOut
  28081. );
  28082. if (postFinder) {
  28083. postFinder(null, results, matcherOut, xml);
  28084. } else {
  28085. push2.apply(results, matcherOut);
  28086. }
  28087. }
  28088. });
  28089. }
  28090. function matcherFromTokens(tokens) {
  28091. var checkContext, matcher, j, len = tokens.length, leadingRelative = Expr.relative[tokens[0].type], implicitRelative = leadingRelative || Expr.relative[" "], i3 = leadingRelative ? 1 : 0, matchContext = addCombinator(function(elem) {
  28092. return elem === checkContext;
  28093. }, implicitRelative, true), matchAnyContext = addCombinator(function(elem) {
  28094. return indexOf.call(checkContext, elem) > -1;
  28095. }, implicitRelative, true), matchers2 = [function(elem, context, xml) {
  28096. var ret = !leadingRelative && (xml || context != outermostContext) || ((checkContext = context).nodeType ? matchContext(elem, context, xml) : matchAnyContext(elem, context, xml));
  28097. checkContext = null;
  28098. return ret;
  28099. }];
  28100. for (; i3 < len; i3++) {
  28101. if (matcher = Expr.relative[tokens[i3].type]) {
  28102. matchers2 = [addCombinator(elementMatcher(matchers2), matcher)];
  28103. } else {
  28104. matcher = Expr.filter[tokens[i3].type].apply(null, tokens[i3].matches);
  28105. if (matcher[expando]) {
  28106. j = ++i3;
  28107. for (; j < len; j++) {
  28108. if (Expr.relative[tokens[j].type]) {
  28109. break;
  28110. }
  28111. }
  28112. return setMatcher(
  28113. i3 > 1 && elementMatcher(matchers2),
  28114. i3 > 1 && toSelector(
  28115. tokens.slice(0, i3 - 1).concat({ value: tokens[i3 - 2].type === " " ? "*" : "" })
  28116. ).replace(rtrimCSS, "$1"),
  28117. matcher,
  28118. i3 < j && matcherFromTokens(tokens.slice(i3, j)),
  28119. j < len && matcherFromTokens(tokens = tokens.slice(j)),
  28120. j < len && toSelector(tokens)
  28121. );
  28122. }
  28123. matchers2.push(matcher);
  28124. }
  28125. }
  28126. return elementMatcher(matchers2);
  28127. }
  28128. function matcherFromGroupMatchers(elementMatchers, setMatchers) {
  28129. var bySet = setMatchers.length > 0, byElement = elementMatchers.length > 0, superMatcher = function(seed, context, xml, results, outermost) {
  28130. var elem, j, matcher, matchedCount = 0, i3 = "0", unmatched = seed && [], setMatched = [], contextBackup = outermostContext, elems = seed || byElement && Expr.find.TAG("*", outermost), dirrunsUnique = dirruns += contextBackup == null ? 1 : Math.random() || 0.1, len = elems.length;
  28131. if (outermost) {
  28132. outermostContext = context == document3 || context || outermost;
  28133. }
  28134. for (; i3 !== len && (elem = elems[i3]) != null; i3++) {
  28135. if (byElement && elem) {
  28136. j = 0;
  28137. if (!context && elem.ownerDocument != document3) {
  28138. setDocument(elem);
  28139. xml = !documentIsHTML;
  28140. }
  28141. while (matcher = elementMatchers[j++]) {
  28142. if (matcher(elem, context || document3, xml)) {
  28143. push2.call(results, elem);
  28144. break;
  28145. }
  28146. }
  28147. if (outermost) {
  28148. dirruns = dirrunsUnique;
  28149. }
  28150. }
  28151. if (bySet) {
  28152. if (elem = !matcher && elem) {
  28153. matchedCount--;
  28154. }
  28155. if (seed) {
  28156. unmatched.push(elem);
  28157. }
  28158. }
  28159. }
  28160. matchedCount += i3;
  28161. if (bySet && i3 !== matchedCount) {
  28162. j = 0;
  28163. while (matcher = setMatchers[j++]) {
  28164. matcher(unmatched, setMatched, context, xml);
  28165. }
  28166. if (seed) {
  28167. if (matchedCount > 0) {
  28168. while (i3--) {
  28169. if (!(unmatched[i3] || setMatched[i3])) {
  28170. setMatched[i3] = pop.call(results);
  28171. }
  28172. }
  28173. }
  28174. setMatched = condense(setMatched);
  28175. }
  28176. push2.apply(results, setMatched);
  28177. if (outermost && !seed && setMatched.length > 0 && matchedCount + setMatchers.length > 1) {
  28178. jQuery.uniqueSort(results);
  28179. }
  28180. }
  28181. if (outermost) {
  28182. dirruns = dirrunsUnique;
  28183. outermostContext = contextBackup;
  28184. }
  28185. return unmatched;
  28186. };
  28187. return bySet ? markFunction(superMatcher) : superMatcher;
  28188. }
  28189. function compile(selector, match) {
  28190. var i3, setMatchers = [], elementMatchers = [], cached = compilerCache[selector + " "];
  28191. if (!cached) {
  28192. if (!match) {
  28193. match = tokenize(selector);
  28194. }
  28195. i3 = match.length;
  28196. while (i3--) {
  28197. cached = matcherFromTokens(match[i3]);
  28198. if (cached[expando]) {
  28199. setMatchers.push(cached);
  28200. } else {
  28201. elementMatchers.push(cached);
  28202. }
  28203. }
  28204. cached = compilerCache(
  28205. selector,
  28206. matcherFromGroupMatchers(elementMatchers, setMatchers)
  28207. );
  28208. cached.selector = selector;
  28209. }
  28210. return cached;
  28211. }
  28212. function select(selector, context, results, seed) {
  28213. var i3, tokens, token, type2, find3, compiled = typeof selector === "function" && selector, match = !seed && tokenize(selector = compiled.selector || selector);
  28214. results = results || [];
  28215. if (match.length === 1) {
  28216. tokens = match[0] = match[0].slice(0);
  28217. if (tokens.length > 2 && (token = tokens[0]).type === "ID" && context.nodeType === 9 && documentIsHTML && Expr.relative[tokens[1].type]) {
  28218. context = (Expr.find.ID(
  28219. token.matches[0].replace(runescape, funescape),
  28220. context
  28221. ) || [])[0];
  28222. if (!context) {
  28223. return results;
  28224. } else if (compiled) {
  28225. context = context.parentNode;
  28226. }
  28227. selector = selector.slice(tokens.shift().value.length);
  28228. }
  28229. i3 = matchExpr.needsContext.test(selector) ? 0 : tokens.length;
  28230. while (i3--) {
  28231. token = tokens[i3];
  28232. if (Expr.relative[type2 = token.type]) {
  28233. break;
  28234. }
  28235. if (find3 = Expr.find[type2]) {
  28236. if (seed = find3(
  28237. token.matches[0].replace(runescape, funescape),
  28238. rsibling.test(tokens[0].type) && testContext(context.parentNode) || context
  28239. )) {
  28240. tokens.splice(i3, 1);
  28241. selector = seed.length && toSelector(tokens);
  28242. if (!selector) {
  28243. push2.apply(results, seed);
  28244. return results;
  28245. }
  28246. break;
  28247. }
  28248. }
  28249. }
  28250. }
  28251. (compiled || compile(selector, match))(
  28252. seed,
  28253. context,
  28254. !documentIsHTML,
  28255. results,
  28256. !context || rsibling.test(selector) && testContext(context.parentNode) || context
  28257. );
  28258. return results;
  28259. }
  28260. support.sortStable = expando.split("").sort(sortOrder).join("") === expando;
  28261. setDocument();
  28262. support.sortDetached = assert(function(el) {
  28263. return el.compareDocumentPosition(document3.createElement("fieldset")) & 1;
  28264. });
  28265. jQuery.find = find2;
  28266. jQuery.expr[":"] = jQuery.expr.pseudos;
  28267. jQuery.unique = jQuery.uniqueSort;
  28268. find2.compile = compile;
  28269. find2.select = select;
  28270. find2.setDocument = setDocument;
  28271. find2.escape = jQuery.escapeSelector;
  28272. find2.getText = jQuery.text;
  28273. find2.isXML = jQuery.isXMLDoc;
  28274. find2.selectors = jQuery.expr;
  28275. find2.support = jQuery.support;
  28276. find2.uniqueSort = jQuery.uniqueSort;
  28277. })();
  28278. var dir = function(elem, dir2, until) {
  28279. var matched = [], truncate = until !== void 0;
  28280. while ((elem = elem[dir2]) && elem.nodeType !== 9) {
  28281. if (elem.nodeType === 1) {
  28282. if (truncate && jQuery(elem).is(until)) {
  28283. break;
  28284. }
  28285. matched.push(elem);
  28286. }
  28287. }
  28288. return matched;
  28289. };
  28290. var siblings = function(n, elem) {
  28291. var matched = [];
  28292. for (; n; n = n.nextSibling) {
  28293. if (n.nodeType === 1 && n !== elem) {
  28294. matched.push(n);
  28295. }
  28296. }
  28297. return matched;
  28298. };
  28299. var rneedsContext = jQuery.expr.match.needsContext;
  28300. var rsingleTag = /^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;
  28301. function winnow(elements, qualifier, not) {
  28302. if (isFunction2(qualifier)) {
  28303. return jQuery.grep(elements, function(elem, i2) {
  28304. return !!qualifier.call(elem, i2, elem) !== not;
  28305. });
  28306. }
  28307. if (qualifier.nodeType) {
  28308. return jQuery.grep(elements, function(elem) {
  28309. return elem === qualifier !== not;
  28310. });
  28311. }
  28312. if (typeof qualifier !== "string") {
  28313. return jQuery.grep(elements, function(elem) {
  28314. return indexOf.call(qualifier, elem) > -1 !== not;
  28315. });
  28316. }
  28317. return jQuery.filter(qualifier, elements, not);
  28318. }
  28319. jQuery.filter = function(expr, elems, not) {
  28320. var elem = elems[0];
  28321. if (not) {
  28322. expr = ":not(" + expr + ")";
  28323. }
  28324. if (elems.length === 1 && elem.nodeType === 1) {
  28325. return jQuery.find.matchesSelector(elem, expr) ? [elem] : [];
  28326. }
  28327. return jQuery.find.matches(expr, jQuery.grep(elems, function(elem2) {
  28328. return elem2.nodeType === 1;
  28329. }));
  28330. };
  28331. jQuery.fn.extend({
  28332. find: function(selector) {
  28333. var i2, ret, len = this.length, self2 = this;
  28334. if (typeof selector !== "string") {
  28335. return this.pushStack(jQuery(selector).filter(function() {
  28336. for (i2 = 0; i2 < len; i2++) {
  28337. if (jQuery.contains(self2[i2], this)) {
  28338. return true;
  28339. }
  28340. }
  28341. }));
  28342. }
  28343. ret = this.pushStack([]);
  28344. for (i2 = 0; i2 < len; i2++) {
  28345. jQuery.find(selector, self2[i2], ret);
  28346. }
  28347. return len > 1 ? jQuery.uniqueSort(ret) : ret;
  28348. },
  28349. filter: function(selector) {
  28350. return this.pushStack(winnow(this, selector || [], false));
  28351. },
  28352. not: function(selector) {
  28353. return this.pushStack(winnow(this, selector || [], true));
  28354. },
  28355. is: function(selector) {
  28356. return !!winnow(
  28357. this,
  28358. typeof selector === "string" && rneedsContext.test(selector) ? jQuery(selector) : selector || [],
  28359. false
  28360. ).length;
  28361. }
  28362. });
  28363. var rootjQuery, rquickExpr = /^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/, init = jQuery.fn.init = function(selector, context, root2) {
  28364. var match, elem;
  28365. if (!selector) {
  28366. return this;
  28367. }
  28368. root2 = root2 || rootjQuery;
  28369. if (typeof selector === "string") {
  28370. if (selector[0] === "<" && selector[selector.length - 1] === ">" && selector.length >= 3) {
  28371. match = [null, selector, null];
  28372. } else {
  28373. match = rquickExpr.exec(selector);
  28374. }
  28375. if (match && (match[1] || !context)) {
  28376. if (match[1]) {
  28377. context = context instanceof jQuery ? context[0] : context;
  28378. jQuery.merge(this, jQuery.parseHTML(
  28379. match[1],
  28380. context && context.nodeType ? context.ownerDocument || context : document2,
  28381. true
  28382. ));
  28383. if (rsingleTag.test(match[1]) && jQuery.isPlainObject(context)) {
  28384. for (match in context) {
  28385. if (isFunction2(this[match])) {
  28386. this[match](context[match]);
  28387. } else {
  28388. this.attr(match, context[match]);
  28389. }
  28390. }
  28391. }
  28392. return this;
  28393. } else {
  28394. elem = document2.getElementById(match[2]);
  28395. if (elem) {
  28396. this[0] = elem;
  28397. this.length = 1;
  28398. }
  28399. return this;
  28400. }
  28401. } else if (!context || context.jquery) {
  28402. return (context || root2).find(selector);
  28403. } else {
  28404. return this.constructor(context).find(selector);
  28405. }
  28406. } else if (selector.nodeType) {
  28407. this[0] = selector;
  28408. this.length = 1;
  28409. return this;
  28410. } else if (isFunction2(selector)) {
  28411. return root2.ready !== void 0 ? root2.ready(selector) : selector(jQuery);
  28412. }
  28413. return jQuery.makeArray(selector, this);
  28414. };
  28415. init.prototype = jQuery.fn;
  28416. rootjQuery = jQuery(document2);
  28417. var rparentsprev = /^(?:parents|prev(?:Until|All))/, guaranteedUnique = {
  28418. children: true,
  28419. contents: true,
  28420. next: true,
  28421. prev: true
  28422. };
  28423. jQuery.fn.extend({
  28424. has: function(target) {
  28425. var targets = jQuery(target, this), l = targets.length;
  28426. return this.filter(function() {
  28427. var i2 = 0;
  28428. for (; i2 < l; i2++) {
  28429. if (jQuery.contains(this, targets[i2])) {
  28430. return true;
  28431. }
  28432. }
  28433. });
  28434. },
  28435. closest: function(selectors, context) {
  28436. var cur, i2 = 0, l = this.length, matched = [], targets = typeof selectors !== "string" && jQuery(selectors);
  28437. if (!rneedsContext.test(selectors)) {
  28438. for (; i2 < l; i2++) {
  28439. for (cur = this[i2]; cur && cur !== context; cur = cur.parentNode) {
  28440. if (cur.nodeType < 11 && (targets ? targets.index(cur) > -1 : cur.nodeType === 1 && jQuery.find.matchesSelector(cur, selectors))) {
  28441. matched.push(cur);
  28442. break;
  28443. }
  28444. }
  28445. }
  28446. }
  28447. return this.pushStack(matched.length > 1 ? jQuery.uniqueSort(matched) : matched);
  28448. },
  28449. index: function(elem) {
  28450. if (!elem) {
  28451. return this[0] && this[0].parentNode ? this.first().prevAll().length : -1;
  28452. }
  28453. if (typeof elem === "string") {
  28454. return indexOf.call(jQuery(elem), this[0]);
  28455. }
  28456. return indexOf.call(
  28457. this,
  28458. elem.jquery ? elem[0] : elem
  28459. );
  28460. },
  28461. add: function(selector, context) {
  28462. return this.pushStack(
  28463. jQuery.uniqueSort(
  28464. jQuery.merge(this.get(), jQuery(selector, context))
  28465. )
  28466. );
  28467. },
  28468. addBack: function(selector) {
  28469. return this.add(
  28470. selector == null ? this.prevObject : this.prevObject.filter(selector)
  28471. );
  28472. }
  28473. });
  28474. function sibling(cur, dir2) {
  28475. while ((cur = cur[dir2]) && cur.nodeType !== 1) {
  28476. }
  28477. return cur;
  28478. }
  28479. jQuery.each({
  28480. parent: function(elem) {
  28481. var parent = elem.parentNode;
  28482. return parent && parent.nodeType !== 11 ? parent : null;
  28483. },
  28484. parents: function(elem) {
  28485. return dir(elem, "parentNode");
  28486. },
  28487. parentsUntil: function(elem, _i, until) {
  28488. return dir(elem, "parentNode", until);
  28489. },
  28490. next: function(elem) {
  28491. return sibling(elem, "nextSibling");
  28492. },
  28493. prev: function(elem) {
  28494. return sibling(elem, "previousSibling");
  28495. },
  28496. nextAll: function(elem) {
  28497. return dir(elem, "nextSibling");
  28498. },
  28499. prevAll: function(elem) {
  28500. return dir(elem, "previousSibling");
  28501. },
  28502. nextUntil: function(elem, _i, until) {
  28503. return dir(elem, "nextSibling", until);
  28504. },
  28505. prevUntil: function(elem, _i, until) {
  28506. return dir(elem, "previousSibling", until);
  28507. },
  28508. siblings: function(elem) {
  28509. return siblings((elem.parentNode || {}).firstChild, elem);
  28510. },
  28511. children: function(elem) {
  28512. return siblings(elem.firstChild);
  28513. },
  28514. contents: function(elem) {
  28515. if (elem.contentDocument != null && getProto(elem.contentDocument)) {
  28516. return elem.contentDocument;
  28517. }
  28518. if (nodeName(elem, "template")) {
  28519. elem = elem.content || elem;
  28520. }
  28521. return jQuery.merge([], elem.childNodes);
  28522. }
  28523. }, function(name, fn2) {
  28524. jQuery.fn[name] = function(until, selector) {
  28525. var matched = jQuery.map(this, fn2, until);
  28526. if (name.slice(-5) !== "Until") {
  28527. selector = until;
  28528. }
  28529. if (selector && typeof selector === "string") {
  28530. matched = jQuery.filter(selector, matched);
  28531. }
  28532. if (this.length > 1) {
  28533. if (!guaranteedUnique[name]) {
  28534. jQuery.uniqueSort(matched);
  28535. }
  28536. if (rparentsprev.test(name)) {
  28537. matched.reverse();
  28538. }
  28539. }
  28540. return this.pushStack(matched);
  28541. };
  28542. });
  28543. var rnothtmlwhite = /[^\x20\t\r\n\f]+/g;
  28544. function createOptions(options2) {
  28545. var object = {};
  28546. jQuery.each(options2.match(rnothtmlwhite) || [], function(_, flag) {
  28547. object[flag] = true;
  28548. });
  28549. return object;
  28550. }
  28551. jQuery.Callbacks = function(options2) {
  28552. options2 = typeof options2 === "string" ? createOptions(options2) : jQuery.extend({}, options2);
  28553. var firing, memory, fired, locked, list = [], queue = [], firingIndex = -1, fire = function() {
  28554. locked = locked || options2.once;
  28555. fired = firing = true;
  28556. for (; queue.length; firingIndex = -1) {
  28557. memory = queue.shift();
  28558. while (++firingIndex < list.length) {
  28559. if (list[firingIndex].apply(memory[0], memory[1]) === false && options2.stopOnFalse) {
  28560. firingIndex = list.length;
  28561. memory = false;
  28562. }
  28563. }
  28564. }
  28565. if (!options2.memory) {
  28566. memory = false;
  28567. }
  28568. firing = false;
  28569. if (locked) {
  28570. if (memory) {
  28571. list = [];
  28572. } else {
  28573. list = "";
  28574. }
  28575. }
  28576. }, self2 = {
  28577. add: function() {
  28578. if (list) {
  28579. if (memory && !firing) {
  28580. firingIndex = list.length - 1;
  28581. queue.push(memory);
  28582. }
  28583. (function add(args) {
  28584. jQuery.each(args, function(_, arg) {
  28585. if (isFunction2(arg)) {
  28586. if (!options2.unique || !self2.has(arg)) {
  28587. list.push(arg);
  28588. }
  28589. } else if (arg && arg.length && toType(arg) !== "string") {
  28590. add(arg);
  28591. }
  28592. });
  28593. })(arguments);
  28594. if (memory && !firing) {
  28595. fire();
  28596. }
  28597. }
  28598. return this;
  28599. },
  28600. remove: function() {
  28601. jQuery.each(arguments, function(_, arg) {
  28602. var index2;
  28603. while ((index2 = jQuery.inArray(arg, list, index2)) > -1) {
  28604. list.splice(index2, 1);
  28605. if (index2 <= firingIndex) {
  28606. firingIndex--;
  28607. }
  28608. }
  28609. });
  28610. return this;
  28611. },
  28612. has: function(fn2) {
  28613. return fn2 ? jQuery.inArray(fn2, list) > -1 : list.length > 0;
  28614. },
  28615. empty: function() {
  28616. if (list) {
  28617. list = [];
  28618. }
  28619. return this;
  28620. },
  28621. disable: function() {
  28622. locked = queue = [];
  28623. list = memory = "";
  28624. return this;
  28625. },
  28626. disabled: function() {
  28627. return !list;
  28628. },
  28629. lock: function() {
  28630. locked = queue = [];
  28631. if (!memory && !firing) {
  28632. list = memory = "";
  28633. }
  28634. return this;
  28635. },
  28636. locked: function() {
  28637. return !!locked;
  28638. },
  28639. fireWith: function(context, args) {
  28640. if (!locked) {
  28641. args = args || [];
  28642. args = [context, args.slice ? args.slice() : args];
  28643. queue.push(args);
  28644. if (!firing) {
  28645. fire();
  28646. }
  28647. }
  28648. return this;
  28649. },
  28650. fire: function() {
  28651. self2.fireWith(this, arguments);
  28652. return this;
  28653. },
  28654. fired: function() {
  28655. return !!fired;
  28656. }
  28657. };
  28658. return self2;
  28659. };
  28660. function Identity(v) {
  28661. return v;
  28662. }
  28663. function Thrower(ex) {
  28664. throw ex;
  28665. }
  28666. function adoptValue(value, resolve2, reject2, noValue) {
  28667. var method;
  28668. try {
  28669. if (value && isFunction2(method = value.promise)) {
  28670. method.call(value).done(resolve2).fail(reject2);
  28671. } else if (value && isFunction2(method = value.then)) {
  28672. method.call(value, resolve2, reject2);
  28673. } else {
  28674. resolve2.apply(void 0, [value].slice(noValue));
  28675. }
  28676. } catch (value2) {
  28677. reject2.apply(void 0, [value2]);
  28678. }
  28679. }
  28680. jQuery.extend({
  28681. Deferred: function(func) {
  28682. var tuples = [
  28683. [
  28684. "notify",
  28685. "progress",
  28686. jQuery.Callbacks("memory"),
  28687. jQuery.Callbacks("memory"),
  28688. 2
  28689. ],
  28690. [
  28691. "resolve",
  28692. "done",
  28693. jQuery.Callbacks("once memory"),
  28694. jQuery.Callbacks("once memory"),
  28695. 0,
  28696. "resolved"
  28697. ],
  28698. [
  28699. "reject",
  28700. "fail",
  28701. jQuery.Callbacks("once memory"),
  28702. jQuery.Callbacks("once memory"),
  28703. 1,
  28704. "rejected"
  28705. ]
  28706. ], state = "pending", promise = {
  28707. state: function() {
  28708. return state;
  28709. },
  28710. always: function() {
  28711. deferred.done(arguments).fail(arguments);
  28712. return this;
  28713. },
  28714. "catch": function(fn2) {
  28715. return promise.then(null, fn2);
  28716. },
  28717. pipe: function() {
  28718. var fns = arguments;
  28719. return jQuery.Deferred(function(newDefer) {
  28720. jQuery.each(tuples, function(_i, tuple2) {
  28721. var fn2 = isFunction2(fns[tuple2[4]]) && fns[tuple2[4]];
  28722. deferred[tuple2[1]](function() {
  28723. var returned = fn2 && fn2.apply(this, arguments);
  28724. if (returned && isFunction2(returned.promise)) {
  28725. returned.promise().progress(newDefer.notify).done(newDefer.resolve).fail(newDefer.reject);
  28726. } else {
  28727. newDefer[tuple2[0] + "With"](
  28728. this,
  28729. fn2 ? [returned] : arguments
  28730. );
  28731. }
  28732. });
  28733. });
  28734. fns = null;
  28735. }).promise();
  28736. },
  28737. then: function(onFulfilled, onRejected, onProgress) {
  28738. var maxDepth = 0;
  28739. function resolve2(depth, deferred2, handler, special) {
  28740. return function() {
  28741. var that = this, args = arguments, mightThrow = function() {
  28742. var returned, then;
  28743. if (depth < maxDepth) {
  28744. return;
  28745. }
  28746. returned = handler.apply(that, args);
  28747. if (returned === deferred2.promise()) {
  28748. throw new TypeError("Thenable self-resolution");
  28749. }
  28750. then = returned && (typeof returned === "object" || typeof returned === "function") && returned.then;
  28751. if (isFunction2(then)) {
  28752. if (special) {
  28753. then.call(
  28754. returned,
  28755. resolve2(maxDepth, deferred2, Identity, special),
  28756. resolve2(maxDepth, deferred2, Thrower, special)
  28757. );
  28758. } else {
  28759. maxDepth++;
  28760. then.call(
  28761. returned,
  28762. resolve2(maxDepth, deferred2, Identity, special),
  28763. resolve2(maxDepth, deferred2, Thrower, special),
  28764. resolve2(
  28765. maxDepth,
  28766. deferred2,
  28767. Identity,
  28768. deferred2.notifyWith
  28769. )
  28770. );
  28771. }
  28772. } else {
  28773. if (handler !== Identity) {
  28774. that = void 0;
  28775. args = [returned];
  28776. }
  28777. (special || deferred2.resolveWith)(that, args);
  28778. }
  28779. }, process2 = special ? mightThrow : function() {
  28780. try {
  28781. mightThrow();
  28782. } catch (e) {
  28783. if (jQuery.Deferred.exceptionHook) {
  28784. jQuery.Deferred.exceptionHook(
  28785. e,
  28786. process2.error
  28787. );
  28788. }
  28789. if (depth + 1 >= maxDepth) {
  28790. if (handler !== Thrower) {
  28791. that = void 0;
  28792. args = [e];
  28793. }
  28794. deferred2.rejectWith(that, args);
  28795. }
  28796. }
  28797. };
  28798. if (depth) {
  28799. process2();
  28800. } else {
  28801. if (jQuery.Deferred.getErrorHook) {
  28802. process2.error = jQuery.Deferred.getErrorHook();
  28803. } else if (jQuery.Deferred.getStackHook) {
  28804. process2.error = jQuery.Deferred.getStackHook();
  28805. }
  28806. window2.setTimeout(process2);
  28807. }
  28808. };
  28809. }
  28810. return jQuery.Deferred(function(newDefer) {
  28811. tuples[0][3].add(
  28812. resolve2(
  28813. 0,
  28814. newDefer,
  28815. isFunction2(onProgress) ? onProgress : Identity,
  28816. newDefer.notifyWith
  28817. )
  28818. );
  28819. tuples[1][3].add(
  28820. resolve2(
  28821. 0,
  28822. newDefer,
  28823. isFunction2(onFulfilled) ? onFulfilled : Identity
  28824. )
  28825. );
  28826. tuples[2][3].add(
  28827. resolve2(
  28828. 0,
  28829. newDefer,
  28830. isFunction2(onRejected) ? onRejected : Thrower
  28831. )
  28832. );
  28833. }).promise();
  28834. },
  28835. promise: function(obj) {
  28836. return obj != null ? jQuery.extend(obj, promise) : promise;
  28837. }
  28838. }, deferred = {};
  28839. jQuery.each(tuples, function(i2, tuple2) {
  28840. var list = tuple2[2], stateString = tuple2[5];
  28841. promise[tuple2[1]] = list.add;
  28842. if (stateString) {
  28843. list.add(
  28844. function() {
  28845. state = stateString;
  28846. },
  28847. tuples[3 - i2][2].disable,
  28848. tuples[3 - i2][3].disable,
  28849. tuples[0][2].lock,
  28850. tuples[0][3].lock
  28851. );
  28852. }
  28853. list.add(tuple2[3].fire);
  28854. deferred[tuple2[0]] = function() {
  28855. deferred[tuple2[0] + "With"](this === deferred ? void 0 : this, arguments);
  28856. return this;
  28857. };
  28858. deferred[tuple2[0] + "With"] = list.fireWith;
  28859. });
  28860. promise.promise(deferred);
  28861. if (func) {
  28862. func.call(deferred, deferred);
  28863. }
  28864. return deferred;
  28865. },
  28866. when: function(singleValue) {
  28867. var remaining = arguments.length, i2 = remaining, resolveContexts = Array(i2), resolveValues = slice.call(arguments), primary = jQuery.Deferred(), updateFunc = function(i3) {
  28868. return function(value) {
  28869. resolveContexts[i3] = this;
  28870. resolveValues[i3] = arguments.length > 1 ? slice.call(arguments) : value;
  28871. if (!--remaining) {
  28872. primary.resolveWith(resolveContexts, resolveValues);
  28873. }
  28874. };
  28875. };
  28876. if (remaining <= 1) {
  28877. adoptValue(
  28878. singleValue,
  28879. primary.done(updateFunc(i2)).resolve,
  28880. primary.reject,
  28881. !remaining
  28882. );
  28883. if (primary.state() === "pending" || isFunction2(resolveValues[i2] && resolveValues[i2].then)) {
  28884. return primary.then();
  28885. }
  28886. }
  28887. while (i2--) {
  28888. adoptValue(resolveValues[i2], updateFunc(i2), primary.reject);
  28889. }
  28890. return primary.promise();
  28891. }
  28892. });
  28893. var rerrorNames = /^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;
  28894. jQuery.Deferred.exceptionHook = function(error, asyncError) {
  28895. if (window2.console && window2.console.warn && error && rerrorNames.test(error.name)) {
  28896. window2.console.warn(
  28897. "jQuery.Deferred exception: " + error.message,
  28898. error.stack,
  28899. asyncError
  28900. );
  28901. }
  28902. };
  28903. jQuery.readyException = function(error) {
  28904. window2.setTimeout(function() {
  28905. throw error;
  28906. });
  28907. };
  28908. var readyList = jQuery.Deferred();
  28909. jQuery.fn.ready = function(fn2) {
  28910. readyList.then(fn2).catch(function(error) {
  28911. jQuery.readyException(error);
  28912. });
  28913. return this;
  28914. };
  28915. jQuery.extend({
  28916. isReady: false,
  28917. readyWait: 1,
  28918. ready: function(wait) {
  28919. if (wait === true ? --jQuery.readyWait : jQuery.isReady) {
  28920. return;
  28921. }
  28922. jQuery.isReady = true;
  28923. if (wait !== true && --jQuery.readyWait > 0) {
  28924. return;
  28925. }
  28926. readyList.resolveWith(document2, [jQuery]);
  28927. }
  28928. });
  28929. jQuery.ready.then = readyList.then;
  28930. function completed() {
  28931. document2.removeEventListener("DOMContentLoaded", completed);
  28932. window2.removeEventListener("load", completed);
  28933. jQuery.ready();
  28934. }
  28935. if (document2.readyState === "complete" || document2.readyState !== "loading" && !document2.documentElement.doScroll) {
  28936. window2.setTimeout(jQuery.ready);
  28937. } else {
  28938. document2.addEventListener("DOMContentLoaded", completed);
  28939. window2.addEventListener("load", completed);
  28940. }
  28941. var access = function(elems, fn2, key, value, chainable, emptyGet, raw) {
  28942. var i2 = 0, len = elems.length, bulk = key == null;
  28943. if (toType(key) === "object") {
  28944. chainable = true;
  28945. for (i2 in key) {
  28946. access(elems, fn2, i2, key[i2], true, emptyGet, raw);
  28947. }
  28948. } else if (value !== void 0) {
  28949. chainable = true;
  28950. if (!isFunction2(value)) {
  28951. raw = true;
  28952. }
  28953. if (bulk) {
  28954. if (raw) {
  28955. fn2.call(elems, value);
  28956. fn2 = null;
  28957. } else {
  28958. bulk = fn2;
  28959. fn2 = function(elem, _key, value2) {
  28960. return bulk.call(jQuery(elem), value2);
  28961. };
  28962. }
  28963. }
  28964. if (fn2) {
  28965. for (; i2 < len; i2++) {
  28966. fn2(
  28967. elems[i2],
  28968. key,
  28969. raw ? value : value.call(elems[i2], i2, fn2(elems[i2], key))
  28970. );
  28971. }
  28972. }
  28973. }
  28974. if (chainable) {
  28975. return elems;
  28976. }
  28977. if (bulk) {
  28978. return fn2.call(elems);
  28979. }
  28980. return len ? fn2(elems[0], key) : emptyGet;
  28981. };
  28982. var rmsPrefix = /^-ms-/, rdashAlpha = /-([a-z])/g;
  28983. function fcamelCase(_all, letter) {
  28984. return letter.toUpperCase();
  28985. }
  28986. function camelCase3(string) {
  28987. return string.replace(rmsPrefix, "ms-").replace(rdashAlpha, fcamelCase);
  28988. }
  28989. var acceptData = function(owner) {
  28990. return owner.nodeType === 1 || owner.nodeType === 9 || !+owner.nodeType;
  28991. };
  28992. function Data() {
  28993. this.expando = jQuery.expando + Data.uid++;
  28994. }
  28995. Data.uid = 1;
  28996. Data.prototype = {
  28997. cache: function(owner) {
  28998. var value = owner[this.expando];
  28999. if (!value) {
  29000. value = {};
  29001. if (acceptData(owner)) {
  29002. if (owner.nodeType) {
  29003. owner[this.expando] = value;
  29004. } else {
  29005. Object.defineProperty(owner, this.expando, {
  29006. value,
  29007. configurable: true
  29008. });
  29009. }
  29010. }
  29011. }
  29012. return value;
  29013. },
  29014. set: function(owner, data, value) {
  29015. var prop, cache = this.cache(owner);
  29016. if (typeof data === "string") {
  29017. cache[camelCase3(data)] = value;
  29018. } else {
  29019. for (prop in data) {
  29020. cache[camelCase3(prop)] = data[prop];
  29021. }
  29022. }
  29023. return cache;
  29024. },
  29025. get: function(owner, key) {
  29026. return key === void 0 ? this.cache(owner) : owner[this.expando] && owner[this.expando][camelCase3(key)];
  29027. },
  29028. access: function(owner, key, value) {
  29029. if (key === void 0 || key && typeof key === "string" && value === void 0) {
  29030. return this.get(owner, key);
  29031. }
  29032. this.set(owner, key, value);
  29033. return value !== void 0 ? value : key;
  29034. },
  29035. remove: function(owner, key) {
  29036. var i2, cache = owner[this.expando];
  29037. if (cache === void 0) {
  29038. return;
  29039. }
  29040. if (key !== void 0) {
  29041. if (Array.isArray(key)) {
  29042. key = key.map(camelCase3);
  29043. } else {
  29044. key = camelCase3(key);
  29045. key = key in cache ? [key] : key.match(rnothtmlwhite) || [];
  29046. }
  29047. i2 = key.length;
  29048. while (i2--) {
  29049. delete cache[key[i2]];
  29050. }
  29051. }
  29052. if (key === void 0 || jQuery.isEmptyObject(cache)) {
  29053. if (owner.nodeType) {
  29054. owner[this.expando] = void 0;
  29055. } else {
  29056. delete owner[this.expando];
  29057. }
  29058. }
  29059. },
  29060. hasData: function(owner) {
  29061. var cache = owner[this.expando];
  29062. return cache !== void 0 && !jQuery.isEmptyObject(cache);
  29063. }
  29064. };
  29065. var dataPriv = new Data();
  29066. var dataUser = new Data();
  29067. var rbrace = /^(?:\{[\w\W]*\}|\[[\w\W]*\])$/, rmultiDash = /[A-Z]/g;
  29068. function getData(data) {
  29069. if (data === "true") {
  29070. return true;
  29071. }
  29072. if (data === "false") {
  29073. return false;
  29074. }
  29075. if (data === "null") {
  29076. return null;
  29077. }
  29078. if (data === +data + "") {
  29079. return +data;
  29080. }
  29081. if (rbrace.test(data)) {
  29082. return JSON.parse(data);
  29083. }
  29084. return data;
  29085. }
  29086. function dataAttr(elem, key, data) {
  29087. var name;
  29088. if (data === void 0 && elem.nodeType === 1) {
  29089. name = "data-" + key.replace(rmultiDash, "-$&").toLowerCase();
  29090. data = elem.getAttribute(name);
  29091. if (typeof data === "string") {
  29092. try {
  29093. data = getData(data);
  29094. } catch (e) {
  29095. }
  29096. dataUser.set(elem, key, data);
  29097. } else {
  29098. data = void 0;
  29099. }
  29100. }
  29101. return data;
  29102. }
  29103. jQuery.extend({
  29104. hasData: function(elem) {
  29105. return dataUser.hasData(elem) || dataPriv.hasData(elem);
  29106. },
  29107. data: function(elem, name, data) {
  29108. return dataUser.access(elem, name, data);
  29109. },
  29110. removeData: function(elem, name) {
  29111. dataUser.remove(elem, name);
  29112. },
  29113. _data: function(elem, name, data) {
  29114. return dataPriv.access(elem, name, data);
  29115. },
  29116. _removeData: function(elem, name) {
  29117. dataPriv.remove(elem, name);
  29118. }
  29119. });
  29120. jQuery.fn.extend({
  29121. data: function(key, value) {
  29122. var i2, name, data, elem = this[0], attrs = elem && elem.attributes;
  29123. if (key === void 0) {
  29124. if (this.length) {
  29125. data = dataUser.get(elem);
  29126. if (elem.nodeType === 1 && !dataPriv.get(elem, "hasDataAttrs")) {
  29127. i2 = attrs.length;
  29128. while (i2--) {
  29129. if (attrs[i2]) {
  29130. name = attrs[i2].name;
  29131. if (name.indexOf("data-") === 0) {
  29132. name = camelCase3(name.slice(5));
  29133. dataAttr(elem, name, data[name]);
  29134. }
  29135. }
  29136. }
  29137. dataPriv.set(elem, "hasDataAttrs", true);
  29138. }
  29139. }
  29140. return data;
  29141. }
  29142. if (typeof key === "object") {
  29143. return this.each(function() {
  29144. dataUser.set(this, key);
  29145. });
  29146. }
  29147. return access(this, function(value2) {
  29148. var data2;
  29149. if (elem && value2 === void 0) {
  29150. data2 = dataUser.get(elem, key);
  29151. if (data2 !== void 0) {
  29152. return data2;
  29153. }
  29154. data2 = dataAttr(elem, key);
  29155. if (data2 !== void 0) {
  29156. return data2;
  29157. }
  29158. return;
  29159. }
  29160. this.each(function() {
  29161. dataUser.set(this, key, value2);
  29162. });
  29163. }, null, value, arguments.length > 1, null, true);
  29164. },
  29165. removeData: function(key) {
  29166. return this.each(function() {
  29167. dataUser.remove(this, key);
  29168. });
  29169. }
  29170. });
  29171. jQuery.extend({
  29172. queue: function(elem, type2, data) {
  29173. var queue;
  29174. if (elem) {
  29175. type2 = (type2 || "fx") + "queue";
  29176. queue = dataPriv.get(elem, type2);
  29177. if (data) {
  29178. if (!queue || Array.isArray(data)) {
  29179. queue = dataPriv.access(elem, type2, jQuery.makeArray(data));
  29180. } else {
  29181. queue.push(data);
  29182. }
  29183. }
  29184. return queue || [];
  29185. }
  29186. },
  29187. dequeue: function(elem, type2) {
  29188. type2 = type2 || "fx";
  29189. var queue = jQuery.queue(elem, type2), startLength = queue.length, fn2 = queue.shift(), hooks3 = jQuery._queueHooks(elem, type2), next = function() {
  29190. jQuery.dequeue(elem, type2);
  29191. };
  29192. if (fn2 === "inprogress") {
  29193. fn2 = queue.shift();
  29194. startLength--;
  29195. }
  29196. if (fn2) {
  29197. if (type2 === "fx") {
  29198. queue.unshift("inprogress");
  29199. }
  29200. delete hooks3.stop;
  29201. fn2.call(elem, next, hooks3);
  29202. }
  29203. if (!startLength && hooks3) {
  29204. hooks3.empty.fire();
  29205. }
  29206. },
  29207. _queueHooks: function(elem, type2) {
  29208. var key = type2 + "queueHooks";
  29209. return dataPriv.get(elem, key) || dataPriv.access(elem, key, {
  29210. empty: jQuery.Callbacks("once memory").add(function() {
  29211. dataPriv.remove(elem, [type2 + "queue", key]);
  29212. })
  29213. });
  29214. }
  29215. });
  29216. jQuery.fn.extend({
  29217. queue: function(type2, data) {
  29218. var setter = 2;
  29219. if (typeof type2 !== "string") {
  29220. data = type2;
  29221. type2 = "fx";
  29222. setter--;
  29223. }
  29224. if (arguments.length < setter) {
  29225. return jQuery.queue(this[0], type2);
  29226. }
  29227. return data === void 0 ? this : this.each(function() {
  29228. var queue = jQuery.queue(this, type2, data);
  29229. jQuery._queueHooks(this, type2);
  29230. if (type2 === "fx" && queue[0] !== "inprogress") {
  29231. jQuery.dequeue(this, type2);
  29232. }
  29233. });
  29234. },
  29235. dequeue: function(type2) {
  29236. return this.each(function() {
  29237. jQuery.dequeue(this, type2);
  29238. });
  29239. },
  29240. clearQueue: function(type2) {
  29241. return this.queue(type2 || "fx", []);
  29242. },
  29243. promise: function(type2, obj) {
  29244. var tmp, count = 1, defer = jQuery.Deferred(), elements = this, i2 = this.length, resolve2 = function() {
  29245. if (!--count) {
  29246. defer.resolveWith(elements, [elements]);
  29247. }
  29248. };
  29249. if (typeof type2 !== "string") {
  29250. obj = type2;
  29251. type2 = void 0;
  29252. }
  29253. type2 = type2 || "fx";
  29254. while (i2--) {
  29255. tmp = dataPriv.get(elements[i2], type2 + "queueHooks");
  29256. if (tmp && tmp.empty) {
  29257. count++;
  29258. tmp.empty.add(resolve2);
  29259. }
  29260. }
  29261. resolve2();
  29262. return defer.promise(obj);
  29263. }
  29264. });
  29265. var pnum = /[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;
  29266. var rcssNum = new RegExp("^(?:([+-])=|)(" + pnum + ")([a-z%]*)$", "i");
  29267. var cssExpand = ["Top", "Right", "Bottom", "Left"];
  29268. var documentElement = document2.documentElement;
  29269. var isAttached = function(elem) {
  29270. return jQuery.contains(elem.ownerDocument, elem);
  29271. }, composed = { composed: true };
  29272. if (documentElement.getRootNode) {
  29273. isAttached = function(elem) {
  29274. return jQuery.contains(elem.ownerDocument, elem) || elem.getRootNode(composed) === elem.ownerDocument;
  29275. };
  29276. }
  29277. var isHiddenWithinTree = function(elem, el) {
  29278. elem = el || elem;
  29279. return elem.style.display === "none" || elem.style.display === "" && isAttached(elem) && jQuery.css(elem, "display") === "none";
  29280. };
  29281. function adjustCSS(elem, prop, valueParts, tween) {
  29282. var adjusted, scale, maxIterations = 20, currentValue = tween ? function() {
  29283. return tween.cur();
  29284. } : function() {
  29285. return jQuery.css(elem, prop, "");
  29286. }, initial = currentValue(), unit = valueParts && valueParts[3] || (jQuery.cssNumber[prop] ? "" : "px"), initialInUnit = elem.nodeType && (jQuery.cssNumber[prop] || unit !== "px" && +initial) && rcssNum.exec(jQuery.css(elem, prop));
  29287. if (initialInUnit && initialInUnit[3] !== unit) {
  29288. initial = initial / 2;
  29289. unit = unit || initialInUnit[3];
  29290. initialInUnit = +initial || 1;
  29291. while (maxIterations--) {
  29292. jQuery.style(elem, prop, initialInUnit + unit);
  29293. if ((1 - scale) * (1 - (scale = currentValue() / initial || 0.5)) <= 0) {
  29294. maxIterations = 0;
  29295. }
  29296. initialInUnit = initialInUnit / scale;
  29297. }
  29298. initialInUnit = initialInUnit * 2;
  29299. jQuery.style(elem, prop, initialInUnit + unit);
  29300. valueParts = valueParts || [];
  29301. }
  29302. if (valueParts) {
  29303. initialInUnit = +initialInUnit || +initial || 0;
  29304. adjusted = valueParts[1] ? initialInUnit + (valueParts[1] + 1) * valueParts[2] : +valueParts[2];
  29305. if (tween) {
  29306. tween.unit = unit;
  29307. tween.start = initialInUnit;
  29308. tween.end = adjusted;
  29309. }
  29310. }
  29311. return adjusted;
  29312. }
  29313. var defaultDisplayMap = {};
  29314. function getDefaultDisplay(elem) {
  29315. var temp, doc = elem.ownerDocument, nodeName2 = elem.nodeName, display = defaultDisplayMap[nodeName2];
  29316. if (display) {
  29317. return display;
  29318. }
  29319. temp = doc.body.appendChild(doc.createElement(nodeName2));
  29320. display = jQuery.css(temp, "display");
  29321. temp.parentNode.removeChild(temp);
  29322. if (display === "none") {
  29323. display = "block";
  29324. }
  29325. defaultDisplayMap[nodeName2] = display;
  29326. return display;
  29327. }
  29328. function showHide(elements, show) {
  29329. var display, elem, values3 = [], index2 = 0, length = elements.length;
  29330. for (; index2 < length; index2++) {
  29331. elem = elements[index2];
  29332. if (!elem.style) {
  29333. continue;
  29334. }
  29335. display = elem.style.display;
  29336. if (show) {
  29337. if (display === "none") {
  29338. values3[index2] = dataPriv.get(elem, "display") || null;
  29339. if (!values3[index2]) {
  29340. elem.style.display = "";
  29341. }
  29342. }
  29343. if (elem.style.display === "" && isHiddenWithinTree(elem)) {
  29344. values3[index2] = getDefaultDisplay(elem);
  29345. }
  29346. } else {
  29347. if (display !== "none") {
  29348. values3[index2] = "none";
  29349. dataPriv.set(elem, "display", display);
  29350. }
  29351. }
  29352. }
  29353. for (index2 = 0; index2 < length; index2++) {
  29354. if (values3[index2] != null) {
  29355. elements[index2].style.display = values3[index2];
  29356. }
  29357. }
  29358. return elements;
  29359. }
  29360. jQuery.fn.extend({
  29361. show: function() {
  29362. return showHide(this, true);
  29363. },
  29364. hide: function() {
  29365. return showHide(this);
  29366. },
  29367. toggle: function(state) {
  29368. if (typeof state === "boolean") {
  29369. return state ? this.show() : this.hide();
  29370. }
  29371. return this.each(function() {
  29372. if (isHiddenWithinTree(this)) {
  29373. jQuery(this).show();
  29374. } else {
  29375. jQuery(this).hide();
  29376. }
  29377. });
  29378. }
  29379. });
  29380. var rcheckableType = /^(?:checkbox|radio)$/i;
  29381. var rtagName = /<([a-z][^\/\0>\x20\t\r\n\f]*)/i;
  29382. var rscriptType = /^$|^module$|\/(?:java|ecma)script/i;
  29383. (function() {
  29384. var fragment = document2.createDocumentFragment(), div = fragment.appendChild(document2.createElement("div")), input = document2.createElement("input");
  29385. input.setAttribute("type", "radio");
  29386. input.setAttribute("checked", "checked");
  29387. input.setAttribute("name", "t");
  29388. div.appendChild(input);
  29389. support.checkClone = div.cloneNode(true).cloneNode(true).lastChild.checked;
  29390. div.innerHTML = "<textarea>x</textarea>";
  29391. support.noCloneChecked = !!div.cloneNode(true).lastChild.defaultValue;
  29392. div.innerHTML = "<option></option>";
  29393. support.option = !!div.lastChild;
  29394. })();
  29395. var wrapMap = {
  29396. thead: [1, "<table>", "</table>"],
  29397. col: [2, "<table><colgroup>", "</colgroup></table>"],
  29398. tr: [2, "<table><tbody>", "</tbody></table>"],
  29399. td: [3, "<table><tbody><tr>", "</tr></tbody></table>"],
  29400. _default: [0, "", ""]
  29401. };
  29402. wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
  29403. wrapMap.th = wrapMap.td;
  29404. if (!support.option) {
  29405. wrapMap.optgroup = wrapMap.option = [1, "<select multiple='multiple'>", "</select>"];
  29406. }
  29407. function getAll(context, tag) {
  29408. var ret;
  29409. if (typeof context.getElementsByTagName !== "undefined") {
  29410. ret = context.getElementsByTagName(tag || "*");
  29411. } else if (typeof context.querySelectorAll !== "undefined") {
  29412. ret = context.querySelectorAll(tag || "*");
  29413. } else {
  29414. ret = [];
  29415. }
  29416. if (tag === void 0 || tag && nodeName(context, tag)) {
  29417. return jQuery.merge([context], ret);
  29418. }
  29419. return ret;
  29420. }
  29421. function setGlobalEval(elems, refElements) {
  29422. var i2 = 0, l = elems.length;
  29423. for (; i2 < l; i2++) {
  29424. dataPriv.set(
  29425. elems[i2],
  29426. "globalEval",
  29427. !refElements || dataPriv.get(refElements[i2], "globalEval")
  29428. );
  29429. }
  29430. }
  29431. var rhtml = /<|&#?\w+;/;
  29432. function buildFragment(elems, context, scripts, selection, ignored) {
  29433. var elem, tmp, tag, wrap, attached, j, fragment = context.createDocumentFragment(), nodes = [], i2 = 0, l = elems.length;
  29434. for (; i2 < l; i2++) {
  29435. elem = elems[i2];
  29436. if (elem || elem === 0) {
  29437. if (toType(elem) === "object") {
  29438. jQuery.merge(nodes, elem.nodeType ? [elem] : elem);
  29439. } else if (!rhtml.test(elem)) {
  29440. nodes.push(context.createTextNode(elem));
  29441. } else {
  29442. tmp = tmp || fragment.appendChild(context.createElement("div"));
  29443. tag = (rtagName.exec(elem) || ["", ""])[1].toLowerCase();
  29444. wrap = wrapMap[tag] || wrapMap._default;
  29445. tmp.innerHTML = wrap[1] + jQuery.htmlPrefilter(elem) + wrap[2];
  29446. j = wrap[0];
  29447. while (j--) {
  29448. tmp = tmp.lastChild;
  29449. }
  29450. jQuery.merge(nodes, tmp.childNodes);
  29451. tmp = fragment.firstChild;
  29452. tmp.textContent = "";
  29453. }
  29454. }
  29455. }
  29456. fragment.textContent = "";
  29457. i2 = 0;
  29458. while (elem = nodes[i2++]) {
  29459. if (selection && jQuery.inArray(elem, selection) > -1) {
  29460. if (ignored) {
  29461. ignored.push(elem);
  29462. }
  29463. continue;
  29464. }
  29465. attached = isAttached(elem);
  29466. tmp = getAll(fragment.appendChild(elem), "script");
  29467. if (attached) {
  29468. setGlobalEval(tmp);
  29469. }
  29470. if (scripts) {
  29471. j = 0;
  29472. while (elem = tmp[j++]) {
  29473. if (rscriptType.test(elem.type || "")) {
  29474. scripts.push(elem);
  29475. }
  29476. }
  29477. }
  29478. }
  29479. return fragment;
  29480. }
  29481. var rtypenamespace = /^([^.]*)(?:\.(.+)|)/;
  29482. function returnTrue() {
  29483. return true;
  29484. }
  29485. function returnFalse() {
  29486. return false;
  29487. }
  29488. function on3(elem, types, selector, data, fn2, one3) {
  29489. var origFn, type2;
  29490. if (typeof types === "object") {
  29491. if (typeof selector !== "string") {
  29492. data = data || selector;
  29493. selector = void 0;
  29494. }
  29495. for (type2 in types) {
  29496. on3(elem, type2, selector, data, types[type2], one3);
  29497. }
  29498. return elem;
  29499. }
  29500. if (data == null && fn2 == null) {
  29501. fn2 = selector;
  29502. data = selector = void 0;
  29503. } else if (fn2 == null) {
  29504. if (typeof selector === "string") {
  29505. fn2 = data;
  29506. data = void 0;
  29507. } else {
  29508. fn2 = data;
  29509. data = selector;
  29510. selector = void 0;
  29511. }
  29512. }
  29513. if (fn2 === false) {
  29514. fn2 = returnFalse;
  29515. } else if (!fn2) {
  29516. return elem;
  29517. }
  29518. if (one3 === 1) {
  29519. origFn = fn2;
  29520. fn2 = function(event2) {
  29521. jQuery().off(event2);
  29522. return origFn.apply(this, arguments);
  29523. };
  29524. fn2.guid = origFn.guid || (origFn.guid = jQuery.guid++);
  29525. }
  29526. return elem.each(function() {
  29527. jQuery.event.add(this, types, fn2, data, selector);
  29528. });
  29529. }
  29530. jQuery.event = {
  29531. global: {},
  29532. add: function(elem, types, handler, data, selector) {
  29533. var handleObjIn, eventHandle, tmp, events, t2, handleObj, special, handlers, type2, namespaces, origType, elemData = dataPriv.get(elem);
  29534. if (!acceptData(elem)) {
  29535. return;
  29536. }
  29537. if (handler.handler) {
  29538. handleObjIn = handler;
  29539. handler = handleObjIn.handler;
  29540. selector = handleObjIn.selector;
  29541. }
  29542. if (selector) {
  29543. jQuery.find.matchesSelector(documentElement, selector);
  29544. }
  29545. if (!handler.guid) {
  29546. handler.guid = jQuery.guid++;
  29547. }
  29548. if (!(events = elemData.events)) {
  29549. events = elemData.events = /* @__PURE__ */ Object.create(null);
  29550. }
  29551. if (!(eventHandle = elemData.handle)) {
  29552. eventHandle = elemData.handle = function(e) {
  29553. return typeof jQuery !== "undefined" && jQuery.event.triggered !== e.type ? jQuery.event.dispatch.apply(elem, arguments) : void 0;
  29554. };
  29555. }
  29556. types = (types || "").match(rnothtmlwhite) || [""];
  29557. t2 = types.length;
  29558. while (t2--) {
  29559. tmp = rtypenamespace.exec(types[t2]) || [];
  29560. type2 = origType = tmp[1];
  29561. namespaces = (tmp[2] || "").split(".").sort();
  29562. if (!type2) {
  29563. continue;
  29564. }
  29565. special = jQuery.event.special[type2] || {};
  29566. type2 = (selector ? special.delegateType : special.bindType) || type2;
  29567. special = jQuery.event.special[type2] || {};
  29568. handleObj = jQuery.extend({
  29569. type: type2,
  29570. origType,
  29571. data,
  29572. handler,
  29573. guid: handler.guid,
  29574. selector,
  29575. needsContext: selector && jQuery.expr.match.needsContext.test(selector),
  29576. namespace: namespaces.join(".")
  29577. }, handleObjIn);
  29578. if (!(handlers = events[type2])) {
  29579. handlers = events[type2] = [];
  29580. handlers.delegateCount = 0;
  29581. if (!special.setup || special.setup.call(elem, data, namespaces, eventHandle) === false) {
  29582. if (elem.addEventListener) {
  29583. elem.addEventListener(type2, eventHandle);
  29584. }
  29585. }
  29586. }
  29587. if (special.add) {
  29588. special.add.call(elem, handleObj);
  29589. if (!handleObj.handler.guid) {
  29590. handleObj.handler.guid = handler.guid;
  29591. }
  29592. }
  29593. if (selector) {
  29594. handlers.splice(handlers.delegateCount++, 0, handleObj);
  29595. } else {
  29596. handlers.push(handleObj);
  29597. }
  29598. jQuery.event.global[type2] = true;
  29599. }
  29600. },
  29601. remove: function(elem, types, handler, selector, mappedTypes) {
  29602. var j, origCount, tmp, events, t2, handleObj, special, handlers, type2, namespaces, origType, elemData = dataPriv.hasData(elem) && dataPriv.get(elem);
  29603. if (!elemData || !(events = elemData.events)) {
  29604. return;
  29605. }
  29606. types = (types || "").match(rnothtmlwhite) || [""];
  29607. t2 = types.length;
  29608. while (t2--) {
  29609. tmp = rtypenamespace.exec(types[t2]) || [];
  29610. type2 = origType = tmp[1];
  29611. namespaces = (tmp[2] || "").split(".").sort();
  29612. if (!type2) {
  29613. for (type2 in events) {
  29614. jQuery.event.remove(elem, type2 + types[t2], handler, selector, true);
  29615. }
  29616. continue;
  29617. }
  29618. special = jQuery.event.special[type2] || {};
  29619. type2 = (selector ? special.delegateType : special.bindType) || type2;
  29620. handlers = events[type2] || [];
  29621. tmp = tmp[2] && new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)");
  29622. origCount = j = handlers.length;
  29623. while (j--) {
  29624. handleObj = handlers[j];
  29625. if ((mappedTypes || origType === handleObj.origType) && (!handler || handler.guid === handleObj.guid) && (!tmp || tmp.test(handleObj.namespace)) && (!selector || selector === handleObj.selector || selector === "**" && handleObj.selector)) {
  29626. handlers.splice(j, 1);
  29627. if (handleObj.selector) {
  29628. handlers.delegateCount--;
  29629. }
  29630. if (special.remove) {
  29631. special.remove.call(elem, handleObj);
  29632. }
  29633. }
  29634. }
  29635. if (origCount && !handlers.length) {
  29636. if (!special.teardown || special.teardown.call(elem, namespaces, elemData.handle) === false) {
  29637. jQuery.removeEvent(elem, type2, elemData.handle);
  29638. }
  29639. delete events[type2];
  29640. }
  29641. }
  29642. if (jQuery.isEmptyObject(events)) {
  29643. dataPriv.remove(elem, "handle events");
  29644. }
  29645. },
  29646. dispatch: function(nativeEvent) {
  29647. var i2, j, ret, matched, handleObj, handlerQueue, args = new Array(arguments.length), event2 = jQuery.event.fix(nativeEvent), handlers = (dataPriv.get(this, "events") || /* @__PURE__ */ Object.create(null))[event2.type] || [], special = jQuery.event.special[event2.type] || {};
  29648. args[0] = event2;
  29649. for (i2 = 1; i2 < arguments.length; i2++) {
  29650. args[i2] = arguments[i2];
  29651. }
  29652. event2.delegateTarget = this;
  29653. if (special.preDispatch && special.preDispatch.call(this, event2) === false) {
  29654. return;
  29655. }
  29656. handlerQueue = jQuery.event.handlers.call(this, event2, handlers);
  29657. i2 = 0;
  29658. while ((matched = handlerQueue[i2++]) && !event2.isPropagationStopped()) {
  29659. event2.currentTarget = matched.elem;
  29660. j = 0;
  29661. while ((handleObj = matched.handlers[j++]) && !event2.isImmediatePropagationStopped()) {
  29662. if (!event2.rnamespace || handleObj.namespace === false || event2.rnamespace.test(handleObj.namespace)) {
  29663. event2.handleObj = handleObj;
  29664. event2.data = handleObj.data;
  29665. ret = ((jQuery.event.special[handleObj.origType] || {}).handle || handleObj.handler).apply(matched.elem, args);
  29666. if (ret !== void 0) {
  29667. if ((event2.result = ret) === false) {
  29668. event2.preventDefault();
  29669. event2.stopPropagation();
  29670. }
  29671. }
  29672. }
  29673. }
  29674. }
  29675. if (special.postDispatch) {
  29676. special.postDispatch.call(this, event2);
  29677. }
  29678. return event2.result;
  29679. },
  29680. handlers: function(event2, handlers) {
  29681. var i2, handleObj, sel, matchedHandlers, matchedSelectors, handlerQueue = [], delegateCount = handlers.delegateCount, cur = event2.target;
  29682. if (delegateCount && cur.nodeType && !(event2.type === "click" && event2.button >= 1)) {
  29683. for (; cur !== this; cur = cur.parentNode || this) {
  29684. if (cur.nodeType === 1 && !(event2.type === "click" && cur.disabled === true)) {
  29685. matchedHandlers = [];
  29686. matchedSelectors = {};
  29687. for (i2 = 0; i2 < delegateCount; i2++) {
  29688. handleObj = handlers[i2];
  29689. sel = handleObj.selector + " ";
  29690. if (matchedSelectors[sel] === void 0) {
  29691. matchedSelectors[sel] = handleObj.needsContext ? jQuery(sel, this).index(cur) > -1 : jQuery.find(sel, this, null, [cur]).length;
  29692. }
  29693. if (matchedSelectors[sel]) {
  29694. matchedHandlers.push(handleObj);
  29695. }
  29696. }
  29697. if (matchedHandlers.length) {
  29698. handlerQueue.push({ elem: cur, handlers: matchedHandlers });
  29699. }
  29700. }
  29701. }
  29702. }
  29703. cur = this;
  29704. if (delegateCount < handlers.length) {
  29705. handlerQueue.push({ elem: cur, handlers: handlers.slice(delegateCount) });
  29706. }
  29707. return handlerQueue;
  29708. },
  29709. addProp: function(name, hook3) {
  29710. Object.defineProperty(jQuery.Event.prototype, name, {
  29711. enumerable: true,
  29712. configurable: true,
  29713. get: isFunction2(hook3) ? function() {
  29714. if (this.originalEvent) {
  29715. return hook3(this.originalEvent);
  29716. }
  29717. } : function() {
  29718. if (this.originalEvent) {
  29719. return this.originalEvent[name];
  29720. }
  29721. },
  29722. set: function(value) {
  29723. Object.defineProperty(this, name, {
  29724. enumerable: true,
  29725. configurable: true,
  29726. writable: true,
  29727. value
  29728. });
  29729. }
  29730. });
  29731. },
  29732. fix: function(originalEvent) {
  29733. return originalEvent[jQuery.expando] ? originalEvent : new jQuery.Event(originalEvent);
  29734. },
  29735. special: {
  29736. load: {
  29737. noBubble: true
  29738. },
  29739. click: {
  29740. setup: function(data) {
  29741. var el = this || data;
  29742. if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) {
  29743. leverageNative(el, "click", true);
  29744. }
  29745. return false;
  29746. },
  29747. trigger: function(data) {
  29748. var el = this || data;
  29749. if (rcheckableType.test(el.type) && el.click && nodeName(el, "input")) {
  29750. leverageNative(el, "click");
  29751. }
  29752. return true;
  29753. },
  29754. _default: function(event2) {
  29755. var target = event2.target;
  29756. return rcheckableType.test(target.type) && target.click && nodeName(target, "input") && dataPriv.get(target, "click") || nodeName(target, "a");
  29757. }
  29758. },
  29759. beforeunload: {
  29760. postDispatch: function(event2) {
  29761. if (event2.result !== void 0 && event2.originalEvent) {
  29762. event2.originalEvent.returnValue = event2.result;
  29763. }
  29764. }
  29765. }
  29766. }
  29767. };
  29768. function leverageNative(el, type2, isSetup) {
  29769. if (!isSetup) {
  29770. if (dataPriv.get(el, type2) === void 0) {
  29771. jQuery.event.add(el, type2, returnTrue);
  29772. }
  29773. return;
  29774. }
  29775. dataPriv.set(el, type2, false);
  29776. jQuery.event.add(el, type2, {
  29777. namespace: false,
  29778. handler: function(event2) {
  29779. var result, saved = dataPriv.get(this, type2);
  29780. if (event2.isTrigger & 1 && this[type2]) {
  29781. if (!saved) {
  29782. saved = slice.call(arguments);
  29783. dataPriv.set(this, type2, saved);
  29784. this[type2]();
  29785. result = dataPriv.get(this, type2);
  29786. dataPriv.set(this, type2, false);
  29787. if (saved !== result) {
  29788. event2.stopImmediatePropagation();
  29789. event2.preventDefault();
  29790. return result;
  29791. }
  29792. } else if ((jQuery.event.special[type2] || {}).delegateType) {
  29793. event2.stopPropagation();
  29794. }
  29795. } else if (saved) {
  29796. dataPriv.set(this, type2, jQuery.event.trigger(
  29797. saved[0],
  29798. saved.slice(1),
  29799. this
  29800. ));
  29801. event2.stopPropagation();
  29802. event2.isImmediatePropagationStopped = returnTrue;
  29803. }
  29804. }
  29805. });
  29806. }
  29807. jQuery.removeEvent = function(elem, type2, handle) {
  29808. if (elem.removeEventListener) {
  29809. elem.removeEventListener(type2, handle);
  29810. }
  29811. };
  29812. jQuery.Event = function(src, props) {
  29813. if (!(this instanceof jQuery.Event)) {
  29814. return new jQuery.Event(src, props);
  29815. }
  29816. if (src && src.type) {
  29817. this.originalEvent = src;
  29818. this.type = src.type;
  29819. this.isDefaultPrevented = src.defaultPrevented || src.defaultPrevented === void 0 && src.returnValue === false ? returnTrue : returnFalse;
  29820. this.target = src.target && src.target.nodeType === 3 ? src.target.parentNode : src.target;
  29821. this.currentTarget = src.currentTarget;
  29822. this.relatedTarget = src.relatedTarget;
  29823. } else {
  29824. this.type = src;
  29825. }
  29826. if (props) {
  29827. jQuery.extend(this, props);
  29828. }
  29829. this.timeStamp = src && src.timeStamp || Date.now();
  29830. this[jQuery.expando] = true;
  29831. };
  29832. jQuery.Event.prototype = {
  29833. constructor: jQuery.Event,
  29834. isDefaultPrevented: returnFalse,
  29835. isPropagationStopped: returnFalse,
  29836. isImmediatePropagationStopped: returnFalse,
  29837. isSimulated: false,
  29838. preventDefault: function() {
  29839. var e = this.originalEvent;
  29840. this.isDefaultPrevented = returnTrue;
  29841. if (e && !this.isSimulated) {
  29842. e.preventDefault();
  29843. }
  29844. },
  29845. stopPropagation: function() {
  29846. var e = this.originalEvent;
  29847. this.isPropagationStopped = returnTrue;
  29848. if (e && !this.isSimulated) {
  29849. e.stopPropagation();
  29850. }
  29851. },
  29852. stopImmediatePropagation: function() {
  29853. var e = this.originalEvent;
  29854. this.isImmediatePropagationStopped = returnTrue;
  29855. if (e && !this.isSimulated) {
  29856. e.stopImmediatePropagation();
  29857. }
  29858. this.stopPropagation();
  29859. }
  29860. };
  29861. jQuery.each({
  29862. altKey: true,
  29863. bubbles: true,
  29864. cancelable: true,
  29865. changedTouches: true,
  29866. ctrlKey: true,
  29867. detail: true,
  29868. eventPhase: true,
  29869. metaKey: true,
  29870. pageX: true,
  29871. pageY: true,
  29872. shiftKey: true,
  29873. view: true,
  29874. "char": true,
  29875. code: true,
  29876. charCode: true,
  29877. key: true,
  29878. keyCode: true,
  29879. button: true,
  29880. buttons: true,
  29881. clientX: true,
  29882. clientY: true,
  29883. offsetX: true,
  29884. offsetY: true,
  29885. pointerId: true,
  29886. pointerType: true,
  29887. screenX: true,
  29888. screenY: true,
  29889. targetTouches: true,
  29890. toElement: true,
  29891. touches: true,
  29892. which: true
  29893. }, jQuery.event.addProp);
  29894. jQuery.each({ focus: "focusin", blur: "focusout" }, function(type2, delegateType) {
  29895. function focusMappedHandler(nativeEvent) {
  29896. if (document2.documentMode) {
  29897. var handle = dataPriv.get(this, "handle"), event2 = jQuery.event.fix(nativeEvent);
  29898. event2.type = nativeEvent.type === "focusin" ? "focus" : "blur";
  29899. event2.isSimulated = true;
  29900. handle(nativeEvent);
  29901. if (event2.target === event2.currentTarget) {
  29902. handle(event2);
  29903. }
  29904. } else {
  29905. jQuery.event.simulate(
  29906. delegateType,
  29907. nativeEvent.target,
  29908. jQuery.event.fix(nativeEvent)
  29909. );
  29910. }
  29911. }
  29912. jQuery.event.special[type2] = {
  29913. setup: function() {
  29914. var attaches;
  29915. leverageNative(this, type2, true);
  29916. if (document2.documentMode) {
  29917. attaches = dataPriv.get(this, delegateType);
  29918. if (!attaches) {
  29919. this.addEventListener(delegateType, focusMappedHandler);
  29920. }
  29921. dataPriv.set(this, delegateType, (attaches || 0) + 1);
  29922. } else {
  29923. return false;
  29924. }
  29925. },
  29926. trigger: function() {
  29927. leverageNative(this, type2);
  29928. return true;
  29929. },
  29930. teardown: function() {
  29931. var attaches;
  29932. if (document2.documentMode) {
  29933. attaches = dataPriv.get(this, delegateType) - 1;
  29934. if (!attaches) {
  29935. this.removeEventListener(delegateType, focusMappedHandler);
  29936. dataPriv.remove(this, delegateType);
  29937. } else {
  29938. dataPriv.set(this, delegateType, attaches);
  29939. }
  29940. } else {
  29941. return false;
  29942. }
  29943. },
  29944. _default: function(event2) {
  29945. return dataPriv.get(event2.target, type2);
  29946. },
  29947. delegateType
  29948. };
  29949. jQuery.event.special[delegateType] = {
  29950. setup: function() {
  29951. var doc = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc, attaches = dataPriv.get(dataHolder, delegateType);
  29952. if (!attaches) {
  29953. if (document2.documentMode) {
  29954. this.addEventListener(delegateType, focusMappedHandler);
  29955. } else {
  29956. doc.addEventListener(type2, focusMappedHandler, true);
  29957. }
  29958. }
  29959. dataPriv.set(dataHolder, delegateType, (attaches || 0) + 1);
  29960. },
  29961. teardown: function() {
  29962. var doc = this.ownerDocument || this.document || this, dataHolder = document2.documentMode ? this : doc, attaches = dataPriv.get(dataHolder, delegateType) - 1;
  29963. if (!attaches) {
  29964. if (document2.documentMode) {
  29965. this.removeEventListener(delegateType, focusMappedHandler);
  29966. } else {
  29967. doc.removeEventListener(type2, focusMappedHandler, true);
  29968. }
  29969. dataPriv.remove(dataHolder, delegateType);
  29970. } else {
  29971. dataPriv.set(dataHolder, delegateType, attaches);
  29972. }
  29973. }
  29974. };
  29975. });
  29976. jQuery.each({
  29977. mouseenter: "mouseover",
  29978. mouseleave: "mouseout",
  29979. pointerenter: "pointerover",
  29980. pointerleave: "pointerout"
  29981. }, function(orig, fix) {
  29982. jQuery.event.special[orig] = {
  29983. delegateType: fix,
  29984. bindType: fix,
  29985. handle: function(event2) {
  29986. var ret, target = this, related = event2.relatedTarget, handleObj = event2.handleObj;
  29987. if (!related || related !== target && !jQuery.contains(target, related)) {
  29988. event2.type = handleObj.origType;
  29989. ret = handleObj.handler.apply(this, arguments);
  29990. event2.type = fix;
  29991. }
  29992. return ret;
  29993. }
  29994. };
  29995. });
  29996. jQuery.fn.extend({
  29997. on: function(types, selector, data, fn2) {
  29998. return on3(this, types, selector, data, fn2);
  29999. },
  30000. one: function(types, selector, data, fn2) {
  30001. return on3(this, types, selector, data, fn2, 1);
  30002. },
  30003. off: function(types, selector, fn2) {
  30004. var handleObj, type2;
  30005. if (types && types.preventDefault && types.handleObj) {
  30006. handleObj = types.handleObj;
  30007. jQuery(types.delegateTarget).off(
  30008. handleObj.namespace ? handleObj.origType + "." + handleObj.namespace : handleObj.origType,
  30009. handleObj.selector,
  30010. handleObj.handler
  30011. );
  30012. return this;
  30013. }
  30014. if (typeof types === "object") {
  30015. for (type2 in types) {
  30016. this.off(type2, selector, types[type2]);
  30017. }
  30018. return this;
  30019. }
  30020. if (selector === false || typeof selector === "function") {
  30021. fn2 = selector;
  30022. selector = void 0;
  30023. }
  30024. if (fn2 === false) {
  30025. fn2 = returnFalse;
  30026. }
  30027. return this.each(function() {
  30028. jQuery.event.remove(this, types, fn2, selector);
  30029. });
  30030. }
  30031. });
  30032. var rnoInnerhtml = /<script|<style|<link/i, rchecked = /checked\s*(?:[^=]|=\s*.checked.)/i, rcleanScript = /^\s*<!\[CDATA\[|\]\]>\s*$/g;
  30033. function manipulationTarget(elem, content) {
  30034. if (nodeName(elem, "table") && nodeName(content.nodeType !== 11 ? content : content.firstChild, "tr")) {
  30035. return jQuery(elem).children("tbody")[0] || elem;
  30036. }
  30037. return elem;
  30038. }
  30039. function disableScript(elem) {
  30040. elem.type = (elem.getAttribute("type") !== null) + "/" + elem.type;
  30041. return elem;
  30042. }
  30043. function restoreScript(elem) {
  30044. if ((elem.type || "").slice(0, 5) === "true/") {
  30045. elem.type = elem.type.slice(5);
  30046. } else {
  30047. elem.removeAttribute("type");
  30048. }
  30049. return elem;
  30050. }
  30051. function cloneCopyEvent(src, dest) {
  30052. var i2, l, type2, pdataOld, udataOld, udataCur, events;
  30053. if (dest.nodeType !== 1) {
  30054. return;
  30055. }
  30056. if (dataPriv.hasData(src)) {
  30057. pdataOld = dataPriv.get(src);
  30058. events = pdataOld.events;
  30059. if (events) {
  30060. dataPriv.remove(dest, "handle events");
  30061. for (type2 in events) {
  30062. for (i2 = 0, l = events[type2].length; i2 < l; i2++) {
  30063. jQuery.event.add(dest, type2, events[type2][i2]);
  30064. }
  30065. }
  30066. }
  30067. }
  30068. if (dataUser.hasData(src)) {
  30069. udataOld = dataUser.access(src);
  30070. udataCur = jQuery.extend({}, udataOld);
  30071. dataUser.set(dest, udataCur);
  30072. }
  30073. }
  30074. function fixInput(src, dest) {
  30075. var nodeName2 = dest.nodeName.toLowerCase();
  30076. if (nodeName2 === "input" && rcheckableType.test(src.type)) {
  30077. dest.checked = src.checked;
  30078. } else if (nodeName2 === "input" || nodeName2 === "textarea") {
  30079. dest.defaultValue = src.defaultValue;
  30080. }
  30081. }
  30082. function domManip(collection, args, callback2, ignored) {
  30083. args = flat2(args);
  30084. var fragment, first, scripts, hasScripts, node, doc, i2 = 0, l = collection.length, iNoClone = l - 1, value = args[0], valueIsFunction = isFunction2(value);
  30085. if (valueIsFunction || l > 1 && typeof value === "string" && !support.checkClone && rchecked.test(value)) {
  30086. return collection.each(function(index2) {
  30087. var self2 = collection.eq(index2);
  30088. if (valueIsFunction) {
  30089. args[0] = value.call(this, index2, self2.html());
  30090. }
  30091. domManip(self2, args, callback2, ignored);
  30092. });
  30093. }
  30094. if (l) {
  30095. fragment = buildFragment(args, collection[0].ownerDocument, false, collection, ignored);
  30096. first = fragment.firstChild;
  30097. if (fragment.childNodes.length === 1) {
  30098. fragment = first;
  30099. }
  30100. if (first || ignored) {
  30101. scripts = jQuery.map(getAll(fragment, "script"), disableScript);
  30102. hasScripts = scripts.length;
  30103. for (; i2 < l; i2++) {
  30104. node = fragment;
  30105. if (i2 !== iNoClone) {
  30106. node = jQuery.clone(node, true, true);
  30107. if (hasScripts) {
  30108. jQuery.merge(scripts, getAll(node, "script"));
  30109. }
  30110. }
  30111. callback2.call(collection[i2], node, i2);
  30112. }
  30113. if (hasScripts) {
  30114. doc = scripts[scripts.length - 1].ownerDocument;
  30115. jQuery.map(scripts, restoreScript);
  30116. for (i2 = 0; i2 < hasScripts; i2++) {
  30117. node = scripts[i2];
  30118. if (rscriptType.test(node.type || "") && !dataPriv.access(node, "globalEval") && jQuery.contains(doc, node)) {
  30119. if (node.src && (node.type || "").toLowerCase() !== "module") {
  30120. if (jQuery._evalUrl && !node.noModule) {
  30121. jQuery._evalUrl(node.src, {
  30122. nonce: node.nonce || node.getAttribute("nonce")
  30123. }, doc);
  30124. }
  30125. } else {
  30126. DOMEval(node.textContent.replace(rcleanScript, ""), node, doc);
  30127. }
  30128. }
  30129. }
  30130. }
  30131. }
  30132. }
  30133. return collection;
  30134. }
  30135. function remove2(elem, selector, keepData) {
  30136. var node, nodes = selector ? jQuery.filter(selector, elem) : elem, i2 = 0;
  30137. for (; (node = nodes[i2]) != null; i2++) {
  30138. if (!keepData && node.nodeType === 1) {
  30139. jQuery.cleanData(getAll(node));
  30140. }
  30141. if (node.parentNode) {
  30142. if (keepData && isAttached(node)) {
  30143. setGlobalEval(getAll(node, "script"));
  30144. }
  30145. node.parentNode.removeChild(node);
  30146. }
  30147. }
  30148. return elem;
  30149. }
  30150. jQuery.extend({
  30151. htmlPrefilter: function(html) {
  30152. return html;
  30153. },
  30154. clone: function(elem, dataAndEvents, deepDataAndEvents) {
  30155. var i2, l, srcElements, destElements, clone = elem.cloneNode(true), inPage = isAttached(elem);
  30156. if (!support.noCloneChecked && (elem.nodeType === 1 || elem.nodeType === 11) && !jQuery.isXMLDoc(elem)) {
  30157. destElements = getAll(clone);
  30158. srcElements = getAll(elem);
  30159. for (i2 = 0, l = srcElements.length; i2 < l; i2++) {
  30160. fixInput(srcElements[i2], destElements[i2]);
  30161. }
  30162. }
  30163. if (dataAndEvents) {
  30164. if (deepDataAndEvents) {
  30165. srcElements = srcElements || getAll(elem);
  30166. destElements = destElements || getAll(clone);
  30167. for (i2 = 0, l = srcElements.length; i2 < l; i2++) {
  30168. cloneCopyEvent(srcElements[i2], destElements[i2]);
  30169. }
  30170. } else {
  30171. cloneCopyEvent(elem, clone);
  30172. }
  30173. }
  30174. destElements = getAll(clone, "script");
  30175. if (destElements.length > 0) {
  30176. setGlobalEval(destElements, !inPage && getAll(elem, "script"));
  30177. }
  30178. return clone;
  30179. },
  30180. cleanData: function(elems) {
  30181. var data, elem, type2, special = jQuery.event.special, i2 = 0;
  30182. for (; (elem = elems[i2]) !== void 0; i2++) {
  30183. if (acceptData(elem)) {
  30184. if (data = elem[dataPriv.expando]) {
  30185. if (data.events) {
  30186. for (type2 in data.events) {
  30187. if (special[type2]) {
  30188. jQuery.event.remove(elem, type2);
  30189. } else {
  30190. jQuery.removeEvent(elem, type2, data.handle);
  30191. }
  30192. }
  30193. }
  30194. elem[dataPriv.expando] = void 0;
  30195. }
  30196. if (elem[dataUser.expando]) {
  30197. elem[dataUser.expando] = void 0;
  30198. }
  30199. }
  30200. }
  30201. }
  30202. });
  30203. jQuery.fn.extend({
  30204. detach: function(selector) {
  30205. return remove2(this, selector, true);
  30206. },
  30207. remove: function(selector) {
  30208. return remove2(this, selector);
  30209. },
  30210. text: function(value) {
  30211. return access(this, function(value2) {
  30212. return value2 === void 0 ? jQuery.text(this) : this.empty().each(function() {
  30213. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  30214. this.textContent = value2;
  30215. }
  30216. });
  30217. }, null, value, arguments.length);
  30218. },
  30219. append: function() {
  30220. return domManip(this, arguments, function(elem) {
  30221. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  30222. var target = manipulationTarget(this, elem);
  30223. target.appendChild(elem);
  30224. }
  30225. });
  30226. },
  30227. prepend: function() {
  30228. return domManip(this, arguments, function(elem) {
  30229. if (this.nodeType === 1 || this.nodeType === 11 || this.nodeType === 9) {
  30230. var target = manipulationTarget(this, elem);
  30231. target.insertBefore(elem, target.firstChild);
  30232. }
  30233. });
  30234. },
  30235. before: function() {
  30236. return domManip(this, arguments, function(elem) {
  30237. if (this.parentNode) {
  30238. this.parentNode.insertBefore(elem, this);
  30239. }
  30240. });
  30241. },
  30242. after: function() {
  30243. return domManip(this, arguments, function(elem) {
  30244. if (this.parentNode) {
  30245. this.parentNode.insertBefore(elem, this.nextSibling);
  30246. }
  30247. });
  30248. },
  30249. empty: function() {
  30250. var elem, i2 = 0;
  30251. for (; (elem = this[i2]) != null; i2++) {
  30252. if (elem.nodeType === 1) {
  30253. jQuery.cleanData(getAll(elem, false));
  30254. elem.textContent = "";
  30255. }
  30256. }
  30257. return this;
  30258. },
  30259. clone: function(dataAndEvents, deepDataAndEvents) {
  30260. dataAndEvents = dataAndEvents == null ? false : dataAndEvents;
  30261. deepDataAndEvents = deepDataAndEvents == null ? dataAndEvents : deepDataAndEvents;
  30262. return this.map(function() {
  30263. return jQuery.clone(this, dataAndEvents, deepDataAndEvents);
  30264. });
  30265. },
  30266. html: function(value) {
  30267. return access(this, function(value2) {
  30268. var elem = this[0] || {}, i2 = 0, l = this.length;
  30269. if (value2 === void 0 && elem.nodeType === 1) {
  30270. return elem.innerHTML;
  30271. }
  30272. if (typeof value2 === "string" && !rnoInnerhtml.test(value2) && !wrapMap[(rtagName.exec(value2) || ["", ""])[1].toLowerCase()]) {
  30273. value2 = jQuery.htmlPrefilter(value2);
  30274. try {
  30275. for (; i2 < l; i2++) {
  30276. elem = this[i2] || {};
  30277. if (elem.nodeType === 1) {
  30278. jQuery.cleanData(getAll(elem, false));
  30279. elem.innerHTML = value2;
  30280. }
  30281. }
  30282. elem = 0;
  30283. } catch (e) {
  30284. }
  30285. }
  30286. if (elem) {
  30287. this.empty().append(value2);
  30288. }
  30289. }, null, value, arguments.length);
  30290. },
  30291. replaceWith: function() {
  30292. var ignored = [];
  30293. return domManip(this, arguments, function(elem) {
  30294. var parent = this.parentNode;
  30295. if (jQuery.inArray(this, ignored) < 0) {
  30296. jQuery.cleanData(getAll(this));
  30297. if (parent) {
  30298. parent.replaceChild(elem, this);
  30299. }
  30300. }
  30301. }, ignored);
  30302. }
  30303. });
  30304. jQuery.each({
  30305. appendTo: "append",
  30306. prependTo: "prepend",
  30307. insertBefore: "before",
  30308. insertAfter: "after",
  30309. replaceAll: "replaceWith"
  30310. }, function(name, original) {
  30311. jQuery.fn[name] = function(selector) {
  30312. var elems, ret = [], insert = jQuery(selector), last = insert.length - 1, i2 = 0;
  30313. for (; i2 <= last; i2++) {
  30314. elems = i2 === last ? this : this.clone(true);
  30315. jQuery(insert[i2])[original](elems);
  30316. push.apply(ret, elems.get());
  30317. }
  30318. return this.pushStack(ret);
  30319. };
  30320. });
  30321. var rnumnonpx = new RegExp("^(" + pnum + ")(?!px)[a-z%]+$", "i");
  30322. var rcustomProp = /^--/;
  30323. var getStyles = function(elem) {
  30324. var view = elem.ownerDocument.defaultView;
  30325. if (!view || !view.opener) {
  30326. view = window2;
  30327. }
  30328. return view.getComputedStyle(elem);
  30329. };
  30330. var swap = function(elem, options2, callback2) {
  30331. var ret, name, old = {};
  30332. for (name in options2) {
  30333. old[name] = elem.style[name];
  30334. elem.style[name] = options2[name];
  30335. }
  30336. ret = callback2.call(elem);
  30337. for (name in options2) {
  30338. elem.style[name] = old[name];
  30339. }
  30340. return ret;
  30341. };
  30342. var rboxStyle = new RegExp(cssExpand.join("|"), "i");
  30343. (function() {
  30344. function computeStyleTests() {
  30345. if (!div) {
  30346. return;
  30347. }
  30348. container.style.cssText = "position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0";
  30349. div.style.cssText = "position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%";
  30350. documentElement.appendChild(container).appendChild(div);
  30351. var divStyle = window2.getComputedStyle(div);
  30352. pixelPositionVal = divStyle.top !== "1%";
  30353. reliableMarginLeftVal = roundPixelMeasures(divStyle.marginLeft) === 12;
  30354. div.style.right = "60%";
  30355. pixelBoxStylesVal = roundPixelMeasures(divStyle.right) === 36;
  30356. boxSizingReliableVal = roundPixelMeasures(divStyle.width) === 36;
  30357. div.style.position = "absolute";
  30358. scrollboxSizeVal = roundPixelMeasures(div.offsetWidth / 3) === 12;
  30359. documentElement.removeChild(container);
  30360. div = null;
  30361. }
  30362. function roundPixelMeasures(measure) {
  30363. return Math.round(parseFloat(measure));
  30364. }
  30365. var pixelPositionVal, boxSizingReliableVal, scrollboxSizeVal, pixelBoxStylesVal, reliableTrDimensionsVal, reliableMarginLeftVal, container = document2.createElement("div"), div = document2.createElement("div");
  30366. if (!div.style) {
  30367. return;
  30368. }
  30369. div.style.backgroundClip = "content-box";
  30370. div.cloneNode(true).style.backgroundClip = "";
  30371. support.clearCloneStyle = div.style.backgroundClip === "content-box";
  30372. jQuery.extend(support, {
  30373. boxSizingReliable: function() {
  30374. computeStyleTests();
  30375. return boxSizingReliableVal;
  30376. },
  30377. pixelBoxStyles: function() {
  30378. computeStyleTests();
  30379. return pixelBoxStylesVal;
  30380. },
  30381. pixelPosition: function() {
  30382. computeStyleTests();
  30383. return pixelPositionVal;
  30384. },
  30385. reliableMarginLeft: function() {
  30386. computeStyleTests();
  30387. return reliableMarginLeftVal;
  30388. },
  30389. scrollboxSize: function() {
  30390. computeStyleTests();
  30391. return scrollboxSizeVal;
  30392. },
  30393. reliableTrDimensions: function() {
  30394. var table, tr, trChild, trStyle;
  30395. if (reliableTrDimensionsVal == null) {
  30396. table = document2.createElement("table");
  30397. tr = document2.createElement("tr");
  30398. trChild = document2.createElement("div");
  30399. table.style.cssText = "position:absolute;left:-11111px;border-collapse:separate";
  30400. tr.style.cssText = "border:1px solid";
  30401. tr.style.height = "1px";
  30402. trChild.style.height = "9px";
  30403. trChild.style.display = "block";
  30404. documentElement.appendChild(table).appendChild(tr).appendChild(trChild);
  30405. trStyle = window2.getComputedStyle(tr);
  30406. reliableTrDimensionsVal = parseInt(trStyle.height, 10) + parseInt(trStyle.borderTopWidth, 10) + parseInt(trStyle.borderBottomWidth, 10) === tr.offsetHeight;
  30407. documentElement.removeChild(table);
  30408. }
  30409. return reliableTrDimensionsVal;
  30410. }
  30411. });
  30412. })();
  30413. function curCSS(elem, name, computed2) {
  30414. var width2, minWidth, maxWidth, ret, isCustomProp = rcustomProp.test(name), style = elem.style;
  30415. computed2 = computed2 || getStyles(elem);
  30416. if (computed2) {
  30417. ret = computed2.getPropertyValue(name) || computed2[name];
  30418. if (isCustomProp && ret) {
  30419. ret = ret.replace(rtrimCSS, "$1") || void 0;
  30420. }
  30421. if (ret === "" && !isAttached(elem)) {
  30422. ret = jQuery.style(elem, name);
  30423. }
  30424. if (!support.pixelBoxStyles() && rnumnonpx.test(ret) && rboxStyle.test(name)) {
  30425. width2 = style.width;
  30426. minWidth = style.minWidth;
  30427. maxWidth = style.maxWidth;
  30428. style.minWidth = style.maxWidth = style.width = ret;
  30429. ret = computed2.width;
  30430. style.width = width2;
  30431. style.minWidth = minWidth;
  30432. style.maxWidth = maxWidth;
  30433. }
  30434. }
  30435. return ret !== void 0 ? ret + "" : ret;
  30436. }
  30437. function addGetHookIf(conditionFn, hookFn) {
  30438. return {
  30439. get: function() {
  30440. if (conditionFn()) {
  30441. delete this.get;
  30442. return;
  30443. }
  30444. return (this.get = hookFn).apply(this, arguments);
  30445. }
  30446. };
  30447. }
  30448. var cssPrefixes = ["Webkit", "Moz", "ms"], emptyStyle = document2.createElement("div").style, vendorProps = {};
  30449. function vendorPropName(name) {
  30450. var capName = name[0].toUpperCase() + name.slice(1), i2 = cssPrefixes.length;
  30451. while (i2--) {
  30452. name = cssPrefixes[i2] + capName;
  30453. if (name in emptyStyle) {
  30454. return name;
  30455. }
  30456. }
  30457. }
  30458. function finalPropName(name) {
  30459. var final = jQuery.cssProps[name] || vendorProps[name];
  30460. if (final) {
  30461. return final;
  30462. }
  30463. if (name in emptyStyle) {
  30464. return name;
  30465. }
  30466. return vendorProps[name] = vendorPropName(name) || name;
  30467. }
  30468. var rdisplayswap = /^(none|table(?!-c[ea]).+)/, cssShow = { position: "absolute", visibility: "hidden", display: "block" }, cssNormalTransform = {
  30469. letterSpacing: "0",
  30470. fontWeight: "400"
  30471. };
  30472. function setPositiveNumber(_elem, value, subtract) {
  30473. var matches = rcssNum.exec(value);
  30474. return matches ? Math.max(0, matches[2] - (subtract || 0)) + (matches[3] || "px") : value;
  30475. }
  30476. function boxModelAdjustment(elem, dimension, box, isBorderBox, styles, computedVal) {
  30477. var i2 = dimension === "width" ? 1 : 0, extra = 0, delta = 0, marginDelta = 0;
  30478. if (box === (isBorderBox ? "border" : "content")) {
  30479. return 0;
  30480. }
  30481. for (; i2 < 4; i2 += 2) {
  30482. if (box === "margin") {
  30483. marginDelta += jQuery.css(elem, box + cssExpand[i2], true, styles);
  30484. }
  30485. if (!isBorderBox) {
  30486. delta += jQuery.css(elem, "padding" + cssExpand[i2], true, styles);
  30487. if (box !== "padding") {
  30488. delta += jQuery.css(elem, "border" + cssExpand[i2] + "Width", true, styles);
  30489. } else {
  30490. extra += jQuery.css(elem, "border" + cssExpand[i2] + "Width", true, styles);
  30491. }
  30492. } else {
  30493. if (box === "content") {
  30494. delta -= jQuery.css(elem, "padding" + cssExpand[i2], true, styles);
  30495. }
  30496. if (box !== "margin") {
  30497. delta -= jQuery.css(elem, "border" + cssExpand[i2] + "Width", true, styles);
  30498. }
  30499. }
  30500. }
  30501. if (!isBorderBox && computedVal >= 0) {
  30502. delta += Math.max(0, Math.ceil(
  30503. elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - computedVal - delta - extra - 0.5
  30504. )) || 0;
  30505. }
  30506. return delta + marginDelta;
  30507. }
  30508. function getWidthOrHeight(elem, dimension, extra) {
  30509. var styles = getStyles(elem), boxSizingNeeded = !support.boxSizingReliable() || extra, isBorderBox = boxSizingNeeded && jQuery.css(elem, "boxSizing", false, styles) === "border-box", valueIsBorderBox = isBorderBox, val = curCSS(elem, dimension, styles), offsetProp = "offset" + dimension[0].toUpperCase() + dimension.slice(1);
  30510. if (rnumnonpx.test(val)) {
  30511. if (!extra) {
  30512. return val;
  30513. }
  30514. val = "auto";
  30515. }
  30516. if ((!support.boxSizingReliable() && isBorderBox || !support.reliableTrDimensions() && nodeName(elem, "tr") || val === "auto" || !parseFloat(val) && jQuery.css(elem, "display", false, styles) === "inline") && elem.getClientRects().length) {
  30517. isBorderBox = jQuery.css(elem, "boxSizing", false, styles) === "border-box";
  30518. valueIsBorderBox = offsetProp in elem;
  30519. if (valueIsBorderBox) {
  30520. val = elem[offsetProp];
  30521. }
  30522. }
  30523. val = parseFloat(val) || 0;
  30524. return val + boxModelAdjustment(
  30525. elem,
  30526. dimension,
  30527. extra || (isBorderBox ? "border" : "content"),
  30528. valueIsBorderBox,
  30529. styles,
  30530. val
  30531. ) + "px";
  30532. }
  30533. jQuery.extend({
  30534. cssHooks: {
  30535. opacity: {
  30536. get: function(elem, computed2) {
  30537. if (computed2) {
  30538. var ret = curCSS(elem, "opacity");
  30539. return ret === "" ? "1" : ret;
  30540. }
  30541. }
  30542. }
  30543. },
  30544. cssNumber: {
  30545. animationIterationCount: true,
  30546. aspectRatio: true,
  30547. borderImageSlice: true,
  30548. columnCount: true,
  30549. flexGrow: true,
  30550. flexShrink: true,
  30551. fontWeight: true,
  30552. gridArea: true,
  30553. gridColumn: true,
  30554. gridColumnEnd: true,
  30555. gridColumnStart: true,
  30556. gridRow: true,
  30557. gridRowEnd: true,
  30558. gridRowStart: true,
  30559. lineHeight: true,
  30560. opacity: true,
  30561. order: true,
  30562. orphans: true,
  30563. scale: true,
  30564. widows: true,
  30565. zIndex: true,
  30566. zoom: true,
  30567. fillOpacity: true,
  30568. floodOpacity: true,
  30569. stopOpacity: true,
  30570. strokeMiterlimit: true,
  30571. strokeOpacity: true
  30572. },
  30573. cssProps: {},
  30574. style: function(elem, name, value, extra) {
  30575. if (!elem || elem.nodeType === 3 || elem.nodeType === 8 || !elem.style) {
  30576. return;
  30577. }
  30578. var ret, type2, hooks3, origName = camelCase3(name), isCustomProp = rcustomProp.test(name), style = elem.style;
  30579. if (!isCustomProp) {
  30580. name = finalPropName(origName);
  30581. }
  30582. hooks3 = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  30583. if (value !== void 0) {
  30584. type2 = typeof value;
  30585. if (type2 === "string" && (ret = rcssNum.exec(value)) && ret[1]) {
  30586. value = adjustCSS(elem, name, ret);
  30587. type2 = "number";
  30588. }
  30589. if (value == null || value !== value) {
  30590. return;
  30591. }
  30592. if (type2 === "number" && !isCustomProp) {
  30593. value += ret && ret[3] || (jQuery.cssNumber[origName] ? "" : "px");
  30594. }
  30595. if (!support.clearCloneStyle && value === "" && name.indexOf("background") === 0) {
  30596. style[name] = "inherit";
  30597. }
  30598. if (!hooks3 || !("set" in hooks3) || (value = hooks3.set(elem, value, extra)) !== void 0) {
  30599. if (isCustomProp) {
  30600. style.setProperty(name, value);
  30601. } else {
  30602. style[name] = value;
  30603. }
  30604. }
  30605. } else {
  30606. if (hooks3 && "get" in hooks3 && (ret = hooks3.get(elem, false, extra)) !== void 0) {
  30607. return ret;
  30608. }
  30609. return style[name];
  30610. }
  30611. },
  30612. css: function(elem, name, extra, styles) {
  30613. var val, num, hooks3, origName = camelCase3(name), isCustomProp = rcustomProp.test(name);
  30614. if (!isCustomProp) {
  30615. name = finalPropName(origName);
  30616. }
  30617. hooks3 = jQuery.cssHooks[name] || jQuery.cssHooks[origName];
  30618. if (hooks3 && "get" in hooks3) {
  30619. val = hooks3.get(elem, true, extra);
  30620. }
  30621. if (val === void 0) {
  30622. val = curCSS(elem, name, styles);
  30623. }
  30624. if (val === "normal" && name in cssNormalTransform) {
  30625. val = cssNormalTransform[name];
  30626. }
  30627. if (extra === "" || extra) {
  30628. num = parseFloat(val);
  30629. return extra === true || isFinite(num) ? num || 0 : val;
  30630. }
  30631. return val;
  30632. }
  30633. });
  30634. jQuery.each(["height", "width"], function(_i, dimension) {
  30635. jQuery.cssHooks[dimension] = {
  30636. get: function(elem, computed2, extra) {
  30637. if (computed2) {
  30638. return rdisplayswap.test(jQuery.css(elem, "display")) && (!elem.getClientRects().length || !elem.getBoundingClientRect().width) ? swap(elem, cssShow, function() {
  30639. return getWidthOrHeight(elem, dimension, extra);
  30640. }) : getWidthOrHeight(elem, dimension, extra);
  30641. }
  30642. },
  30643. set: function(elem, value, extra) {
  30644. var matches, styles = getStyles(elem), scrollboxSizeBuggy = !support.scrollboxSize() && styles.position === "absolute", boxSizingNeeded = scrollboxSizeBuggy || extra, isBorderBox = boxSizingNeeded && jQuery.css(elem, "boxSizing", false, styles) === "border-box", subtract = extra ? boxModelAdjustment(
  30645. elem,
  30646. dimension,
  30647. extra,
  30648. isBorderBox,
  30649. styles
  30650. ) : 0;
  30651. if (isBorderBox && scrollboxSizeBuggy) {
  30652. subtract -= Math.ceil(
  30653. elem["offset" + dimension[0].toUpperCase() + dimension.slice(1)] - parseFloat(styles[dimension]) - boxModelAdjustment(elem, dimension, "border", false, styles) - 0.5
  30654. );
  30655. }
  30656. if (subtract && (matches = rcssNum.exec(value)) && (matches[3] || "px") !== "px") {
  30657. elem.style[dimension] = value;
  30658. value = jQuery.css(elem, dimension);
  30659. }
  30660. return setPositiveNumber(elem, value, subtract);
  30661. }
  30662. };
  30663. });
  30664. jQuery.cssHooks.marginLeft = addGetHookIf(
  30665. support.reliableMarginLeft,
  30666. function(elem, computed2) {
  30667. if (computed2) {
  30668. return (parseFloat(curCSS(elem, "marginLeft")) || elem.getBoundingClientRect().left - swap(elem, { marginLeft: 0 }, function() {
  30669. return elem.getBoundingClientRect().left;
  30670. })) + "px";
  30671. }
  30672. }
  30673. );
  30674. jQuery.each({
  30675. margin: "",
  30676. padding: "",
  30677. border: "Width"
  30678. }, function(prefix, suffix) {
  30679. jQuery.cssHooks[prefix + suffix] = {
  30680. expand: function(value) {
  30681. var i2 = 0, expanded = {}, parts = typeof value === "string" ? value.split(" ") : [value];
  30682. for (; i2 < 4; i2++) {
  30683. expanded[prefix + cssExpand[i2] + suffix] = parts[i2] || parts[i2 - 2] || parts[0];
  30684. }
  30685. return expanded;
  30686. }
  30687. };
  30688. if (prefix !== "margin") {
  30689. jQuery.cssHooks[prefix + suffix].set = setPositiveNumber;
  30690. }
  30691. });
  30692. jQuery.fn.extend({
  30693. css: function(name, value) {
  30694. return access(this, function(elem, name2, value2) {
  30695. var styles, len, map = {}, i2 = 0;
  30696. if (Array.isArray(name2)) {
  30697. styles = getStyles(elem);
  30698. len = name2.length;
  30699. for (; i2 < len; i2++) {
  30700. map[name2[i2]] = jQuery.css(elem, name2[i2], false, styles);
  30701. }
  30702. return map;
  30703. }
  30704. return value2 !== void 0 ? jQuery.style(elem, name2, value2) : jQuery.css(elem, name2);
  30705. }, name, value, arguments.length > 1);
  30706. }
  30707. });
  30708. function Tween(elem, options2, prop, end, easing) {
  30709. return new Tween.prototype.init(elem, options2, prop, end, easing);
  30710. }
  30711. jQuery.Tween = Tween;
  30712. Tween.prototype = {
  30713. constructor: Tween,
  30714. init: function(elem, options2, prop, end, easing, unit) {
  30715. this.elem = elem;
  30716. this.prop = prop;
  30717. this.easing = easing || jQuery.easing._default;
  30718. this.options = options2;
  30719. this.start = this.now = this.cur();
  30720. this.end = end;
  30721. this.unit = unit || (jQuery.cssNumber[prop] ? "" : "px");
  30722. },
  30723. cur: function() {
  30724. var hooks3 = Tween.propHooks[this.prop];
  30725. return hooks3 && hooks3.get ? hooks3.get(this) : Tween.propHooks._default.get(this);
  30726. },
  30727. run: function(percent) {
  30728. var eased, hooks3 = Tween.propHooks[this.prop];
  30729. if (this.options.duration) {
  30730. this.pos = eased = jQuery.easing[this.easing](
  30731. percent,
  30732. this.options.duration * percent,
  30733. 0,
  30734. 1,
  30735. this.options.duration
  30736. );
  30737. } else {
  30738. this.pos = eased = percent;
  30739. }
  30740. this.now = (this.end - this.start) * eased + this.start;
  30741. if (this.options.step) {
  30742. this.options.step.call(this.elem, this.now, this);
  30743. }
  30744. if (hooks3 && hooks3.set) {
  30745. hooks3.set(this);
  30746. } else {
  30747. Tween.propHooks._default.set(this);
  30748. }
  30749. return this;
  30750. }
  30751. };
  30752. Tween.prototype.init.prototype = Tween.prototype;
  30753. Tween.propHooks = {
  30754. _default: {
  30755. get: function(tween) {
  30756. var result;
  30757. if (tween.elem.nodeType !== 1 || tween.elem[tween.prop] != null && tween.elem.style[tween.prop] == null) {
  30758. return tween.elem[tween.prop];
  30759. }
  30760. result = jQuery.css(tween.elem, tween.prop, "");
  30761. return !result || result === "auto" ? 0 : result;
  30762. },
  30763. set: function(tween) {
  30764. if (jQuery.fx.step[tween.prop]) {
  30765. jQuery.fx.step[tween.prop](tween);
  30766. } else if (tween.elem.nodeType === 1 && (jQuery.cssHooks[tween.prop] || tween.elem.style[finalPropName(tween.prop)] != null)) {
  30767. jQuery.style(tween.elem, tween.prop, tween.now + tween.unit);
  30768. } else {
  30769. tween.elem[tween.prop] = tween.now;
  30770. }
  30771. }
  30772. }
  30773. };
  30774. Tween.propHooks.scrollTop = Tween.propHooks.scrollLeft = {
  30775. set: function(tween) {
  30776. if (tween.elem.nodeType && tween.elem.parentNode) {
  30777. tween.elem[tween.prop] = tween.now;
  30778. }
  30779. }
  30780. };
  30781. jQuery.easing = {
  30782. linear: function(p) {
  30783. return p;
  30784. },
  30785. swing: function(p) {
  30786. return 0.5 - Math.cos(p * Math.PI) / 2;
  30787. },
  30788. _default: "swing"
  30789. };
  30790. jQuery.fx = Tween.prototype.init;
  30791. jQuery.fx.step = {};
  30792. var fxNow, inProgress, rfxtypes = /^(?:toggle|show|hide)$/, rrun = /queueHooks$/;
  30793. function schedule() {
  30794. if (inProgress) {
  30795. if (document2.hidden === false && window2.requestAnimationFrame) {
  30796. window2.requestAnimationFrame(schedule);
  30797. } else {
  30798. window2.setTimeout(schedule, jQuery.fx.interval);
  30799. }
  30800. jQuery.fx.tick();
  30801. }
  30802. }
  30803. function createFxNow() {
  30804. window2.setTimeout(function() {
  30805. fxNow = void 0;
  30806. });
  30807. return fxNow = Date.now();
  30808. }
  30809. function genFx(type2, includeWidth) {
  30810. var which, i2 = 0, attrs = { height: type2 };
  30811. includeWidth = includeWidth ? 1 : 0;
  30812. for (; i2 < 4; i2 += 2 - includeWidth) {
  30813. which = cssExpand[i2];
  30814. attrs["margin" + which] = attrs["padding" + which] = type2;
  30815. }
  30816. if (includeWidth) {
  30817. attrs.opacity = attrs.width = type2;
  30818. }
  30819. return attrs;
  30820. }
  30821. function createTween(value, prop, animation) {
  30822. var tween, collection = (Animation.tweeners[prop] || []).concat(Animation.tweeners["*"]), index2 = 0, length = collection.length;
  30823. for (; index2 < length; index2++) {
  30824. if (tween = collection[index2].call(animation, prop, value)) {
  30825. return tween;
  30826. }
  30827. }
  30828. }
  30829. function defaultPrefilter(elem, props, opts) {
  30830. var prop, value, toggle, hooks3, oldfire, propTween, restoreDisplay, display, isBox = "width" in props || "height" in props, anim = this, orig = {}, style = elem.style, hidden = elem.nodeType && isHiddenWithinTree(elem), dataShow = dataPriv.get(elem, "fxshow");
  30831. if (!opts.queue) {
  30832. hooks3 = jQuery._queueHooks(elem, "fx");
  30833. if (hooks3.unqueued == null) {
  30834. hooks3.unqueued = 0;
  30835. oldfire = hooks3.empty.fire;
  30836. hooks3.empty.fire = function() {
  30837. if (!hooks3.unqueued) {
  30838. oldfire();
  30839. }
  30840. };
  30841. }
  30842. hooks3.unqueued++;
  30843. anim.always(function() {
  30844. anim.always(function() {
  30845. hooks3.unqueued--;
  30846. if (!jQuery.queue(elem, "fx").length) {
  30847. hooks3.empty.fire();
  30848. }
  30849. });
  30850. });
  30851. }
  30852. for (prop in props) {
  30853. value = props[prop];
  30854. if (rfxtypes.test(value)) {
  30855. delete props[prop];
  30856. toggle = toggle || value === "toggle";
  30857. if (value === (hidden ? "hide" : "show")) {
  30858. if (value === "show" && dataShow && dataShow[prop] !== void 0) {
  30859. hidden = true;
  30860. } else {
  30861. continue;
  30862. }
  30863. }
  30864. orig[prop] = dataShow && dataShow[prop] || jQuery.style(elem, prop);
  30865. }
  30866. }
  30867. propTween = !jQuery.isEmptyObject(props);
  30868. if (!propTween && jQuery.isEmptyObject(orig)) {
  30869. return;
  30870. }
  30871. if (isBox && elem.nodeType === 1) {
  30872. opts.overflow = [style.overflow, style.overflowX, style.overflowY];
  30873. restoreDisplay = dataShow && dataShow.display;
  30874. if (restoreDisplay == null) {
  30875. restoreDisplay = dataPriv.get(elem, "display");
  30876. }
  30877. display = jQuery.css(elem, "display");
  30878. if (display === "none") {
  30879. if (restoreDisplay) {
  30880. display = restoreDisplay;
  30881. } else {
  30882. showHide([elem], true);
  30883. restoreDisplay = elem.style.display || restoreDisplay;
  30884. display = jQuery.css(elem, "display");
  30885. showHide([elem]);
  30886. }
  30887. }
  30888. if (display === "inline" || display === "inline-block" && restoreDisplay != null) {
  30889. if (jQuery.css(elem, "float") === "none") {
  30890. if (!propTween) {
  30891. anim.done(function() {
  30892. style.display = restoreDisplay;
  30893. });
  30894. if (restoreDisplay == null) {
  30895. display = style.display;
  30896. restoreDisplay = display === "none" ? "" : display;
  30897. }
  30898. }
  30899. style.display = "inline-block";
  30900. }
  30901. }
  30902. }
  30903. if (opts.overflow) {
  30904. style.overflow = "hidden";
  30905. anim.always(function() {
  30906. style.overflow = opts.overflow[0];
  30907. style.overflowX = opts.overflow[1];
  30908. style.overflowY = opts.overflow[2];
  30909. });
  30910. }
  30911. propTween = false;
  30912. for (prop in orig) {
  30913. if (!propTween) {
  30914. if (dataShow) {
  30915. if ("hidden" in dataShow) {
  30916. hidden = dataShow.hidden;
  30917. }
  30918. } else {
  30919. dataShow = dataPriv.access(elem, "fxshow", { display: restoreDisplay });
  30920. }
  30921. if (toggle) {
  30922. dataShow.hidden = !hidden;
  30923. }
  30924. if (hidden) {
  30925. showHide([elem], true);
  30926. }
  30927. anim.done(function() {
  30928. if (!hidden) {
  30929. showHide([elem]);
  30930. }
  30931. dataPriv.remove(elem, "fxshow");
  30932. for (prop in orig) {
  30933. jQuery.style(elem, prop, orig[prop]);
  30934. }
  30935. });
  30936. }
  30937. propTween = createTween(hidden ? dataShow[prop] : 0, prop, anim);
  30938. if (!(prop in dataShow)) {
  30939. dataShow[prop] = propTween.start;
  30940. if (hidden) {
  30941. propTween.end = propTween.start;
  30942. propTween.start = 0;
  30943. }
  30944. }
  30945. }
  30946. }
  30947. function propFilter(props, specialEasing) {
  30948. var index2, name, easing, value, hooks3;
  30949. for (index2 in props) {
  30950. name = camelCase3(index2);
  30951. easing = specialEasing[name];
  30952. value = props[index2];
  30953. if (Array.isArray(value)) {
  30954. easing = value[1];
  30955. value = props[index2] = value[0];
  30956. }
  30957. if (index2 !== name) {
  30958. props[name] = value;
  30959. delete props[index2];
  30960. }
  30961. hooks3 = jQuery.cssHooks[name];
  30962. if (hooks3 && "expand" in hooks3) {
  30963. value = hooks3.expand(value);
  30964. delete props[name];
  30965. for (index2 in value) {
  30966. if (!(index2 in props)) {
  30967. props[index2] = value[index2];
  30968. specialEasing[index2] = easing;
  30969. }
  30970. }
  30971. } else {
  30972. specialEasing[name] = easing;
  30973. }
  30974. }
  30975. }
  30976. function Animation(elem, properties, options2) {
  30977. var result, stopped, index2 = 0, length = Animation.prefilters.length, deferred = jQuery.Deferred().always(function() {
  30978. delete tick.elem;
  30979. }), tick = function() {
  30980. if (stopped) {
  30981. return false;
  30982. }
  30983. var currentTime = fxNow || createFxNow(), remaining = Math.max(0, animation.startTime + animation.duration - currentTime), temp = remaining / animation.duration || 0, percent = 1 - temp, index3 = 0, length2 = animation.tweens.length;
  30984. for (; index3 < length2; index3++) {
  30985. animation.tweens[index3].run(percent);
  30986. }
  30987. deferred.notifyWith(elem, [animation, percent, remaining]);
  30988. if (percent < 1 && length2) {
  30989. return remaining;
  30990. }
  30991. if (!length2) {
  30992. deferred.notifyWith(elem, [animation, 1, 0]);
  30993. }
  30994. deferred.resolveWith(elem, [animation]);
  30995. return false;
  30996. }, animation = deferred.promise({
  30997. elem,
  30998. props: jQuery.extend({}, properties),
  30999. opts: jQuery.extend(true, {
  31000. specialEasing: {},
  31001. easing: jQuery.easing._default
  31002. }, options2),
  31003. originalProperties: properties,
  31004. originalOptions: options2,
  31005. startTime: fxNow || createFxNow(),
  31006. duration: options2.duration,
  31007. tweens: [],
  31008. createTween: function(prop, end) {
  31009. var tween = jQuery.Tween(
  31010. elem,
  31011. animation.opts,
  31012. prop,
  31013. end,
  31014. animation.opts.specialEasing[prop] || animation.opts.easing
  31015. );
  31016. animation.tweens.push(tween);
  31017. return tween;
  31018. },
  31019. stop: function(gotoEnd) {
  31020. var index3 = 0, length2 = gotoEnd ? animation.tweens.length : 0;
  31021. if (stopped) {
  31022. return this;
  31023. }
  31024. stopped = true;
  31025. for (; index3 < length2; index3++) {
  31026. animation.tweens[index3].run(1);
  31027. }
  31028. if (gotoEnd) {
  31029. deferred.notifyWith(elem, [animation, 1, 0]);
  31030. deferred.resolveWith(elem, [animation, gotoEnd]);
  31031. } else {
  31032. deferred.rejectWith(elem, [animation, gotoEnd]);
  31033. }
  31034. return this;
  31035. }
  31036. }), props = animation.props;
  31037. propFilter(props, animation.opts.specialEasing);
  31038. for (; index2 < length; index2++) {
  31039. result = Animation.prefilters[index2].call(animation, elem, props, animation.opts);
  31040. if (result) {
  31041. if (isFunction2(result.stop)) {
  31042. jQuery._queueHooks(animation.elem, animation.opts.queue).stop = result.stop.bind(result);
  31043. }
  31044. return result;
  31045. }
  31046. }
  31047. jQuery.map(props, createTween, animation);
  31048. if (isFunction2(animation.opts.start)) {
  31049. animation.opts.start.call(elem, animation);
  31050. }
  31051. animation.progress(animation.opts.progress).done(animation.opts.done, animation.opts.complete).fail(animation.opts.fail).always(animation.opts.always);
  31052. jQuery.fx.timer(
  31053. jQuery.extend(tick, {
  31054. elem,
  31055. anim: animation,
  31056. queue: animation.opts.queue
  31057. })
  31058. );
  31059. return animation;
  31060. }
  31061. jQuery.Animation = jQuery.extend(Animation, {
  31062. tweeners: {
  31063. "*": [function(prop, value) {
  31064. var tween = this.createTween(prop, value);
  31065. adjustCSS(tween.elem, prop, rcssNum.exec(value), tween);
  31066. return tween;
  31067. }]
  31068. },
  31069. tweener: function(props, callback2) {
  31070. if (isFunction2(props)) {
  31071. callback2 = props;
  31072. props = ["*"];
  31073. } else {
  31074. props = props.match(rnothtmlwhite);
  31075. }
  31076. var prop, index2 = 0, length = props.length;
  31077. for (; index2 < length; index2++) {
  31078. prop = props[index2];
  31079. Animation.tweeners[prop] = Animation.tweeners[prop] || [];
  31080. Animation.tweeners[prop].unshift(callback2);
  31081. }
  31082. },
  31083. prefilters: [defaultPrefilter],
  31084. prefilter: function(callback2, prepend) {
  31085. if (prepend) {
  31086. Animation.prefilters.unshift(callback2);
  31087. } else {
  31088. Animation.prefilters.push(callback2);
  31089. }
  31090. }
  31091. });
  31092. jQuery.speed = function(speed, easing, fn2) {
  31093. var opt = speed && typeof speed === "object" ? jQuery.extend({}, speed) : {
  31094. complete: fn2 || !fn2 && easing || isFunction2(speed) && speed,
  31095. duration: speed,
  31096. easing: fn2 && easing || easing && !isFunction2(easing) && easing
  31097. };
  31098. if (jQuery.fx.off) {
  31099. opt.duration = 0;
  31100. } else {
  31101. if (typeof opt.duration !== "number") {
  31102. if (opt.duration in jQuery.fx.speeds) {
  31103. opt.duration = jQuery.fx.speeds[opt.duration];
  31104. } else {
  31105. opt.duration = jQuery.fx.speeds._default;
  31106. }
  31107. }
  31108. }
  31109. if (opt.queue == null || opt.queue === true) {
  31110. opt.queue = "fx";
  31111. }
  31112. opt.old = opt.complete;
  31113. opt.complete = function() {
  31114. if (isFunction2(opt.old)) {
  31115. opt.old.call(this);
  31116. }
  31117. if (opt.queue) {
  31118. jQuery.dequeue(this, opt.queue);
  31119. }
  31120. };
  31121. return opt;
  31122. };
  31123. jQuery.fn.extend({
  31124. fadeTo: function(speed, to, easing, callback2) {
  31125. return this.filter(isHiddenWithinTree).css("opacity", 0).show().end().animate({ opacity: to }, speed, easing, callback2);
  31126. },
  31127. animate: function(prop, speed, easing, callback2) {
  31128. var empty = jQuery.isEmptyObject(prop), optall = jQuery.speed(speed, easing, callback2), doAnimation = function() {
  31129. var anim = Animation(this, jQuery.extend({}, prop), optall);
  31130. if (empty || dataPriv.get(this, "finish")) {
  31131. anim.stop(true);
  31132. }
  31133. };
  31134. doAnimation.finish = doAnimation;
  31135. return empty || optall.queue === false ? this.each(doAnimation) : this.queue(optall.queue, doAnimation);
  31136. },
  31137. stop: function(type2, clearQueue, gotoEnd) {
  31138. var stopQueue = function(hooks3) {
  31139. var stop = hooks3.stop;
  31140. delete hooks3.stop;
  31141. stop(gotoEnd);
  31142. };
  31143. if (typeof type2 !== "string") {
  31144. gotoEnd = clearQueue;
  31145. clearQueue = type2;
  31146. type2 = void 0;
  31147. }
  31148. if (clearQueue) {
  31149. this.queue(type2 || "fx", []);
  31150. }
  31151. return this.each(function() {
  31152. var dequeue3 = true, index2 = type2 != null && type2 + "queueHooks", timers = jQuery.timers, data = dataPriv.get(this);
  31153. if (index2) {
  31154. if (data[index2] && data[index2].stop) {
  31155. stopQueue(data[index2]);
  31156. }
  31157. } else {
  31158. for (index2 in data) {
  31159. if (data[index2] && data[index2].stop && rrun.test(index2)) {
  31160. stopQueue(data[index2]);
  31161. }
  31162. }
  31163. }
  31164. for (index2 = timers.length; index2--; ) {
  31165. if (timers[index2].elem === this && (type2 == null || timers[index2].queue === type2)) {
  31166. timers[index2].anim.stop(gotoEnd);
  31167. dequeue3 = false;
  31168. timers.splice(index2, 1);
  31169. }
  31170. }
  31171. if (dequeue3 || !gotoEnd) {
  31172. jQuery.dequeue(this, type2);
  31173. }
  31174. });
  31175. },
  31176. finish: function(type2) {
  31177. if (type2 !== false) {
  31178. type2 = type2 || "fx";
  31179. }
  31180. return this.each(function() {
  31181. var index2, data = dataPriv.get(this), queue = data[type2 + "queue"], hooks3 = data[type2 + "queueHooks"], timers = jQuery.timers, length = queue ? queue.length : 0;
  31182. data.finish = true;
  31183. jQuery.queue(this, type2, []);
  31184. if (hooks3 && hooks3.stop) {
  31185. hooks3.stop.call(this, true);
  31186. }
  31187. for (index2 = timers.length; index2--; ) {
  31188. if (timers[index2].elem === this && timers[index2].queue === type2) {
  31189. timers[index2].anim.stop(true);
  31190. timers.splice(index2, 1);
  31191. }
  31192. }
  31193. for (index2 = 0; index2 < length; index2++) {
  31194. if (queue[index2] && queue[index2].finish) {
  31195. queue[index2].finish.call(this);
  31196. }
  31197. }
  31198. delete data.finish;
  31199. });
  31200. }
  31201. });
  31202. jQuery.each(["toggle", "show", "hide"], function(_i, name) {
  31203. var cssFn = jQuery.fn[name];
  31204. jQuery.fn[name] = function(speed, easing, callback2) {
  31205. return speed == null || typeof speed === "boolean" ? cssFn.apply(this, arguments) : this.animate(genFx(name, true), speed, easing, callback2);
  31206. };
  31207. });
  31208. jQuery.each({
  31209. slideDown: genFx("show"),
  31210. slideUp: genFx("hide"),
  31211. slideToggle: genFx("toggle"),
  31212. fadeIn: { opacity: "show" },
  31213. fadeOut: { opacity: "hide" },
  31214. fadeToggle: { opacity: "toggle" }
  31215. }, function(name, props) {
  31216. jQuery.fn[name] = function(speed, easing, callback2) {
  31217. return this.animate(props, speed, easing, callback2);
  31218. };
  31219. });
  31220. jQuery.timers = [];
  31221. jQuery.fx.tick = function() {
  31222. var timer, i2 = 0, timers = jQuery.timers;
  31223. fxNow = Date.now();
  31224. for (; i2 < timers.length; i2++) {
  31225. timer = timers[i2];
  31226. if (!timer() && timers[i2] === timer) {
  31227. timers.splice(i2--, 1);
  31228. }
  31229. }
  31230. if (!timers.length) {
  31231. jQuery.fx.stop();
  31232. }
  31233. fxNow = void 0;
  31234. };
  31235. jQuery.fx.timer = function(timer) {
  31236. jQuery.timers.push(timer);
  31237. jQuery.fx.start();
  31238. };
  31239. jQuery.fx.interval = 13;
  31240. jQuery.fx.start = function() {
  31241. if (inProgress) {
  31242. return;
  31243. }
  31244. inProgress = true;
  31245. schedule();
  31246. };
  31247. jQuery.fx.stop = function() {
  31248. inProgress = null;
  31249. };
  31250. jQuery.fx.speeds = {
  31251. slow: 600,
  31252. fast: 200,
  31253. _default: 400
  31254. };
  31255. jQuery.fn.delay = function(time, type2) {
  31256. time = jQuery.fx ? jQuery.fx.speeds[time] || time : time;
  31257. type2 = type2 || "fx";
  31258. return this.queue(type2, function(next, hooks3) {
  31259. var timeout = window2.setTimeout(next, time);
  31260. hooks3.stop = function() {
  31261. window2.clearTimeout(timeout);
  31262. };
  31263. });
  31264. };
  31265. (function() {
  31266. var input = document2.createElement("input"), select = document2.createElement("select"), opt = select.appendChild(document2.createElement("option"));
  31267. input.type = "checkbox";
  31268. support.checkOn = input.value !== "";
  31269. support.optSelected = opt.selected;
  31270. input = document2.createElement("input");
  31271. input.value = "t";
  31272. input.type = "radio";
  31273. support.radioValue = input.value === "t";
  31274. })();
  31275. var boolHook, attrHandle = jQuery.expr.attrHandle;
  31276. jQuery.fn.extend({
  31277. attr: function(name, value) {
  31278. return access(this, jQuery.attr, name, value, arguments.length > 1);
  31279. },
  31280. removeAttr: function(name) {
  31281. return this.each(function() {
  31282. jQuery.removeAttr(this, name);
  31283. });
  31284. }
  31285. });
  31286. jQuery.extend({
  31287. attr: function(elem, name, value) {
  31288. var ret, hooks3, nType = elem.nodeType;
  31289. if (nType === 3 || nType === 8 || nType === 2) {
  31290. return;
  31291. }
  31292. if (typeof elem.getAttribute === "undefined") {
  31293. return jQuery.prop(elem, name, value);
  31294. }
  31295. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  31296. hooks3 = jQuery.attrHooks[name.toLowerCase()] || (jQuery.expr.match.bool.test(name) ? boolHook : void 0);
  31297. }
  31298. if (value !== void 0) {
  31299. if (value === null) {
  31300. jQuery.removeAttr(elem, name);
  31301. return;
  31302. }
  31303. if (hooks3 && "set" in hooks3 && (ret = hooks3.set(elem, value, name)) !== void 0) {
  31304. return ret;
  31305. }
  31306. elem.setAttribute(name, value + "");
  31307. return value;
  31308. }
  31309. if (hooks3 && "get" in hooks3 && (ret = hooks3.get(elem, name)) !== null) {
  31310. return ret;
  31311. }
  31312. ret = jQuery.find.attr(elem, name);
  31313. return ret == null ? void 0 : ret;
  31314. },
  31315. attrHooks: {
  31316. type: {
  31317. set: function(elem, value) {
  31318. if (!support.radioValue && value === "radio" && nodeName(elem, "input")) {
  31319. var val = elem.value;
  31320. elem.setAttribute("type", value);
  31321. if (val) {
  31322. elem.value = val;
  31323. }
  31324. return value;
  31325. }
  31326. }
  31327. }
  31328. },
  31329. removeAttr: function(elem, value) {
  31330. var name, i2 = 0, attrNames = value && value.match(rnothtmlwhite);
  31331. if (attrNames && elem.nodeType === 1) {
  31332. while (name = attrNames[i2++]) {
  31333. elem.removeAttribute(name);
  31334. }
  31335. }
  31336. }
  31337. });
  31338. boolHook = {
  31339. set: function(elem, value, name) {
  31340. if (value === false) {
  31341. jQuery.removeAttr(elem, name);
  31342. } else {
  31343. elem.setAttribute(name, name);
  31344. }
  31345. return name;
  31346. }
  31347. };
  31348. jQuery.each(jQuery.expr.match.bool.source.match(/\w+/g), function(_i, name) {
  31349. var getter = attrHandle[name] || jQuery.find.attr;
  31350. attrHandle[name] = function(elem, name2, isXML) {
  31351. var ret, handle, lowercaseName = name2.toLowerCase();
  31352. if (!isXML) {
  31353. handle = attrHandle[lowercaseName];
  31354. attrHandle[lowercaseName] = ret;
  31355. ret = getter(elem, name2, isXML) != null ? lowercaseName : null;
  31356. attrHandle[lowercaseName] = handle;
  31357. }
  31358. return ret;
  31359. };
  31360. });
  31361. var rfocusable = /^(?:input|select|textarea|button)$/i, rclickable = /^(?:a|area)$/i;
  31362. jQuery.fn.extend({
  31363. prop: function(name, value) {
  31364. return access(this, jQuery.prop, name, value, arguments.length > 1);
  31365. },
  31366. removeProp: function(name) {
  31367. return this.each(function() {
  31368. delete this[jQuery.propFix[name] || name];
  31369. });
  31370. }
  31371. });
  31372. jQuery.extend({
  31373. prop: function(elem, name, value) {
  31374. var ret, hooks3, nType = elem.nodeType;
  31375. if (nType === 3 || nType === 8 || nType === 2) {
  31376. return;
  31377. }
  31378. if (nType !== 1 || !jQuery.isXMLDoc(elem)) {
  31379. name = jQuery.propFix[name] || name;
  31380. hooks3 = jQuery.propHooks[name];
  31381. }
  31382. if (value !== void 0) {
  31383. if (hooks3 && "set" in hooks3 && (ret = hooks3.set(elem, value, name)) !== void 0) {
  31384. return ret;
  31385. }
  31386. return elem[name] = value;
  31387. }
  31388. if (hooks3 && "get" in hooks3 && (ret = hooks3.get(elem, name)) !== null) {
  31389. return ret;
  31390. }
  31391. return elem[name];
  31392. },
  31393. propHooks: {
  31394. tabIndex: {
  31395. get: function(elem) {
  31396. var tabindex = jQuery.find.attr(elem, "tabindex");
  31397. if (tabindex) {
  31398. return parseInt(tabindex, 10);
  31399. }
  31400. if (rfocusable.test(elem.nodeName) || rclickable.test(elem.nodeName) && elem.href) {
  31401. return 0;
  31402. }
  31403. return -1;
  31404. }
  31405. }
  31406. },
  31407. propFix: {
  31408. "for": "htmlFor",
  31409. "class": "className"
  31410. }
  31411. });
  31412. if (!support.optSelected) {
  31413. jQuery.propHooks.selected = {
  31414. get: function(elem) {
  31415. var parent = elem.parentNode;
  31416. if (parent && parent.parentNode) {
  31417. parent.parentNode.selectedIndex;
  31418. }
  31419. return null;
  31420. },
  31421. set: function(elem) {
  31422. var parent = elem.parentNode;
  31423. if (parent) {
  31424. parent.selectedIndex;
  31425. if (parent.parentNode) {
  31426. parent.parentNode.selectedIndex;
  31427. }
  31428. }
  31429. }
  31430. };
  31431. }
  31432. jQuery.each([
  31433. "tabIndex",
  31434. "readOnly",
  31435. "maxLength",
  31436. "cellSpacing",
  31437. "cellPadding",
  31438. "rowSpan",
  31439. "colSpan",
  31440. "useMap",
  31441. "frameBorder",
  31442. "contentEditable"
  31443. ], function() {
  31444. jQuery.propFix[this.toLowerCase()] = this;
  31445. });
  31446. function stripAndCollapse(value) {
  31447. var tokens = value.match(rnothtmlwhite) || [];
  31448. return tokens.join(" ");
  31449. }
  31450. function getClass2(elem) {
  31451. return elem.getAttribute && elem.getAttribute("class") || "";
  31452. }
  31453. function classesToArray(value) {
  31454. if (Array.isArray(value)) {
  31455. return value;
  31456. }
  31457. if (typeof value === "string") {
  31458. return value.match(rnothtmlwhite) || [];
  31459. }
  31460. return [];
  31461. }
  31462. jQuery.fn.extend({
  31463. addClass: function(value) {
  31464. var classNames, cur, curValue, className, i2, finalValue;
  31465. if (isFunction2(value)) {
  31466. return this.each(function(j) {
  31467. jQuery(this).addClass(value.call(this, j, getClass2(this)));
  31468. });
  31469. }
  31470. classNames = classesToArray(value);
  31471. if (classNames.length) {
  31472. return this.each(function() {
  31473. curValue = getClass2(this);
  31474. cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  31475. if (cur) {
  31476. for (i2 = 0; i2 < classNames.length; i2++) {
  31477. className = classNames[i2];
  31478. if (cur.indexOf(" " + className + " ") < 0) {
  31479. cur += className + " ";
  31480. }
  31481. }
  31482. finalValue = stripAndCollapse(cur);
  31483. if (curValue !== finalValue) {
  31484. this.setAttribute("class", finalValue);
  31485. }
  31486. }
  31487. });
  31488. }
  31489. return this;
  31490. },
  31491. removeClass: function(value) {
  31492. var classNames, cur, curValue, className, i2, finalValue;
  31493. if (isFunction2(value)) {
  31494. return this.each(function(j) {
  31495. jQuery(this).removeClass(value.call(this, j, getClass2(this)));
  31496. });
  31497. }
  31498. if (!arguments.length) {
  31499. return this.attr("class", "");
  31500. }
  31501. classNames = classesToArray(value);
  31502. if (classNames.length) {
  31503. return this.each(function() {
  31504. curValue = getClass2(this);
  31505. cur = this.nodeType === 1 && " " + stripAndCollapse(curValue) + " ";
  31506. if (cur) {
  31507. for (i2 = 0; i2 < classNames.length; i2++) {
  31508. className = classNames[i2];
  31509. while (cur.indexOf(" " + className + " ") > -1) {
  31510. cur = cur.replace(" " + className + " ", " ");
  31511. }
  31512. }
  31513. finalValue = stripAndCollapse(cur);
  31514. if (curValue !== finalValue) {
  31515. this.setAttribute("class", finalValue);
  31516. }
  31517. }
  31518. });
  31519. }
  31520. return this;
  31521. },
  31522. toggleClass: function(value, stateVal) {
  31523. var classNames, className, i2, self2, type2 = typeof value, isValidValue = type2 === "string" || Array.isArray(value);
  31524. if (isFunction2(value)) {
  31525. return this.each(function(i3) {
  31526. jQuery(this).toggleClass(
  31527. value.call(this, i3, getClass2(this), stateVal),
  31528. stateVal
  31529. );
  31530. });
  31531. }
  31532. if (typeof stateVal === "boolean" && isValidValue) {
  31533. return stateVal ? this.addClass(value) : this.removeClass(value);
  31534. }
  31535. classNames = classesToArray(value);
  31536. return this.each(function() {
  31537. if (isValidValue) {
  31538. self2 = jQuery(this);
  31539. for (i2 = 0; i2 < classNames.length; i2++) {
  31540. className = classNames[i2];
  31541. if (self2.hasClass(className)) {
  31542. self2.removeClass(className);
  31543. } else {
  31544. self2.addClass(className);
  31545. }
  31546. }
  31547. } else if (value === void 0 || type2 === "boolean") {
  31548. className = getClass2(this);
  31549. if (className) {
  31550. dataPriv.set(this, "__className__", className);
  31551. }
  31552. if (this.setAttribute) {
  31553. this.setAttribute(
  31554. "class",
  31555. className || value === false ? "" : dataPriv.get(this, "__className__") || ""
  31556. );
  31557. }
  31558. }
  31559. });
  31560. },
  31561. hasClass: function(selector) {
  31562. var className, elem, i2 = 0;
  31563. className = " " + selector + " ";
  31564. while (elem = this[i2++]) {
  31565. if (elem.nodeType === 1 && (" " + stripAndCollapse(getClass2(elem)) + " ").indexOf(className) > -1) {
  31566. return true;
  31567. }
  31568. }
  31569. return false;
  31570. }
  31571. });
  31572. var rreturn = /\r/g;
  31573. jQuery.fn.extend({
  31574. val: function(value) {
  31575. var hooks3, ret, valueIsFunction, elem = this[0];
  31576. if (!arguments.length) {
  31577. if (elem) {
  31578. hooks3 = jQuery.valHooks[elem.type] || jQuery.valHooks[elem.nodeName.toLowerCase()];
  31579. if (hooks3 && "get" in hooks3 && (ret = hooks3.get(elem, "value")) !== void 0) {
  31580. return ret;
  31581. }
  31582. ret = elem.value;
  31583. if (typeof ret === "string") {
  31584. return ret.replace(rreturn, "");
  31585. }
  31586. return ret == null ? "" : ret;
  31587. }
  31588. return;
  31589. }
  31590. valueIsFunction = isFunction2(value);
  31591. return this.each(function(i2) {
  31592. var val;
  31593. if (this.nodeType !== 1) {
  31594. return;
  31595. }
  31596. if (valueIsFunction) {
  31597. val = value.call(this, i2, jQuery(this).val());
  31598. } else {
  31599. val = value;
  31600. }
  31601. if (val == null) {
  31602. val = "";
  31603. } else if (typeof val === "number") {
  31604. val += "";
  31605. } else if (Array.isArray(val)) {
  31606. val = jQuery.map(val, function(value2) {
  31607. return value2 == null ? "" : value2 + "";
  31608. });
  31609. }
  31610. hooks3 = jQuery.valHooks[this.type] || jQuery.valHooks[this.nodeName.toLowerCase()];
  31611. if (!hooks3 || !("set" in hooks3) || hooks3.set(this, val, "value") === void 0) {
  31612. this.value = val;
  31613. }
  31614. });
  31615. }
  31616. });
  31617. jQuery.extend({
  31618. valHooks: {
  31619. option: {
  31620. get: function(elem) {
  31621. var val = jQuery.find.attr(elem, "value");
  31622. return val != null ? val : stripAndCollapse(jQuery.text(elem));
  31623. }
  31624. },
  31625. select: {
  31626. get: function(elem) {
  31627. var value, option, i2, options2 = elem.options, index2 = elem.selectedIndex, one3 = elem.type === "select-one", values3 = one3 ? null : [], max2 = one3 ? index2 + 1 : options2.length;
  31628. if (index2 < 0) {
  31629. i2 = max2;
  31630. } else {
  31631. i2 = one3 ? index2 : 0;
  31632. }
  31633. for (; i2 < max2; i2++) {
  31634. option = options2[i2];
  31635. if ((option.selected || i2 === index2) && !option.disabled && (!option.parentNode.disabled || !nodeName(option.parentNode, "optgroup"))) {
  31636. value = jQuery(option).val();
  31637. if (one3) {
  31638. return value;
  31639. }
  31640. values3.push(value);
  31641. }
  31642. }
  31643. return values3;
  31644. },
  31645. set: function(elem, value) {
  31646. var optionSet, option, options2 = elem.options, values3 = jQuery.makeArray(value), i2 = options2.length;
  31647. while (i2--) {
  31648. option = options2[i2];
  31649. if (option.selected = jQuery.inArray(jQuery.valHooks.option.get(option), values3) > -1) {
  31650. optionSet = true;
  31651. }
  31652. }
  31653. if (!optionSet) {
  31654. elem.selectedIndex = -1;
  31655. }
  31656. return values3;
  31657. }
  31658. }
  31659. }
  31660. });
  31661. jQuery.each(["radio", "checkbox"], function() {
  31662. jQuery.valHooks[this] = {
  31663. set: function(elem, value) {
  31664. if (Array.isArray(value)) {
  31665. return elem.checked = jQuery.inArray(jQuery(elem).val(), value) > -1;
  31666. }
  31667. }
  31668. };
  31669. if (!support.checkOn) {
  31670. jQuery.valHooks[this].get = function(elem) {
  31671. return elem.getAttribute("value") === null ? "on" : elem.value;
  31672. };
  31673. }
  31674. });
  31675. var location = window2.location;
  31676. var nonce = { guid: Date.now() };
  31677. var rquery = /\?/;
  31678. jQuery.parseXML = function(data) {
  31679. var xml, parserErrorElem;
  31680. if (!data || typeof data !== "string") {
  31681. return null;
  31682. }
  31683. try {
  31684. xml = new window2.DOMParser().parseFromString(data, "text/xml");
  31685. } catch (e) {
  31686. }
  31687. parserErrorElem = xml && xml.getElementsByTagName("parsererror")[0];
  31688. if (!xml || parserErrorElem) {
  31689. jQuery.error("Invalid XML: " + (parserErrorElem ? jQuery.map(parserErrorElem.childNodes, function(el) {
  31690. return el.textContent;
  31691. }).join("\n") : data));
  31692. }
  31693. return xml;
  31694. };
  31695. var rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, stopPropagationCallback = function(e) {
  31696. e.stopPropagation();
  31697. };
  31698. jQuery.extend(jQuery.event, {
  31699. trigger: function(event2, data, elem, onlyHandlers) {
  31700. var i2, cur, tmp, bubbleType, ontype, handle, special, lastElement, eventPath = [elem || document2], type2 = hasOwn2.call(event2, "type") ? event2.type : event2, namespaces = hasOwn2.call(event2, "namespace") ? event2.namespace.split(".") : [];
  31701. cur = lastElement = tmp = elem = elem || document2;
  31702. if (elem.nodeType === 3 || elem.nodeType === 8) {
  31703. return;
  31704. }
  31705. if (rfocusMorph.test(type2 + jQuery.event.triggered)) {
  31706. return;
  31707. }
  31708. if (type2.indexOf(".") > -1) {
  31709. namespaces = type2.split(".");
  31710. type2 = namespaces.shift();
  31711. namespaces.sort();
  31712. }
  31713. ontype = type2.indexOf(":") < 0 && "on" + type2;
  31714. event2 = event2[jQuery.expando] ? event2 : new jQuery.Event(type2, typeof event2 === "object" && event2);
  31715. event2.isTrigger = onlyHandlers ? 2 : 3;
  31716. event2.namespace = namespaces.join(".");
  31717. event2.rnamespace = event2.namespace ? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.|)") + "(\\.|$)") : null;
  31718. event2.result = void 0;
  31719. if (!event2.target) {
  31720. event2.target = elem;
  31721. }
  31722. data = data == null ? [event2] : jQuery.makeArray(data, [event2]);
  31723. special = jQuery.event.special[type2] || {};
  31724. if (!onlyHandlers && special.trigger && special.trigger.apply(elem, data) === false) {
  31725. return;
  31726. }
  31727. if (!onlyHandlers && !special.noBubble && !isWindow(elem)) {
  31728. bubbleType = special.delegateType || type2;
  31729. if (!rfocusMorph.test(bubbleType + type2)) {
  31730. cur = cur.parentNode;
  31731. }
  31732. for (; cur; cur = cur.parentNode) {
  31733. eventPath.push(cur);
  31734. tmp = cur;
  31735. }
  31736. if (tmp === (elem.ownerDocument || document2)) {
  31737. eventPath.push(tmp.defaultView || tmp.parentWindow || window2);
  31738. }
  31739. }
  31740. i2 = 0;
  31741. while ((cur = eventPath[i2++]) && !event2.isPropagationStopped()) {
  31742. lastElement = cur;
  31743. event2.type = i2 > 1 ? bubbleType : special.bindType || type2;
  31744. handle = (dataPriv.get(cur, "events") || /* @__PURE__ */ Object.create(null))[event2.type] && dataPriv.get(cur, "handle");
  31745. if (handle) {
  31746. handle.apply(cur, data);
  31747. }
  31748. handle = ontype && cur[ontype];
  31749. if (handle && handle.apply && acceptData(cur)) {
  31750. event2.result = handle.apply(cur, data);
  31751. if (event2.result === false) {
  31752. event2.preventDefault();
  31753. }
  31754. }
  31755. }
  31756. event2.type = type2;
  31757. if (!onlyHandlers && !event2.isDefaultPrevented()) {
  31758. if ((!special._default || special._default.apply(eventPath.pop(), data) === false) && acceptData(elem)) {
  31759. if (ontype && isFunction2(elem[type2]) && !isWindow(elem)) {
  31760. tmp = elem[ontype];
  31761. if (tmp) {
  31762. elem[ontype] = null;
  31763. }
  31764. jQuery.event.triggered = type2;
  31765. if (event2.isPropagationStopped()) {
  31766. lastElement.addEventListener(type2, stopPropagationCallback);
  31767. }
  31768. elem[type2]();
  31769. if (event2.isPropagationStopped()) {
  31770. lastElement.removeEventListener(type2, stopPropagationCallback);
  31771. }
  31772. jQuery.event.triggered = void 0;
  31773. if (tmp) {
  31774. elem[ontype] = tmp;
  31775. }
  31776. }
  31777. }
  31778. }
  31779. return event2.result;
  31780. },
  31781. simulate: function(type2, elem, event2) {
  31782. var e = jQuery.extend(
  31783. new jQuery.Event(),
  31784. event2,
  31785. {
  31786. type: type2,
  31787. isSimulated: true
  31788. }
  31789. );
  31790. jQuery.event.trigger(e, null, elem);
  31791. }
  31792. });
  31793. jQuery.fn.extend({
  31794. trigger: function(type2, data) {
  31795. return this.each(function() {
  31796. jQuery.event.trigger(type2, data, this);
  31797. });
  31798. },
  31799. triggerHandler: function(type2, data) {
  31800. var elem = this[0];
  31801. if (elem) {
  31802. return jQuery.event.trigger(type2, data, elem, true);
  31803. }
  31804. }
  31805. });
  31806. var rbracket = /\[\]$/, rCRLF = /\r?\n/g, rsubmitterTypes = /^(?:submit|button|image|reset|file)$/i, rsubmittable = /^(?:input|select|textarea|keygen)/i;
  31807. function buildParams(prefix, obj, traditional, add) {
  31808. var name;
  31809. if (Array.isArray(obj)) {
  31810. jQuery.each(obj, function(i2, v) {
  31811. if (traditional || rbracket.test(prefix)) {
  31812. add(prefix, v);
  31813. } else {
  31814. buildParams(
  31815. prefix + "[" + (typeof v === "object" && v != null ? i2 : "") + "]",
  31816. v,
  31817. traditional,
  31818. add
  31819. );
  31820. }
  31821. });
  31822. } else if (!traditional && toType(obj) === "object") {
  31823. for (name in obj) {
  31824. buildParams(prefix + "[" + name + "]", obj[name], traditional, add);
  31825. }
  31826. } else {
  31827. add(prefix, obj);
  31828. }
  31829. }
  31830. jQuery.param = function(a, traditional) {
  31831. var prefix, s = [], add = function(key, valueOrFunction) {
  31832. var value = isFunction2(valueOrFunction) ? valueOrFunction() : valueOrFunction;
  31833. s[s.length] = encodeURIComponent(key) + "=" + encodeURIComponent(value == null ? "" : value);
  31834. };
  31835. if (a == null) {
  31836. return "";
  31837. }
  31838. if (Array.isArray(a) || a.jquery && !jQuery.isPlainObject(a)) {
  31839. jQuery.each(a, function() {
  31840. add(this.name, this.value);
  31841. });
  31842. } else {
  31843. for (prefix in a) {
  31844. buildParams(prefix, a[prefix], traditional, add);
  31845. }
  31846. }
  31847. return s.join("&");
  31848. };
  31849. jQuery.fn.extend({
  31850. serialize: function() {
  31851. return jQuery.param(this.serializeArray());
  31852. },
  31853. serializeArray: function() {
  31854. return this.map(function() {
  31855. var elements = jQuery.prop(this, "elements");
  31856. return elements ? jQuery.makeArray(elements) : this;
  31857. }).filter(function() {
  31858. var type2 = this.type;
  31859. return this.name && !jQuery(this).is(":disabled") && rsubmittable.test(this.nodeName) && !rsubmitterTypes.test(type2) && (this.checked || !rcheckableType.test(type2));
  31860. }).map(function(_i, elem) {
  31861. var val = jQuery(this).val();
  31862. if (val == null) {
  31863. return null;
  31864. }
  31865. if (Array.isArray(val)) {
  31866. return jQuery.map(val, function(val2) {
  31867. return { name: elem.name, value: val2.replace(rCRLF, "\r\n") };
  31868. });
  31869. }
  31870. return { name: elem.name, value: val.replace(rCRLF, "\r\n") };
  31871. }).get();
  31872. }
  31873. });
  31874. var r20 = /%20/g, rhash = /#.*$/, rantiCache = /([?&])_=[^&]*/, rheaders = /^(.*?):[ \t]*([^\r\n]*)$/mg, rlocalProtocol = /^(?:about|app|app-storage|.+-extension|file|res|widget):$/, rnoContent = /^(?:GET|HEAD)$/, rprotocol = /^\/\//, prefilters = {}, transports = {}, allTypes = "*/".concat("*"), originAnchor = document2.createElement("a");
  31875. originAnchor.href = location.href;
  31876. function addToPrefiltersOrTransports(structure) {
  31877. return function(dataTypeExpression, func) {
  31878. if (typeof dataTypeExpression !== "string") {
  31879. func = dataTypeExpression;
  31880. dataTypeExpression = "*";
  31881. }
  31882. var dataType, i2 = 0, dataTypes = dataTypeExpression.toLowerCase().match(rnothtmlwhite) || [];
  31883. if (isFunction2(func)) {
  31884. while (dataType = dataTypes[i2++]) {
  31885. if (dataType[0] === "+") {
  31886. dataType = dataType.slice(1) || "*";
  31887. (structure[dataType] = structure[dataType] || []).unshift(func);
  31888. } else {
  31889. (structure[dataType] = structure[dataType] || []).push(func);
  31890. }
  31891. }
  31892. }
  31893. };
  31894. }
  31895. function inspectPrefiltersOrTransports(structure, options2, originalOptions, jqXHR) {
  31896. var inspected = {}, seekingTransport = structure === transports;
  31897. function inspect(dataType) {
  31898. var selected;
  31899. inspected[dataType] = true;
  31900. jQuery.each(structure[dataType] || [], function(_, prefilterOrFactory) {
  31901. var dataTypeOrTransport = prefilterOrFactory(options2, originalOptions, jqXHR);
  31902. if (typeof dataTypeOrTransport === "string" && !seekingTransport && !inspected[dataTypeOrTransport]) {
  31903. options2.dataTypes.unshift(dataTypeOrTransport);
  31904. inspect(dataTypeOrTransport);
  31905. return false;
  31906. } else if (seekingTransport) {
  31907. return !(selected = dataTypeOrTransport);
  31908. }
  31909. });
  31910. return selected;
  31911. }
  31912. return inspect(options2.dataTypes[0]) || !inspected["*"] && inspect("*");
  31913. }
  31914. function ajaxExtend(target, src) {
  31915. var key, deep, flatOptions = jQuery.ajaxSettings.flatOptions || {};
  31916. for (key in src) {
  31917. if (src[key] !== void 0) {
  31918. (flatOptions[key] ? target : deep || (deep = {}))[key] = src[key];
  31919. }
  31920. }
  31921. if (deep) {
  31922. jQuery.extend(true, target, deep);
  31923. }
  31924. return target;
  31925. }
  31926. function ajaxHandleResponses(s, jqXHR, responses) {
  31927. var ct2, type2, finalDataType, firstDataType, contents = s.contents, dataTypes = s.dataTypes;
  31928. while (dataTypes[0] === "*") {
  31929. dataTypes.shift();
  31930. if (ct2 === void 0) {
  31931. ct2 = s.mimeType || jqXHR.getResponseHeader("Content-Type");
  31932. }
  31933. }
  31934. if (ct2) {
  31935. for (type2 in contents) {
  31936. if (contents[type2] && contents[type2].test(ct2)) {
  31937. dataTypes.unshift(type2);
  31938. break;
  31939. }
  31940. }
  31941. }
  31942. if (dataTypes[0] in responses) {
  31943. finalDataType = dataTypes[0];
  31944. } else {
  31945. for (type2 in responses) {
  31946. if (!dataTypes[0] || s.converters[type2 + " " + dataTypes[0]]) {
  31947. finalDataType = type2;
  31948. break;
  31949. }
  31950. if (!firstDataType) {
  31951. firstDataType = type2;
  31952. }
  31953. }
  31954. finalDataType = finalDataType || firstDataType;
  31955. }
  31956. if (finalDataType) {
  31957. if (finalDataType !== dataTypes[0]) {
  31958. dataTypes.unshift(finalDataType);
  31959. }
  31960. return responses[finalDataType];
  31961. }
  31962. }
  31963. function ajaxConvert(s, response, jqXHR, isSuccess) {
  31964. var conv2, current, conv, tmp, prev, converters = {}, dataTypes = s.dataTypes.slice();
  31965. if (dataTypes[1]) {
  31966. for (conv in s.converters) {
  31967. converters[conv.toLowerCase()] = s.converters[conv];
  31968. }
  31969. }
  31970. current = dataTypes.shift();
  31971. while (current) {
  31972. if (s.responseFields[current]) {
  31973. jqXHR[s.responseFields[current]] = response;
  31974. }
  31975. if (!prev && isSuccess && s.dataFilter) {
  31976. response = s.dataFilter(response, s.dataType);
  31977. }
  31978. prev = current;
  31979. current = dataTypes.shift();
  31980. if (current) {
  31981. if (current === "*") {
  31982. current = prev;
  31983. } else if (prev !== "*" && prev !== current) {
  31984. conv = converters[prev + " " + current] || converters["* " + current];
  31985. if (!conv) {
  31986. for (conv2 in converters) {
  31987. tmp = conv2.split(" ");
  31988. if (tmp[1] === current) {
  31989. conv = converters[prev + " " + tmp[0]] || converters["* " + tmp[0]];
  31990. if (conv) {
  31991. if (conv === true) {
  31992. conv = converters[conv2];
  31993. } else if (converters[conv2] !== true) {
  31994. current = tmp[0];
  31995. dataTypes.unshift(tmp[1]);
  31996. }
  31997. break;
  31998. }
  31999. }
  32000. }
  32001. }
  32002. if (conv !== true) {
  32003. if (conv && s.throws) {
  32004. response = conv(response);
  32005. } else {
  32006. try {
  32007. response = conv(response);
  32008. } catch (e) {
  32009. return {
  32010. state: "parsererror",
  32011. error: conv ? e : "No conversion from " + prev + " to " + current
  32012. };
  32013. }
  32014. }
  32015. }
  32016. }
  32017. }
  32018. }
  32019. return { state: "success", data: response };
  32020. }
  32021. jQuery.extend({
  32022. active: 0,
  32023. lastModified: {},
  32024. etag: {},
  32025. ajaxSettings: {
  32026. url: location.href,
  32027. type: "GET",
  32028. isLocal: rlocalProtocol.test(location.protocol),
  32029. global: true,
  32030. processData: true,
  32031. async: true,
  32032. contentType: "application/x-www-form-urlencoded; charset=UTF-8",
  32033. accepts: {
  32034. "*": allTypes,
  32035. text: "text/plain",
  32036. html: "text/html",
  32037. xml: "application/xml, text/xml",
  32038. json: "application/json, text/javascript"
  32039. },
  32040. contents: {
  32041. xml: /\bxml\b/,
  32042. html: /\bhtml/,
  32043. json: /\bjson\b/
  32044. },
  32045. responseFields: {
  32046. xml: "responseXML",
  32047. text: "responseText",
  32048. json: "responseJSON"
  32049. },
  32050. converters: {
  32051. "* text": String,
  32052. "text html": true,
  32053. "text json": JSON.parse,
  32054. "text xml": jQuery.parseXML
  32055. },
  32056. flatOptions: {
  32057. url: true,
  32058. context: true
  32059. }
  32060. },
  32061. ajaxSetup: function(target, settings) {
  32062. return settings ? ajaxExtend(ajaxExtend(target, jQuery.ajaxSettings), settings) : ajaxExtend(jQuery.ajaxSettings, target);
  32063. },
  32064. ajaxPrefilter: addToPrefiltersOrTransports(prefilters),
  32065. ajaxTransport: addToPrefiltersOrTransports(transports),
  32066. ajax: function(url, options2) {
  32067. if (typeof url === "object") {
  32068. options2 = url;
  32069. url = void 0;
  32070. }
  32071. options2 = options2 || {};
  32072. var transport, cacheURL, responseHeadersString, responseHeaders, timeoutTimer, urlAnchor, completed2, fireGlobals, i2, uncached, s = jQuery.ajaxSetup({}, options2), callbackContext = s.context || s, globalEventContext = s.context && (callbackContext.nodeType || callbackContext.jquery) ? jQuery(callbackContext) : jQuery.event, deferred = jQuery.Deferred(), completeDeferred = jQuery.Callbacks("once memory"), statusCode = s.statusCode || {}, requestHeaders = {}, requestHeadersNames = {}, strAbort = "canceled", jqXHR = {
  32073. readyState: 0,
  32074. getResponseHeader: function(key) {
  32075. var match;
  32076. if (completed2) {
  32077. if (!responseHeaders) {
  32078. responseHeaders = {};
  32079. while (match = rheaders.exec(responseHeadersString)) {
  32080. responseHeaders[match[1].toLowerCase() + " "] = (responseHeaders[match[1].toLowerCase() + " "] || []).concat(match[2]);
  32081. }
  32082. }
  32083. match = responseHeaders[key.toLowerCase() + " "];
  32084. }
  32085. return match == null ? null : match.join(", ");
  32086. },
  32087. getAllResponseHeaders: function() {
  32088. return completed2 ? responseHeadersString : null;
  32089. },
  32090. setRequestHeader: function(name, value) {
  32091. if (completed2 == null) {
  32092. name = requestHeadersNames[name.toLowerCase()] = requestHeadersNames[name.toLowerCase()] || name;
  32093. requestHeaders[name] = value;
  32094. }
  32095. return this;
  32096. },
  32097. overrideMimeType: function(type2) {
  32098. if (completed2 == null) {
  32099. s.mimeType = type2;
  32100. }
  32101. return this;
  32102. },
  32103. statusCode: function(map) {
  32104. var code;
  32105. if (map) {
  32106. if (completed2) {
  32107. jqXHR.always(map[jqXHR.status]);
  32108. } else {
  32109. for (code in map) {
  32110. statusCode[code] = [statusCode[code], map[code]];
  32111. }
  32112. }
  32113. }
  32114. return this;
  32115. },
  32116. abort: function(statusText) {
  32117. var finalText = statusText || strAbort;
  32118. if (transport) {
  32119. transport.abort(finalText);
  32120. }
  32121. done(0, finalText);
  32122. return this;
  32123. }
  32124. };
  32125. deferred.promise(jqXHR);
  32126. s.url = ((url || s.url || location.href) + "").replace(rprotocol, location.protocol + "//");
  32127. s.type = options2.method || options2.type || s.method || s.type;
  32128. s.dataTypes = (s.dataType || "*").toLowerCase().match(rnothtmlwhite) || [""];
  32129. if (s.crossDomain == null) {
  32130. urlAnchor = document2.createElement("a");
  32131. try {
  32132. urlAnchor.href = s.url;
  32133. urlAnchor.href = urlAnchor.href;
  32134. s.crossDomain = originAnchor.protocol + "//" + originAnchor.host !== urlAnchor.protocol + "//" + urlAnchor.host;
  32135. } catch (e) {
  32136. s.crossDomain = true;
  32137. }
  32138. }
  32139. if (s.data && s.processData && typeof s.data !== "string") {
  32140. s.data = jQuery.param(s.data, s.traditional);
  32141. }
  32142. inspectPrefiltersOrTransports(prefilters, s, options2, jqXHR);
  32143. if (completed2) {
  32144. return jqXHR;
  32145. }
  32146. fireGlobals = jQuery.event && s.global;
  32147. if (fireGlobals && jQuery.active++ === 0) {
  32148. jQuery.event.trigger("ajaxStart");
  32149. }
  32150. s.type = s.type.toUpperCase();
  32151. s.hasContent = !rnoContent.test(s.type);
  32152. cacheURL = s.url.replace(rhash, "");
  32153. if (!s.hasContent) {
  32154. uncached = s.url.slice(cacheURL.length);
  32155. if (s.data && (s.processData || typeof s.data === "string")) {
  32156. cacheURL += (rquery.test(cacheURL) ? "&" : "?") + s.data;
  32157. delete s.data;
  32158. }
  32159. if (s.cache === false) {
  32160. cacheURL = cacheURL.replace(rantiCache, "$1");
  32161. uncached = (rquery.test(cacheURL) ? "&" : "?") + "_=" + nonce.guid++ + uncached;
  32162. }
  32163. s.url = cacheURL + uncached;
  32164. } else if (s.data && s.processData && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0) {
  32165. s.data = s.data.replace(r20, "+");
  32166. }
  32167. if (s.ifModified) {
  32168. if (jQuery.lastModified[cacheURL]) {
  32169. jqXHR.setRequestHeader("If-Modified-Since", jQuery.lastModified[cacheURL]);
  32170. }
  32171. if (jQuery.etag[cacheURL]) {
  32172. jqXHR.setRequestHeader("If-None-Match", jQuery.etag[cacheURL]);
  32173. }
  32174. }
  32175. if (s.data && s.hasContent && s.contentType !== false || options2.contentType) {
  32176. jqXHR.setRequestHeader("Content-Type", s.contentType);
  32177. }
  32178. jqXHR.setRequestHeader(
  32179. "Accept",
  32180. s.dataTypes[0] && s.accepts[s.dataTypes[0]] ? s.accepts[s.dataTypes[0]] + (s.dataTypes[0] !== "*" ? ", " + allTypes + "; q=0.01" : "") : s.accepts["*"]
  32181. );
  32182. for (i2 in s.headers) {
  32183. jqXHR.setRequestHeader(i2, s.headers[i2]);
  32184. }
  32185. if (s.beforeSend && (s.beforeSend.call(callbackContext, jqXHR, s) === false || completed2)) {
  32186. return jqXHR.abort();
  32187. }
  32188. strAbort = "abort";
  32189. completeDeferred.add(s.complete);
  32190. jqXHR.done(s.success);
  32191. jqXHR.fail(s.error);
  32192. transport = inspectPrefiltersOrTransports(transports, s, options2, jqXHR);
  32193. if (!transport) {
  32194. done(-1, "No Transport");
  32195. } else {
  32196. jqXHR.readyState = 1;
  32197. if (fireGlobals) {
  32198. globalEventContext.trigger("ajaxSend", [jqXHR, s]);
  32199. }
  32200. if (completed2) {
  32201. return jqXHR;
  32202. }
  32203. if (s.async && s.timeout > 0) {
  32204. timeoutTimer = window2.setTimeout(function() {
  32205. jqXHR.abort("timeout");
  32206. }, s.timeout);
  32207. }
  32208. try {
  32209. completed2 = false;
  32210. transport.send(requestHeaders, done);
  32211. } catch (e) {
  32212. if (completed2) {
  32213. throw e;
  32214. }
  32215. done(-1, e);
  32216. }
  32217. }
  32218. function done(status, nativeStatusText, responses, headers) {
  32219. var isSuccess, success, error, response, modified, statusText = nativeStatusText;
  32220. if (completed2) {
  32221. return;
  32222. }
  32223. completed2 = true;
  32224. if (timeoutTimer) {
  32225. window2.clearTimeout(timeoutTimer);
  32226. }
  32227. transport = void 0;
  32228. responseHeadersString = headers || "";
  32229. jqXHR.readyState = status > 0 ? 4 : 0;
  32230. isSuccess = status >= 200 && status < 300 || status === 304;
  32231. if (responses) {
  32232. response = ajaxHandleResponses(s, jqXHR, responses);
  32233. }
  32234. if (!isSuccess && jQuery.inArray("script", s.dataTypes) > -1 && jQuery.inArray("json", s.dataTypes) < 0) {
  32235. s.converters["text script"] = function() {
  32236. };
  32237. }
  32238. response = ajaxConvert(s, response, jqXHR, isSuccess);
  32239. if (isSuccess) {
  32240. if (s.ifModified) {
  32241. modified = jqXHR.getResponseHeader("Last-Modified");
  32242. if (modified) {
  32243. jQuery.lastModified[cacheURL] = modified;
  32244. }
  32245. modified = jqXHR.getResponseHeader("etag");
  32246. if (modified) {
  32247. jQuery.etag[cacheURL] = modified;
  32248. }
  32249. }
  32250. if (status === 204 || s.type === "HEAD") {
  32251. statusText = "nocontent";
  32252. } else if (status === 304) {
  32253. statusText = "notmodified";
  32254. } else {
  32255. statusText = response.state;
  32256. success = response.data;
  32257. error = response.error;
  32258. isSuccess = !error;
  32259. }
  32260. } else {
  32261. error = statusText;
  32262. if (status || !statusText) {
  32263. statusText = "error";
  32264. if (status < 0) {
  32265. status = 0;
  32266. }
  32267. }
  32268. }
  32269. jqXHR.status = status;
  32270. jqXHR.statusText = (nativeStatusText || statusText) + "";
  32271. if (isSuccess) {
  32272. deferred.resolveWith(callbackContext, [success, statusText, jqXHR]);
  32273. } else {
  32274. deferred.rejectWith(callbackContext, [jqXHR, statusText, error]);
  32275. }
  32276. jqXHR.statusCode(statusCode);
  32277. statusCode = void 0;
  32278. if (fireGlobals) {
  32279. globalEventContext.trigger(
  32280. isSuccess ? "ajaxSuccess" : "ajaxError",
  32281. [jqXHR, s, isSuccess ? success : error]
  32282. );
  32283. }
  32284. completeDeferred.fireWith(callbackContext, [jqXHR, statusText]);
  32285. if (fireGlobals) {
  32286. globalEventContext.trigger("ajaxComplete", [jqXHR, s]);
  32287. if (!--jQuery.active) {
  32288. jQuery.event.trigger("ajaxStop");
  32289. }
  32290. }
  32291. }
  32292. return jqXHR;
  32293. },
  32294. getJSON: function(url, data, callback2) {
  32295. return jQuery.get(url, data, callback2, "json");
  32296. },
  32297. getScript: function(url, callback2) {
  32298. return jQuery.get(url, void 0, callback2, "script");
  32299. }
  32300. });
  32301. jQuery.each(["get", "post"], function(_i, method) {
  32302. jQuery[method] = function(url, data, callback2, type2) {
  32303. if (isFunction2(data)) {
  32304. type2 = type2 || callback2;
  32305. callback2 = data;
  32306. data = void 0;
  32307. }
  32308. return jQuery.ajax(jQuery.extend({
  32309. url,
  32310. type: method,
  32311. dataType: type2,
  32312. data,
  32313. success: callback2
  32314. }, jQuery.isPlainObject(url) && url));
  32315. };
  32316. });
  32317. jQuery.ajaxPrefilter(function(s) {
  32318. var i2;
  32319. for (i2 in s.headers) {
  32320. if (i2.toLowerCase() === "content-type") {
  32321. s.contentType = s.headers[i2] || "";
  32322. }
  32323. }
  32324. });
  32325. jQuery._evalUrl = function(url, options2, doc) {
  32326. return jQuery.ajax({
  32327. url,
  32328. type: "GET",
  32329. dataType: "script",
  32330. cache: true,
  32331. async: false,
  32332. global: false,
  32333. converters: {
  32334. "text script": function() {
  32335. }
  32336. },
  32337. dataFilter: function(response) {
  32338. jQuery.globalEval(response, options2, doc);
  32339. }
  32340. });
  32341. };
  32342. jQuery.fn.extend({
  32343. wrapAll: function(html) {
  32344. var wrap;
  32345. if (this[0]) {
  32346. if (isFunction2(html)) {
  32347. html = html.call(this[0]);
  32348. }
  32349. wrap = jQuery(html, this[0].ownerDocument).eq(0).clone(true);
  32350. if (this[0].parentNode) {
  32351. wrap.insertBefore(this[0]);
  32352. }
  32353. wrap.map(function() {
  32354. var elem = this;
  32355. while (elem.firstElementChild) {
  32356. elem = elem.firstElementChild;
  32357. }
  32358. return elem;
  32359. }).append(this);
  32360. }
  32361. return this;
  32362. },
  32363. wrapInner: function(html) {
  32364. if (isFunction2(html)) {
  32365. return this.each(function(i2) {
  32366. jQuery(this).wrapInner(html.call(this, i2));
  32367. });
  32368. }
  32369. return this.each(function() {
  32370. var self2 = jQuery(this), contents = self2.contents();
  32371. if (contents.length) {
  32372. contents.wrapAll(html);
  32373. } else {
  32374. self2.append(html);
  32375. }
  32376. });
  32377. },
  32378. wrap: function(html) {
  32379. var htmlIsFunction = isFunction2(html);
  32380. return this.each(function(i2) {
  32381. jQuery(this).wrapAll(htmlIsFunction ? html.call(this, i2) : html);
  32382. });
  32383. },
  32384. unwrap: function(selector) {
  32385. this.parent(selector).not("body").each(function() {
  32386. jQuery(this).replaceWith(this.childNodes);
  32387. });
  32388. return this;
  32389. }
  32390. });
  32391. jQuery.expr.pseudos.hidden = function(elem) {
  32392. return !jQuery.expr.pseudos.visible(elem);
  32393. };
  32394. jQuery.expr.pseudos.visible = function(elem) {
  32395. return !!(elem.offsetWidth || elem.offsetHeight || elem.getClientRects().length);
  32396. };
  32397. jQuery.ajaxSettings.xhr = function() {
  32398. try {
  32399. return new window2.XMLHttpRequest();
  32400. } catch (e) {
  32401. }
  32402. };
  32403. var xhrSuccessStatus = {
  32404. 0: 200,
  32405. 1223: 204
  32406. }, xhrSupported = jQuery.ajaxSettings.xhr();
  32407. support.cors = !!xhrSupported && "withCredentials" in xhrSupported;
  32408. support.ajax = xhrSupported = !!xhrSupported;
  32409. jQuery.ajaxTransport(function(options2) {
  32410. var callback2, errorCallback;
  32411. if (support.cors || xhrSupported && !options2.crossDomain) {
  32412. return {
  32413. send: function(headers, complete) {
  32414. var i2, xhr = options2.xhr();
  32415. xhr.open(
  32416. options2.type,
  32417. options2.url,
  32418. options2.async,
  32419. options2.username,
  32420. options2.password
  32421. );
  32422. if (options2.xhrFields) {
  32423. for (i2 in options2.xhrFields) {
  32424. xhr[i2] = options2.xhrFields[i2];
  32425. }
  32426. }
  32427. if (options2.mimeType && xhr.overrideMimeType) {
  32428. xhr.overrideMimeType(options2.mimeType);
  32429. }
  32430. if (!options2.crossDomain && !headers["X-Requested-With"]) {
  32431. headers["X-Requested-With"] = "XMLHttpRequest";
  32432. }
  32433. for (i2 in headers) {
  32434. xhr.setRequestHeader(i2, headers[i2]);
  32435. }
  32436. callback2 = function(type2) {
  32437. return function() {
  32438. if (callback2) {
  32439. callback2 = errorCallback = xhr.onload = xhr.onerror = xhr.onabort = xhr.ontimeout = xhr.onreadystatechange = null;
  32440. if (type2 === "abort") {
  32441. xhr.abort();
  32442. } else if (type2 === "error") {
  32443. if (typeof xhr.status !== "number") {
  32444. complete(0, "error");
  32445. } else {
  32446. complete(
  32447. xhr.status,
  32448. xhr.statusText
  32449. );
  32450. }
  32451. } else {
  32452. complete(
  32453. xhrSuccessStatus[xhr.status] || xhr.status,
  32454. xhr.statusText,
  32455. (xhr.responseType || "text") !== "text" || typeof xhr.responseText !== "string" ? { binary: xhr.response } : { text: xhr.responseText },
  32456. xhr.getAllResponseHeaders()
  32457. );
  32458. }
  32459. }
  32460. };
  32461. };
  32462. xhr.onload = callback2();
  32463. errorCallback = xhr.onerror = xhr.ontimeout = callback2("error");
  32464. if (xhr.onabort !== void 0) {
  32465. xhr.onabort = errorCallback;
  32466. } else {
  32467. xhr.onreadystatechange = function() {
  32468. if (xhr.readyState === 4) {
  32469. window2.setTimeout(function() {
  32470. if (callback2) {
  32471. errorCallback();
  32472. }
  32473. });
  32474. }
  32475. };
  32476. }
  32477. callback2 = callback2("abort");
  32478. try {
  32479. xhr.send(options2.hasContent && options2.data || null);
  32480. } catch (e) {
  32481. if (callback2) {
  32482. throw e;
  32483. }
  32484. }
  32485. },
  32486. abort: function() {
  32487. if (callback2) {
  32488. callback2();
  32489. }
  32490. }
  32491. };
  32492. }
  32493. });
  32494. jQuery.ajaxPrefilter(function(s) {
  32495. if (s.crossDomain) {
  32496. s.contents.script = false;
  32497. }
  32498. });
  32499. jQuery.ajaxSetup({
  32500. accepts: {
  32501. script: "text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"
  32502. },
  32503. contents: {
  32504. script: /\b(?:java|ecma)script\b/
  32505. },
  32506. converters: {
  32507. "text script": function(text) {
  32508. jQuery.globalEval(text);
  32509. return text;
  32510. }
  32511. }
  32512. });
  32513. jQuery.ajaxPrefilter("script", function(s) {
  32514. if (s.cache === void 0) {
  32515. s.cache = false;
  32516. }
  32517. if (s.crossDomain) {
  32518. s.type = "GET";
  32519. }
  32520. });
  32521. jQuery.ajaxTransport("script", function(s) {
  32522. if (s.crossDomain || s.scriptAttrs) {
  32523. var script, callback2;
  32524. return {
  32525. send: function(_, complete) {
  32526. script = jQuery("<script>").attr(s.scriptAttrs || {}).prop({ charset: s.scriptCharset, src: s.url }).on("load error", callback2 = function(evt) {
  32527. script.remove();
  32528. callback2 = null;
  32529. if (evt) {
  32530. complete(evt.type === "error" ? 404 : 200, evt.type);
  32531. }
  32532. });
  32533. document2.head.appendChild(script[0]);
  32534. },
  32535. abort: function() {
  32536. if (callback2) {
  32537. callback2();
  32538. }
  32539. }
  32540. };
  32541. }
  32542. });
  32543. var oldCallbacks = [], rjsonp = /(=)\?(?=&|$)|\?\?/;
  32544. jQuery.ajaxSetup({
  32545. jsonp: "callback",
  32546. jsonpCallback: function() {
  32547. var callback2 = oldCallbacks.pop() || jQuery.expando + "_" + nonce.guid++;
  32548. this[callback2] = true;
  32549. return callback2;
  32550. }
  32551. });
  32552. jQuery.ajaxPrefilter("json jsonp", function(s, originalSettings, jqXHR) {
  32553. var callbackName, overwritten, responseContainer, jsonProp = s.jsonp !== false && (rjsonp.test(s.url) ? "url" : typeof s.data === "string" && (s.contentType || "").indexOf("application/x-www-form-urlencoded") === 0 && rjsonp.test(s.data) && "data");
  32554. if (jsonProp || s.dataTypes[0] === "jsonp") {
  32555. callbackName = s.jsonpCallback = isFunction2(s.jsonpCallback) ? s.jsonpCallback() : s.jsonpCallback;
  32556. if (jsonProp) {
  32557. s[jsonProp] = s[jsonProp].replace(rjsonp, "$1" + callbackName);
  32558. } else if (s.jsonp !== false) {
  32559. s.url += (rquery.test(s.url) ? "&" : "?") + s.jsonp + "=" + callbackName;
  32560. }
  32561. s.converters["script json"] = function() {
  32562. if (!responseContainer) {
  32563. jQuery.error(callbackName + " was not called");
  32564. }
  32565. return responseContainer[0];
  32566. };
  32567. s.dataTypes[0] = "json";
  32568. overwritten = window2[callbackName];
  32569. window2[callbackName] = function() {
  32570. responseContainer = arguments;
  32571. };
  32572. jqXHR.always(function() {
  32573. if (overwritten === void 0) {
  32574. jQuery(window2).removeProp(callbackName);
  32575. } else {
  32576. window2[callbackName] = overwritten;
  32577. }
  32578. if (s[callbackName]) {
  32579. s.jsonpCallback = originalSettings.jsonpCallback;
  32580. oldCallbacks.push(callbackName);
  32581. }
  32582. if (responseContainer && isFunction2(overwritten)) {
  32583. overwritten(responseContainer[0]);
  32584. }
  32585. responseContainer = overwritten = void 0;
  32586. });
  32587. return "script";
  32588. }
  32589. });
  32590. support.createHTMLDocument = function() {
  32591. var body = document2.implementation.createHTMLDocument("").body;
  32592. body.innerHTML = "<form></form><form></form>";
  32593. return body.childNodes.length === 2;
  32594. }();
  32595. jQuery.parseHTML = function(data, context, keepScripts) {
  32596. if (typeof data !== "string") {
  32597. return [];
  32598. }
  32599. if (typeof context === "boolean") {
  32600. keepScripts = context;
  32601. context = false;
  32602. }
  32603. var base2, parsed, scripts;
  32604. if (!context) {
  32605. if (support.createHTMLDocument) {
  32606. context = document2.implementation.createHTMLDocument("");
  32607. base2 = context.createElement("base");
  32608. base2.href = document2.location.href;
  32609. context.head.appendChild(base2);
  32610. } else {
  32611. context = document2;
  32612. }
  32613. }
  32614. parsed = rsingleTag.exec(data);
  32615. scripts = !keepScripts && [];
  32616. if (parsed) {
  32617. return [context.createElement(parsed[1])];
  32618. }
  32619. parsed = buildFragment([data], context, scripts);
  32620. if (scripts && scripts.length) {
  32621. jQuery(scripts).remove();
  32622. }
  32623. return jQuery.merge([], parsed.childNodes);
  32624. };
  32625. jQuery.fn.load = function(url, params, callback2) {
  32626. var selector, type2, response, self2 = this, off2 = url.indexOf(" ");
  32627. if (off2 > -1) {
  32628. selector = stripAndCollapse(url.slice(off2));
  32629. url = url.slice(0, off2);
  32630. }
  32631. if (isFunction2(params)) {
  32632. callback2 = params;
  32633. params = void 0;
  32634. } else if (params && typeof params === "object") {
  32635. type2 = "POST";
  32636. }
  32637. if (self2.length > 0) {
  32638. jQuery.ajax({
  32639. url,
  32640. type: type2 || "GET",
  32641. dataType: "html",
  32642. data: params
  32643. }).done(function(responseText) {
  32644. response = arguments;
  32645. self2.html(selector ? jQuery("<div>").append(jQuery.parseHTML(responseText)).find(selector) : responseText);
  32646. }).always(callback2 && function(jqXHR, status) {
  32647. self2.each(function() {
  32648. callback2.apply(this, response || [jqXHR.responseText, status, jqXHR]);
  32649. });
  32650. });
  32651. }
  32652. return this;
  32653. };
  32654. jQuery.expr.pseudos.animated = function(elem) {
  32655. return jQuery.grep(jQuery.timers, function(fn2) {
  32656. return elem === fn2.elem;
  32657. }).length;
  32658. };
  32659. jQuery.offset = {
  32660. setOffset: function(elem, options2, i2) {
  32661. var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition, position2 = jQuery.css(elem, "position"), curElem = jQuery(elem), props = {};
  32662. if (position2 === "static") {
  32663. elem.style.position = "relative";
  32664. }
  32665. curOffset = curElem.offset();
  32666. curCSSTop = jQuery.css(elem, "top");
  32667. curCSSLeft = jQuery.css(elem, "left");
  32668. calculatePosition = (position2 === "absolute" || position2 === "fixed") && (curCSSTop + curCSSLeft).indexOf("auto") > -1;
  32669. if (calculatePosition) {
  32670. curPosition = curElem.position();
  32671. curTop = curPosition.top;
  32672. curLeft = curPosition.left;
  32673. } else {
  32674. curTop = parseFloat(curCSSTop) || 0;
  32675. curLeft = parseFloat(curCSSLeft) || 0;
  32676. }
  32677. if (isFunction2(options2)) {
  32678. options2 = options2.call(elem, i2, jQuery.extend({}, curOffset));
  32679. }
  32680. if (options2.top != null) {
  32681. props.top = options2.top - curOffset.top + curTop;
  32682. }
  32683. if (options2.left != null) {
  32684. props.left = options2.left - curOffset.left + curLeft;
  32685. }
  32686. if ("using" in options2) {
  32687. options2.using.call(elem, props);
  32688. } else {
  32689. curElem.css(props);
  32690. }
  32691. }
  32692. };
  32693. jQuery.fn.extend({
  32694. offset: function(options2) {
  32695. if (arguments.length) {
  32696. return options2 === void 0 ? this : this.each(function(i2) {
  32697. jQuery.offset.setOffset(this, options2, i2);
  32698. });
  32699. }
  32700. var rect, win2, elem = this[0];
  32701. if (!elem) {
  32702. return;
  32703. }
  32704. if (!elem.getClientRects().length) {
  32705. return { top: 0, left: 0 };
  32706. }
  32707. rect = elem.getBoundingClientRect();
  32708. win2 = elem.ownerDocument.defaultView;
  32709. return {
  32710. top: rect.top + win2.pageYOffset,
  32711. left: rect.left + win2.pageXOffset
  32712. };
  32713. },
  32714. position: function() {
  32715. if (!this[0]) {
  32716. return;
  32717. }
  32718. var offsetParent, offset, doc, elem = this[0], parentOffset = { top: 0, left: 0 };
  32719. if (jQuery.css(elem, "position") === "fixed") {
  32720. offset = elem.getBoundingClientRect();
  32721. } else {
  32722. offset = this.offset();
  32723. doc = elem.ownerDocument;
  32724. offsetParent = elem.offsetParent || doc.documentElement;
  32725. while (offsetParent && (offsetParent === doc.body || offsetParent === doc.documentElement) && jQuery.css(offsetParent, "position") === "static") {
  32726. offsetParent = offsetParent.parentNode;
  32727. }
  32728. if (offsetParent && offsetParent !== elem && offsetParent.nodeType === 1) {
  32729. parentOffset = jQuery(offsetParent).offset();
  32730. parentOffset.top += jQuery.css(offsetParent, "borderTopWidth", true);
  32731. parentOffset.left += jQuery.css(offsetParent, "borderLeftWidth", true);
  32732. }
  32733. }
  32734. return {
  32735. top: offset.top - parentOffset.top - jQuery.css(elem, "marginTop", true),
  32736. left: offset.left - parentOffset.left - jQuery.css(elem, "marginLeft", true)
  32737. };
  32738. },
  32739. offsetParent: function() {
  32740. return this.map(function() {
  32741. var offsetParent = this.offsetParent;
  32742. while (offsetParent && jQuery.css(offsetParent, "position") === "static") {
  32743. offsetParent = offsetParent.offsetParent;
  32744. }
  32745. return offsetParent || documentElement;
  32746. });
  32747. }
  32748. });
  32749. jQuery.each({ scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function(method, prop) {
  32750. var top = "pageYOffset" === prop;
  32751. jQuery.fn[method] = function(val) {
  32752. return access(this, function(elem, method2, val2) {
  32753. var win2;
  32754. if (isWindow(elem)) {
  32755. win2 = elem;
  32756. } else if (elem.nodeType === 9) {
  32757. win2 = elem.defaultView;
  32758. }
  32759. if (val2 === void 0) {
  32760. return win2 ? win2[prop] : elem[method2];
  32761. }
  32762. if (win2) {
  32763. win2.scrollTo(
  32764. !top ? val2 : win2.pageXOffset,
  32765. top ? val2 : win2.pageYOffset
  32766. );
  32767. } else {
  32768. elem[method2] = val2;
  32769. }
  32770. }, method, val, arguments.length);
  32771. };
  32772. });
  32773. jQuery.each(["top", "left"], function(_i, prop) {
  32774. jQuery.cssHooks[prop] = addGetHookIf(
  32775. support.pixelPosition,
  32776. function(elem, computed2) {
  32777. if (computed2) {
  32778. computed2 = curCSS(elem, prop);
  32779. return rnumnonpx.test(computed2) ? jQuery(elem).position()[prop] + "px" : computed2;
  32780. }
  32781. }
  32782. );
  32783. });
  32784. jQuery.each({ Height: "height", Width: "width" }, function(name, type2) {
  32785. jQuery.each({
  32786. padding: "inner" + name,
  32787. content: type2,
  32788. "": "outer" + name
  32789. }, function(defaultExtra, funcName) {
  32790. jQuery.fn[funcName] = function(margin, value) {
  32791. var chainable = arguments.length && (defaultExtra || typeof margin !== "boolean"), extra = defaultExtra || (margin === true || value === true ? "margin" : "border");
  32792. return access(this, function(elem, type3, value2) {
  32793. var doc;
  32794. if (isWindow(elem)) {
  32795. return funcName.indexOf("outer") === 0 ? elem["inner" + name] : elem.document.documentElement["client" + name];
  32796. }
  32797. if (elem.nodeType === 9) {
  32798. doc = elem.documentElement;
  32799. return Math.max(
  32800. elem.body["scroll" + name],
  32801. doc["scroll" + name],
  32802. elem.body["offset" + name],
  32803. doc["offset" + name],
  32804. doc["client" + name]
  32805. );
  32806. }
  32807. return value2 === void 0 ? jQuery.css(elem, type3, extra) : jQuery.style(elem, type3, value2, extra);
  32808. }, type2, chainable ? margin : void 0, chainable);
  32809. };
  32810. });
  32811. });
  32812. jQuery.each([
  32813. "ajaxStart",
  32814. "ajaxStop",
  32815. "ajaxComplete",
  32816. "ajaxError",
  32817. "ajaxSuccess",
  32818. "ajaxSend"
  32819. ], function(_i, type2) {
  32820. jQuery.fn[type2] = function(fn2) {
  32821. return this.on(type2, fn2);
  32822. };
  32823. });
  32824. jQuery.fn.extend({
  32825. bind: function(types, data, fn2) {
  32826. return this.on(types, null, data, fn2);
  32827. },
  32828. unbind: function(types, fn2) {
  32829. return this.off(types, null, fn2);
  32830. },
  32831. delegate: function(selector, types, data, fn2) {
  32832. return this.on(types, selector, data, fn2);
  32833. },
  32834. undelegate: function(selector, types, fn2) {
  32835. return arguments.length === 1 ? this.off(selector, "**") : this.off(types, selector || "**", fn2);
  32836. },
  32837. hover: function(fnOver, fnOut) {
  32838. return this.mouseenter(fnOver).mouseleave(fnOut || fnOver);
  32839. }
  32840. });
  32841. jQuery.each(
  32842. "blur focus focusin focusout resize scroll click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup contextmenu".split(" "),
  32843. function(_i, name) {
  32844. jQuery.fn[name] = function(data, fn2) {
  32845. return arguments.length > 0 ? this.on(name, null, data, fn2) : this.trigger(name);
  32846. };
  32847. }
  32848. );
  32849. var rtrim = /^[\s\uFEFF\xA0]+|([^\s\uFEFF\xA0])[\s\uFEFF\xA0]+$/g;
  32850. jQuery.proxy = function(fn2, context) {
  32851. var tmp, args, proxy;
  32852. if (typeof context === "string") {
  32853. tmp = fn2[context];
  32854. context = fn2;
  32855. fn2 = tmp;
  32856. }
  32857. if (!isFunction2(fn2)) {
  32858. return void 0;
  32859. }
  32860. args = slice.call(arguments, 2);
  32861. proxy = function() {
  32862. return fn2.apply(context || this, args.concat(slice.call(arguments)));
  32863. };
  32864. proxy.guid = fn2.guid = fn2.guid || jQuery.guid++;
  32865. return proxy;
  32866. };
  32867. jQuery.holdReady = function(hold) {
  32868. if (hold) {
  32869. jQuery.readyWait++;
  32870. } else {
  32871. jQuery.ready(true);
  32872. }
  32873. };
  32874. jQuery.isArray = Array.isArray;
  32875. jQuery.parseJSON = JSON.parse;
  32876. jQuery.nodeName = nodeName;
  32877. jQuery.isFunction = isFunction2;
  32878. jQuery.isWindow = isWindow;
  32879. jQuery.camelCase = camelCase3;
  32880. jQuery.type = toType;
  32881. jQuery.now = Date.now;
  32882. jQuery.isNumeric = function(obj) {
  32883. var type2 = jQuery.type(obj);
  32884. return (type2 === "number" || type2 === "string") && !isNaN(obj - parseFloat(obj));
  32885. };
  32886. jQuery.trim = function(text) {
  32887. return text == null ? "" : (text + "").replace(rtrim, "$1");
  32888. };
  32889. var _jQuery = window2.jQuery, _$ = window2.$;
  32890. jQuery.noConflict = function(deep) {
  32891. if (window2.$ === jQuery) {
  32892. window2.$ = _$;
  32893. }
  32894. if (deep && window2.jQuery === jQuery) {
  32895. window2.jQuery = _jQuery;
  32896. }
  32897. return jQuery;
  32898. };
  32899. if (typeof noGlobal === "undefined") {
  32900. window2.jQuery = window2.$ = jQuery;
  32901. }
  32902. return jQuery;
  32903. });
  32904. })(jquery);
  32905. var _style_0$2 = `@charset "UTF-8";:root{--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary-rgb:64,158,255;--el-color-success-rgb:103,194,58;--el-color-warning-rgb:230,162,60;--el-color-danger-rgb:245,108,108;--el-color-error-rgb:245,108,108;--el-color-info-rgb:144,147,153;--el-font-size-extra-large:20px;--el-font-size-large:18px;--el-font-size-medium:16px;--el-font-size-base:14px;--el-font-size-small:13px;--el-font-size-extra-small:12px;--el-font-family:"Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","\\5fae\\8f6f\\96c5\\9ed1",Arial,sans-serif;--el-font-weight-primary:500;--el-font-line-height-primary:24px;--el-index-normal:1;--el-index-top:1000;--el-index-popper:2000;--el-border-radius-base:4px;--el-border-radius-small:2px;--el-border-radius-round:20px;--el-border-radius-circle:100%;--el-transition-duration:.3s;--el-transition-duration-fast:.2s;--el-transition-function-ease-in-out-bezier:cubic-bezier(.645, .045, .355, 1);--el-transition-function-fast-bezier:cubic-bezier(.23, 1, .32, 1);--el-transition-all:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);--el-transition-fade:opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-md-fade:transform var(--el-transition-duration) var(--el-transition-function-fast-bezier),opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-fade-linear:opacity var(--el-transition-duration-fast) linear;--el-transition-border:border-color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-box-shadow:box-shadow var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-color:color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-component-size-large:40px;--el-component-size:32px;--el-component-size-small:24px}:root{color-scheme:light;--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary:#409eff;--el-color-primary-light-3:#79bbff;--el-color-primary-light-5:#a0cfff;--el-color-primary-light-7:#c6e2ff;--el-color-primary-light-8:#d9ecff;--el-color-primary-light-9:#ecf5ff;--el-color-primary-dark-2:#337ecc;--el-color-success:#67c23a;--el-color-success-light-3:#95d475;--el-color-success-light-5:#b3e19d;--el-color-success-light-7:#d1edc4;--el-color-success-light-8:#e1f3d8;--el-color-success-light-9:#f0f9eb;--el-color-success-dark-2:#529b2e;--el-color-warning:#e6a23c;--el-color-warning-light-3:#eebe77;--el-color-warning-light-5:#f3d19e;--el-color-warning-light-7:#f8e3c5;--el-color-warning-light-8:#faecd8;--el-color-warning-light-9:#fdf6ec;--el-color-warning-dark-2:#b88230;--el-color-danger:#f56c6c;--el-color-danger-light-3:#f89898;--el-color-danger-light-5:#fab6b6;--el-color-danger-light-7:#fcd3d3;--el-color-danger-light-8:#fde2e2;--el-color-danger-light-9:#fef0f0;--el-color-danger-dark-2:#c45656;--el-color-error:#f56c6c;--el-color-error-light-3:#f89898;--el-color-error-light-5:#fab6b6;--el-color-error-light-7:#fcd3d3;--el-color-error-light-8:#fde2e2;--el-color-error-light-9:#fef0f0;--el-color-error-dark-2:#c45656;--el-color-info:#909399;--el-color-info-light-3:#b1b3b8;--el-color-info-light-5:#c8c9cc;--el-color-info-light-7:#dedfe0;--el-color-info-light-8:#e9e9eb;--el-color-info-light-9:#f4f4f5;--el-color-info-dark-2:#73767a;--el-bg-color:#ffffff;--el-bg-color-page:#f2f3f5;--el-bg-color-overlay:#ffffff;--el-text-color-primary:#303133;--el-text-color-regular:#606266;--el-text-color-secondary:#909399;--el-text-color-placeholder:#a8abb2;--el-text-color-disabled:#c0c4cc;--el-border-color:#dcdfe6;--el-border-color-light:#e4e7ed;--el-border-color-lighter:#ebeef5;--el-border-color-extra-light:#f2f6fc;--el-border-color-dark:#d4d7de;--el-border-color-darker:#cdd0d6;--el-fill-color:#f0f2f5;--el-fill-color-light:#f5f7fa;--el-fill-color-lighter:#fafafa;--el-fill-color-extra-light:#fafcff;--el-fill-color-dark:#ebedf0;--el-fill-color-darker:#e6e8eb;--el-fill-color-blank:#ffffff;--el-box-shadow:0px 12px 32px 4px rgba(0, 0, 0, .04),0px 8px 20px rgba(0, 0, 0, .08);--el-box-shadow-light:0px 0px 12px rgba(0, 0, 0, .12);--el-box-shadow-lighter:0px 0px 6px rgba(0, 0, 0, .12);--el-box-shadow-dark:0px 16px 48px 16px rgba(0, 0, 0, .08),0px 12px 32px rgba(0, 0, 0, .12),0px 8px 16px -8px rgba(0, 0, 0, .16);--el-disabled-bg-color:var(--el-fill-color-light);--el-disabled-text-color:var(--el-text-color-placeholder);--el-disabled-border-color:var(--el-border-color-light);--el-overlay-color:rgba(0, 0, 0, .8);--el-overlay-color-light:rgba(0, 0, 0, .7);--el-overlay-color-lighter:rgba(0, 0, 0, .5);--el-mask-color:rgba(255, 255, 255, .9);--el-mask-color-extra-light:rgba(255, 255, 255, .3);--el-border-width:1px;--el-border-style:solid;--el-border-color-hover:var(--el-text-color-disabled);--el-border:var(--el-border-width) var(--el-border-style) var(--el-border-color);--el-svg-monochrome-grey:var(--el-border-color)}.fade-in-linear-enter-active,.fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.fade-in-linear-enter-from,.fade-in-linear-leave-to{opacity:0}.el-fade-in-linear-enter-active,.el-fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.el-fade-in-linear-enter-from,.el-fade-in-linear-leave-to{opacity:0}.el-fade-in-enter-active,.el-fade-in-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-fade-in-enter-from,.el-fade-in-leave-active{opacity:0}.el-zoom-in-center-enter-active,.el-zoom-in-center-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-zoom-in-center-enter-from,.el-zoom-in-center-leave-active{opacity:0;transform:scaleX(0)}.el-zoom-in-top-enter-active,.el-zoom-in-top-leave-active{opacity:1;transform:scaleY(1);transition:var(--el-transition-md-fade);transform-origin:center top}.el-zoom-in-top-enter-active[data-popper-placement^=top],.el-zoom-in-top-leave-active[data-popper-placement^=top]{transform-origin:center bottom}.el-zoom-in-top-enter-from,.el-zoom-in-top-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-bottom-enter-active,.el-zoom-in-bottom-leave-active{opacity:1;transform:scaleY(1);transition:var(--el-transition-md-fade);transform-origin:center bottom}.el-zoom-in-bottom-enter-from,.el-zoom-in-bottom-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-left-enter-active,.el-zoom-in-left-leave-active{opacity:1;transform:scale(1);transition:var(--el-transition-md-fade);transform-origin:top left}.el-zoom-in-left-enter-from,.el-zoom-in-left-leave-active{opacity:0;transform:scale(.45)}.collapse-transition{transition:var(--el-transition-duration) height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.el-collapse-transition-enter-active,.el-collapse-transition-leave-active{transition:var(--el-transition-duration) max-height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.horizontal-collapse-transition{transition:var(--el-transition-duration) width ease-in-out,var(--el-transition-duration) padding-left ease-in-out,var(--el-transition-duration) padding-right ease-in-out}.el-list-enter-active,.el-list-leave-active{transition:all 1s}.el-list-enter-from,.el-list-leave-to{opacity:0;transform:translateY(-30px)}.el-list-leave-active{position:absolute!important}.el-opacity-transition{transition:opacity var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-icon-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon--right{margin-left:5px}.el-icon--left{margin-right:5px}@-webkit-keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.el-icon{--color:inherit;height:1em;width:1em;line-height:1em;display:inline-flex;justify-content:center;align-items:center;position:relative;fill:currentColor;color:var(--color);font-size:inherit}.el-icon.is-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon svg{height:1em;width:1em}.el-affix--fixed{position:fixed}.el-alert{--el-alert-padding:8px 16px;--el-alert-border-radius-base:var(--el-border-radius-base);--el-alert-title-font-size:13px;--el-alert-description-font-size:12px;--el-alert-close-font-size:12px;--el-alert-close-customed-font-size:13px;--el-alert-icon-size:16px;--el-alert-icon-large-size:28px;width:100%;padding:var(--el-alert-padding);margin:0;box-sizing:border-box;border-radius:var(--el-alert-border-radius-base);position:relative;background-color:var(--el-color-white);overflow:hidden;opacity:1;display:flex;align-items:center;transition:opacity var(--el-transition-duration-fast)}.el-alert.is-light .el-alert__close-btn{color:var(--el-text-color-placeholder)}.el-alert.is-dark .el-alert__close-btn,.el-alert.is-dark .el-alert__description{color:var(--el-color-white)}.el-alert.is-center{justify-content:center}.el-alert--success{--el-alert-bg-color:var(--el-color-success-light-9)}.el-alert--success.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-success)}.el-alert--success.is-light .el-alert__description{color:var(--el-color-success)}.el-alert--success.is-dark{background-color:var(--el-color-success);color:var(--el-color-white)}.el-alert--info{--el-alert-bg-color:var(--el-color-info-light-9)}.el-alert--info.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-info)}.el-alert--info.is-light .el-alert__description{color:var(--el-color-info)}.el-alert--info.is-dark{background-color:var(--el-color-info);color:var(--el-color-white)}.el-alert--warning{--el-alert-bg-color:var(--el-color-warning-light-9)}.el-alert--warning.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-warning)}.el-alert--warning.is-light .el-alert__description{color:var(--el-color-warning)}.el-alert--warning.is-dark{background-color:var(--el-color-warning);color:var(--el-color-white)}.el-alert--error{--el-alert-bg-color:var(--el-color-error-light-9)}.el-alert--error.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-error)}.el-alert--error.is-light .el-alert__description{color:var(--el-color-error)}.el-alert--error.is-dark{background-color:var(--el-color-error);color:var(--el-color-white)}.el-alert__content{display:table-cell;padding:0 8px}.el-alert .el-alert__icon{font-size:var(--el-alert-icon-size);width:var(--el-alert-icon-size)}.el-alert .el-alert__icon.is-big{font-size:var(--el-alert-icon-large-size);width:var(--el-alert-icon-large-size)}.el-alert__title{font-size:var(--el-alert-title-font-size);line-height:18px;vertical-align:text-top}.el-alert__title.is-bold{font-weight:700}.el-alert .el-alert__description{font-size:var(--el-alert-description-font-size);margin:5px 0 0}.el-alert .el-alert__close-btn{font-size:var(--el-alert-close-font-size);opacity:1;position:absolute;top:12px;right:15px;cursor:pointer}.el-alert .el-alert__close-btn.is-customed{font-style:normal;font-size:var(--el-alert-close-customed-font-size);top:9px}.el-alert-fade-enter-from,.el-alert-fade-leave-active{opacity:0}.el-aside{overflow:auto;box-sizing:border-box;flex-shrink:0;width:var(--el-aside-width,300px)}.el-autocomplete{position:relative;display:inline-block}.el-autocomplete__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-autocomplete__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-autocomplete__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-autocomplete-suggestion{border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-autocomplete-suggestion__wrap{max-height:280px;padding:10px 0;box-sizing:border-box}.el-autocomplete-suggestion__list{margin:0;padding:0}.el-autocomplete-suggestion li{padding:0 20px;margin:0;line-height:34px;cursor:pointer;color:var(--el-text-color-regular);font-size:var(--el-font-size-base);list-style:none;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-autocomplete-suggestion li:hover,.el-autocomplete-suggestion li.highlighted{background-color:var(--el-fill-color-light)}.el-autocomplete-suggestion li.divider{margin-top:6px;border-top:1px solid var(--el-color-black)}.el-autocomplete-suggestion li.divider:last-child{margin-bottom:-6px}.el-autocomplete-suggestion.is-loading li{text-align:center;height:100px;line-height:100px;font-size:20px;color:var(--el-text-color-secondary)}.el-autocomplete-suggestion.is-loading li:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-autocomplete-suggestion.is-loading li:hover{background-color:var(--el-bg-color-overlay)}.el-autocomplete-suggestion.is-loading .el-icon-loading{vertical-align:middle}.el-avatar{--el-avatar-text-color:var(--el-color-white);--el-avatar-bg-color:var(--el-text-color-disabled);--el-avatar-text-size:14px;--el-avatar-icon-size:18px;--el-avatar-border-radius:var(--el-border-radius-base);--el-avatar-size-large:56px;--el-avatar-size-small:24px;--el-avatar-size:40px;display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;text-align:center;overflow:hidden;color:var(--el-avatar-text-color);background:var(--el-avatar-bg-color);width:var(--el-avatar-size);height:var(--el-avatar-size);font-size:var(--el-avatar-text-size)}.el-avatar>img{display:block;height:100%}.el-avatar--circle{border-radius:50%}.el-avatar--square{border-radius:var(--el-avatar-border-radius)}.el-avatar--icon{font-size:var(--el-avatar-icon-size)}.el-avatar--small{--el-avatar-size:24px}.el-avatar--large{--el-avatar-size:56px}.el-backtop{--el-backtop-bg-color:var(--el-bg-color-overlay);--el-backtop-text-color:var(--el-color-primary);--el-backtop-hover-bg-color:var(--el-border-color-extra-light);position:fixed;background-color:var(--el-backtop-bg-color);width:40px;height:40px;border-radius:50%;color:var(--el-backtop-text-color);display:flex;align-items:center;justify-content:center;font-size:20px;box-shadow:var(--el-box-shadow-lighter);cursor:pointer;z-index:5}.el-backtop:hover{background-color:var(--el-backtop-hover-bg-color)}.el-backtop__icon{font-size:20px}.el-badge{--el-badge-bg-color:var(--el-color-danger);--el-badge-radius:10px;--el-badge-font-size:12px;--el-badge-padding:6px;--el-badge-size:18px;position:relative;vertical-align:middle;display:inline-block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.el-badge__content{background-color:var(--el-badge-bg-color);border-radius:var(--el-badge-radius);color:var(--el-color-white);display:inline-flex;justify-content:center;align-items:center;font-size:var(--el-badge-font-size);height:var(--el-badge-size);padding:0 var(--el-badge-padding);white-space:nowrap;border:1px solid var(--el-bg-color)}.el-badge__content.is-fixed{position:absolute;top:0;right:calc(1px + var(--el-badge-size)/ 2);transform:translateY(-50%) translate(100%);z-index:var(--el-index-normal)}.el-badge__content.is-fixed.is-dot{right:5px}.el-badge__content.is-dot{height:8px;width:8px;padding:0;right:0;border-radius:50%}.el-badge__content--primary{background-color:var(--el-color-primary)}.el-badge__content--success{background-color:var(--el-color-success)}.el-badge__content--warning{background-color:var(--el-color-warning)}.el-badge__content--info{background-color:var(--el-color-info)}.el-badge__content--danger{background-color:var(--el-color-danger)}.el-breadcrumb{font-size:14px;line-height:1}.el-breadcrumb:after,.el-breadcrumb:before{display:table;content:""}.el-breadcrumb:after{clear:both}.el-breadcrumb__separator{margin:0 9px;font-weight:700;color:var(--el-text-color-placeholder)}.el-breadcrumb__separator.el-icon{margin:0 6px;font-weight:400}.el-breadcrumb__separator.el-icon svg{vertical-align:middle}.el-breadcrumb__item{float:left;display:inline-flex;align-items:center}.el-breadcrumb__inner{color:var(--el-text-color-regular)}.el-breadcrumb__inner a,.el-breadcrumb__inner.is-link{font-weight:700;text-decoration:none;transition:var(--el-transition-color);color:var(--el-text-color-primary)}.el-breadcrumb__inner a:hover,.el-breadcrumb__inner.is-link:hover{color:var(--el-color-primary);cursor:pointer}.el-breadcrumb__item:last-child .el-breadcrumb__inner,.el-breadcrumb__item:last-child .el-breadcrumb__inner a,.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover{font-weight:400;color:var(--el-text-color-regular);cursor:text}.el-breadcrumb__item:last-child .el-breadcrumb__separator{display:none}.el-button-group{display:inline-block;vertical-align:middle}.el-button-group:after,.el-button-group:before{display:table;content:""}.el-button-group:after{clear:both}.el-button-group>.el-button{float:left;position:relative}.el-button-group>.el-button+.el-button{margin-left:0}.el-button-group>.el-button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.el-button-group>.el-button:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.el-button-group>.el-button:first-child:last-child{border-top-right-radius:var(--el-border-radius-base);border-bottom-right-radius:var(--el-border-radius-base);border-top-left-radius:var(--el-border-radius-base);border-bottom-left-radius:var(--el-border-radius-base)}.el-button-group>.el-button:first-child:last-child.is-round{border-radius:var(--el-border-radius-round)}.el-button-group>.el-button:first-child:last-child.is-circle{border-radius:50%}.el-button-group>.el-button:not(:first-child):not(:last-child){border-radius:0}.el-button-group>.el-button:not(:last-child){margin-right:-1px}.el-button-group>.el-button:active,.el-button-group>.el-button:focus,.el-button-group>.el-button:hover{z-index:1}.el-button-group>.el-button.is-active{z-index:1}.el-button-group>.el-dropdown>.el-button{border-top-left-radius:0;border-bottom-left-radius:0;border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button{--el-button-font-weight:var(--el-font-weight-primary);--el-button-border-color:var(--el-border-color);--el-button-bg-color:var(--el-fill-color-blank);--el-button-text-color:var(--el-text-color-regular);--el-button-disabled-text-color:var(--el-disabled-text-color);--el-button-disabled-bg-color:var(--el-fill-color-blank);--el-button-disabled-border-color:var(--el-border-color-light);--el-button-divide-border-color:rgba(255, 255, 255, .5);--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-color-primary-light-9);--el-button-hover-border-color:var(--el-color-primary-light-7);--el-button-active-text-color:var(--el-button-hover-text-color);--el-button-active-border-color:var(--el-color-primary);--el-button-active-bg-color:var(--el-button-hover-bg-color);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-hover-link-text-color:var(--el-color-info);--el-button-active-color:var(--el-text-color-primary)}.el-button{display:inline-flex;justify-content:center;align-items:center;line-height:1;height:32px;white-space:nowrap;cursor:pointer;color:var(--el-button-text-color);text-align:center;box-sizing:border-box;outline:0;transition:.1s;font-weight:var(--el-button-font-weight);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-webkit-appearance:none;background-color:var(--el-button-bg-color);border:var(--el-border);border-color:var(--el-button-border-color);padding:8px 15px;font-size:var(--el-font-size-base);border-radius:var(--el-border-radius-base)}.el-button:focus,.el-button:hover{color:var(--el-button-hover-text-color);border-color:var(--el-button-hover-border-color);background-color:var(--el-button-hover-bg-color);outline:0}.el-button:active{color:var(--el-button-active-text-color);border-color:var(--el-button-active-border-color);background-color:var(--el-button-active-bg-color);outline:0}.el-button:focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px}.el-button>span{display:inline-flex;align-items:center}.el-button+.el-button{margin-left:12px}.el-button.is-round{padding:8px 15px}.el-button::-moz-focus-inner{border:0}.el-button [class*=el-icon]+span{margin-left:6px}.el-button [class*=el-icon] svg{vertical-align:bottom}.el-button.is-plain{--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-fill-color-blank);--el-button-hover-border-color:var(--el-color-primary)}.el-button.is-active{color:var(--el-button-active-text-color);border-color:var(--el-button-active-border-color);background-color:var(--el-button-active-bg-color);outline:0}.el-button.is-disabled,.el-button.is-disabled:focus,.el-button.is-disabled:hover{color:var(--el-button-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color);border-color:var(--el-button-disabled-border-color)}.el-button.is-loading{position:relative;pointer-events:none}.el-button.is-loading:before{z-index:1;pointer-events:none;content:"";position:absolute;left:-1px;top:-1px;right:-1px;bottom:-1px;border-radius:inherit;background-color:var(--el-mask-color-extra-light)}.el-button.is-round{border-radius:var(--el-border-radius-round)}.el-button.is-circle{border-radius:50%;padding:8px}.el-button.is-text{color:var(--el-button-text-color);border:0 solid transparent;background-color:transparent}.el-button.is-text.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important}.el-button.is-text:not(.is-disabled):focus,.el-button.is-text:not(.is-disabled):hover{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled):focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px}.el-button.is-text:not(.is-disabled):active{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled).is-has-bg:focus,.el-button.is-text:not(.is-disabled).is-has-bg:hover{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg:active{background-color:var(--el-fill-color-dark)}.el-button__text--expand{letter-spacing:.3em;margin-right:-.3em}.el-button.is-link{border-color:transparent;color:var(--el-button-text-color);background:0 0;padding:2px;height:auto}.el-button.is-link:focus,.el-button.is-link:hover{color:var(--el-button-hover-link-text-color)}.el-button.is-link.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important;border-color:transparent!important}.el-button.is-link:not(.is-disabled):focus,.el-button.is-link:not(.is-disabled):hover{border-color:transparent;background-color:transparent}.el-button.is-link:not(.is-disabled):active{color:var(--el-button-active-color);border-color:transparent;background-color:transparent}.el-button--text{border-color:transparent;background:0 0;color:var(--el-color-primary);padding-left:0;padding-right:0}.el-button--text.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important;border-color:transparent!important}.el-button--text:not(.is-disabled):focus,.el-button--text:not(.is-disabled):hover{color:var(--el-color-primary-light-3);border-color:transparent;background-color:transparent}.el-button--text:not(.is-disabled):active{color:var(--el-color-primary-dark-2);border-color:transparent;background-color:transparent}.el-button__link--expand{letter-spacing:.3em;margin-right:-.3em}.el-button--primary{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-primary);--el-button-border-color:var(--el-color-primary);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-active-color:var(--el-color-primary-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-primary-light-5);--el-button-hover-bg-color:var(--el-color-primary-light-3);--el-button-hover-border-color:var(--el-color-primary-light-3);--el-button-active-bg-color:var(--el-color-primary-dark-2);--el-button-active-border-color:var(--el-color-primary-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-primary-light-5);--el-button-disabled-border-color:var(--el-color-primary-light-5)}.el-button--primary.is-link,.el-button--primary.is-plain,.el-button--primary.is-text{--el-button-text-color:var(--el-color-primary);--el-button-bg-color:var(--el-color-primary-light-9);--el-button-border-color:var(--el-color-primary-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-primary);--el-button-hover-border-color:var(--el-color-primary);--el-button-active-text-color:var(--el-color-white)}.el-button--primary.is-link.is-disabled,.el-button--primary.is-link.is-disabled:active,.el-button--primary.is-link.is-disabled:focus,.el-button--primary.is-link.is-disabled:hover,.el-button--primary.is-plain.is-disabled,.el-button--primary.is-plain.is-disabled:active,.el-button--primary.is-plain.is-disabled:focus,.el-button--primary.is-plain.is-disabled:hover,.el-button--primary.is-text.is-disabled,.el-button--primary.is-text.is-disabled:active,.el-button--primary.is-text.is-disabled:focus,.el-button--primary.is-text.is-disabled:hover{color:var(--el-color-primary-light-5);background-color:var(--el-color-primary-light-9);border-color:var(--el-color-primary-light-8)}.el-button--success{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-success);--el-button-border-color:var(--el-color-success);--el-button-outline-color:var(--el-color-success-light-5);--el-button-active-color:var(--el-color-success-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-success-light-5);--el-button-hover-bg-color:var(--el-color-success-light-3);--el-button-hover-border-color:var(--el-color-success-light-3);--el-button-active-bg-color:var(--el-color-success-dark-2);--el-button-active-border-color:var(--el-color-success-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-success-light-5);--el-button-disabled-border-color:var(--el-color-success-light-5)}.el-button--success.is-link,.el-button--success.is-plain,.el-button--success.is-text{--el-button-text-color:var(--el-color-success);--el-button-bg-color:var(--el-color-success-light-9);--el-button-border-color:var(--el-color-success-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-success);--el-button-hover-border-color:var(--el-color-success);--el-button-active-text-color:var(--el-color-white)}.el-button--success.is-link.is-disabled,.el-button--success.is-link.is-disabled:active,.el-button--success.is-link.is-disabled:focus,.el-button--success.is-link.is-disabled:hover,.el-button--success.is-plain.is-disabled,.el-button--success.is-plain.is-disabled:active,.el-button--success.is-plain.is-disabled:focus,.el-button--success.is-plain.is-disabled:hover,.el-button--success.is-text.is-disabled,.el-button--success.is-text.is-disabled:active,.el-button--success.is-text.is-disabled:focus,.el-button--success.is-text.is-disabled:hover{color:var(--el-color-success-light-5);background-color:var(--el-color-success-light-9);border-color:var(--el-color-success-light-8)}.el-button--warning{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-warning);--el-button-border-color:var(--el-color-warning);--el-button-outline-color:var(--el-color-warning-light-5);--el-button-active-color:var(--el-color-warning-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-warning-light-5);--el-button-hover-bg-color:var(--el-color-warning-light-3);--el-button-hover-border-color:var(--el-color-warning-light-3);--el-button-active-bg-color:var(--el-color-warning-dark-2);--el-button-active-border-color:var(--el-color-warning-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-warning-light-5);--el-button-disabled-border-color:var(--el-color-warning-light-5)}.el-button--warning.is-link,.el-button--warning.is-plain,.el-button--warning.is-text{--el-button-text-color:var(--el-color-warning);--el-button-bg-color:var(--el-color-warning-light-9);--el-button-border-color:var(--el-color-warning-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-warning);--el-button-hover-border-color:var(--el-color-warning);--el-button-active-text-color:var(--el-color-white)}.el-button--warning.is-link.is-disabled,.el-button--warning.is-link.is-disabled:active,.el-button--warning.is-link.is-disabled:focus,.el-button--warning.is-link.is-disabled:hover,.el-button--warning.is-plain.is-disabled,.el-button--warning.is-plain.is-disabled:active,.el-button--warning.is-plain.is-disabled:focus,.el-button--warning.is-plain.is-disabled:hover,.el-button--warning.is-text.is-disabled,.el-button--warning.is-text.is-disabled:active,.el-button--warning.is-text.is-disabled:focus,.el-button--warning.is-text.is-disabled:hover{color:var(--el-color-warning-light-5);background-color:var(--el-color-warning-light-9);border-color:var(--el-color-warning-light-8)}.el-button--danger{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-danger);--el-button-border-color:var(--el-color-danger);--el-button-outline-color:var(--el-color-danger-light-5);--el-button-active-color:var(--el-color-danger-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-danger-light-5);--el-button-hover-bg-color:var(--el-color-danger-light-3);--el-button-hover-border-color:var(--el-color-danger-light-3);--el-button-active-bg-color:var(--el-color-danger-dark-2);--el-button-active-border-color:var(--el-color-danger-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-danger-light-5);--el-button-disabled-border-color:var(--el-color-danger-light-5)}.el-button--danger.is-link,.el-button--danger.is-plain,.el-button--danger.is-text{--el-button-text-color:var(--el-color-danger);--el-button-bg-color:var(--el-color-danger-light-9);--el-button-border-color:var(--el-color-danger-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-danger);--el-button-hover-border-color:var(--el-color-danger);--el-button-active-text-color:var(--el-color-white)}.el-button--danger.is-link.is-disabled,.el-button--danger.is-link.is-disabled:active,.el-button--danger.is-link.is-disabled:focus,.el-button--danger.is-link.is-disabled:hover,.el-button--danger.is-plain.is-disabled,.el-button--danger.is-plain.is-disabled:active,.el-button--danger.is-plain.is-disabled:focus,.el-button--danger.is-plain.is-disabled:hover,.el-button--danger.is-text.is-disabled,.el-button--danger.is-text.is-disabled:active,.el-button--danger.is-text.is-disabled:focus,.el-button--danger.is-text.is-disabled:hover{color:var(--el-color-danger-light-5);background-color:var(--el-color-danger-light-9);border-color:var(--el-color-danger-light-8)}.el-button--info{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-info);--el-button-border-color:var(--el-color-info);--el-button-outline-color:var(--el-color-info-light-5);--el-button-active-color:var(--el-color-info-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-info-light-5);--el-button-hover-bg-color:var(--el-color-info-light-3);--el-button-hover-border-color:var(--el-color-info-light-3);--el-button-active-bg-color:var(--el-color-info-dark-2);--el-button-active-border-color:var(--el-color-info-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-info-light-5);--el-button-disabled-border-color:var(--el-color-info-light-5)}.el-button--info.is-link,.el-button--info.is-plain,.el-button--info.is-text{--el-button-text-color:var(--el-color-info);--el-button-bg-color:var(--el-color-info-light-9);--el-button-border-color:var(--el-color-info-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-info);--el-button-hover-border-color:var(--el-color-info);--el-button-active-text-color:var(--el-color-white)}.el-button--info.is-link.is-disabled,.el-button--info.is-link.is-disabled:active,.el-button--info.is-link.is-disabled:focus,.el-button--info.is-link.is-disabled:hover,.el-button--info.is-plain.is-disabled,.el-button--info.is-plain.is-disabled:active,.el-button--info.is-plain.is-disabled:focus,.el-button--info.is-plain.is-disabled:hover,.el-button--info.is-text.is-disabled,.el-button--info.is-text.is-disabled:active,.el-button--info.is-text.is-disabled:focus,.el-button--info.is-text.is-disabled:hover{color:var(--el-color-info-light-5);background-color:var(--el-color-info-light-9);border-color:var(--el-color-info-light-8)}.el-button--large{--el-button-size:40px;height:var(--el-button-size);padding:12px 19px;font-size:var(--el-font-size-base);border-radius:var(--el-border-radius-base)}.el-button--large [class*=el-icon]+span{margin-left:8px}.el-button--large.is-round{padding:12px 19px}.el-button--large.is-circle{width:var(--el-button-size);padding:12px}.el-button--small{--el-button-size:24px;height:var(--el-button-size);padding:5px 11px;font-size:12px;border-radius:calc(var(--el-border-radius-base) - 1px)}.el-button--small [class*=el-icon]+span{margin-left:4px}.el-button--small.is-round{padding:5px 11px}.el-button--small.is-circle{width:var(--el-button-size);padding:5px}.el-calendar{--el-calendar-border:var(--el-table-border, 1px solid var(--el-border-color-lighter));--el-calendar-header-border-bottom:var(--el-calendar-border);--el-calendar-selected-bg-color:var(--el-color-primary-light-9);--el-calendar-cell-width:85px;background-color:var(--el-fill-color-blank)}.el-calendar__header{display:flex;justify-content:space-between;padding:12px 20px;border-bottom:var(--el-calendar-header-border-bottom)}.el-calendar__title{color:var(--el-text-color);align-self:center}.el-calendar__body{padding:12px 20px 35px}.el-calendar-table{table-layout:fixed;width:100%}.el-calendar-table thead th{padding:12px 0;color:var(--el-text-color-regular);font-weight:400}.el-calendar-table:not(.is-range) td.next,.el-calendar-table:not(.is-range) td.prev{color:var(--el-text-color-placeholder)}.el-calendar-table td{border-bottom:var(--el-calendar-border);border-right:var(--el-calendar-border);vertical-align:top;transition:background-color var(--el-transition-duration-fast) ease}.el-calendar-table td.is-selected{background-color:var(--el-calendar-selected-bg-color)}.el-calendar-table td.is-today{color:var(--el-color-primary)}.el-calendar-table tr:first-child td{border-top:var(--el-calendar-border)}.el-calendar-table tr td:first-child{border-left:var(--el-calendar-border)}.el-calendar-table tr.el-calendar-table__row--hide-border td{border-top:none}.el-calendar-table .el-calendar-day{box-sizing:border-box;padding:8px;height:var(--el-calendar-cell-width)}.el-calendar-table .el-calendar-day:hover{cursor:pointer;background-color:var(--el-calendar-selected-bg-color)}.el-card{--el-card-border-color:var(--el-border-color-light);--el-card-border-radius:4px;--el-card-padding:20px;--el-card-bg-color:var(--el-fill-color-blank)}.el-card{border-radius:var(--el-card-border-radius);border:1px solid var(--el-card-border-color);background-color:var(--el-card-bg-color);overflow:hidden;color:var(--el-text-color-primary);transition:var(--el-transition-duration)}.el-card.is-always-shadow{box-shadow:var(--el-box-shadow-light)}.el-card.is-hover-shadow:focus,.el-card.is-hover-shadow:hover{box-shadow:var(--el-box-shadow-light)}.el-card__header{padding:calc(var(--el-card-padding) - 2px) var(--el-card-padding);border-bottom:1px solid var(--el-card-border-color);box-sizing:border-box}.el-card__body{padding:var(--el-card-padding)}.el-carousel__item{position:absolute;top:0;left:0;width:100%;height:100%;display:inline-block;overflow:hidden;z-index:calc(var(--el-index-normal) - 1)}.el-carousel__item.is-active{z-index:calc(var(--el-index-normal) - 1)}.el-carousel__item.is-animating{transition:transform .4s ease-in-out}.el-carousel__item--card{width:50%;transition:transform .4s ease-in-out}.el-carousel__item--card.is-in-stage{cursor:pointer;z-index:var(--el-index-normal)}.el-carousel__item--card.is-in-stage.is-hover .el-carousel__mask,.el-carousel__item--card.is-in-stage:hover .el-carousel__mask{opacity:.12}.el-carousel__item--card.is-active{z-index:calc(var(--el-index-normal) + 1)}.el-carousel__mask{position:absolute;width:100%;height:100%;top:0;left:0;background-color:var(--el-color-white);opacity:.24;transition:var(--el-transition-duration-fast)}.el-carousel{--el-carousel-arrow-font-size:12px;--el-carousel-arrow-size:36px;--el-carousel-arrow-background:rgba(31, 45, 61, .11);--el-carousel-arrow-hover-background:rgba(31, 45, 61, .23);--el-carousel-indicator-width:30px;--el-carousel-indicator-height:2px;--el-carousel-indicator-padding-horizontal:4px;--el-carousel-indicator-padding-vertical:12px;--el-carousel-indicator-out-color:var(--el-border-color-hover);position:relative}.el-carousel--horizontal{overflow-x:hidden}.el-carousel--vertical{overflow-y:hidden}.el-carousel__container{position:relative;height:300px}.el-carousel__arrow{border:none;outline:0;padding:0;margin:0;height:var(--el-carousel-arrow-size);width:var(--el-carousel-arrow-size);cursor:pointer;transition:var(--el-transition-duration);border-radius:50%;background-color:var(--el-carousel-arrow-background);color:#fff;position:absolute;top:50%;z-index:10;transform:translateY(-50%);text-align:center;font-size:var(--el-carousel-arrow-font-size);display:inline-flex;justify-content:center;align-items:center}.el-carousel__arrow--left{left:16px}.el-carousel__arrow--right{right:16px}.el-carousel__arrow:hover{background-color:var(--el-carousel-arrow-hover-background)}.el-carousel__arrow i{cursor:pointer}.el-carousel__indicators{position:absolute;list-style:none;margin:0;padding:0;z-index:calc(var(--el-index-normal) + 1)}.el-carousel__indicators--horizontal{bottom:0;left:50%;transform:translate(-50%)}.el-carousel__indicators--vertical{right:0;top:50%;transform:translateY(-50%)}.el-carousel__indicators--outside{bottom:calc(var(--el-carousel-indicator-height) + var(--el-carousel-indicator-padding-vertical) * 2);text-align:center;position:static;transform:none}.el-carousel__indicators--outside .el-carousel__indicator:hover button{opacity:.64}.el-carousel__indicators--outside button{background-color:var(--el-carousel-indicator-out-color);opacity:.24}.el-carousel__indicators--labels{left:0;right:0;transform:none;text-align:center}.el-carousel__indicators--labels .el-carousel__button{height:auto;width:auto;padding:2px 18px;font-size:12px;color:#000}.el-carousel__indicators--labels .el-carousel__indicator{padding:6px 4px}.el-carousel__indicator{background-color:transparent;cursor:pointer}.el-carousel__indicator:hover button{opacity:.72}.el-carousel__indicator--horizontal{display:inline-block;padding:var(--el-carousel-indicator-padding-vertical) var(--el-carousel-indicator-padding-horizontal)}.el-carousel__indicator--vertical{padding:var(--el-carousel-indicator-padding-horizontal) var(--el-carousel-indicator-padding-vertical)}.el-carousel__indicator--vertical .el-carousel__button{width:var(--el-carousel-indicator-height);height:calc(var(--el-carousel-indicator-width)/ 2)}.el-carousel__indicator.is-active button{opacity:1}.el-carousel__button{display:block;opacity:.48;width:var(--el-carousel-indicator-width);height:var(--el-carousel-indicator-height);background-color:#fff;border:none;outline:0;padding:0;margin:0;cursor:pointer;transition:var(--el-transition-duration)}.carousel-arrow-left-enter-from,.carousel-arrow-left-leave-active{transform:translateY(-50%) translate(-10px);opacity:0}.carousel-arrow-right-enter-from,.carousel-arrow-right-leave-active{transform:translateY(-50%) translate(10px);opacity:0}.el-cascader-panel{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color)}.el-cascader-panel{display:flex;border-radius:var(--el-cascader-menu-radius);font-size:var(--el-cascader-menu-font-size)}.el-cascader-panel.is-bordered{border:var(--el-cascader-menu-border);border-radius:var(--el-cascader-menu-radius)}.el-cascader-menu{min-width:180px;box-sizing:border-box;color:var(--el-cascader-menu-text-color);border-right:var(--el-cascader-menu-border)}.el-cascader-menu:last-child{border-right:none}.el-cascader-menu:last-child .el-cascader-node{padding-right:20px}.el-cascader-menu__wrap.el-scrollbar__wrap{height:204px}.el-cascader-menu__list{position:relative;min-height:100%;margin:0;padding:6px 0;list-style:none;box-sizing:border-box}.el-cascader-menu__hover-zone{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.el-cascader-menu__empty-text{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;align-items:center;color:var(--el-cascader-color-empty)}.el-cascader-menu__empty-text .is-loading{margin-right:2px}.el-cascader-node{position:relative;display:flex;align-items:center;padding:0 30px 0 20px;height:34px;line-height:34px;outline:0}.el-cascader-node.is-selectable.in-active-path{color:var(--el-cascader-menu-text-color)}.el-cascader-node.in-active-path,.el-cascader-node.is-active,.el-cascader-node.is-selectable.in-checked-path{color:var(--el-cascader-menu-selected-text-color);font-weight:700}.el-cascader-node:not(.is-disabled){cursor:pointer}.el-cascader-node:not(.is-disabled):focus,.el-cascader-node:not(.is-disabled):hover{background:var(--el-cascader-node-background-hover)}.el-cascader-node.is-disabled{color:var(--el-cascader-node-color-disabled);cursor:not-allowed}.el-cascader-node__prefix{position:absolute;left:10px}.el-cascader-node__postfix{position:absolute;right:10px}.el-cascader-node__label{flex:1;text-align:left;padding:0 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-cascader-node>.el-checkbox{margin-right:0}.el-cascader-node>.el-radio{margin-right:0}.el-cascader-node>.el-radio .el-radio__label{padding-left:0}.el-cascader{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color);display:inline-block;vertical-align:middle;position:relative;font-size:var(--el-font-size-base);line-height:32px;outline:0}.el-cascader:not(.is-disabled):hover .el-input__wrapper{cursor:pointer;box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-cascader .el-input{display:flex;cursor:pointer}.el-cascader .el-input .el-input__inner{text-overflow:ellipsis;cursor:pointer}.el-cascader .el-input .el-input__suffix-inner .el-icon{height:calc(100% - 2px)}.el-cascader .el-input .el-input__suffix-inner .el-icon svg{vertical-align:middle}.el-cascader .el-input .icon-arrow-down{transition:transform var(--el-transition-duration);font-size:14px}.el-cascader .el-input .icon-arrow-down.is-reverse{transform:rotate(180deg)}.el-cascader .el-input .icon-circle-close:hover{color:var(--el-input-clear-hover-color,var(--el-text-color-secondary))}.el-cascader .el-input.is-focus .el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-focus-border-color,var(--el-color-primary)) inset}.el-cascader--large{font-size:14px;line-height:40px}.el-cascader--small{font-size:12px;line-height:24px}.el-cascader.is-disabled .el-cascader__label{z-index:calc(var(--el-index-normal) + 1);color:var(--el-disabled-text-color)}.el-cascader__dropdown{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color)}.el-cascader__dropdown{font-size:var(--el-cascader-menu-font-size);border-radius:var(--el-cascader-menu-radius)}.el-cascader__dropdown.el-popper{background:var(--el-cascader-menu-fill);border:var(--el-cascader-menu-border);box-shadow:var(--el-cascader-menu-shadow)}.el-cascader__dropdown.el-popper .el-popper__arrow:before{border:var(--el-cascader-menu-border)}.el-cascader__dropdown.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-cascader__dropdown.el-popper{box-shadow:var(--el-cascader-menu-shadow)}.el-cascader__tags{position:absolute;left:0;right:30px;top:50%;transform:translateY(-50%);display:flex;flex-wrap:wrap;line-height:normal;text-align:left;box-sizing:border-box}.el-cascader__tags .el-tag{display:inline-flex;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:var(--el-cascader-tag-background)}.el-cascader__tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__tags .el-tag>span{flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__tags .el-tag .el-icon-close{flex:none;background-color:var(--el-text-color-placeholder);color:var(--el-color-white)}.el-cascader__tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-cascader__collapse-tags{white-space:normal;z-index:var(--el-index-normal)}.el-cascader__collapse-tags .el-tag{display:inline-flex;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:var(--el-fill-color)}.el-cascader__collapse-tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__collapse-tags .el-tag>span{flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__collapse-tags .el-tag .el-icon-close{flex:none;background-color:var(--el-text-color-placeholder);color:var(--el-color-white)}.el-cascader__collapse-tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-cascader__suggestion-panel{border-radius:var(--el-cascader-menu-radius)}.el-cascader__suggestion-list{max-height:204px;margin:0;padding:6px 0;font-size:var(--el-font-size-base);color:var(--el-cascader-menu-text-color);text-align:center}.el-cascader__suggestion-item{display:flex;justify-content:space-between;align-items:center;height:34px;padding:0 15px;text-align:left;outline:0;cursor:pointer}.el-cascader__suggestion-item:focus,.el-cascader__suggestion-item:hover{background:var(--el-cascader-node-background-hover)}.el-cascader__suggestion-item.is-checked{color:var(--el-cascader-menu-selected-text-color);font-weight:700}.el-cascader__suggestion-item>span{margin-right:10px}.el-cascader__empty-text{margin:10px 0;color:var(--el-cascader-color-empty)}.el-cascader__search-input{flex:1;height:24px;min-width:60px;margin:2px 0 2px 11px;padding:0;color:var(--el-cascader-menu-text-color);border:none;outline:0;box-sizing:border-box;background:0 0}.el-cascader__search-input::-moz-placeholder{color:transparent}.el-cascader__search-input:-ms-input-placeholder{color:transparent}.el-cascader__search-input::placeholder{color:transparent}.el-check-tag{background-color:var(--el-color-info-light-9);border-radius:var(--el-border-radius-base);color:var(--el-color-info);cursor:pointer;display:inline-block;font-size:var(--el-font-size-base);line-height:var(--el-font-size-base);padding:7px 15px;transition:var(--el-transition-all);font-weight:700}.el-check-tag:hover{background-color:var(--el-color-info-light-7)}.el-check-tag.is-checked{background-color:var(--el-color-primary-light-8);color:var(--el-color-primary)}.el-check-tag.is-checked:hover{background-color:var(--el-color-primary-light-7)}.el-checkbox-button{--el-checkbox-button-checked-bg-color:var(--el-color-primary);--el-checkbox-button-checked-text-color:var(--el-color-white);--el-checkbox-button-checked-border-color:var(--el-color-primary)}.el-checkbox-button{position:relative;display:inline-block}.el-checkbox-button__inner{display:inline-block;line-height:1;font-weight:var(--el-checkbox-font-weight);white-space:nowrap;vertical-align:middle;cursor:pointer;background:var(--el-button-bg-color,var(--el-fill-color-blank));border:var(--el-border);border-left:0;color:var(--el-button-text-color,var(--el-text-color-regular));-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:0;margin:0;position:relative;transition:var(--el-transition-all);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:8px 15px;font-size:var(--el-font-size-base);border-radius:0}.el-checkbox-button__inner.is-round{padding:8px 15px}.el-checkbox-button__inner:hover{color:var(--el-color-primary)}.el-checkbox-button__inner [class*=el-icon-]{line-height:.9}.el-checkbox-button__inner [class*=el-icon-]+span{margin-left:5px}.el-checkbox-button__original{opacity:0;outline:0;position:absolute;margin:0;z-index:-1}.el-checkbox-button.is-checked .el-checkbox-button__inner{color:var(--el-checkbox-button-checked-text-color);background-color:var(--el-checkbox-button-checked-bg-color);border-color:var(--el-checkbox-button-checked-border-color);box-shadow:-1px 0 0 0 var(--el-color-primary-light-7)}.el-checkbox-button.is-checked:first-child .el-checkbox-button__inner{border-left-color:var(--el-checkbox-button-checked-border-color)}.el-checkbox-button.is-disabled .el-checkbox-button__inner{color:var(--el-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color,var(--el-fill-color-blank));border-color:var(--el-button-disabled-border-color,var(--el-border-color-light));box-shadow:none}.el-checkbox-button.is-disabled:first-child .el-checkbox-button__inner{border-left-color:var(--el-button-disabled-border-color,var(--el-border-color-light))}.el-checkbox-button:first-child .el-checkbox-button__inner{border-left:var(--el-border);border-top-left-radius:var(--el-border-radius-base);border-bottom-left-radius:var(--el-border-radius-base);box-shadow:none!important}.el-checkbox-button.is-focus .el-checkbox-button__inner{border-color:var(--el-checkbox-button-checked-border-color)}.el-checkbox-button:last-child .el-checkbox-button__inner{border-top-right-radius:var(--el-border-radius-base);border-bottom-right-radius:var(--el-border-radius-base)}.el-checkbox-button--large .el-checkbox-button__inner{padding:12px 19px;font-size:var(--el-font-size-base);border-radius:0}.el-checkbox-button--large .el-checkbox-button__inner.is-round{padding:12px 19px}.el-checkbox-button--small .el-checkbox-button__inner{padding:5px 11px;font-size:12px;border-radius:0}.el-checkbox-button--small .el-checkbox-button__inner.is-round{padding:5px 11px}.el-checkbox-group{font-size:0;line-height:0}.el-checkbox{--el-checkbox-font-size:14px;--el-checkbox-font-weight:var(--el-font-weight-primary);--el-checkbox-text-color:var(--el-text-color-regular);--el-checkbox-input-height:14px;--el-checkbox-input-width:14px;--el-checkbox-border-radius:var(--el-border-radius-small);--el-checkbox-bg-color:var(--el-fill-color-blank);--el-checkbox-input-border:var(--el-border);--el-checkbox-disabled-border-color:var(--el-border-color);--el-checkbox-disabled-input-fill:var(--el-fill-color-light);--el-checkbox-disabled-icon-color:var(--el-text-color-placeholder);--el-checkbox-disabled-checked-input-fill:var(--el-border-color-extra-light);--el-checkbox-disabled-checked-input-border-color:var(--el-border-color);--el-checkbox-disabled-checked-icon-color:var(--el-text-color-placeholder);--el-checkbox-checked-text-color:var(--el-color-primary);--el-checkbox-checked-input-border-color:var(--el-color-primary);--el-checkbox-checked-bg-color:var(--el-color-primary);--el-checkbox-checked-icon-color:var(--el-color-white);--el-checkbox-input-border-color-hover:var(--el-color-primary)}.el-checkbox{color:var(--el-checkbox-text-color);font-weight:var(--el-checkbox-font-weight);font-size:var(--el-font-size-base);position:relative;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:30px;height:32px}.el-checkbox.is-disabled{cursor:not-allowed}.el-checkbox.is-bordered{padding:0 15px 0 9px;border-radius:var(--el-border-radius-base);border:var(--el-border);box-sizing:border-box}.el-checkbox.is-bordered.is-checked{border-color:var(--el-color-primary)}.el-checkbox.is-bordered.is-disabled{border-color:var(--el-border-color-lighter)}.el-checkbox.is-bordered.el-checkbox--large{padding:0 19px 0 11px;border-radius:var(--el-border-radius-base)}.el-checkbox.is-bordered.el-checkbox--large .el-checkbox__label{font-size:var(--el-font-size-base)}.el-checkbox.is-bordered.el-checkbox--large .el-checkbox__inner{height:14px;width:14px}.el-checkbox.is-bordered.el-checkbox--small{padding:0 11px 0 7px;border-radius:calc(var(--el-border-radius-base) - 1px)}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__label{font-size:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner{height:12px;width:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner:after{height:6px;width:2px}.el-checkbox input:focus-visible+.el-checkbox__inner{outline:2px solid var(--el-checkbox-input-border-color-hover);outline-offset:1px;border-radius:var(--el-checkbox-border-radius)}.el-checkbox__input{white-space:nowrap;cursor:pointer;outline:0;display:inline-flex;position:relative}.el-checkbox__input.is-disabled .el-checkbox__inner{background-color:var(--el-checkbox-disabled-input-fill);border-color:var(--el-checkbox-disabled-border-color);cursor:not-allowed}.el-checkbox__input.is-disabled .el-checkbox__inner:after{cursor:not-allowed;border-color:var(--el-checkbox-disabled-icon-color)}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner{background-color:var(--el-checkbox-disabled-checked-input-fill);border-color:var(--el-checkbox-disabled-checked-input-border-color)}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner:after{border-color:var(--el-checkbox-disabled-checked-icon-color)}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner{background-color:var(--el-checkbox-disabled-checked-input-fill);border-color:var(--el-checkbox-disabled-checked-input-border-color)}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner:before{background-color:var(--el-checkbox-disabled-checked-icon-color);border-color:var(--el-checkbox-disabled-checked-icon-color)}.el-checkbox__input.is-disabled+span.el-checkbox__label{color:var(--el-disabled-text-color);cursor:not-allowed}.el-checkbox__input.is-checked .el-checkbox__inner{background-color:var(--el-checkbox-checked-bg-color);border-color:var(--el-checkbox-checked-input-border-color)}.el-checkbox__input.is-checked .el-checkbox__inner:after{transform:rotate(45deg) scaleY(1)}.el-checkbox__input.is-checked+.el-checkbox__label{color:var(--el-checkbox-checked-text-color)}.el-checkbox__input.is-focus:not(.is-checked) .el-checkbox__original:not(:focus-visible){border-color:var(--el-checkbox-input-border-color-hover)}.el-checkbox__input.is-indeterminate .el-checkbox__inner{background-color:var(--el-checkbox-checked-bg-color);border-color:var(--el-checkbox-checked-input-border-color)}.el-checkbox__input.is-indeterminate .el-checkbox__inner:before{content:"";position:absolute;display:block;background-color:var(--el-checkbox-checked-icon-color);height:2px;transform:scale(.5);left:0;right:0;top:5px}.el-checkbox__input.is-indeterminate .el-checkbox__inner:after{display:none}.el-checkbox__inner{display:inline-block;position:relative;border:var(--el-checkbox-input-border);border-radius:var(--el-checkbox-border-radius);box-sizing:border-box;width:var(--el-checkbox-input-width);height:var(--el-checkbox-input-height);background-color:var(--el-checkbox-bg-color);z-index:var(--el-index-normal);transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46),outline .25s cubic-bezier(.71,-.46,.29,1.46)}.el-checkbox__inner:hover{border-color:var(--el-checkbox-input-border-color-hover)}.el-checkbox__inner:after{box-sizing:content-box;content:"";border:1px solid var(--el-checkbox-checked-icon-color);border-left:0;border-top:0;height:7px;left:4px;position:absolute;top:1px;transform:rotate(45deg) scaleY(0);width:3px;transition:transform .15s ease-in 50ms;transform-origin:center}.el-checkbox__original{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;z-index:-1}.el-checkbox__label{display:inline-block;padding-left:8px;line-height:1;font-size:var(--el-checkbox-font-size)}.el-checkbox.el-checkbox--large{height:40px}.el-checkbox.el-checkbox--large .el-checkbox__label{font-size:14px}.el-checkbox.el-checkbox--large .el-checkbox__inner{width:14px;height:14px}.el-checkbox.el-checkbox--small{height:24px}.el-checkbox.el-checkbox--small .el-checkbox__label{font-size:12px}.el-checkbox.el-checkbox--small .el-checkbox__inner{width:12px;height:12px}.el-checkbox.el-checkbox--small .el-checkbox__input.is-indeterminate .el-checkbox__inner:before{top:4px}.el-checkbox.el-checkbox--small .el-checkbox__inner:after{width:2px;height:6px}.el-checkbox:last-of-type{margin-right:0}[class*=el-col-]{box-sizing:border-box}[class*=el-col-].is-guttered{display:block;min-height:1px}.el-col-0,.el-col-0.is-guttered{display:none}.el-col-0{max-width:0%;flex:0 0 0%}.el-col-offset-0{margin-left:0}.el-col-pull-0{position:relative;right:0}.el-col-push-0{position:relative;left:0}.el-col-1{max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-offset-1{margin-left:4.1666666667%}.el-col-pull-1{position:relative;right:4.1666666667%}.el-col-push-1{position:relative;left:4.1666666667%}.el-col-2{max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-offset-2{margin-left:8.3333333333%}.el-col-pull-2{position:relative;right:8.3333333333%}.el-col-push-2{position:relative;left:8.3333333333%}.el-col-3{max-width:12.5%;flex:0 0 12.5%}.el-col-offset-3{margin-left:12.5%}.el-col-pull-3{position:relative;right:12.5%}.el-col-push-3{position:relative;left:12.5%}.el-col-4{max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-offset-4{margin-left:16.6666666667%}.el-col-pull-4{position:relative;right:16.6666666667%}.el-col-push-4{position:relative;left:16.6666666667%}.el-col-5{max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-offset-5{margin-left:20.8333333333%}.el-col-pull-5{position:relative;right:20.8333333333%}.el-col-push-5{position:relative;left:20.8333333333%}.el-col-6{max-width:25%;flex:0 0 25%}.el-col-offset-6{margin-left:25%}.el-col-pull-6{position:relative;right:25%}.el-col-push-6{position:relative;left:25%}.el-col-7{max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-offset-7{margin-left:29.1666666667%}.el-col-pull-7{position:relative;right:29.1666666667%}.el-col-push-7{position:relative;left:29.1666666667%}.el-col-8{max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-offset-8{margin-left:33.3333333333%}.el-col-pull-8{position:relative;right:33.3333333333%}.el-col-push-8{position:relative;left:33.3333333333%}.el-col-9{max-width:37.5%;flex:0 0 37.5%}.el-col-offset-9{margin-left:37.5%}.el-col-pull-9{position:relative;right:37.5%}.el-col-push-9{position:relative;left:37.5%}.el-col-10{max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-offset-10{margin-left:41.6666666667%}.el-col-pull-10{position:relative;right:41.6666666667%}.el-col-push-10{position:relative;left:41.6666666667%}.el-col-11{max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-offset-11{margin-left:45.8333333333%}.el-col-pull-11{position:relative;right:45.8333333333%}.el-col-push-11{position:relative;left:45.8333333333%}.el-col-12{max-width:50%;flex:0 0 50%}.el-col-offset-12{margin-left:50%}.el-col-pull-12{position:relative;right:50%}.el-col-push-12{position:relative;left:50%}.el-col-13{max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-offset-13{margin-left:54.1666666667%}.el-col-pull-13{position:relative;right:54.1666666667%}.el-col-push-13{position:relative;left:54.1666666667%}.el-col-14{max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-offset-14{margin-left:58.3333333333%}.el-col-pull-14{position:relative;right:58.3333333333%}.el-col-push-14{position:relative;left:58.3333333333%}.el-col-15{max-width:62.5%;flex:0 0 62.5%}.el-col-offset-15{margin-left:62.5%}.el-col-pull-15{position:relative;right:62.5%}.el-col-push-15{position:relative;left:62.5%}.el-col-16{max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-offset-16{margin-left:66.6666666667%}.el-col-pull-16{position:relative;right:66.6666666667%}.el-col-push-16{position:relative;left:66.6666666667%}.el-col-17{max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-offset-17{margin-left:70.8333333333%}.el-col-pull-17{position:relative;right:70.8333333333%}.el-col-push-17{position:relative;left:70.8333333333%}.el-col-18{max-width:75%;flex:0 0 75%}.el-col-offset-18{margin-left:75%}.el-col-pull-18{position:relative;right:75%}.el-col-push-18{position:relative;left:75%}.el-col-19{max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-offset-19{margin-left:79.1666666667%}.el-col-pull-19{position:relative;right:79.1666666667%}.el-col-push-19{position:relative;left:79.1666666667%}.el-col-20{max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-offset-20{margin-left:83.3333333333%}.el-col-pull-20{position:relative;right:83.3333333333%}.el-col-push-20{position:relative;left:83.3333333333%}.el-col-21{max-width:87.5%;flex:0 0 87.5%}.el-col-offset-21{margin-left:87.5%}.el-col-pull-21{position:relative;right:87.5%}.el-col-push-21{position:relative;left:87.5%}.el-col-22{max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-offset-22{margin-left:91.6666666667%}.el-col-pull-22{position:relative;right:91.6666666667%}.el-col-push-22{position:relative;left:91.6666666667%}.el-col-23{max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-offset-23{margin-left:95.8333333333%}.el-col-pull-23{position:relative;right:95.8333333333%}.el-col-push-23{position:relative;left:95.8333333333%}.el-col-24{max-width:100%;flex:0 0 100%}.el-col-offset-24{margin-left:100%}.el-col-pull-24{position:relative;right:100%}.el-col-push-24{position:relative;left:100%}@media only screen and (max-width:768px){.el-col-xs-0,.el-col-xs-0.is-guttered{display:none}.el-col-xs-0{max-width:0%;flex:0 0 0%}.el-col-xs-offset-0{margin-left:0}.el-col-xs-pull-0{position:relative;right:0}.el-col-xs-push-0{position:relative;left:0}.el-col-xs-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-xs-offset-1{margin-left:4.1666666667%}.el-col-xs-pull-1{position:relative;right:4.1666666667%}.el-col-xs-push-1{position:relative;left:4.1666666667%}.el-col-xs-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-xs-offset-2{margin-left:8.3333333333%}.el-col-xs-pull-2{position:relative;right:8.3333333333%}.el-col-xs-push-2{position:relative;left:8.3333333333%}.el-col-xs-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-xs-offset-3{margin-left:12.5%}.el-col-xs-pull-3{position:relative;right:12.5%}.el-col-xs-push-3{position:relative;left:12.5%}.el-col-xs-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-xs-offset-4{margin-left:16.6666666667%}.el-col-xs-pull-4{position:relative;right:16.6666666667%}.el-col-xs-push-4{position:relative;left:16.6666666667%}.el-col-xs-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-xs-offset-5{margin-left:20.8333333333%}.el-col-xs-pull-5{position:relative;right:20.8333333333%}.el-col-xs-push-5{position:relative;left:20.8333333333%}.el-col-xs-6{display:block;max-width:25%;flex:0 0 25%}.el-col-xs-offset-6{margin-left:25%}.el-col-xs-pull-6{position:relative;right:25%}.el-col-xs-push-6{position:relative;left:25%}.el-col-xs-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-xs-offset-7{margin-left:29.1666666667%}.el-col-xs-pull-7{position:relative;right:29.1666666667%}.el-col-xs-push-7{position:relative;left:29.1666666667%}.el-col-xs-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-xs-offset-8{margin-left:33.3333333333%}.el-col-xs-pull-8{position:relative;right:33.3333333333%}.el-col-xs-push-8{position:relative;left:33.3333333333%}.el-col-xs-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-xs-offset-9{margin-left:37.5%}.el-col-xs-pull-9{position:relative;right:37.5%}.el-col-xs-push-9{position:relative;left:37.5%}.el-col-xs-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-xs-offset-10{margin-left:41.6666666667%}.el-col-xs-pull-10{position:relative;right:41.6666666667%}.el-col-xs-push-10{position:relative;left:41.6666666667%}.el-col-xs-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-xs-offset-11{margin-left:45.8333333333%}.el-col-xs-pull-11{position:relative;right:45.8333333333%}.el-col-xs-push-11{position:relative;left:45.8333333333%}.el-col-xs-12{display:block;max-width:50%;flex:0 0 50%}.el-col-xs-offset-12{margin-left:50%}.el-col-xs-pull-12{position:relative;right:50%}.el-col-xs-push-12{position:relative;left:50%}.el-col-xs-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-xs-offset-13{margin-left:54.1666666667%}.el-col-xs-pull-13{position:relative;right:54.1666666667%}.el-col-xs-push-13{position:relative;left:54.1666666667%}.el-col-xs-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-xs-offset-14{margin-left:58.3333333333%}.el-col-xs-pull-14{position:relative;right:58.3333333333%}.el-col-xs-push-14{position:relative;left:58.3333333333%}.el-col-xs-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-xs-offset-15{margin-left:62.5%}.el-col-xs-pull-15{position:relative;right:62.5%}.el-col-xs-push-15{position:relative;left:62.5%}.el-col-xs-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-xs-offset-16{margin-left:66.6666666667%}.el-col-xs-pull-16{position:relative;right:66.6666666667%}.el-col-xs-push-16{position:relative;left:66.6666666667%}.el-col-xs-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-xs-offset-17{margin-left:70.8333333333%}.el-col-xs-pull-17{position:relative;right:70.8333333333%}.el-col-xs-push-17{position:relative;left:70.8333333333%}.el-col-xs-18{display:block;max-width:75%;flex:0 0 75%}.el-col-xs-offset-18{margin-left:75%}.el-col-xs-pull-18{position:relative;right:75%}.el-col-xs-push-18{position:relative;left:75%}.el-col-xs-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-xs-offset-19{margin-left:79.1666666667%}.el-col-xs-pull-19{position:relative;right:79.1666666667%}.el-col-xs-push-19{position:relative;left:79.1666666667%}.el-col-xs-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-xs-offset-20{margin-left:83.3333333333%}.el-col-xs-pull-20{position:relative;right:83.3333333333%}.el-col-xs-push-20{position:relative;left:83.3333333333%}.el-col-xs-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-xs-offset-21{margin-left:87.5%}.el-col-xs-pull-21{position:relative;right:87.5%}.el-col-xs-push-21{position:relative;left:87.5%}.el-col-xs-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-xs-offset-22{margin-left:91.6666666667%}.el-col-xs-pull-22{position:relative;right:91.6666666667%}.el-col-xs-push-22{position:relative;left:91.6666666667%}.el-col-xs-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-xs-offset-23{margin-left:95.8333333333%}.el-col-xs-pull-23{position:relative;right:95.8333333333%}.el-col-xs-push-23{position:relative;left:95.8333333333%}.el-col-xs-24{display:block;max-width:100%;flex:0 0 100%}.el-col-xs-offset-24{margin-left:100%}.el-col-xs-pull-24{position:relative;right:100%}.el-col-xs-push-24{position:relative;left:100%}}@media only screen and (min-width:768px){.el-col-sm-0,.el-col-sm-0.is-guttered{display:none}.el-col-sm-0{max-width:0%;flex:0 0 0%}.el-col-sm-offset-0{margin-left:0}.el-col-sm-pull-0{position:relative;right:0}.el-col-sm-push-0{position:relative;left:0}.el-col-sm-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-sm-offset-1{margin-left:4.1666666667%}.el-col-sm-pull-1{position:relative;right:4.1666666667%}.el-col-sm-push-1{position:relative;left:4.1666666667%}.el-col-sm-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-sm-offset-2{margin-left:8.3333333333%}.el-col-sm-pull-2{position:relative;right:8.3333333333%}.el-col-sm-push-2{position:relative;left:8.3333333333%}.el-col-sm-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-sm-offset-3{margin-left:12.5%}.el-col-sm-pull-3{position:relative;right:12.5%}.el-col-sm-push-3{position:relative;left:12.5%}.el-col-sm-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-sm-offset-4{margin-left:16.6666666667%}.el-col-sm-pull-4{position:relative;right:16.6666666667%}.el-col-sm-push-4{position:relative;left:16.6666666667%}.el-col-sm-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-sm-offset-5{margin-left:20.8333333333%}.el-col-sm-pull-5{position:relative;right:20.8333333333%}.el-col-sm-push-5{position:relative;left:20.8333333333%}.el-col-sm-6{display:block;max-width:25%;flex:0 0 25%}.el-col-sm-offset-6{margin-left:25%}.el-col-sm-pull-6{position:relative;right:25%}.el-col-sm-push-6{position:relative;left:25%}.el-col-sm-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-sm-offset-7{margin-left:29.1666666667%}.el-col-sm-pull-7{position:relative;right:29.1666666667%}.el-col-sm-push-7{position:relative;left:29.1666666667%}.el-col-sm-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-sm-offset-8{margin-left:33.3333333333%}.el-col-sm-pull-8{position:relative;right:33.3333333333%}.el-col-sm-push-8{position:relative;left:33.3333333333%}.el-col-sm-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-sm-offset-9{margin-left:37.5%}.el-col-sm-pull-9{position:relative;right:37.5%}.el-col-sm-push-9{position:relative;left:37.5%}.el-col-sm-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-sm-offset-10{margin-left:41.6666666667%}.el-col-sm-pull-10{position:relative;right:41.6666666667%}.el-col-sm-push-10{position:relative;left:41.6666666667%}.el-col-sm-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-sm-offset-11{margin-left:45.8333333333%}.el-col-sm-pull-11{position:relative;right:45.8333333333%}.el-col-sm-push-11{position:relative;left:45.8333333333%}.el-col-sm-12{display:block;max-width:50%;flex:0 0 50%}.el-col-sm-offset-12{margin-left:50%}.el-col-sm-pull-12{position:relative;right:50%}.el-col-sm-push-12{position:relative;left:50%}.el-col-sm-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-sm-offset-13{margin-left:54.1666666667%}.el-col-sm-pull-13{position:relative;right:54.1666666667%}.el-col-sm-push-13{position:relative;left:54.1666666667%}.el-col-sm-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-sm-offset-14{margin-left:58.3333333333%}.el-col-sm-pull-14{position:relative;right:58.3333333333%}.el-col-sm-push-14{position:relative;left:58.3333333333%}.el-col-sm-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-sm-offset-15{margin-left:62.5%}.el-col-sm-pull-15{position:relative;right:62.5%}.el-col-sm-push-15{position:relative;left:62.5%}.el-col-sm-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-sm-offset-16{margin-left:66.6666666667%}.el-col-sm-pull-16{position:relative;right:66.6666666667%}.el-col-sm-push-16{position:relative;left:66.6666666667%}.el-col-sm-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-sm-offset-17{margin-left:70.8333333333%}.el-col-sm-pull-17{position:relative;right:70.8333333333%}.el-col-sm-push-17{position:relative;left:70.8333333333%}.el-col-sm-18{display:block;max-width:75%;flex:0 0 75%}.el-col-sm-offset-18{margin-left:75%}.el-col-sm-pull-18{position:relative;right:75%}.el-col-sm-push-18{position:relative;left:75%}.el-col-sm-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-sm-offset-19{margin-left:79.1666666667%}.el-col-sm-pull-19{position:relative;right:79.1666666667%}.el-col-sm-push-19{position:relative;left:79.1666666667%}.el-col-sm-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-sm-offset-20{margin-left:83.3333333333%}.el-col-sm-pull-20{position:relative;right:83.3333333333%}.el-col-sm-push-20{position:relative;left:83.3333333333%}.el-col-sm-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-sm-offset-21{margin-left:87.5%}.el-col-sm-pull-21{position:relative;right:87.5%}.el-col-sm-push-21{position:relative;left:87.5%}.el-col-sm-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-sm-offset-22{margin-left:91.6666666667%}.el-col-sm-pull-22{position:relative;right:91.6666666667%}.el-col-sm-push-22{position:relative;left:91.6666666667%}.el-col-sm-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-sm-offset-23{margin-left:95.8333333333%}.el-col-sm-pull-23{position:relative;right:95.8333333333%}.el-col-sm-push-23{position:relative;left:95.8333333333%}.el-col-sm-24{display:block;max-width:100%;flex:0 0 100%}.el-col-sm-offset-24{margin-left:100%}.el-col-sm-pull-24{position:relative;right:100%}.el-col-sm-push-24{position:relative;left:100%}}@media only screen and (min-width:992px){.el-col-md-0,.el-col-md-0.is-guttered{display:none}.el-col-md-0{max-width:0%;flex:0 0 0%}.el-col-md-offset-0{margin-left:0}.el-col-md-pull-0{position:relative;right:0}.el-col-md-push-0{position:relative;left:0}.el-col-md-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-md-offset-1{margin-left:4.1666666667%}.el-col-md-pull-1{position:relative;right:4.1666666667%}.el-col-md-push-1{position:relative;left:4.1666666667%}.el-col-md-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-md-offset-2{margin-left:8.3333333333%}.el-col-md-pull-2{position:relative;right:8.3333333333%}.el-col-md-push-2{position:relative;left:8.3333333333%}.el-col-md-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-md-offset-3{margin-left:12.5%}.el-col-md-pull-3{position:relative;right:12.5%}.el-col-md-push-3{position:relative;left:12.5%}.el-col-md-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-md-offset-4{margin-left:16.6666666667%}.el-col-md-pull-4{position:relative;right:16.6666666667%}.el-col-md-push-4{position:relative;left:16.6666666667%}.el-col-md-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-md-offset-5{margin-left:20.8333333333%}.el-col-md-pull-5{position:relative;right:20.8333333333%}.el-col-md-push-5{position:relative;left:20.8333333333%}.el-col-md-6{display:block;max-width:25%;flex:0 0 25%}.el-col-md-offset-6{margin-left:25%}.el-col-md-pull-6{position:relative;right:25%}.el-col-md-push-6{position:relative;left:25%}.el-col-md-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-md-offset-7{margin-left:29.1666666667%}.el-col-md-pull-7{position:relative;right:29.1666666667%}.el-col-md-push-7{position:relative;left:29.1666666667%}.el-col-md-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-md-offset-8{margin-left:33.3333333333%}.el-col-md-pull-8{position:relative;right:33.3333333333%}.el-col-md-push-8{position:relative;left:33.3333333333%}.el-col-md-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-md-offset-9{margin-left:37.5%}.el-col-md-pull-9{position:relative;right:37.5%}.el-col-md-push-9{position:relative;left:37.5%}.el-col-md-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-md-offset-10{margin-left:41.6666666667%}.el-col-md-pull-10{position:relative;right:41.6666666667%}.el-col-md-push-10{position:relative;left:41.6666666667%}.el-col-md-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-md-offset-11{margin-left:45.8333333333%}.el-col-md-pull-11{position:relative;right:45.8333333333%}.el-col-md-push-11{position:relative;left:45.8333333333%}.el-col-md-12{display:block;max-width:50%;flex:0 0 50%}.el-col-md-offset-12{margin-left:50%}.el-col-md-pull-12{position:relative;right:50%}.el-col-md-push-12{position:relative;left:50%}.el-col-md-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-md-offset-13{margin-left:54.1666666667%}.el-col-md-pull-13{position:relative;right:54.1666666667%}.el-col-md-push-13{position:relative;left:54.1666666667%}.el-col-md-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-md-offset-14{margin-left:58.3333333333%}.el-col-md-pull-14{position:relative;right:58.3333333333%}.el-col-md-push-14{position:relative;left:58.3333333333%}.el-col-md-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-md-offset-15{margin-left:62.5%}.el-col-md-pull-15{position:relative;right:62.5%}.el-col-md-push-15{position:relative;left:62.5%}.el-col-md-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-md-offset-16{margin-left:66.6666666667%}.el-col-md-pull-16{position:relative;right:66.6666666667%}.el-col-md-push-16{position:relative;left:66.6666666667%}.el-col-md-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-md-offset-17{margin-left:70.8333333333%}.el-col-md-pull-17{position:relative;right:70.8333333333%}.el-col-md-push-17{position:relative;left:70.8333333333%}.el-col-md-18{display:block;max-width:75%;flex:0 0 75%}.el-col-md-offset-18{margin-left:75%}.el-col-md-pull-18{position:relative;right:75%}.el-col-md-push-18{position:relative;left:75%}.el-col-md-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-md-offset-19{margin-left:79.1666666667%}.el-col-md-pull-19{position:relative;right:79.1666666667%}.el-col-md-push-19{position:relative;left:79.1666666667%}.el-col-md-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-md-offset-20{margin-left:83.3333333333%}.el-col-md-pull-20{position:relative;right:83.3333333333%}.el-col-md-push-20{position:relative;left:83.3333333333%}.el-col-md-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-md-offset-21{margin-left:87.5%}.el-col-md-pull-21{position:relative;right:87.5%}.el-col-md-push-21{position:relative;left:87.5%}.el-col-md-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-md-offset-22{margin-left:91.6666666667%}.el-col-md-pull-22{position:relative;right:91.6666666667%}.el-col-md-push-22{position:relative;left:91.6666666667%}.el-col-md-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-md-offset-23{margin-left:95.8333333333%}.el-col-md-pull-23{position:relative;right:95.8333333333%}.el-col-md-push-23{position:relative;left:95.8333333333%}.el-col-md-24{display:block;max-width:100%;flex:0 0 100%}.el-col-md-offset-24{margin-left:100%}.el-col-md-pull-24{position:relative;right:100%}.el-col-md-push-24{position:relative;left:100%}}@media only screen and (min-width:1200px){.el-col-lg-0,.el-col-lg-0.is-guttered{display:none}.el-col-lg-0{max-width:0%;flex:0 0 0%}.el-col-lg-offset-0{margin-left:0}.el-col-lg-pull-0{position:relative;right:0}.el-col-lg-push-0{position:relative;left:0}.el-col-lg-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-lg-offset-1{margin-left:4.1666666667%}.el-col-lg-pull-1{position:relative;right:4.1666666667%}.el-col-lg-push-1{position:relative;left:4.1666666667%}.el-col-lg-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-lg-offset-2{margin-left:8.3333333333%}.el-col-lg-pull-2{position:relative;right:8.3333333333%}.el-col-lg-push-2{position:relative;left:8.3333333333%}.el-col-lg-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-lg-offset-3{margin-left:12.5%}.el-col-lg-pull-3{position:relative;right:12.5%}.el-col-lg-push-3{position:relative;left:12.5%}.el-col-lg-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-lg-offset-4{margin-left:16.6666666667%}.el-col-lg-pull-4{position:relative;right:16.6666666667%}.el-col-lg-push-4{position:relative;left:16.6666666667%}.el-col-lg-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-lg-offset-5{margin-left:20.8333333333%}.el-col-lg-pull-5{position:relative;right:20.8333333333%}.el-col-lg-push-5{position:relative;left:20.8333333333%}.el-col-lg-6{display:block;max-width:25%;flex:0 0 25%}.el-col-lg-offset-6{margin-left:25%}.el-col-lg-pull-6{position:relative;right:25%}.el-col-lg-push-6{position:relative;left:25%}.el-col-lg-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-lg-offset-7{margin-left:29.1666666667%}.el-col-lg-pull-7{position:relative;right:29.1666666667%}.el-col-lg-push-7{position:relative;left:29.1666666667%}.el-col-lg-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-lg-offset-8{margin-left:33.3333333333%}.el-col-lg-pull-8{position:relative;right:33.3333333333%}.el-col-lg-push-8{position:relative;left:33.3333333333%}.el-col-lg-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-lg-offset-9{margin-left:37.5%}.el-col-lg-pull-9{position:relative;right:37.5%}.el-col-lg-push-9{position:relative;left:37.5%}.el-col-lg-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-lg-offset-10{margin-left:41.6666666667%}.el-col-lg-pull-10{position:relative;right:41.6666666667%}.el-col-lg-push-10{position:relative;left:41.6666666667%}.el-col-lg-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-lg-offset-11{margin-left:45.8333333333%}.el-col-lg-pull-11{position:relative;right:45.8333333333%}.el-col-lg-push-11{position:relative;left:45.8333333333%}.el-col-lg-12{display:block;max-width:50%;flex:0 0 50%}.el-col-lg-offset-12{margin-left:50%}.el-col-lg-pull-12{position:relative;right:50%}.el-col-lg-push-12{position:relative;left:50%}.el-col-lg-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-lg-offset-13{margin-left:54.1666666667%}.el-col-lg-pull-13{position:relative;right:54.1666666667%}.el-col-lg-push-13{position:relative;left:54.1666666667%}.el-col-lg-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-lg-offset-14{margin-left:58.3333333333%}.el-col-lg-pull-14{position:relative;right:58.3333333333%}.el-col-lg-push-14{position:relative;left:58.3333333333%}.el-col-lg-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-lg-offset-15{margin-left:62.5%}.el-col-lg-pull-15{position:relative;right:62.5%}.el-col-lg-push-15{position:relative;left:62.5%}.el-col-lg-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-lg-offset-16{margin-left:66.6666666667%}.el-col-lg-pull-16{position:relative;right:66.6666666667%}.el-col-lg-push-16{position:relative;left:66.6666666667%}.el-col-lg-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-lg-offset-17{margin-left:70.8333333333%}.el-col-lg-pull-17{position:relative;right:70.8333333333%}.el-col-lg-push-17{position:relative;left:70.8333333333%}.el-col-lg-18{display:block;max-width:75%;flex:0 0 75%}.el-col-lg-offset-18{margin-left:75%}.el-col-lg-pull-18{position:relative;right:75%}.el-col-lg-push-18{position:relative;left:75%}.el-col-lg-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-lg-offset-19{margin-left:79.1666666667%}.el-col-lg-pull-19{position:relative;right:79.1666666667%}.el-col-lg-push-19{position:relative;left:79.1666666667%}.el-col-lg-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-lg-offset-20{margin-left:83.3333333333%}.el-col-lg-pull-20{position:relative;right:83.3333333333%}.el-col-lg-push-20{position:relative;left:83.3333333333%}.el-col-lg-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-lg-offset-21{margin-left:87.5%}.el-col-lg-pull-21{position:relative;right:87.5%}.el-col-lg-push-21{position:relative;left:87.5%}.el-col-lg-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-lg-offset-22{margin-left:91.6666666667%}.el-col-lg-pull-22{position:relative;right:91.6666666667%}.el-col-lg-push-22{position:relative;left:91.6666666667%}.el-col-lg-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-lg-offset-23{margin-left:95.8333333333%}.el-col-lg-pull-23{position:relative;right:95.8333333333%}.el-col-lg-push-23{position:relative;left:95.8333333333%}.el-col-lg-24{display:block;max-width:100%;flex:0 0 100%}.el-col-lg-offset-24{margin-left:100%}.el-col-lg-pull-24{position:relative;right:100%}.el-col-lg-push-24{position:relative;left:100%}}@media only screen and (min-width:1920px){.el-col-xl-0,.el-col-xl-0.is-guttered{display:none}.el-col-xl-0{max-width:0%;flex:0 0 0%}.el-col-xl-offset-0{margin-left:0}.el-col-xl-pull-0{position:relative;right:0}.el-col-xl-push-0{position:relative;left:0}.el-col-xl-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-xl-offset-1{margin-left:4.1666666667%}.el-col-xl-pull-1{position:relative;right:4.1666666667%}.el-col-xl-push-1{position:relative;left:4.1666666667%}.el-col-xl-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-xl-offset-2{margin-left:8.3333333333%}.el-col-xl-pull-2{position:relative;right:8.3333333333%}.el-col-xl-push-2{position:relative;left:8.3333333333%}.el-col-xl-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-xl-offset-3{margin-left:12.5%}.el-col-xl-pull-3{position:relative;right:12.5%}.el-col-xl-push-3{position:relative;left:12.5%}.el-col-xl-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-xl-offset-4{margin-left:16.6666666667%}.el-col-xl-pull-4{position:relative;right:16.6666666667%}.el-col-xl-push-4{position:relative;left:16.6666666667%}.el-col-xl-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-xl-offset-5{margin-left:20.8333333333%}.el-col-xl-pull-5{position:relative;right:20.8333333333%}.el-col-xl-push-5{position:relative;left:20.8333333333%}.el-col-xl-6{display:block;max-width:25%;flex:0 0 25%}.el-col-xl-offset-6{margin-left:25%}.el-col-xl-pull-6{position:relative;right:25%}.el-col-xl-push-6{position:relative;left:25%}.el-col-xl-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-xl-offset-7{margin-left:29.1666666667%}.el-col-xl-pull-7{position:relative;right:29.1666666667%}.el-col-xl-push-7{position:relative;left:29.1666666667%}.el-col-xl-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-xl-offset-8{margin-left:33.3333333333%}.el-col-xl-pull-8{position:relative;right:33.3333333333%}.el-col-xl-push-8{position:relative;left:33.3333333333%}.el-col-xl-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-xl-offset-9{margin-left:37.5%}.el-col-xl-pull-9{position:relative;right:37.5%}.el-col-xl-push-9{position:relative;left:37.5%}.el-col-xl-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-xl-offset-10{margin-left:41.6666666667%}.el-col-xl-pull-10{position:relative;right:41.6666666667%}.el-col-xl-push-10{position:relative;left:41.6666666667%}.el-col-xl-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-xl-offset-11{margin-left:45.8333333333%}.el-col-xl-pull-11{position:relative;right:45.8333333333%}.el-col-xl-push-11{position:relative;left:45.8333333333%}.el-col-xl-12{display:block;max-width:50%;flex:0 0 50%}.el-col-xl-offset-12{margin-left:50%}.el-col-xl-pull-12{position:relative;right:50%}.el-col-xl-push-12{position:relative;left:50%}.el-col-xl-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-xl-offset-13{margin-left:54.1666666667%}.el-col-xl-pull-13{position:relative;right:54.1666666667%}.el-col-xl-push-13{position:relative;left:54.1666666667%}.el-col-xl-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-xl-offset-14{margin-left:58.3333333333%}.el-col-xl-pull-14{position:relative;right:58.3333333333%}.el-col-xl-push-14{position:relative;left:58.3333333333%}.el-col-xl-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-xl-offset-15{margin-left:62.5%}.el-col-xl-pull-15{position:relative;right:62.5%}.el-col-xl-push-15{position:relative;left:62.5%}.el-col-xl-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-xl-offset-16{margin-left:66.6666666667%}.el-col-xl-pull-16{position:relative;right:66.6666666667%}.el-col-xl-push-16{position:relative;left:66.6666666667%}.el-col-xl-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-xl-offset-17{margin-left:70.8333333333%}.el-col-xl-pull-17{position:relative;right:70.8333333333%}.el-col-xl-push-17{position:relative;left:70.8333333333%}.el-col-xl-18{display:block;max-width:75%;flex:0 0 75%}.el-col-xl-offset-18{margin-left:75%}.el-col-xl-pull-18{position:relative;right:75%}.el-col-xl-push-18{position:relative;left:75%}.el-col-xl-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-xl-offset-19{margin-left:79.1666666667%}.el-col-xl-pull-19{position:relative;right:79.1666666667%}.el-col-xl-push-19{position:relative;left:79.1666666667%}.el-col-xl-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-xl-offset-20{margin-left:83.3333333333%}.el-col-xl-pull-20{position:relative;right:83.3333333333%}.el-col-xl-push-20{position:relative;left:83.3333333333%}.el-col-xl-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-xl-offset-21{margin-left:87.5%}.el-col-xl-pull-21{position:relative;right:87.5%}.el-col-xl-push-21{position:relative;left:87.5%}.el-col-xl-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-xl-offset-22{margin-left:91.6666666667%}.el-col-xl-pull-22{position:relative;right:91.6666666667%}.el-col-xl-push-22{position:relative;left:91.6666666667%}.el-col-xl-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-xl-offset-23{margin-left:95.8333333333%}.el-col-xl-pull-23{position:relative;right:95.8333333333%}.el-col-xl-push-23{position:relative;left:95.8333333333%}.el-col-xl-24{display:block;max-width:100%;flex:0 0 100%}.el-col-xl-offset-24{margin-left:100%}.el-col-xl-pull-24{position:relative;right:100%}.el-col-xl-push-24{position:relative;left:100%}}.el-collapse{--el-collapse-border-color:var(--el-border-color-lighter);--el-collapse-header-height:48px;--el-collapse-header-bg-color:var(--el-fill-color-blank);--el-collapse-header-text-color:var(--el-text-color-primary);--el-collapse-header-font-size:13px;--el-collapse-content-bg-color:var(--el-fill-color-blank);--el-collapse-content-font-size:13px;--el-collapse-content-text-color:var(--el-text-color-primary);border-top:1px solid var(--el-collapse-border-color);border-bottom:1px solid var(--el-collapse-border-color)}.el-collapse-item.is-disabled .el-collapse-item__header{color:var(--el-text-color-disabled);cursor:not-allowed}.el-collapse-item__header{display:flex;align-items:center;height:var(--el-collapse-header-height);line-height:var(--el-collapse-header-height);background-color:var(--el-collapse-header-bg-color);color:var(--el-collapse-header-text-color);cursor:pointer;border-bottom:1px solid var(--el-collapse-border-color);font-size:var(--el-collapse-header-font-size);font-weight:500;transition:border-bottom-color var(--el-transition-duration);outline:0}.el-collapse-item__arrow{margin:0 8px 0 auto;transition:transform var(--el-transition-duration);font-weight:300}.el-collapse-item__arrow.is-active{transform:rotate(90deg)}.el-collapse-item__header.focusing:focus:not(:hover){color:var(--el-color-primary)}.el-collapse-item__header.is-active{border-bottom-color:transparent}.el-collapse-item__wrap{will-change:height;background-color:var(--el-collapse-content-bg-color);overflow:hidden;box-sizing:border-box;border-bottom:1px solid var(--el-collapse-border-color)}.el-collapse-item__content{padding-bottom:25px;font-size:var(--el-collapse-content-font-size);color:var(--el-collapse-content-text-color);line-height:1.7692307692}.el-collapse-item:last-child{margin-bottom:-1px}.el-color-predefine{display:flex;font-size:12px;margin-top:8px;width:280px}.el-color-predefine__colors{display:flex;flex:1;flex-wrap:wrap}.el-color-predefine__color-selector{margin:0 0 8px 8px;width:20px;height:20px;border-radius:4px;cursor:pointer}.el-color-predefine__color-selector:nth-child(10n+1){margin-left:0}.el-color-predefine__color-selector.selected{box-shadow:0 0 3px 2px var(--el-color-primary)}.el-color-predefine__color-selector>div{display:flex;height:100%;border-radius:3px}.el-color-predefine__color-selector.is-alpha{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.el-color-hue-slider{position:relative;box-sizing:border-box;width:280px;height:12px;background-color:red;padding:0 2px;float:right}.el-color-hue-slider__bar{position:relative;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);height:100%}.el-color-hue-slider__thumb{position:absolute;cursor:pointer;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid var(--el-border-color-lighter);box-shadow:0 0 2px #0009;z-index:1}.el-color-hue-slider.is-vertical{width:12px;height:180px;padding:2px 0}.el-color-hue-slider.is-vertical .el-color-hue-slider__bar{background:linear-gradient(to bottom,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}.el-color-hue-slider.is-vertical .el-color-hue-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-svpanel{position:relative;width:280px;height:180px}.el-color-svpanel__black,.el-color-svpanel__white{position:absolute;top:0;left:0;right:0;bottom:0}.el-color-svpanel__white{background:linear-gradient(to right,#fff,rgba(255,255,255,0))}.el-color-svpanel__black{background:linear-gradient(to top,#000,rgba(0,0,0,0))}.el-color-svpanel__cursor{position:absolute}.el-color-svpanel__cursor>div{cursor:head;width:4px;height:4px;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px #0000004d,0 0 1px 2px #0006;border-radius:50%;transform:translate(-2px,-2px)}.el-color-alpha-slider{position:relative;box-sizing:border-box;width:280px;height:12px;background-image:linear-gradient(45deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(45deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%);background-size:12px 12px;background-position:0 0,6px 0,6px -6px,0 6px}.el-color-alpha-slider__bar{position:relative;background:linear-gradient(to right,rgba(255,255,255,0) 0,var(--el-bg-color) 100%);height:100%}.el-color-alpha-slider__thumb{position:absolute;cursor:pointer;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid var(--el-border-color-lighter);box-shadow:0 0 2px #0009;z-index:1}.el-color-alpha-slider.is-vertical{width:20px;height:180px}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__bar{background:linear-gradient(to bottom,rgba(255,255,255,0) 0,#fff 100%)}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-dropdown{width:300px}.el-color-dropdown__main-wrapper{margin-bottom:6px}.el-color-dropdown__main-wrapper:after{content:"";display:table;clear:both}.el-color-dropdown__btns{margin-top:12px;text-align:right}.el-color-dropdown__value{float:left;line-height:26px;font-size:12px;color:#000;width:160px}.el-color-picker{display:inline-block;position:relative;line-height:normal;outline:0}.el-color-picker:hover:not(.is-disabled) .el-color-picker__trigger{border:1px solid var(--el-border-color-hover)}.el-color-picker:focus-visible:not(.is-disabled) .el-color-picker__trigger{outline:2px solid var(--el-color-primary);outline-offset:1px}.el-color-picker.is-disabled .el-color-picker__trigger{cursor:not-allowed}.el-color-picker--large{height:40px}.el-color-picker--large .el-color-picker__trigger{height:40px;width:40px}.el-color-picker--large .el-color-picker__mask{height:38px;width:38px}.el-color-picker--small{height:24px}.el-color-picker--small .el-color-picker__trigger{height:24px;width:24px}.el-color-picker--small .el-color-picker__mask{height:22px;width:22px}.el-color-picker--small .el-color-picker__empty,.el-color-picker--small .el-color-picker__icon{transform:scale(.8)}.el-color-picker__mask{height:30px;width:30px;border-radius:4px;position:absolute;top:1px;left:1px;z-index:1;cursor:not-allowed;background-color:#ffffffb3}.el-color-picker__trigger{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;height:32px;width:32px;padding:4px;border:1px solid var(--el-border-color);border-radius:4px;font-size:0;position:relative;cursor:pointer}.el-color-picker__color{position:relative;display:block;box-sizing:border-box;border:1px solid var(--el-text-color-secondary);border-radius:var(--el-border-radius-small);width:100%;height:100%;text-align:center}.el-color-picker__color.is-alpha{background-image:linear-gradient(45deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(45deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%);background-size:12px 12px;background-position:0 0,6px 0,6px -6px,0 6px}.el-color-picker__color-inner{display:inline-flex;justify-content:center;align-items:center;width:100%;height:100%}.el-color-picker .el-color-picker__empty{font-size:12px;color:var(--el-text-color-secondary)}.el-color-picker .el-color-picker__icon{display:inline-flex;justify-content:center;align-items:center;color:#fff;font-size:12px}.el-color-picker__panel{position:absolute;z-index:10;padding:6px;box-sizing:content-box;background-color:#fff;border-radius:var(--el-border-radius-base);box-shadow:var(--el-box-shadow-light)}.el-color-picker__panel.el-popper{border:1px solid var(--el-border-color-lighter)}.el-color-picker,.el-color-picker__panel{--el-color-picker-alpha-bg-a:#ccc;--el-color-picker-alpha-bg-b:transparent}.dark .el-color-picker,.dark .el-color-picker__panel{--el-color-picker-alpha-bg-a:#333333}.el-container{display:flex;flex-direction:row;flex:1;flex-basis:auto;box-sizing:border-box;min-width:0}.el-container.is-vertical{flex-direction:column}.el-date-table{font-size:12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-date-table.is-week-mode .el-date-table__row:hover .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table.is-week-mode .el-date-table__row:hover td.available:hover{color:var(--el-datepicker-text-color)}.el-date-table.is-week-mode .el-date-table__row:hover td:first-child .el-date-table-cell{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table.is-week-mode .el-date-table__row:hover td:last-child .el-date-table-cell{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table.is-week-mode .el-date-table__row.current .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table td{width:32px;height:30px;padding:4px 0;box-sizing:border-box;text-align:center;cursor:pointer;position:relative}.el-date-table td .el-date-table-cell{height:30px;padding:3px 0;box-sizing:border-box}.el-date-table td .el-date-table-cell .el-date-table-cell__text{width:24px;height:24px;display:block;margin:0 auto;line-height:24px;position:absolute;left:50%;transform:translate(-50%);border-radius:50%}.el-date-table td.next-month,.el-date-table td.prev-month{color:var(--el-datepicker-off-text-color)}.el-date-table td.today{position:relative}.el-date-table td.today .el-date-table-cell__text{color:var(--el-color-primary);font-weight:700}.el-date-table td.today.end-date .el-date-table-cell__text,.el-date-table td.today.start-date .el-date-table-cell__text{color:#fff}.el-date-table td.available:hover{color:var(--el-datepicker-hover-text-color)}.el-date-table td.in-range .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table td.in-range .el-date-table-cell:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-date-table td.current:not(.disabled) .el-date-table-cell__text{color:#fff;background-color:var(--el-datepicker-active-color)}.el-date-table td.current:not(.disabled):focus-visible .el-date-table-cell__text{outline:2px solid var(--el-datepicker-active-color);outline-offset:1px}.el-date-table td.end-date .el-date-table-cell,.el-date-table td.start-date .el-date-table-cell{color:#fff}.el-date-table td.end-date .el-date-table-cell__text,.el-date-table td.start-date .el-date-table-cell__text{background-color:var(--el-datepicker-active-color)}.el-date-table td.start-date .el-date-table-cell{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table td.end-date .el-date-table-cell{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table td.disabled .el-date-table-cell{background-color:var(--el-fill-color-light);opacity:1;cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-date-table td.selected .el-date-table-cell{margin-left:5px;margin-right:5px;background-color:var(--el-datepicker-inrange-bg-color);border-radius:15px}.el-date-table td.selected .el-date-table-cell:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-date-table td.selected .el-date-table-cell__text{background-color:var(--el-datepicker-active-color);color:#fff;border-radius:15px}.el-date-table td.week{font-size:80%;color:var(--el-datepicker-header-text-color)}.el-date-table td:focus{outline:0}.el-date-table th{padding:5px;color:var(--el-datepicker-header-text-color);font-weight:400;border-bottom:solid 1px var(--el-border-color-lighter)}.el-month-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-month-table td{text-align:center;padding:8px 0;cursor:pointer}.el-month-table td div{height:48px;padding:6px 0;box-sizing:border-box}.el-month-table td.today .cell{color:var(--el-color-primary);font-weight:700}.el-month-table td.today.end-date .cell,.el-month-table td.today.start-date .cell{color:#fff}.el-month-table td.disabled .cell{background-color:var(--el-fill-color-light);cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-month-table td.disabled .cell:hover{color:var(--el-text-color-placeholder)}.el-month-table td .cell{width:60px;height:36px;display:block;line-height:36px;color:var(--el-datepicker-text-color);margin:0 auto;border-radius:18px}.el-month-table td .cell:hover{color:var(--el-datepicker-hover-text-color)}.el-month-table td.in-range div{background-color:var(--el-datepicker-inrange-bg-color)}.el-month-table td.in-range div:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-month-table td.end-date div,.el-month-table td.start-date div{color:#fff}.el-month-table td.end-date .cell,.el-month-table td.start-date .cell{color:#fff;background-color:var(--el-datepicker-active-color)}.el-month-table td.start-date div{border-top-left-radius:24px;border-bottom-left-radius:24px}.el-month-table td.end-date div{border-top-right-radius:24px;border-bottom-right-radius:24px}.el-month-table td.current:not(.disabled) .cell{color:var(--el-datepicker-active-color)}.el-month-table td:focus-visible{outline:0}.el-month-table td:focus-visible .cell{outline:2px solid var(--el-datepicker-active-color)}.el-year-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-year-table .el-icon{color:var(--el-datepicker-icon-color)}.el-year-table td{text-align:center;padding:20px 3px;cursor:pointer}.el-year-table td.today .cell{color:var(--el-color-primary);font-weight:700}.el-year-table td.disabled .cell{background-color:var(--el-fill-color-light);cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-year-table td.disabled .cell:hover{color:var(--el-text-color-placeholder)}.el-year-table td .cell{width:48px;height:36px;display:block;line-height:36px;color:var(--el-datepicker-text-color);border-radius:18px;margin:0 auto}.el-year-table td .cell:hover{color:var(--el-datepicker-hover-text-color)}.el-year-table td.current:not(.disabled) .cell{color:var(--el-datepicker-active-color)}.el-year-table td:focus-visible{outline:0}.el-year-table td:focus-visible .cell{outline:2px solid var(--el-datepicker-active-color)}.el-time-spinner.has-seconds .el-time-spinner__wrapper{width:33.3%}.el-time-spinner__wrapper{max-height:192px;overflow:auto;display:inline-block;width:50%;vertical-align:top;position:relative}.el-time-spinner__wrapper.el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default){padding-bottom:15px}.el-time-spinner__wrapper.is-arrow{box-sizing:border-box;text-align:center;overflow:hidden}.el-time-spinner__wrapper.is-arrow .el-time-spinner__list{transform:translateY(-32px)}.el-time-spinner__wrapper.is-arrow .el-time-spinner__item:hover:not(.is-disabled):not(.is-active){background:var(--el-fill-color-light);cursor:default}.el-time-spinner__arrow{font-size:12px;color:var(--el-text-color-secondary);position:absolute;left:0;width:100%;z-index:var(--el-index-normal);text-align:center;height:30px;line-height:30px;cursor:pointer}.el-time-spinner__arrow:hover{color:var(--el-color-primary)}.el-time-spinner__arrow.arrow-up{top:10px}.el-time-spinner__arrow.arrow-down{bottom:10px}.el-time-spinner__input.el-input{width:70%}.el-time-spinner__input.el-input .el-input__inner{padding:0;text-align:center}.el-time-spinner__list{padding:0;margin:0;list-style:none;text-align:center}.el-time-spinner__list:after,.el-time-spinner__list:before{content:"";display:block;width:100%;height:80px}.el-time-spinner__item{height:32px;line-height:32px;font-size:12px;color:var(--el-text-color-regular)}.el-time-spinner__item:hover:not(.is-disabled):not(.is-active){background:var(--el-fill-color-light);cursor:pointer}.el-time-spinner__item.is-active:not(.is-disabled){color:var(--el-text-color-primary);font-weight:700}.el-time-spinner__item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-picker__popper{--el-datepicker-border-color:var(--el-disabled-border-color)}.el-picker__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-datepicker-border-color);box-shadow:var(--el-box-shadow-light)}.el-picker__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-datepicker-border-color)}.el-picker__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-date-editor{--el-date-editor-width:220px;--el-date-editor-monthrange-width:300px;--el-date-editor-daterange-width:350px;--el-date-editor-datetimerange-width:400px;--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary);position:relative;display:inline-block;text-align:left}.el-date-editor.el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset}.el-date-editor.el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-date-editor.el-input,.el-date-editor.el-input__wrapper{width:var(--el-date-editor-width);height:var(--el-input-height,var(--el-component-size))}.el-date-editor--monthrange{--el-date-editor-width:var(--el-date-editor-monthrange-width)}.el-date-editor--daterange,.el-date-editor--timerange{--el-date-editor-width:var(--el-date-editor-daterange-width)}.el-date-editor--datetimerange{--el-date-editor-width:var(--el-date-editor-datetimerange-width)}.el-date-editor--dates .el-input__wrapper{text-overflow:ellipsis;white-space:nowrap}.el-date-editor .close-icon,.el-date-editor .clear-icon{cursor:pointer}.el-date-editor .clear-icon:hover{color:var(--el-text-color-secondary)}.el-date-editor .el-range__icon{height:inherit;font-size:14px;color:var(--el-text-color-placeholder);float:left}.el-date-editor .el-range__icon svg{vertical-align:middle}.el-date-editor .el-range-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;outline:0;display:inline-block;height:30px;line-height:30px;margin:0;padding:0;width:39%;text-align:center;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);background-color:transparent}.el-date-editor .el-range-input::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-input:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-input::placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-separator{flex:1;display:inline-flex;justify-content:center;align-items:center;height:100%;padding:0 5px;margin:0;font-size:14px;word-break:keep-all;color:var(--el-text-color-primary)}.el-date-editor .el-range__close-icon{font-size:14px;color:var(--el-text-color-placeholder);height:inherit;width:unset;cursor:pointer}.el-date-editor .el-range__close-icon:hover{color:var(--el-text-color-secondary)}.el-date-editor .el-range__close-icon svg{vertical-align:middle}.el-date-editor .el-range__close-icon--hidden{opacity:0;visibility:hidden}.el-range-editor.el-input__wrapper{display:inline-flex;align-items:center;padding:0 10px}.el-range-editor.is-active,.el-range-editor.is-active:hover{box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-range-editor--large{line-height:var(--el-component-size-large)}.el-range-editor--large.el-input__wrapper{height:var(--el-component-size-large)}.el-range-editor--large .el-range-separator{line-height:40px;font-size:14px}.el-range-editor--large .el-range-input{height:38px;line-height:38px;font-size:14px}.el-range-editor--small{line-height:var(--el-component-size-small)}.el-range-editor--small.el-input__wrapper{height:var(--el-component-size-small)}.el-range-editor--small .el-range-separator{line-height:24px;font-size:12px}.el-range-editor--small .el-range-input{height:22px;line-height:22px;font-size:12px}.el-range-editor.is-disabled{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-range-editor.is-disabled:focus,.el-range-editor.is-disabled:hover{border-color:var(--el-disabled-border-color)}.el-range-editor.is-disabled input{background-color:var(--el-disabled-bg-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-range-editor.is-disabled input::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled input:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled input::placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled .el-range-separator{color:var(--el-disabled-text-color)}.el-picker-panel{color:var(--el-text-color-regular);background:var(--el-bg-color-overlay);border-radius:var(--el-border-radius-base);line-height:30px}.el-picker-panel .el-time-panel{margin:5px 0;border:solid 1px var(--el-datepicker-border-color);background-color:var(--el-bg-color-overlay);box-shadow:var(--el-box-shadow-light)}.el-picker-panel__body-wrapper:after,.el-picker-panel__body:after{content:"";display:table;clear:both}.el-picker-panel__content{position:relative;margin:15px}.el-picker-panel__footer{border-top:1px solid var(--el-datepicker-inner-border-color);padding:4px 12px;text-align:right;background-color:var(--el-bg-color-overlay);position:relative;font-size:0}.el-picker-panel__shortcut{display:block;width:100%;border:0;background-color:transparent;line-height:28px;font-size:14px;color:var(--el-datepicker-text-color);padding-left:12px;text-align:left;outline:0;cursor:pointer}.el-picker-panel__shortcut:hover{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__shortcut.active{background-color:#e6f1fe;color:var(--el-datepicker-active-color)}.el-picker-panel__btn{border:1px solid var(--el-fill-color-darker);color:var(--el-text-color-primary);line-height:24px;border-radius:2px;padding:0 20px;cursor:pointer;background-color:transparent;outline:0;font-size:12px}.el-picker-panel__btn[disabled]{color:var(--el-text-color-disabled);cursor:not-allowed}.el-picker-panel__icon-btn{font-size:12px;color:var(--el-datepicker-icon-color);border:0;background:0 0;cursor:pointer;outline:0;margin-top:8px}.el-picker-panel__icon-btn:hover{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__icon-btn:focus-visible{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__icon-btn.is-disabled{color:var(--el-text-color-disabled)}.el-picker-panel__icon-btn.is-disabled:hover{cursor:not-allowed}.el-picker-panel__icon-btn .el-icon{cursor:pointer;font-size:inherit}.el-picker-panel__link-btn{vertical-align:middle}.el-picker-panel [slot=sidebar],.el-picker-panel__sidebar{position:absolute;top:0;bottom:0;width:110px;border-right:1px solid var(--el-datepicker-inner-border-color);box-sizing:border-box;padding-top:6px;background-color:var(--el-bg-color-overlay);overflow:auto}.el-picker-panel [slot=sidebar]+.el-picker-panel__body,.el-picker-panel__sidebar+.el-picker-panel__body{margin-left:110px}.el-date-picker{--el-datepicker-text-color:var(--el-text-color-regular);--el-datepicker-off-text-color:var(--el-text-color-placeholder);--el-datepicker-header-text-color:var(--el-text-color-regular);--el-datepicker-icon-color:var(--el-text-color-primary);--el-datepicker-border-color:var(--el-disabled-border-color);--el-datepicker-inner-border-color:var(--el-border-color-light);--el-datepicker-inrange-bg-color:var(--el-border-color-extra-light);--el-datepicker-inrange-hover-bg-color:var(--el-border-color-extra-light);--el-datepicker-active-color:var(--el-color-primary);--el-datepicker-hover-text-color:var(--el-color-primary)}.el-date-picker{width:322px}.el-date-picker.has-sidebar.has-time{width:434px}.el-date-picker.has-sidebar{width:438px}.el-date-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-picker .el-picker-panel__content{width:292px}.el-date-picker table{table-layout:fixed;width:100%}.el-date-picker__editor-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-picker__time-header{position:relative;border-bottom:1px solid var(--el-datepicker-inner-border-color);font-size:12px;padding:8px 5px 5px;display:table;width:100%;box-sizing:border-box}.el-date-picker__header{margin:12px;text-align:center}.el-date-picker__header--bordered{margin-bottom:0;padding-bottom:12px;border-bottom:solid 1px var(--el-border-color-lighter)}.el-date-picker__header--bordered+.el-picker-panel__content{margin-top:0}.el-date-picker__header-label{font-size:16px;font-weight:500;padding:0 5px;line-height:22px;text-align:center;cursor:pointer;color:var(--el-text-color-regular)}.el-date-picker__header-label:hover{color:var(--el-datepicker-hover-text-color)}.el-date-picker__header-label:focus-visible{outline:0;color:var(--el-datepicker-hover-text-color)}.el-date-picker__header-label.active{color:var(--el-datepicker-active-color)}.el-date-picker__prev-btn{float:left}.el-date-picker__next-btn{float:right}.el-date-picker__time-wrap{padding:10px;text-align:center}.el-date-picker__time-label{float:left;cursor:pointer;line-height:30px;margin-left:10px}.el-date-picker .el-time-panel{position:absolute}.el-date-range-picker{--el-datepicker-text-color:var(--el-text-color-regular);--el-datepicker-off-text-color:var(--el-text-color-placeholder);--el-datepicker-header-text-color:var(--el-text-color-regular);--el-datepicker-icon-color:var(--el-text-color-primary);--el-datepicker-border-color:var(--el-disabled-border-color);--el-datepicker-inner-border-color:var(--el-border-color-light);--el-datepicker-inrange-bg-color:var(--el-border-color-extra-light);--el-datepicker-inrange-hover-bg-color:var(--el-border-color-extra-light);--el-datepicker-active-color:var(--el-color-primary);--el-datepicker-hover-text-color:var(--el-color-primary)}.el-date-range-picker{width:646px}.el-date-range-picker.has-sidebar{width:756px}.el-date-range-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-range-picker table{table-layout:fixed;width:100%}.el-date-range-picker .el-picker-panel__body{min-width:513px}.el-date-range-picker .el-picker-panel__content{margin:0}.el-date-range-picker__header{position:relative;text-align:center;height:28px}.el-date-range-picker__header [class*=arrow-left]{float:left}.el-date-range-picker__header [class*=arrow-right]{float:right}.el-date-range-picker__header div{font-size:16px;font-weight:500;margin-right:50px}.el-date-range-picker__content{float:left;width:50%;box-sizing:border-box;margin:0;padding:16px}.el-date-range-picker__content.is-left{border-right:1px solid var(--el-datepicker-inner-border-color)}.el-date-range-picker__content .el-date-range-picker__header div{margin-left:50px;margin-right:50px}.el-date-range-picker__editors-wrap{box-sizing:border-box;display:table-cell}.el-date-range-picker__editors-wrap.is-right{text-align:right}.el-date-range-picker__time-header{position:relative;border-bottom:1px solid var(--el-datepicker-inner-border-color);font-size:12px;padding:8px 5px 5px;display:table;width:100%;box-sizing:border-box}.el-date-range-picker__time-header>.el-icon-arrow-right{font-size:20px;vertical-align:middle;display:table-cell;color:var(--el-datepicker-icon-color)}.el-date-range-picker__time-picker-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-range-picker__time-picker-wrap .el-picker-panel{position:absolute;top:13px;right:0;z-index:1;background:#fff}.el-date-range-picker__time-picker-wrap .el-time-panel{position:absolute}.el-time-range-picker{width:354px;overflow:visible}.el-time-range-picker__content{position:relative;text-align:center;padding:10px;z-index:1}.el-time-range-picker__cell{box-sizing:border-box;margin:0;padding:4px 7px 7px;width:50%;display:inline-block}.el-time-range-picker__header{margin-bottom:5px;text-align:center;font-size:14px}.el-time-range-picker__body{border-radius:2px;border:1px solid var(--el-datepicker-border-color)}.el-time-panel{border-radius:2px;position:relative;width:180px;left:0;z-index:var(--el-index-top);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:content-box}.el-time-panel__content{font-size:0;position:relative;overflow:hidden}.el-time-panel__content:after,.el-time-panel__content:before{content:"";top:50%;position:absolute;margin-top:-16px;height:32px;z-index:-1;left:0;right:0;box-sizing:border-box;padding-top:6px;text-align:left}.el-time-panel__content:after{left:50%;margin-left:12%;margin-right:12%}.el-time-panel__content:before{padding-left:50%;margin-right:12%;margin-left:12%;border-top:1px solid var(--el-border-color-light);border-bottom:1px solid var(--el-border-color-light)}.el-time-panel__content.has-seconds:after{left:66.6666666667%}.el-time-panel__content.has-seconds:before{padding-left:33.3333333333%}.el-time-panel__footer{border-top:1px solid var(--el-timepicker-inner-border-color,var(--el-border-color-light));padding:4px;height:36px;line-height:25px;text-align:right;box-sizing:border-box}.el-time-panel__btn{border:none;line-height:28px;padding:0 5px;margin:0 5px;cursor:pointer;background-color:transparent;outline:0;font-size:12px;color:var(--el-text-color-primary)}.el-time-panel__btn.confirm{font-weight:800;color:var(--el-timepicker-active-color,var(--el-color-primary))}.el-descriptions{--el-descriptions-table-border:1px solid var(--el-border-color-lighter);--el-descriptions-item-bordered-label-background:var(--el-fill-color-light);box-sizing:border-box;font-size:var(--el-font-size-base);color:var(--el-text-color-primary)}.el-descriptions__header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.el-descriptions__title{color:var(--el-text-color-primary);font-size:16px;font-weight:700}.el-descriptions__body{background-color:var(--el-fill-color-blank)}.el-descriptions__body .el-descriptions__table{border-collapse:collapse;width:100%}.el-descriptions__body .el-descriptions__table .el-descriptions__cell{box-sizing:border-box;text-align:left;font-weight:400;line-height:23px;font-size:14px}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-left{text-align:left}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-center{text-align:center}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-right{text-align:right}.el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{border:var(--el-descriptions-table-border);padding:8px 11px}.el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:12px}.el-descriptions--large{font-size:14px}.el-descriptions--large .el-descriptions__header{margin-bottom:20px}.el-descriptions--large .el-descriptions__header .el-descriptions__title{font-size:16px}.el-descriptions--large .el-descriptions__body .el-descriptions__table .el-descriptions__cell{font-size:14px}.el-descriptions--large .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{padding:12px 15px}.el-descriptions--large .el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:16px}.el-descriptions--small{font-size:12px}.el-descriptions--small .el-descriptions__header{margin-bottom:12px}.el-descriptions--small .el-descriptions__header .el-descriptions__title{font-size:14px}.el-descriptions--small .el-descriptions__body .el-descriptions__table .el-descriptions__cell{font-size:12px}.el-descriptions--small .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{padding:4px 7px}.el-descriptions--small .el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:8px}.el-descriptions__label.el-descriptions__cell.is-bordered-label{font-weight:700;color:var(--el-text-color-regular);background:var(--el-descriptions-item-bordered-label-background)}.el-descriptions__label:not(.is-bordered-label){color:var(--el-text-color-primary);margin-right:16px}.el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:6px}.el-descriptions__content.el-descriptions__cell.is-bordered-content{color:var(--el-text-color-primary)}.el-descriptions__content:not(.is-bordered-label){color:var(--el-text-color-regular)}.el-descriptions--large .el-descriptions__label:not(.is-bordered-label){margin-right:16px}.el-descriptions--large .el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:8px}.el-descriptions--small .el-descriptions__label:not(.is-bordered-label){margin-right:12px}.el-descriptions--small .el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:4px}:root{--el-popup-modal-bg-color:var(--el-color-black);--el-popup-modal-opacity:.5}.v-modal-enter{-webkit-animation:v-modal-in var(--el-transition-duration-fast) ease;animation:v-modal-in var(--el-transition-duration-fast) ease}.v-modal-leave{-webkit-animation:v-modal-out var(--el-transition-duration-fast) ease forwards;animation:v-modal-out var(--el-transition-duration-fast) ease forwards}@-webkit-keyframes v-modal-in{0%{opacity:0}}@keyframes v-modal-in{0%{opacity:0}}@-webkit-keyframes v-modal-out{to{opacity:0}}@keyframes v-modal-out{to{opacity:0}}.v-modal{position:fixed;left:0;top:0;width:100%;height:100%;opacity:var(--el-popup-modal-opacity);background:var(--el-popup-modal-bg-color)}.el-popup-parent--hidden{overflow:hidden}.el-dialog{--el-dialog-width:50%;--el-dialog-margin-top:15vh;--el-dialog-bg-color:var(--el-bg-color);--el-dialog-box-shadow:var(--el-box-shadow);--el-dialog-title-font-size:var(--el-font-size-large);--el-dialog-content-font-size:14px;--el-dialog-font-line-height:var(--el-font-line-height-primary);--el-dialog-padding-primary:20px;--el-dialog-border-radius:var(--el-border-radius-small);position:relative;margin:var(--el-dialog-margin-top,15vh) auto 50px;background:var(--el-dialog-bg-color);border-radius:var(--el-dialog-border-radius);box-shadow:var(--el-dialog-box-shadow);box-sizing:border-box;width:var(--el-dialog-width,50%)}.el-dialog:focus{outline:0!important}.el-dialog.is-align-center{margin:auto}.el-dialog.is-fullscreen{--el-dialog-width:100%;--el-dialog-margin-top:0;margin-bottom:0;height:100%;overflow:auto}.el-dialog__wrapper{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto;margin:0}.el-dialog.is-draggable .el-dialog__header{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-dialog__header{padding:var(--el-dialog-padding-primary);padding-bottom:10px;margin-right:16px}.el-dialog__headerbtn{position:absolute;top:6px;right:0;padding:0;width:54px;height:54px;background:0 0;border:none;outline:0;cursor:pointer;font-size:var(--el-message-close-size,16px)}.el-dialog__headerbtn .el-dialog__close{color:var(--el-color-info);font-size:inherit}.el-dialog__headerbtn:focus .el-dialog__close,.el-dialog__headerbtn:hover .el-dialog__close{color:var(--el-color-primary)}.el-dialog__title{line-height:var(--el-dialog-font-line-height);font-size:var(--el-dialog-title-font-size);color:var(--el-text-color-primary)}.el-dialog__body{padding:calc(var(--el-dialog-padding-primary) + 10px) var(--el-dialog-padding-primary);color:var(--el-text-color-regular);font-size:var(--el-dialog-content-font-size)}.el-dialog__footer{padding:var(--el-dialog-padding-primary);padding-top:10px;text-align:right;box-sizing:border-box}.el-dialog--center{text-align:center}.el-dialog--center .el-dialog__body{text-align:initial;padding:25px calc(var(--el-dialog-padding-primary) + 5px) 30px}.el-dialog--center .el-dialog__footer{text-align:inherit}.el-overlay-dialog{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto}.dialog-fade-enter-active{-webkit-animation:modal-fade-in var(--el-transition-duration);animation:modal-fade-in var(--el-transition-duration)}.dialog-fade-enter-active .el-overlay-dialog{-webkit-animation:dialog-fade-in var(--el-transition-duration);animation:dialog-fade-in var(--el-transition-duration)}.dialog-fade-leave-active{-webkit-animation:modal-fade-out var(--el-transition-duration);animation:modal-fade-out var(--el-transition-duration)}.dialog-fade-leave-active .el-overlay-dialog{-webkit-animation:dialog-fade-out var(--el-transition-duration);animation:dialog-fade-out var(--el-transition-duration)}@-webkit-keyframes dialog-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes dialog-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes dialog-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes dialog-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@-webkit-keyframes modal-fade-in{0%{opacity:0}to{opacity:1}}@keyframes modal-fade-in{0%{opacity:0}to{opacity:1}}@-webkit-keyframes modal-fade-out{0%{opacity:1}to{opacity:0}}@keyframes modal-fade-out{0%{opacity:1}to{opacity:0}}.el-divider{position:relative}.el-divider--horizontal{display:block;height:1px;width:100%;margin:24px 0;border-top:1px var(--el-border-color) var(--el-border-style)}.el-divider--vertical{display:inline-block;width:1px;height:1em;margin:0 8px;vertical-align:middle;position:relative;border-left:1px var(--el-border-color) var(--el-border-style)}.el-divider__text{position:absolute;background-color:var(--el-bg-color);padding:0 20px;font-weight:500;color:var(--el-text-color-primary);font-size:14px}.el-divider__text.is-left{left:20px;transform:translateY(-50%)}.el-divider__text.is-center{left:50%;transform:translate(-50%) translateY(-50%)}.el-divider__text.is-right{right:20px;transform:translateY(-50%)}.el-drawer{--el-drawer-bg-color:var(--el-dialog-bg-color, var(--el-bg-color));--el-drawer-padding-primary:var(--el-dialog-padding-primary, 20px)}.el-drawer{position:absolute;box-sizing:border-box;background-color:var(--el-drawer-bg-color);display:flex;flex-direction:column;box-shadow:var(--el-box-shadow-dark);overflow:hidden;transition:all var(--el-transition-duration)}.el-drawer .rtl,.el-drawer .ltr,.el-drawer .ttb,.el-drawer .btt{transform:translate(0)}.el-drawer__sr-focus:focus{outline:0!important}.el-drawer__header{align-items:center;color:#72767b;display:flex;margin-bottom:32px;padding:var(--el-drawer-padding-primary);padding-bottom:0}.el-drawer__header>:first-child{flex:1}.el-drawer__title{margin:0;flex:1;line-height:inherit;font-size:1rem}.el-drawer__footer{padding:var(--el-drawer-padding-primary);padding-top:10px;text-align:right}.el-drawer__close-btn{display:inline-flex;border:none;cursor:pointer;font-size:var(--el-font-size-extra-large);color:inherit;background-color:transparent;outline:0}.el-drawer__close-btn:focus i,.el-drawer__close-btn:hover i{color:var(--el-color-primary)}.el-drawer__body{flex:1;padding:var(--el-drawer-padding-primary);overflow:auto}.el-drawer__body>*{box-sizing:border-box}.el-drawer.ltr,.el-drawer.rtl{height:100%;top:0;bottom:0}.el-drawer.btt,.el-drawer.ttb{width:100%;left:0;right:0}.el-drawer.ltr{left:0}.el-drawer.rtl{right:0}.el-drawer.ttb{top:0}.el-drawer.btt{bottom:0}.el-drawer-fade-enter-active,.el-drawer-fade-leave-active{transition:all var(--el-transition-duration)}.el-drawer-fade-enter-active,.el-drawer-fade-enter-from,.el-drawer-fade-enter-to,.el-drawer-fade-leave-active,.el-drawer-fade-leave-from,.el-drawer-fade-leave-to{overflow:hidden!important}.el-drawer-fade-enter-from,.el-drawer-fade-leave-to{opacity:0}.el-drawer-fade-enter-to,.el-drawer-fade-leave-from{opacity:1}.el-drawer-fade-enter-from .rtl,.el-drawer-fade-leave-to .rtl{transform:translate(100%)}.el-drawer-fade-enter-from .ltr,.el-drawer-fade-leave-to .ltr{transform:translate(-100%)}.el-drawer-fade-enter-from .ttb,.el-drawer-fade-leave-to .ttb{transform:translateY(-100%)}.el-drawer-fade-enter-from .btt,.el-drawer-fade-leave-to .btt{transform:translateY(100%)}.el-dropdown{--el-dropdown-menu-box-shadow:var(--el-box-shadow-light);--el-dropdown-menuItem-hover-fill:var(--el-color-primary-light-9);--el-dropdown-menuItem-hover-color:var(--el-color-primary);--el-dropdown-menu-index:10;display:inline-flex;position:relative;color:var(--el-text-color-regular);font-size:var(--el-font-size-base);line-height:1;vertical-align:top}.el-dropdown.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-dropdown__popper{--el-dropdown-menu-box-shadow:var(--el-box-shadow-light);--el-dropdown-menuItem-hover-fill:var(--el-color-primary-light-9);--el-dropdown-menuItem-hover-color:var(--el-color-primary);--el-dropdown-menu-index:10}.el-dropdown__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-dropdown-menu-box-shadow)}.el-dropdown__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-dropdown__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-dropdown__popper .el-dropdown-menu{border:none}.el-dropdown__popper .el-dropdown__popper-selfdefine{outline:0}.el-dropdown__popper .el-scrollbar__bar{z-index:calc(var(--el-dropdown-menu-index) + 1)}.el-dropdown__popper .el-dropdown__list{list-style:none;padding:0;margin:0;box-sizing:border-box}.el-dropdown .el-dropdown__caret-button{padding-left:0;padding-right:0;display:inline-flex;justify-content:center;align-items:center;width:32px;border-left:none}.el-dropdown .el-dropdown__caret-button>span{display:inline-flex}.el-dropdown .el-dropdown__caret-button:before{content:"";position:absolute;display:block;width:1px;top:-1px;bottom:-1px;left:0;background:var(--el-overlay-color-lighter)}.el-dropdown .el-dropdown__caret-button.el-button:before{background:var(--el-border-color);opacity:.5}.el-dropdown .el-dropdown__caret-button .el-dropdown__icon{font-size:inherit;padding-left:0}.el-dropdown .el-dropdown-selfdefine{outline:0}.el-dropdown--large .el-dropdown__caret-button{width:40px}.el-dropdown--small .el-dropdown__caret-button{width:24px}.el-dropdown-menu{position:relative;top:0;left:0;z-index:var(--el-dropdown-menu-index);padding:5px 0;margin:0;background-color:var(--el-bg-color-overlay);border:none;border-radius:var(--el-border-radius-base);box-shadow:none;list-style:none}.el-dropdown-menu__item{display:flex;align-items:center;white-space:nowrap;list-style:none;line-height:22px;padding:5px 16px;margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);cursor:pointer;outline:0}.el-dropdown-menu__item:not(.is-disabled):focus{background-color:var(--el-dropdown-menuItem-hover-fill);color:var(--el-dropdown-menuItem-hover-color)}.el-dropdown-menu__item i{margin-right:5px}.el-dropdown-menu__item--divided{margin:6px 0;border-top:1px solid var(--el-border-color-lighter)}.el-dropdown-menu__item.is-disabled{cursor:not-allowed;color:var(--el-text-color-disabled)}.el-dropdown-menu--large{padding:7px 0}.el-dropdown-menu--large .el-dropdown-menu__item{padding:7px 20px;line-height:22px;font-size:14px}.el-dropdown-menu--large .el-dropdown-menu__item--divided{margin:8px 0}.el-dropdown-menu--small{padding:3px 0}.el-dropdown-menu--small .el-dropdown-menu__item{padding:2px 12px;line-height:20px;font-size:12px}.el-dropdown-menu--small .el-dropdown-menu__item--divided{margin:4px 0}.el-empty{--el-empty-padding:40px 0;--el-empty-image-width:160px;--el-empty-description-margin-top:20px;--el-empty-bottom-margin-top:20px;--el-empty-fill-color-0:var(--el-color-white);--el-empty-fill-color-1:#fcfcfd;--el-empty-fill-color-2:#f8f9fb;--el-empty-fill-color-3:#f7f8fc;--el-empty-fill-color-4:#eeeff3;--el-empty-fill-color-5:#edeef2;--el-empty-fill-color-6:#e9ebef;--el-empty-fill-color-7:#e5e7e9;--el-empty-fill-color-8:#e0e3e9;--el-empty-fill-color-9:#d5d7de;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:var(--el-empty-padding)}.el-empty__image{width:var(--el-empty-image-width)}.el-empty__image img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;height:100%;vertical-align:top;-o-object-fit:contain;object-fit:contain}.el-empty__image svg{color:var(--el-svg-monochrome-grey);fill:currentColor;width:100%;height:100%;vertical-align:top}.el-empty__description{margin-top:var(--el-empty-description-margin-top)}.el-empty__description p{margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-secondary)}.el-empty__bottom{margin-top:var(--el-empty-bottom-margin-top)}.el-footer{--el-footer-padding:0 20px;--el-footer-height:60px;padding:var(--el-footer-padding);box-sizing:border-box;flex-shrink:0;height:var(--el-footer-height)}.el-form{--el-form-label-font-size:var(--el-font-size-base)}.el-form--label-left .el-form-item__label{justify-content:flex-start}.el-form--label-top .el-form-item{display:block}.el-form--label-top .el-form-item .el-form-item__label{display:block;height:auto;text-align:left;margin-bottom:8px;line-height:22px}.el-form--inline .el-form-item{display:inline-flex;vertical-align:middle;margin-right:32px}.el-form--inline.el-form--label-top{display:flex;flex-wrap:wrap}.el-form--inline.el-form--label-top .el-form-item{display:block}.el-form--large.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:12px;line-height:22px}.el-form--default.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:8px;line-height:22px}.el-form--small.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:4px;line-height:20px}.el-form-item{display:flex;--font-size:14px;margin-bottom:18px}.el-form-item .el-form-item{margin-bottom:0}.el-form-item .el-input__validateIcon{display:none}.el-form-item--large{--font-size:14px;--el-form-label-font-size:var(--font-size);margin-bottom:22px}.el-form-item--large .el-form-item__label{height:40px;line-height:40px}.el-form-item--large .el-form-item__content{line-height:40px}.el-form-item--large .el-form-item__error{padding-top:4px}.el-form-item--default{--font-size:14px;--el-form-label-font-size:var(--font-size);margin-bottom:18px}.el-form-item--default .el-form-item__label{height:32px;line-height:32px}.el-form-item--default .el-form-item__content{line-height:32px}.el-form-item--default .el-form-item__error{padding-top:2px}.el-form-item--small{--font-size:12px;--el-form-label-font-size:var(--font-size);margin-bottom:18px}.el-form-item--small .el-form-item__label{height:24px;line-height:24px}.el-form-item--small .el-form-item__content{line-height:24px}.el-form-item--small .el-form-item__error{padding-top:2px}.el-form-item__label-wrap{display:flex}.el-form-item__label{display:inline-flex;justify-content:flex-end;align-items:flex-start;flex:0 0 auto;font-size:var(--el-form-label-font-size);color:var(--el-text-color-regular);height:32px;line-height:32px;padding:0 12px 0 0;box-sizing:border-box}.el-form-item__content{display:flex;flex-wrap:wrap;align-items:center;flex:1;line-height:32px;position:relative;font-size:var(--font-size);min-width:0}.el-form-item__content .el-input-group{vertical-align:top}.el-form-item__error{color:var(--el-color-danger);font-size:12px;line-height:1;padding-top:2px;position:absolute;top:100%;left:0}.el-form-item__error--inline{position:relative;top:auto;left:auto;display:inline-block;margin-left:10px}.el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label-wrap>.el-form-item__label:before,.el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label:before{content:"*";color:var(--el-color-danger);margin-right:4px}.el-form-item.is-required:not(.is-no-asterisk).asterisk-right>.el-form-item__label-wrap>.el-form-item__label:after,.el-form-item.is-required:not(.is-no-asterisk).asterisk-right>.el-form-item__label:after{content:"*";color:var(--el-color-danger);margin-left:4px}.el-form-item.is-error .el-select-v2__wrapper,.el-form-item.is-error .el-select-v2__wrapper:focus,.el-form-item.is-error .el-textarea__inner,.el-form-item.is-error .el-textarea__inner:focus{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-form-item.is-error .el-input__wrapper{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-form-item.is-error .el-input-group__append .el-input__wrapper,.el-form-item.is-error .el-input-group__prepend .el-input__wrapper{box-shadow:0 0 0 1px transparent inset}.el-form-item.is-error .el-input__validateIcon{color:var(--el-color-danger)}.el-form-item--feedback .el-input__validateIcon{display:inline-flex}.el-header{--el-header-padding:0 20px;--el-header-height:60px;padding:var(--el-header-padding);box-sizing:border-box;flex-shrink:0;height:var(--el-header-height)}.el-image-viewer__wrapper{position:fixed;top:0;right:0;bottom:0;left:0}.el-image-viewer__btn{position:absolute;z-index:1;display:flex;align-items:center;justify-content:center;border-radius:50%;opacity:.8;cursor:pointer;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__btn .el-icon{font-size:inherit;cursor:pointer}.el-image-viewer__close{top:40px;right:40px;width:40px;height:40px;font-size:40px}.el-image-viewer__canvas{position:static;width:100%;height:100%;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__actions{left:50%;bottom:30px;transform:translate(-50%);width:282px;height:44px;padding:0 23px;background-color:var(--el-text-color-regular);border-color:#fff;border-radius:22px}.el-image-viewer__actions__inner{width:100%;height:100%;text-align:justify;cursor:default;font-size:23px;color:#fff;display:flex;align-items:center;justify-content:space-around}.el-image-viewer__prev{top:50%;transform:translateY(-50%);left:40px;width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__next{top:50%;transform:translateY(-50%);right:40px;text-indent:2px;width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__close{width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__mask{position:absolute;width:100%;height:100%;top:0;left:0;opacity:.5;background:#000}.viewer-fade-enter-active{-webkit-animation:viewer-fade-in var(--el-transition-duration);animation:viewer-fade-in var(--el-transition-duration)}.viewer-fade-leave-active{-webkit-animation:viewer-fade-out var(--el-transition-duration);animation:viewer-fade-out var(--el-transition-duration)}@-webkit-keyframes viewer-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes viewer-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes viewer-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes viewer-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}.el-image__error,.el-image__inner,.el-image__placeholder,.el-image__wrapper{width:100%;height:100%}.el-image{position:relative;display:inline-block;overflow:hidden}.el-image__inner{vertical-align:top;opacity:1}.el-image__inner.is-loading{opacity:0}.el-image__wrapper{position:absolute;top:0;left:0}.el-image__placeholder{background:var(--el-fill-color-light)}.el-image__error{display:flex;justify-content:center;align-items:center;font-size:14px;background:var(--el-fill-color-light);color:var(--el-text-color-placeholder);vertical-align:middle}.el-image__preview{cursor:pointer}.el-input-number{position:relative;display:inline-flex;width:150px;line-height:30px}.el-input-number .el-input__wrapper{padding-left:42px;padding-right:42px}.el-input-number .el-input__inner{-webkit-appearance:none;-moz-appearance:textfield;text-align:center;line-height:1}.el-input-number .el-input__inner::-webkit-inner-spin-button,.el-input-number .el-input__inner::-webkit-outer-spin-button{margin:0;-webkit-appearance:none}.el-input-number__decrease,.el-input-number__increase{display:flex;justify-content:center;align-items:center;height:auto;position:absolute;z-index:1;top:1px;bottom:1px;width:32px;background:var(--el-fill-color-light);color:var(--el-text-color-regular);cursor:pointer;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-input-number__decrease:hover,.el-input-number__increase:hover{color:var(--el-color-primary)}.el-input-number__decrease:hover~.el-input:not(.is-disabled) .el-input_wrapper,.el-input-number__increase:hover~.el-input:not(.is-disabled) .el-input_wrapper{box-shadow:0 0 0 1px var(--el-input-focus-border-color,var(--el-color-primary)) inset}.el-input-number__decrease.is-disabled,.el-input-number__increase.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-input-number__increase{right:1px;border-radius:0 var(--el-border-radius-base) var(--el-border-radius-base) 0;border-left:var(--el-border)}.el-input-number__decrease{left:1px;border-radius:var(--el-border-radius-base) 0 0 var(--el-border-radius-base);border-right:var(--el-border)}.el-input-number.is-disabled .el-input-number__decrease,.el-input-number.is-disabled .el-input-number__increase{border-color:var(--el-disabled-border-color);color:var(--el-disabled-border-color)}.el-input-number.is-disabled .el-input-number__decrease:hover,.el-input-number.is-disabled .el-input-number__increase:hover{color:var(--el-disabled-border-color);cursor:not-allowed}.el-input-number--large{width:180px;line-height:38px}.el-input-number--large .el-input-number__decrease,.el-input-number--large .el-input-number__increase{width:40px;font-size:14px}.el-input-number--large .el-input__wrapper{padding-left:47px;padding-right:47px}.el-input-number--small{width:120px;line-height:22px}.el-input-number--small .el-input-number__decrease,.el-input-number--small .el-input-number__increase{width:24px;font-size:12px}.el-input-number--small .el-input__wrapper{padding-left:31px;padding-right:31px}.el-input-number--small .el-input-number__decrease [class*=el-icon],.el-input-number--small .el-input-number__increase [class*=el-icon]{transform:scale(.9)}.el-input-number.is-without-controls .el-input__wrapper{padding-left:15px;padding-right:15px}.el-input-number.is-controls-right .el-input__wrapper{padding-left:15px;padding-right:42px}.el-input-number.is-controls-right .el-input-number__decrease,.el-input-number.is-controls-right .el-input-number__increase{--el-input-number-controls-height:15px;height:var(--el-input-number-controls-height);line-height:var(--el-input-number-controls-height)}.el-input-number.is-controls-right .el-input-number__decrease [class*=el-icon],.el-input-number.is-controls-right .el-input-number__increase [class*=el-icon]{transform:scale(.8)}.el-input-number.is-controls-right .el-input-number__increase{bottom:auto;left:auto;border-radius:0 var(--el-border-radius-base) 0 0;border-bottom:var(--el-border)}.el-input-number.is-controls-right .el-input-number__decrease{right:1px;top:auto;left:auto;border-right:none;border-left:var(--el-border);border-radius:0 0 var(--el-border-radius-base) 0}.el-input-number.is-controls-right[class*=large] [class*=decrease],.el-input-number.is-controls-right[class*=large] [class*=increase]{--el-input-number-controls-height:19px}.el-input-number.is-controls-right[class*=small] [class*=decrease],.el-input-number.is-controls-right[class*=small] [class*=increase]{--el-input-number-controls-height:11px}.el-textarea{--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary)}.el-textarea{position:relative;display:inline-block;width:100%;vertical-align:bottom;font-size:var(--el-font-size-base)}.el-textarea__inner{position:relative;display:block;resize:vertical;padding:5px 11px;line-height:1.5;box-sizing:border-box;width:100%;font-size:inherit;font-family:inherit;color:var(--el-input-text-color,var(--el-text-color-regular));background-color:var(--el-input-bg-color,var(--el-fill-color-blank));background-image:none;-webkit-appearance:none;box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset;border-radius:var(--el-input-border-radius,var(--el-border-radius-base));transition:var(--el-transition-box-shadow);border:none}.el-textarea__inner::-moz-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner:-ms-input-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner::placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-textarea__inner:focus{outline:0;box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-textarea .el-input__count{color:var(--el-color-info);background:var(--el-fill-color-blank);position:absolute;font-size:12px;line-height:14px;bottom:5px;right:10px}.el-textarea.is-disabled .el-textarea__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-textarea.is-disabled .el-textarea__inner::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-disabled .el-textarea__inner:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-disabled .el-textarea__inner::placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-exceed .el-textarea__inner{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-textarea.is-exceed .el-input__count{color:var(--el-color-danger)}.el-input{--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary)}.el-input{--el-input-height:var(--el-component-size);position:relative;font-size:var(--el-font-size-base);display:inline-flex;width:100%;line-height:var(--el-input-height);box-sizing:border-box;vertical-align:middle}.el-input::-webkit-scrollbar{z-index:11;width:6px}.el-input::-webkit-scrollbar:horizontal{height:6px}.el-input::-webkit-scrollbar-thumb{border-radius:5px;width:6px;background:var(--el-text-color-disabled)}.el-input::-webkit-scrollbar-corner{background:var(--el-fill-color-blank)}.el-input::-webkit-scrollbar-track{background:var(--el-fill-color-blank)}.el-input::-webkit-scrollbar-track-piece{background:var(--el-fill-color-blank);width:6px}.el-input .el-input__clear,.el-input .el-input__password{color:var(--el-input-icon-color);font-size:14px;cursor:pointer}.el-input .el-input__clear:hover,.el-input .el-input__password:hover{color:var(--el-input-clear-hover-color)}.el-input .el-input__count{height:100%;display:inline-flex;align-items:center;color:var(--el-color-info);font-size:12px}.el-input .el-input__count .el-input__count-inner{background:var(--el-fill-color-blank);line-height:initial;display:inline-block;padding-left:8px}.el-input__wrapper{display:inline-flex;flex-grow:1;align-items:center;justify-content:center;padding:1px 11px;background-color:var(--el-input-bg-color,var(--el-fill-color-blank));background-image:none;border-radius:var(--el-input-border-radius,var(--el-border-radius-base));transition:var(--el-transition-box-shadow);transform:translateZ(0);box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset}.el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 32px) - 2px);width:100%;flex-grow:1;-webkit-appearance:none;color:var(--el-input-text-color,var(--el-text-color-regular));font-size:inherit;height:var(--el-input-inner-height);line-height:var(--el-input-inner-height);padding:0;outline:0;border:none;background:0 0;box-sizing:border-box}.el-input__inner:focus{outline:0}.el-input__inner::-moz-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner:-ms-input-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner::placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner[type=password]::-ms-reveal{display:none}.el-input__prefix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--el-input-icon-color,var(--el-text-color-placeholder));transition:all var(--el-transition-duration);pointer-events:none}.el-input__prefix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}.el-input__prefix-inner>:last-child{margin-right:8px}.el-input__prefix-inner>:first-child,.el-input__prefix-inner>:first-child.el-input__icon{margin-left:0}.el-input__suffix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--el-input-icon-color,var(--el-text-color-placeholder));transition:all var(--el-transition-duration);pointer-events:none}.el-input__suffix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}.el-input__suffix-inner>:first-child{margin-left:8px}.el-input .el-input__icon{height:inherit;line-height:inherit;display:flex;justify-content:center;align-items:center;transition:all var(--el-transition-duration);margin-left:8px}.el-input__validateIcon{pointer-events:none}.el-input.is-active .el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-focus-color,) inset}.el-input.is-disabled{cursor:not-allowed}.el-input.is-disabled .el-input__wrapper{background-color:var(--el-disabled-bg-color);box-shadow:0 0 0 1px var(--el-disabled-border-color) inset}.el-input.is-disabled .el-input__inner{color:var(--el-disabled-text-color);-webkit-text-fill-color:var(--el-disabled-text-color);cursor:not-allowed}.el-input.is-disabled .el-input__inner::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__inner:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__inner::placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__icon{cursor:not-allowed}.el-input.is-exceed .el-input__wrapper{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-input.is-exceed .el-input__suffix .el-input__count{color:var(--el-color-danger)}.el-input--large{--el-input-height:var(--el-component-size-large);font-size:14px}.el-input--large .el-input__wrapper{padding:1px 15px}.el-input--large .el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 40px) - 2px)}.el-input--small{--el-input-height:var(--el-component-size-small);font-size:12px}.el-input--small .el-input__wrapper{padding:1px 7px}.el-input--small .el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 24px) - 2px)}.el-input-group{display:inline-flex;width:100%;align-items:stretch}.el-input-group__append,.el-input-group__prepend{background-color:var(--el-fill-color-light);color:var(--el-color-info);position:relative;display:inline-flex;align-items:center;justify-content:center;min-height:100%;border-radius:var(--el-input-border-radius);padding:0 20px;white-space:nowrap}.el-input-group__append:focus,.el-input-group__prepend:focus{outline:0}.el-input-group__append .el-button,.el-input-group__append .el-select,.el-input-group__prepend .el-button,.el-input-group__prepend .el-select{display:inline-block;margin:0 -20px}.el-input-group__append button.el-button,.el-input-group__append button.el-button:hover,.el-input-group__append div.el-select .el-input__wrapper,.el-input-group__append div.el-select:hover .el-input__wrapper,.el-input-group__prepend button.el-button,.el-input-group__prepend button.el-button:hover,.el-input-group__prepend div.el-select .el-input__wrapper,.el-input-group__prepend div.el-select:hover .el-input__wrapper{border-color:transparent;background-color:transparent;color:inherit}.el-input-group__append .el-button,.el-input-group__append .el-input,.el-input-group__prepend .el-button,.el-input-group__prepend .el-input{font-size:inherit}.el-input-group__prepend{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 0 var(--el-input-border-color) inset,0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset}.el-input-group__append{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset,-1px 0 0 0 var(--el-input-border-color) inset}.el-input-group--prepend>.el-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0}.el-input-group--prepend .el-input-group__prepend .el-select .el-input .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select .el-input .el-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 0 var(--el-input-border-color) inset,0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__wrapper{box-shadow:1px 0 0 0 var(--el-input-focus-border-color) inset,1px 0 0 0 var(--el-input-focus-border-color),0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important;z-index:2}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__wrapper:focus{outline:0;z-index:2;box-shadow:1px 0 0 0 var(--el-input-focus-border-color) inset,1px 0 0 0 var(--el-input-focus-border-color),0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important}.el-input-group--prepend .el-input-group__prepend .el-select:hover .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select:hover .el-input__wrapper{z-index:1;box-shadow:1px 0 0 0 var(--el-input-hover-border-color) inset,1px 0 0 0 var(--el-input-hover-border-color),0 1px 0 0 var(--el-input-hover-border-color) inset,0 -1px 0 0 var(--el-input-hover-border-color) inset!important}.el-input-group--append>.el-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0}.el-input-group--append .el-input-group__append .el-select .el-input .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select .el-input .el-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset,-1px 0 0 0 var(--el-input-border-color) inset}.el-input-group--append .el-input-group__append .el-select .el-input.is-focus .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select .el-input.is-focus .el-input__wrapper{z-index:2;box-shadow:-1px 0 0 0 var(--el-input-focus-border-color),-1px 0 0 0 var(--el-input-focus-border-color) inset,0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important}.el-input-group--append .el-input-group__append .el-select:hover .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select:hover .el-input__wrapper{z-index:1;box-shadow:-1px 0 0 0 var(--el-input-hover-border-color),-1px 0 0 0 var(--el-input-hover-border-color) inset,0 1px 0 0 var(--el-input-hover-border-color) inset,0 -1px 0 0 var(--el-input-hover-border-color) inset!important}.el-link{--el-link-font-size:var(--el-font-size-base);--el-link-font-weight:var(--el-font-weight-primary);--el-link-text-color:var(--el-text-color-regular);--el-link-hover-text-color:var(--el-color-primary);--el-link-disabled-text-color:var(--el-text-color-placeholder)}.el-link{display:inline-flex;flex-direction:row;align-items:center;justify-content:center;vertical-align:middle;position:relative;text-decoration:none;outline:0;cursor:pointer;padding:0;font-size:var(--el-link-font-size);font-weight:var(--el-link-font-weight);color:var(--el-link-text-color)}.el-link:hover{color:var(--el-link-hover-text-color)}.el-link.is-underline:hover:after{content:"";position:absolute;left:0;right:0;height:0;bottom:0;border-bottom:1px solid var(--el-link-hover-text-color)}.el-link.is-disabled{color:var(--el-link-disabled-text-color);cursor:not-allowed}.el-link [class*=el-icon-]+span{margin-left:5px}.el-link.el-link--default:after{border-color:var(--el-link-hover-text-color)}.el-link__inner{display:inline-flex;justify-content:center;align-items:center}.el-link.el-link--primary{--el-link-text-color:var(--el-color-primary);--el-link-hover-text-color:var(--el-color-primary-light-3);--el-link-disabled-text-color:var(--el-color-primary-light-5)}.el-link.el-link--primary:after{border-color:var(--el-link-text-color)}.el-link.el-link--primary.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--success{--el-link-text-color:var(--el-color-success);--el-link-hover-text-color:var(--el-color-success-light-3);--el-link-disabled-text-color:var(--el-color-success-light-5)}.el-link.el-link--success:after{border-color:var(--el-link-text-color)}.el-link.el-link--success.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--warning{--el-link-text-color:var(--el-color-warning);--el-link-hover-text-color:var(--el-color-warning-light-3);--el-link-disabled-text-color:var(--el-color-warning-light-5)}.el-link.el-link--warning:after{border-color:var(--el-link-text-color)}.el-link.el-link--warning.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--danger{--el-link-text-color:var(--el-color-danger);--el-link-hover-text-color:var(--el-color-danger-light-3);--el-link-disabled-text-color:var(--el-color-danger-light-5)}.el-link.el-link--danger:after{border-color:var(--el-link-text-color)}.el-link.el-link--danger.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--error{--el-link-text-color:var(--el-color-error);--el-link-hover-text-color:var(--el-color-error-light-3);--el-link-disabled-text-color:var(--el-color-error-light-5)}.el-link.el-link--error:after{border-color:var(--el-link-text-color)}.el-link.el-link--error.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--info{--el-link-text-color:var(--el-color-info);--el-link-hover-text-color:var(--el-color-info-light-3);--el-link-disabled-text-color:var(--el-color-info-light-5)}.el-link.el-link--info:after{border-color:var(--el-link-text-color)}.el-link.el-link--info.is-underline:hover:after{border-color:var(--el-link-text-color)}:root{--el-loading-spinner-size:42px;--el-loading-fullscreen-spinner-size:50px}.el-loading-parent--relative{position:relative!important}.el-loading-parent--hidden{overflow:hidden!important}.el-loading-mask{position:absolute;z-index:2000;background-color:var(--el-mask-color);margin:0;top:0;right:0;bottom:0;left:0;transition:opacity var(--el-transition-duration)}.el-loading-mask.is-fullscreen{position:fixed}.el-loading-mask.is-fullscreen .el-loading-spinner{margin-top:calc((0px - var(--el-loading-fullscreen-spinner-size))/ 2)}.el-loading-mask.is-fullscreen .el-loading-spinner .circular{height:var(--el-loading-fullscreen-spinner-size);width:var(--el-loading-fullscreen-spinner-size)}.el-loading-spinner{top:50%;margin-top:calc((0px - var(--el-loading-spinner-size))/ 2);width:100%;text-align:center;position:absolute}.el-loading-spinner .el-loading-text{color:var(--el-color-primary);margin:3px 0;font-size:14px}.el-loading-spinner .circular{display:inline;height:var(--el-loading-spinner-size);width:var(--el-loading-spinner-size);-webkit-animation:loading-rotate 2s linear infinite;animation:loading-rotate 2s linear infinite}.el-loading-spinner .path{-webkit-animation:loading-dash 1.5s ease-in-out infinite;animation:loading-dash 1.5s ease-in-out infinite;stroke-dasharray:90,150;stroke-dashoffset:0;stroke-width:2;stroke:var(--el-color-primary);stroke-linecap:round}.el-loading-spinner i{color:var(--el-color-primary)}.el-loading-fade-enter-from,.el-loading-fade-leave-to{opacity:0}@-webkit-keyframes loading-rotate{to{transform:rotate(360deg)}}@keyframes loading-rotate{to{transform:rotate(360deg)}}@-webkit-keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}@keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}.el-main{--el-main-padding:20px;display:block;flex:1;flex-basis:auto;overflow:auto;box-sizing:border-box;padding:var(--el-main-padding)}:root{--el-menu-active-color:var(--el-color-primary);--el-menu-text-color:var(--el-text-color-primary);--el-menu-hover-text-color:var(--el-color-primary);--el-menu-bg-color:var(--el-fill-color-blank);--el-menu-hover-bg-color:var(--el-color-primary-light-9);--el-menu-item-height:56px;--el-menu-sub-item-height:calc(var(--el-menu-item-height) - 6px);--el-menu-horizontal-sub-item-height:36px;--el-menu-item-font-size:var(--el-font-size-base);--el-menu-item-hover-fill:var(--el-color-primary-light-9);--el-menu-border-color:var(--el-border-color);--el-menu-base-level-padding:20px;--el-menu-level-padding:20px;--el-menu-icon-width:24px}.el-menu{border-right:solid 1px var(--el-menu-border-color);list-style:none;position:relative;margin:0;padding-left:0;background-color:var(--el-menu-bg-color);box-sizing:border-box}.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-menu-item,.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-menu-item-group__title,.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-sub-menu__title{white-space:nowrap;padding-left:calc(var(--el-menu-base-level-padding) + var(--el-menu-level) * var(--el-menu-level-padding))}.el-menu--horizontal{display:flex;flex-wrap:nowrap;border-bottom:solid 1px var(--el-menu-border-color);border-right:none}.el-menu--horizontal>.el-menu-item{display:inline-flex;justify-content:center;align-items:center;height:100%;margin:0;border-bottom:2px solid transparent;color:var(--el-menu-text-color)}.el-menu--horizontal>.el-menu-item a,.el-menu--horizontal>.el-menu-item a:hover{color:inherit}.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus,.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover{background-color:#fff}.el-menu--horizontal>.el-sub-menu:focus,.el-menu--horizontal>.el-sub-menu:hover{outline:0}.el-menu--horizontal>.el-sub-menu:hover .el-sub-menu__title{color:var(--el-menu-hover-text-color)}.el-menu--horizontal>.el-sub-menu.is-active .el-sub-menu__title{border-bottom:2px solid var(--el-menu-active-color);color:var(--el-menu-active-color)}.el-menu--horizontal>.el-sub-menu .el-sub-menu__title{height:100%;border-bottom:2px solid transparent;color:var(--el-menu-text-color)}.el-menu--horizontal>.el-sub-menu .el-sub-menu__title:hover{background-color:var(--el-bg-color-overlay)}.el-menu--horizontal .el-menu .el-menu-item,.el-menu--horizontal .el-menu .el-sub-menu__title{background-color:var(--el-menu-bg-color);display:flex;align-items:center;height:var(--el-menu-horizontal-sub-item-height);line-height:var(--el-menu-horizontal-sub-item-height);padding:0 10px;color:var(--el-menu-text-color)}.el-menu--horizontal .el-menu .el-sub-menu__title{padding-right:40px}.el-menu--horizontal .el-menu .el-menu-item.is-active,.el-menu--horizontal .el-menu .el-sub-menu.is-active>.el-sub-menu__title{color:var(--el-menu-active-color)}.el-menu--horizontal .el-menu-item:not(.is-disabled):focus,.el-menu--horizontal .el-menu-item:not(.is-disabled):hover{outline:0;color:var(--el-menu-hover-text-color);background-color:var(--el-menu-hover-bg-color)}.el-menu--horizontal>.el-menu-item.is-active{border-bottom:2px solid var(--el-menu-active-color);color:var(--el-menu-active-color)!important}.el-menu--collapse{width:calc(var(--el-menu-icon-width) + var(--el-menu-base-level-padding) * 2)}.el-menu--collapse>.el-menu-item [class^=el-icon],.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title [class^=el-icon],.el-menu--collapse>.el-sub-menu>.el-sub-menu__title [class^=el-icon]{margin:0;vertical-align:middle;width:var(--el-menu-icon-width);text-align:center}.el-menu--collapse>.el-menu-item .el-sub-menu__icon-arrow,.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow,.el-menu--collapse>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow{display:none}.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title>span,.el-menu--collapse>.el-menu-item>span,.el-menu--collapse>.el-sub-menu>.el-sub-menu__title>span{height:0;width:0;overflow:hidden;visibility:hidden;display:inline-block}.el-menu--collapse>.el-menu-item.is-active i{color:inherit}.el-menu--collapse .el-menu .el-sub-menu{min-width:200px}.el-menu--popup{z-index:100;min-width:200px;border:none;padding:5px 0;border-radius:var(--el-border-radius-small);box-shadow:var(--el-box-shadow-light)}.el-menu .el-icon{flex-shrink:0}.el-menu-item{display:flex;align-items:center;height:var(--el-menu-item-height);line-height:var(--el-menu-item-height);font-size:var(--el-menu-item-font-size);color:var(--el-menu-text-color);padding:0 var(--el-menu-base-level-padding);list-style:none;cursor:pointer;position:relative;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration),color var(--el-transition-duration);box-sizing:border-box;white-space:nowrap}.el-menu-item *{vertical-align:bottom}.el-menu-item i{color:inherit}.el-menu-item:focus,.el-menu-item:hover{outline:0}.el-menu-item:hover{background-color:var(--el-menu-hover-bg-color)}.el-menu-item.is-disabled{opacity:.25;cursor:not-allowed;background:0 0!important}.el-menu-item [class^=el-icon]{margin-right:5px;width:var(--el-menu-icon-width);text-align:center;font-size:18px;vertical-align:middle}.el-menu-item.is-active{color:var(--el-menu-active-color)}.el-menu-item.is-active i{color:inherit}.el-menu-item .el-menu-tooltip__trigger{position:absolute;left:0;top:0;height:100%;width:100%;display:inline-flex;align-items:center;box-sizing:border-box;padding:0 var(--el-menu-base-level-padding)}.el-sub-menu{list-style:none;margin:0;padding-left:0}.el-sub-menu__title{display:flex;align-items:center;height:var(--el-menu-item-height);line-height:var(--el-menu-item-height);font-size:var(--el-menu-item-font-size);color:var(--el-menu-text-color);padding:0 var(--el-menu-base-level-padding);list-style:none;cursor:pointer;position:relative;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration),color var(--el-transition-duration);box-sizing:border-box;white-space:nowrap;padding-right:calc(var(--el-menu-base-level-padding) + var(--el-menu-icon-width))}.el-sub-menu__title *{vertical-align:bottom}.el-sub-menu__title i{color:inherit}.el-sub-menu__title:focus,.el-sub-menu__title:hover{outline:0}.el-sub-menu__title.is-disabled{opacity:.25;cursor:not-allowed;background:0 0!important}.el-sub-menu__title:hover{background-color:var(--el-menu-hover-bg-color)}.el-sub-menu .el-menu{border:none}.el-sub-menu .el-menu-item{height:var(--el-menu-sub-item-height);line-height:var(--el-menu-sub-item-height)}.el-sub-menu__hide-arrow .el-sub-menu__icon-arrow{display:none!important}.el-sub-menu.is-active .el-sub-menu__title{border-bottom-color:var(--el-menu-active-color)}.el-sub-menu.is-disabled .el-menu-item,.el-sub-menu.is-disabled .el-sub-menu__title{opacity:.25;cursor:not-allowed;background:0 0!important}.el-sub-menu .el-icon{vertical-align:middle;margin-right:5px;width:var(--el-menu-icon-width);text-align:center;font-size:18px}.el-sub-menu .el-icon.el-sub-menu__icon-more{margin-right:0!important}.el-sub-menu .el-sub-menu__icon-arrow{position:absolute;top:50%;right:var(--el-menu-base-level-padding);margin-top:-6px;transition:transform var(--el-transition-duration);font-size:12px;margin-right:0;width:inherit}.el-menu-item-group>ul{padding:0}.el-menu-item-group__title{padding:7px 0 7px var(--el-menu-base-level-padding);line-height:normal;font-size:12px;color:var(--el-text-color-secondary)}.horizontal-collapse-transition .el-sub-menu__title .el-sub-menu__icon-arrow{transition:var(--el-transition-duration-fast);opacity:0}.el-message-box{--el-messagebox-title-color:var(--el-text-color-primary);--el-messagebox-width:420px;--el-messagebox-border-radius:4px;--el-messagebox-font-size:var(--el-font-size-large);--el-messagebox-content-font-size:var(--el-font-size-base);--el-messagebox-content-color:var(--el-text-color-regular);--el-messagebox-error-font-size:12px;--el-messagebox-padding-primary:15px}.el-message-box{display:inline-block;max-width:var(--el-messagebox-width);width:100%;padding-bottom:10px;vertical-align:middle;background-color:var(--el-bg-color);border-radius:var(--el-messagebox-border-radius);border:1px solid var(--el-border-color-lighter);font-size:var(--el-messagebox-font-size);box-shadow:var(--el-box-shadow-light);text-align:left;overflow:hidden;-webkit-backface-visibility:hidden;backface-visibility:hidden;box-sizing:border-box}.el-message-box:focus{outline:0!important}.el-overlay.is-message-box .el-overlay-message-box{text-align:center;position:fixed;top:0;right:0;bottom:0;left:0;padding:16px;overflow:auto}.el-overlay.is-message-box .el-overlay-message-box:after{content:"";display:inline-block;height:100%;width:0;vertical-align:middle}.el-message-box.is-draggable .el-message-box__header{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-message-box__header{position:relative;padding:var(--el-messagebox-padding-primary);padding-bottom:10px}.el-message-box__title{padding-left:0;margin-bottom:0;font-size:var(--el-messagebox-font-size);line-height:1;color:var(--el-messagebox-title-color)}.el-message-box__headerbtn{position:absolute;top:var(--el-messagebox-padding-primary);right:var(--el-messagebox-padding-primary);padding:0;border:none;outline:0;background:0 0;font-size:var(--el-message-close-size,16px);cursor:pointer}.el-message-box__headerbtn .el-message-box__close{color:var(--el-color-info);font-size:inherit}.el-message-box__headerbtn:focus .el-message-box__close,.el-message-box__headerbtn:hover .el-message-box__close{color:var(--el-color-primary)}.el-message-box__content{padding:10px var(--el-messagebox-padding-primary);color:var(--el-messagebox-content-color);font-size:var(--el-messagebox-content-font-size)}.el-message-box__container{position:relative}.el-message-box__input{padding-top:15px}.el-message-box__input div.invalid>input{border-color:var(--el-color-error)}.el-message-box__input div.invalid>input:focus{border-color:var(--el-color-error)}.el-message-box__status{position:absolute;top:50%;transform:translateY(-50%);font-size:24px!important}.el-message-box__status:before{padding-left:1px}.el-message-box__status.el-icon{position:absolute}.el-message-box__status+.el-message-box__message{padding-left:36px;padding-right:12px;word-break:break-word}.el-message-box__status.el-message-box-icon--success{--el-messagebox-color:var(--el-color-success);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--info{--el-messagebox-color:var(--el-color-info);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--warning{--el-messagebox-color:var(--el-color-warning);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--error{--el-messagebox-color:var(--el-color-error);color:var(--el-messagebox-color)}.el-message-box__message{margin:0}.el-message-box__message p{margin:0;line-height:24px}.el-message-box__errormsg{color:var(--el-color-error);font-size:var(--el-messagebox-error-font-size);min-height:18px;margin-top:2px}.el-message-box__btns{padding:5px 15px 0;display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center}.el-message-box__btns button:nth-child(2){margin-left:10px}.el-message-box__btns-reverse{flex-direction:row-reverse}.el-message-box--center .el-message-box__title{position:relative;display:flex;align-items:center;justify-content:center}.el-message-box--center .el-message-box__status{position:relative;top:auto;padding-right:5px;text-align:center;transform:translateY(-1px)}.el-message-box--center .el-message-box__message{margin-left:0}.el-message-box--center .el-message-box__btns{justify-content:center}.el-message-box--center .el-message-box__content{padding-left:calc(var(--el-messagebox-padding-primary) + 12px);padding-right:calc(var(--el-messagebox-padding-primary) + 12px);text-align:center}.fade-in-linear-enter-active .el-overlay-message-box{-webkit-animation:msgbox-fade-in var(--el-transition-duration);animation:msgbox-fade-in var(--el-transition-duration)}.fade-in-linear-leave-active .el-overlay-message-box{animation:msgbox-fade-in var(--el-transition-duration) reverse}@-webkit-keyframes msgbox-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes msgbox-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes msgbox-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes msgbox-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}.el-message{--el-message-bg-color:var(--el-color-info-light-9);--el-message-border-color:var(--el-border-color-lighter);--el-message-padding:15px 19px;--el-message-close-size:16px;--el-message-close-icon-color:var(--el-text-color-placeholder);--el-message-close-hover-color:var(--el-text-color-secondary)}.el-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;max-width:calc(100% - 32px);box-sizing:border-box;border-radius:var(--el-border-radius-base);border-width:var(--el-border-width);border-style:var(--el-border-style);border-color:var(--el-message-border-color);position:fixed;left:50%;top:20px;transform:translate(-50%);background-color:var(--el-message-bg-color);transition:opacity var(--el-transition-duration),transform .4s,top .4s;padding:var(--el-message-padding);display:flex;align-items:center}.el-message.is-center{justify-content:center}.el-message.is-closable .el-message__content{padding-right:31px}.el-message p{margin:0}.el-message--success{--el-message-bg-color:var(--el-color-success-light-9);--el-message-border-color:var(--el-color-success-light-8);--el-message-text-color:var(--el-color-success)}.el-message--success .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--success{color:var(--el-message-text-color)}.el-message--info{--el-message-bg-color:var(--el-color-info-light-9);--el-message-border-color:var(--el-color-info-light-8);--el-message-text-color:var(--el-color-info)}.el-message--info .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--info{color:var(--el-message-text-color)}.el-message--warning{--el-message-bg-color:var(--el-color-warning-light-9);--el-message-border-color:var(--el-color-warning-light-8);--el-message-text-color:var(--el-color-warning)}.el-message--warning .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--warning{color:var(--el-message-text-color)}.el-message--error{--el-message-bg-color:var(--el-color-error-light-9);--el-message-border-color:var(--el-color-error-light-8);--el-message-text-color:var(--el-color-error)}.el-message--error .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--error{color:var(--el-message-text-color)}.el-message__icon{margin-right:10px}.el-message .el-message__badge{position:absolute;top:-8px;right:-8px}.el-message__content{padding:0;font-size:14px;line-height:1}.el-message__content:focus{outline-width:0}.el-message .el-message__closeBtn{position:absolute;top:50%;right:19px;transform:translateY(-50%);cursor:pointer;color:var(--el-message-close-icon-color);font-size:var(--el-message-close-size)}.el-message .el-message__closeBtn:focus{outline-width:0}.el-message .el-message__closeBtn:hover{color:var(--el-message-close-hover-color)}.el-message-fade-enter-from,.el-message-fade-leave-to{opacity:0;transform:translate(-50%,-100%)}.el-notification{--el-notification-width:330px;--el-notification-padding:14px 26px 14px 13px;--el-notification-radius:8px;--el-notification-shadow:var(--el-box-shadow-light);--el-notification-border-color:var(--el-border-color-lighter);--el-notification-icon-size:24px;--el-notification-close-font-size:var(--el-message-close-size, 16px);--el-notification-group-margin-left:13px;--el-notification-group-margin-right:8px;--el-notification-content-font-size:var(--el-font-size-base);--el-notification-content-color:var(--el-text-color-regular);--el-notification-title-font-size:16px;--el-notification-title-color:var(--el-text-color-primary);--el-notification-close-color:var(--el-text-color-secondary);--el-notification-close-hover-color:var(--el-text-color-regular)}.el-notification{display:flex;width:var(--el-notification-width);padding:var(--el-notification-padding);border-radius:var(--el-notification-radius);box-sizing:border-box;border:1px solid var(--el-notification-border-color);position:fixed;background-color:var(--el-bg-color-overlay);box-shadow:var(--el-notification-shadow);transition:opacity var(--el-transition-duration),transform var(--el-transition-duration),left var(--el-transition-duration),right var(--el-transition-duration),top .4s,bottom var(--el-transition-duration);overflow-wrap:anywhere;overflow:hidden;z-index:9999}.el-notification.right{right:16px}.el-notification.left{left:16px}.el-notification__group{margin-left:var(--el-notification-group-margin-left);margin-right:var(--el-notification-group-margin-right)}.el-notification__title{font-weight:700;font-size:var(--el-notification-title-font-size);line-height:var(--el-notification-icon-size);color:var(--el-notification-title-color);margin:0}.el-notification__content{font-size:var(--el-notification-content-font-size);line-height:24px;margin:6px 0 0;color:var(--el-notification-content-color);text-align:justify}.el-notification__content p{margin:0}.el-notification .el-notification__icon{height:var(--el-notification-icon-size);width:var(--el-notification-icon-size);font-size:var(--el-notification-icon-size)}.el-notification .el-notification__closeBtn{position:absolute;top:18px;right:15px;cursor:pointer;color:var(--el-notification-close-color);font-size:var(--el-notification-close-font-size)}.el-notification .el-notification__closeBtn:hover{color:var(--el-notification-close-hover-color)}.el-notification .el-notification--success{--el-notification-icon-color:var(--el-color-success);color:var(--el-notification-icon-color)}.el-notification .el-notification--info{--el-notification-icon-color:var(--el-color-info);color:var(--el-notification-icon-color)}.el-notification .el-notification--warning{--el-notification-icon-color:var(--el-color-warning);color:var(--el-notification-icon-color)}.el-notification .el-notification--error{--el-notification-icon-color:var(--el-color-error);color:var(--el-notification-icon-color)}.el-notification-fade-enter-from.right{right:0;transform:translate(100%)}.el-notification-fade-enter-from.left{left:0;transform:translate(-100%)}.el-notification-fade-leave-to{opacity:0}.el-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;height:100%;background-color:var(--el-overlay-color-lighter);overflow:auto}.el-overlay .el-overlay-root{height:0}.el-page-header.is-contentful .el-page-header__main{border-top:1px solid var(--el-border-color-light);margin-top:16px}.el-page-header__header{display:flex;align-items:center;justify-content:space-between;line-height:24px}.el-page-header__left{display:flex;align-items:center;margin-right:40px;position:relative}.el-page-header__back{display:flex;align-items:center;cursor:pointer}.el-page-header__left .el-divider--vertical{margin:0 16px}.el-page-header__icon{font-size:16px;margin-right:10px;display:flex;align-items:center}.el-page-header__icon .el-icon{font-size:inherit}.el-page-header__title{font-size:14px;font-weight:500}.el-page-header__content{font-size:18px;color:var(--el-text-color-primary)}.el-page-header__breadcrumb{margin-bottom:16px}.el-pagination{--el-pagination-font-size:14px;--el-pagination-bg-color:var(--el-fill-color-blank);--el-pagination-text-color:var(--el-text-color-primary);--el-pagination-border-radius:2px;--el-pagination-button-color:var(--el-text-color-primary);--el-pagination-button-width:32px;--el-pagination-button-height:32px;--el-pagination-button-disabled-color:var(--el-text-color-placeholder);--el-pagination-button-disabled-bg-color:var(--el-fill-color-blank);--el-pagination-button-bg-color:var(--el-fill-color);--el-pagination-hover-color:var(--el-color-primary);--el-pagination-font-size-small:12px;--el-pagination-button-width-small:24px;--el-pagination-button-height-small:24px;--el-pagination-item-gap:16px;white-space:nowrap;color:var(--el-pagination-text-color);font-size:var(--el-pagination-font-size);font-weight:400;display:flex;align-items:center}.el-pagination .el-input__inner{text-align:center;-moz-appearance:textfield}.el-pagination .el-select .el-input{width:128px}.el-pagination button{display:flex;justify-content:center;align-items:center;font-size:var(--el-pagination-font-size);min-width:var(--el-pagination-button-width);height:var(--el-pagination-button-height);line-height:var(--el-pagination-button-height);color:var(--el-pagination-button-color);background:var(--el-pagination-bg-color);padding:0 4px;border:none;border-radius:var(--el-pagination-border-radius);cursor:pointer;text-align:center;box-sizing:border-box}.el-pagination button *{pointer-events:none}.el-pagination button:focus{outline:0}.el-pagination button:hover{color:var(--el-pagination-hover-color)}.el-pagination button.is-active{color:var(--el-pagination-hover-color);cursor:default;font-weight:700}.el-pagination button.is-active.is-disabled{font-weight:700;color:var(--el-text-color-secondary)}.el-pagination button.is-disabled,.el-pagination button:disabled{color:var(--el-pagination-button-disabled-color);background-color:var(--el-pagination-button-disabled-bg-color);cursor:not-allowed}.el-pagination button:focus-visible{outline:1px solid var(--el-pagination-hover-color);outline-offset:-1px}.el-pagination .btn-next .el-icon,.el-pagination .btn-prev .el-icon{display:block;font-size:12px;font-weight:700;width:inherit}.el-pagination>.is-first{margin-left:0!important}.el-pagination>.is-last{margin-right:0!important}.el-pagination .btn-prev{margin-left:var(--el-pagination-item-gap)}.el-pagination__sizes,.el-pagination__total{margin-left:var(--el-pagination-item-gap);font-weight:400;color:var(--el-text-color-regular)}.el-pagination__total[disabled=true]{color:var(--el-text-color-placeholder)}.el-pagination__jump{display:flex;align-items:center;margin-left:var(--el-pagination-item-gap);font-weight:400;color:var(--el-text-color-regular)}.el-pagination__jump[disabled=true]{color:var(--el-text-color-placeholder)}.el-pagination__goto{margin-right:8px}.el-pagination__editor{text-align:center;box-sizing:border-box}.el-pagination__editor.el-input{width:56px}.el-pagination__editor .el-input__inner::-webkit-inner-spin-button,.el-pagination__editor .el-input__inner::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.el-pagination__classifier{margin-left:8px}.el-pagination__rightwrapper{flex:1;display:flex;align-items:center;justify-content:flex-end}.el-pagination.is-background .btn-next,.el-pagination.is-background .btn-prev,.el-pagination.is-background .el-pager li{margin:0 4px;background-color:var(--el-pagination-button-bg-color)}.el-pagination.is-background .btn-next.is-active,.el-pagination.is-background .btn-prev.is-active,.el-pagination.is-background .el-pager li.is-active{background-color:var(--el-color-primary);color:var(--el-color-white)}.el-pagination.is-background .btn-next.is-disabled,.el-pagination.is-background .btn-next:disabled,.el-pagination.is-background .btn-prev.is-disabled,.el-pagination.is-background .btn-prev:disabled,.el-pagination.is-background .el-pager li.is-disabled,.el-pagination.is-background .el-pager li:disabled{color:var(--el-text-color-placeholder);background-color:var(--el-disabled-bg-color)}.el-pagination.is-background .btn-next.is-disabled.is-active,.el-pagination.is-background .btn-next:disabled.is-active,.el-pagination.is-background .btn-prev.is-disabled.is-active,.el-pagination.is-background .btn-prev:disabled.is-active,.el-pagination.is-background .el-pager li.is-disabled.is-active,.el-pagination.is-background .el-pager li:disabled.is-active{color:var(--el-text-color-secondary);background-color:var(--el-fill-color-dark)}.el-pagination.is-background .btn-prev{margin-left:var(--el-pagination-item-gap)}.el-pagination--small .btn-next,.el-pagination--small .btn-prev,.el-pagination--small .el-pager li{height:var(--el-pagination-button-height-small);line-height:var(--el-pagination-button-height-small);font-size:var(--el-pagination-font-size-small);min-width:var(--el-pagination-button-width-small)}.el-pagination--small button,.el-pagination--small span:not([class*=suffix]){font-size:var(--el-pagination-font-size-small)}.el-pagination--small .el-select .el-input{width:100px}.el-pager{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;font-size:0;padding:0;margin:0;display:flex;align-items:center}.el-pager li{display:flex;justify-content:center;align-items:center;font-size:var(--el-pagination-font-size);min-width:var(--el-pagination-button-width);height:var(--el-pagination-button-height);line-height:var(--el-pagination-button-height);color:var(--el-pagination-button-color);background:var(--el-pagination-bg-color);padding:0 4px;border:none;border-radius:var(--el-pagination-border-radius);cursor:pointer;text-align:center;box-sizing:border-box}.el-pager li *{pointer-events:none}.el-pager li:focus{outline:0}.el-pager li:hover{color:var(--el-pagination-hover-color)}.el-pager li.is-active{color:var(--el-pagination-hover-color);cursor:default;font-weight:700}.el-pager li.is-active.is-disabled{font-weight:700;color:var(--el-text-color-secondary)}.el-pager li.is-disabled,.el-pager li:disabled{color:var(--el-pagination-button-disabled-color);background-color:var(--el-pagination-button-disabled-bg-color);cursor:not-allowed}.el-pager li:focus-visible{outline:1px solid var(--el-pagination-hover-color);outline-offset:-1px}.el-popconfirm__main{display:flex;align-items:center}.el-popconfirm__icon{margin-right:5px}.el-popconfirm__action{text-align:right;margin-top:8px}.el-popover{--el-popover-bg-color:var(--el-bg-color-overlay);--el-popover-font-size:var(--el-font-size-base);--el-popover-border-color:var(--el-border-color-lighter);--el-popover-padding:12px;--el-popover-padding-large:18px 20px;--el-popover-title-font-size:16px;--el-popover-title-text-color:var(--el-text-color-primary);--el-popover-border-radius:4px}.el-popover.el-popper{background:var(--el-popover-bg-color);min-width:150px;border-radius:var(--el-popover-border-radius);border:1px solid var(--el-popover-border-color);padding:var(--el-popover-padding);z-index:var(--el-index-popper);color:var(--el-text-color-regular);line-height:1.4;text-align:justify;font-size:var(--el-popover-font-size);box-shadow:var(--el-box-shadow-light);word-break:break-all;box-sizing:border-box}.el-popover.el-popper--plain{padding:var(--el-popover-padding-large)}.el-popover__title{color:var(--el-popover-title-text-color);font-size:var(--el-popover-title-font-size);line-height:1;margin-bottom:12px}.el-popover__reference:focus:hover,.el-popover__reference:focus:not(.focusing){outline-width:0}.el-popover.el-popper.is-dark{--el-popover-bg-color:var(--el-text-color-primary);--el-popover-border-color:var(--el-text-color-primary);--el-popover-title-text-color:var(--el-bg-color);color:var(--el-bg-color)}.el-popover.el-popper:focus,.el-popover.el-popper:focus:active{outline-width:0}.el-progress{position:relative;line-height:1;display:flex;align-items:center}.el-progress__text{font-size:14px;color:var(--el-text-color-regular);margin-left:5px;min-width:50px;line-height:1}.el-progress__text i{vertical-align:middle;display:block}.el-progress--circle,.el-progress--dashboard{display:inline-block}.el-progress--circle .el-progress__text,.el-progress--dashboard .el-progress__text{position:absolute;top:50%;left:0;width:100%;text-align:center;margin:0;transform:translateY(-50%)}.el-progress--circle .el-progress__text i,.el-progress--dashboard .el-progress__text i{vertical-align:middle;display:inline-block}.el-progress--without-text .el-progress__text{display:none}.el-progress--without-text .el-progress-bar{padding-right:0;margin-right:0;display:block}.el-progress--text-inside .el-progress-bar{padding-right:0;margin-right:0}.el-progress.is-success .el-progress-bar__inner{background-color:var(--el-color-success)}.el-progress.is-success .el-progress__text{color:var(--el-color-success)}.el-progress.is-warning .el-progress-bar__inner{background-color:var(--el-color-warning)}.el-progress.is-warning .el-progress__text{color:var(--el-color-warning)}.el-progress.is-exception .el-progress-bar__inner{background-color:var(--el-color-danger)}.el-progress.is-exception .el-progress__text{color:var(--el-color-danger)}.el-progress-bar{flex-grow:1;box-sizing:border-box}.el-progress-bar__outer{height:6px;border-radius:100px;background-color:var(--el-border-color-lighter);overflow:hidden;position:relative;vertical-align:middle}.el-progress-bar__inner{position:absolute;left:0;top:0;height:100%;background-color:var(--el-color-primary);text-align:right;border-radius:100px;line-height:1;white-space:nowrap;transition:width .6s ease}.el-progress-bar__inner:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-progress-bar__inner--indeterminate{transform:translateZ(0);-webkit-animation:indeterminate 3s infinite;animation:indeterminate 3s infinite}.el-progress-bar__inner--striped{background-image:linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 50%,rgba(0,0,0,.1) 50%,rgba(0,0,0,.1) 75%,transparent 75%,transparent);background-size:1.25em 1.25em}.el-progress-bar__inner--striped.el-progress-bar__inner--striped-flow{-webkit-animation:striped-flow 3s linear infinite;animation:striped-flow 3s linear infinite}.el-progress-bar__innerText{display:inline-block;vertical-align:middle;color:#fff;font-size:12px;margin:0 5px}@-webkit-keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}@keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}@-webkit-keyframes indeterminate{0%{left:-100%}to{left:100%}}@keyframes indeterminate{0%{left:-100%}to{left:100%}}@-webkit-keyframes striped-flow{0%{background-position:-100%}to{background-position:100%}}@keyframes striped-flow{0%{background-position:-100%}to{background-position:100%}}.el-radio-button{--el-radio-button-checked-bg-color:var(--el-color-primary);--el-radio-button-checked-text-color:var(--el-color-white);--el-radio-button-checked-border-color:var(--el-color-primary);--el-radio-button-disabled-checked-fill:var(--el-border-color-extra-light)}.el-radio-button{position:relative;display:inline-block;outline:0}.el-radio-button__inner{display:inline-block;line-height:1;white-space:nowrap;vertical-align:middle;background:var(--el-button-bg-color,var(--el-fill-color-blank));border:var(--el-border);font-weight:var(--el-button-font-weight,var(--el-font-weight-primary));border-left:0;color:var(--el-button-text-color,var(--el-text-color-regular));-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:0;margin:0;position:relative;cursor:pointer;transition:var(--el-transition-all);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:8px 15px;font-size:var(--el-font-size-base);border-radius:0}.el-radio-button__inner.is-round{padding:8px 15px}.el-radio-button__inner:hover{color:var(--el-color-primary)}.el-radio-button__inner [class*=el-icon-]{line-height:.9}.el-radio-button__inner [class*=el-icon-]+span{margin-left:5px}.el-radio-button:first-child .el-radio-button__inner{border-left:var(--el-border);border-radius:var(--el-border-radius-base) 0 0 var(--el-border-radius-base);box-shadow:none!important}.el-radio-button__original-radio{opacity:0;outline:0;position:absolute;z-index:-1}.el-radio-button__original-radio:checked+.el-radio-button__inner{color:var(--el-radio-button-checked-text-color,var(--el-color-white));background-color:var(--el-radio-button-checked-bg-color,var(--el-color-primary));border-color:var(--el-radio-button-checked-border-color,var(--el-color-primary));box-shadow:-1px 0 0 0 var(--el-radio-button-checked-border-color,var(--el-color-primary))}.el-radio-button__original-radio:focus-visible+.el-radio-button__inner{border-left:var(--el-border);border-left-color:var(--el-radio-button-checked-border-color,var(--el-color-primary));outline:2px solid var(--el-radio-button-checked-border-color);outline-offset:1px;z-index:2;border-radius:var(--el-border-radius-base);box-shadow:none}.el-radio-button__original-radio:disabled+.el-radio-button__inner{color:var(--el-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color,var(--el-fill-color-blank));border-color:var(--el-button-disabled-border-color,var(--el-border-color-light));box-shadow:none}.el-radio-button__original-radio:disabled:checked+.el-radio-button__inner{background-color:var(--el-radio-button-disabled-checked-fill)}.el-radio-button:last-child .el-radio-button__inner{border-radius:0 var(--el-border-radius-base) var(--el-border-radius-base) 0}.el-radio-button:first-child:last-child .el-radio-button__inner{border-radius:var(--el-border-radius-base)}.el-radio-button--large .el-radio-button__inner{padding:12px 19px;font-size:var(--el-font-size-base);border-radius:0}.el-radio-button--large .el-radio-button__inner.is-round{padding:12px 19px}.el-radio-button--small .el-radio-button__inner{padding:5px 11px;font-size:12px;border-radius:0}.el-radio-button--small .el-radio-button__inner.is-round{padding:5px 11px}.el-radio-group{display:inline-flex;align-items:center;flex-wrap:wrap;font-size:0}.el-radio{--el-radio-font-size:var(--el-font-size-base);--el-radio-text-color:var(--el-text-color-regular);--el-radio-font-weight:var(--el-font-weight-primary);--el-radio-input-height:14px;--el-radio-input-width:14px;--el-radio-input-border-radius:var(--el-border-radius-circle);--el-radio-input-bg-color:var(--el-fill-color-blank);--el-radio-input-border:var(--el-border);--el-radio-input-border-color:var(--el-border-color);--el-radio-input-border-color-hover:var(--el-color-primary)}.el-radio{color:var(--el-radio-text-color);font-weight:var(--el-radio-font-weight);position:relative;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;outline:0;font-size:var(--el-font-size-base);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:32px;height:32px}.el-radio.el-radio--large{height:40px}.el-radio.el-radio--small{height:24px}.el-radio.is-bordered{padding:0 15px 0 9px;border-radius:var(--el-border-radius-base);border:var(--el-border);box-sizing:border-box}.el-radio.is-bordered.is-checked{border-color:var(--el-color-primary)}.el-radio.is-bordered.is-disabled{cursor:not-allowed;border-color:var(--el-border-color-lighter)}.el-radio.is-bordered.el-radio--large{padding:0 19px 0 11px;border-radius:var(--el-border-radius-base)}.el-radio.is-bordered.el-radio--large .el-radio__label{font-size:var(--el-font-size-base)}.el-radio.is-bordered.el-radio--large .el-radio__inner{height:14px;width:14px}.el-radio.is-bordered.el-radio--small{padding:0 11px 0 7px;border-radius:var(--el-border-radius-base)}.el-radio.is-bordered.el-radio--small .el-radio__label{font-size:12px}.el-radio.is-bordered.el-radio--small .el-radio__inner{height:12px;width:12px}.el-radio:last-child{margin-right:0}.el-radio__input{white-space:nowrap;cursor:pointer;outline:0;display:inline-flex;position:relative;vertical-align:middle}.el-radio__input.is-disabled .el-radio__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);cursor:not-allowed}.el-radio__input.is-disabled .el-radio__inner:after{cursor:not-allowed;background-color:var(--el-disabled-bg-color)}.el-radio__input.is-disabled .el-radio__inner+.el-radio__label{cursor:not-allowed}.el-radio__input.is-disabled.is-checked .el-radio__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color)}.el-radio__input.is-disabled.is-checked .el-radio__inner:after{background-color:var(--el-text-color-placeholder)}.el-radio__input.is-disabled+span.el-radio__label{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-radio__input.is-checked .el-radio__inner{border-color:var(--el-color-primary);background:var(--el-color-primary)}.el-radio__input.is-checked .el-radio__inner:after{transform:translate(-50%,-50%) scale(1)}.el-radio__input.is-checked+.el-radio__label{color:var(--el-color-primary)}.el-radio__input.is-focus .el-radio__inner{border-color:var(--el-radio-input-border-color-hover)}.el-radio__inner{border:var(--el-radio-input-border);border-radius:var(--el-radio-input-border-radius);width:var(--el-radio-input-width);height:var(--el-radio-input-height);background-color:var(--el-radio-input-bg-color);position:relative;cursor:pointer;display:inline-block;box-sizing:border-box}.el-radio__inner:hover{border-color:var(--el-radio-input-border-color-hover)}.el-radio__inner:after{width:4px;height:4px;border-radius:var(--el-radio-input-border-radius);background-color:var(--el-color-white);content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%) scale(0);transition:transform .15s ease-in}.el-radio__original{opacity:0;outline:0;position:absolute;z-index:-1;top:0;left:0;right:0;bottom:0;margin:0}.el-radio__original:focus-visible+.el-radio__inner{outline:2px solid var(--el-radio-input-border-color-hover);outline-offset:1px;border-radius:var(--el-radio-input-border-radius)}.el-radio:focus:not(:focus-visible):not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner{box-shadow:0 0 2px 2px var(--el-radio-input-border-color-hover)}.el-radio__label{font-size:var(--el-radio-font-size);padding-left:8px}.el-radio.el-radio--large .el-radio__label{font-size:14px}.el-radio.el-radio--large .el-radio__inner{width:14px;height:14px}.el-radio.el-radio--small .el-radio__label{font-size:12px}.el-radio.el-radio--small .el-radio__inner{width:12px;height:12px}.el-rate{--el-rate-height:20px;--el-rate-font-size:var(--el-font-size-base);--el-rate-icon-size:18px;--el-rate-icon-margin:6px;--el-rate-void-color:var(--el-border-color-darker);--el-rate-fill-color:#f7ba2a;--el-rate-disabled-void-color:var(--el-fill-color);--el-rate-text-color:var(--el-text-color-primary)}.el-rate{display:inline-flex;align-items:center;height:32px}.el-rate:active,.el-rate:focus{outline:0}.el-rate__item{cursor:pointer;display:inline-block;position:relative;font-size:0;vertical-align:middle;color:var(--el-rate-void-color);line-height:normal}.el-rate .el-rate__icon{position:relative;display:inline-block;font-size:var(--el-rate-icon-size);margin-right:var(--el-rate-icon-margin);transition:var(--el-transition-duration)}.el-rate .el-rate__icon.hover{transform:scale(1.15)}.el-rate .el-rate__icon .path2{position:absolute;left:0;top:0}.el-rate .el-rate__icon.is-active{color:var(--el-rate-fill-color)}.el-rate__decimal{position:absolute;top:0;left:0;display:inline-block;overflow:hidden;color:var(--el-rate-fill-color)}.el-rate__text{font-size:var(--el-rate-font-size);vertical-align:middle;color:var(--el-rate-text-color)}.el-rate--large{height:40px}.el-rate--small{height:24px}.el-rate--small .el-rate__icon{font-size:14px}.el-rate.is-disabled .el-rate__item{cursor:auto;color:var(--el-rate-disabled-void-color)}.el-result{--el-result-padding:40px 30px;--el-result-icon-font-size:64px;--el-result-title-font-size:20px;--el-result-title-margin-top:20px;--el-result-subtitle-margin-top:10px;--el-result-extra-margin-top:30px}.el-result{display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:var(--el-result-padding)}.el-result__icon svg{width:var(--el-result-icon-font-size);height:var(--el-result-icon-font-size)}.el-result__title{margin-top:var(--el-result-title-margin-top)}.el-result__title p{margin:0;font-size:var(--el-result-title-font-size);color:var(--el-text-color-primary);line-height:1.3}.el-result__subtitle{margin-top:var(--el-result-subtitle-margin-top)}.el-result__subtitle p{margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);line-height:1.3}.el-result__extra{margin-top:var(--el-result-extra-margin-top)}.el-result .icon-primary{--el-result-color:var(--el-color-primary);color:var(--el-result-color)}.el-result .icon-success{--el-result-color:var(--el-color-success);color:var(--el-result-color)}.el-result .icon-warning{--el-result-color:var(--el-color-warning);color:var(--el-result-color)}.el-result .icon-danger{--el-result-color:var(--el-color-danger);color:var(--el-result-color)}.el-result .icon-error{--el-result-color:var(--el-color-error);color:var(--el-result-color)}.el-result .icon-info{--el-result-color:var(--el-color-info);color:var(--el-result-color)}.el-row{display:flex;flex-wrap:wrap;position:relative;box-sizing:border-box}.el-row.is-justify-center{justify-content:center}.el-row.is-justify-end{justify-content:flex-end}.el-row.is-justify-space-between{justify-content:space-between}.el-row.is-justify-space-around{justify-content:space-around}.el-row.is-justify-space-evenly{justify-content:space-evenly}.el-row.is-align-middle{align-items:center}.el-row.is-align-bottom{align-items:flex-end}.el-scrollbar{--el-scrollbar-opacity:.3;--el-scrollbar-bg-color:var(--el-text-color-secondary);--el-scrollbar-hover-opacity:.5;--el-scrollbar-hover-bg-color:var(--el-text-color-secondary)}.el-scrollbar{overflow:hidden;position:relative;height:100%}.el-scrollbar__wrap{overflow:auto;height:100%}.el-scrollbar__wrap--hidden-default{scrollbar-width:none}.el-scrollbar__wrap--hidden-default::-webkit-scrollbar{display:none}.el-scrollbar__thumb{position:relative;display:block;width:0;height:0;cursor:pointer;border-radius:inherit;background-color:var(--el-scrollbar-bg-color,var(--el-text-color-secondary));transition:var(--el-transition-duration) background-color;opacity:var(--el-scrollbar-opacity,.3)}.el-scrollbar__thumb:hover{background-color:var(--el-scrollbar-hover-bg-color,var(--el-text-color-secondary));opacity:var(--el-scrollbar-hover-opacity,.5)}.el-scrollbar__bar{position:absolute;right:2px;bottom:2px;z-index:1;border-radius:4px}.el-scrollbar__bar.is-vertical{width:6px;top:2px}.el-scrollbar__bar.is-vertical>div{width:100%}.el-scrollbar__bar.is-horizontal{height:6px;left:2px}.el-scrollbar__bar.is-horizontal>div{height:100%}.el-scrollbar-fade-enter-active{transition:opacity .34s ease-out}.el-scrollbar-fade-leave-active{transition:opacity .12s ease-out}.el-scrollbar-fade-enter-from,.el-scrollbar-fade-leave-active{opacity:0}.el-select-dropdown{z-index:calc(var(--el-index-top) + 1);border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown__option-item.is-selected:not(.is-multiple).is-disabled{color:var(--el-text-color-disabled)}.el-select-dropdown__option-item.is-selected:not(.is-multiple).is-disabled:after{background-color:var(--el-text-color-disabled)}.el-select-dropdown__option-item:hover:not(.hover){background-color:transparent}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-disabled.is-selected{color:var(--el-text-color-disabled)}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:var(--el-select-font-size)}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;margin:6px 0!important;padding:0!important;box-sizing:border-box}.el-select-dropdown__option-item{font-size:var(--el-select-font-size);padding:0 32px 0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--el-text-color-regular);height:34px;line-height:34px;box-sizing:border-box;cursor:pointer}.el-select-dropdown__option-item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-select-dropdown__option-item.is-disabled:hover{background-color:var(--el-bg-color)}.el-select-dropdown__option-item.is-selected{background-color:var(--el-fill-color-light);font-weight:700}.el-select-dropdown__option-item.is-selected:not(.is-multiple){color:var(--el-color-primary)}.el-select-dropdown__option-item.hover{background-color:var(--el-fill-color-light)!important}.el-select-dropdown__option-item:hover{background-color:var(--el-fill-color-light)}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay)}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected .el-icon{position:absolute;right:20px;top:0;height:inherit;font-size:12px}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected .el-icon svg{height:inherit;vertical-align:middle}.el-select-group{margin:0;padding:0}.el-select-group__wrap{position:relative;list-style:none;margin:0;padding:0}.el-select-group__wrap:not(:last-of-type){padding-bottom:24px}.el-select-group__wrap:not(:last-of-type):after{content:"";position:absolute;display:block;left:20px;right:20px;bottom:12px;height:1px;background:var(--el-border-color-light)}.el-select-group__split-dash{position:absolute;left:20px;right:20px;height:1px;background:var(--el-border-color-light)}.el-select-group__title{padding-left:20px;font-size:12px;color:var(--el-color-info);line-height:30px}.el-select-group .el-select-dropdown__item{padding-left:20px}.el-select-v2{--el-select-border-color-hover:var(--el-border-color-hover);--el-select-disabled-border:var(--el-disabled-border-color);--el-select-font-size:var(--el-font-size-base);--el-select-close-hover-color:var(--el-text-color-secondary);--el-select-input-color:var(--el-text-color-placeholder);--el-select-multiple-input-color:var(--el-text-color-regular);--el-select-input-focus-border-color:var(--el-color-primary);--el-select-input-font-size:14px}.el-select-v2{display:inline-block;position:relative;vertical-align:middle;font-size:14px}.el-select-v2__wrapper{display:flex;align-items:center;flex-wrap:wrap;position:relative;box-sizing:border-box;cursor:pointer;padding:1px 30px 1px 0;border:1px solid var(--el-border-color);border-radius:var(--el-border-radius-base);background-color:var(--el-fill-color-blank);transition:var(--el-transition-duration)}.el-select-v2__wrapper:hover{border-color:var(--el-text-color-placeholder)}.el-select-v2__wrapper.is-filterable{cursor:text}.el-select-v2__wrapper.is-focused{border-color:var(--el-color-primary)}.el-select-v2__wrapper.is-hovering:not(.is-focused){border-color:var(--el-border-color-hover)}.el-select-v2__wrapper.is-disabled{cursor:not-allowed;background-color:var(--el-fill-color-light);color:var(--el-text-color-placeholder);border-color:var(--el-select-disabled-border)}.el-select-v2__wrapper.is-disabled:hover{border-color:var(--el-select-disabled-border)}.el-select-v2__wrapper.is-disabled.is-focus{border-color:var(--el-input-focus-border-color)}.el-select-v2__wrapper.is-disabled .is-transparent{opacity:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-select-v2__wrapper.is-disabled .el-select-v2__caret,.el-select-v2__wrapper.is-disabled .el-select-v2__combobox-input{cursor:not-allowed}.el-select-v2__wrapper .el-select-v2__input-wrapper{box-sizing:border-box;position:relative;-webkit-margin-start:12px;margin-inline-start:12px;max-width:100%;overflow:hidden}.el-select-v2__wrapper,.el-select-v2__wrapper .el-select-v2__input-wrapper{line-height:32px}.el-select-v2__wrapper .el-select-v2__input-wrapper input{--el-input-inner-height:calc(var(--el-component-size, 32px) - 8px);height:var(--el-input-inner-height);line-height:var(--el-input-inner-height);min-width:4px;width:100%;background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:0 0;border:none;margin:2px 0;outline:0;padding:0}.el-select-v2 .el-select-v2__tags-text{display:inline-block;line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-select-v2__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:14px}.el-select-v2__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-select-v2__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-select-v2__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-select-v2--large .el-select-v2__wrapper .el-select-v2__combobox-input{height:32px}.el-select-v2--large .el-select-v2__caret,.el-select-v2--large .el-select-v2__suffix{height:40px}.el-select-v2--large .el-select-v2__placeholder{font-size:14px;line-height:40px}.el-select-v2--small .el-select-v2__wrapper .el-select-v2__combobox-input{height:16px}.el-select-v2--small .el-select-v2__caret,.el-select-v2--small .el-select-v2__suffix{height:24px}.el-select-v2--small .el-select-v2__placeholder{font-size:12px;line-height:24px}.el-select-v2 .el-select-v2__selection>span{display:inline-block}.el-select-v2:hover .el-select-v2__combobox-input{border-color:var(--el-select-border-color-hover)}.el-select-v2 .el-select__selection-text{text-overflow:ellipsis;display:inline-block;overflow-x:hidden;vertical-align:bottom}.el-select-v2 .el-select-v2__combobox-input{padding-right:35px;display:block;color:var(--el-text-color-regular)}.el-select-v2 .el-select-v2__combobox-input:focus{border-color:var(--el-select-input-focus-border-color)}.el-select-v2__input{border:none;outline:0;padding:0;margin-left:15px;color:var(--el-select-multiple-input-color);font-size:var(--el-select-font-size);-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px}.el-select-v2__input.is-small{height:14px}.el-select-v2__close{cursor:pointer;position:absolute;top:8px;z-index:var(--el-index-top);right:25px;color:var(--el-select-input-color);line-height:18px;font-size:var(--el-select-input-font-size)}.el-select-v2__close:hover{color:var(--el-select-close-hover-color)}.el-select-v2__suffix{display:inline-flex;position:absolute;right:12px;height:32px;top:50%;transform:translateY(-50%);color:var(--el-input-icon-color,var(--el-text-color-placeholder))}.el-select-v2__suffix .el-input__icon{height:inherit}.el-select-v2__suffix .el-input__icon:not(:first-child){margin-left:8px}.el-select-v2__caret{color:var(--el-select-input-color);font-size:var(--el-select-input-font-size);transition:var(--el-transition-duration);transform:rotate(180deg);cursor:pointer}.el-select-v2__caret.is-reverse{transform:rotate(0)}.el-select-v2__caret.is-show-close{font-size:var(--el-select-font-size);text-align:center;transform:rotate(180deg);border-radius:var(--el-border-radius-circle);color:var(--el-select-input-color);transition:var(--el-transition-color)}.el-select-v2__caret.is-show-close:hover{color:var(--el-select-close-hover-color)}.el-select-v2__caret.el-icon{height:inherit}.el-select-v2__caret.el-icon svg{vertical-align:middle}.el-select-v2__selection{white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;width:100%}.el-select-v2__input-calculator{left:0;position:absolute;top:0;visibility:hidden;white-space:pre;z-index:999}.el-select-v2__selected-item{line-height:inherit;height:inherit;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-wrap:wrap}.el-select-v2__placeholder{position:absolute;top:50%;transform:translateY(-50%);-webkit-margin-start:12px;margin-inline-start:12px;width:calc(100% - 52px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--el-input-text-color,var(--el-text-color-regular))}.el-select-v2__placeholder.is-transparent{color:var(--el-text-color-placeholder)}.el-select-v2 .el-select-v2__selection .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 0 2px 6px;background-color:var(--el-fill-color)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;color:var(--el-color-white)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select-v2.el-select-v2--small .el-select-v2__selection .el-tag{margin:1px 0 1px 6px;height:18px}.el-select-dropdown{z-index:calc(var(--el-index-top) + 1);border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay)}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.hover{background-color:var(--el-fill-color-light)}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected:after{content:"";position:absolute;top:50%;right:20px;border-top:none;border-right:none;background-repeat:no-repeat;background-position:center;background-color:var(--el-color-primary);-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask-size:100% 100%;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;-webkit-mask-size:100% 100%;transform:translateY(-50%);width:12px;height:12px}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.is-disabled:after{background-color:var(--el-text-color-disabled)}.el-select-dropdown .el-select-dropdown__option-item.is-selected:after{content:"";position:absolute;top:50%;right:20px;border-top:none;border-right:none;background-repeat:no-repeat;background-position:center;background-color:var(--el-color-primary);-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask-size:100% 100%;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;-webkit-mask-size:100% 100%;transform:translateY(-50%);width:12px;height:12px}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown .el-select-dropdown__item.is-disabled:hover{background-color:unset}.el-select-dropdown .el-select-dropdown__item.is-disabled.selected{color:var(--el-text-color-disabled)}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:var(--el-select-font-size)}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;padding:6px 0;margin:0;box-sizing:border-box}.el-select{--el-select-border-color-hover:var(--el-border-color-hover);--el-select-disabled-border:var(--el-disabled-border-color);--el-select-font-size:var(--el-font-size-base);--el-select-close-hover-color:var(--el-text-color-secondary);--el-select-input-color:var(--el-text-color-placeholder);--el-select-multiple-input-color:var(--el-text-color-regular);--el-select-input-focus-border-color:var(--el-color-primary);--el-select-input-font-size:14px}.el-select{display:inline-block;position:relative;vertical-align:middle;line-height:32px}.el-select__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-select__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-select__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-select__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-select__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-select__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-select .el-select-tags-wrapper.has-prefix{margin-left:6px}.el-select--large{line-height:40px}.el-select--large .el-select-tags-wrapper.has-prefix{margin-left:8px}.el-select--small{line-height:24px}.el-select--small .el-select-tags-wrapper.has-prefix{margin-left:4px}.el-select .el-select__tags>span{display:inline-block}.el-select:hover:not(.el-select--disabled) .el-input__wrapper{box-shadow:0 0 0 1px var(--el-select-border-color-hover) inset}.el-select .el-select__tags-text{display:inline-block;line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-select .el-input__wrapper{cursor:pointer}.el-select .el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-select-input-focus-border-color) inset!important}.el-select .el-input__inner{cursor:pointer}.el-select .el-input{display:flex}.el-select .el-input .el-select__caret{color:var(--el-select-input-color);font-size:var(--el-select-input-font-size);transition:transform var(--el-transition-duration);transform:rotate(0);cursor:pointer}.el-select .el-input .el-select__caret.is-reverse{transform:rotate(-180deg)}.el-select .el-input .el-select__caret.is-show-close{font-size:var(--el-select-font-size);text-align:center;transform:rotate(0);border-radius:var(--el-border-radius-circle);color:var(--el-select-input-color);transition:var(--el-transition-color)}.el-select .el-input .el-select__caret.is-show-close:hover{color:var(--el-select-close-hover-color)}.el-select .el-input .el-select__caret.el-icon{position:relative;height:inherit;z-index:2}.el-select .el-input.is-disabled .el-input__wrapper{cursor:not-allowed}.el-select .el-input.is-disabled .el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-select-disabled-border) inset}.el-select .el-input.is-disabled .el-input__inner,.el-select .el-input.is-disabled .el-select__caret{cursor:not-allowed}.el-select .el-input.is-focus .el-input__wrapper{box-shadow:0 0 0 1px var(--el-select-input-focus-border-color) inset!important}.el-select__input{border:none;outline:0;padding:0;margin-left:15px;color:var(--el-select-multiple-input-color);font-size:var(--el-select-font-size);-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px;background-color:transparent}.el-select__input.is-disabled{cursor:not-allowed}.el-select__input--iOS{position:absolute;left:0;top:0;z-index:6}.el-select__input.is-small{height:14px}.el-select__close{cursor:pointer;position:absolute;top:8px;z-index:var(--el-index-top);right:25px;color:var(--el-select-input-color);line-height:18px;font-size:var(--el-select-input-font-size)}.el-select__close:hover{color:var(--el-select-close-hover-color)}.el-select__tags{position:absolute;line-height:normal;top:50%;transform:translateY(-50%);white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;cursor:pointer}.el-select__tags .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 6px 2px 0}.el-select__tags .el-tag:last-child{margin-right:0}.el-select__tags .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;top:0;color:#fff}.el-select__tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select__tags .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select__tags .el-tag--info{background-color:var(--el-fill-color)}.el-select__tags.is-disabled{cursor:not-allowed}.el-select__collapse-tags{white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;cursor:pointer}.el-select__collapse-tags .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 6px 2px 0}.el-select__collapse-tags .el-tag:last-child{margin-right:0}.el-select__collapse-tags .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;top:0;color:#fff}.el-select__collapse-tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select__collapse-tags .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select__collapse-tags .el-tag--info{background-color:var(--el-fill-color)}.el-select__collapse-tag{line-height:inherit;height:inherit;display:flex}.el-skeleton{--el-skeleton-circle-size:var(--el-avatar-size)}.el-skeleton__item{background:var(--el-skeleton-color);display:inline-block;height:16px;border-radius:var(--el-border-radius-base);width:100%}.el-skeleton__circle{border-radius:50%;width:var(--el-skeleton-circle-size);height:var(--el-skeleton-circle-size);line-height:var(--el-skeleton-circle-size)}.el-skeleton__button{height:40px;width:64px;border-radius:4px}.el-skeleton__p{width:100%}.el-skeleton__p.is-last{width:61%}.el-skeleton__p.is-first{width:33%}.el-skeleton__text{width:100%;height:var(--el-font-size-small)}.el-skeleton__caption{height:var(--el-font-size-extra-small)}.el-skeleton__h1{height:var(--el-font-size-extra-large)}.el-skeleton__h3{height:var(--el-font-size-large)}.el-skeleton__h5{height:var(--el-font-size-medium)}.el-skeleton__image{width:unset;display:flex;align-items:center;justify-content:center;border-radius:0}.el-skeleton__image svg{color:var(--el-svg-monochrome-grey);fill:currentColor;width:22%;height:22%}.el-skeleton{--el-skeleton-color:var(--el-fill-color);--el-skeleton-to-color:var(--el-fill-color-darker)}@-webkit-keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}@keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}.el-skeleton{width:100%}.el-skeleton__first-line,.el-skeleton__paragraph{height:16px;margin-top:16px;background:var(--el-skeleton-color)}.el-skeleton.is-animated .el-skeleton__item{background:linear-gradient(90deg,var(--el-skeleton-color) 25%,var(--el-skeleton-to-color) 37%,var(--el-skeleton-color) 63%);background-size:400% 100%;-webkit-animation:el-skeleton-loading 1.4s ease infinite;animation:el-skeleton-loading 1.4s ease infinite}.el-slider{--el-slider-main-bg-color:var(--el-color-primary);--el-slider-runway-bg-color:var(--el-border-color-light);--el-slider-stop-bg-color:var(--el-color-white);--el-slider-disabled-color:var(--el-text-color-placeholder);--el-slider-border-radius:3px;--el-slider-height:6px;--el-slider-button-size:20px;--el-slider-button-wrapper-size:36px;--el-slider-button-wrapper-offset:-15px}.el-slider{width:100%;height:32px;display:flex;align-items:center}.el-slider__runway{flex:1;height:var(--el-slider-height);background-color:var(--el-slider-runway-bg-color);border-radius:var(--el-slider-border-radius);position:relative;cursor:pointer}.el-slider__runway.show-input{margin-right:30px;width:auto}.el-slider__runway.is-disabled{cursor:default}.el-slider__runway.is-disabled .el-slider__bar{background-color:var(--el-slider-disabled-color)}.el-slider__runway.is-disabled .el-slider__button{border-color:var(--el-slider-disabled-color)}.el-slider__runway.is-disabled .el-slider__button-wrapper.hover,.el-slider__runway.is-disabled .el-slider__button-wrapper:hover,.el-slider__runway.is-disabled .el-slider__button-wrapper.dragging{cursor:not-allowed}.el-slider__runway.is-disabled .el-slider__button.dragging,.el-slider__runway.is-disabled .el-slider__button.hover,.el-slider__runway.is-disabled .el-slider__button:hover{transform:scale(1)}.el-slider__runway.is-disabled .el-slider__button.hover,.el-slider__runway.is-disabled .el-slider__button:hover,.el-slider__runway.is-disabled .el-slider__button.dragging{cursor:not-allowed}.el-slider__input{flex-shrink:0;width:130px}.el-slider__bar{height:var(--el-slider-height);background-color:var(--el-slider-main-bg-color);border-top-left-radius:var(--el-slider-border-radius);border-bottom-left-radius:var(--el-slider-border-radius);position:absolute}.el-slider__button-wrapper{height:var(--el-slider-button-wrapper-size);width:var(--el-slider-button-wrapper-size);position:absolute;z-index:1;top:var(--el-slider-button-wrapper-offset);transform:translate(-50%);background-color:transparent;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:normal;outline:0}.el-slider__button-wrapper:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-slider__button-wrapper.hover,.el-slider__button-wrapper:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button-wrapper.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__button{display:inline-block;width:var(--el-slider-button-size);height:var(--el-slider-button-size);vertical-align:middle;border:solid 2px var(--el-slider-main-bg-color);background-color:var(--el-color-white);border-radius:50%;box-sizing:border-box;transition:var(--el-transition-duration-fast);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-slider__button.dragging,.el-slider__button.hover,.el-slider__button:hover{transform:scale(1.2)}.el-slider__button.hover,.el-slider__button:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__stop{position:absolute;height:var(--el-slider-height);width:var(--el-slider-height);border-radius:var(--el-border-radius-circle);background-color:var(--el-slider-stop-bg-color);transform:translate(-50%)}.el-slider__marks{top:0;left:12px;width:18px;height:100%}.el-slider__marks-text{position:absolute;transform:translate(-50%);font-size:14px;color:var(--el-color-info);margin-top:15px;white-space:pre}.el-slider.is-vertical{position:relative;display:inline-flex;width:auto;height:100%;flex:0}.el-slider.is-vertical .el-slider__runway{width:var(--el-slider-height);height:100%;margin:0 16px}.el-slider.is-vertical .el-slider__bar{width:var(--el-slider-height);height:auto;border-radius:0 0 3px 3px}.el-slider.is-vertical .el-slider__button-wrapper{top:auto;left:var(--el-slider-button-wrapper-offset);transform:translateY(50%)}.el-slider.is-vertical .el-slider__stop{transform:translateY(50%)}.el-slider.is-vertical .el-slider__marks-text{margin-top:0;left:15px;transform:translateY(50%)}.el-slider--large{height:40px}.el-slider--small{height:24px}.el-space{display:inline-flex;vertical-align:top}.el-space__item{display:flex;flex-wrap:wrap}.el-space__item>*{flex:1}.el-space--vertical{flex-direction:column}.el-time-spinner{width:100%;white-space:nowrap}.el-spinner{display:inline-block;vertical-align:middle}.el-spinner-inner{-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite;width:50px;height:50px}.el-spinner-inner .path{stroke:var(--el-border-color-lighter);stroke-linecap:round;-webkit-animation:dash 1.5s ease-in-out infinite;animation:dash 1.5s ease-in-out infinite}@-webkit-keyframes rotate{to{transform:rotate(360deg)}}@keyframes rotate{to{transform:rotate(360deg)}}@-webkit-keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}.el-step{position:relative;flex-shrink:1}.el-step:last-of-type .el-step__line{display:none}.el-step:last-of-type.is-flex{flex-basis:auto!important;flex-shrink:0;flex-grow:0}.el-step:last-of-type .el-step__description,.el-step:last-of-type .el-step__main{padding-right:0}.el-step__head{position:relative;width:100%}.el-step__head.is-process{color:var(--el-text-color-primary);border-color:var(--el-text-color-primary)}.el-step__head.is-wait{color:var(--el-text-color-placeholder);border-color:var(--el-text-color-placeholder)}.el-step__head.is-success{color:var(--el-color-success);border-color:var(--el-color-success)}.el-step__head.is-error{color:var(--el-color-danger);border-color:var(--el-color-danger)}.el-step__head.is-finish{color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-step__icon{position:relative;z-index:1;display:inline-flex;justify-content:center;align-items:center;width:24px;height:24px;font-size:14px;box-sizing:border-box;background:var(--el-bg-color);transition:.15s ease-out}.el-step__icon.is-text{border-radius:50%;border:2px solid;border-color:inherit}.el-step__icon.is-icon{width:40px}.el-step__icon-inner{display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:center;font-weight:700;line-height:1;color:inherit}.el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:25px;font-weight:400}.el-step__icon-inner.is-status{transform:translateY(1px)}.el-step__line{position:absolute;border-color:inherit;background-color:var(--el-text-color-placeholder)}.el-step__line-inner{display:block;border-width:1px;border-style:solid;border-color:inherit;transition:.15s ease-out;box-sizing:border-box;width:0;height:0}.el-step__main{white-space:normal;text-align:left}.el-step__title{font-size:16px;line-height:38px}.el-step__title.is-process{font-weight:700;color:var(--el-text-color-primary)}.el-step__title.is-wait{color:var(--el-text-color-placeholder)}.el-step__title.is-success{color:var(--el-color-success)}.el-step__title.is-error{color:var(--el-color-danger)}.el-step__title.is-finish{color:var(--el-color-primary)}.el-step__description{padding-right:10%;margin-top:-5px;font-size:12px;line-height:20px;font-weight:400}.el-step__description.is-process{color:var(--el-text-color-primary)}.el-step__description.is-wait{color:var(--el-text-color-placeholder)}.el-step__description.is-success{color:var(--el-color-success)}.el-step__description.is-error{color:var(--el-color-danger)}.el-step__description.is-finish{color:var(--el-color-primary)}.el-step.is-horizontal{display:inline-block}.el-step.is-horizontal .el-step__line{height:2px;top:11px;left:0;right:0}.el-step.is-vertical{display:flex}.el-step.is-vertical .el-step__head{flex-grow:0;width:24px}.el-step.is-vertical .el-step__main{padding-left:10px;flex-grow:1}.el-step.is-vertical .el-step__title{line-height:24px;padding-bottom:8px}.el-step.is-vertical .el-step__line{width:2px;top:0;bottom:0;left:11px}.el-step.is-vertical .el-step__icon.is-icon{width:24px}.el-step.is-center .el-step__head,.el-step.is-center .el-step__main{text-align:center}.el-step.is-center .el-step__description{padding-left:20%;padding-right:20%}.el-step.is-center .el-step__line{left:50%;right:-50%}.el-step.is-simple{display:flex;align-items:center}.el-step.is-simple .el-step__head{width:auto;font-size:0;padding-right:10px}.el-step.is-simple .el-step__icon{background:0 0;width:16px;height:16px;font-size:12px}.el-step.is-simple .el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:18px}.el-step.is-simple .el-step__icon-inner.is-status{transform:scale(.8) translateY(1px)}.el-step.is-simple .el-step__main{position:relative;display:flex;align-items:stretch;flex-grow:1}.el-step.is-simple .el-step__title{font-size:16px;line-height:20px}.el-step.is-simple:not(:last-of-type) .el-step__title{max-width:50%;word-break:break-all}.el-step.is-simple .el-step__arrow{flex-grow:1;display:flex;align-items:center;justify-content:center}.el-step.is-simple .el-step__arrow:after,.el-step.is-simple .el-step__arrow:before{content:"";display:inline-block;position:absolute;height:15px;width:1px;background:var(--el-text-color-placeholder)}.el-step.is-simple .el-step__arrow:before{transform:rotate(-45deg) translateY(-4px);transform-origin:0 0}.el-step.is-simple .el-step__arrow:after{transform:rotate(45deg) translateY(4px);transform-origin:100% 100%}.el-step.is-simple:last-of-type .el-step__arrow{display:none}.el-steps{display:flex}.el-steps--simple{padding:13px 8%;border-radius:4px;background:var(--el-fill-color-light)}.el-steps--horizontal{white-space:nowrap}.el-steps--vertical{height:100%;flex-flow:column}.el-switch{--el-switch-on-color:var(--el-color-primary);--el-switch-off-color:var(--el-border-color)}.el-switch{display:inline-flex;align-items:center;position:relative;font-size:14px;line-height:20px;height:32px;vertical-align:middle}.el-switch.is-disabled .el-switch__core,.el-switch.is-disabled .el-switch__label{cursor:not-allowed}.el-switch__label{transition:var(--el-transition-duration-fast);height:20px;display:inline-block;font-size:14px;font-weight:500;cursor:pointer;vertical-align:middle;color:var(--el-text-color-primary)}.el-switch__label.is-active{color:var(--el-color-primary)}.el-switch__label--left{margin-right:10px}.el-switch__label--right{margin-left:10px}.el-switch__label *{line-height:1;font-size:14px;display:inline-block}.el-switch__label .el-icon{height:inherit}.el-switch__label .el-icon svg{vertical-align:middle}.el-switch__input{position:absolute;width:0;height:0;opacity:0;margin:0}.el-switch__input:focus-visible~.el-switch__core{outline:2px solid var(--el-switch-on-color);outline-offset:1px}.el-switch__core{display:inline-flex;position:relative;align-items:center;min-width:40px;height:20px;border:1px solid var(--el-switch-border-color,var(--el-switch-off-color));outline:0;border-radius:10px;box-sizing:border-box;background:var(--el-switch-off-color);cursor:pointer;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration)}.el-switch__core .el-switch__inner{width:100%;transition:all var(--el-transition-duration);height:16px;display:flex;justify-content:center;align-items:center;overflow:hidden;padding:0 4px 0 18px}.el-switch__core .el-switch__inner .is-icon,.el-switch__core .el-switch__inner .is-text{font-size:12px;color:var(--el-color-white);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-switch__core .el-switch__action{position:absolute;left:1px;border-radius:var(--el-border-radius-circle);transition:all var(--el-transition-duration);width:16px;height:16px;background-color:var(--el-color-white);display:flex;justify-content:center;align-items:center;color:var(--el-switch-off-color)}.el-switch.is-checked .el-switch__core{border-color:var(--el-switch-border-color,var(--el-switch-on-color));background-color:var(--el-switch-on-color)}.el-switch.is-checked .el-switch__core .el-switch__action{left:calc(100% - 17px);color:var(--el-switch-on-color)}.el-switch.is-checked .el-switch__core .el-switch__inner{padding:0 18px 0 4px}.el-switch.is-disabled{opacity:.6}.el-switch--wide .el-switch__label.el-switch__label--left span{left:10px}.el-switch--wide .el-switch__label.el-switch__label--right span{right:10px}.el-switch .label-fade-enter-from,.el-switch .label-fade-leave-active{opacity:0}.el-switch--large{font-size:14px;line-height:24px;height:40px}.el-switch--large .el-switch__label{height:24px;font-size:14px}.el-switch--large .el-switch__label *{font-size:14px}.el-switch--large .el-switch__core{min-width:50px;height:24px;border-radius:12px}.el-switch--large .el-switch__core .el-switch__inner{height:20px;padding:0 6px 0 22px}.el-switch--large .el-switch__core .el-switch__action{width:20px;height:20px}.el-switch--large.is-checked .el-switch__core .el-switch__action{left:calc(100% - 21px)}.el-switch--large.is-checked .el-switch__core .el-switch__inner{padding:0 22px 0 6px}.el-switch--small{font-size:12px;line-height:16px;height:24px}.el-switch--small .el-switch__label{height:16px;font-size:12px}.el-switch--small .el-switch__label *{font-size:12px}.el-switch--small .el-switch__core{min-width:30px;height:16px;border-radius:8px}.el-switch--small .el-switch__core .el-switch__inner{height:12px;padding:0 2px 0 14px}.el-switch--small .el-switch__core .el-switch__action{width:12px;height:12px}.el-switch--small.is-checked .el-switch__core .el-switch__action{left:calc(100% - 13px)}.el-switch--small.is-checked .el-switch__core .el-switch__inner{padding:0 14px 0 2px}.el-table-column--selection .cell{padding-left:14px;padding-right:14px}.el-table-filter{border:solid 1px var(--el-border-color-lighter);border-radius:2px;background-color:#fff;box-shadow:var(--el-box-shadow-light);box-sizing:border-box}.el-table-filter__list{padding:5px 0;margin:0;list-style:none;min-width:100px}.el-table-filter__list-item{line-height:36px;padding:0 10px;cursor:pointer;font-size:var(--el-font-size-base)}.el-table-filter__list-item:hover{background-color:var(--el-color-primary-light-9);color:var(--el-color-primary)}.el-table-filter__list-item.is-active{background-color:var(--el-color-primary);color:#fff}.el-table-filter__content{min-width:100px}.el-table-filter__bottom{border-top:1px solid var(--el-border-color-lighter);padding:8px}.el-table-filter__bottom button{background:0 0;border:none;color:var(--el-text-color-regular);cursor:pointer;font-size:var(--el-font-size-small);padding:0 3px}.el-table-filter__bottom button:hover{color:var(--el-color-primary)}.el-table-filter__bottom button:focus{outline:0}.el-table-filter__bottom button.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-table-filter__wrap{max-height:280px}.el-table-filter__checkbox-group{padding:10px}.el-table-filter__checkbox-group label.el-checkbox{display:flex;align-items:center;margin-right:5px;margin-bottom:12px;margin-left:5px;height:unset}.el-table-filter__checkbox-group .el-checkbox:last-child{margin-bottom:0}.el-table{--el-table-border-color:var(--el-border-color-lighter);--el-table-border:1px solid var(--el-table-border-color);--el-table-text-color:var(--el-text-color-regular);--el-table-header-text-color:var(--el-text-color-secondary);--el-table-row-hover-bg-color:var(--el-fill-color-light);--el-table-current-row-bg-color:var(--el-color-primary-light-9);--el-table-header-bg-color:var(--el-bg-color);--el-table-fixed-box-shadow:var(--el-box-shadow-light);--el-table-bg-color:var(--el-fill-color-blank);--el-table-tr-bg-color:var(--el-fill-color-blank);--el-table-expanded-cell-bg-color:var(--el-fill-color-blank);--el-table-fixed-left-column:inset 10px 0 10px -10px rgba(0, 0, 0, .15);--el-table-fixed-right-column:inset -10px 0 10px -10px rgba(0, 0, 0, .15)}.el-table{position:relative;overflow:hidden;box-sizing:border-box;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:100%;max-width:100%;background-color:var(--el-table-bg-color);font-size:14px;color:var(--el-table-text-color)}.el-table__inner-wrapper{position:relative;display:flex;flex-direction:column;height:100%}.el-table__inner-wrapper:before{left:0;bottom:0;width:100%;height:1px}.el-table.has-footer.el-table--fluid-height tr:last-child td.el-table__cell,.el-table.has-footer.el-table--scrollable-y tr:last-child td.el-table__cell{border-bottom-color:transparent}.el-table__empty-block{position:-webkit-sticky;position:sticky;left:0;min-height:60px;text-align:center;width:100%;display:flex;justify-content:center;align-items:center}.el-table__empty-text{line-height:60px;width:50%;color:var(--el-text-color-secondary)}.el-table__expand-column .cell{padding:0;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-table__expand-icon{position:relative;cursor:pointer;color:var(--el-text-color-regular);font-size:12px;transition:transform var(--el-transition-duration-fast) ease-in-out;height:20px}.el-table__expand-icon--expanded{transform:rotate(90deg)}.el-table__expand-icon>.el-icon{font-size:12px}.el-table__expanded-cell{background-color:var(--el-table-expanded-cell-bg-color)}.el-table__expanded-cell[class*=cell]{padding:20px 50px}.el-table__expanded-cell:hover{background-color:transparent!important}.el-table__placeholder{display:inline-block;width:20px}.el-table__append-wrapper{overflow:hidden}.el-table--fit{border-right:0;border-bottom:0}.el-table--fit .el-table__cell.gutter{border-right-width:1px}.el-table thead{color:var(--el-table-header-text-color);font-weight:500}.el-table thead.is-group th.el-table__cell{background:var(--el-fill-color-light)}.el-table .el-table__cell{padding:8px 0;min-width:0;box-sizing:border-box;text-overflow:ellipsis;vertical-align:middle;position:relative;text-align:left;z-index:1}.el-table .el-table__cell.is-center{text-align:center}.el-table .el-table__cell.is-right{text-align:right}.el-table .el-table__cell.gutter{width:15px;border-right-width:0;border-bottom-width:0;padding:0}.el-table .el-table__cell.is-hidden>*{visibility:hidden}.el-table .cell{box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:normal;word-break:break-all;line-height:23px;padding:0 12px}.el-table .cell.el-tooltip{white-space:nowrap;min-width:50px}.el-table--large{font-size:var(--el-font-size-base)}.el-table--large .el-table__cell{padding:12px 0}.el-table--large .cell{padding:0 16px}.el-table--default{font-size:14px}.el-table--default .el-table__cell{padding:8px 0}.el-table--default .cell{padding:0 12px}.el-table--small{font-size:12px}.el-table--small .el-table__cell{padding:4px 0}.el-table--small .cell{padding:0 8px}.el-table tr{background-color:var(--el-table-tr-bg-color)}.el-table tr input[type=checkbox]{margin:0}.el-table td.el-table__cell,.el-table th.el-table__cell.is-leaf{border-bottom:var(--el-table-border)}.el-table th.el-table__cell.is-sortable{cursor:pointer}.el-table th.el-table__cell{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:var(--el-table-header-bg-color)}.el-table th.el-table__cell>.cell.highlight{color:var(--el-color-primary)}.el-table th.el-table__cell.required>div:before{display:inline-block;content:"";width:8px;height:8px;border-radius:50%;background:#ff4d51;margin-right:5px;vertical-align:middle}.el-table td.el-table__cell div{box-sizing:border-box}.el-table td.el-table__cell.gutter{width:0}.el-table__footer-wrapper{border-top:var(--el-table-border)}.el-table--border .el-table__inner-wrapper:after,.el-table--border:after,.el-table--border:before,.el-table__inner-wrapper:before{content:"";position:absolute;background-color:var(--el-table-border-color);z-index:3}.el-table--border .el-table__inner-wrapper:after{left:0;top:0;width:100%;height:1px}.el-table--border:before{top:-1px;left:0;width:1px;height:100%}.el-table--border:after{top:-1px;right:0;width:1px;height:100%}.el-table--border .el-table__inner-wrapper{border-right:none;border-bottom:none}.el-table--border .el-table__footer-wrapper{position:relative;flex-shrink:0}.el-table--border .el-table__cell{border-right:var(--el-table-border)}.el-table--border th.el-table__cell.gutter:last-of-type{border-bottom:var(--el-table-border);border-bottom-width:1px}.el-table--border th.el-table__cell{border-bottom:var(--el-table-border)}.el-table--hidden{visibility:hidden}.el-table__body-wrapper,.el-table__footer-wrapper,.el-table__header-wrapper{width:100%}.el-table__body-wrapper tr td.el-table-fixed-column--left,.el-table__body-wrapper tr td.el-table-fixed-column--right,.el-table__body-wrapper tr th.el-table-fixed-column--left,.el-table__body-wrapper tr th.el-table-fixed-column--right,.el-table__footer-wrapper tr td.el-table-fixed-column--left,.el-table__footer-wrapper tr td.el-table-fixed-column--right,.el-table__footer-wrapper tr th.el-table-fixed-column--left,.el-table__footer-wrapper tr th.el-table-fixed-column--right,.el-table__header-wrapper tr td.el-table-fixed-column--left,.el-table__header-wrapper tr td.el-table-fixed-column--right,.el-table__header-wrapper tr th.el-table-fixed-column--left,.el-table__header-wrapper tr th.el-table-fixed-column--right{position:-webkit-sticky!important;position:sticky!important;z-index:2;background:var(--el-bg-color)}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-last-column:before{content:"";position:absolute;top:0;width:10px;bottom:-1px;overflow-x:hidden;overflow-y:hidden;box-shadow:none;touch-action:none;pointer-events:none}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-first-column:before{left:-10px}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-last-column:before{right:-10px;box-shadow:none}.el-table__body-wrapper tr td.el-table__fixed-right-patch,.el-table__body-wrapper tr th.el-table__fixed-right-patch,.el-table__footer-wrapper tr td.el-table__fixed-right-patch,.el-table__footer-wrapper tr th.el-table__fixed-right-patch,.el-table__header-wrapper tr td.el-table__fixed-right-patch,.el-table__header-wrapper tr th.el-table__fixed-right-patch{position:-webkit-sticky!important;position:sticky!important;z-index:2;background:#fff;right:0}.el-table__header-wrapper{flex-shrink:0}.el-table__header-wrapper tr th.el-table-fixed-column--left,.el-table__header-wrapper tr th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table__body,.el-table__footer,.el-table__header{table-layout:fixed;border-collapse:separate}.el-table__footer-wrapper,.el-table__header-wrapper{overflow:hidden}.el-table__footer-wrapper tbody td.el-table__cell,.el-table__header-wrapper tbody td.el-table__cell{background-color:var(--el-table-row-hover-bg-color);color:var(--el-table-text-color)}.el-table__body-wrapper .el-table-column--selection>.cell,.el-table__header-wrapper .el-table-column--selection>.cell{display:inline-flex;align-items:center;height:23px}.el-table__body-wrapper .el-table-column--selection .el-checkbox,.el-table__header-wrapper .el-table-column--selection .el-checkbox{height:unset}.el-table.is-scrolling-left .el-table-fixed-column--right.is-first-column:before{box-shadow:var(--el-table-fixed-right-column)}.el-table.is-scrolling-left.el-table--border .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:var(--el-table-border)}.el-table.is-scrolling-left th.el-table-fixed-column--left{background-color:var(--el-table-header-bg-color)}.el-table.is-scrolling-right .el-table-fixed-column--left.is-last-column:before{box-shadow:var(--el-table-fixed-left-column)}.el-table.is-scrolling-right .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:none}.el-table.is-scrolling-right th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table.is-scrolling-middle .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:none}.el-table.is-scrolling-middle .el-table-fixed-column--right.is-first-column:before{box-shadow:var(--el-table-fixed-right-column)}.el-table.is-scrolling-middle .el-table-fixed-column--left.is-last-column:before{box-shadow:var(--el-table-fixed-left-column)}.el-table.is-scrolling-none .el-table-fixed-column--left.is-first-column:before,.el-table.is-scrolling-none .el-table-fixed-column--left.is-last-column:before,.el-table.is-scrolling-none .el-table-fixed-column--right.is-first-column:before,.el-table.is-scrolling-none .el-table-fixed-column--right.is-last-column:before{box-shadow:none}.el-table.is-scrolling-none th.el-table-fixed-column--left,.el-table.is-scrolling-none th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table__body-wrapper{overflow:hidden;position:relative;flex:1}.el-table__body-wrapper .el-scrollbar__bar{z-index:2}.el-table .caret-wrapper{display:inline-flex;flex-direction:column;align-items:center;height:14px;width:24px;vertical-align:middle;cursor:pointer;overflow:initial;position:relative}.el-table .sort-caret{width:0;height:0;border:solid 5px transparent;position:absolute;left:7px}.el-table .sort-caret.ascending{border-bottom-color:var(--el-text-color-placeholder);top:-5px}.el-table .sort-caret.descending{border-top-color:var(--el-text-color-placeholder);bottom:-3px}.el-table .ascending .sort-caret.ascending{border-bottom-color:var(--el-color-primary)}.el-table .descending .sort-caret.descending{border-top-color:var(--el-color-primary)}.el-table .hidden-columns{visibility:hidden;position:absolute;z-index:-1}.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{background:var(--el-fill-color-lighter)}.el-table--striped .el-table__body tr.el-table__row--striped.current-row td.el-table__cell{background-color:var(--el-table-current-row-bg-color)}.el-table__body tr.hover-row.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped>td.el-table__cell,.el-table__body tr.hover-row>td.el-table__cell{background-color:var(--el-table-row-hover-bg-color)}.el-table__body tr.current-row>td.el-table__cell{background-color:var(--el-table-current-row-bg-color)}.el-table__column-resize-proxy{position:absolute;left:200px;top:0;bottom:0;width:0;border-left:var(--el-table-border);z-index:10}.el-table__column-filter-trigger{display:inline-block;cursor:pointer}.el-table__column-filter-trigger i{color:var(--el-color-info);font-size:14px;vertical-align:middle}.el-table__border-left-patch{top:0;left:0;width:1px;height:100%;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table__border-bottom-patch{left:0;height:1px;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table__border-right-patch{top:0;height:100%;width:1px;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table--enable-row-transition .el-table__body td.el-table__cell{transition:background-color .25s ease}.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{background-color:var(--el-table-row-hover-bg-color)}.el-table [class*=el-table__row--level] .el-table__expand-icon{display:inline-block;width:12px;line-height:12px;height:12px;text-align:center;margin-right:8px}.el-table .el-table.el-table--border .el-table__cell{border-right:var(--el-table-border)}.el-table:not(.el-table--border) .el-table__cell{border-right:none}.el-table:not(.el-table--border)>.el-table__inner-wrapper:after{content:none}.el-table-v2{--el-table-border-color:var(--el-border-color-lighter);--el-table-border:1px solid var(--el-table-border-color);--el-table-text-color:var(--el-text-color-regular);--el-table-header-text-color:var(--el-text-color-secondary);--el-table-row-hover-bg-color:var(--el-fill-color-light);--el-table-current-row-bg-color:var(--el-color-primary-light-9);--el-table-header-bg-color:var(--el-bg-color);--el-table-fixed-box-shadow:var(--el-box-shadow-light);--el-table-bg-color:var(--el-fill-color-blank);--el-table-tr-bg-color:var(--el-fill-color-blank);--el-table-expanded-cell-bg-color:var(--el-fill-color-blank);--el-table-fixed-left-column:inset 10px 0 10px -10px rgba(0, 0, 0, .15);--el-table-fixed-right-column:inset -10px 0 10px -10px rgba(0, 0, 0, .15)}.el-table-v2{font-size:14px}.el-table-v2 *{box-sizing:border-box}.el-table-v2__root{position:relative}.el-table-v2__root:hover .el-table-v2__main .el-virtual-scrollbar{opacity:1}.el-table-v2__main{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);left:0}.el-table-v2__main .el-vl__horizontal,.el-table-v2__main .el-vl__vertical{z-index:2}.el-table-v2__left{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);left:0;box-shadow:2px 0 4px #0000000f}.el-table-v2__left .el-virtual-scrollbar{opacity:0}.el-table-v2__left .el-vl__horizontal,.el-table-v2__left .el-vl__vertical{z-index:-1}.el-table-v2__right{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);right:0;box-shadow:-2px 0 4px #0000000f}.el-table-v2__right .el-virtual-scrollbar{opacity:0}.el-table-v2__right .el-vl__horizontal,.el-table-v2__right .el-vl__vertical{z-index:-1}.el-table-v2__header-row,.el-table-v2__row{-webkit-padding-end:var(--el-table-scrollbar-size);padding-inline-end:var(--el-table-scrollbar-size)}.el-table-v2__header-wrapper{overflow:hidden}.el-table-v2__header{position:relative;overflow:hidden}.el-table-v2__footer{position:absolute;left:0;right:0;bottom:0;overflow:hidden}.el-table-v2__empty{position:absolute;left:0}.el-table-v2__overlay{position:absolute;left:0;right:0;top:0;bottom:0;z-index:9999}.el-table-v2__header-row{display:flex;border-bottom:var(--el-table-border)}.el-table-v2__header-cell{display:flex;align-items:center;padding:0 8px;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;background-color:var(--el-table-header-bg-color);color:var(--el-table-header-text-color);font-weight:700}.el-table-v2__header-cell.is-align-center{justify-content:center;text-align:center}.el-table-v2__header-cell.is-align-right{justify-content:flex-end;text-align:right}.el-table-v2__header-cell.is-sortable{cursor:pointer}.el-table-v2__header-cell:hover .el-icon{display:block}.el-table-v2__sort-icon{transition:opacity,display var(--el-transition-duration);opacity:.6;display:none}.el-table-v2__sort-icon.is-sorting{display:block;opacity:1}.el-table-v2__row{border-bottom:var(--el-table-border);display:flex;align-items:center;transition:background-color var(--el-transition-duration)}.el-table-v2__row.is-hovered,.el-table-v2__row:hover{background-color:var(--el-table-row-hover-bg-color)}.el-table-v2__row-cell{height:100%;overflow:hidden;display:flex;align-items:center;padding:0 8px}.el-table-v2__row-cell.is-align-center{justify-content:center;text-align:center}.el-table-v2__row-cell.is-align-right{justify-content:flex-end;text-align:right}.el-table-v2__expand-icon{margin:0 4px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-table-v2__expand-icon svg{transition:transform var(--el-transition-duration)}.el-table-v2__expand-icon.is-expanded svg{transform:rotate(90deg)}.el-table-v2:not(.is-dynamic) .el-table-v2__cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-table-v2.is-dynamic .el-table-v2__row{overflow:hidden;align-items:stretch}.el-table-v2.is-dynamic .el-table-v2__row .el-table-v2__row-cell{word-break:break-all}.el-tabs{--el-tabs-header-height:40px}.el-tabs__header{padding:0;position:relative;margin:0 0 15px}.el-tabs__active-bar{position:absolute;bottom:0;left:0;height:2px;background-color:var(--el-color-primary);z-index:1;transition:width var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier),transform var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);list-style:none}.el-tabs__new-tab{display:flex;align-items:center;justify-content:center;float:right;border:1px solid var(--el-border-color);height:20px;width:20px;line-height:20px;margin:10px 0 10px 10px;border-radius:3px;text-align:center;font-size:12px;color:var(--el-text-color-primary);cursor:pointer;transition:all .15s}.el-tabs__new-tab .is-icon-plus{height:inherit;width:inherit;transform:scale(.8)}.el-tabs__new-tab .is-icon-plus svg{vertical-align:middle}.el-tabs__new-tab:hover{color:var(--el-color-primary)}.el-tabs__nav-wrap{overflow:hidden;margin-bottom:-1px;position:relative}.el-tabs__nav-wrap:after{content:"";position:absolute;left:0;bottom:0;width:100%;height:2px;background-color:var(--el-border-color-light);z-index:var(--el-index-normal)}.el-tabs__nav-wrap.is-scrollable{padding:0 20px;box-sizing:border-box}.el-tabs__nav-scroll{overflow:hidden}.el-tabs__nav-next,.el-tabs__nav-prev{position:absolute;cursor:pointer;line-height:44px;font-size:12px;color:var(--el-text-color-secondary);width:20px;text-align:center}.el-tabs__nav-next{right:0}.el-tabs__nav-prev{left:0}.el-tabs__nav{display:flex;white-space:nowrap;position:relative;transition:transform var(--el-transition-duration);float:left;z-index:calc(var(--el-index-normal) + 1)}.el-tabs__nav.is-stretch{min-width:100%;display:flex}.el-tabs__nav.is-stretch>*{flex:1;text-align:center}.el-tabs__item{padding:0 20px;height:var(--el-tabs-header-height);box-sizing:border-box;display:flex;align-items:center;justify-content:center;list-style:none;font-size:var(--el-font-size-base);font-weight:500;color:var(--el-text-color-primary);position:relative}.el-tabs__item:focus,.el-tabs__item:focus:active{outline:0}.el-tabs__item:focus-visible{box-shadow:0 0 2px 2px var(--el-color-primary) inset;border-radius:3px}.el-tabs__item .is-icon-close{border-radius:50%;text-align:center;transition:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);margin-left:5px}.el-tabs__item .is-icon-close:before{transform:scale(.9);display:inline-block}.el-tabs__item .is-icon-close:hover{background-color:var(--el-text-color-placeholder);color:#fff}.el-tabs__item.is-active{color:var(--el-color-primary)}.el-tabs__item:hover{color:var(--el-color-primary);cursor:pointer}.el-tabs__item.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-tabs__content{overflow:hidden;position:relative}.el-tabs--card>.el-tabs__header{border-bottom:1px solid var(--el-border-color-light);height:var(--el-tabs-header-height)}.el-tabs--card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--card>.el-tabs__header .el-tabs__nav{border:1px solid var(--el-border-color-light);border-bottom:none;border-radius:4px 4px 0 0;box-sizing:border-box}.el-tabs--card>.el-tabs__header .el-tabs__active-bar{display:none}.el-tabs--card>.el-tabs__header .el-tabs__item .is-icon-close{position:relative;font-size:12px;width:0;height:14px;overflow:hidden;right:-2px;transform-origin:100% 50%}.el-tabs--card>.el-tabs__header .el-tabs__item{border-bottom:1px solid transparent;border-left:1px solid var(--el-border-color-light);transition:color var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier),padding var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier)}.el-tabs--card>.el-tabs__header .el-tabs__item:first-child{border-left:none}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover{padding-left:13px;padding-right:13px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover .is-icon-close{width:14px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active{border-bottom-color:var(--el-bg-color)}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable{padding-left:20px;padding-right:20px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable .is-icon-close{width:14px}.el-tabs--border-card{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color)}.el-tabs--border-card>.el-tabs__content{padding:15px}.el-tabs--border-card>.el-tabs__header{background-color:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color-light);margin:0}.el-tabs--border-card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--border-card>.el-tabs__header .el-tabs__item{transition:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);border:1px solid transparent;margin-top:-1px;color:var(--el-text-color-secondary)}.el-tabs--border-card>.el-tabs__header .el-tabs__item:first-child{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item+.el-tabs__item{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay);border-right-color:var(--el-border-color);border-left-color:var(--el-border-color)}.el-tabs--border-card>.el-tabs__header .el-tabs__item:not(.is-disabled):hover{color:var(--el-color-primary)}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-disabled{color:var(--el-disabled-text-color)}.el-tabs--border-card>.el-tabs__header .is-scrollable .el-tabs__item:first-child{margin-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:nth-child(2),.el-tabs--bottom .el-tabs__item.is-top:nth-child(2),.el-tabs--top .el-tabs__item.is-bottom:nth-child(2),.el-tabs--top .el-tabs__item.is-top:nth-child(2){padding-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:last-child,.el-tabs--bottom .el-tabs__item.is-top:last-child,.el-tabs--top .el-tabs__item.is-bottom:last-child,.el-tabs--top .el-tabs__item.is-top:last-child{padding-right:0}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2){padding-left:20px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover{padding-left:13px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child{padding-right:20px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover{padding-right:13px}.el-tabs--bottom .el-tabs__header.is-bottom{margin-bottom:0;margin-top:10px}.el-tabs--bottom.el-tabs--border-card .el-tabs__header.is-bottom{border-bottom:0;border-top:1px solid var(--el-border-color)}.el-tabs--bottom.el-tabs--border-card .el-tabs__nav-wrap.is-bottom{margin-top:-1px;margin-bottom:0}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom:not(.is-active){border:1px solid transparent}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom{margin:0 -1px -1px}.el-tabs--left,.el-tabs--right{overflow:hidden}.el-tabs--left .el-tabs__header.is-left,.el-tabs--left .el-tabs__header.is-right,.el-tabs--left .el-tabs__nav-scroll,.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__header.is-left,.el-tabs--right .el-tabs__header.is-right,.el-tabs--right .el-tabs__nav-scroll,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{height:100%}.el-tabs--left .el-tabs__active-bar.is-left,.el-tabs--left .el-tabs__active-bar.is-right,.el-tabs--right .el-tabs__active-bar.is-left,.el-tabs--right .el-tabs__active-bar.is-right{top:0;bottom:auto;width:2px;height:auto}.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{margin-bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{height:30px;line-height:30px;width:100%;text-align:center;cursor:pointer}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i{transform:rotate(90deg)}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{left:auto;top:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next{right:auto;bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--left .el-tabs__nav-wrap.is-right.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-right.is-scrollable{padding:30px 0}.el-tabs--left .el-tabs__nav-wrap.is-left:after,.el-tabs--left .el-tabs__nav-wrap.is-right:after,.el-tabs--right .el-tabs__nav-wrap.is-left:after,.el-tabs--right .el-tabs__nav-wrap.is-right:after{height:100%;width:2px;bottom:auto;top:0}.el-tabs--left .el-tabs__nav.is-left,.el-tabs--left .el-tabs__nav.is-right,.el-tabs--right .el-tabs__nav.is-left,.el-tabs--right .el-tabs__nav.is-right{flex-direction:column}.el-tabs--left .el-tabs__item.is-left,.el-tabs--right .el-tabs__item.is-left{justify-content:flex-end}.el-tabs--left .el-tabs__item.is-right,.el-tabs--right .el-tabs__item.is-right{justify-content:flex-start}.el-tabs--left .el-tabs__header.is-left{float:left;margin-bottom:0;margin-right:10px}.el-tabs--left .el-tabs__nav-wrap.is-left{margin-right:-1px}.el-tabs--left .el-tabs__nav-wrap.is-left:after{left:auto;right:0}.el-tabs--left .el-tabs__active-bar.is-left{right:0;left:auto}.el-tabs--left .el-tabs__item.is-left{text-align:right}.el-tabs--left.el-tabs--card .el-tabs__active-bar.is-left{display:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left{border-left:none;border-right:1px solid var(--el-border-color-light);border-bottom:none;border-top:1px solid var(--el-border-color-light);text-align:left}.el-tabs--left.el-tabs--card .el-tabs__item.is-left:first-child{border-right:1px solid var(--el-border-color-light);border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active{border:1px solid var(--el-border-color-light);border-right-color:#fff;border-left:none;border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:first-child{border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:last-child{border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__nav{border-radius:4px 0 0 4px;border-bottom:1px solid var(--el-border-color-light);border-right:none}.el-tabs--left.el-tabs--card .el-tabs__new-tab{float:none}.el-tabs--left.el-tabs--border-card .el-tabs__header.is-left{border-right:1px solid var(--el-border-color)}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left{border:1px solid transparent;margin:-1px 0 -1px -1px}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.el-tabs--right .el-tabs__header.is-right{float:right;margin-bottom:0;margin-left:10px}.el-tabs--right .el-tabs__nav-wrap.is-right{margin-left:-1px}.el-tabs--right .el-tabs__nav-wrap.is-right:after{left:0;right:auto}.el-tabs--right .el-tabs__active-bar.is-right{left:0}.el-tabs--right.el-tabs--card .el-tabs__active-bar.is-right{display:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right{border-bottom:none;border-top:1px solid var(--el-border-color-light)}.el-tabs--right.el-tabs--card .el-tabs__item.is-right:first-child{border-left:1px solid var(--el-border-color-light);border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active{border:1px solid var(--el-border-color-light);border-left-color:#fff;border-right:none;border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:first-child{border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:last-child{border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__nav{border-radius:0 4px 4px 0;border-bottom:1px solid var(--el-border-color-light);border-left:none}.el-tabs--right.el-tabs--border-card .el-tabs__header.is-right{border-left:1px solid var(--el-border-color)}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right{border:1px solid transparent;margin:-1px -1px -1px 0}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.slideInLeft-transition,.slideInRight-transition{display:inline-block}.slideInRight-enter{-webkit-animation:slideInRight-enter var(--el-transition-duration);animation:slideInRight-enter var(--el-transition-duration)}.slideInRight-leave{position:absolute;left:0;right:0;-webkit-animation:slideInRight-leave var(--el-transition-duration);animation:slideInRight-leave var(--el-transition-duration)}.slideInLeft-enter{-webkit-animation:slideInLeft-enter var(--el-transition-duration);animation:slideInLeft-enter var(--el-transition-duration)}.slideInLeft-leave{position:absolute;left:0;right:0;-webkit-animation:slideInLeft-leave var(--el-transition-duration);animation:slideInLeft-leave var(--el-transition-duration)}@-webkit-keyframes slideInRight-enter{0%{opacity:0;transform-origin:0 0;transform:translate(100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@keyframes slideInRight-enter{0%{opacity:0;transform-origin:0 0;transform:translate(100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@-webkit-keyframes slideInRight-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(100%);opacity:0}}@keyframes slideInRight-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(100%);opacity:0}}@-webkit-keyframes slideInLeft-enter{0%{opacity:0;transform-origin:0 0;transform:translate(-100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@keyframes slideInLeft-enter{0%{opacity:0;transform-origin:0 0;transform:translate(-100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@-webkit-keyframes slideInLeft-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(-100%);opacity:0}}@keyframes slideInLeft-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(-100%);opacity:0}}.el-tag{--el-tag-font-size:12px;--el-tag-border-radius:4px;--el-tag-border-radius-rounded:9999px}.el-tag{--el-tag-bg-color:var(--el-color-primary-light-9);--el-tag-border-color:var(--el-color-primary-light-8);--el-tag-hover-color:var(--el-color-primary);--el-tag-text-color:var(--el-color-primary);background-color:var(--el-tag-bg-color);border-color:var(--el-tag-border-color);color:var(--el-tag-text-color);display:inline-flex;justify-content:center;align-items:center;height:24px;padding:0 9px;font-size:var(--el-tag-font-size);line-height:1;border-width:1px;border-style:solid;border-radius:var(--el-tag-border-radius);box-sizing:border-box;white-space:nowrap;--el-icon-size:14px}.el-tag.el-tag--primary{--el-tag-bg-color:var(--el-color-primary-light-9);--el-tag-border-color:var(--el-color-primary-light-8);--el-tag-hover-color:var(--el-color-primary)}.el-tag.el-tag--success{--el-tag-bg-color:var(--el-color-success-light-9);--el-tag-border-color:var(--el-color-success-light-8);--el-tag-hover-color:var(--el-color-success)}.el-tag.el-tag--warning{--el-tag-bg-color:var(--el-color-warning-light-9);--el-tag-border-color:var(--el-color-warning-light-8);--el-tag-hover-color:var(--el-color-warning)}.el-tag.el-tag--danger{--el-tag-bg-color:var(--el-color-danger-light-9);--el-tag-border-color:var(--el-color-danger-light-8);--el-tag-hover-color:var(--el-color-danger)}.el-tag.el-tag--error{--el-tag-bg-color:var(--el-color-error-light-9);--el-tag-border-color:var(--el-color-error-light-8);--el-tag-hover-color:var(--el-color-error)}.el-tag.el-tag--info{--el-tag-bg-color:var(--el-color-info-light-9);--el-tag-border-color:var(--el-color-info-light-8);--el-tag-hover-color:var(--el-color-info)}.el-tag.el-tag--primary{--el-tag-text-color:var(--el-color-primary)}.el-tag.el-tag--success{--el-tag-text-color:var(--el-color-success)}.el-tag.el-tag--warning{--el-tag-text-color:var(--el-color-warning)}.el-tag.el-tag--danger{--el-tag-text-color:var(--el-color-danger)}.el-tag.el-tag--error{--el-tag-text-color:var(--el-color-error)}.el-tag.el-tag--info{--el-tag-text-color:var(--el-color-info)}.el-tag.is-hit{border-color:var(--el-color-primary)}.el-tag.is-round{border-radius:var(--el-tag-border-radius-rounded)}.el-tag .el-tag__close{color:var(--el-tag-text-color)}.el-tag .el-tag__close:hover{color:var(--el-color-white);background-color:var(--el-tag-hover-color)}.el-tag .el-icon{border-radius:50%;cursor:pointer;font-size:calc(var(--el-icon-size) - 2px);height:var(--el-icon-size);width:var(--el-icon-size)}.el-tag .el-tag__close{margin-left:6px}.el-tag--dark{--el-tag-bg-color:var(--el-color-primary);--el-tag-border-color:var(--el-color-primary);--el-tag-hover-color:var(--el-color-primary-light-3);--el-tag-text-color:var(--el-color-white)}.el-tag--dark.el-tag--primary{--el-tag-bg-color:var(--el-color-primary);--el-tag-border-color:var(--el-color-primary);--el-tag-hover-color:var(--el-color-primary-light-3)}.el-tag--dark.el-tag--success{--el-tag-bg-color:var(--el-color-success);--el-tag-border-color:var(--el-color-success);--el-tag-hover-color:var(--el-color-success-light-3)}.el-tag--dark.el-tag--warning{--el-tag-bg-color:var(--el-color-warning);--el-tag-border-color:var(--el-color-warning);--el-tag-hover-color:var(--el-color-warning-light-3)}.el-tag--dark.el-tag--danger{--el-tag-bg-color:var(--el-color-danger);--el-tag-border-color:var(--el-color-danger);--el-tag-hover-color:var(--el-color-danger-light-3)}.el-tag--dark.el-tag--error{--el-tag-bg-color:var(--el-color-error);--el-tag-border-color:var(--el-color-error);--el-tag-hover-color:var(--el-color-error-light-3)}.el-tag--dark.el-tag--info{--el-tag-bg-color:var(--el-color-info);--el-tag-border-color:var(--el-color-info);--el-tag-hover-color:var(--el-color-info-light-3)}.el-tag--dark.el-tag--primary,.el-tag--dark.el-tag--success,.el-tag--dark.el-tag--warning,.el-tag--dark.el-tag--danger,.el-tag--dark.el-tag--error,.el-tag--dark.el-tag--info{--el-tag-text-color:var(--el-color-white)}.el-tag--plain{--el-tag-border-color:var(--el-color-primary-light-5);--el-tag-hover-color:var(--el-color-primary);--el-tag-bg-color:var(--el-fill-color-blank)}.el-tag--plain.el-tag--primary{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-primary-light-5);--el-tag-hover-color:var(--el-color-primary)}.el-tag--plain.el-tag--success{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-success-light-5);--el-tag-hover-color:var(--el-color-success)}.el-tag--plain.el-tag--warning{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-warning-light-5);--el-tag-hover-color:var(--el-color-warning)}.el-tag--plain.el-tag--danger{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-danger-light-5);--el-tag-hover-color:var(--el-color-danger)}.el-tag--plain.el-tag--error{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-error-light-5);--el-tag-hover-color:var(--el-color-error)}.el-tag--plain.el-tag--info{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-info-light-5);--el-tag-hover-color:var(--el-color-info)}.el-tag.is-closable{padding-right:5px}.el-tag--large{padding:0 11px;height:32px;--el-icon-size:16px}.el-tag--large .el-tag__close{margin-left:8px}.el-tag--large.is-closable{padding-right:7px}.el-tag--small{padding:0 7px;height:20px;--el-icon-size:12px}.el-tag--small .el-tag__close{margin-left:4px}.el-tag--small.is-closable{padding-right:3px}.el-tag--small .el-icon-close{transform:scale(.8)}.el-tag.el-tag--primary.is-hit{border-color:var(--el-color-primary)}.el-tag.el-tag--success.is-hit{border-color:var(--el-color-success)}.el-tag.el-tag--warning.is-hit{border-color:var(--el-color-warning)}.el-tag.el-tag--danger.is-hit{border-color:var(--el-color-danger)}.el-tag.el-tag--error.is-hit{border-color:var(--el-color-error)}.el-tag.el-tag--info.is-hit{border-color:var(--el-color-info)}.el-text{--el-text-font-size:var(--el-font-size-base);--el-text-color:var(--el-text-color-regular)}.el-text{align-self:center;margin:0;padding:0;font-size:var(--el-text-font-size);color:var(--el-text-color);word-break:break-all}.el-text.is-truncated{display:inline-block;max-width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.el-text--large{--el-text-font-size:var(--el-font-size-medium)}.el-text--default{--el-text-font-size:var(--el-font-size-base)}.el-text--small{--el-text-font-size:var(--el-font-size-extra-small)}.el-text.el-text--primary{--el-text-color:var(--el-color-primary)}.el-text.el-text--success{--el-text-color:var(--el-color-success)}.el-text.el-text--warning{--el-text-color:var(--el-color-warning)}.el-text.el-text--danger{--el-text-color:var(--el-color-danger)}.el-text.el-text--error{--el-text-color:var(--el-color-error)}.el-text.el-text--info{--el-text-color:var(--el-color-info)}.el-text>.el-icon{vertical-align:-2px}.time-select{margin:5px 0;min-width:0}.time-select .el-picker-panel__content{max-height:200px;margin:0}.time-select-item{padding:8px 10px;font-size:14px;line-height:20px}.time-select-item.disabled{color:var(--el-datepicker-border-color);cursor:not-allowed}.time-select-item:hover{background-color:var(--el-fill-color-light);font-weight:700;cursor:pointer}.time-select .time-select-item.selected:not(.disabled){color:var(--el-color-primary);font-weight:700}.el-timeline-item{position:relative;padding-bottom:20px}.el-timeline-item__wrapper{position:relative;padding-left:28px;top:-3px}.el-timeline-item__tail{position:absolute;left:4px;height:100%;border-left:2px solid var(--el-timeline-node-color)}.el-timeline-item .el-timeline-item__icon{color:var(--el-color-white);font-size:var(--el-font-size-small)}.el-timeline-item__node{position:absolute;background-color:var(--el-timeline-node-color);border-color:var(--el-timeline-node-color);border-radius:50%;box-sizing:border-box;display:flex;justify-content:center;align-items:center}.el-timeline-item__node--normal{left:-1px;width:var(--el-timeline-node-size-normal);height:var(--el-timeline-node-size-normal)}.el-timeline-item__node--large{left:-2px;width:var(--el-timeline-node-size-large);height:var(--el-timeline-node-size-large)}.el-timeline-item__node.is-hollow{background:var(--el-color-white);border-style:solid;border-width:2px}.el-timeline-item__node--primary{background-color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-timeline-item__node--success{background-color:var(--el-color-success);border-color:var(--el-color-success)}.el-timeline-item__node--warning{background-color:var(--el-color-warning);border-color:var(--el-color-warning)}.el-timeline-item__node--danger{background-color:var(--el-color-danger);border-color:var(--el-color-danger)}.el-timeline-item__node--info{background-color:var(--el-color-info);border-color:var(--el-color-info)}.el-timeline-item__dot{position:absolute;display:flex;justify-content:center;align-items:center}.el-timeline-item__content{color:var(--el-text-color-primary)}.el-timeline-item__timestamp{color:var(--el-text-color-secondary);line-height:1;font-size:var(--el-font-size-small)}.el-timeline-item__timestamp.is-top{margin-bottom:8px;padding-top:4px}.el-timeline-item__timestamp.is-bottom{margin-top:8px}.el-timeline{--el-timeline-node-size-normal:12px;--el-timeline-node-size-large:14px;--el-timeline-node-color:var(--el-border-color-light)}.el-timeline{margin:0;font-size:var(--el-font-size-base);list-style:none}.el-timeline .el-timeline-item:last-child .el-timeline-item__tail{display:none}.el-timeline .el-timeline-item__center{display:flex;align-items:center}.el-timeline .el-timeline-item__center .el-timeline-item__wrapper{width:100%}.el-timeline .el-timeline-item__center .el-timeline-item__tail{top:0}.el-timeline .el-timeline-item__center:first-child .el-timeline-item__tail{height:calc(50% + 10px);top:calc(50% - 10px)}.el-timeline .el-timeline-item__center:last-child .el-timeline-item__tail{display:block;height:calc(50% - 10px)}.el-tooltip-v2__content{--el-tooltip-v2-padding:5px 10px;--el-tooltip-v2-border-radius:4px;--el-tooltip-v2-border-color:var(--el-border-color);border-radius:var(--el-tooltip-v2-border-radius);color:var(--el-color-black);background-color:var(--el-color-white);padding:var(--el-tooltip-v2-padding);border:1px solid var(--el-border-color)}.el-tooltip-v2__arrow{position:absolute;color:var(--el-color-white);width:var(--el-tooltip-v2-arrow-width);height:var(--el-tooltip-v2-arrow-height);pointer-events:none;left:var(--el-tooltip-v2-arrow-x);top:var(--el-tooltip-v2-arrow-y)}.el-tooltip-v2__arrow:before{content:"";width:0;height:0;border:var(--el-tooltip-v2-arrow-border-width) solid transparent;position:absolute}.el-tooltip-v2__arrow:after{content:"";width:0;height:0;border:var(--el-tooltip-v2-arrow-border-width) solid transparent;position:absolute}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow{bottom:0}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow:before{border-top-color:var(--el-color-white);border-top-width:var(--el-tooltip-v2-arrow-border-width);border-bottom:0;top:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow:after{border-top-color:var(--el-border-color);border-top-width:var(--el-tooltip-v2-arrow-border-width);border-bottom:0;top:100%;z-index:-1}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow{top:0}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow:before{border-bottom-color:var(--el-color-white);border-bottom-width:var(--el-tooltip-v2-arrow-border-width);border-top:0;bottom:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow:after{border-bottom-color:var(--el-border-color);border-bottom-width:var(--el-tooltip-v2-arrow-border-width);border-top:0;bottom:100%;z-index:-1}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow{right:0}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow:before{border-left-color:var(--el-color-white);border-left-width:var(--el-tooltip-v2-arrow-border-width);border-right:0;left:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow:after{border-left-color:var(--el-border-color);border-left-width:var(--el-tooltip-v2-arrow-border-width);border-right:0;left:100%;z-index:-1}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow{left:0}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow:before{border-right-color:var(--el-color-white);border-right-width:var(--el-tooltip-v2-arrow-border-width);border-left:0;right:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow:after{border-right-color:var(--el-border-color);border-right-width:var(--el-tooltip-v2-arrow-border-width);border-left:0;right:100%;z-index:-1}.el-tooltip-v2__content.is-dark{--el-tooltip-v2-border-color:transparent;background-color:var(--el-color-black);color:var(--el-color-white);border-color:transparent}.el-tooltip-v2__content.is-dark .el-tooltip-v2__arrow{background-color:var(--el-color-black);border-color:transparent}.el-transfer{--el-transfer-border-color:var(--el-border-color-lighter);--el-transfer-border-radius:var(--el-border-radius-base);--el-transfer-panel-width:200px;--el-transfer-panel-header-height:40px;--el-transfer-panel-header-bg-color:var(--el-fill-color-light);--el-transfer-panel-footer-height:40px;--el-transfer-panel-body-height:278px;--el-transfer-item-height:30px;--el-transfer-filter-height:32px}.el-transfer{font-size:var(--el-font-size-base)}.el-transfer__buttons{display:inline-block;vertical-align:middle;padding:0 30px}.el-transfer__button{vertical-align:top}.el-transfer__button:nth-child(2){margin:0 0 0 10px}.el-transfer__button i,.el-transfer__button span{font-size:14px}.el-transfer__button .el-icon+span{margin-left:0}.el-transfer-panel{overflow:hidden;background:var(--el-bg-color-overlay);display:inline-block;text-align:left;vertical-align:middle;width:var(--el-transfer-panel-width);max-height:100%;box-sizing:border-box;position:relative}.el-transfer-panel__body{height:var(--el-transfer-panel-body-height);border-left:1px solid var(--el-transfer-border-color);border-right:1px solid var(--el-transfer-border-color);border-bottom:1px solid var(--el-transfer-border-color);border-bottom-left-radius:var(--el-transfer-border-radius);border-bottom-right-radius:var(--el-transfer-border-radius);overflow:hidden}.el-transfer-panel__body.is-with-footer{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.el-transfer-panel__list{margin:0;padding:6px 0;list-style:none;height:var(--el-transfer-panel-body-height);overflow:auto;box-sizing:border-box}.el-transfer-panel__list.is-filterable{height:calc(100% - var(--el-transfer-filter-height) - 30px);padding-top:0}.el-transfer-panel__item{height:var(--el-transfer-item-height);line-height:var(--el-transfer-item-height);padding-left:15px;display:block!important}.el-transfer-panel__item+.el-transfer-panel__item{margin-left:0}.el-transfer-panel__item.el-checkbox{color:var(--el-text-color-regular)}.el-transfer-panel__item:hover{color:var(--el-color-primary)}.el-transfer-panel__item.el-checkbox .el-checkbox__label{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;box-sizing:border-box;padding-left:22px;line-height:var(--el-transfer-item-height)}.el-transfer-panel__item .el-checkbox__input{position:absolute;top:8px}.el-transfer-panel__filter{text-align:center;padding:15px;box-sizing:border-box}.el-transfer-panel__filter .el-input__inner{height:var(--el-transfer-filter-height);width:100%;font-size:12px;display:inline-block;box-sizing:border-box;border-radius:calc(var(--el-transfer-filter-height)/ 2)}.el-transfer-panel__filter .el-icon-circle-close{cursor:pointer}.el-transfer-panel .el-transfer-panel__header{display:flex;align-items:center;height:var(--el-transfer-panel-header-height);background:var(--el-transfer-panel-header-bg-color);margin:0;padding-left:15px;border:1px solid var(--el-transfer-border-color);border-top-left-radius:var(--el-transfer-border-radius);border-top-right-radius:var(--el-transfer-border-radius);box-sizing:border-box;color:var(--el-color-black)}.el-transfer-panel .el-transfer-panel__header .el-checkbox{position:relative;display:flex;width:100%;align-items:center}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label{font-size:16px;color:var(--el-text-color-primary);font-weight:400}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label span{position:absolute;right:15px;top:50%;transform:translate3d(0,-50%,0);color:var(--el-text-color-secondary);font-size:12px;font-weight:400}.el-transfer-panel .el-transfer-panel__footer{height:var(--el-transfer-panel-footer-height);background:var(--el-bg-color-overlay);margin:0;padding:0;border:1px solid var(--el-transfer-border-color);border-bottom-left-radius:var(--el-transfer-border-radius);border-bottom-right-radius:var(--el-transfer-border-radius)}.el-transfer-panel .el-transfer-panel__footer:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-transfer-panel .el-transfer-panel__footer .el-checkbox{padding-left:20px;color:var(--el-text-color-regular)}.el-transfer-panel .el-transfer-panel__empty{margin:0;height:var(--el-transfer-item-height);line-height:var(--el-transfer-item-height);padding:6px 15px 0;color:var(--el-text-color-secondary);text-align:center}.el-transfer-panel .el-checkbox__label{padding-left:8px}.el-transfer-panel .el-checkbox__inner{height:14px;width:14px;border-radius:3px}.el-transfer-panel .el-checkbox__inner:after{height:6px;width:3px;left:4px}.el-tree{--el-tree-node-hover-bg-color:var(--el-fill-color-light);--el-tree-text-color:var(--el-text-color-regular);--el-tree-expand-icon-color:var(--el-text-color-placeholder)}.el-tree{position:relative;cursor:default;background:var(--el-fill-color-blank);color:var(--el-tree-text-color);font-size:var(--el-font-size-base)}.el-tree__empty-block{position:relative;min-height:60px;text-align:center;width:100%;height:100%}.el-tree__empty-text{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);color:var(--el-text-color-secondary);font-size:var(--el-font-size-base)}.el-tree__drop-indicator{position:absolute;left:0;right:0;height:1px;background-color:var(--el-color-primary)}.el-tree-node{white-space:nowrap;outline:0}.el-tree-node:focus>.el-tree-node__content{background-color:var(--el-tree-node-hover-bg-color)}.el-tree-node.is-drop-inner>.el-tree-node__content .el-tree-node__label{background-color:var(--el-color-primary);color:#fff}.el-tree-node__content{display:flex;align-items:center;height:26px;cursor:pointer}.el-tree-node__content>.el-tree-node__expand-icon{padding:6px;box-sizing:content-box}.el-tree-node__content>label.el-checkbox{margin-right:8px}.el-tree-node__content:hover{background-color:var(--el-tree-node-hover-bg-color)}.el-tree.is-dragging .el-tree-node__content{cursor:move}.el-tree.is-dragging .el-tree-node__content *{pointer-events:none}.el-tree.is-dragging.is-drop-not-allow .el-tree-node__content{cursor:not-allowed}.el-tree-node__expand-icon{cursor:pointer;color:var(--el-tree-expand-icon-color);font-size:12px;transform:rotate(0);transition:transform var(--el-transition-duration) ease-in-out}.el-tree-node__expand-icon.expanded{transform:rotate(90deg)}.el-tree-node__expand-icon.is-leaf{color:transparent;cursor:default}.el-tree-node__expand-icon.is-hidden{visibility:hidden}.el-tree-node__loading-icon{margin-right:8px;font-size:var(--el-font-size-base);color:var(--el-tree-expand-icon-color)}.el-tree-node>.el-tree-node__children{overflow:hidden;background-color:transparent}.el-tree-node.is-expanded>.el-tree-node__children{display:block}.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:var(--el-color-primary-light-9)}.el-tree-select{--el-tree-node-hover-bg-color:var(--el-fill-color-light);--el-tree-text-color:var(--el-text-color-regular);--el-tree-expand-icon-color:var(--el-text-color-placeholder)}.el-tree-select__popper .el-tree-node__expand-icon{margin-left:8px}.el-tree-select__popper .el-tree-node.is-checked>.el-tree-node__content .el-select-dropdown__item.selected:after{content:none}.el-tree-select__popper .el-select-dropdown__item{flex:1;background:0 0!important;padding-left:0;height:20px;line-height:20px}.el-upload{--el-upload-dragger-padding-horizontal:40px;--el-upload-dragger-padding-vertical:10px}.el-upload{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;outline:0}.el-upload__input{display:none}.el-upload__tip{font-size:12px;color:var(--el-text-color-regular);margin-top:7px}.el-upload iframe{position:absolute;z-index:-1;top:0;left:0;opacity:0}.el-upload--picture-card{--el-upload-picture-card-size:148px;background-color:var(--el-fill-color-lighter);border:1px dashed var(--el-border-color-darker);border-radius:6px;box-sizing:border-box;width:var(--el-upload-picture-card-size);height:var(--el-upload-picture-card-size);cursor:pointer;vertical-align:top;display:inline-flex;justify-content:center;align-items:center}.el-upload--picture-card i{font-size:28px;color:var(--el-text-color-secondary)}.el-upload--picture-card:hover{border-color:var(--el-color-primary);color:var(--el-color-primary)}.el-upload.is-drag{display:block}.el-upload:focus{border-color:var(--el-color-primary);color:var(--el-color-primary)}.el-upload:focus .el-upload-dragger{border-color:var(--el-color-primary)}.el-upload-dragger{padding:var(--el-upload-dragger-padding-horizontal) var(--el-upload-dragger-padding-vertical);background-color:var(--el-fill-color-blank);border:1px dashed var(--el-border-color);border-radius:6px;box-sizing:border-box;text-align:center;cursor:pointer;position:relative;overflow:hidden}.el-upload-dragger .el-icon--upload{font-size:67px;color:var(--el-text-color-placeholder);margin-bottom:16px;line-height:50px}.el-upload-dragger+.el-upload__tip{text-align:center}.el-upload-dragger~.el-upload__files{border-top:var(--el-border);margin-top:7px;padding-top:5px}.el-upload-dragger .el-upload__text{color:var(--el-text-color-regular);font-size:14px;text-align:center}.el-upload-dragger .el-upload__text em{color:var(--el-color-primary);font-style:normal}.el-upload-dragger:hover{border-color:var(--el-color-primary)}.el-upload-dragger.is-dragover{padding:calc(var(--el-upload-dragger-padding-horizontal) - 1px) calc(var(--el-upload-dragger-padding-vertical) - 1px);background-color:var(--el-color-primary-light-9);border:2px dashed var(--el-color-primary)}.el-upload-list{margin:10px 0 0;padding:0;list-style:none;position:relative}.el-upload-list__item{transition:all .5s cubic-bezier(.55,0,.1,1);font-size:14px;color:var(--el-text-color-regular);margin-bottom:5px;position:relative;box-sizing:border-box;border-radius:4px;width:100%}.el-upload-list__item .el-progress{position:absolute;top:20px;width:100%}.el-upload-list__item .el-progress__text{position:absolute;right:0;top:-13px}.el-upload-list__item .el-progress-bar{margin-right:0;padding-right:0}.el-upload-list__item .el-icon--upload-success{color:var(--el-color-success)}.el-upload-list__item .el-icon--close{display:none;position:absolute;right:5px;top:50%;cursor:pointer;opacity:.75;color:var(--el-text-color-regular);transition:opacity var(--el-transition-duration);transform:translateY(-50%)}.el-upload-list__item .el-icon--close:hover{opacity:1;color:var(--el-color-primary)}.el-upload-list__item .el-icon--close-tip{display:none;position:absolute;top:1px;right:5px;font-size:12px;cursor:pointer;opacity:1;color:var(--el-color-primary);font-style:normal}.el-upload-list__item:hover{background-color:var(--el-fill-color-light)}.el-upload-list__item:hover .el-icon--close{display:inline-flex}.el-upload-list__item:hover .el-progress__text{display:none}.el-upload-list__item .el-upload-list__item-info{display:inline-flex;justify-content:center;flex-direction:column;width:calc(100% - 30px);margin-left:4px}.el-upload-list__item.is-success .el-upload-list__item-status-label{display:inline-flex}.el-upload-list__item.is-success .el-upload-list__item-name:focus,.el-upload-list__item.is-success .el-upload-list__item-name:hover{color:var(--el-color-primary);cursor:pointer}.el-upload-list__item.is-success:focus:not(:hover) .el-icon--close-tip{display:inline-block}.el-upload-list__item.is-success:active,.el-upload-list__item.is-success:not(.focusing):focus{outline-width:0}.el-upload-list__item.is-success:active .el-icon--close-tip,.el-upload-list__item.is-success:not(.focusing):focus .el-icon--close-tip{display:none}.el-upload-list__item.is-success:focus .el-upload-list__item-status-label,.el-upload-list__item.is-success:hover .el-upload-list__item-status-label{display:none;opacity:0}.el-upload-list__item-name{color:var(--el-text-color-regular);display:inline-flex;text-align:center;align-items:center;padding:0 4px;transition:color var(--el-transition-duration);font-size:var(--el-font-size-base)}.el-upload-list__item-name .el-icon{margin-right:6px;color:var(--el-text-color-secondary)}.el-upload-list__item-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-upload-list__item-status-label{position:absolute;right:5px;top:0;line-height:inherit;display:none;height:100%;justify-content:center;align-items:center;transition:opacity var(--el-transition-duration)}.el-upload-list__item-delete{position:absolute;right:10px;top:0;font-size:12px;color:var(--el-text-color-regular);display:none}.el-upload-list__item-delete:hover{color:var(--el-color-primary)}.el-upload-list--picture-card{--el-upload-list-picture-card-size:148px;display:inline-flex;flex-wrap:wrap;margin:0}.el-upload-list--picture-card .el-upload-list__item{overflow:hidden;background-color:var(--el-fill-color-blank);border:1px solid var(--el-border-color);border-radius:6px;box-sizing:border-box;width:var(--el-upload-list-picture-card-size);height:var(--el-upload-list-picture-card-size);margin:0 8px 8px 0;padding:0;display:inline-flex}.el-upload-list--picture-card .el-upload-list__item .el-icon--check,.el-upload-list--picture-card .el-upload-list__item .el-icon--circle-check{color:#fff}.el-upload-list--picture-card .el-upload-list__item .el-icon--close{display:none}.el-upload-list--picture-card .el-upload-list__item:hover .el-upload-list__item-status-label{opacity:0;display:block}.el-upload-list--picture-card .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture-card .el-upload-list__item .el-upload-list__item-name{display:none}.el-upload-list--picture-card .el-upload-list__item-thumbnail{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.el-upload-list--picture-card .el-upload-list__item-status-label{right:-15px;top:-6px;width:40px;height:24px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-list--picture-card .el-upload-list__item-status-label i{font-size:12px;margin-top:11px;transform:rotate(-45deg)}.el-upload-list--picture-card .el-upload-list__item-actions{position:absolute;width:100%;height:100%;left:0;top:0;cursor:default;display:inline-flex;justify-content:center;align-items:center;color:#fff;opacity:0;font-size:20px;background-color:var(--el-overlay-color-lighter);transition:opacity var(--el-transition-duration)}.el-upload-list--picture-card .el-upload-list__item-actions span{display:none;cursor:pointer}.el-upload-list--picture-card .el-upload-list__item-actions span+span{margin-left:1rem}.el-upload-list--picture-card .el-upload-list__item-actions .el-upload-list__item-delete{position:static;font-size:inherit;color:inherit}.el-upload-list--picture-card .el-upload-list__item-actions:hover{opacity:1}.el-upload-list--picture-card .el-upload-list__item-actions:hover span{display:inline-flex}.el-upload-list--picture-card .el-progress{top:50%;left:50%;transform:translate(-50%,-50%);bottom:auto;width:126px}.el-upload-list--picture-card .el-progress .el-progress__text{top:50%}.el-upload-list--picture .el-upload-list__item{overflow:hidden;z-index:0;background-color:var(--el-fill-color-blank);border:1px solid var(--el-border-color);border-radius:6px;box-sizing:border-box;margin-top:10px;padding:10px;display:flex;align-items:center}.el-upload-list--picture .el-upload-list__item .el-icon--check,.el-upload-list--picture .el-upload-list__item .el-icon--circle-check{color:#fff}.el-upload-list--picture .el-upload-list__item:hover .el-upload-list__item-status-label{opacity:0;display:inline-flex}.el-upload-list--picture .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture .el-upload-list__item.is-success .el-upload-list__item-name i{display:none}.el-upload-list--picture .el-upload-list__item .el-icon--close{top:5px;transform:translateY(0)}.el-upload-list--picture .el-upload-list__item-thumbnail{display:inline-flex;justify-content:center;align-items:center;width:70px;height:70px;-o-object-fit:contain;object-fit:contain;position:relative;z-index:1;background-color:var(--el-color-white)}.el-upload-list--picture .el-upload-list__item-status-label{position:absolute;right:-17px;top:-7px;width:46px;height:26px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-list--picture .el-upload-list__item-status-label i{font-size:12px;margin-top:12px;transform:rotate(-45deg)}.el-upload-list--picture .el-progress{position:relative;top:-7px}.el-upload-cover{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;z-index:10;cursor:default}.el-upload-cover:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-upload-cover img{display:block;width:100%;height:100%}.el-upload-cover__label{right:-15px;top:-6px;width:40px;height:24px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-cover__label i{font-size:12px;margin-top:11px;transform:rotate(-45deg);color:#fff}.el-upload-cover__progress{display:inline-block;vertical-align:middle;position:static;width:243px}.el-upload-cover__progress+.el-upload__inner{opacity:0}.el-upload-cover__content{position:absolute;top:0;left:0;width:100%;height:100%}.el-upload-cover__interact{position:absolute;bottom:0;left:0;width:100%;height:100%;background-color:var(--el-overlay-color-light);text-align:center}.el-upload-cover__interact .btn{display:inline-block;color:#fff;font-size:14px;cursor:pointer;vertical-align:middle;transition:var(--el-transition-md-fade);margin-top:60px}.el-upload-cover__interact .btn i{margin-top:0}.el-upload-cover__interact .btn span{opacity:0;transition:opacity .15s linear}.el-upload-cover__interact .btn:not(:first-child){margin-left:35px}.el-upload-cover__interact .btn:hover{transform:translateY(-13px)}.el-upload-cover__interact .btn:hover span{opacity:1}.el-upload-cover__interact .btn i{color:#fff;display:block;font-size:24px;line-height:inherit;margin:0 auto 5px}.el-upload-cover__title{position:absolute;bottom:0;left:0;background-color:#fff;height:36px;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:400;text-align:left;padding:0 10px;margin:0;line-height:36px;font-size:14px;color:var(--el-text-color-primary)}.el-upload-cover+.el-upload__inner{opacity:0;position:relative;z-index:1}.el-vl__wrapper{position:relative}.el-vl__wrapper:hover .el-virtual-scrollbar,.el-vl__wrapper.always-on .el-virtual-scrollbar{opacity:1}.el-vl__window{scrollbar-width:none}.el-vl__window::-webkit-scrollbar{display:none}.el-virtual-scrollbar{opacity:0;transition:opacity .34s ease-out}.el-virtual-scrollbar.always-on{opacity:1}.el-vg__wrapper{position:relative}.el-popper{--el-popper-border-radius:var(--el-popover-border-radius, 4px)}.el-popper{position:absolute;border-radius:var(--el-popper-border-radius);padding:5px 11px;z-index:2000;font-size:12px;line-height:20px;min-width:10px;word-wrap:break-word;visibility:visible}.el-popper.is-dark{color:var(--el-bg-color);background:var(--el-text-color-primary);border:1px solid var(--el-text-color-primary)}.el-popper.is-dark .el-popper__arrow:before{border:1px solid var(--el-text-color-primary);background:var(--el-text-color-primary);right:0}.el-popper.is-light{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light)}.el-popper.is-light .el-popper__arrow:before{border:1px solid var(--el-border-color-light);background:var(--el-bg-color-overlay);right:0}.el-popper.is-pure{padding:0}.el-popper__arrow{position:absolute;width:10px;height:10px;z-index:-1}.el-popper__arrow:before{position:absolute;width:10px;height:10px;z-index:-1;content:" ";transform:rotate(45deg);background:var(--el-text-color-primary);box-sizing:border-box}.el-popper[data-popper-placement^=top]>.el-popper__arrow{bottom:-5px}.el-popper[data-popper-placement^=top]>.el-popper__arrow:before{border-bottom-right-radius:2px}.el-popper[data-popper-placement^=bottom]>.el-popper__arrow{top:-5px}.el-popper[data-popper-placement^=bottom]>.el-popper__arrow:before{border-top-left-radius:2px}.el-popper[data-popper-placement^=left]>.el-popper__arrow{right:-5px}.el-popper[data-popper-placement^=left]>.el-popper__arrow:before{border-top-right-radius:2px}.el-popper[data-popper-placement^=right]>.el-popper__arrow{left:-5px}.el-popper[data-popper-placement^=right]>.el-popper__arrow:before{border-bottom-left-radius:2px}.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent!important;border-left-color:transparent!important}.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent!important;border-right-color:transparent!important}.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent!important;border-bottom-color:transparent!important}.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent!important;border-top-color:transparent!important}.el-select-dropdown__item{font-size:var(--el-font-size-base);padding:0 32px 0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--el-text-color-regular);height:34px;line-height:34px;box-sizing:border-box;cursor:pointer}.el-select-dropdown__item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-select-dropdown__item.hover,.el-select-dropdown__item:hover{background-color:var(--el-fill-color-light)}.el-select-dropdown__item.selected{color:var(--el-color-primary);font-weight:700}.el-statistic{--el-statistic-title-font-weight:400;--el-statistic-title-font-size:var(--el-font-size-extra-small);--el-statistic-title-color:var(--el-text-color-regular);--el-statistic-content-font-weight:400;--el-statistic-content-font-size:var(--el-font-size-extra-large);--el-statistic-content-color:var(--el-text-color-primary)}.el-statistic__head{font-weight:var(--el-statistic-title-font-weight);font-size:var(--el-statistic-title-font-size);color:var(--el-statistic-title-color);line-height:20px;margin-bottom:4px}.el-statistic__content{font-weight:var(--el-statistic-content-font-weight);font-size:var(--el-statistic-content-font-size);color:var(--el-statistic-content-color)}.el-statistic__value{display:inline-block}.el-statistic__prefix{margin-right:4px;display:inline-block}.el-statistic__suffix{margin-left:4px;display:inline-block}.el-button{height:32rem!important;padding:8rem 15rem!important;font-size:14rem!important}.el-input__wrapper{padding:1rem 11rem!important}.el-input{height:32rem!important;font-size:14rem!important}.jt-wall-row .col-left{font-size:14rem!important}.el-color-picker__trigger{height:32rem!important;padding:4rem!important}.el-radio-button__inner{padding:8rem 15rem!important;font-size:14rem}.el-textarea__inner{padding:5rem 11rem!important;font-size:14rem}.el-input__inner{height:32rem!important;font-size:14rem!important}.jt-wall-row{display:flex;flex-direction:row;height:40rem;align-items:center}.jt-wall-row .col-left{display:flex;align-items:center;justify-content:right;width:60rem;font-family:Alimama_ShuHeiTi_Bold;font-weight:700;margin-right:8rem}.jt-wall-row .col-main{flex:1;display:flex;flex-direction:row}.jt-wall-row .col-main .el-input--suffix{background-color:#fff0}.jt-wall-row .col-main .el-input--suffix *{background-color:#fff0;color:#fff}.jt-wall-row .col-main .el-input-number__decrease,.jt-wall-row .col-main .el-input-number__increase{background-color:#3489ff;color:#fff}.jt-wall-dialog{pointer-events:none}.jt-wall-dialog .el-dialog{pointer-events:auto;position:absolute!important;background:rgba(5,45,155,.7);min-width:280rem;overflow:hidden;margin-top:0rem}.jt-wall-dialog .el-dialog .el-dialog__header{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyCAIAAAD9fhrKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4NTc1YTY2Yi1hY2U5LTUyNDctODM5MS01MGJjMjM4MDkxMDkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDY4MTUxMzk2RDM1MTFFRDkzM0JDNEQ5N0IwQTIxRjYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDY4MTUxMzg2RDM1MTFFRDkzM0JDNEQ5N0IwQTIxRjYiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6YjZlNTUzODYtMzRjZC02NDQyLWI4OTktODY4YTdiYTNkMzgyIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjg1NzVhNjZiLWFjZTktNTI0Ny04MzkxLTUwYmMyMzgwOTEwOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Po+VQtwAACdUSURBVHja7H1bluM4kiUMfEjuHpFZtY4+/TGLmQ3MmTMbnf1MdUX6QyIJ2MAAAjC8+JB7ZHZXh7LKQ6IoECSBy2sXFwb4/X/+X2FfEqDv5dh35mXeC+k2CzD/+XfxL72BeVbv04KI7uP6ByD7pZTy6ToMnUTwv3f7rgWG/cNXrhz7AcVtUfOiwP/kOg6mLGRVoq1JUewjsAoLWJQ2RdlTg7CD+y+eJW3MziVU1dfK/wV2LIhXJpQJ/nQhOUFWWxDJRYjnwnfItkB2Z8w/yC7sr9fnXpj8Y/9d27hw/2D4zm/0/4V92EcRtq+bMP9J+AX98UdadxN8oy/D/tXdBeWAvsBQM7/FvwklxzemJ0xyfrflu6JG1T+Hc1mrhKEA/wfTQ9BfAD119x9Ca2R1ZjuEqwdq/Kb7C9vO3oQzZJ9AKdAzqDuoGVC5r3r3j8Gp62XoJaT9g3WBDK3crwwIdfB+mxUmyJP0HXNGAj/uM1zNQWTs8MChMOvJEQYMuDxdepBAQGM7810t2MHIioItnEqwbOx66GBadMSXHHQiCgBHFmDV8h+rJcQPEUaLk+WIFi5YDnyQXPoUs0R+oyTfEWvdkKFaskPYju0t1RLCDrxM/luoHejIm+0qbZ9g6+P2/snOBWDRQVPAggLOgMEBFRh7PoY+DPaJvUIYIvjeb3eG9b39tH6zFoL0Q9eHzVt6A1qOKMdYE7cD+lsBDCtdya7B2QINBEj1YZqMxSAwIKL7J3DVdI0WHbWgY4HdyIp2Z7d+lvreTa+hfHep/M/ZhZS9Gr7pbthqXsmtsdXpepS9MHXTi5xf5XIzX3XXf/tfBkmer2MHkPKdGr0SOckyXGzoO60IYIGBUcEdYFZKSuikFMBLT7pxQprYwXrifAZwtfto3pi9bVEcXVKSVcKtPYT5lSnMlOAaQMKKUobEv2UXF9a7kx4vbkRWnGsxAKxnAIRnrPAtg9FFYM8l93Pg/YA9A31zZCeJfOOBv3znykOv2KG6W/YVpu+xtlHUjlvWXGzu3Dqd6rflx/ZRkH+0vEFofssYCXAbtSNB7O6gxylGfNhRGFFJOdT6jbbFR4jEcHa4EqKrlkOsD2LKs2J9AlGKdVtucv4I9TdQpftrrH88BUSO3QVHI7RaboRWiJW7zy+zoW/jd4Ie0b472y+Q2F+AwHXuXv79f39/GiHr3pCgXQpSxaMeYOx7cxYGBHIKkHIKQhxJ6MOimxQI25jVdWBCy0Up941DSE4JAfKQtUURDcqawrT21YUUnVHkUVoJfByheE0DCGLysIiwkiEX6zwZctkHb3JHofU0ivee7aJx/QoxOTT6b2OVMCmE/0RU0SctOfsqnOz6rS9KszI5Umh2dJHWNjsFXSsw+7nIcCEtKuys2VfILxcWwIf8TdGrI3wxQpQHU/zi5JEjD8HWclhMxX4ecMHgi4ZesOgyBGsZWokCrWD5kPM9otXwbOLK9OphesYiOWvWFA3qddNbivHFc81iq7r8ZrrvJ2Jz/zjuRqnuvQm46rtmsFO0Yaql4w7U4fH5YuJD+JiWsB3Dj9HRYdp0J81LGE7nySMmPZfxflbAemw6wGW42RLMj+bZHEtcL1145NmiPEMWGKmNAwOMkYchZyaenRYiWmgpLx0xcGfXrjwXdMw5xSG/3ZJ/5LKXa0D++I4+R9gKVwwtuVrpNzj6HS7syt/Fuj+E5ghJAAblHeFxG2rhzyWNfgRrZ2HPNDDCVjQm2P4ltPk9kZUfRRmssXRMgzGIhftL7zdCpBuClYxYi02LC7KWwK+JSH4Yj5tEhZiyjLwfBaiq4lSKGonKgzUBK5xdQr5C9wfT/5HCfx5vJhcRkQtYKVrN77BMnjtJPT5pGHK4LCCKHSBidDe/rzQt2S+7CEINL4bBsX7XiNURcTdot5/18NIPXVfiFK8GNB/tGZYhiWBSvt/n8gnN7+9kEccCJSSH4Ai4fsG+stU3BzDI+OEPMS/K7GXgz0foAf6wgVkiYIkJMk2F7/NimBayADDClrZIJDCHLUQBGTdCcKAsPXcKWqODsqABuJPFJApGpx+sskHE20jmINK6KFuAbxvgmR2cCoTE3le5KAoeODNymG7ZKP/IcbdjNrEZTmzVfzMaySEojcE3QeokTnEoYVCFCSxGAT4e3uCU7i/oxMokDCzQKq8MFeTRyv1OquEZoU/pURFgisp1oFhnfiWaxgYCkkEGH8SZMJDi1kBadlvEEcol+x6q4tQ2TwMGw8ClHzF2snu6vN0nFx4mwOUAyILQNNPY4tN1WKUeKDAr/Cj/Cg3QPBnMmhxm4bKoD1PUSML8SmcCZmCmC+dUCwizumlWobYFbEWUs3o8psoXijTeElqsCBeCVE+4wFcEIQsVg9IZNC3hyZhgI7AY1LUVv9KWFJhM/SZioY23iHN1O6bsJGd2lS1VZra/AzY0/HatTsQXG6Vl75MOhoySNjhIHlCzvq6xxMEmVCXH4sSms9wKMmLFeA0bHMxEK9Nl5jehZrEerTM8BUHmaIU5WvHzCvWW06u0NC2pJSZohXJQw3eUXfOZggX1wYMwhn1xU2EfqjZfHYhv1/F9MhGbZjw9xIkrAM0GJG6zoUs5ZhUHRR+PhWCKMGscDDlaNPUUgzcf9+V6IUVLJFSLUSp+ahC3m/9f+v6+UHDoQ9EYCAewWu81rILXyrY4cYMkdHfEyjNNYONMPOLDVd3L1MqVeWGmSqVgiyJ1j2AYptSYtACA2Haz94jN1gOprhSLFbEThhIAErkEIO7TIkOhwPA3+6EQ9cNhUUnEdAvW+0A4SnYdmCiZGhdwHfZCkTMpjlDZD9t8KtlFp+4ATNSuyJjcc1T2KC/rOGQmtIs04uc7uC+0MtxK6GVFFei14VY0QFiEfZipdpiVCajl/RXU1Azi7DaS2HoCRNzlVOmFzTt949XvwlMlKqzoWYnqZIDjZRxvcrkZJiWYkuUwa90NDUi836fn67h2X4dZWHKi+JMANJIMWf1tMphlbj4obTFr7GjokGNSEo95LMIUtgAvfTct2haFERQgYAF6FuMxCDzaoR+rDvQOfIQc+6Af0XaCFPjWYDvV+pEPVmCizfvxv3DqfqgA07sb9sRjARdgfVS/UoLHR31svBBwn/aHa8WPlf8Q07rh1pM6KZBHytXSMB1cx1z+YnQoFYOygQjMhB6RGaZ4ed6jkIRgmuNUihYrWg0erdoxYM7+AlotFAnqZQUxOej+2QNfDa0QK5aOiFZ/gKVp6eGTM9Xjt5UJihpdrYfsFbjKHxWHAAtqStYeyUKv0Zj+dB36DoCcpVHAQd+DV2xaFnz7mEyIZ5AmpeWV2DCQHS8rCcOzDGaZkI7uDmEW6Vl2FBIjI8mU+IxFetgiRZ94n2LUA1Cu5peAm8IjUgA17nnx7qqIXLGXeG0fU9sHYm5eozMNJg9kmldiOsn516qC4TGjS/JgwEQWxYY0iqWqDbVYK2tnpddKJPeCl4O1nbG0TImKmSyOdWJxUuXZ8aFMVp9Ej6/7G3MWUIv4ivFELH7H+UsyIBf0b3qZzt8NmPC1TaiKLlZBZkuDVqjWAcFuxP4pRSseyWJlWNAfjmxQ0ysQTcvFdX6t1OW3fMyxQZ8OhO/YstLtM6xtLEuCAshgEkcDWXbo0KBJMnDDBHIb0M3Xceh7mQwacg0+CEAx1lsDNYN1Xn2nb2/3ZRz70WEWRHaUR4jZaVgY6SU5/KdZRRjSvDH7wUR/wyCQJe/bWI9WQ66oka8RIUMAiD67YDFksV6ira3UD6E+BhLHBDBvIomCE4Ij1vigaFbY3hh/y0+zRLBsH5Ect8nUjo0MZKcTY3NMj4gN8QsTXplrzFgPUhKvQC42p0JVWVobpxjbWiFNWrOVzmkIYhEAZo4EZw1dPhC1R6sLmv8hVAc9c90qPTUTA8r5DbQSVZP/GjF1epXYGSVtaZen4WsHsA4oVbgl0kc6Zv8MUkrrRZiUghSzwqGUJiv8FXuac4NxxKuCWVl4aPe72LlE93mxCIP3aca+uww976xHYMsAUkeeMhMeLkyLYtw1nUyUMAQdmVGIFpPBO0g4R2YchsTXtQ5HYsmngY0JZJxLeDK4WiYgC+fdxvVvwTggMW/7UNmF6aLYjuxYfh+Moj/E5p55rzBy8Ky1MLkwfw85ugh+UrGqaRzBL0V5IhBHNzBUOF6ZFmxhJU5JFHRRM3ChyKV0kUlOLFa0rZogBvpV6joCVWzqDCw3WO4GrcRqtnrScvScvDaMkGIU307AZ2mawIo1awW6/qJ6O+aYjH4WV6+lTNQC9w0w6wvqdHjcBWqerHwECq0MDzS9ZobJYgp3ZoEnSuZBcrPB42iBJlItZM5xfmUhkhZYA7r+Ns3OFzUtNPPIY9YGbHE6sApMvZ1UeafpRrhq2SH049okePiARMLw4lIAL2+CwGAYxSihQxwKTQbbgJ011EZTEmoAcVQxzo7wY4eiFo1gHtIhYh7YAVblTxRYcehAnYwgYJPwM+kzfx/tEsmbvLbpr4oZfuifDeysoer+wvwnDfE3g5u8f2Y6OvPclsyljPKCkkWRoOhyt0DFXZXSGdcXlg+DVqFwsi/IIYw9J7/dGBB0bUfdOppvqEVuTGWiVfesB6ptKwKsq1e1GL3p0jrAsKLWzW9wLmPhASeE35nG9WiqItzmmd/LBLNMQDfRCRPQ+EaZ+rASfYYNLNJbwiwraaEdXnHOCRNpMmBKzYIJT0oIlzWoyvuiHacOdxWCuB4mzMTJW4nOFWLGCF7pYBRzKXD+hWGnAsICPEM6oue9W7w34THCvTHf5SxZx5PbDz5Rsb3bkXrioYd2qz6lnbIYjShoVKmgi9b0acyIp30nSbSGrjL8V8BNIue75mDYkJoCoBDxkSNW5nLvo5UkT/yHcEpO6hwL2K/6b6K/rA6JClDhgYaHVVfABnj1BzlU3XNQkqzcDRBVGYrdCFTgY55pvJYZHSJh0po8oQ5ooPSOlkJLgAp6axDxeumtFZ5uyETWCXwaRyjHgJyzPM4ByglXJ+DSy7stAeIMU4xhIvg5oOEmQp6IghEBhBBCCREjx/wWOgTiJ4pMiq8RaEgTNZz1JW37m6pTnOEMhMGmEWx746PGmkdk2WzAZ2e0HUuUryBUVfAqQS3wF9nbSLDjc4MqlIr7DxjsyOkN1OIIEUppw7Qh82okgSd/yKVfyflNqpufv5Wq7KsPVSJNZh7Z3Kl8TAL3BpMfe/WfuvEbnsAc19ZJ3yOZ4ccPa9bkGBSAyZIjUtBX/3qCSpXRw2yH3lK526Jc+cus3jWNQoJzfmKpH6/IVRAuh1n95CxagkndGI0O6wgiJBHOqnuDV6OK0EzkdlAGupzeBh7lpHRZPLggxqxRAn+AFlV9KgcF8W0sOGhiP96yP9no8djVEJsUoKQPmDHcAqRSllZKQuQ5IPtCJ1JOk5ujcs+XC9A0KU1q9o/VTnWJqFSyqhaxstbQN7ncc6s741ZU1eEbTWbG2nAg7t2kDXp1GrCSYReoh4TbjyYW9jByxNUW4kHP43BfFhqP416H4KhEpOk7Gp+crbROtZpsy7C4a9/d7Pij2dcAzjtSUVIyACiTiTCsCFFXZxX9SSwmvgRgNIrxRwZegXn5CxbAy2teXCjn/IsBNwsMRRxQDUOWaazPGJmom+MqTKe1s6i5FHaHXDAxdjSfZAefbdtjO9sqRHV/qPgudmgjxqmKUNGxMm6CdUcRZrQMc5BiGKENBHQOrbASVWFuSk06vFYWrRYvufc2Euwy2wH3WGEWikZzAxVl0UpkM28i3HVXbcvPoRMrcWc9Kj/+9Dnnwzry5IQ2Zomq+LXyF8KUwZAheZ/mKOMB8PDQORWeiJJBMhWw9D2kwz8UgUthMOtu0MoG4d450TtbaUKpMoWLcS53LHPwsTO332b+g6hkIRTBMpefgcdqq8GCtTsoc/ghcNMApn6FypjgCvIC6mmudjnLKennBCU5ecQjT1k8+ZOW4HWcNmI+Oo9lbFUFstT/WTHxYq4cYTcSt0KZKWIlXytN8zZRFFlDPfe5rBK4LghdVgBmDIuK6pwEJnJraMA7pMnMV+2n9TTQCnG/gT3Ok0+EhFsToUVNzCoHiZidU4LBLJK0bjQrMEkesMIWwEqOKAuqDIbPQoxnT1X2OLVW+O4+WS+ozWxDVvih7zvws5UxyWNTm0kQQjea9oNioudYbpVKfVJ8XF9wR3Uy5TKQMiZrMU9DRClg4335nYYGSgFUmkU546r8Nkxtyaa5ZGUC7Nz96v6t7aIyKbV+lPIn6cDpVgnVw7X2wdzqpetDXylyYdkVOWyl7CiOsl3IyM5mHdVxKnMMrKN4s1wMWik/zc9wn6sFvtKBgQW3S6bjmKI6MlstCUtMJHZJLvZ+jLkLt9Fq+/nBc5N8FrCwkavveGBYbC80+FWutvP4ZCfHt/uEGvPgyB5LUeIr7CqD+QXbKgY3zR+DiQagboasadPs1IfWhmcNfZdoWJlchKkRwu9mqJ6JESfL+9bWHow/btoKBPk+72+BOsYLBd51EHP9CZ6lETMuloBYDIErwyDVprDdPrI5vVgkOWq9P/IIPVjO9semovRogYjtjRW2VSFVWCN+WAwL5mN03BNwNWhFG3RuW03izAwf3SieJoeUWHO6CdU/CWlzOeRDmY0AUGS2We2Cyhx2HHEzR7v8roNoVUrseKxl7KpX+ABgcR4koFQNEsxqznfnuVFCT8x+yNKzZVZk5hd9smb5vDLMLs/dAbnt3v4ldjarkAQFsOEVcbmrWrTL/mS0ye7vk4rPniwNRGqPggihMXrlwI18HDAHKEhd2lAMswtRptvHhgiFNcnpSBIF3EztUOYthk0hbEM/2tCnWukcoK277Ra7e5VEKyVKYbMSMQNaBZ5SM0FoDXp4sjmOM3cw1jTskrqhz4bqDi0RHPepCVVZYIiVM6P8CuPzmuU9y7EVjG8t/MdCad/RCo6hFZ4OCc8PIO8NG5eYdZvUnXIuhPAoWpjJDHXpx76LFwViGJVJrPlIov/e8CE7P9qlVKYg0TCudlDJ8CZNehXwC8Is1liLkGwP02uHmIOsiIlmipCk9HGJIidpYV/AChAkOUiTjIgs711mCYN0lLNIQ1oLlwW3rSTWxNp2URwUoTEqB7VsL1D0lXTkBCE95W37FbsgmOUmbJAsgaK0QebyFFZOByu2hyhKlOGeaKf6ZMRHw4D9C9lEcTE8S06vujcIOKSzeEoZqyqHU0NE+YSDpDmD2WIZ1K5VN/3Q3RNl46tEvXhC2dyXT/FhDasJPznuiE2exakWwywT6H3cab5OktvXN8K+k7Q6Tj4jmvdkyJNGBsnMZz2YFj3Ns7K4YOK5y2BFdxS5vsZM862Hc8gX6JKUQvZcTrCWJXthaQCAz5CJxApZsIciW0YIc7isdKZKVFjLebCT/a6aL6GWGXd3GgXUdJzyPWw0zloNoWa5Fzmgi329t9WxzgUplVwCmOdbqIANf5Dod+gvdtLMBkhhbXzAcy8YoAfKdaUXsUw03a9/CtOPMZsSVD/v5DsNF4NZ3fSHsGJWUn2tpDIHUoRZ0InD8nqJ4J/0pRxjWHjU0d4IHDDDLEN8XJaFJE+m7+WDW8JnYzA7S7fHx/j80/U2zwawHFEywHexqSO22l8ZWjKVyZRzV2omHwYKkSZ9BagkFUe+gg3E7HcpdeISdAWReQIErmQlEnLE3Gya3iMv/MS3x/cR5+1U+BPK3H7I46Z81p6+k/OxQujxd3ghkVsqaxaVB0Eqe2Bo0RHPwndKqqdMgW+yWwwVQoBK1dpQxeynvRq/Ww/qvWCUKOcPA4uqt8FsKwzcGhHG/cv+IGDt+WgSHf3Qz6O6ZEiKiQSVc/1DYByr/D0OPVkZoKmF1YplUAVonjS3ZVkIXOzSXkN3GX1i1Wpa8SQzShYJWkVT4X1Wi8s8k156nhVUlOv1IE+7VxqF0gm5KVEFwGRr1jSgblKqDMtycnTKCYXHrOdiM4dnS9jaaGDbrvcjVqwjRxENh1ruvMIkC01xZXErCMIKVPGWa5q+fpdEW+J0nJyLYK3HJ8I5YRaSt/2D0vVpO25oMCtbpWYTp/hhNPQ4fpMTgLpVfrvcpV7IimXqvE2jTyVmOOxceSQkPB0bhmtheMq83OcF+SoyEH95HbqrAxcshr22YCsSk2XBm4nc1LryoCnQzabO5ihB3gqbwa8piuA1DCqloniZHymP5yCBLpHYqlBUkoqKQn7HjTpCNjdxe07fWSfU2TmJu213e4mn4673I/U5mPm9PtbHODSyYBObqCU2+EbT1uCm/N0Is9zKXfVflzJ/VhqgzczXLR/W9X4HpZUT9RvCXAlVKcBKZTBr7uJiq5we6MWEjdrAljkEdIemamJtXtmW2vDJkPAx3T0Fl0Vpw1MmZ78sVFiyTQ09raZTldghs97Uqzk5CV+vdIfQqu8SjZytiZPKQ9kzdd3bxICGrPFlXIJ7NZtIA4xUlY2YLQ+RZrKCjWud5bfL3sY1Lb4+KPr1arCPkvI0o5qG36IeFS0zmIDOhFrdRbQTrOLm0hhIijjYbDAa1NQh6U0GB7cEsupEGj+mQY55w9+Wd9TlUdFimbKu92FniAPxAUf7YwyrETqJzdiwHCo2UKJMGOgn5XGvlX3XSfl06Ya+q1A2n4evrulCSMsviLstyolWPZBoZTX7QqHHVB1PleCgYZmazospcEGsqeDFslIY85pm05DrRIyFnGno1zDBQf4M2EjP8cCz5fO9G35m+X8BWNXPBkUtrKqB3J7PO0cKraV+050yoda6jncp7Vdni7LPWl7FADC909ChWqR+FR3BFgpZ54QNW1l4q4dn4hKL85TmR5XLjXyS4zMdt41Wpy82PgBYZ6bLb9vfHZTcbLKXPGSyb/uOsmX1UlbCTN4OIGUUTJNSdIh5nZloE4f6RMkF2c2MEal2HhoIha6TmgMZLBJyYmEyh4L05USswqegGjnklzcTs1p3B44/sHiEA5sL11eZelWmqu5/ZK345orxj76gfeiNyYQHw0aWB34/LK3pXFk3jhEomKck6HehFeUyZpLWIe+431XDKAbZza+gZ1vgm9XI7OzCwzjFi9X9BcDZHWZRRA9mY3f/Q/SuzrIJzQcHOg60gv44MLW+qpMsu4lWxpkWytvX8JTaAUGPVjG/diW3ZKbVBPVn1vo+LbNPwWxiwKdxoOmH22pXJtUzVFpIYrcqmEi9YZgDZco+sSRighsgdtOmQyaOQ1yTFFpaSQZtojqvqJiXgmxjdVXBZHSKz9sJBB8gtka2Q2Uwvz2T50S2qnLWULtwTGtbXTMxmdBbu0QHKMF2KpVKYFjrnLEeIafVTSpF4Vg3tPVEbFaHWkuvhu9SvIKdxgzzh8EsNbxg1MiwyYGwgriUV/7yrfNDh8U56lXS6l+i0i+OORjw6ODgkZDwXARQMqN50WsamYokj26yyxNN0gOBVb26mNaTA6JBFn2b5yBaDUP/vGr2KAAqFxfaiqmFuHnSVgXLGBmnL1AfWhJ1CzqKRk2iEgk5LysXXqjhWnEfYGM2S2aPxWxNp222EYxumoVFNYnmgUlBTQ5X3DinJCazTnGr8Gq1N/bE0hNbUiRo3sdC1cYd6G3zOJrZp/6gUIskLWhL+yV8+V1BquGbFNKuz2xiECdpvawZrNp8qv7coL49WLuDlMtH9daa7WCo3PBijWAHiBUbADuFWUcWoajj04aehda78GHgJNONg2nIoNXQPV+GZtNOO3nJuQykGGL1MS1hcayL9UM0L3uJGmn9tc3DdbNJnKHiVQ2F5E0tXdXmKJAxRoQbD+forirjTcECT8RzefV2Ap9jfOin6UWHdI1Thi98qFolHOoDkCRaeYLZt43RRr4GDS2r1S+pAlU3SDTwizALSYanoUOhlFR/iOHJurTkgcGFgsFBZzCLlkxf3vMUo+tk7KnTCw7fRHfRZXh4JBh8XMP6xEtR1lCS2JM6MBphut86ILg1fQxbQGPAS9tI826Xt6GpmTZpHy2fkyQ2SDt5uawmbx2UnXmenQoGdcjn+dmrpyYKrYy5w6pcCXfVQww+1a2ui4fUzUPyT4KPWJH095+HrX2SpSK+6JWtT5EVDnztyXz1sc9VBvER2N0FiLRYks8NBHQ81MJ2eZVy7EKE0i57o0mUn96sDP9sC9yoRusj0JLOVOA7CFXjerq7/9DDM5Dj4euxZQ+wiuG8xrfxtVjX0ryoFiOTkhZtNvRquxwhapqXAxdafpXSgLrfdlIaptb3sBHrVfwB7GLPBH8+dG3oDlUU8ws0ayhWOcuJD1ak5nwAYaOVAx7puzvi44EYP1mlAo49Dzf2Sd2bmKX4hXOaQ6N1NNa/SD+2ltIol7eoD0VUq3cojT3iQcirajqmdvNdmqZpuJKVtHD7oVWNU8nZAHJ6FZp6JSzW9jW+RNvXSdg1oSUtezC/0lhkRfgSNkWXUiNTzeoaIB5F+UcZViM29AIQpa8yYaBuNva+k08XP0Nwo6OCaA032MWi55CfyBT4fLVzbtLHbHuIh0MYwYC13S+6EbXBtk4BqbyYS0pBs2jEKNC8SblJO2eLmyu+PUZfHo65Ho7IPj8N6EvqeTz7YO74PXB8bPbJ0k5fy6jlJS39TxPf6f4iBGzDU7XZazni+BuN9Nn8fLTU4E0Jg1mmQISj15P7J8iaL+X0B+i53oDVvbstNoXWRZTDcY+ilXl1f/8f/+fQo7uJJS60x2kitEJs7mxw6sUm/dwOglrfart41/stHsKU9Xwdu2q0DBUqlNeZbPcktCFurrN4dBvDISzoVmNqFWD726zc/6KWpn/JF+7lLMd16cA85MS2nrWj5KAd8gM78bg+utLy2fuZ0pI4GhkdLM8y4aG6U5sysSHA+cCWfPVCjiZidQXW+og5xI26nuxESFL6uQcPoDobZ1biN7cManQtFVWg8bu+f74OsL1OQftbskcEp5WdczN23ZMpsFS7anythHMT0X9MNDs616NKqo9Qj4ZbQNZSlPJhr4biDq1blYW3B7D+1+vLEOpAXFwfIdWPcMSGhEQ5ZPSC/bOQ/S5C1YLNTo2/CfFKsw4tdJKkZYf2cr3piOuV3O4dXn43PIsvWpH92ESOAhfdf3My3Ofly/7Q5awjEdgw0MRok9bYCusMulyG7skPCDYDt3ZU6MJA5Z1WNk9p/3Tpd5577eeGKertvkTRih0RK1DUQKeaAoV7UAK7T+m6hgWNFAK/wOunw9ODPOtIqZtTqutaLrm0KNQK8hCeOwtSzUnSIncCtX/rVl/U5TdaE0wcwqm0E0h1+V3AD1OOKNF5lbToEHr8rkiGg58PWO1TuM+LgZKNLiMNWo1+hmBDmm3mXLZ/5sVFmhgKvI6DHRDc66hY84zbRXTephmx6kwvbnViJoQWfxQbcJaVcyYchlN949c8wv9UyIbtBz9ugtg2sKGVtG7/VG15aLcyZHcgBeqN1qAn3jH3t3+o4beiQDzYuAxxQ+i6+U20GKVe5O0fOH5HK379fMAqerehVB/TdPcpXCrhonMbXNIBwRZXrSEXUk6r5WOKgNjR+mDjMMidltFAAeu0IutWGcU14WKbaycCaGvZLAH7I0rH0O0Xk/oLkQmOjR5ud/At/wmeePCg6u7/BPWih+fcVAWHRjN090wJv0k1t92B7Aj/Afgtc2kdfwiauJLmBJsCUbVmi6+G+PEFoXv4Qds/cO9MMPV2CzFarmqtKUMNuDiJ/fgQNUMujWiIVZgeKOyA4MuVkqrvx0Glux1dgtPZ5oqAY0/JDZ0bjksHtWRKsF3j3Zw+p3EL/nT+Be2nAB77yfbHLyz50PXBnbykR4ZNTtPhHdGAco3ioofvO/2/UQwlDrx0BviEXjkBTK/QKcwA5ThmUYYs2U0/nN2hqunZZX4mikDlg+HhOcBy67+/TxPiltA1kNvAgstDUsuiVHRa2V/0fWfQSsIBbKrdYFLBDMLyyR01negw48cDJwJnpIttgBON9RK+WpT5E4Kl40s6f2YtQnGyKPyiM8SvukxHi5LLfVWgilTLW304TAQ1+HT5m7z/sHYHl4Dhw3Audflet1Dt1Ra7UV3/1q0FNhq4XvqPf5hDGDb3AGYdsDUEBEVhSArFaLglKhta9e3pIuWBqtQggjSmSN/sgODQPz8NUC5ceuxKzrZAvfEQ3C0Pzj8K4Iv3+/X6VxK4HgG4RgMGJIOCgRo7DAe7vy3GwIHyMZh/9ZIUCJ1N8ACn6k9eDvJPXIJ/onWSZKqgSSrDqc51wtagNL7ZjFZ5XdOEwmPfv1yHo1ZlzMWg+7x8cBUf8DoOmWZfzrHYuMW3UOCGnWo/1sDTcIYPNesvgK9treVsOAQNEotbttctblhmkoF2lpvqQbEotrry9cEz/dLkNp9nsrsOr/p2bSM7ZdNXPZDREdZJgiG/KGlk/yHwe1lgC6dSEHRDh3/YqddNKmoN8bMaf09yPHw+JAwkBbGd2Mx2WwMuT2N/JlqL+66L6Ni5x2FlwKeLHRA8pnyVtz5RwfCEHHTunuNJV+fGI+ULYjc8GZKd9ZufNdTjsXL2AkKopk/HM+e1a4v8OZHzTxjhrfq27OQb63h4SIFyQ4edKcRXuLOSfCwQT/Q+KnAFwbfqLBGPlHN/+39qLAYoHwYscwjDULKZzOVOkiT2YV1DsFlSs0KLxne7LkVS4MXEgg+OgCbzDc83lyPmg0+kJv6ijgH/ncLJv9C0keXi+vk1x0eLIlOVVqcVqKD59M800nf/4ewOlgRZSWv8LSvwoP/TgmDfTT/EhoHWDVDqFzV+O4JZWxqWpjAwGaqrXyYJ3wy56rozcU3cycSZbx+TinmjaT7zt6dLZRJPK85IX4YPvt5mrfVfoBnBA/X9RB8+wjAOrb/0ic6En/7JLh3ELzovPEDpML28eIC2HrsAcNa39VgDjApU/0AtDb5gdwE1gYeYtUDZafkIcbMFDrBMsIn1JjaUlJdiFJsuLVrStQVY86JfOetpMbSuDS4HOqjhbm+3iZ/KYDX7TsJDV4eSZL3f5p+COn8F0ok9XefX68+hd3AcVfBPq1TzK5rEBwI3nOXtBTpJNe+vJJmjih1ruQk3G/GBChr07A0IzrA5UcmAEc2XlP0G1DZF948pEb9bL0OrXi4jwIFLCnWN6e5EK7/rZbBTDh+6gYaivVNSK/VpFMIvw5gvPSb+Jf3i1+vPu9rngHEn7pleBU2I+W3XWV7JvQNyuf7eTa8kw4e4Z/pheJAev+8UiHWepa5/l5OdwbNNoG7/EON3sqG2GFK5JI9hKNOidq8IgctlAHjksUPB5n3KNKansb9eBmhGyFsAobNBzPI3B1dmgD+hDVeHun69/lWZGZ4Zf8RzrW+zYC9p/a7lA1owOFGJZi/HAp1L63e3pMU5LyBITVOvIUmyXFWpbNYaC7WVAcr/L8AA+dSd3OMf2BsAAAAASUVORK5CYII=) no-repeat;background-size:100%;margin-right:0rem;padding:6rem;text-align:center}.jt-wall-dialog .el-dialog .el-dialog__headerbtn{height:34rem}.jt-wall-dialog .el-dialog .el-dialog__body{padding:10rem;color:#fff}.jt-wall-dialog .el-dialog .el-color-picker__trigger{width:120rem}.jt-wall-dialog .el-dialog .el-body-foot{position:absolute;bottom:8rem;right:8rem;width:calc(100% - 16rem)}.jt-wall-dialog .el-dialog .el-body-foot .el-button-group{display:flex}.jt-wall-dialog .el-dialog .el-body-foot .el-button-group .el-button{border:solid 0rem rgb(255,0,0);flex:1}
  32906. `;
  32907. var _export_sfc = (sfc, props) => {
  32908. const target = sfc.__vccOpts || sfc;
  32909. for (const [key, val] of props) {
  32910. target[key] = val;
  32911. }
  32912. return target;
  32913. };
  32914. const _hoisted_1$2 = { class: "jt-wall-dialog" };
  32915. const _hoisted_2$2 = {
  32916. slot: "title",
  32917. class: "header-title"
  32918. };
  32919. const _hoisted_3$2 = { style: { "line-height": "24rem", "font-size": "16rem", "color": "#fff", "font-family": "'Alimama_ShuHeiTi_Bold'" } };
  32920. const _hoisted_4$2 = { class: "odin-dialog__content" };
  32921. const _hoisted_5$2 = { class: "jt-wall-row" };
  32922. const _hoisted_6$2 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u9AD8\u5EA6", -1);
  32923. const _hoisted_7$2 = { class: "col-main" };
  32924. const _hoisted_8$2 = { class: "jt-wall-row" };
  32925. const _hoisted_9$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5F2F\u66F2\u5EA6", -1);
  32926. const _hoisted_10$1 = { class: "col-main" };
  32927. const _hoisted_11$1 = { class: "jt-wall-row" };
  32928. const _hoisted_12$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u7EBF\u5BBD", -1);
  32929. const _hoisted_13$1 = { class: "col-main" };
  32930. const _hoisted_14$1 = { class: "jt-wall-row" };
  32931. const _hoisted_15$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u53D1\u5149\u5F3A\u5EA6", -1);
  32932. const _hoisted_16$1 = { class: "col-main" };
  32933. const _hoisted_17$1 = { class: "jt-wall-row" };
  32934. const _hoisted_18$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u989C\u8272", -1);
  32935. const _hoisted_19$1 = { class: "col-main" };
  32936. const _hoisted_20$1 = { class: "jt-wall-row" };
  32937. const _hoisted_21$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6D41\u52A8\u65B9\u5411", -1);
  32938. const _hoisted_22$1 = { class: "col-main" };
  32939. const _hoisted_23$1 = { class: "jt-wall-row" };
  32940. const _hoisted_24$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6D41\u52A8\u987A\u5E8F", -1);
  32941. const _hoisted_25$1 = { class: "col-main" };
  32942. const _hoisted_26$1 = { class: "jt-wall-row" };
  32943. const _hoisted_27$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6D41\u52A8\u65F6\u95F4", -1);
  32944. const _hoisted_28$1 = { class: "col-main" };
  32945. const _hoisted_29$1 = { class: "col-main" };
  32946. const _hoisted_30$1 = { class: "jt-wall-row" };
  32947. const _hoisted_31$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u91CD\u590D\u6570\u91CF", -1);
  32948. const _hoisted_32$1 = { class: "col-main" };
  32949. const _hoisted_33$1 = {
  32950. class: "jt-wall-row",
  32951. style: { "height": "60rem" }
  32952. };
  32953. const _hoisted_34$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6587\u5B57\u5185\u5BB9", -1);
  32954. const _hoisted_35$1 = { class: "col-main" };
  32955. const _hoisted_36$1 = { class: "jt-wall-row" };
  32956. const _hoisted_37$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u63CF\u8FB9\u5BBD\u5EA6", -1);
  32957. const _hoisted_38$1 = { class: "col-main" };
  32958. const _hoisted_39$1 = { class: "jt-wall-row" };
  32959. const _hoisted_40$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u63CF\u8FB9\u989C\u8272", -1);
  32960. const _hoisted_41$1 = { class: "col-main" };
  32961. const _hoisted_42$1 = {
  32962. class: "jt-wall-row",
  32963. style: { "height": "100rem" }
  32964. };
  32965. const _hoisted_43$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u89C6\u9891\u5730\u5740", -1);
  32966. const _hoisted_44$1 = { class: "col-main" };
  32967. const _hoisted_45$1 = { class: "jt-wall-row" };
  32968. const _hoisted_46$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "X\u8F74\u5E73\u79FB", -1);
  32969. const _hoisted_47$1 = { class: "col-main" };
  32970. const _hoisted_48$1 = { class: "jt-wall-row" };
  32971. const _hoisted_49$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "Y\u8F74\u5E73\u79FB", -1);
  32972. const _hoisted_50$1 = { class: "col-main" };
  32973. const _hoisted_51$1 = { class: "jt-wall-row" };
  32974. const _hoisted_52$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "Z\u8F74\u5E73\u79FB", -1);
  32975. const _hoisted_53$1 = { class: "col-main" };
  32976. const _hoisted_54$1 = { class: "el-body-foot" };
  32977. const _sfc_main$2 = {
  32978. __name: "CrEditProperty.ce",
  32979. props: {
  32980. params: {
  32981. id: {
  32982. type: String,
  32983. default: () => void 0
  32984. },
  32985. height: {
  32986. type: Number,
  32987. default: () => 13
  32988. },
  32989. bottomHeight: {
  32990. type: Number,
  32991. default: () => 0
  32992. },
  32993. color: {
  32994. type: String,
  32995. default: () => "255,255,0,0.9"
  32996. },
  32997. direction: {
  32998. type: String,
  32999. default: () => "horizontal"
  33000. },
  33001. order: {
  33002. type: String,
  33003. default: () => "+"
  33004. },
  33005. count: {
  33006. type: Number,
  33007. default: () => 2
  33008. },
  33009. text: {
  33010. type: String,
  33011. default: () => ""
  33012. },
  33013. lineWidth: {
  33014. type: Number,
  33015. default: () => 2
  33016. },
  33017. glowPower: {
  33018. type: Number,
  33019. default: () => 0.25
  33020. },
  33021. outlineWidth: {
  33022. type: Number,
  33023. default: () => 0
  33024. },
  33025. outlineColor: {
  33026. type: String,
  33027. default: () => "255,255,0,0.9"
  33028. },
  33029. speed: {
  33030. type: Number,
  33031. default: () => 1.5
  33032. },
  33033. videoUrl: {
  33034. type: String,
  33035. default: () => ""
  33036. },
  33037. arcHeight: {
  33038. type: Number,
  33039. default: () => 1e3
  33040. },
  33041. axisX: {
  33042. type: Number,
  33043. default: () => 0
  33044. },
  33045. axisY: {
  33046. type: Number,
  33047. default: () => 0
  33048. },
  33049. axisZ: {
  33050. type: Number,
  33051. default: () => 0
  33052. }
  33053. },
  33054. showDialog: {
  33055. type: Boolean,
  33056. default: () => false
  33057. }
  33058. },
  33059. emits: ["submit", "update:showDialog", "update:params", "remove"],
  33060. setup(__props, { expose: __expose, emit }) {
  33061. const props = __props;
  33062. const language = ref("zh-cn");
  33063. const locale = computed$1(() => language.value === "zh-cn" ? zhCn : en);
  33064. const {
  33065. proxy
  33066. } = getCurrentInstance();
  33067. const predefineColors = ref([
  33068. "#ff4500",
  33069. "#ff8c00",
  33070. "#ffd700",
  33071. "#90ee90",
  33072. "#00ced1",
  33073. "#1e90ff",
  33074. "#c71585",
  33075. "rgba(255, 69, 0, 0.68)",
  33076. "rgb(255, 120, 0)",
  33077. "hsv(51, 100, 98)",
  33078. "hsva(120, 40, 94, 0.5)",
  33079. "hsl(181, 100%, 37%)",
  33080. "hsla(209, 100%, 56%, 0.73)",
  33081. "#c7158577"
  33082. ]);
  33083. const isShowColor = ref(false);
  33084. const isShowText = ref(false);
  33085. const isShowHeight = ref(false);
  33086. const isShowDirection = ref(false);
  33087. const isShowOrder = ref(false);
  33088. const isShowCount = ref(false);
  33089. ref(false);
  33090. const isShowLineWidth = ref(false);
  33091. const isShowGlowpower = ref(false);
  33092. const isShowOutlineWidth = ref(false);
  33093. const isShowOutlineColor = ref(false);
  33094. const isShowSpeed = ref(false);
  33095. const isShowVideoUrl = ref(false);
  33096. const isShowArcHeight = ref(false);
  33097. const isShowAxis = ref(false);
  33098. const color2 = ref(props.params.color);
  33099. const title = ref("\u5C5E\u6027\u7F16\u8F91");
  33100. const dialogVisible = ref(props.showDialog);
  33101. const directions = reactive([{
  33102. key: "\u5DE6\u53F3",
  33103. value: "horizontal"
  33104. }, {
  33105. key: "\u4E0A\u4E0B",
  33106. value: "vertical"
  33107. }]);
  33108. const orders = reactive([]);
  33109. const radioDirection = ref("");
  33110. const radioOrder = ref("");
  33111. const wallHeight = ref(0);
  33112. const yCount = ref(0);
  33113. const txtContent = ref("");
  33114. const lineWidth = ref(0);
  33115. const glowPower = ref(0.25);
  33116. const outlineWidth = ref(0);
  33117. const outlineColor = ref(props.params.outlineColor);
  33118. const speed = ref(1.5);
  33119. const txtVideoUrl = ref("");
  33120. const arcHeight = ref(1e3);
  33121. const axisX = ref(0);
  33122. const axisY = ref(0);
  33123. const axisZ = ref(0);
  33124. updateParams(props.params);
  33125. function updateParams(params) {
  33126. proxy._params = params;
  33127. _setShowControls(false);
  33128. if (params.id === DrawTools.DrawType.TextWall) {
  33129. title.value = "\u5E7F\u544A\u724C\u7F16\u8F91";
  33130. isShowColor.value = true;
  33131. isShowText.value = true;
  33132. isShowHeight.value = true;
  33133. } else if (params.id === DrawTools.DrawType.DynamicWall) {
  33134. title.value = "\u52A8\u6001\u56F4\u680F\u7F16\u8F91";
  33135. isShowColor.value = true;
  33136. isShowDirection.value = true;
  33137. isShowOrder.value = true;
  33138. isShowCount.value = true;
  33139. isShowHeight.value = true;
  33140. isShowSpeed.value = true;
  33141. } else if (params.id === DrawTools.DrawType.NormalWall) {
  33142. title.value = "\u666E\u901A\u56F4\u680F\u7F16\u8F91";
  33143. isShowColor.value = true;
  33144. isShowHeight.value = true;
  33145. } else if (params.id === DrawTools.DrawType.Circle) {
  33146. title.value = "\u8D34\u5730\u5706\u7F16\u8F91";
  33147. isShowColor.value = true;
  33148. isShowOutlineColor.value = true;
  33149. isShowOutlineWidth.value = true;
  33150. } else if (params.id === DrawTools.DrawType.DynamicCircle) {
  33151. title.value = "\u6269\u6563\u5706\u7F16\u8F91";
  33152. isShowColor.value = true;
  33153. isShowCount.value = true;
  33154. isShowSpeed.value = true;
  33155. } else if (params.id === DrawTools.DrawType.House) {
  33156. title.value = "\u623F\u5C4B\u7F16\u8F91";
  33157. isShowColor.value = true;
  33158. isShowHeight.value = true;
  33159. } else if (params.id === DrawTools.DrawType.VideoWall) {
  33160. title.value = "\u89C6\u9891\u5899\u7F16\u8F91";
  33161. isShowHeight.value = true;
  33162. isShowVideoUrl.value = true;
  33163. isShowAxis.value = true;
  33164. } else if (params.id === DrawTools.DrawType.Polyline) {
  33165. title.value = "\u8D34\u5730\u7EBF\u7F16\u8F91";
  33166. isShowColor.value = true;
  33167. isShowLineWidth.value = true;
  33168. } else if (params.id === DrawTools.DrawType.ArrowPolyline) {
  33169. title.value = "\u7BAD\u5934\u7EBF\u7F16\u8F91";
  33170. isShowColor.value = true;
  33171. isShowLineWidth.value = true;
  33172. } else if (params.id === DrawTools.DrawType.DynamicPolyline) {
  33173. title.value = "\u52A8\u6001\u7EBF\u7F16\u8F91";
  33174. isShowColor.value = true;
  33175. isShowOrder.value = true;
  33176. isShowCount.value = true;
  33177. isShowLineWidth.value = true;
  33178. isShowSpeed.value = true;
  33179. } else if (params.id === DrawTools.DrawType.GrowPolyline) {
  33180. title.value = "\u53D1\u5149\u7EBF\u7F16\u8F91";
  33181. isShowColor.value = true;
  33182. isShowLineWidth.value = true;
  33183. isShowGlowpower.value = true;
  33184. } else if (params.id === DrawTools.DrawType.OutlinePolyline) {
  33185. title.value = "\u63CF\u8FB9\u7EBF\u7F16\u8F91";
  33186. isShowColor.value = true;
  33187. isShowLineWidth.value = true;
  33188. isShowOutlineColor.value = true;
  33189. isShowOutlineWidth.value = true;
  33190. } else if (params.id === DrawTools.DrawType.Polygon) {
  33191. title.value = "\u8D34\u5730\u9762\u7F16\u8F91";
  33192. isShowColor.value = true;
  33193. isShowOutlineColor.value = true;
  33194. isShowOutlineWidth.value = true;
  33195. } else if (params.id === DrawTools.DrawType.Rectangle) {
  33196. title.value = "\u77E9\u5F62\u7F16\u8F91";
  33197. isShowColor.value = true;
  33198. isShowOutlineColor.value = true;
  33199. isShowOutlineWidth.value = true;
  33200. } else if (params.id === DrawTools.DrawType.SpatialLine) {
  33201. title.value = "\u7A7A\u95F4\u7EBF\u7F16\u8F91";
  33202. isShowColor.value = true;
  33203. isShowLineWidth.value = true;
  33204. } else if (params.id === DrawTools.DrawType.OdLine) {
  33205. title.value = "OD\u7EBF\u7F16\u8F91";
  33206. isShowSpeed.value = true;
  33207. isShowColor.value = true;
  33208. isShowLineWidth.value = true;
  33209. isShowOrder.value = true;
  33210. isShowArcHeight.value = true;
  33211. } else {
  33212. _setShowControls(false);
  33213. }
  33214. color2.value = params.color;
  33215. if (params.direction === "horizontal") {
  33216. radioDirection.value = directions[0].key;
  33217. Object.assign(orders, [{
  33218. key: "\u81EA\u5DE6\u81F3\u53F3",
  33219. value: "-"
  33220. }, {
  33221. key: "\u81EA\u53F3\u81F3\u5DE6",
  33222. value: "+"
  33223. }]);
  33224. if (params.order === "-") {
  33225. radioOrder.value = orders[0].key;
  33226. } else {
  33227. radioOrder.value = orders[1].key;
  33228. }
  33229. } else {
  33230. radioDirection.value = directions[1].key;
  33231. Object.assign(orders, [{
  33232. key: "\u81EA\u4E0A\u81F3\u4E0B",
  33233. value: "+"
  33234. }, {
  33235. key: "\u81EA\u4E0B\u81F3\u4E0A",
  33236. value: "-"
  33237. }]);
  33238. if (params.order === "+") {
  33239. radioOrder.value = orders[0].key;
  33240. } else {
  33241. radioOrder.value = orders[1].key;
  33242. }
  33243. }
  33244. if (params.id === DrawTools.DrawType.OdLine) {
  33245. Object.assign(orders, [{
  33246. key: "\u6C47\u805A",
  33247. value: "+"
  33248. }, {
  33249. key: "\u6269\u6563",
  33250. value: "-"
  33251. }]);
  33252. if (params.order === "+") {
  33253. radioOrder.value = orders[0].key;
  33254. } else {
  33255. radioOrder.value = orders[1].key;
  33256. }
  33257. }
  33258. wallHeight.value = parseFloat(params.height).toFixed(2);
  33259. yCount.value = params.count;
  33260. txtContent.value = params.text;
  33261. lineWidth.value = params.lineWidth;
  33262. glowPower.value = params.power;
  33263. outlineColor.value = params.outlineColor;
  33264. outlineWidth.value = params.outlineWidth;
  33265. speed.value = (parseFloat(params.duration) / 1e3).toFixed(2);
  33266. txtVideoUrl.value = params.videoUrl;
  33267. arcHeight.value = params.odlineHeight;
  33268. axisX.value = params.axisX;
  33269. axisY.value = params.axisY;
  33270. axisZ.value = params.axisZ;
  33271. }
  33272. function _setShowControls(isShow) {
  33273. isShowColor.value = isShow;
  33274. isShowText.value = isShow;
  33275. isShowDirection.value = isShow;
  33276. isShowOrder.value = isShow;
  33277. isShowCount.value = isShow;
  33278. isShowHeight.value = isShow;
  33279. isShowLineWidth.value = isShow;
  33280. isShowGlowpower.value = isShow;
  33281. isShowOutlineColor.value = isShow;
  33282. isShowOutlineWidth.value = isShow;
  33283. isShowSpeed.value = isShow;
  33284. isShowVideoUrl.value = isShow;
  33285. isShowArcHeight.value = isShow;
  33286. isShowAxis.value = isShow;
  33287. }
  33288. __expose({});
  33289. function submit() {
  33290. let outParam = proxy._params;
  33291. outParam.height = wallHeight.value;
  33292. outParam.color = color2.value;
  33293. outParam.direction = directions.filter((item) => {
  33294. return item.key === radioDirection.value;
  33295. })[0].value;
  33296. outParam.order = orders.filter((item) => {
  33297. return item.key === radioOrder.value;
  33298. })[0].value;
  33299. outParam.count = yCount.value;
  33300. outParam.text = txtContent.value;
  33301. outParam.lineWidth = lineWidth.value;
  33302. outParam.power = glowPower.value;
  33303. outParam.outlineColor = outlineColor.value;
  33304. outParam.outlineWidth = outlineWidth.value;
  33305. outParam.duration = speed.value * 1e3;
  33306. outParam.videoUrl = txtVideoUrl.value;
  33307. outParam.odlineHeight = arcHeight.value;
  33308. outParam.bottomHeight = props.params.bottomHeight;
  33309. outParam.axisX = axisX.value;
  33310. outParam.axisY = axisY.value;
  33311. outParam.axisZ = axisZ.value;
  33312. emit("submit", outParam);
  33313. axisX.value = axisY.value = axisZ.value = 0;
  33314. }
  33315. function close() {
  33316. dialogVisible.value = false;
  33317. }
  33318. function remove2() {
  33319. emit("remove", {});
  33320. dialogVisible.value = false;
  33321. }
  33322. function directionChange(e) {
  33323. if (e.target.value === directions[0].key) {
  33324. Object.assign(orders, [{
  33325. key: "\u81EA\u5DE6\u81F3\u53F3",
  33326. value: "-"
  33327. }, {
  33328. key: "\u81EA\u53F3\u81F3\u5DE6",
  33329. value: "+"
  33330. }]);
  33331. radioOrder.value = orders[0].key;
  33332. } else if (e.target.value === directions[1].key) {
  33333. Object.assign(orders, [{
  33334. key: "\u81EA\u4E0A\u81F3\u4E0B",
  33335. value: "-"
  33336. }, {
  33337. key: "\u81EA\u4E0B\u81F3\u4E0A",
  33338. value: "+"
  33339. }]);
  33340. radioOrder.value = orders[0].key;
  33341. }
  33342. }
  33343. function closeDialog() {
  33344. emit("update:showDialog", false);
  33345. }
  33346. function openDialog() {
  33347. updateParams(props.params);
  33348. }
  33349. return (_ctx, _cache) => {
  33350. return openBlock(), createElementBlock("div", _hoisted_1$2, [
  33351. createVNode(unref(ElDialog), {
  33352. modal: false,
  33353. "destroy-on-close": false,
  33354. modelValue: dialogVisible.value,
  33355. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => dialogVisible.value = $event),
  33356. title: title.value,
  33357. style: normalizeStyle({ left: "10rem", background: "rgb(0 44 126 / 68%)", height: "calc(100% - 175rem)", width: "180rem", top: "125rem" }),
  33358. onClose: closeDialog,
  33359. onOpen: openDialog,
  33360. "show-close": false
  33361. }, {
  33362. header: withCtx(() => [
  33363. createElementVNode("div", _hoisted_2$2, [
  33364. createElementVNode("span", _hoisted_3$2, toDisplayString(title.value), 1)
  33365. ])
  33366. ]),
  33367. default: withCtx(() => [
  33368. createElementVNode("div", _hoisted_4$2, [
  33369. withDirectives(createElementVNode("div", _hoisted_5$2, [
  33370. _hoisted_6$2,
  33371. createElementVNode("div", _hoisted_7$2, [
  33372. createVNode(unref(ElInput), {
  33373. modelValue: wallHeight.value,
  33374. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => wallHeight.value = $event),
  33375. placeholder: "\u8F93\u5165\u9AD8\u5EA6\u503C",
  33376. clearable: ""
  33377. }, null, 8, ["modelValue"])
  33378. ])
  33379. ], 512), [
  33380. [vShow, isShowHeight.value]
  33381. ]),
  33382. withDirectives(createElementVNode("div", _hoisted_8$2, [
  33383. _hoisted_9$1,
  33384. createElementVNode("div", _hoisted_10$1, [
  33385. createVNode(unref(ElInput), {
  33386. modelValue: arcHeight.value,
  33387. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => arcHeight.value = $event),
  33388. placeholder: "\u8F93\u5165\u5F2F\u66F2\u5EA60\uFF5E9000",
  33389. clearable: ""
  33390. }, null, 8, ["modelValue"])
  33391. ])
  33392. ], 512), [
  33393. [vShow, isShowArcHeight.value]
  33394. ]),
  33395. withDirectives(createElementVNode("div", _hoisted_11$1, [
  33396. _hoisted_12$1,
  33397. createElementVNode("div", _hoisted_13$1, [
  33398. createVNode(unref(ElInput), {
  33399. modelValue: lineWidth.value,
  33400. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => lineWidth.value = $event),
  33401. placeholder: "\u8F93\u5165\u5BBD\u5EA6\u503C",
  33402. clearable: ""
  33403. }, null, 8, ["modelValue"])
  33404. ])
  33405. ], 512), [
  33406. [vShow, isShowLineWidth.value]
  33407. ]),
  33408. withDirectives(createElementVNode("div", _hoisted_14$1, [
  33409. _hoisted_15$1,
  33410. createElementVNode("div", _hoisted_16$1, [
  33411. createVNode(unref(ElInput), {
  33412. modelValue: glowPower.value,
  33413. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => glowPower.value = $event),
  33414. placeholder: "\u8F93\u5165\u53D1\u5149\u5F3A\u5EA60\uFF5E1",
  33415. clearable: ""
  33416. }, null, 8, ["modelValue"])
  33417. ])
  33418. ], 512), [
  33419. [vShow, isShowGlowpower.value]
  33420. ]),
  33421. withDirectives(createElementVNode("div", _hoisted_17$1, [
  33422. _hoisted_18$1,
  33423. createElementVNode("div", _hoisted_19$1, [
  33424. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  33425. default: withCtx(() => [
  33426. createVNode(unref(ElColorPicker), {
  33427. modelValue: color2.value,
  33428. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => color2.value = $event),
  33429. "show-alpha": "",
  33430. predefine: predefineColors.value,
  33431. label: "12"
  33432. }, null, 8, ["modelValue", "predefine"])
  33433. ]),
  33434. _: 1
  33435. }, 8, ["locale"])
  33436. ])
  33437. ], 512), [
  33438. [vShow, isShowColor.value]
  33439. ]),
  33440. withDirectives(createElementVNode("div", _hoisted_20$1, [
  33441. _hoisted_21$1,
  33442. createElementVNode("div", _hoisted_22$1, [
  33443. createVNode(unref(ElRadioGroup), {
  33444. modelValue: radioDirection.value,
  33445. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => radioDirection.value = $event)
  33446. }, {
  33447. default: withCtx(() => [
  33448. (openBlock(true), createElementBlock(Fragment, null, renderList(directions, (item, index2) => {
  33449. return openBlock(), createBlock(unref(ElRadioButton), {
  33450. label: item.key,
  33451. modelValue: item.value,
  33452. "onUpdate:modelValue": ($event) => item.value = $event,
  33453. onChange: directionChange
  33454. }, null, 8, ["label", "modelValue", "onUpdate:modelValue"]);
  33455. }), 256))
  33456. ]),
  33457. _: 1
  33458. }, 8, ["modelValue"])
  33459. ])
  33460. ], 512), [
  33461. [vShow, isShowDirection.value]
  33462. ]),
  33463. withDirectives(createElementVNode("div", _hoisted_23$1, [
  33464. _hoisted_24$1,
  33465. createElementVNode("div", _hoisted_25$1, [
  33466. createVNode(unref(ElRadioGroup), {
  33467. modelValue: radioOrder.value,
  33468. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => radioOrder.value = $event)
  33469. }, {
  33470. default: withCtx(() => [
  33471. (openBlock(true), createElementBlock(Fragment, null, renderList(orders, (item, index2) => {
  33472. return openBlock(), createBlock(unref(ElRadioButton), {
  33473. label: item.key,
  33474. modelValue: item.value,
  33475. "onUpdate:modelValue": ($event) => item.value = $event
  33476. }, null, 8, ["label", "modelValue", "onUpdate:modelValue"]);
  33477. }), 256))
  33478. ]),
  33479. _: 1
  33480. }, 8, ["modelValue"])
  33481. ])
  33482. ], 512), [
  33483. [vShow, isShowOrder.value]
  33484. ]),
  33485. withDirectives(createElementVNode("div", _hoisted_26$1, [
  33486. _hoisted_27$1,
  33487. createElementVNode("div", _hoisted_28$1, [
  33488. createElementVNode("div", _hoisted_29$1, [
  33489. createVNode(unref(ElInput), {
  33490. modelValue: speed.value,
  33491. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => speed.value = $event),
  33492. placeholder: "\u8F93\u5165\u6D41\u52A8\u65F6\u95F40\uFF5E10",
  33493. clearable: ""
  33494. }, null, 8, ["modelValue"])
  33495. ])
  33496. ])
  33497. ], 512), [
  33498. [vShow, isShowSpeed.value]
  33499. ]),
  33500. withDirectives(createElementVNode("div", _hoisted_30$1, [
  33501. _hoisted_31$1,
  33502. createElementVNode("div", _hoisted_32$1, [
  33503. createVNode(unref(ElInput), {
  33504. modelValue: yCount.value,
  33505. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => yCount.value = $event),
  33506. placeholder: "\u8F93\u51651\uFF5E100",
  33507. clearable: ""
  33508. }, null, 8, ["modelValue"])
  33509. ])
  33510. ], 512), [
  33511. [vShow, isShowCount.value]
  33512. ]),
  33513. withDirectives(createElementVNode("div", _hoisted_33$1, [
  33514. _hoisted_34$1,
  33515. createElementVNode("div", _hoisted_35$1, [
  33516. createVNode(unref(ElInput), {
  33517. modelValue: txtContent.value,
  33518. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => txtContent.value = $event),
  33519. placeholder: "\u8F93\u5165\u663E\u793A\u7684\u6587\u5B57\u5185\u5BB9",
  33520. clearable: "",
  33521. type: "textarea",
  33522. rows: 2
  33523. }, null, 8, ["modelValue"])
  33524. ])
  33525. ], 512), [
  33526. [vShow, isShowText.value]
  33527. ]),
  33528. withDirectives(createElementVNode("div", _hoisted_36$1, [
  33529. _hoisted_37$1,
  33530. createElementVNode("div", _hoisted_38$1, [
  33531. createVNode(unref(ElInput), {
  33532. modelValue: outlineWidth.value,
  33533. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => outlineWidth.value = $event),
  33534. placeholder: "\u8F93\u5165\u5BBD\u5EA6\u503C",
  33535. clearable: ""
  33536. }, null, 8, ["modelValue"])
  33537. ])
  33538. ], 512), [
  33539. [vShow, isShowOutlineWidth.value]
  33540. ]),
  33541. withDirectives(createElementVNode("div", _hoisted_39$1, [
  33542. _hoisted_40$1,
  33543. createElementVNode("div", _hoisted_41$1, [
  33544. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  33545. default: withCtx(() => [
  33546. createVNode(unref(ElColorPicker), {
  33547. modelValue: outlineColor.value,
  33548. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => outlineColor.value = $event),
  33549. "show-alpha": "",
  33550. predefine: predefineColors.value,
  33551. label: "12"
  33552. }, null, 8, ["modelValue", "predefine"])
  33553. ]),
  33554. _: 1
  33555. }, 8, ["locale"])
  33556. ])
  33557. ], 512), [
  33558. [vShow, isShowOutlineColor.value]
  33559. ]),
  33560. withDirectives(createElementVNode("div", _hoisted_42$1, [
  33561. _hoisted_43$1,
  33562. createElementVNode("div", _hoisted_44$1, [
  33563. createVNode(unref(ElInput), {
  33564. modelValue: txtVideoUrl.value,
  33565. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => txtVideoUrl.value = $event),
  33566. placeholder: "\u8F93\u5165\u64AD\u653E\u89C6\u9891\u7684\u5730\u5740",
  33567. clearable: "",
  33568. type: "textarea",
  33569. rows: 4
  33570. }, null, 8, ["modelValue"])
  33571. ])
  33572. ], 512), [
  33573. [vShow, isShowVideoUrl.value]
  33574. ]),
  33575. withDirectives(createElementVNode("div", _hoisted_45$1, [
  33576. _hoisted_46$1,
  33577. createElementVNode("div", _hoisted_47$1, [
  33578. createVNode(unref(ElInputNumber), {
  33579. modelValue: axisX.value,
  33580. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => axisX.value = $event),
  33581. precision: 2,
  33582. step: 0.1,
  33583. max: 10
  33584. }, null, 8, ["modelValue"])
  33585. ])
  33586. ], 512), [
  33587. [vShow, isShowAxis.value]
  33588. ]),
  33589. withDirectives(createElementVNode("div", _hoisted_48$1, [
  33590. _hoisted_49$1,
  33591. createElementVNode("div", _hoisted_50$1, [
  33592. createVNode(unref(ElInputNumber), {
  33593. modelValue: axisY.value,
  33594. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => axisY.value = $event),
  33595. precision: 2,
  33596. step: 0.1,
  33597. max: 10
  33598. }, null, 8, ["modelValue"])
  33599. ])
  33600. ], 512), [
  33601. [vShow, isShowAxis.value]
  33602. ]),
  33603. withDirectives(createElementVNode("div", _hoisted_51$1, [
  33604. _hoisted_52$1,
  33605. createElementVNode("div", _hoisted_53$1, [
  33606. createVNode(unref(ElInputNumber), {
  33607. modelValue: axisZ.value,
  33608. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => axisZ.value = $event),
  33609. precision: 2,
  33610. step: 0.1,
  33611. max: 10
  33612. }, null, 8, ["modelValue"])
  33613. ])
  33614. ], 512), [
  33615. [vShow, isShowAxis.value]
  33616. ]),
  33617. createElementVNode("div", _hoisted_54$1, [
  33618. createVNode(unref(ElButtonGroup), null, {
  33619. default: withCtx(() => [
  33620. createVNode(unref(ElButton), {
  33621. type: "primary",
  33622. icon: unref(edit_default),
  33623. onClick: _cache[16] || (_cache[16] = ($event) => submit())
  33624. }, {
  33625. default: withCtx(() => [
  33626. createTextVNode("\u4FEE\u6539")
  33627. ]),
  33628. _: 1
  33629. }, 8, ["icon"]),
  33630. createVNode(unref(ElButton), {
  33631. type: "primary",
  33632. style: { "background-color": "rgb(222, 146, 47)" },
  33633. icon: unref(delete_default),
  33634. onClick: _cache[17] || (_cache[17] = ($event) => remove2())
  33635. }, {
  33636. default: withCtx(() => [
  33637. createTextVNode("\u5220\u9664")
  33638. ]),
  33639. _: 1
  33640. }, 8, ["icon"]),
  33641. createVNode(unref(ElButton), {
  33642. type: "primary",
  33643. style: { "background-color": "rgb(126, 128, 135)" },
  33644. icon: unref(close_default),
  33645. onClick: _cache[18] || (_cache[18] = ($event) => close())
  33646. }, {
  33647. default: withCtx(() => [
  33648. createTextVNode("\u5173\u95ED")
  33649. ]),
  33650. _: 1
  33651. }, 8, ["icon"])
  33652. ]),
  33653. _: 1
  33654. })
  33655. ])
  33656. ])
  33657. ]),
  33658. _: 1
  33659. }, 8, ["modelValue", "title", "style"])
  33660. ]);
  33661. };
  33662. }
  33663. };
  33664. var DialogEditProperty$2 = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["styles", [_style_0$2]]]);
  33665. Array.prototype.last = function() {
  33666. if (this === void 0 || this.length === void 0 || this.length === 0)
  33667. return void 0;
  33668. return this[this.length - 1];
  33669. };
  33670. Array.prototype.first = function() {
  33671. if (this === void 0 || this.length === void 0 || this.length === 0)
  33672. return void 0;
  33673. return this[0];
  33674. };
  33675. Cesium.Entity.prototype.setEditType = function(options2) {
  33676. this._editType = options2;
  33677. };
  33678. Cesium.Entity.prototype.getEditType = function() {
  33679. return this._editType;
  33680. };
  33681. Cesium.Entity.prototype.setEntityType = function(entityType) {
  33682. this._entityType = entityType;
  33683. };
  33684. Cesium.Entity.prototype.getEntityType = function(entityType) {
  33685. return this._entityType;
  33686. };
  33687. Cesium.Entity.prototype.setIsEdit = function(isEdit) {
  33688. this._isEdit = isEdit;
  33689. };
  33690. Cesium.Entity.prototype.getIsEdit = function() {
  33691. return this._isEdit;
  33692. };
  33693. Cesium.Entity.prototype.setParams = function(params) {
  33694. this._params = params;
  33695. };
  33696. Cesium.Entity.prototype.getParams = function() {
  33697. return this._params;
  33698. };
  33699. Cesium.Entity.prototype.bindEntity = function(entity) {
  33700. this._bindEntity = entity;
  33701. };
  33702. Cesium.Entity.prototype.getBindEntity = function() {
  33703. return this._bindEntity;
  33704. };
  33705. class DrawTools {
  33706. constructor(viewer2, options2) {
  33707. this._viewer = viewer2;
  33708. this._init(options2);
  33709. }
  33710. static initEditPropertyParams() {
  33711. return {
  33712. id: void 0,
  33713. height: 20,
  33714. bottomHeight: 0,
  33715. color: "rgba(0,255,0,0.75)",
  33716. direction: "horizontal",
  33717. order: "-",
  33718. count: 2,
  33719. text: "",
  33720. lineWidth: 0,
  33721. power: 0.25,
  33722. outlineWidth: 0,
  33723. outlineColor: "rgba(255,255,255,1)",
  33724. videoUrl: "",
  33725. duration: 1500,
  33726. odlineHeight: 1e3,
  33727. odlineCount: 50,
  33728. axisX: 0,
  33729. axisY: 0,
  33730. axisZ: 0
  33731. };
  33732. }
  33733. _init(options2) {
  33734. this._viewer.scene.globe.depthTestAgainstTerrain = true;
  33735. this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  33736. this._sketchEntityName = this._guid();
  33737. let dataSource = new Cesium.CustomDataSource(this._sketchEntityName);
  33738. this._viewer.dataSources.add(dataSource);
  33739. this._entities = dataSource.entities;
  33740. this._pointEntitys = [];
  33741. this._sketchPointImage = void 0;
  33742. this._iconNormal = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABwAAAAcEAYAAAAinQPXAAAABGdBTUEAALGPC/xhBQAAAAFzUkdCAK7OHOkAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlzAAAASAAAAEgARslrPgAAB2FJREFUWMO9mHtQlNcZxn/nW65GxHtEqTEajUxVoLYRSIyipHG4qG0lajtxVIRFubgqXuOI28ZE7FAvCLKLSNKxg/FSIzdvqNE62kaRitqpYMxovBGigo4I4n6nfwjsCrsLrtjnn53vnPe87/Oc9/2+854VdBhCd6ZP6dMHlAXO/lOngrzMLz/8EEQ0ASNGANNY2aOHxYIdfHr3LuBCwPnzQIKcf/AgiJ8pQV99BfmvR4+orHxZVsLxpZFT0qd07gyP7zqrej3IInF47lwQkTLV3d1xv3KXWPT4MYhLzMzIgHpn10+Sk+Gw74w+jx79HwSGnzUYhg4FED4FBcBq/jtokOOC2oSb0FZUgHpKVoeHQ9GtGM/y8lcgMLxf5juDBwNDlOWnTgGvUdWz5wsQ7c179fUWzz9y0tX1BdZPILeqCpTtil9QEOT9c876K1faWqS07XeMzJFuboCXkpaX1w5hqxl14QJIKYRWCzLV5OXtDQXbon3c3c2/TeMoYvncucAgPrl40Y7fA0zv1QtMydKwb58FL7toRwbDYo3/0utB3OD8qlX2hIkLqalwO0b9+fLlUHJOG9vQ0P4EjfyFIdPZGfqsURampIBIlxsWLLBtL/NltF4PhUIrVq92QGDIeEOmpye4pYju164Bq6n29LTiopy8tDTIL48pSExsDq/Oj9is/eAD4CRbli1DMEFUBAYCewnUaJD8jr2lpQjpJ7M2bBBi0+L47Tt2mP2G5xhNaWnAHrLj461tKF1rasA0rW5b//6w/0rigQcPWhrZKVFXP8TkybaFyb3kXbkCbiO6fpyU1Dwq58vNG3U6BJvEiYMHEcwQW8aNA3pT7O4OaPmTiwuCnlwcNQrEDRGYmytloilj5vr1Zv+mNXVhSUnmOFYEVnt6gtM9t+8mTbKlwo5AoWdySIjteWUcIwwG2LX7o6lPnkiZULTlj/7+wEThm5oKbCBeCOANUisqkNRxLCEBSSzrYmOB3jw6c8Yi3kL5K51OyvkZGXUTJz7LSH09CIPwMBpt85CHhMf48Q4IJFPofHzsbMAAJfjIEQtXC9TZWi0wkEuKAmjEyspKpNN2pyVBQULZaIjbvXmzUDb6xF0zGJCqv+no6NGAK5fLyiz8JssVcXEWgQLUsZZxWmGbrLTN057Agfh7eNiefhpRb7h922LgOzFp2DDzxnJXrsvLE0rqOW3sTz+12h4lLfRZhuQybuXmWmQkgPzhwy0o1jlV37ljh+e3/L1LF0cEXqX04UPb0075rlovLwtBHuqZ5845T5Z37UqbEAPkzOfsUvlHXZ35saFnQ4++fe04eIfftv64tEfgdvkXeweprFIvBQaaebJH+f3x4xbPvsRPnixlQlHGtDFjWq2Wuqj0yz4+QKk4FxNjMVXD2998Y0FRKEsCAuzwzBKv2eZpR6DspxQcPWpnvrNYoNNBZOTOnRoN0ilJMzYjA3ibsKoqoIxezs6gLJbpxcVSTbyePurwYSkT76VPKSgAWQslJcAmenTrBszgP7W1wBlRmZICY2SydHIC8ZCvdTo7Ak+ri44dcySDNDTs2mVufluhThoGD4bHp6or4uOb3zWJnoqwMGAVLnfuACHscHJCiFRmhISA0BMcFob52PDC/8EDkLfkR5GRQmycN8/t8mXw8O73WVwctnvdJ3SqrQXNSJeY3bttaWhHJxMxzDh97VqQAwheutR2IC6pm/z8oOBm7LcVFVJNKNo0oUsXhBKmGR0VBfI0vkFBINzExxoNEKP+ePYsktefFmVnC2Vjvm5SZSVEpGUNefNNUH8ti8rKQCziaOfOVuL2563PP4eCjJhxK1a8hMCJJ7NTPDxAXWIaefEi0J2r/ftbMfyryDhxAkZ2u1EaHAx6oReq2rb/JiTLZKkoUHLf2//YMWCGnPf++1YM7zHw+nVQ1mlKhg2DvPeiltr+GLaj2W524Kd6zZ4NhGOQ0ophI6GSkr4Gq61VGyjx7vdZQoIdYY1xVZ06RKttS1gTHLkPLjVmGo3AJZToaCsGjSWrPFBKfH3bvta0uyR3ySlGIxS4a7trte1l244MtoRpT93XSUk0l0oruFDbqROYUtQ9X3xhLr2WaBpX4+WnOTl2hHkw9eZN0Li5dLP6Dehogc1dexslK/7MynffhbNDvZXnWq9GNJWyiKC69TlphvobtWbOHNgnZonq6hdl+xL/yTQhbKUxeOtWEP9melSUFYMWJSv/IAtNprZLUu4Rf9u6FQpdo49bfRXaBQcy2BL1p+XURYtAZrLwhx+sGDSWrDpc3ZeVBbJMPt22zY6wRj/1oep08zXMUXRABpsQFmqcHhICYiLlhw4BBWiFA/5FOXmhoc8u0Pv3vyyrDshgEwqLYnKLi4FO5OfkvPh66UdudnZHCXsFAptQ96XMW7jQTsm2xAF23roFlD6NXLy4o9m8AoHFR7SxNTWgjGOsVovtxqBxXAzEbc4cKCycN+/+/Y7n88oRvjarcNYsCDtprP/+ewjvZ1xz9SpERBp3zpz5qqP/D5zQE33tptaiAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDIyLTA0LTA5VDE2OjQyOjI5KzA4OjAwjRBbGwAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyMi0wNC0wOVQxNjo0MjoyOSswODowMPxN46cAAABKdEVYdHN2ZzpiYXNlLXVyaQBmaWxlOi8vL2hvbWUvYWRtaW4vaWNvbi1mb250L3RtcC9pY29uXzJhcHo1b3VpcnV4L2Rpbmd3ZWkuc3ZncY9vkgAAAABJRU5ErkJggg==";
  33743. this._iconBlue = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MkEyMUE1MDg3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MkEyMUE1MDc3NTAyMTFFREI0RUY4MjBCRjRGRDc0QUIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pv/grmkAAAhxSURBVHjazFoLUFVFGN49597LBdFUEpEQI0IpyxIfqU1ZkY/pNZg1RZlWY2lW4yMncxq18oHZ0+lhOaWZUo0zPjIr8W1NiubI+AxBIkRQQsQE7us8tv3P7qGL7gXOPRdzZ3bmcnf3+7/v/Lv/+f/lYkIIMpur2yBktQVO5yM7LRybIvsOFKFGCeHyQz/dFO2Ousflcg6UJSlVlqVEjHEMjNMH5tE0vVLT9ZJAQNnn9fm3d+9z3xEYioR9bNcjW9Z8Gtv35l7PUAFjnU5HLytrFUU9TgV9XXD4+PJhoyfV2/GIFO4TGD8my1lVuGXSHYNuPdyhfbv5VkVAgzWwFjAACzAvp0fwoV++uz6lxzXLolzOW1AEmz+gHCwtq3i2z52Pn2jtlgvXI1LpgQ0jeqYm74y0CGiACdjUxkir3KxMlsoKNj6WmNAlV5Kk9qiNGmBTG6vAlhV+rd1aUuGeNSNSeiSuolGo2X1cdDogbThQ79h21CMfP6NKtR4dw/edYiTSK8GhZ/aO0R7KiFV7dnPpzeFQXkppWeWY9MGj8+ifektbqzVC8KbVH6UNHdJvOw2nHUIB7vrDI89df861p0SRsUSjuiSzB4qxyYzx0TVEdBUNTnVqs7I6B4beEKOFwqThuu7X/IJ7hj/yYlGoM9NqIakpSVH7t67c3C4muq8IyKcQ9EpuddSK3xqcSHJR7g7WsSkCm8+YiSEgRuU9gMbd3k5578kufrcTC8U0eLwF/e99anhJ6Sm/HSHSid/Xv5CclJAjAjlXr+GHP6x07z9JZCSDCBfzBJapBomJabJfdKqFCiGa4RkQgrQA6p+MtbVTEn2dY2XhUz956szM6wdkLRFtsVZFrReeeaRTQte46aIxT4DgrA9ABJKRw42QTLsjimqATgUZwpxNO/0OGz3KmMvWuBFgABZgimwBB+ASbtSSp0zIHutyOuNEg9NW/e06UE49YRBi5LFB2NxaMoQg5iGJfza+Y+MwlwlmogALMIXpD+UAXIBTOEKi4rt0zg51sFft8TjN7YQbnzrbVpeeD8Q+w3fYFCQba9ha5kHABGyRTcrlCeBkVQjO/Wxeb3rA00WDb62rcbHzAARML0hBAloK+lyQ4TEHx2B4BragUS69vl06/6aLnk6LQuQ+vdMyRQMHT/ql/D9VGfEQi00PGFDYwqsP8/AsMQyJbTvABhuiFb3TU+8Otb1CCXFd1SF2gGhg/f56Bw4+B9iCJ0J5Bv93fgAbbIimd7yq/UDgZklITLQ7RTSwp9grs7MgBYXYMEQ0OTtBWBR7d5FX+NQ5J0tCHG63K0GYglSpkrklGkXY1GGKMbdo8d+qkBfn5LB0RpwOeDlc2mo9NNYHbyOMIuCRptvNsCGqXxgnS2dEoslhxMrgSDXOSbL0HlFVzSv6vlMMJigorWGpnJ2ymzRdTrENGxY4NSeE+PwBYQ3ds6tDN1IewvvFRMLQwTBMPB2lxTuEaTvnRKwI0S/U1ZeLBganRWtGwteYAOoR8EgQFsUe3DNamNpzTroVIWp1TW2xaCCrf6xKzDScaP89SRKGGBLkCSMjVo1aZRS1IZrOOalWhCgHjxTvEw3ckhylD7rOobF6ghZJphhk1TO80DK8Yab1KgJssCHMKhgnxYqQQM7i5bv9AaVONDh7VFzAqCWMekLhRZIFzzQWWLzIMjAY3qwsii2+YakDTsDNkkdoRVZbXHLyN9EglKdjh8QoUBSBcaIDEYU91cbtRi7yUFCF2OgBha9lBRZg3nWjuPQFLsDJqkfAtfWfr1jzDSHiR/zuk/GBjO5YQyqtQDU/5WYKCjo/Oicd/JmPw1xYA2sBA7AAM8RFBAEuwMnqYTei3Q95vx47U1VzTJj3uDBZNzXRl9EdUTE+SshnECJcFPOWwraNxj0GYo3OyLM1PgQYgAWYIlvAAbgAp3AKK6XyTPXZ56bOm0f3p/BFFEdr7LwZSd5xQ9wKUukUo/u4h8SdecCHzPmwdtOMJF9ciHodbE+cvmA+cAm1rVoSAsD1m3fmH127cfvSUJOiXRh98nS8/8dpXb0DknWNKB5qzsOIKlwYdIULpWMwB+ZunNrVC2tDeQIa2P552+4jfFsROxd0sbRfm5/31dyMPumZLQWkwsqA9EOTCzqCzdTGvKB7MCNWTU9s/oIOWsHh41tvGz5uNv34Fxdi64IOvNaxQ/t2aXvzVixKTUnqezkSRBqhCm4bMW7GhboGuJw7H+qQW7nEBoALFPCvOx8cP+toYUl+W4v4o6h0L9iiNkvBdnNXplYvsSEtOFddc75owLCxc6jLd7aVCMDulzlmDtgCm6FSEju38RAxztJUumTkoy+9faqyqjDSIgDzgezJi6gN+P9Is1HKjpBGz9T+U1cy+ulXZ9XU/lMRKRGABZjUEyeseCJcIY1i6BY4NmHagjlen/+CXREUow6wADMcEeEKQTxxq96wadfvCz9cvpBuBSVcEbCWYuQAFmCGSgrbSojx0qW9KmfxV5u/zP1+MTEqI6vlCNFhLWAAFsdEl1sIvIAgdTn98muL1mzZtXe1VYCtv+xbDWsBg2OR/0OIKaaB9ooHsqcsoXt8h4Uwu+P+xyfD/zwqOIatHw7YFQJvVthSUICVDxs9Kae0rOJwS2vKyk8fgbmwhq/V7fKwLYSLgWLoPLz9s59//c3mwjKMPTZ+5hswl6ceWiQ4REQIF2OE5QOHCo9NfCVndoPHW3vxHPgOxmAOzOVr0BUlhIuB0Hn2+5937p/77hcLgsMyfF7wwbKFMAZz+Fx0RQoJDsvvL8ndYYZlM8y+8/HKbXbDbKgW8ftd+qQJLQcglFZCaE3qFn81wogEh1mYE/F74bb64RnFAm/DDwy6mPdrkJLzKGfLpsj+vwIMACSZzfDJFmOPAAAAAElFTkSuQmCC";
  33744. this._iconGreen = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MjI1NDIwOUU3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MjI1NDIwOUQ3NTAyMTFFRDk0MTJGQzhGMTFCQkREODIiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgEE4igAAAgKSURBVHjazFoJbFRVFP3L/OlMoQXKImAFm0JbFtFKShEQI6UsggmkGKghIKTIIgZUohIDKEuLaFTQiIKyKKghqSyyF0pZbcHQsJVpoRkKbYFAW+iU2f78/313+qY+hvc78+dPkZfcMJ377rn3/Pve/fe9gVUUhfENY5eBjNbhvlnI6Bmh+KT5NzBhGigg9sb5vX3NpohhRqMwgOe4eJ7nurIsGwl69MDskiRXS7Jc7naLpx1OV/4z/V67CKpw+Gf1ZiQv9/vWyc8lTkMEpgiCIVGLrSh6ShGhX4ovlG5Mz5jToCcjXKhPIGvyOOG2JW/OywNfuBAd1WqFVhIwwAZsAQOwAPNxZoQ9f+yPHnHdn94QYRSeZ8I4XG7xnLWianq/oZOuBrvkQs0IZz27a2RCfLeCcJOAAZiAjXyM0hqblslcRfHuiV07d9zKcVwU00IDsJGPLeBLS3zBLi3O8nfuyLjuXbegKtTsOrY4Ldz22u2GPFue4bL7MlfrqWXh+xhDjNLL2EtOj0r3jI8Z70kyJcnN4aC4RGtF9eSklzIOoD/lQEsrGCLs/m3f9nxlUP98VE6j1QDz6/P5xZWLI06KJ3lGwIWdB2tfZEgkJB4oVwwzWBgsLY1d6hoWPUxSw0Tl2na8sHjYiAnvlKntmaD3SHxcrDG1f9/1aiScspOZYZ1hGm4dHnmSRyRglk+i/ITQwVywAVvAoA3kMyolufc6iEHv0uKuntkxu1ts5xyacY2nhh1TNsZcpBTxjBl2K4AQ2eD8MiITWXFDmULiYJhUNlXak7DH0d7QnvrUr1feWtgjZdxa2hILKiOzp01o1/mp9gtoOrtsZ0eXjjYXMYhEa/RFKyxmLCaCmBF/NhF633xkCxiABZg0XxADxBJq1eLnz8ycYhSE9jTl3Iq5EWeYM/wjwUPQvj1CEwHP8SMFWIBJbX9QDBALzrNmIhGdOsZkqm3sTfWbhKbgTcSSMhBLiiYcMc9I2CMswARsmk8Uy5s4r5qIsFt/WN6nVaQ5iaZcVLkoQjEpjbD++4IM+hFUQniCDMYBTMCm+USxJP6+bkVfFWRVIny/Pj3TaIpiezF3SjzFN619AaNwRLABSwzhnSOWGxLABh80sz5J8a+qLS81IsY20a1TaIrc2lzhoX3A+2Ui6FcxkRn+4f3j9UEZbdtEDcCUgycSaTbF0RQnGk7wTY79S2xIbSvGIDCPNxynPnUckyYiBpPJ2JmmKBVLuSYCXIA9EWxWWAIPYZeJZdS4cEwGTXtEMBhMNEWthHonVieB5gix2Aft/NIYk6Y9wqHmMGzH4HANHBOn6T3i8UgO2vcxfIzibTdI0Tv88Lw+NMTUHBHF6XJTz9CJQqLs7ZdkLHoIkbbyf71YgpBAbdtxTIoWInK9reEGTTGk9RCpqfGTCDJ6skE2kxL2QRk4JlkLEc+dmrorNEVGTIbo7VxFgowUQlYU4oxCnFMAe0LMBJFmgmPyaCEinrt45TRNkRyZLA8SBkleMj5CMvGclCBJMIQdJgAC2OCDZoZjErUQcees3njK5RZtNOWy2GUu1sk2nidcOAiPX2aUAHvC/1yCBDDh1Khyw2KDmLBF8Bkpt1bWXSm/fpKmhOPp9OjpIhyKGCcWHxkPpQj4b2oPQcJnj7AAMy06jbo/IBaISWtGwF3Dj5tzf1PIIyQx1nRf40phUiTmQWMQTaTI/ePx2wPEPvAF7xWEAViAqXIRoUAsEJPWze6tdn8dOF5y63ZNCbXv4SKVvYl7HSkKItPQGMwjpFx+4he8V5AtYAAWYNJ8QQwQC0bQfLASq2/duTvjveXL0fqkvog6GDooR3sdtWdFZomsjW18Xj5SdhXBwYOADdgW9CpwAJbK3nDMWpC9AmJRW1aBiABww8GCwkt/7s5fpzbJzJmZ9XHrnYfiDtkHSgMlph59CSXC9y8phA7m5sXl2cFWLRMwwPe+w6cuYvqKngs6uFp4tvDApmUv9ktKC1RZSxwl3I66HYaD9QcNFtHC+RpAaDuShCR5RPQIz7h24zy9zb3lQFjFF0oPpY6Yuhh9vIaJ6Lqgg6y1jY5q1bPowOZV8XGxyY+jQUQVqjh15NSP6m0P4HLuntom13KJDQD1CPDa0NezFl2ylBe2NInLZdYi8IV8WvGCDJi9YC+JoXDW3qm5V5aSPmUJSnlBS5EA7P5pk5eAL/Cp1pLouY2HinEXtdLlo96Y+3ll9W1LuEkA5tjMeauQD/h9pNkqpYdIU2bq7tvKM976cFFN3f2qcJEALMBEmbiqJROhEmkig5ZAycz3s5c4nK56vSQQhg2wADMUEqESYXCTcWfX/qNnVn6zcSVaCmKoJMAWYeQAFmCqNYUtRYTBTcftnNWbDv68dedqVMZlrQBgA7aAAVgYk3ncRBTcNd189+NVuXlHi7ZpBTh07PQ2sAUMjKX8H0R8ZKB7qhqbOX8tWuNHNJTZI2MmzYPfPKowhq5rDL1E4M0q4w7qRnrGnBxrRdWFQDYVN25ehLlgg21lvXHoJoLJwInjHrz9M9/+5LPmyjLoJmYt/BTm4tZDCkcMYSGCyXjL8tnzlpJZH+QsfmB31PnPge9AB3NgLrZhnigimAyUzrs79xX8s+zLn7LJsgyfs7/esBJ0MAfPZZ5IImRZ/mrt1iO+suwrs1989+thvWVWbYT9fhc9aQUdB6CUVkNpje3SqQPDMgpZZmFO2O+FW+o/niEsyDb8qt7Rd78GLTmucrp80vz/K8AAYAEv1AHM/GwAAAAASUVORK5CYII=";
  33745. this._iconViolet = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDozNjZmZDYyMy02NmE4LWYzNDUtODc4MC00YmMwY2IzZWM4OTMiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6MzFDREU3Mjk3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6MzFDREU3Mjg3NTAyMTFFREE4MThDODBGNzMxNDBCQzEiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6OWFmM2ZiODktNzQ4OS1kMDRkLTkyNzUtZDM5MWNhYzYwMGE1IiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjM2NmZkNjIzLTY2YTgtZjM0NS04NzgwLTRiYzBjYjNlYzg5MyIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Ppb+WxIAAAhcSURBVHjazFoLcFTVGb6vvdnNY0lEEJOIxhCSKTEFKSC1osIgjqIyA62mZfAxWJU+tC3TVh2lHSGhtNOKOqK0ii+0QwcfFB+IAsKIITpJhUBDHhMiSSBCTMgm2d377PnungubnXOT3L0b6rlzmM2e83/n+87/n/+ecxbeNE3OLvLFV3Fui3KiivNSkhmTNb7EpagQQvzxg++VBvxpc2XZN1MUhEJRFHJ5nk9HO5mwAV03OnTDaFYUtTocie66pOymOjSlYnzeq0d2bn02c9oVxXcTAct8PqnYja2qakeJoFdqDx3dNH/xij4vHhGSnYHlSxf5Out3rrjmqqmHglkZa9yKQIENbIEBLGCeT4/wB/f+c1LBpXkvpsm+73IpLFFF/bKltf2esjl3NI005JL1iNBSs23B5MKJe1ItAgWYwCZj3OiWm5vOQmvt9ttzJ4zbLAhCFjdKBdhkjNcwlht+Iw0tof6zrQsKLs19jWShIeM40hASure3S727O0WloV/QehTeSo/ZsilPzjCC11+k5yzM0/yTs4yhcAgvtaW1Y2nJ7MU7yJ/GcKE1EiH8B1ueLrr2+9N3kXQadAIM7f1abK84LEcOnBFFXuREMpk8TyrHx4jhMQ1OJ5x0U+f8s8boeY9MUbLmjNedMEm6Du2rqp17w5KfNTitmRGvkcKCfHnW9NK/O4kwIjp37JdfpDUv+jSgVw+IASHAofpRef/gSttQ0Rc2sAUGq5Axs2ZM+85GcPAaWkLT528/MDF/QiXLWPtG4Rt/tM+v1vSLMi9zPl4iniCVeASeEPjB82QQj8Az8IjOaZxqapxiKpzvygy9aMs1EekCmTnrX7WdfHjSjEUbWCE2Io88cPeSnAkXjV3J9ERY5xuX7PNrNQOin0/j0kiVUQUI8llVSnjs79FHpjawBQawgMkaCxzAJdmsJT50X/ky2ecby5yllTWy+p9+MY2PkYonb60RUuER1udBoixBMgcsYDK3P4QDuIBTMkLSxo+7oNxpYfe80eaLhZPMSSSkUAU8vPWvFVr2QrdimD7xfWw7nzUZMgdMYLPGJFx+DE5uhfCbn1s9JSM9UMJqbF9TJ5O5tNZEooh48o4Lk66fwWJIJZjAZtkQLsVvbFxTapm7ECKWTSmax2oYONgjRKp7RSluYbsRwRITS9cxQcDGGCybKSWF1zuFl5MQeUwwcwaroXtbmyTRWLdFkJekKxGDwo3nz4nB+iEVY7D6Z4/JmgluroSkB/wFrIa+z7rE2DyeWwfJiEhcO2fXD3n69p9mzjrl5EqI5PfLE5hv0qZ+gach4TacRhJmwFaaB5i8KCfJ1RrxSZKfuW3oUflE8l49kvg3xmCeX2KcXK0RMut8yo7BqSqUk+DqPaJpepjpqmyfaSbs30wPx24WFsZww2koIWYkqjDP0PKkDAO7WOuheyevBRgGxQS2XJjO3LZTTqYbIUZvqO84qyFz9lidyohtzenjRYT92LiZsy9kbocpJ8ONEO1UV3cjqyHn1nxNw+6V1tgsJicmdkaJCbDxgJ1zW77G6k85aW6EqF/WNVYzc3lZtuGfGdQ1sgXHVtwW4zbM4sPJ3tYDE9gYg2VDOaluhCiV6zftjypqiNWY92iponKKdZ7QaHUjJl6EbQ8sYOY+Uqo43LCEwAncXHmkuaWtu7H5q09ZjTieZv/kEhWHIpXURDHx6ydxLcT3OSdCsQ5YwAxeyz76ggs4ufUIXNv3/MtbXzfjj5BxZeK6aYpvaoYetUhECRnVqhoNNyvkTIP5WbNOh7H+sAUGsIDpcBFhggs4uV3sVrb79459R052dh1hGgZEs+hfP4hIU9P1iEUmapFSDGWQqPjnLHlDoQKiHGyBASxgssYCB3ABp2QOVmrHyVOn7/3V6tUkPpkvImlsmln83nXh4NJcNWKGuYgRIxcTpcQIx1fynd2OvrCBbfG710WA5bA2wvevrFgDLk5hNZwQAPd9uKfq8Jvbd210BPCL3GVPfS9a+PbVYWF6QA8bEBSrYYgzI1a1Ptvfk4q+l791dRi2Tp5Awdjvf7y/joaV6eWCLpPUy6p2vPTElWUl84bLSOH6XqHn3Xapd9fXotLUJ+jdmrUBFHMkU56UaQTnkkRxc54WKAkaw2HVHjr60awb7nycfDxGhXi6oIPXsoNZGUUHdry8rrAgf9r52CCSDFU7a8Gdv+sN9eNyrsdpkbu5xAZALwE8NueW5Y8drm+uGm0R/21oOYCxyJgtGHuoK1O3l9jYFnxzqqunYcb8ZauIy/eMlghgT5+3dBXGwphOWxIvt/HIGKfJVrr5xh/+/E9tHZ31qRYBzIXlD64jY+D3kSGzlBchZz3TfSbUvPiu3z7W1X2mPVUigAVM4okmN55IVshZMSQEjtz364pV4Ui016sIghECFjCTEZGsEI5u3E5t++CTz9c+uWktCQU1WRGwJRiVwAKm06ZwtIRYL11SOyvXv/ThC5vfWW/iaOf2PEJsYAsMYFFM7nwLwQsIW5cTv/j9uq07PzmwxS3AR3urt8AWGBTL/H8IscX04zp4YflDG0iM73aRZnfffMeD+M2jnWJ4Ovx7FYI3K0IKB7Dj8xevqGxpbT80nE3r8RN16Asbamt45eFZCBWDw1AP3v7lP330j0OlZbTdvvzhP6Av3XroqeCQEiFUjJWWaw7WH7n/N5WP9w+EuxP74Du0oQ/6UhvuWyWEikHqPP3O+3u+eOIv/6iIT8v4XPG3F9eiDX1oX+5bKSQ+Lf91w+bddlq20+yfn3n1Y69p1qmk/H6XzLRJjgNIpR1IrfkXj7+Q4zkzPs2iT8rvhUfrP54RLHgbv82Ps+/XsCWnWc7TmKzx/yfAAHo1CtU9myPWAAAAAElFTkSuQmCC";
  33746. this._image_arrow_forward = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4FpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4IDc5LjE2NDAzNiwgMjAxOS8wOC8xMy0wMTowNjo1NyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDplMWFmZGVkNi00MTJhLTc5NDAtYjQxMC04NDExNjRiMzQ0ODciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QTA3MThEMzhCMjc3MTFFRDg1ODdDNkY4OTc4ODRCRjUiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QTA3MThEMzdCMjc3MTFFRDg1ODdDNkY4OTc4ODRCRjUiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6YjI3YWU1YjEtZmRkMy0wOTQyLWIyMzUtMDFkYWY3YTJlNGUyIiBzdFJlZjpkb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6YWUwMWJjYWItYzAxZS04YTQyLTg4MjAtNDU1NmY4NDVmMjBiIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+BD9OfQAAEDhJREFUeNrsXT3PJEcRrho2QQ5IkAj4HfwJEhLInUHAjwBBgEACCRC2gAA5MEiQ2QRYpCQgPiJbsiAxyMYGm+O48927u+8WPd6Zd3t7u6qe6lnfe3tvt9Sa3Zmej+6uruep6i9+9NxzTPvAh4MQHf+Z09RCfsPRzUXInyOVa9b/Hnq4zMBdmnv9dhnp7enpDKtToJf9f04/5OZajQiwQhK4UmWskAUtTa3avSAV8aj9Ro7a7/JcDz34UtkVba/fp1JGLrCSpQvmx0EASnAfwZ8V650rgMugdAkA7lIhGGSQkMP1wxs1oqJds64jxIZOyg8jGTmZ2BXXdzfXOf2WozRykub4XAeWbiktK+deR5299G9+mhXgd1N8McU3z+wBqFrqNTLAQE0xYNE7ROKkS0J/n5hppJJXAQgBBT0SrBCH4yNP0K6TjsP3SfUZHlGxiA9ViEeNXOyyNLsszXVxXxmv1fTyDECL2Yazi7dJduRp1Vs9dJdQJ11nCF9K8ZMpfj/FN5pr9XQMgGptt1jPFEhvWd9FGp59Qdo9Gvk4h5XvfbsFvEPQMxF5JgeOZf0OgW8ZjPKI3jd/wzD9Lo+7gohcT+e3Bbko4674v90fOUXZHf7TLnvWdddwPfTQw4WEzaS7fp3ij1N8bYkHQLPec+bHDdZwrsxF8SZoYC8KYFDWETRUniv1fJieCDGAq/Z8bSwDWgZEtW4X37MiFSCV4LElTwwSQ494kXOfFP8/UXipNDLjkZ35sRGylBMXOX4X5zK4qxCOmVhsMwKSx43yf5OlXxf3dnLSQw89lPj9hRQ/m+KnU3w1xfvn8gBQ0JpHLFvb2q/34deUvxjWvgb0kT58Bq1hxPL13uNZ6QP4Tu97Ix4C6x2IFwUpj4hXQ3sH8u3oteg57TuQMkO+r/Xbau/PycmmIBzr7Pfj7Pp87Sr7vT785hRlk5GcHp5U6N74HvbtMJeI91J8IcWXU/xbCwGwQNvrG/cG7KGg7H2DRwyQ5wwKkUCfMVTyFiEELfdEAMRIV+06iRIA9PuRb1wK4lGiYZWRlq7iAQgTiyUEhQnv8tHS1fI9BGXMqmO0fq137DJisi7i1URO5uPj6fx4/DD7X6Zbd3LSwzNOAErMemkiAn8pSELIA+BZqwIAjzc1EL0HJSje/S1WeASQlzwXsbARr8K5PQHnsuqXehdQS/j0+n5Cq/atshBQ0XuigGqBfQuZGgJ5o4bvjJIjPkvdtsssSmZr77iavB8jyXiUkY2RiDyczj3Kfj+Yrn2YpZt/bzuO9XAmD0DeJfnHFL+T4m8mOTQJwED1PnAEqJda8BqAc+B7UOtaAGBBr0UHEUa+tQZcVlcABZWkl1YMMEIsYdS6jIAc6vmIgLTlGVpq0aNl3jImoREMmQ3vD0pUEALHhpyg+YwAey6XA0AgozNpWtoQ0v6HkD6IEc9tRkRmYvIgi/ez3/em4/+m45x2Qz1cEgEoceftFH9G+wGCf496AFr6/C0vAmLdKySDWZkGyNQ+6wAhHC0uejLARah9vECrm5waFFNUCVmgN5yWdwiIxsNQ1H/Uy+DlCx1vQADI1cBwiTKPkpHl3RKH6amtXo0ocYl6LILyeCNvVt2j71hC9lrG1ESeHSH2pOjWCBmJfFftnGTk5P5ERMb43+n/Byn+OzuXX3t89NS7OR5iA3jRxy6w36b4rRR/F+0CiPb7e258aQTw0gL20nrjDWrPo4pbGPVG5B4UT1miwNkKuMh5VPFFXP8RBbhUqbVaXUxtHpOlsw9axwNoRCPaBeC882ZciEcKqLCyW8BwaCgvVBZQr1K0Tmr1ER0/YbzrCITR5wr5U4qXkoaIt7Ce7uDFXGrkRL22BHo1kfdcTWTkPym+P5GSf9F+0N3b0//3p3MfTKTmNgkAVbDr9RS/meIvLAJgWebeNaL4QMCWlflQdhmZmRBhsS1MN2qha982NL4zYBFADXQIlsUSwGtR/i19wxGS0gpemLV5rDSHj58AwIAZ6FY5IhUWEQ6AOXM2HRm15j2PD/KcqCejdTYJUVvXFS98XlQnDQFdvAToOfunLYaG4gY34gWqbxEvMOopR7zn6AJ2+e/Re/K9FH+S4ju1ymwJEVIghjVuFYoEGpL1DXkQsFKIsLUKECdUba47WnZWHpD8ksMQvWfXGGb5OgG+Q1tVMvqM8t7IEtNI2VvpxCkvtEyl+l3ilgEiP1q55jIoC/NuvFfYaMMElE9lczGxvo0b86DVpSzQhWiQxvtr+kiMMhanDUXzKISvr4J4bP16FHd/FqTurXYrICC31BNSJ2zIXjkxXoB2VMvPp1L8Woo/TfFzHgEQowAFLMDagjxcqUA/87oClYAyJ6XhREBTAvfVCIYYjVCAckbA2RJycQSFi5+sAEe+uI6leFhRHlEm3KJEBbB4tPITkOwyqFS1bjJk4SdEYUfkWQy5jACCR0CI6otfeRa/V67aQl8CKO4WHdEOnAzLbfRJUskvA+DikVEEsDQ9jui0aSqySbzYAVAkPy1BFmALGwZOxEjQu4TFXKRNHHzLr30+xV+m+HyKn5m7AKIsDun3j/7mhvdaFSCAuxeZdsgN744+h2l5l4D3HM2diPZpou9t7Y/kQF644T1L3LWeaxidf3/OkfBaHpeU//H3H/f9L51aiHxvax211Dc6Y6Hl2+y9Pc4jk0u6ABHdQKAcU7DMiOJufG09EwGIJOKab+2eRvR+BNPQay33l+U1jm14ZWkXAOLGRdiWtyMgwlS5YG7sMGEBLUfEOkI2B0LvQayUSFeC57KNHKPWYst+EFFvTov3hSqeDW/cS83iQrtmOOB2RNtRixsQUSaHe8VU9uLLJyPtwHPtCpDO86awo7ti9ciwXrQs9mjdWN8kDe2vxTpmMD/syLJXl863SkQfH+sutrzbWXcmm1vXe5a2AN5YT68zWJ4Casmq7AyKwvAEp6XwLUUgZG+ZS6DLiEFBR9YxkEAjkqAyQIkJohxa6oYbFZKnTCOKBumSEPCd7NSfp+ijOz8iZRx1US6RM1baBBmuTISIWG3QyydX+u2lkq3IeB5PFoXaBluhXT45MYoYRXWChZPEsq2KAcLR8Q61vAoom7WxJZ7coWSnTCaAnvHSlLMSiu/NBpmKWocCkOzIFveahR4h2/Z7T+9+K8WvpPjVAQQhcVwe3qA6MQqOlYxG9xhA+8JrDVEChYsCnShPbLHUCWDT5DRmURpqpIxR0EStXAZkDQEetHykoazF8FIJQESQvFnAICH5wrInAcvcIgZWPpV3iNUGI4NzEY+HOHUaLVNkDECE7EmQwJfGS8Qjxwu/2+prZooPxEXD9GzxNiQD88za96K6PGIMoeO4JNjOI56c8v5x98Av0n6RoH8OhkUsgRcgzDHafyFKYxEQQKKj7cXJjwDP1nY95IyNSYBsRZUyWgcRa9ADfw4KJUK20MGlrcCOKuiagovOICDCBxp6HiiEVHBxyfPIWXKlDTBjhda2TBVm0DPIwLdansAzWKGmvLIB7l6/bMSrihJDDsihAM9EZrGgso2Ut+ZdEDBfClEQRM8tGVQYGQ+HzqjgRlnIwzgN8Ospfjk94g/zyVWgceQL5HhuIc2NoW1L28JbvalsnmJh0l3hVtcCG+RkVoaSuQnRDYc0j4onIBJQdJGpY0T1LYUHUJFGWLrnoq2VkCdDkcWrPBlG9r4gh0wPhocGXWZbew7apiJWk9Zm60RFTCJXey4B8sYV/dNKvgT0aFkyUNMBg6NbvHyDg7g+uh1tUyh5x9pbnawg7QuRI03movPoa3p7AGW4xQMTbVe2YViXj3yRoX9Mv9+lvQv/JcczldfFGyl+g24WAsoaa8NCQHkYCJ8T2rKgD9JAoqsORhd0QI6WVUPA957jHZHvtlcRq2+gg74/siOdZQW2bK1L1L4KHJKvc64EiD4HSVdZclm9Z2iUjSUb6Gh7EZTph2A5WGVTy0skr6i8DwvaSPS7tbIWalvds2X5cDrjEWmnSBu2cGm+Pu6P8HCyhMcV+8b9DsbV/O5NwPredP4eHZYgHuMVPZ1hA+CjuxTwymHiOaCK40KuMZjWUbkUuP9wD9+42D2LGbGgIiPRxWGibFg5FqNGLHbPJW+5n+vCI6bl6b2fHE8KSo4igxSt+cMSlLn8dq4UBiKTkXn4iOcqQqzF8Rp49eYt2d3igSNjvQjNChycNJ6F7xGhljU8kFlTeTqtrMXw9NW8C0L24EV2dAgH2i5ax1s63unwwQSu8wZDI9iOGwyNS+jOa/3fn9KO6caNinbUw5JgyRa0GdDKAARRFLG2+AYFG5jnMkVchcfXxHTdiuOytZSOVejS2IC8iszeXe0HMdxtVeCKEiPNnUkG2A+Om8xTWFYdDUG3YsTNq8iJIKSPi+pBVy9ESKEF2uKAH5tk2RfHSBtBlVWETFl6wUuHki7U4CjbFgfbCmLZbiaLbd5mON9e+PEEpjPQPiyAd073cEq7DpssPVxyyLs7RlL1pxS/TcB2wKvTB90IuFQ8AB7bVBqrKnFRDwHaFy4KMEWtaALf4ylZbzlhtr0BQgB4ZdfFy5vQMitVUymn9+XDH22PAkoKo91U1iJRnifCA2zLY6Kl1/oovXtbPQ6R+pSK/LSQWlEs5+hAPQHPkWKhXk3AupkAcjMB5Ayy60lBbjLwvJqANU/3+ADOcvnQ2cH/GQF9zrFhrtWXU/xRin/+SK4dsrc6VSriWRfIspGFkpOWxoxaz4hLNToTAPVgsML+I6QGAT0UCCygtFb+I8dNGtnKWahcubo+gLSlqwWx6C2wQWUw6i2QLFfeltgEeFUsMuN1B1nuZ3Y8CdaztxmYXhf/1wXYrqfj1RTXWZp1FrcTuG6n2EMPlxuerGeFC8NwHMPwQoo/T/GvKNlbATwRcYtrykb7BGQhHgZca0SxEdh4FR6P5EcsO9QyQ6bRRTd6sfpErbXfkVH/5RKcrVaZZ1Eu8UoI4BmxtoC2ABdfXEYgi3j+v52AdDfF6+zcNvu9no4zuO4ygN1mxxyQt0XsNl8Pt45Yd8Emv6Xw+xR/mOKrtB9nAYeVAVxWP3wNlL3FIKzlZJGFJFpdksgKS6cgJJDF71mRiNehVYxQELY2S4m4l6XY4tUjIMrzquMTKOAN0DbSmcFUClC9zq7PabbF9esCgL1z+bN66OFCgb2D/4WHUQe9Qvstfl9recAKAMxaPz7iXkUGEVrWaHS0bmR+prezUmSN+cg3Bqxtt3VHRjWj3QRz2BWWKhXgqh132f/r7Pz14Zzk13fF9fIZPfTQwwWZoj08sfAO7Vf1+0GKr7dywJUBTBGhQheI8abLnQJsm5cq0reqLUHsjWL33scFoFrLD9eWRC1jDYRr50T5Lx1Ye+hWcA/PRpWdo34vWkZ+leKLKb65hAPm2wHrGxacTnPSRq7nA5G8qTBWvzS6ap4G4LVZCzXQ9YBYA2frd1dcXXH1cJfq86z134Wpy9uTCyvAYt4Vq8LlVm0NdLm4tmSnPLp7rUG6BF9avqTX0Z1ugnLOcu51dOdE9xbz9n8BBgASWdK5g1XGVgAAAABJRU5ErkJggg==";
  33747. this._image_arrow_reverse = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA4FpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ4IDc5LjE2NDAzNiwgMjAxOS8wOC8xMy0wMTowNjo1NyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDplMWFmZGVkNi00MTJhLTc5NDAtYjQxMC04NDExNjRiMzQ0ODciIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QThBQTYyN0ZCMjc2MTFFREIzM0E4RjQ4Q0YwQTgyMzgiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QThBQTYyN0VCMjc2MTFFREIzM0E4RjQ4Q0YwQTgyMzgiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIxLjAgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6YmIzYjdkNGEtYmQwYi04YjRjLTkwNmQtMTRhMTNkNjEwZWUxIiBzdFJlZjpkb2N1bWVudElEPSJhZG9iZTpkb2NpZDpwaG90b3Nob3A6YWUwMWJjYWItYzAxZS04YTQyLTg4MjAtNDU1NmY4NDVmMjBiIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+EmbDrAAAEJdJREFUeNrsXTuPJEkRjujpmdnd2b1bYFkEAhwkpMPi7eCiQ+LuPAyEEMLhcQiQDgmEARL8AhxMDHxsHH4C+Hg4CAMDIYGziBMVZO1k7WRnZ0R8kdWz2zObKeVUVU898hEZX0RkZCQ/ubigkQ6UOGUZzfDc2mq096CRkUa6WRSNXEvjf61R4Y0Q2b1n5/anJ9vRJwdMchM51gsqsxzJOwaQHvF4Gl03UpjSuQJTNs6RY+vcAmiPgqU4SuN3Nu6pn6/vpaYAcXlX+it7zx5CAPh4yt9N+UdD5B9cdqRb2MVDEx+C2lXaFEC65M3e9WVdNo17qLimxrtQUK4BT4JAK8a79Puu+sh6PzsAbfU4eh83hIGWYLBb6upZXjkF8FrKP0z5zZQ/Mkbw4CQjje6/vroYFbs9dS4B86Q4X643jazdvylAe6OA9qYBrhYQWsCn3cPF+T7YcjpK6LseaCP3i6JRTwYga4KGouk/rTZaXsti4Akr1rUYAsMqC8DrKX875TdoTCUMrX6k0f3XXhc5VJ25ANNtAZ7pnNO5nFxd00mRN9X1SQW62+Ld1ADpqXGsAXJJUwDAIs+Vx6mhNUqwHaegOLqvqcrevPYUpBJ26iBgucT4vdayq3ex5J+l+qwlmrID/K2yMnC/oNaDHuB+JWv8P0j5s4PbjjTSSApz2xYgelacn+bz0+Ke1vW2AOJtA4ALcN1hwNLQ6ATTKoUqAPKeE0c71jRNUTRvD6AsIBADyFogwQ6AIMcIeCMAHRUErHl0ZF4dMa9b78/lFDa+L2A7tMo9BWik+p1dISQqAHws5a+l/HbKj4eqOZJLiiNdZ1q01gSccpZB9jQfl/Pz4nzJdwqwPasA+bQCWc3Ui4IeApbe8572Kw3iYwWgxKFWSwuManHeNy2Q9kaTOPXSwKp3zrlHSy4BDNXMyzZloF0toYDJd7SjgBZOQLvYNKKXuvWtloCItkfp9Ke2FyoAzEzhkxn4vzHY/kgm+d4+kD3LoHleHJff7uXjct26r8wL0G46gbNxnyAg7Wlz0wG0Me0+uQYq85hbbQHwTKceOEgQoJl057AImGvz59c0Ck2nC0SAsSwEqHUj8i2tv7W+pUa7liA7AZYAcjR9XdgRWKjQ2pEBywI8jhABYPYS/FLKP075M44JY6SRetK2ANN71fn9lO9mOrxbnN8rQDb9xudZCz4HwJQCGiqBYCrgdy0mEQE5URibKMylBSyTo915jDwyt6oxPA9E2Dm3NH1vbpsbWqsoJdO0X68fUS3dA3A22l2CVgkPG7yyS/D9njCDrGsXh75QS4vnG4GAMgP9x+AYQdf0E/AeBvjIznOeADB79s+Oft9M+UMdHT/S8aTTDKYX+fggHx/m45xfKc7vF0C7AO8W1IpQMEU0UNDbWFBty5ofZEcLbmkOEziAGRw/GuAJyCQQTcn5bcd7mQDNFxG2LOBH6hRhlhJoBwZaCtWEkekGASwmaN9pQoUlVEVAlp1xbD13ZfrfXzqHCCkofSA0JqBAbbUTg2MgMi4twQ39dlRw2HmvJQB8IeWfpvzFbLrs/eDtTfstcSeD6KsZWJfjo5TfW/3vYb5eQJZBCdUC0QjoSsXsraU7iObqMVbLgckzBzL5c55rrFKKRsZSRc5q1S3yXTkotelOQ+1nd9mxYVYUAjTuKIhbtIy8R8hehsVAm7cAaAKEC+kQxObb5nnY1vun9ruejUV07hrR/D0rQ49AgDgPlrCPll8DYDZ4j7XKAPX94ICiwri1gEuLCgMKR6v9vPpq/JaBMqvLAL+a8s9S/gQ4yJ5nupfB9P0pvy+D62ydeJx/e5R/f0++75zwtaM1o2ETbMVkEhbD84A+Im55modjOhNES/YGbO2tKo4Jc6qKxEGQtPquZWZEwFP7DOpVjWjZiBNaRNjSn69DgTRLxajzXI+w52nvHASwCMP3hCgUzHumLsrHUS18GYvsCBwC1Kc13iyTeY8JGp3TZ0f7RpwNifS1+Uy+74qQ7ZDI4Phkh883VkMIO+2D8lbNzB9RLqBVAB9M+Vspv5M1VW9wlum/hikqEDzBNO2g0Zs8k6VHpIjJkU2T3GVwCwl0kucbiswptjRAD+gQT1tkTi0aSMQyM0faHPm/xTBaXstEWJANhUaYC00OnSJwono1wVoTgBbx1KFfeV6WvCXgSxnyBZ33D5k0wXFCDlj0Wm487dYTJGVlu7ToF5nKWcrlOechJmzptE5EV2VooI2sXkBC8EZB1uOHETrRcDTSvlDfbIobPpfyb1L+RQP8EQmbi4GOgDgDxBQdgKz8xgEtEjGbeYO3Bf51Ga0wl8g1NcxKPVYai2ARKZgp7nTEnQyWgMFFjgk5aiJG+1EarxFQqyWDuS2XDJgwo3WghoUPmS+NMJ3yK0hYVqTNidYt2+qxOiCgzEFabwFb4B1sjePI8jEkLgEFtU82ymLRT9STXYzvInSEWi0JrCOTv6lP6/9s/I7wn640CwAfoEsnv9+l/GWDcLgxANsgJeoAYqBCHlPmQOcQ2V6n67UaHUQ5rmWwxVSteSNR+icCusi8Uk0L3txcb3v2vMVjwuibGHiHN6fp0UOLltmhFXTuMsI4OWhdQTScqGc7U3tumcE+ZpApinOftWGMHEB4RcBdwH7hhgVNW+/P1WcZsKwi1lOvLSLToBauRPi8p2R69BzhERq2eMKkF6CICfOVQKze7vTYPAXw65Tfot3lU0joQURjRADdezcDDeqBmOVUQgEmaAxIKGh5xCQbCVrSIkZ0Hr/H1N6zjCliSmv5Dfd6BaPmNc9aIAB9IVpMj8ORpqWX72yvv991/EOdsBzggaaU0PlyRNhsTeG0fD0kQGMe86SOtkKdYxFTsxfAhwxeUT0jmrVhopiDncVDJgfEEQ98hD45MA4j1iKEJ3GwnZhiFu+eUMzRlU4743ijAjmHGbllykL2OY7Ov4hjFSijL3HDbCaN+6yYz86cjiASoyWtevPh7GikvWDsCXYMCB8eYUfNaXGLDYcFUwaB2tJavb6MrNRQ+pq9cWNZ47gYyWJoVwyMcwnQDKJ9e2M/2o8REyriF4Bqodw5rjxLROT91jr2iBPyGq2bO9ug12rHYHsglhxv/r4WNiOR+lBlM7qK6CCr8WYB4Pt0uZ3vX5VPiaOdR5mSx4QY+C4FTFaL41EmKGkxZi6eZpBIjHsYnXdETVTWGlUBGYeA7ewJdhpYiwGMKHMXh2Fb1Magqdeia89EyyvGAzkCawn2rQ1FPCuX1p6IjwfiVc+geRUBlOhe6lHHKhS4PcHQmvZA55kRS5KAdEPgN3sEbu5oYw7wMwRoI4AYoTNkejDCs9Glx0jYbERpphV9Q4Y18akA8PeUf5vyV1L+fdCc6g02r2GQzpdOoo9oLHkAMKrlki3YCFP/sknUAUnzqxCKaWQ9dZaGaYw7Bi3qfISWmzrrboVaFZB+UdrUYi5QNYXEwPcsCxCqOTtty7SiXwQU9BgoKwFWNE1joyAv8KyOEdrzIvihfg89q18iIG3F/kAdC6NtXf+3Z4kbO/2AWJwlKGBxsI3Z4N1k8AWP/jkwnpt9WqwC4D+lP99J+Zcp/6tz0HNAo7I0CnYkr54EgJNQh8VC03Yjkd/QAYoyBwGYlQDaMjqtENW+BGCAVuAMDkjGa6wvVjkQJzVP0udA/3PFJhFth4GyOhqHRIUGDmpgFKBDxFqmMdm1MUw4MB5RK0uUR1lttMZ7noFzRINHhfT2+8TkC9b6fYuvWb4XkdUJiACH+JoxyGu8PlizVPYqAMuTi4vWA3MgoJ+n/Brhc/PzJkEfpctVBXMgng/TbrAezUENia2Nrmm1rAiexcGKaDWB1gkw+p4Zcx2dR7aes9YDR8oIhOBtlWMnAlb0vRIc2JOjya/dKAfdHwAtU3RLWWQnPuQ7E+mOc2v2MfA2FbKesTZu6WnDKA1QR9u3/78b9yM6hhDa4JXtb9WLKBbILDoevMBqGt+eqvb16hUJXYzu54A4hbYDFTG1lr4SyN/ZqKMn6HjOnc+e0QSAOWmhgDUgPaXjTPPqhiX07qN8nCMEPs7CycN8fj//PsdAmBtl22j4ySESCRDPmqiBIBBDAk6UGZECKMh3J5DxXBfgaO0+AXWlFQBtlbnRLyyN8Mw9ghRaV689NQbrtT3ar2u2G+4V6iJClSeY9AgPER4xrR67+2DUQxu9gsEa3nXIb3jPeXTChCsmPd9DlF5PQQ1ZoywBYE7aZkCtRjlWAeAmpHkq5m4WPuZQx6/Q1V4Bc0jjB1koWTbueTUfyx3ztp2DskeIiOxJ4DFNlPFqjHBS7mNQi0QZOVK3ifRoglMH+EXLI53PdAoqXaArnXWK0BGy10VUWOwBME+Dj7RppEyI0HAIUEXvYcAipT1v3cNgOTxAR33S6o2NohFue3zfPMFhTXRD8QQAoqvtgH+S8qczWLXW4w4B4CYnbEZp2fN+2Zr3ohJEyusH+d5y+9672SJzVtBLr3m2cT+XexusmWpAtaFDaX+HAnOj3Grb9AJO77bHqNXALs+VyV0UZh6d9ukRsiLadKStvBgHiBUCsXagZW7RjyO47O0oGVEsKDBOkSkGMqyXUYuBrHjWExYQS4J3D0esErYAcFXNmVl/KuXvpfz13Rc96+izgaIjHYkoc14IK4vQcScLIeeFEHOaj2fVfaf5+jTn+fcTAACmgCaGaINTh7a1dj6/R+CJmOFbYBed70fKjW4vjQJ1r6WmVzDy/AqY4r4RnjUHEWx6rIsR4Eetikhdestujd2Ipr5ipdveTqSIMKAFAFpWue1t/rY1WenVre+m/MeU/5nyX1J+my7nzctNT45JUx3p5U0zdfwn538fcTm3Od/Jx7Min1fn51kQOauEkvJ6m4WU5fqEsI1GagZiMTJrsySieIRNVsBMX3XiO4N5dSGD4Vtm1hoUDrFHuxG+N31H1LKx044tM7AV26DeLY8I22iHwTbUVn71cPneXQx7o1MeIupodBe/cmfISIRFZzO7/YiQyBRAneZ56TfpMoDQ5+n4nQBHGhLVSP3Esa1yKXBsi/NFQNlUQshZPm4LIWU5bnI+KSwsh7Z4oJaNXl8DxMrQ40/Qqbk/G88Rh75JAcs1/kOW1SKqjaNWgbaVYFdoZMId+CZHiNDKiewsiTqMW/2NRBM0HQR7BIAlvU6XWwe/VWgeIw1BYaSRnncqhYg6b8HfNvn3WiA5qYQVLs4twIwuRaWAw2IEFFF/AUR4QQQfpKxr6oPWAxEeiGK+A9Hl6hG/AFEsBl55kT1fVGFhu4L3/yHlv6X8j5TfGDzotqcB/iMdbZpyfvfIJehNJUhUVhDhQgAp/8/Fb5uGMKIdl+9agYO0zZusQa9NOSCmew8gUY3Dm9rQmJi2MRFS7poZRsvYalukHtrUhXL+9NSaynmWMAFAr+KfU/5Vyk9ebs028I6hSA/rx0gvqwT9v5yPndg3tB9JcqNcbxrP1cJHKyqlFvu+tRcDExZ2WByQZ2Ng90Q7RdgGg2AeES5qfw2kqM33rZkCGDx1pBfX6dFXDXobpDTSbeo0K6S2F2obDb/bCv+NOBIigYy8CLgtE34dO4FVwWd/Q/Wmc+j2hdGCDFp/OZWgAzWqDHp7qYlXXvaBeBPrJYd+mdyQjrJ+4+DzJfBPDYKo91Uw9wz5vwADAFVdqz1vyN8hAAAAAElFTkSuQmCC";
  33748. this._image_h_l_r = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAABIklEQVR4nO3WbQuCMBiG0dn//80tiAp6WT4zi+A+54vTTdMKuZZ20Y/H2/is9/r+aFxdNz5/qa7t1/Gr+dlj79ZX5mrnvz93p+3T9zKznbnnynW/OPfwnLXP/v2xqXvolXv8dH7Ld7Vhvs+cf/2v/d/vd3dfq8/0zbm1a1d/18L2o3fIzHbtnVi51p5zK8f6q3Xj8cza8XjrusH+oQEAcQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAABBIAABAIAEAAIEEAAAEEgAAEEgAAEAgAQAAgQQAAAQSAAAQSAAAQCABAACBBAAABBIAAJCmtXYCutDwWwUr9cEAAAAASUVORK5CYII=";
  33749. this._image_h_r_l = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAAAAXNSR0IArs4c6QAAAFBlWElmTU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAIAAAAACVLBWUAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgoZXuEHAAAC90lEQVR4Ae3WzVbbMBAG0PzBgcOa93/M7nCj2F8zUUILdDmXjWTNSLauBMz+19vbstvvl139+c5zza39sd7hUNe99mveZ/3dbs3/LF7W3j/IXbZ5hzI/Yzf7TXxux/fPY3n+W+wrOfP3Zs5P26wXk22d/bzenJf8jNf82h/73XLOh7KeS51b++fEw/R8uQfzetvzsubmbtyuPXLmteo6W/9Qv2lZ7te4fde6l6xT52Ysbf22jK3t+o7j8frdt/H1HTWe96RdY+v8OnfrX84u45kznrPm6Cde2/THnPRrW/vjK+e8OT6e61j6OZcaH/ZbfDvXy+/Qsc5Jv55TxtKOWNY/t39+bx/NSV6dk3VGrM4Zu/2fsbFW/Ou69RvGO2rOFlvq2Pwdc2w8Z/0tdpqeL/HTab0/iaWd1xt5iaWd587PyXt6evyOOT939LP8jCcv66d9fn78nsSH2cvLv3OS//p6mzvmJza3Izb+D64/ae/zR/zR3IyN+MfH/fz39+tY9j9yv9//6pw57+45/xvOfzv9ECBAgAABAt0EFADdTtx+CRAgQIDAWUAB4BoQIECAAIGGAgqAhoduywQIECBAQAHgDhAgQIAAgYYCCoCGh27LBAgQIEBAAeAOECBAgACBhgIKgIaHbssECBAgQEAB4A4QIECAAIGGAgqAhoduywQIECBAQAHgDhAgQIAAgYYCCoCGh27LBAgQIEBAAeAOECBAgACBhgIKgIaHbssECBAgQEAB4A4QIECAAIGGAgqAhoduywQIECBAQAHgDhAgQIAAgYYCCoCGh27LBAgQIEBAAeAOECBAgACBhgIKgIaHbssECBAgQEAB4A4QIECAAIGGAgqAhoduywQIECBAQAHgDhAgQIAAgYYCCoCGh27LBAgQIEBAAeAOECBAgACBhgIKgIaHbssECBAgQEAB4A4QIECAAIGGAgqAhoduywQIECBAQAHgDhAgQIAAgYYCCoCGh27LBAgQIEBAAeAOECBAgACBhgK/AX08dE/3SOoSAAAAAElFTkSuQmCC";
  33750. this._image_v_b_t = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAADcklEQVR4nO3di27bMAyFYdpWLuv2/o+aJfFFgxOp5VjKdjDM6rD/A4KkbZyhwIBzTMluE/s+CAAA+J/EIH1/SL9ws/KLR/5rAADwZb2S4zHIMBzVN9YOzh8QN74XAAD8HTmLt2Z3Ns3PId7vR/MB9oPihtcAAGBfOq9Lr3WOR/0Icrt5BaAxb14rAwAA4OsUAC/HPxWAk4i0hSmAF/iT8zMAALCvnNXtQiHwwn/O8WkuAGdTALy1hFhoEQAAoA5ver+W4aoAXK8UAAAA/j1/UgDGED8mAHYZQB/ofYBQAgAAqMIL/qXN/L+F/6MAyPX6TUS6lQLgPYQCAABAFaUCsJbjY3oMQS4XXQDaFwoAywAAANRRCv6lApDP/odHAYi3Wy4A3YYCMFEAAACozgv9tUn+qApAnycA4cUCMFEAAACoxgv+LQVgSI8Q5OdPWwDawoE2/CcKAAAAVZTC3zuRn5wC0M0F4LuIHJx9AHb3/2TCnwIAAEAdugC0zmtRWW4LwP0xAYjPCcAhTQHswZ9uHOAUAQAAsC971t8WLunXBeD97H9+X14COBT2Adj1flsCKAAAAOzPC35vGcBb/291ATguFIBS8FMAAACoo1QASpP8993/7wUgLQGcUgEICxMAHfojVwIAAFCNLQDdCwUgPDcBXi5vqQAcCgUgOsFv9wIAAID9NE74ezf1swXgnt7X6CWAo7oh0FIBGLkSAACAqvJGPxv+paX8UW8AnH+Q7wR4NhsBvQIwqgnASAEAAKAaO/7fUgB6lfEx3wnwbDYCLhWAkQIAAEBVXgHwbuufc3xQ9/xJBeB6PacCcFooAF74jxQAAACqWAp/fVdfXQD6lO+PE/ggH0sA+koAUQdKOpACAADA1/BKARC1AbDNpSDE5wQgXwrYpQKwNgEYKQAAAFRTKgD27/roCYC+1f84TwDOZg9AMAfa9f+BCQAAAFW16iqAYJ717YBzjg9qiX96/jng2+2Uzv6PqgSUJgCDKQHcDRAAgP3Zs/9gvvY2Abb6ioC5AOTgP5vw17p0QKueKQAAANThFYCgzvytLn2dpwHHEO/3tfCX9P2ggr8zlwICAIB9NGb8vxT8OsePefw/XxIYpO9/mJ3/S/LGgqDW/ikAAADsp9kQ+J45v9/S9+NcALaGv5X/4W77IQAAoLI3EWl/AQ/TsX9wLtbWAAAAAElFTkSuQmCC";
  33751. this._image_v_t_b = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAgAAAAAgCAYAAABkS8DlAAAAAXNSR0IArs4c6QAAAFBlWElmTU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAACAKADAAQAAAABAAAAIAAAAACVLBWUAAABWWlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iWE1QIENvcmUgNi4wLjAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp0aWZmPSJodHRwOi8vbnMuYWRvYmUuY29tL3RpZmYvMS4wLyI+CiAgICAgICAgIDx0aWZmOk9yaWVudGF0aW9uPjE8L3RpZmY6T3JpZW50YXRpb24+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgoZXuEHAAAHhUlEQVR4Ae2d2W7bSBREucmy7IcA+f+fnAePtXCZqr68IhVLSGLATIA5DbS72QspHT9U9UbV79++vVdV9axIgAAEIAABCEDgf0Kgq3a7f/RdR8WXT37nSf0yfvIWdIMABCAAAQhA4DcJNHP7+jf7uXlvA/CmTHb2TEDe0A3uhRT7XpWOg+JU1bXLCRCAAAQgAAEIbEFgmqzXjq1iN+d/ruF13dfT9NbVT08XdXI8zZ33StMQKHsN94R/UMNBFZ5BIEAAAhCAAAQgsBEB6W8j/U0T4MF4GgGnj3TcA/ej4rmr9vuzM4rpHpQteXfOG1j8ffOMvSos/CWqHAMgCAQIQAACEIDAVgRW4m8TYB1uNRs/VtNkA5AmYK3jFv+zCs7qe+6m/f6ki92qsW+SZsAdLf6OLrcBKNP+Kuj1oEEPyjpVESAAAQhAAAIQ2IhALR1uZsH3TH4n0W4lymkAbAys4w7W8F5t+6muPeg/dbUMgAp25SYh9BZ5G4BavUpH3cwd0wBY9Ici/mEI7DZcR4AABCAAAQhAYCsCtWX6ugfAot9rTO5ZgDQAax33YN0GwPrtJf9j18gAyA3kVEGO5m0AHIoB0J8QeU8thOjnUoDTNAduT4AABCAAAQhAYAsC0xQzADHi92g/xD+WAH7UcQ3xp75qGpuAMADT4XDUbsBaJqCeR/Ke4i8zAEqLAVCaIn9rAGIJYJTjcDkBAhCAAAQgAIGNCEi2lxmAZSkgR/85sE8d9wA/l/FPujh6E+BRmUYi3tSNNhTaIaQBsLtw8BG/2FhwHfmrj5cCxkblaoQBKKD4AwEIQAACENiIQAzcGwlwGf3rsq3GMZcAYv1/reOzAZB+n1UpA/Dy4uMAthFW+0E32in94BzUwSI/qFNJnVcc53KXESAAAQhAAAIQ2I6A5Lpq9MfRum0zUGYAXKZr1zs6eMe+Ndyn+C7KH7v6+fmoYo3xPZxvBqVlF6HLZAuio+rKDIA6W/B1A5//TyOgonJKoDyBPxCAAAQgAAEIbELAS/eN9NknAWppeCsNb10m+S5lNzpuDdfSvTS8HP/vqsPhXY2t4EXY9ZG9/u8phFqL+8UA6E7aJFDW+Yvou63arDcA2gQQIAABCEAAAhDYjoA12iP9YgK0lu+0GIC57J6O9xLsi3T/1E0vL+8e/auxR/flHKHyZQlAdy4GQOWut+hnXIu/y1xPgAAEIAABCEBgOwIxUz9q/C7h1+g+zEBcF3NwR8fLuwDU/tQ1h8O/cgLe0NdrE6BfCNQpbwdxuwRg8W+8vHA1Abn730cEMQDb/cN5EgQgAAEIQCAJlNG/hD7Ef53e03Gf3ov3BehVwN4DMIu6VDxmAGQAtALgtYUyAyCnYIVPob8xAaWvTwkQIAABCEAAAhDYmkARfonwYgBm4S+m4KOOFwMgXb/EEsA4xuheGwD1yTtVWNFjA4G/ii9jlL+IfxwLtPCPpd7tCBCAAAQgAAEIbEkgtNrr/2kCmqaUze/3uQ7kVT/qmKB13C8EunRtnAKwiNsVxAZAO4b5BldxTwOwFv6cFfD7AwgQgAAEIAABCGxLYPSreDRgT81OI+BZfEeHmBGYZvH3gN96X2YAvAegV7uz0usJAFXaTSwhDYDTtQmIlwdhABZS5CAAAQhAAALbELDIW/Rz4G5DkGYgDcDySXIGwL8H0PsYoN8DMEjXPfUf7wBwp3AVS7dZ6DWlEHsBMg1DgAFYSJGDAAQgAAEIbEMgRvf5PoCSSsLzdEDMAOQnkY5PsQQwGwAdA5TY+6d9y+hfSh5vAfzROcQMwDL693WO/qMuH0EKAQhAAAIQgMAWBNZi77xmA8rav4/x39PxeKePlwCGbtrtjmqT7//3C4CaMvq/19GC7zP/FnwMwBb/Wp4BAQhAAAIQeEzAWu3oWfvMW/zzet0zdPu6DNB1r69HqX+e/S9vANQ97joH9Q3hb9vFBPjmLidAAAIQgAAEILAtAeu1Q+r2oDf1W8QVStn601jEFTR7P1bDMJQfA+r860F++Y83DrhT39feFbju17mTQ9ct4p9lma47kIcABCAAAQhA4GsJpFan4M8a7ofe1XFruPcBKHZV256qp6dWbiDE352fnrQb8NYAlG9goc/oAud9MwIEIAABCEAAAn+GgAbt19H+rOG+9sa+m5D67bRtZQBeX09l5H+5LAbAN/hVA+A9AQQIQAACEIAABP4MgU4H+FKzU7/zev2J1gZAmwE7jfaP89T/YgC8gcAhb+BOS4h8HCWo1H9dt7QiBwEIQAACEIDA1xM4n0OzvYwfYVnC/6jjMZO/28kANM1ZsdZvAoSDyMaR5k2iQ36NtSFY57OeFAIQgAAEIACBbQgcDqnVy8DdT36k4/NMQFd9/352s+rt7Z4BWD78Wugf5ZfW5CAAAQhAAAIQ2IJADtz9rEd516V2Xw3A6WQDUFX7fU4d3N6gVN75M9/g5mF3mlEEAQhAAAIQgMAXErAeW/jX4v/ocWkCVK/f+Z2ena7arvOr4muWNf8rCjIQgAAEIACBv47AL+m4TwlcFH/W+K/7dnwgCEAAAhCAAAQ+T+A/hVJn6rP9qnIAAAAASUVORK5CYII=";
  33752. this._sketchTempPoints = [];
  33753. this._sketchPoints = [];
  33754. this._sketchOutputPoints = [];
  33755. this._sketchWallHeights = [];
  33756. this._drawEntity = void 0;
  33757. this._lineLabel = void 0;
  33758. this._polygonLabel = void 0;
  33759. if (options2 && options2.isDrawPoint)
  33760. this._isDrawPoint = options2.isDrawPoint;
  33761. else
  33762. this._isDrawPoint = false;
  33763. if (options2 && options2.isRetainDrawPoint)
  33764. this._isRetainDrawPoint = options2.isRetainDrawPoint;
  33765. else
  33766. this._isRetainDrawPoint = false;
  33767. this._param = {
  33768. lineWidth: 3,
  33769. lineColor: "rgba(0,255,0,0.75)",
  33770. outlineWidth: 2,
  33771. outlineColor: "rgba(255,255,255,1)",
  33772. polygonColor: "rgba(0,255,0,0.5)",
  33773. wallHeight: 30,
  33774. power: 0.25,
  33775. odlineHeight: 1e3,
  33776. odlineCount: 50,
  33777. text: "\u91D1\u7530\u4EA7\u4E1A\u96C6\u56E2",
  33778. duration: 1500,
  33779. count: 1,
  33780. direction_h: "horizontal",
  33781. direction_v: "vertical",
  33782. order_add: "+",
  33783. order_minus: "-",
  33784. houseColor: "rgba(0,255,0,0.95)"
  33785. };
  33786. if (options2 && options2.iconType) {
  33787. switch (options2.iconType) {
  33788. case DrawTools.IconType.Normal:
  33789. this._sketchPointImage = this._iconNormal;
  33790. break;
  33791. case DrawTools.IconType.Blue:
  33792. this._sketchPointImage = this._iconBlue;
  33793. break;
  33794. case DrawTools.IconType.Green:
  33795. this._sketchPointImage = this._iconGreen;
  33796. break;
  33797. case DrawTools.IconType.Violet:
  33798. this._sketchPointImage = this._iconViolet;
  33799. break;
  33800. default:
  33801. this._sketchPointImage = this._iconNormal;
  33802. break;
  33803. }
  33804. } else {
  33805. this._sketchPointImage = this._iconNormal;
  33806. }
  33807. this._canvasWidth = this._viewer.scene.canvas.width;
  33808. this._canvasHeight = this._viewer.scene.canvas.height;
  33809. if (this._isRuntimeApp()) {
  33810. this._viewer._cesiumWidget._supportsImageRenderingPixelated = Cesium.FeatureDetection.supportsImageRenderingPixelated();
  33811. this._viewer._cesiumWidget._forceResize = true;
  33812. if (Cesium.FeatureDetection.supportsImageRenderingPixelated()) {
  33813. this._viewer.resolutionScale = 2.6;
  33814. }
  33815. }
  33816. }
  33817. _arcToDegree(arc) {
  33818. return arc / Math.PI * 180;
  33819. }
  33820. _toColor(red, green, blue, alpha) {
  33821. let normalColor = new Cesium.Color(0, 0, 0, 1);
  33822. if (typeof red != "number")
  33823. return normalColor;
  33824. if (typeof green != "number")
  33825. return normalColor;
  33826. if (typeof blue != "number")
  33827. return normalColor;
  33828. if (typeof alpha != "number")
  33829. return normalColor;
  33830. if (red < 0 || red > 255 || green < 0 || green > 255 || blue < 0 || blue > 255 || alpha < 0 || alpha > 1)
  33831. return normalColor;
  33832. return new Cesium.Color(red / 255, green / 255, blue / 255, alpha);
  33833. }
  33834. _toColorFromArray(array) {
  33835. if (!array || array.length === void 0 || array.length === 0)
  33836. return new Cesium.Color(255 / 255, 255 / 255, 255 / 255, 1);
  33837. let r2 = 255, g = 255, b = 255, a = 1;
  33838. if (array.length === 1) {
  33839. r2 = parseInt(array[0]);
  33840. } else if (array.length === 2) {
  33841. r2 = parseInt(array[0]);
  33842. g = parseInt(array[1]);
  33843. } else if (array.length === 3) {
  33844. r2 = parseInt(array[0]);
  33845. g = parseInt(array[1]);
  33846. b = parseInt(array[2]);
  33847. } else if (array.length >= 4) {
  33848. r2 = parseInt(array[0]);
  33849. g = parseInt(array[1]);
  33850. b = parseInt(array[2]);
  33851. a = parseFloat(array[3]);
  33852. }
  33853. return new Cesium.Color(r2 / 255, g / 255, b / 255, a);
  33854. }
  33855. _updateScene() {
  33856. this._viewer.scene.requestRender();
  33857. }
  33858. _getScreenClickPosition(screenPosition) {
  33859. let resCartesian = void 0;
  33860. let ray = this._viewer.scene.camera.getPickRay(screenPosition);
  33861. let position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  33862. Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  33863. if (Cesium.defined(position2)) {
  33864. resCartesian = {
  33865. x: position2.x,
  33866. y: position2.y,
  33867. z: position2.z
  33868. };
  33869. }
  33870. return resCartesian;
  33871. }
  33872. _getScreenClickPositionAndHeight(screenPoint) {
  33873. var lng = void 0, lat = void 0, height2 = void 0;
  33874. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  33875. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  33876. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  33877. cartographic = Cesium.Cartographic.fromCartesian(position2);
  33878. var feature2 = this._viewer.scene.pick(screenPoint);
  33879. if (feature2 === void 0 && Cesium.defined(cartographic)) {
  33880. lng = this._arcToDegree(cartographic.longitude);
  33881. lat = this._arcToDegree(cartographic.latitude);
  33882. height2 = cartographic.height;
  33883. } else {
  33884. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  33885. if (Cesium.defined(cartesian)) {
  33886. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  33887. if (Cesium.defined(cartographic)) {
  33888. lng = this._arcToDegree(cartographic.longitude);
  33889. lat = this._arcToDegree(cartographic.latitude);
  33890. height2 = cartographic.height;
  33891. }
  33892. }
  33893. }
  33894. return {
  33895. lng,
  33896. lat,
  33897. height: height2
  33898. };
  33899. }
  33900. _transfromFromScreenPoint(screenPosition) {
  33901. let location = this._getScreenClickPositionAndHeight(screenPosition);
  33902. if (location.lng != void 0) {
  33903. var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
  33904. return {
  33905. gLocation: location,
  33906. sLocation: cartesian
  33907. };
  33908. } else {
  33909. return {
  33910. gLocation: void 0,
  33911. sLocation: void 0
  33912. };
  33913. }
  33914. }
  33915. _removeEntityByName(entityName) {
  33916. var entities2 = this._entities;
  33917. if (!entities2 || !entities2.values)
  33918. return;
  33919. var delEntitys = [];
  33920. for (var i2 = 0; i2 < entities2.values.length; i2++) {
  33921. if (entities2.values[i2].name == entityName) {
  33922. delEntitys.push(entities2.values[i2]);
  33923. }
  33924. }
  33925. for (var i2 = 0; i2 < delEntitys.length; i2++) {
  33926. entities2.remove(delEntitys[i2]);
  33927. }
  33928. this._updateScene();
  33929. }
  33930. _removeEntityByObject(objEntity) {
  33931. if (!Cesium.defined(objEntity))
  33932. return;
  33933. this._entities.remove(objEntity);
  33934. }
  33935. _createPoint(coord, label) {
  33936. let _self = this;
  33937. let entity = new Cesium.Entity({
  33938. name: _self._sketchEntityName + "_Point",
  33939. position: coord,
  33940. billboard: {
  33941. image: _self._sketchPointImage,
  33942. horizontalOrigin: Cesium.HorizontalOrigin.center,
  33943. verticalOrigin: Cesium.VerticalOrigin.bottom,
  33944. scale: 0.5,
  33945. pixelOffset: new Cesium.Cartesian2(0, -11),
  33946. disableDepthTestDistance: Number.POSITIVE_INFINITY
  33947. }
  33948. });
  33949. if (label) {
  33950. entity.label = {
  33951. text: label,
  33952. font: "12px sans-serif",
  33953. fillColor: this._toColor(255, 255, 255, 1),
  33954. outlineColor: this._toColor(0, 154, 94, 1),
  33955. style: Cesium.LabelStyle.FILL_AND_OUTLINE,
  33956. outlineWidth: 1,
  33957. verticalOrigin: Cesium.VerticalOrigin.BOTTOM,
  33958. pixelOffset: new Cesium.Cartesian2(0, -28),
  33959. showBackground: true,
  33960. backgroundColor: this._toColor(0, 0, 0, 0.6),
  33961. disableDepthTestDistance: Number.POSITIVE_INFINITY
  33962. };
  33963. }
  33964. this._entities.add(entity);
  33965. this._pointEntitys.push(entity);
  33966. this._updateScene();
  33967. }
  33968. _removePointEntitys() {
  33969. this._removeEntityByName(this._sketchEntityName + "_Point");
  33970. this._pointEntitys = [];
  33971. }
  33972. _callUpdaeEllipseCenterPosition() {
  33973. let _self = this;
  33974. return function() {
  33975. let point1cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[0]);
  33976. let point2cartographic = Cesium.Cartographic.fromCartesian(_self._sketchTempPoints[1]);
  33977. _self._sketchEllipseCenterPosition = Cesium.Cartesian3.fromDegrees(
  33978. Cesium.Math.toDegrees(
  33979. point1cartographic.longitude
  33980. ),
  33981. Cesium.Math.toDegrees(point1cartographic.latitude),
  33982. point2cartographic.height
  33983. );
  33984. return _self._sketchEllipseCenterPosition;
  33985. };
  33986. }
  33987. _callUpdateEllipseMinorAxis(positions) {
  33988. let _self = this;
  33989. return function() {
  33990. if (positions === void 0 || positions.length === void 0 || positions.length < 2) {
  33991. _self._sketchEllipseRadius = 0;
  33992. } else {
  33993. _self._sketchEllipseRadius = _self._calculateEllipseMinorAxis(positions[0], positions[1]);
  33994. if (_self._sketchEllipseRadius <= 0)
  33995. _self._sketchEllipseRadius = 1;
  33996. }
  33997. return _self._sketchEllipseRadius;
  33998. };
  33999. }
  34000. _calculateEllipseMinorAxis(position1, position2) {
  34001. let point1cartographic = Cesium.Cartographic.fromCartesian(position1);
  34002. let point2cartographic = Cesium.Cartographic.fromCartesian(position2);
  34003. let geodesic = new Cesium.EllipsoidGeodesic();
  34004. geodesic.setEndPoints(point1cartographic, point2cartographic);
  34005. return geodesic.surfaceDistance;
  34006. }
  34007. _calculateEllipseOutlineCoordinate(position1, position2) {
  34008. let positionCenter = position1;
  34009. let positionRotate = position2;
  34010. let ellipseOutlineCoordinates = [];
  34011. for (let angle = 5; angle < 360; ) {
  34012. let newPosition = this._rotatedPointByAngle(positionRotate, positionCenter, angle);
  34013. ellipseOutlineCoordinates.push(newPosition);
  34014. angle = angle + 5;
  34015. }
  34016. ellipseOutlineCoordinates.push(ellipseOutlineCoordinates[0]);
  34017. return ellipseOutlineCoordinates;
  34018. }
  34019. _callEllipseOutlineCoordinate(positions) {
  34020. let _self = this;
  34021. return function() {
  34022. _self._ellipseOutlineCoordinates = _self._calculateEllipseOutlineCoordinate(positions[0], positions[1]);
  34023. return _self._ellipseOutlineCoordinates;
  34024. };
  34025. }
  34026. _rotatedPointByAngle(position_A, position_B, angle) {
  34027. var localToWorld_Matrix = Cesium.Transforms.eastNorthUpToFixedFrame(position_B);
  34028. var worldToLocal_Matrix = Cesium.Matrix4.inverse(localToWorld_Matrix, new Cesium.Matrix4());
  34029. Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_B, new Cesium.Cartesian3());
  34030. var localPosition_A = Cesium.Matrix4.multiplyByPoint(worldToLocal_Matrix, position_A, new Cesium.Cartesian3());
  34031. var new_x = localPosition_A.x * Math.cos(Cesium.Math.toRadians(angle)) + localPosition_A.y * Math.sin(Cesium.Math.toRadians(angle));
  34032. var new_y = localPosition_A.y * Math.cos(Cesium.Math.toRadians(angle)) - localPosition_A.x * Math.sin(Cesium.Math.toRadians(angle));
  34033. var new_z = localPosition_A.z;
  34034. return Cesium.Matrix4.multiplyByPoint(
  34035. localToWorld_Matrix,
  34036. new Cesium.Cartesian3(new_x, new_y, new_z),
  34037. new Cesium.Cartesian3()
  34038. );
  34039. }
  34040. _callUpdateRectangleCoordinates(positions) {
  34041. let _self = this;
  34042. return function() {
  34043. let g0 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(positions[0]);
  34044. let g1 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(positions[1]);
  34045. let lng0 = Cesium.Math.toDegrees(g0.longitude);
  34046. let lat0 = Cesium.Math.toDegrees(g0.latitude);
  34047. let lng1 = Cesium.Math.toDegrees(g1.longitude);
  34048. let lat1 = Cesium.Math.toDegrees(g1.latitude);
  34049. _self._rectangleCoordinates = [0, 0, 1, 1];
  34050. if (lng0 < lng1) {
  34051. _self._rectangleCoordinates[0] = lng0;
  34052. _self._rectangleCoordinates[2] = lng1;
  34053. } else {
  34054. _self._rectangleCoordinates[0] = lng1;
  34055. _self._rectangleCoordinates[2] = lng0;
  34056. }
  34057. if (lat0 < lat1) {
  34058. _self._rectangleCoordinates[1] = lat0;
  34059. _self._rectangleCoordinates[3] = lat1;
  34060. } else {
  34061. _self._rectangleCoordinates[1] = lat1;
  34062. _self._rectangleCoordinates[3] = lat0;
  34063. }
  34064. let rectangle = Cesium.Rectangle.fromDegrees(
  34065. _self._rectangleCoordinates[0],
  34066. _self._rectangleCoordinates[1],
  34067. _self._rectangleCoordinates[2],
  34068. _self._rectangleCoordinates[3]
  34069. );
  34070. let res = _self._calculateRectangleOutlineCoordinates(rectangle);
  34071. _self._rectangleOutlineCoordinates = res.cPoints;
  34072. _self._sketchOutputPoints = res.gPoints;
  34073. return rectangle;
  34074. };
  34075. }
  34076. _calculateRectangleOutlineCoordinates(rectangle) {
  34077. let south_east = Cesium.Rectangle.southeast(rectangle);
  34078. let se2 = Cesium.Cartographic.toCartesian(south_east);
  34079. let south_west = Cesium.Rectangle.southwest(rectangle);
  34080. let sw = Cesium.Cartographic.toCartesian(south_west);
  34081. let north_east = Cesium.Rectangle.northeast(rectangle);
  34082. let ne2 = Cesium.Cartographic.toCartesian(north_east);
  34083. let north_west = Cesium.Rectangle.northwest(rectangle);
  34084. let nw = Cesium.Cartographic.toCartesian(north_west);
  34085. let gPoints = [];
  34086. gPoints.push({
  34087. lng: Cesium.Math.toDegrees(south_west.longitude),
  34088. lat: Cesium.Math.toDegrees(south_west.latitude),
  34089. height: south_west.height
  34090. });
  34091. gPoints.push({
  34092. lng: Cesium.Math.toDegrees(south_east.longitude),
  34093. lat: Cesium.Math.toDegrees(south_east.latitude),
  34094. height: south_east.height
  34095. });
  34096. gPoints.push({
  34097. lng: Cesium.Math.toDegrees(north_east.longitude),
  34098. lat: Cesium.Math.toDegrees(north_east.latitude),
  34099. height: north_east.height
  34100. });
  34101. gPoints.push({
  34102. lng: Cesium.Math.toDegrees(north_west.longitude),
  34103. lat: Cesium.Math.toDegrees(north_west.latitude),
  34104. height: north_west.height
  34105. });
  34106. gPoints.push({
  34107. lng: Cesium.Math.toDegrees(south_west.longitude),
  34108. lat: Cesium.Math.toDegrees(south_west.latitude),
  34109. height: south_west.height
  34110. });
  34111. return {
  34112. cPoints: [sw, se2, ne2, nw, sw],
  34113. gPoints
  34114. };
  34115. }
  34116. _callUpdateRectangleOutlineCoordinates() {
  34117. let _self = this;
  34118. return function() {
  34119. return _self._rectangleOutlineCoordinates;
  34120. };
  34121. }
  34122. _materialTextImageProperty(options2) {
  34123. this._canvasId = "canvasJt";
  34124. let canvasObj = document.getElementById(this._canvasId);
  34125. if (canvasObj != null) {
  34126. document.body.removeChild(canvasObj);
  34127. }
  34128. canvasObj = document.createElement("canvas");
  34129. canvasObj.id = this._canvasId;
  34130. canvasObj.setAttribute("width", "1024px");
  34131. canvasObj.setAttribute("height", "256px");
  34132. document.body.appendChild(canvasObj);
  34133. let context = canvasObj.getContext("2d");
  34134. context.fillStyle = options2.color === void 0 ? "rgba(255,0,0,1)" : options2.color;
  34135. context.font = "bold 240px \u5FAE\u8F6F\u96C5\u9ED1";
  34136. context.textAlign = "left";
  34137. context.textBaseline = "bottom";
  34138. context.fillText(options2.text, 12, 250, 1e3);
  34139. let textMaterial = new Cesium.ImageMaterialProperty({
  34140. image: canvasObj,
  34141. transparent: true
  34142. });
  34143. textMaterial._param = {
  34144. color: context.fillStyle,
  34145. text: options2.text
  34146. };
  34147. return textMaterial;
  34148. }
  34149. _materialColorProperty(options2) {
  34150. let mColor = "rgba(0,255,0,1)";
  34151. if (options2 !== void 0 && options2.color !== void 0)
  34152. mColor = options2.color;
  34153. let colorMaterial = new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString(mColor));
  34154. colorMaterial._param = {
  34155. color: mColor
  34156. };
  34157. return colorMaterial;
  34158. }
  34159. _materialPolylineArrowProperty(options2) {
  34160. let mColor = "rgba(0,255,0,1)";
  34161. if (options2 !== void 0 && options2.color !== void 0)
  34162. mColor = options2.color;
  34163. let colorMaterial = new Cesium.PolylineArrowMaterialProperty(Cesium.Color.fromCssColorString(mColor));
  34164. colorMaterial._param = {
  34165. color: mColor
  34166. };
  34167. return colorMaterial;
  34168. }
  34169. _materialPolylineGlowProperty(options2) {
  34170. let mColor = "rgba(0,255,0,1)";
  34171. if (options2 !== void 0 && options2.color !== void 0)
  34172. mColor = options2.color;
  34173. let power = 0.25;
  34174. if (options2 !== void 0 && options2.power !== void 0 && typeof options2.power === "number")
  34175. power = options2.power;
  34176. let colorMaterial = new Cesium.PolylineGlowMaterialProperty({
  34177. color: Cesium.Color.fromCssColorString(mColor),
  34178. glowPower: power
  34179. });
  34180. colorMaterial._param = {
  34181. color: mColor,
  34182. power
  34183. };
  34184. return colorMaterial;
  34185. }
  34186. _materialPolylineOutlineProperty(options2) {
  34187. let mColor = "rgba(0,255,0,1)";
  34188. let outlineColor = "rgba(255,255,255,1.0)";
  34189. let outlineWidth = 1.2;
  34190. if (options2 !== void 0 && options2.color !== void 0)
  34191. mColor = options2.color;
  34192. if (options2 !== void 0 && options2.outlineColor !== void 0)
  34193. outlineColor = options2.outlineColor;
  34194. if (options2 !== void 0 && options2.outlineWidth !== void 0 && typeof options2.outlineWidth === "number")
  34195. outlineWidth = options2.outlineWidth;
  34196. let colorMaterial = new Cesium.PolylineOutlineMaterialProperty({
  34197. color: Cesium.Color.fromCssColorString(mColor),
  34198. outlineColor: Cesium.Color.fromCssColorString(outlineColor),
  34199. outlineWidth
  34200. });
  34201. colorMaterial._param = {
  34202. color: mColor,
  34203. outlineColor,
  34204. outlineWidth
  34205. };
  34206. return colorMaterial;
  34207. }
  34208. _clear(isAll) {
  34209. if (isAll != void 0 && isAll === true) {
  34210. this._removeEntityByName(this._sketchEntityName);
  34211. this._removePointEntitys();
  34212. }
  34213. this._sketchTempPoints = [];
  34214. this._sketchPoints = [];
  34215. this._sketchOutputPoints = [];
  34216. this._sketchWallHeights = [];
  34217. this._drawEntity = void 0;
  34218. this._removeOperationDom();
  34219. this._tooltipRemove();
  34220. if (this._drawEventHandler !== null && this._drawEventHandler !== void 0 && this._drawEventHandler.isDestroyed() === false) {
  34221. this._clearEvent(this._drawEventHandler);
  34222. }
  34223. }
  34224. }
  34225. Object.assign(DrawTools.prototype, {
  34226. setLabel: function(options2) {
  34227. if (!options2) {
  34228. options2 = {
  34229. lineLabel: void 0,
  34230. polygonLabel: void 0
  34231. };
  34232. }
  34233. if (options2.lineLabel)
  34234. this._lineLabel = options2.lineLabel;
  34235. if (options2.polygonLabel)
  34236. this._lineLabel = options2.polygonLabel;
  34237. }
  34238. });
  34239. Object.assign(DrawTools.prototype, {
  34240. _registerLeftClickEvent: function(handler, callChange) {
  34241. let _self = this;
  34242. if (!handler)
  34243. return;
  34244. handler.setInputAction(function(event2) {
  34245. _self._lock = true;
  34246. clearTimeout(_self._timer);
  34247. _self._timer = setTimeout(function() {
  34248. if (callChange)
  34249. callChange(event2);
  34250. _self._lock = false;
  34251. }, 200);
  34252. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  34253. },
  34254. _registerLeftDoubleClickEvent: function(handler, callChange) {
  34255. let _self = this;
  34256. if (!handler)
  34257. return;
  34258. handler.setInputAction(function(event2) {
  34259. clearTimeout(_self._timer);
  34260. _self._lock = false;
  34261. if (callChange)
  34262. callChange(event2);
  34263. }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  34264. },
  34265. _registerMouseMoveEvent: function(handler, callChange) {
  34266. let _self = this;
  34267. if (!handler)
  34268. return;
  34269. handler.setInputAction(function(event2) {
  34270. if (_self._lock === void 0 || _self._lock === false) {
  34271. if (callChange)
  34272. callChange(event2);
  34273. }
  34274. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  34275. },
  34276. _registerRightClickEvent: function(handler, callChange) {
  34277. if (!handler)
  34278. return;
  34279. handler.setInputAction(function(event2) {
  34280. if (callChange)
  34281. callChange(event2);
  34282. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  34283. },
  34284. _registerLeftDownEvent: function(handler, callChange) {
  34285. if (!handler)
  34286. return;
  34287. handler.setInputAction(function(event2) {
  34288. if (callChange)
  34289. callChange(event2);
  34290. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  34291. },
  34292. _registerLeftUpEvent: function(handler, callChange) {
  34293. if (!handler)
  34294. return;
  34295. handler.setInputAction(function(event2) {
  34296. if (callChange)
  34297. callChange(event2);
  34298. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  34299. },
  34300. _clearEvent: function(handler) {
  34301. this._endTooltip();
  34302. this._removeOperationDom();
  34303. if (!handler)
  34304. return;
  34305. handler.destroy();
  34306. handler = null;
  34307. }
  34308. });
  34309. Object.assign(DrawTools.prototype, {
  34310. _createPolyline: function(polylineType) {
  34311. let _self = this;
  34312. let entityParam = DrawTools.initEditPropertyParams();
  34313. let polylineWidth = _self._param.lineWidth;
  34314. let polylineMaterial = this._materialColorProperty({
  34315. color: _self._param.lineColor
  34316. });
  34317. entityParam.id = DrawTools.DrawType.Polyline;
  34318. if (polylineType !== void 0 && polylineType === DrawTools.PolylineType.ArrowsPolyline) {
  34319. polylineMaterial = this._materialPolylineArrowProperty({
  34320. color: _self._param.lineColor
  34321. });
  34322. polylineWidth = _self._param.lineWidth * 3;
  34323. entityParam.color = _self._param.lineColor;
  34324. entityParam.id = DrawTools.DrawType.ArrowPolyline;
  34325. } else if (polylineType !== void 0 && polylineType === DrawTools.PolylineType.GrowPolyline) {
  34326. polylineMaterial = this._materialPolylineGlowProperty({
  34327. color: _self._param.lineColor,
  34328. power: _self._param.power
  34329. });
  34330. polylineWidth = _self._param.lineWidth * 3;
  34331. entityParam.color = _self._param.lineColor;
  34332. entityParam.power = _self._param.power;
  34333. entityParam.id = DrawTools.DrawType.GrowPolyline;
  34334. } else if (polylineType !== void 0 && polylineType === DrawTools.PolylineType.OutlinePolyline) {
  34335. polylineMaterial = this._materialPolylineOutlineProperty({
  34336. color: _self._param.lineColor,
  34337. outlineColor: _self._param.outlineColor,
  34338. outlineWidth: _self._param.outlineWidth
  34339. });
  34340. polylineWidth = _self._param.lineWidth * 2;
  34341. entityParam.color = _self._param.lineColor;
  34342. entityParam.outlineColor = _self._param.outlineColor;
  34343. entityParam.outlineWidth = _self._param.outlineWidth;
  34344. entityParam.id = DrawTools.DrawType.OutlinePolyline;
  34345. } else if (polylineType !== void 0 && polylineType === DrawTools.PolylineType.DynamicPolyline) {
  34346. polylineMaterial = new WallMaterialProperty({
  34347. viewer: _self._viewer,
  34348. trailImage: _self._image_h_l_r,
  34349. duration: _self._param.duration,
  34350. color: Cesium.Color.fromCssColorString(_self._param.lineColor),
  34351. param: {
  34352. direction: _self._param.direction_h,
  34353. count: _self._param.count,
  34354. order: _self._param.order_minus
  34355. }
  34356. });
  34357. polylineWidth = _self._param.lineWidth;
  34358. entityParam.color = _self._param.lineColor;
  34359. entityParam.duration = _self._param.duration;
  34360. entityParam.direction = _self._param.direction_h;
  34361. entityParam.count = _self._param.count;
  34362. entityParam.order = _self._param.order_minus;
  34363. entityParam.id = DrawTools.DrawType.DynamicPolyline;
  34364. }
  34365. entityParam.lineWidth = polylineWidth;
  34366. let entityPolyline = new Cesium.Entity({
  34367. name: _self._sketchEntityName,
  34368. polyline: {
  34369. show: true,
  34370. positions: new Cesium.CallbackProperty(function() {
  34371. return _self._sketchTempPoints;
  34372. }, false),
  34373. material: polylineMaterial,
  34374. width: polylineWidth,
  34375. clampToGround: true
  34376. }
  34377. });
  34378. this._drawEntity = this._entities.add(entityPolyline);
  34379. this._drawEntity.setParams(entityParam);
  34380. },
  34381. _updatePolyline: function(isEdit) {
  34382. this._drawEntity.polyline.positions = this._sketchPoints;
  34383. this._drawEntity.setEntityType(DrawTools.DrawType.Polyline);
  34384. if (isEdit != void 0 && isEdit === true) {
  34385. this._removePointEntitys();
  34386. this._setEntityIsEdit(this._drawEntity);
  34387. }
  34388. },
  34389. _createSpatialPolyline: function() {
  34390. let _self = this;
  34391. let entityParam = DrawTools.initEditPropertyParams();
  34392. let lineMaterial = this._materialColorProperty({
  34393. color: _self._param.lineColor
  34394. });
  34395. entityParam.id = DrawTools.DrawType.SpatialLine;
  34396. entityParam.color = _self._param.lineColor;
  34397. entityParam.lineWidth = _self._param.lineWidth;
  34398. let entity = new Cesium.Entity({
  34399. name: _self._sketchEntityName,
  34400. polyline: {
  34401. show: true,
  34402. positions: new Cesium.CallbackProperty(function() {
  34403. return _self._sketchTempPoints;
  34404. }, false),
  34405. material: lineMaterial,
  34406. width: _self._param.lineWidth,
  34407. clampToGround: false
  34408. }
  34409. });
  34410. this._drawEntity = this._entities.add(entity);
  34411. this._drawEntity.setParams(entityParam);
  34412. },
  34413. _updateSpatialPolyline: function(isEdit) {
  34414. this._drawEntity.polyline.positions = this._sketchPoints;
  34415. this._drawEntity.setEntityType(DrawTools.DrawType.SpatialLine);
  34416. if (isEdit != void 0 && isEdit === true) {
  34417. this._removePointEntitys();
  34418. this._setEntityIsEdit(this._drawEntity);
  34419. }
  34420. },
  34421. _createPolygon: function(polygonType) {
  34422. let _self = this;
  34423. let entityParam = DrawTools.initEditPropertyParams();
  34424. let polygonMaterial = this._materialColorProperty({
  34425. color: _self._param.polygonColor
  34426. });
  34427. let lineMaterial = this._materialColorProperty({
  34428. color: _self._param.outlineColor
  34429. });
  34430. let entityPolygon = new Cesium.Entity({
  34431. name: _self._sketchEntityName,
  34432. polygon: {
  34433. show: true,
  34434. hierarchy: new Cesium.CallbackProperty(function() {
  34435. return {
  34436. positions: _self._sketchTempPoints
  34437. };
  34438. }, false),
  34439. material: polygonMaterial,
  34440. classificationType: Cesium.ClassificationType.BOTH
  34441. },
  34442. polyline: {
  34443. show: true,
  34444. positions: new Cesium.CallbackProperty(function() {
  34445. return _self._sketchTempPoints;
  34446. }, false),
  34447. material: lineMaterial,
  34448. width: _self._param.outlineWidth,
  34449. clampToGround: true
  34450. }
  34451. });
  34452. entityParam.color = _self._param.polygonColor;
  34453. entityParam.outlineColor = _self._param.outlineColor;
  34454. entityParam.outlineWidth = _self._param.outlineWidth;
  34455. this._drawEntity = this._entities.add(entityPolygon);
  34456. if (polygonType !== void 0 && polygonType === DrawTools.PolygonType.NormalPolygon) {
  34457. this._drawEntity.setEntityType(DrawTools.DrawType.Polygon);
  34458. entityParam.id = DrawTools.DrawType.Polygon;
  34459. } else if (polygonType !== void 0 && polygonType === DrawTools.PolygonType.HousePolygon) {
  34460. this._drawEntity.setEntityType(DrawTools.DrawType.House);
  34461. entityParam.id = DrawTools.DrawType.House;
  34462. }
  34463. this._drawEntity.setParams(entityParam);
  34464. },
  34465. _updatePolygon: function(isEdit) {
  34466. let _self = this;
  34467. let houseMaterial = this._materialColorProperty({
  34468. color: _self._param.houseColor
  34469. });
  34470. let entityType = this._drawEntity.getEntityType();
  34471. if (entityType === DrawTools.DrawType.Polygon) {
  34472. this._drawEntity.polygon.hierarchy = {
  34473. positions: _self._sketchPoints
  34474. };
  34475. this._drawEntity.polyline.positions = this._sketchPoints;
  34476. } else if (entityType === DrawTools.DrawType.House) {
  34477. let entityParam = this._drawEntity.getParams();
  34478. this._removeEntityByObject(this._drawEntity);
  34479. let height2 = parseFloat(this._sketchOutputPoints[0].height);
  34480. let houseHeight = height2 + parseInt(_self._param.wallHeight);
  34481. let houseEntity = new Cesium.Entity({
  34482. name: _self._sketchEntityName,
  34483. polygon: {
  34484. show: true,
  34485. hierarchy: {
  34486. positions: _self._sketchPoints
  34487. },
  34488. extrudedHeight: houseHeight,
  34489. material: houseMaterial
  34490. }
  34491. });
  34492. this._drawEntity = this._entities.add(houseEntity);
  34493. this._drawEntity.setEntityType(entityType);
  34494. entityParam.height = _self._param.wallHeight;
  34495. entityParam.bottomHeight = height2;
  34496. entityParam.color = _self._param.houseColor;
  34497. this._drawEntity.setParams(entityParam);
  34498. }
  34499. if (isEdit != void 0 && isEdit === true) {
  34500. this._removePointEntitys();
  34501. this._setEntityIsEdit(this._drawEntity);
  34502. }
  34503. },
  34504. _createRectangle: function() {
  34505. let _self = this;
  34506. let entityParam = DrawTools.initEditPropertyParams();
  34507. let rectMaterial = this._materialColorProperty({
  34508. color: _self._param.polygonColor
  34509. });
  34510. let lineMaterial = this._materialColorProperty({
  34511. color: _self._param.outlineColor
  34512. });
  34513. let entityRectangle = new Cesium.Entity({
  34514. name: _self._sketchEntityName,
  34515. polyline: {
  34516. show: true,
  34517. positions: new Cesium.CallbackProperty(
  34518. _self._callUpdateRectangleOutlineCoordinates(),
  34519. false
  34520. ),
  34521. material: lineMaterial,
  34522. width: _self._param.outlineWidth,
  34523. clampToGround: true
  34524. },
  34525. rectangle: {
  34526. show: true,
  34527. coordinates: new Cesium.CallbackProperty(
  34528. _self._callUpdateRectangleCoordinates(
  34529. _self._sketchTempPoints
  34530. ),
  34531. false
  34532. ),
  34533. material: rectMaterial,
  34534. classificationType: Cesium.ClassificationType.BOTH
  34535. }
  34536. });
  34537. entityParam.id = DrawTools.DrawType.Rectangle;
  34538. entityParam.color = _self._param.polygonColor;
  34539. entityParam.outlineColor = _self._param.outlineColor;
  34540. entityParam.outlineWidth = _self._param.outlineWidth;
  34541. this._drawEntity = this._entities.add(entityRectangle);
  34542. this._drawEntity.setParams(entityParam);
  34543. },
  34544. _updateRectangle(isEdit) {
  34545. this._drawEntity.polyline.positions = this._rectangleOutlineCoordinates;
  34546. let coordinates = this._rectangleCoordinates;
  34547. this._drawEntity.rectangle.coordinates = Cesium.Rectangle.fromDegrees(coordinates[0], coordinates[1], coordinates[2], coordinates[3]);
  34548. this._drawEntity.setEntityType(DrawTools.DrawType.Rectangle);
  34549. if (isEdit != void 0 && isEdit === true) {
  34550. this._setEntityIsEdit(this._drawEntity);
  34551. }
  34552. },
  34553. _createCircle: function(centerPosition, circleType) {
  34554. let _self = this;
  34555. let entityParam = DrawTools.initEditPropertyParams();
  34556. let circleMaterial = this._materialColorProperty({
  34557. color: _self._param.polygonColor
  34558. });
  34559. let lineMaterial = this._materialColorProperty({
  34560. color: _self._param.outlineColor
  34561. });
  34562. if (circleType != void 0 && circleType === DrawTools.CircleType.DynamicCircle) {
  34563. circleMaterial = new CircleMaterialProperty({
  34564. viewer: _self._viewer,
  34565. duration: _self._param.duration,
  34566. color: Cesium.Color.fromCssColorString(_self._param.polygonColor),
  34567. count: _self._param.count
  34568. });
  34569. }
  34570. this._sketchEllipseCenterPosition = centerPosition.clone();
  34571. let entityCircle = new Cesium.Entity({
  34572. name: _self._sketchEntityName,
  34573. position: centerPosition,
  34574. ellipse: {
  34575. show: true,
  34576. semiMinorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(
  34577. _self._sketchTempPoints
  34578. ), false),
  34579. semiMajorAxis: new Cesium.CallbackProperty(_self._callUpdateEllipseMinorAxis(
  34580. _self._sketchTempPoints
  34581. ), false),
  34582. material: circleMaterial,
  34583. classificationType: Cesium.ClassificationType.BOTH
  34584. }
  34585. });
  34586. if (circleType === void 0 || circleType === DrawTools.CircleType.ColorCircle) {
  34587. entityCircle.polyline = {
  34588. show: true,
  34589. positions: new Cesium.CallbackProperty(_self._callEllipseOutlineCoordinate(
  34590. _self._sketchTempPoints
  34591. ), false),
  34592. material: lineMaterial,
  34593. width: _self._param.outlineWidth,
  34594. clampToGround: true
  34595. };
  34596. }
  34597. this._drawEntity = this._entities.add(entityCircle);
  34598. if (circleType === void 0 || circleType === DrawTools.CircleType.ColorCircle) {
  34599. this._drawEntity.setEntityType(DrawTools.DrawType.Circle);
  34600. entityParam.id = DrawTools.DrawType.Circle;
  34601. entityParam.color = _self._param.polygonColor;
  34602. entityParam.outlineColor = _self._param.outlineColor;
  34603. entityParam.outlineWidth = _self._param.outlineWidth;
  34604. } else if (circleType != void 0 && circleType === DrawTools.CircleType.DynamicCircle) {
  34605. this._drawEntity.setEntityType(DrawTools.DrawType.DynamicCircle);
  34606. entityParam.id = DrawTools.DrawType.DynamicCircle;
  34607. entityParam.color = _self._param.polygonColor;
  34608. entityParam.duration = _self._param.duration;
  34609. entityParam.count = _self._param.count;
  34610. }
  34611. this._drawEntity.setParams(entityParam);
  34612. },
  34613. _updateCircle(isEdit) {
  34614. this._drawEntity.position = this._sketchEllipseCenterPosition;
  34615. let center2 = this._sketchTempPoints.first();
  34616. let outpoint = this._sketchTempPoints.last();
  34617. this._ellipseOutlineCoordinates = this._calculateEllipseOutlineCoordinate(center2, outpoint);
  34618. this._sketchEllipseRadius = this._calculateEllipseMinorAxis(center2, outpoint);
  34619. if (this._drawEntity.polyline != void 0) {
  34620. this._drawEntity.polyline.positions = this._ellipseOutlineCoordinates;
  34621. }
  34622. this._drawEntity.ellipse.semiMajorAxis = this._sketchEllipseRadius;
  34623. this._drawEntity.ellipse.semiMinorAxis = this._sketchEllipseRadius;
  34624. if (isEdit != void 0 && isEdit === true) {
  34625. this._setEntityIsEdit(this._drawEntity);
  34626. }
  34627. },
  34628. _createWall: function(wallType) {
  34629. let _self = this;
  34630. let entityParam = DrawTools.initEditPropertyParams();
  34631. let wallMaterial = this._materialColorProperty({
  34632. color: _self._param.polygonColor
  34633. });
  34634. entityParam.color = _self._param.polygonColor;
  34635. if (wallType !== void 0 && wallType === DrawTools.WallType.TextWall) {
  34636. wallMaterial = this._materialTextImageProperty({
  34637. color: _self._param.polygonColor,
  34638. text: _self._param.text
  34639. });
  34640. entityParam.text = _self._param.text;
  34641. entityParam.color = _self._param.polygonColor;
  34642. } else if (wallType !== void 0 && wallType === DrawTools.WallType.DynamicWall) {
  34643. wallMaterial = new WallMaterialProperty({
  34644. viewer: _self._viewer,
  34645. trailImage: _self._image_v_t_b,
  34646. duration: _self._param.duration,
  34647. color: Cesium.Color.fromCssColorString(_self._param.polygonColor),
  34648. param: {
  34649. count: _self._param.count,
  34650. direction: _self._param.direction_v,
  34651. order: _self._param.order_minus
  34652. }
  34653. });
  34654. entityParam.color = _self._param.polygonColor;
  34655. entityParam.duration = _self._param.duration;
  34656. entityParam.direction = _self._param.direction_v;
  34657. entityParam.count = _self._param.count;
  34658. entityParam.order = _self._param.order_minus;
  34659. }
  34660. let normalWall = new Cesium.Entity({
  34661. name: _self._sketchEntityName,
  34662. wall: {
  34663. show: true,
  34664. positions: new Cesium.CallbackProperty(function() {
  34665. return _self._sketchTempPoints;
  34666. }, false),
  34667. minimumHeights: new Cesium.CallbackProperty(function() {
  34668. return _self._sketchWallHeights;
  34669. }, false),
  34670. maximumHeights: new Cesium.CallbackProperty(function() {
  34671. _self._sketchWallMaxHeights = [];
  34672. for (let i2 = 0; i2 < _self._sketchWallHeights.length; i2++) {
  34673. _self._sketchWallMaxHeights.push(_self._sketchWallHeights[i2] + _self._param.wallHeight);
  34674. }
  34675. return _self._sketchWallMaxHeights;
  34676. }, false),
  34677. material: wallMaterial
  34678. }
  34679. });
  34680. this._drawEntity = this._entities.add(normalWall);
  34681. entityParam.height = this._param.wallHeight;
  34682. if (wallType === void 0 || wallType === DrawTools.WallType.ColorWall) {
  34683. this._drawEntity.setEntityType(DrawTools.DrawType.NormalWall);
  34684. entityParam.id = DrawTools.DrawType.NormalWall;
  34685. } else if (wallType !== void 0 && wallType === DrawTools.WallType.DynamicWall) {
  34686. this._drawEntity.setEntityType(DrawTools.DrawType.DynamicWall);
  34687. entityParam.id = DrawTools.DrawType.DynamicWall;
  34688. } else if (wallType !== void 0 && wallType === DrawTools.WallType.TextWall) {
  34689. this._drawEntity.setEntityType(DrawTools.DrawType.TextWall);
  34690. entityParam.id = DrawTools.DrawType.TextWall;
  34691. }
  34692. this._drawEntity.setParams(entityParam);
  34693. },
  34694. _updateWall: function(isEdit) {
  34695. let hLength = this._sketchWallHeights.length;
  34696. let mhLength = this._sketchWallMaxHeights.length;
  34697. let pLength = this._sketchPoints.length;
  34698. if (hLength === mhLength && hLength - pLength === 1) {
  34699. this._sketchWallHeights.pop();
  34700. this._sketchWallMaxHeights.pop();
  34701. this._drawEntity.wall.positions = this._sketchPoints;
  34702. this._drawEntity.wall.minimumHeights = this._sketchWallHeights;
  34703. this._drawEntity.wall.maximumHeights = this._sketchWallMaxHeights;
  34704. if (isEdit != void 0 && isEdit === true) {
  34705. this._removePointEntitys();
  34706. this._setEntityIsEdit(this._drawEntity);
  34707. }
  34708. } else {
  34709. this._console(hLength, mhLength, pLength);
  34710. }
  34711. },
  34712. _createVideoWall: function() {
  34713. let _self = this;
  34714. let entityWall = new Cesium.Entity({
  34715. name: _self._sketchEntityName,
  34716. position: _self._sketchOutputPoints[0],
  34717. wall: {
  34718. show: true,
  34719. positions: new Cesium.CallbackProperty(function() {
  34720. let pt0 = _self._sketchOutputPoints[0];
  34721. let pt1 = _self._sketchOutputPoints[1];
  34722. _self._wallPositions = [];
  34723. _self._wallPositions.push(Cesium.Cartesian3.fromDegrees(
  34724. pt0.lng,
  34725. pt0.lat,
  34726. pt0.height
  34727. ));
  34728. _self._wallPositions.push(Cesium.Cartesian3.fromDegrees(
  34729. pt1.lng,
  34730. pt1.lat,
  34731. pt0.height
  34732. ));
  34733. return _self._wallPositions;
  34734. }, false),
  34735. maximumHeights: new Cesium.CallbackProperty(function() {
  34736. _self._sketchWallHeights = [];
  34737. let pt2 = _self._sketchOutputPoints[0];
  34738. _self._sketchWallHeights.push(pt2.height);
  34739. _self._sketchWallHeights.push(pt2.height);
  34740. return _self._sketchWallHeights;
  34741. }, false),
  34742. minimumHeights: new Cesium.CallbackProperty(function() {
  34743. _self._sketchWallMaxHeights = [];
  34744. let pt2 = _self._sketchOutputPoints[1];
  34745. _self._sketchWallMaxHeights.push(pt2.height);
  34746. _self._sketchWallMaxHeights.push(pt2.height);
  34747. return _self._sketchWallMaxHeights;
  34748. }, false),
  34749. material: Cesium.Color.fromCssColorString(_self._param.polygonColor),
  34750. outline: true,
  34751. outlineColor: Cesium.Color.fromCssColorString(_self._param.outlineColor),
  34752. outlineWidth: _self._param.outlineWidth
  34753. }
  34754. });
  34755. _self._drawEntity = _self._entities.add(entityWall);
  34756. },
  34757. _updateVideoWall: function(isEdit) {
  34758. let entityParam = DrawTools.initEditPropertyParams();
  34759. entityParam.id = DrawTools.DrawType.VideoWall;
  34760. let videoElement = document.getElementById("wallVideo");
  34761. if (videoElement !== null) {
  34762. document.body.removeChild(videoElement);
  34763. }
  34764. videoElement = document.createElement("video");
  34765. videoElement.id = "wallVideo";
  34766. videoElement.setAttribute("crossorigin", "anonymous");
  34767. videoElement.setAttribute("width", "1024px");
  34768. videoElement.setAttribute("height", "256px");
  34769. videoElement.setAttribute("controls", "controls");
  34770. videoElement.setAttribute(
  34771. "src",
  34772. "https://lf3-cdn-tos.bytescm.com/obj/eden-cn/lmeh7pfuho/campus/campus_intro_20200522.mp4"
  34773. );
  34774. videoElement.setAttribute("loop", "loop");
  34775. videoElement.play();
  34776. document.body.appendChild(videoElement);
  34777. this._drawEntity.wall.positions = this._wallPositions;
  34778. this._drawEntity.wall.minimumHeights = this._sketchWallHeights;
  34779. this._drawEntity.wall.maximumHeights = this._sketchWallMaxHeights;
  34780. entityParam.height = this._sketchWallMaxHeights[0] - this._sketchWallHeights[0];
  34781. this._drawEntity.wall.material = videoElement;
  34782. this._removePointEntitys();
  34783. this._drawEntity.setEntityType(DrawTools.DrawType.VideoWall);
  34784. entityParam.videoUrl = "https://lf3-cdn-tos.bytescm.com/obj/eden-cn/lmeh7pfuho/campus/campus_intro_20200522.mp4";
  34785. entityParam.id = DrawTools.DrawType.VideoWall;
  34786. this._drawEntity.setParams(entityParam);
  34787. if (isEdit != void 0 && isEdit === true) {
  34788. this._setEntityIsEdit(this._drawEntity);
  34789. }
  34790. },
  34791. _calculateOdlinePositios: function(strPoint, endPoint, height2, count) {
  34792. let pt1 = this._cartesian3ToGeo(strPoint);
  34793. let pt2 = this._cartesian3ToGeo(endPoint);
  34794. var h2 = height2 && height2 < 1e3 ? height2 : 1e3;
  34795. var L = Math.abs(pt1.longitude - pt2.longitude) > Math.abs(pt1.latitude - pt2.latitude) ? Math.abs(pt1.longitude - pt2.longitude) : Math.abs(pt1.latitude - pt2.latitude);
  34796. var num = count && count > 50 ? count : 50;
  34797. var result = [];
  34798. var tempResult = [];
  34799. var dlt = L / num;
  34800. var addHeight = pt1.height > pt2.height ? pt1.height : pt2.height;
  34801. var maxHeight = addHeight + h2;
  34802. var minHeight1 = pt1.height;
  34803. var minHeight2 = pt2.height;
  34804. if (Math.abs(pt1.longitude - pt2.longitude) > Math.abs(pt1.latitude - pt2.latitude)) {
  34805. var delLat = (pt2.latitude - pt1.latitude) / num;
  34806. if (pt1.longitude - pt2.longitude > 0) {
  34807. dlt = -dlt;
  34808. }
  34809. for (var i2 = 1; i2 < num; i2++) {
  34810. var tempH = h2 - Math.pow(-0.5 * L + Math.abs(dlt) * i2, 2) * 4 * h2 / Math.pow(L, 2);
  34811. var lon = pt1.longitude + dlt * i2;
  34812. var lat = pt1.latitude + delLat * i2;
  34813. var alt = void 0;
  34814. if (Math.abs(dlt) * i2 == 0.5 * L) {
  34815. alt = maxHeight;
  34816. } else if (Math.abs(dlt) * i2 < 0.5 * L) {
  34817. alt = (maxHeight - minHeight1) / h2 * tempH + minHeight1;
  34818. } else {
  34819. alt = (maxHeight - minHeight2) / h2 * tempH + minHeight2;
  34820. }
  34821. tempResult.push([lon, lat, alt]);
  34822. }
  34823. } else {
  34824. var delLon = (pt2.longitude - pt1.longitude) / num;
  34825. if (pt1.latitude - pt2.latitude > 0) {
  34826. dlt = -dlt;
  34827. }
  34828. for (var i2 = 1; i2 < num; i2++) {
  34829. var tempH = h2 - Math.pow(-0.5 * L + Math.abs(dlt) * i2, 2) * 4 * h2 / Math.pow(L, 2);
  34830. var lon = pt1.longitude + delLon * i2;
  34831. var lat = pt1.latitude + dlt * i2;
  34832. var alt = void 0;
  34833. if (Math.abs(dlt) * i2 == 0.5 * L) {
  34834. alt = maxHeight;
  34835. } else if (Math.abs(dlt) * i2 < 0.5 * L) {
  34836. alt = (maxHeight - minHeight1) / h2 * tempH + minHeight1;
  34837. } else {
  34838. alt = (maxHeight - minHeight2) / h2 * tempH + minHeight2;
  34839. }
  34840. tempResult.push([lon, lat, alt]);
  34841. }
  34842. }
  34843. result.push([pt1.longitude, pt1.latitude, pt1.height]);
  34844. for (var i2 = 0; i2 < tempResult.length; i2++) {
  34845. result.push(tempResult[i2]);
  34846. }
  34847. result.push([pt2.longitude, pt2.latitude, pt2.height]);
  34848. let results = [];
  34849. for (let i3 = 0; i3 < result.length; i3++) {
  34850. results.push(Cesium.Cartesian3.fromDegrees(result[i3][0], result[i3][1], result[i3][2]));
  34851. }
  34852. return results;
  34853. },
  34854. _createOdline: function(isFirst) {
  34855. let _self = this;
  34856. if (isFirst !== void 0 && isFirst === true) {
  34857. let fatherEntity = new Cesium.Entity({
  34858. name: this._sketchEntityName
  34859. });
  34860. this._odlineFatherEntity = this._entities.add(fatherEntity);
  34861. let entityParam = DrawTools.initEditPropertyParams();
  34862. entityParam.id = DrawTools.DrawType.OdLine;
  34863. entityParam.color = _self._param.polygonColor;
  34864. entityParam.duration = _self._param.duration;
  34865. entityParam.direction = _self._param.direction_h;
  34866. entityParam.count = _self._param.count;
  34867. entityParam.order = _self._param.order_add;
  34868. entityParam.odlineHeight = _self._param.odlineHeight;
  34869. entityParam.odlineCount = _self._param.odlineCount;
  34870. entityParam.lineWidth = _self._param.lineWidth * 3;
  34871. this._odlineFatherEntity.setParams(entityParam);
  34872. this._odlineEntitys = [];
  34873. }
  34874. let faterParam = this._odlineFatherEntity.getParams();
  34875. let odLineMaterial = new WallMaterialProperty({
  34876. viewer: _self._viewer,
  34877. trailImage: _self._image_arrow_reverse,
  34878. duration: faterParam.duration,
  34879. color: Cesium.Color.fromCssColorString(faterParam.color),
  34880. param: {
  34881. direction: faterParam.direction,
  34882. count: faterParam.count,
  34883. order: faterParam.order
  34884. }
  34885. });
  34886. let entity = new Cesium.Entity({
  34887. name: _self._sketchEntityName,
  34888. parent: this._odlineFatherEntity,
  34889. polyline: {
  34890. show: true,
  34891. positions: new Cesium.CallbackProperty(function() {
  34892. let center2 = _self._sketchTempPoints[0];
  34893. let endPoint = _self._sketchTempPoints[_self._sketchTempPoints.length - 1];
  34894. let results = _self._calculateOdlinePositios(
  34895. center2,
  34896. endPoint,
  34897. parseInt(
  34898. faterParam.odlineHeight
  34899. ),
  34900. parseInt(faterParam.odlineCount)
  34901. );
  34902. return results;
  34903. }, false),
  34904. material: odLineMaterial,
  34905. width: faterParam.lineWidth,
  34906. clampToGround: false
  34907. }
  34908. });
  34909. this._drawEntity = this._entities.add(entity);
  34910. },
  34911. _updateOdline: function(isLast, isEdit) {
  34912. if (isLast !== void 0 && isLast === true) {
  34913. if (isEdit !== void 0 && isEdit === true) {
  34914. this._drawEntity.setEntityType(DrawTools.DrawType.OdLine);
  34915. this._setEntityIsEdit(this._drawEntity);
  34916. this._drawEntity.parent.setIsEdit(true);
  34917. }
  34918. } else {
  34919. let params = this._drawEntity.parent.getParams();
  34920. let center2 = this._sketchTempPoints[0];
  34921. let endPoint = this._sketchTempPoints[this._sketchTempPoints.length - 1];
  34922. let results = this._calculateOdlinePositios(
  34923. center2,
  34924. endPoint,
  34925. parseInt(params.odlineHeight),
  34926. parseInt(params.odlineCount)
  34927. );
  34928. this._drawEntity.polyline.positions = results;
  34929. this._drawEntity.setEntityType(DrawTools.DrawType.OdLine);
  34930. this._odlineEntitys.push(this._drawEntity);
  34931. if (isEdit !== void 0 && isEdit === true) {
  34932. this._drawEntity.setIsEdit(true);
  34933. }
  34934. }
  34935. },
  34936. _guid() {
  34937. function S4() {
  34938. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  34939. }
  34940. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  34941. },
  34942. _console(...rest) {
  34943. console.log("===>>>", rest);
  34944. }
  34945. });
  34946. Object.assign(DrawTools.prototype, {
  34947. _drawMovingDoubleTooltip(position2) {
  34948. this._updateTooltip("\u5DE6\u952E\u5355\u51FB\u7ED8\u5236,\u53F3\u952E\u5355\u51FB\u64A4\u9500<br>\u5DE6\u952E\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236", position2);
  34949. },
  34950. _drawMovingSimpleTooltip(position2) {
  34951. this._updateTooltip("\u5DE6\u952E\u5355\u51FB\u7ED3\u675F\u7ED8\u5236", position2);
  34952. },
  34953. _removeLastDrawPointEntity() {
  34954. let lastPointEntity = this._pointEntitys.last();
  34955. if (lastPointEntity !== void 0) {
  34956. this._removeEntityByObject(lastPointEntity);
  34957. this._pointEntitys.pop();
  34958. }
  34959. },
  34960. _sketchDrawPoint(handler, options2) {
  34961. let _self = this;
  34962. this._registerLeftClickEvent(handler, function(event2) {
  34963. let scene = _self._viewer.scene;
  34964. if (scene.mode !== Cesium.SceneMode.MORPHING) {
  34965. var pickedObject = scene.pick(event2.position);
  34966. if (scene.pickPositionSupported && Cesium.defined(pickedObject)) {
  34967. var cartesian = scene.pickPosition(event2.position);
  34968. if (Cesium.defined(cartesian)) {
  34969. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  34970. var lng = Cesium.Math.toDegrees(cartographic.longitude);
  34971. var lat = Cesium.Math.toDegrees(cartographic.latitude);
  34972. var height2 = cartographic.height;
  34973. _self._sketchOutputPoints.push({
  34974. lng,
  34975. lat,
  34976. height: height2
  34977. });
  34978. }
  34979. _self._createPoint(cartesian, "\u70B9");
  34980. _self._sketchPoints.push(cartesian.clone());
  34981. if (_self._sketchPoints.length >= 2) {
  34982. _self._createVideoWall();
  34983. _self._clearEvent(handler);
  34984. }
  34985. }
  34986. }
  34987. if (options2.onComplete)
  34988. options2.onComplete(loc.sLocation, loc.gLocation);
  34989. });
  34990. },
  34991. _sketchDrawMultiplePoint(handler, options2) {
  34992. let _self = this;
  34993. this._registerLeftClickEvent(handler, function(event2) {
  34994. let loc2 = _self._transfromFromScreenPoint(event2.position);
  34995. if (!Cesium.defined(loc2.sLocation))
  34996. return;
  34997. if (_self._isDrawPoint) {
  34998. _self._createPoint(loc2.sLocation, _self._lineLabel);
  34999. }
  35000. _self._sketchPoints.push(loc2.sLocation);
  35001. _self._sketchOutputPoints.push(loc2.gLocation);
  35002. if (options2.onAdded)
  35003. options2.onAdded(loc2.sLocation, loc2.gLocation);
  35004. });
  35005. this._registerRightClickEvent(handler, function(event2) {
  35006. if (_self._sketchPoints.length > 0) {
  35007. _self._sketchPoints.pop();
  35008. _self._sketchOutputPoints.pop();
  35009. if (options2.onUndo)
  35010. options2.onUndo();
  35011. }
  35012. });
  35013. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35014. _self._clearEvent(handler);
  35015. if (options2.onComplete)
  35016. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35017. });
  35018. },
  35019. _sketchDrawPolyline(handler, options2) {
  35020. let _self = this;
  35021. this._registerLeftClickEvent(handler, function(event2) {
  35022. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35023. if (!Cesium.defined(loc2.sLocation))
  35024. return;
  35025. if (_self._isDrawPoint) {
  35026. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35027. }
  35028. if (_self._sketchTempPoints.length === 0) {
  35029. _self._createPolyline(options2.polylineType);
  35030. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35031. }
  35032. _self._sketchTempPoints.push(loc2.sLocation);
  35033. _self._sketchPoints.push(loc2.sLocation.clone());
  35034. _self._sketchOutputPoints.push(loc2.gLocation);
  35035. if (options2.onAdded)
  35036. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  35037. _self._createOperationDom();
  35038. });
  35039. this._registerMouseMoveEvent(handler, function(event2) {
  35040. if (_self._isRuntimeApp())
  35041. return;
  35042. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35043. if (!Cesium.defined(loc2.sLocation))
  35044. return;
  35045. if (_self._sketchTempPoints.length > 1) {
  35046. _self._drawMovingDoubleTooltip(event2.endPosition);
  35047. _self._sketchTempPoints.pop();
  35048. _self._sketchTempPoints.push(loc2.sLocation);
  35049. if (options2.onMoving)
  35050. options2.onMoving(loc2.sLocation);
  35051. }
  35052. });
  35053. this._registerRightClickEvent(handler, function(event2) {
  35054. if (_self._sketchTempPoints.length > 2) {
  35055. _self._drawByUndo();
  35056. if (options2.onUndo)
  35057. options2.onUndo();
  35058. }
  35059. });
  35060. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35061. if (_self._sketchPoints.length < 2) {
  35062. if (options2.onError)
  35063. options2.onError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  35064. return;
  35065. }
  35066. _self._updatePolyline(options2.isEdit);
  35067. if (!_self._isRetainDrawPoint)
  35068. _self._removePointEntitys();
  35069. _self._clearEvent(handler);
  35070. if (options2.onComplete)
  35071. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35072. });
  35073. },
  35074. _sketchDrawSpatialPolyline(handler, options2) {
  35075. let _self = this;
  35076. this._registerLeftClickEvent(handler, function(event2) {
  35077. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35078. if (!Cesium.defined(loc2.sLocation))
  35079. return;
  35080. if (_self._isDrawPoint) {
  35081. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35082. }
  35083. if (_self._sketchTempPoints.length === 0) {
  35084. _self._createSpatialPolyline();
  35085. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35086. }
  35087. _self._sketchTempPoints.push(loc2.sLocation);
  35088. _self._sketchPoints.push(loc2.sLocation.clone());
  35089. _self._sketchOutputPoints.push(loc2.gLocation);
  35090. if (options2.onAdded)
  35091. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  35092. _self._createOperationDom();
  35093. });
  35094. this._registerMouseMoveEvent(handler, function(event2) {
  35095. if (_self._isRuntimeApp())
  35096. return;
  35097. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35098. if (!Cesium.defined(loc2.sLocation))
  35099. return;
  35100. if (_self._sketchTempPoints.length > 1) {
  35101. _self._drawMovingDoubleTooltip(event2.endPosition);
  35102. _self._sketchTempPoints.pop();
  35103. _self._sketchTempPoints.push(loc2.sLocation);
  35104. if (options2.onMoving)
  35105. options2.onMoving(loc2.sLocation);
  35106. }
  35107. });
  35108. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35109. if (_self._sketchPoints.length < 2) {
  35110. if (options2.onError)
  35111. options2.onError("\u7ED8\u5236\u70B9\u5C11\u4E8E2\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  35112. return;
  35113. }
  35114. _self._updateSpatialPolyline(options2.isEdit);
  35115. _self._removePointEntitys();
  35116. _self._clearEvent(handler);
  35117. if (options2.onComplete)
  35118. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35119. });
  35120. this._registerRightClickEvent(handler, function(event2) {
  35121. if (_self._sketchTempPoints.length > 2) {
  35122. _self._drawByUndo();
  35123. if (options2.onUndo)
  35124. options2.onUndo();
  35125. }
  35126. });
  35127. },
  35128. _sketchDrawOdline(handler, options2) {
  35129. let _self = this;
  35130. this._registerLeftClickEvent(handler, function(event2) {
  35131. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35132. if (!Cesium.defined(loc2.sLocation))
  35133. return;
  35134. if (_self._isDrawPoint) {
  35135. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35136. }
  35137. if (_self._isRuntimeApp()) {
  35138. _self._showTooltipMessage("\u518D\u6B21\u5355\u51FB\u7ED8\u5236\u4E00\u6761OD\u7EBF\uFF01");
  35139. }
  35140. if (_self._sketchTempPoints.length === 0) {
  35141. _self._createOdline(true);
  35142. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35143. } else {
  35144. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35145. _self._updateOdline(false, options2.isEdit);
  35146. _self._createOdline();
  35147. }
  35148. _self._sketchTempPoints.push(loc2.sLocation);
  35149. _self._sketchPoints.push(loc2.sLocation.clone());
  35150. _self._sketchOutputPoints.push(loc2.gLocation);
  35151. if (options2.onAdded)
  35152. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  35153. _self._createOperationDom();
  35154. });
  35155. this._registerMouseMoveEvent(handler, function(event2) {
  35156. if (_self._isRuntimeApp())
  35157. return;
  35158. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35159. if (!Cesium.defined(loc2.sLocation))
  35160. return;
  35161. if (_self._sketchTempPoints.length > 1) {
  35162. _self._drawMovingDoubleTooltip(event2.endPosition);
  35163. _self._sketchTempPoints.pop();
  35164. _self._sketchTempPoints.push(loc2.sLocation);
  35165. if (options2.onMoving)
  35166. options2.onMoving(loc2.sLocation);
  35167. }
  35168. });
  35169. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35170. _self._removeEntityByObject(_self._drawEntity);
  35171. _self._updateOdline(true, options2.isEdit);
  35172. _self._removePointEntitys();
  35173. _self._clearEvent(handler);
  35174. if (options2.onComplete)
  35175. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35176. });
  35177. this._registerRightClickEvent(handler, function(event2) {
  35178. if (_self._odlineEntitys.length > 0) {
  35179. if (_self._isDrawPoint) {
  35180. _self._removeLastDrawPointEntity();
  35181. }
  35182. _self._removeEntityByObject(_self._odlineEntitys.last());
  35183. _self._odlineEntitys.pop();
  35184. if (options2.onUndo)
  35185. options2.onUndo();
  35186. }
  35187. });
  35188. },
  35189. _sketchDrawPolygon(handler, options2) {
  35190. let _self = this;
  35191. this._registerLeftClickEvent(handler, function(event2) {
  35192. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35193. if (!Cesium.defined(loc2.sLocation))
  35194. return;
  35195. if (_self._isDrawPoint) {
  35196. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35197. }
  35198. if (_self._sketchTempPoints.length === 0) {
  35199. _self._createPolygon(options2.polygonType);
  35200. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35201. }
  35202. _self._sketchTempPoints.push(loc2.sLocation);
  35203. _self._sketchPoints.push(loc2.sLocation.clone());
  35204. _self._sketchOutputPoints.push(loc2.gLocation);
  35205. if (options2.onAdded)
  35206. options2.onAdded(_self._sketchPoints, _self._sketchOutputPoints);
  35207. _self._createOperationDom();
  35208. });
  35209. this._registerMouseMoveEvent(handler, function(event2) {
  35210. if (_self._isRuntimeApp())
  35211. return;
  35212. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35213. if (!Cesium.defined(loc2.sLocation))
  35214. return;
  35215. if (_self._sketchTempPoints.length > 1) {
  35216. _self._drawMovingDoubleTooltip(event2.endPosition);
  35217. _self._sketchTempPoints.pop();
  35218. _self._sketchTempPoints.push(loc2.sLocation);
  35219. if (options2.onMoving)
  35220. options2.onMoving(loc2.sLocation);
  35221. }
  35222. });
  35223. this._registerRightClickEvent(handler, function(event2) {
  35224. if (_self._sketchTempPoints.length > 2) {
  35225. _self._drawByUndo();
  35226. if (options2.onUndo)
  35227. options2.onUndo();
  35228. }
  35229. });
  35230. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35231. if (_self._sketchPoints.length < 3) {
  35232. if (options2.onError)
  35233. options2.onError("\u70B9\u6570\u5C11\u4E8E3\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  35234. return;
  35235. }
  35236. _self._updatePolygon(options2.isEdit);
  35237. if (!_self._isRetainDrawPoint)
  35238. _self._removePointEntitys();
  35239. _self._clearEvent(handler);
  35240. if (options2.onComplete)
  35241. options2.onComplete(_self._sketchPoints, _self._sketchOutputPoints);
  35242. });
  35243. },
  35244. _sketchDrawCircle: function(handler, options2) {
  35245. let _self = this;
  35246. this._registerLeftClickEvent(handler, function(event2) {
  35247. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35248. if (!Cesium.defined(loc2.sLocation))
  35249. return;
  35250. if (_self._sketchTempPoints.length === 0) {
  35251. if (_self._isDrawPoint) {
  35252. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  35253. }
  35254. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35255. _self._sketchTempPoints.push(loc2.sLocation);
  35256. _self._sketchPoints.push(loc2.sLocation.clone());
  35257. _self._sketchOutputPoints.push(loc2.gLocation);
  35258. _self._createCircle(loc2.sLocation, options2.circleType);
  35259. if (_self._isRuntimeApp()) {
  35260. _self._showTooltipMessage("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236\uFF01");
  35261. }
  35262. if (options2.onAdded)
  35263. options2.onAdded(loc2.sLocation);
  35264. } else {
  35265. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35266. _self._removePointEntitys();
  35267. _self._updateCircle(options2.isEdit);
  35268. _self._clearEvent(handler);
  35269. if (options2.onComplete)
  35270. options2.onComplete(_self._sketchOutputPoints[0], _self._sketchEllipseRadius);
  35271. }
  35272. });
  35273. this._registerMouseMoveEvent(handler, function(event2) {
  35274. if (_self._isRuntimeApp()) {
  35275. return;
  35276. }
  35277. if (_self._sketchTempPoints.length <= 0)
  35278. return;
  35279. _self._drawMovingSimpleTooltip(event2.endPosition);
  35280. var cartesian = _self._viewer.scene.pickPosition(event2.endPosition);
  35281. if (cartesian == void 0)
  35282. return;
  35283. _self._sketchTempPoints.pop();
  35284. _self._sketchTempPoints.push(cartesian);
  35285. });
  35286. },
  35287. _sketchDrawRectangle: function(handler, options2) {
  35288. let _self = this;
  35289. this._registerLeftClickEvent(handler, function(event2) {
  35290. if (_self._sketchTempPoints.length === 0) {
  35291. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35292. if (!Cesium.defined(loc2.sLocation))
  35293. return;
  35294. if (_self._isDrawPoint) {
  35295. _self._createPoint(loc2.sLocation, "\u8D77\u70B9");
  35296. }
  35297. _self._sketchTempPoints.push(loc2.sLocation);
  35298. _self._sketchTempPoints.push(loc2.sLocation);
  35299. _self._sketchPoints.push(loc2.gLocation);
  35300. _self._createRectangle();
  35301. if (options2.onAdded)
  35302. options2.onAdded(loc2.sLocation);
  35303. if (_self._isRuntimeApp()) {
  35304. _self._showTooltipMessage("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236\uFF01");
  35305. }
  35306. } else {
  35307. _self._removePointEntitys();
  35308. _self._removeEntityByObject(_self._sketchTempRectangle);
  35309. _self._updateRectangle(options2.isEdit);
  35310. _self._clearEvent(handler);
  35311. if (options2.onComplete)
  35312. options2.onComplete(_self._sketchOutputPoints);
  35313. }
  35314. });
  35315. this._registerMouseMoveEvent(handler, function(event2) {
  35316. if (_self._sketchTempPoints.length < 1)
  35317. return;
  35318. _self._drawMovingSimpleTooltip(event2.endPosition);
  35319. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35320. if (!Cesium.defined(loc2.sLocation))
  35321. return;
  35322. _self._sketchTempPoints.pop();
  35323. _self._sketchTempPoints.push(loc2.sLocation);
  35324. });
  35325. },
  35326. _sketchDrawWall: function(handler, options2) {
  35327. let _self = this;
  35328. this._registerLeftClickEvent(handler, function(event2) {
  35329. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35330. if (!Cesium.defined(loc2.sLocation))
  35331. return;
  35332. if (_self._isDrawPoint) {
  35333. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35334. }
  35335. if (_self._sketchTempPoints.length === 0) {
  35336. _self._createWall(options2.wallType);
  35337. _self._sketchTempPoints.push(loc2.sLocation.clone());
  35338. _self._sketchWallHeights.push(loc2.gLocation.height);
  35339. }
  35340. _self._sketchTempPoints.push(loc2.sLocation);
  35341. _self._sketchWallHeights.push(loc2.gLocation.height);
  35342. _self._sketchPoints.push(loc2.sLocation.clone());
  35343. _self._createOperationDom();
  35344. });
  35345. this._registerMouseMoveEvent(handler, function(event2) {
  35346. if (_self._isRuntimeApp()) {
  35347. return;
  35348. }
  35349. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35350. if (!Cesium.defined(loc2.sLocation))
  35351. return;
  35352. if (_self._sketchTempPoints.length > 1) {
  35353. _self._drawMovingDoubleTooltip(event2.endPosition);
  35354. _self._sketchTempPoints.pop();
  35355. _self._sketchTempPoints.push(loc2.sLocation);
  35356. _self._sketchWallHeights.pop();
  35357. _self._sketchWallHeights.push(loc2.gLocation.height);
  35358. }
  35359. });
  35360. this._registerRightClickEvent(handler, function(event2) {
  35361. if (_self._sketchTempPoints.length > 2) {
  35362. _self._sketchPoints.pop();
  35363. if (_self._isRuntimeApp()) {
  35364. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 1, 1);
  35365. _self._sketchWallHeights.splice(_self._sketchWallHeights.length - 1, 1);
  35366. } else {
  35367. _self._sketchTempPoints.splice(_self._sketchTempPoints.length - 2, 1);
  35368. _self._sketchWallHeights.splice(_self._sketchWallHeights.length - 2, 1);
  35369. }
  35370. if (_self._isDrawPoint) {
  35371. _self._removeLastDrawPointEntity();
  35372. }
  35373. }
  35374. });
  35375. this._registerLeftDoubleClickEvent(handler, function(event2) {
  35376. if (_self._sketchPoints.length < 2) {
  35377. if (options2.onError)
  35378. options2.onError("\u70B9\u6570\u5C11\u4E8E\u4E24\u4E2A\uFF0C\u7981\u6B62\u7ED3\u675F\u7ED8\u5236\uFF01");
  35379. return;
  35380. }
  35381. _self._updateWall(options2.isEdit);
  35382. if (!_self._isRetainDrawPoint)
  35383. _self._removePointEntitys();
  35384. _self._clearEvent(handler);
  35385. });
  35386. },
  35387. _sketchDrawVideoWall: function(handler, options2) {
  35388. let _self = this;
  35389. this._registerLeftClickEvent(handler, function(event2) {
  35390. let loc2 = _self._transfromFromScreenPoint(event2.position);
  35391. if (!Cesium.defined(loc2.sLocation))
  35392. return;
  35393. if (_self._isDrawPoint) {
  35394. _self._createPoint(loc2.sLocation, _self._lineLabel);
  35395. }
  35396. if (_self._sketchOutputPoints.length === 0) {
  35397. _self._sketchOutputPoints.push(loc2.gLocation);
  35398. _self._sketchOutputPoints.push(loc2.gLocation);
  35399. _self._createVideoWall();
  35400. if (_self._isRuntimeApp()) {
  35401. _self._showTooltipMessage("\u518D\u6B21\u5355\u51FB\u7ED3\u675F\u7ED8\u5236");
  35402. }
  35403. } else {
  35404. _self._updateVideoWall(options2.isEdit);
  35405. _self._clearEvent(handler);
  35406. }
  35407. });
  35408. this._registerMouseMoveEvent(handler, function(event2) {
  35409. if (_self._isRuntimeApp())
  35410. return;
  35411. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  35412. if (!Cesium.defined(loc2.sLocation))
  35413. return;
  35414. if (_self._sketchOutputPoints.length > 1) {
  35415. _self._drawMovingSimpleTooltip(event2.endPosition);
  35416. _self._sketchOutputPoints.pop();
  35417. _self._sketchOutputPoints.push(loc2.gLocation);
  35418. }
  35419. });
  35420. },
  35421. _drawByUndo: function() {
  35422. this._sketchPoints.pop();
  35423. if (this._isRuntimeApp()) {
  35424. this._sketchTempPoints.splice(this._sketchTempPoints.length - 1, 1);
  35425. } else {
  35426. this._sketchTempPoints.splice(this._sketchTempPoints.length - 2, 1);
  35427. }
  35428. if (this._isDrawPoint) {
  35429. this._removeLastDrawPointEntity();
  35430. }
  35431. },
  35432. draw: function(type2, options2) {
  35433. let _self = this;
  35434. this._clear();
  35435. this._drawEventHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  35436. if (this._isRuntimeApp()) {
  35437. this._showTooltipMessage("\u5355\u51FB\u7ED8\u5236");
  35438. } else {
  35439. this._beginTooltip("\u5DE6\u952E\u5355\u51FB\u7ED8\u5236", void 0);
  35440. }
  35441. this._drawType = type2;
  35442. switch (type2) {
  35443. case DrawTools.DrawType.Point:
  35444. _self._sketchDrawPoint(_self._drawEventHandler, options2);
  35445. break;
  35446. case DrawTools.DrawType.Polyline:
  35447. options2.polylineType = DrawTools.PolylineType.NormalPolyline;
  35448. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35449. break;
  35450. case DrawTools.DrawType.ArrowPolyline:
  35451. options2.polylineType = DrawTools.PolylineType.ArrowsPolyline;
  35452. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35453. break;
  35454. case DrawTools.DrawType.DynamicPolyline:
  35455. options2.polylineType = DrawTools.PolylineType.DynamicPolyline;
  35456. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35457. break;
  35458. case DrawTools.DrawType.GrowPolyline:
  35459. options2.polylineType = DrawTools.PolylineType.GrowPolyline;
  35460. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35461. break;
  35462. case DrawTools.DrawType.OutlinePolyline:
  35463. options2.polylineType = DrawTools.PolylineType.OutlinePolyline;
  35464. _self._sketchDrawPolyline(_self._drawEventHandler, options2);
  35465. break;
  35466. case DrawTools.DrawType.Polygon:
  35467. options2.polygonType = DrawTools.PolygonType.NormalPolygon;
  35468. _self._sketchDrawPolygon(_self._drawEventHandler, options2);
  35469. break;
  35470. case DrawTools.DrawType.SpatialLine:
  35471. _self._sketchDrawSpatialPolyline(_self._drawEventHandler, options2);
  35472. break;
  35473. case DrawTools.DrawType.Circle:
  35474. options2.circleType = DrawTools.CircleType.ColorCircle;
  35475. _self._sketchDrawCircle(_self._drawEventHandler, options2);
  35476. break;
  35477. case DrawTools.DrawType.Rectangle:
  35478. _self._sketchDrawRectangle(_self._drawEventHandler, options2);
  35479. break;
  35480. case DrawTools.DrawType.NormalWall:
  35481. options2.wallType = DrawTools.WallType.ColorWall;
  35482. _self._sketchDrawWall(_self._drawEventHandler, options2);
  35483. break;
  35484. case DrawTools.DrawType.DynamicWall:
  35485. options2.wallType = DrawTools.WallType.DynamicWall;
  35486. _self._sketchDrawWall(_self._drawEventHandler, options2);
  35487. break;
  35488. case DrawTools.DrawType.TextWall:
  35489. options2.wallType = DrawTools.WallType.TextWall;
  35490. _self._sketchDrawWall(_self._drawEventHandler, options2);
  35491. break;
  35492. case DrawTools.DrawType.DynamicCircle:
  35493. options2.circleType = DrawTools.CircleType.DynamicCircle;
  35494. _self._sketchDrawCircle(_self._drawEventHandler, options2);
  35495. break;
  35496. case DrawTools.DrawType.House:
  35497. options2.polygonType = DrawTools.PolygonType.HousePolygon;
  35498. _self._sketchDrawPolygon(_self._drawEventHandler, options2);
  35499. break;
  35500. case DrawTools.DrawType.VideoWall:
  35501. _self._sketchDrawVideoWall(_self._drawEventHandler, options2);
  35502. break;
  35503. case DrawTools.DrawType.OdLine:
  35504. _self._sketchDrawOdline(_self._drawEventHandler, options2);
  35505. break;
  35506. }
  35507. },
  35508. Clear: function() {
  35509. this._clear(true);
  35510. this._unActivateEdit();
  35511. this._closePropertyEditDialog();
  35512. this._removeOperationDom();
  35513. },
  35514. sketchInit: function() {
  35515. this._clear(false);
  35516. },
  35517. _checkAppOrWeb() {
  35518. if (window.navigator.userAgent.match(
  35519. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  35520. )) {
  35521. return DrawTools.RuntimeEnvironment.App;
  35522. } else {
  35523. return DrawTools.RuntimeEnvironment.Web;
  35524. }
  35525. },
  35526. _isRuntimeApp() {
  35527. if (this._checkAppOrWeb() === DrawTools.RuntimeEnvironment.App) {
  35528. return true;
  35529. }
  35530. return false;
  35531. }
  35532. });
  35533. Object.assign(DrawTools.prototype, {
  35534. _tooltipInit: function(text, mousePosition) {
  35535. let _self = this;
  35536. this._tooltipId = "tooltipSketchmodel";
  35537. let tooltipObj = document.getElementById(this._tooltipId);
  35538. if (tooltipObj === null) {
  35539. tooltipObj = document.createElement("div");
  35540. tooltipObj.id = this._tooltipId;
  35541. document.body.appendChild(tooltipObj);
  35542. let divStyle = "";
  35543. divStyle += "top: 30px;";
  35544. divStyle += "left: 30px;";
  35545. divStyle += "position: absolute;";
  35546. divStyle += "display: flex;";
  35547. divStyle += "align-items: center;";
  35548. divStyle += "width: 12x0px;";
  35549. divStyle += "height: auto;";
  35550. divStyle += "background-color: rgba(0, 0, 0, 0.65);";
  35551. divStyle += "border-radius: 5px;";
  35552. divStyle += "color: rgb(255, 255, 255);";
  35553. divStyle += "font-size: 12px;";
  35554. divStyle += "font-family: 'Alimama_ShuHeiTi_Bold';";
  35555. divStyle += "padding: 8px;";
  35556. divStyle += "border:solid 1px rgb(255,0,0);";
  35557. tooltipObj.setAttribute("style", divStyle);
  35558. }
  35559. if (text != void 0)
  35560. tooltipObj.innerHTML = text;
  35561. if (mousePosition === void 0) {
  35562. document.onmousemove = function(event2) {
  35563. if (event2.clientX < 100 || event2.clientX > _self._canvasWidth - 100 || event2.clientY < 100 || event2.clientY > _self._canvasHeight - 100) {
  35564. tooltipObj.style.display = "none";
  35565. } else {
  35566. tooltipObj.style.display = "flex";
  35567. tooltipObj.style.left = event2.clientX + 10 + "px";
  35568. tooltipObj.style.top = event2.clientY - tooltipObj.offsetHeight / 2 + "px";
  35569. }
  35570. };
  35571. } else {
  35572. if (mousePosition.x < 100 || mousePosition.x > _self._canvasWidth - 100 || mousePosition.y < 100 || mousePosition.y > _self._canvasHeight - 100) {
  35573. tooltipObj.style.display = "none";
  35574. } else {
  35575. tooltipObj.style.display = "flex";
  35576. tooltipObj.style.left = mousePosition.x + 10 + "px";
  35577. tooltipObj.style.top = mousePosition.y - tooltipObj.offsetHeight / 2 + "px";
  35578. }
  35579. }
  35580. },
  35581. _tooltipRemove: function() {
  35582. let tooltipObj = document.getElementById(this._tooltipId);
  35583. if (tooltipObj != null) {
  35584. document.body.removeChild(tooltipObj);
  35585. }
  35586. },
  35587. _tooltipSetText: function(text, mousePosition) {
  35588. let tooltipObj = document.getElementById(this._tooltipId);
  35589. if (tooltipObj != null) {
  35590. if (text != void 0)
  35591. tooltipObj.innerHTML = text;
  35592. if (mousePosition != void 0) {
  35593. if (mousePosition.x < 100 || mousePosition.x > this._canvasWidth - 100 || mousePosition.y < 100 || mousePosition.y > this._canvasHeight - 100) {
  35594. tooltipObj.style.display = "none";
  35595. } else {
  35596. tooltipObj.style.display = "flex";
  35597. tooltipObj.style.left = mousePosition.x + 10 + "px";
  35598. tooltipObj.style.top = mousePosition.y - tooltipObj.offsetHeight / 2 + "px";
  35599. }
  35600. }
  35601. }
  35602. },
  35603. _setMousePointerStyle: function() {
  35604. document.querySelector("body").style.cursor = "crosshair";
  35605. },
  35606. _setMouseDefaultStyle: function() {
  35607. document.querySelector("body").style.cursor = "default";
  35608. },
  35609. _beginTooltip(text, position2) {
  35610. this._tooltipInit(text, position2);
  35611. this._setMousePointerStyle();
  35612. },
  35613. _updateTooltip(text, position2) {
  35614. this._tooltipSetText(text, position2);
  35615. },
  35616. _endTooltip() {
  35617. this._tooltipRemove();
  35618. this._setMouseDefaultStyle();
  35619. },
  35620. _showTooltipMessage: function(message) {
  35621. let msgMainDom = document.getElementById("messageMainDom");
  35622. if (msgMainDom !== null && msgMainDom !== void 0) {
  35623. document.body.removeChild(msgMainDom);
  35624. }
  35625. msgMainDom = document.createElement("div");
  35626. msgMainDom.style.width = "30%";
  35627. msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
  35628. msgMainDom.style.height = "45px";
  35629. msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
  35630. msgMainDom.style.borderRadius = "8px";
  35631. msgMainDom.style.display = "flex";
  35632. msgMainDom.style.alignItems = "center";
  35633. msgMainDom.style.paddingLeft = "10px";
  35634. msgMainDom.style.color = "rgb(91, 188, 48)";
  35635. msgMainDom.style.fontSize = "14px";
  35636. msgMainDom.style.fontWeight = "600";
  35637. msgMainDom.style.position = "absolute";
  35638. msgMainDom.style.left = "35%";
  35639. msgMainDom.style.transition = "transform 1s";
  35640. msgMainDom.style.transform = "translateY(-90px)";
  35641. msgMainDom.style.top = "0px";
  35642. msgMainDom.style.zIndex = 1e3;
  35643. document.body.appendChild(msgMainDom);
  35644. let strHtml = "";
  35645. strHtml += "<div style='";
  35646. strHtml += "background-color: rgb(88, 185, 45);";
  35647. strHtml += "color: rgb(255, 255, 255);";
  35648. strHtml += "height: 24px;";
  35649. strHtml += "width: 24px;";
  35650. strHtml += "border-radius: 20px;";
  35651. strHtml += "display: flex;";
  35652. strHtml += "justify-content: center;";
  35653. strHtml += "align-items: center;";
  35654. strHtml += "font-size: 14px;";
  35655. strHtml += "margin-right: 18px;";
  35656. strHtml += "'>&#10003</div>";
  35657. strHtml += "<div>" + message + "</div>";
  35658. msgMainDom.innerHTML = strHtml;
  35659. msgMainDom.addEventListener("transitionend", function() {
  35660. setTimeout(function() {
  35661. document.body.removeChild(msgMainDom);
  35662. }, 1e3);
  35663. }, false);
  35664. setTimeout(function() {
  35665. msgMainDom.style.transform = "translateY(50px)";
  35666. }, 100);
  35667. }
  35668. });
  35669. Object.assign(DrawTools.prototype, {
  35670. _createSingleCoordinateAxisArrow(positions, color2, axisEntityId) {
  35671. let _self = this;
  35672. let coordinateAxisEntity = new Cesium.Entity({
  35673. id: axisEntityId,
  35674. name: _self._coordinateAxisEntityName,
  35675. position: positions[0],
  35676. polyline: {
  35677. positions,
  35678. width: 10,
  35679. material: _self._materialPolylineArrowProperty({
  35680. color: color2
  35681. })
  35682. }
  35683. });
  35684. coordinateAxisEntity.setEditType({
  35685. type: DrawTools.EditPointType.CoordinateAxis
  35686. });
  35687. return this._entities.add(coordinateAxisEntity);
  35688. },
  35689. _getTranslatePostion: function(originPosition, translateCartesian) {
  35690. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(originPosition);
  35691. let m = new Cesium.Matrix4();
  35692. Cesium.Matrix4.setTranslation(
  35693. Cesium.Matrix4.IDENTITY,
  35694. translateCartesian,
  35695. m
  35696. );
  35697. let modelMatrix = Cesium.Matrix4.multiply(transform3, m, transform3);
  35698. let outPosition = new Cesium.Cartesian3(0, 0, 0);
  35699. Cesium.Matrix4.getTranslation(modelMatrix, outPosition);
  35700. return outPosition;
  35701. },
  35702. _createCoordinateAxis: function(position2) {
  35703. this._showTooltipMessage("\u5355\u51FB\u53F3\u952E\u79FB\u9664\u8C03\u6574\u8F74\u7EBF\uFF01");
  35704. this._removeCoorinateAxis();
  35705. let _self = this;
  35706. let cameraRight = this._viewer.scene.camera.rightWC;
  35707. this._tx = cameraRight.x > 0 ? 150 : -150;
  35708. this._ty = cameraRight.y > 0 ? 150 : -150;
  35709. this._tz = 150;
  35710. this._coordinateAxisEntityId_x = "coordinateAxisId_x";
  35711. this._coordinateAxisEntityId_y = "coordinateAxisId_y";
  35712. this._coordinateAxisEntityId_z = "coordinateAxisId_z";
  35713. this._coordinateAxisEntityName = "coordinateAxisEntity";
  35714. let translateCartesian = new Cesium.Cartesian3(this._tx, 0, 0);
  35715. let endPosition = this._getTranslatePostion(position2, translateCartesian);
  35716. const xPos = [position2, endPosition];
  35717. this._coordinateEntity_x = this._createSingleCoordinateAxisArrow(xPos, "rgba(0,255,0,1.0)", this._coordinateAxisEntityId_x);
  35718. this._coordinateAxisBindEntity(this._coordinateEntity_x);
  35719. translateCartesian = new Cesium.Cartesian3(0, this._ty, 0);
  35720. endPosition = this._getTranslatePostion(position2, translateCartesian);
  35721. const yPos = [position2, endPosition];
  35722. this._coordinateEntity_y = this._createSingleCoordinateAxisArrow(yPos, "rgba(0,0,255,1.0)", this._coordinateAxisEntityId_y);
  35723. this._coordinateAxisBindEntity(this._coordinateEntity_y);
  35724. translateCartesian = new Cesium.Cartesian3(0, 0, this._tz);
  35725. endPosition = this._getTranslatePostion(position2, translateCartesian);
  35726. const zPos = [position2, endPosition];
  35727. this._coordinateEntity_z = this._createSingleCoordinateAxisArrow(zPos, "rgba(255,0,0,1.0)", this._coordinateAxisEntityId_z);
  35728. this._coordinateAxisBindEntity(this._coordinateEntity_z);
  35729. this._eventCoorinateAxis = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  35730. this._registerLeftDownEvent(this._eventCoorinateAxis, function(event2) {
  35731. _self._coorinateAxisMouseDown(event2);
  35732. });
  35733. this._registerMouseMoveEvent(this._eventCoorinateAxis, function(event2) {
  35734. _self._coorinateAxisMouseMove(event2);
  35735. });
  35736. this._registerLeftUpEvent(this._eventCoorinateAxis, function(event2) {
  35737. _self._coorinateAxisMouseUp(event2);
  35738. });
  35739. this._registerRightClickEvent(this._eventCoorinateAxis, function(event2) {
  35740. _self._removeCoorinateAxis();
  35741. });
  35742. },
  35743. _coordinateAxisBindEntity: function(axisEntity) {
  35744. if (this._editEntity === void 0)
  35745. return;
  35746. let editEntityType = this._editEntity.getEntityType();
  35747. if (editEntityType === void 0)
  35748. return;
  35749. if (editEntityType === DrawTools.DrawType.VideoWall) {
  35750. axisEntity.bindEntity(this._editEntity);
  35751. }
  35752. },
  35753. _coorinateAxisMouseDown: function(event2) {
  35754. let _self = this;
  35755. let feature2 = this._viewer.scene.pick(event2.position);
  35756. if (feature2 === void 0)
  35757. return;
  35758. if (feature2.id != void 0 && feature2.id instanceof Cesium.Entity) {
  35759. this._viewer.scene.screenSpaceCameraController.enableRotate = false;
  35760. if (feature2.id.getEditType() === void 0)
  35761. return;
  35762. let entityType = feature2.id.getEditType().type;
  35763. if (entityType !== DrawTools.EditPointType.CoordinateAxis)
  35764. return;
  35765. this._editCoorinateAxis = feature2.id;
  35766. this._editCoorinateAxis.polyline.width = 15;
  35767. this._coordinateAxisMoveStartPosition = this._viewer.scene.camera.pickEllipsoid(
  35768. event2.position,
  35769. this._viewer.scene.globe.ellipsoid
  35770. );
  35771. this._coordinateAxisMoveStartScreen = event2.position;
  35772. this._coorinateAxisPosition = this._editCoorinateAxis.position._value;
  35773. this._coordinateEntity_x.polyline.positions = new Cesium.CallbackProperty(function() {
  35774. let translateCartesian = new Cesium.Cartesian3(_self._tx, 0, 0);
  35775. let endPosition = _self._getTranslatePostion(
  35776. _self._coorinateAxisPosition,
  35777. translateCartesian
  35778. );
  35779. return [_self._coorinateAxisPosition, endPosition];
  35780. }, false);
  35781. this._coordinateEntity_y.polyline.positions = new Cesium.CallbackProperty(function() {
  35782. let translateCartesian = new Cesium.Cartesian3(0, _self._ty, 0);
  35783. let endPosition = _self._getTranslatePostion(
  35784. _self._coorinateAxisPosition,
  35785. translateCartesian
  35786. );
  35787. return [_self._coorinateAxisPosition, endPosition];
  35788. }, false);
  35789. this._coordinateEntity_z.polyline.positions = new Cesium.CallbackProperty(function() {
  35790. let translateCartesian = new Cesium.Cartesian3(0, 0, _self._tz);
  35791. let endPosition = _self._getTranslatePostion(
  35792. _self._coorinateAxisPosition,
  35793. translateCartesian
  35794. );
  35795. return [_self._coorinateAxisPosition, endPosition];
  35796. }, false);
  35797. this._coordinateAxisActivateEditEntity(this._editCoorinateAxis);
  35798. }
  35799. },
  35800. _coorinateAxisMouseMove: function(event2) {
  35801. if (!Cesium.defined(this._editCoorinateAxis))
  35802. return;
  35803. let position2 = this._viewer.scene.camera.pickEllipsoid(
  35804. event2.endPosition,
  35805. this._viewer.scene.globe.ellipsoid
  35806. );
  35807. if (!position2)
  35808. return;
  35809. let strGeo = this._cartesian3ToGeo(this._coordinateAxisMoveStartPosition);
  35810. let endGeo = this._cartesian3ToGeo(position2);
  35811. let entityId = this._editCoorinateAxis.id;
  35812. let entityPosition = this._editCoorinateAxis.position._value;
  35813. let entityGeo = this._cartesian3ToGeo(entityPosition);
  35814. let heightDifference = 0;
  35815. if (entityId === this._coordinateAxisEntityId_x) {
  35816. let difference = strGeo.longitude - endGeo.longitude;
  35817. entityGeo.longitude = entityGeo.longitude - difference;
  35818. } else if (entityId === this._coordinateAxisEntityId_y) {
  35819. let difference = strGeo.latitude - endGeo.latitude;
  35820. entityGeo.latitude = entityGeo.latitude - difference;
  35821. } else if (entityId === this._coordinateAxisEntityId_z) {
  35822. heightDifference = event2.endPosition.y - this._coordinateAxisMoveStartScreen.y;
  35823. heightDifference = heightDifference * 0.5;
  35824. entityGeo.height = entityGeo.height - heightDifference;
  35825. }
  35826. this._coorinateAxisPosition = Cesium.Cartesian3.fromDegrees(entityGeo.longitude, entityGeo.latitude, entityGeo.height);
  35827. this._moveEditEntityByCoordinateAxis(entityPosition, this._coorinateAxisPosition, heightDifference);
  35828. },
  35829. _coorinateAxisMouseUp: function(event2) {
  35830. this._viewer.scene.screenSpaceCameraController.enableRotate = true;
  35831. if (this._editCoorinateAxis !== void 0) {
  35832. this._editCoorinateAxis.polyline.width = 10;
  35833. let translateCartesian = new Cesium.Cartesian3(this._tx, 0, 0);
  35834. let endPosition = this._getTranslatePostion(this._coorinateAxisPosition, translateCartesian);
  35835. this._coordinateEntity_x.polyline.positions = [this._coorinateAxisPosition, endPosition];
  35836. translateCartesian = new Cesium.Cartesian3(0, this._ty, 0);
  35837. endPosition = this._getTranslatePostion(this._coorinateAxisPosition, translateCartesian);
  35838. this._coordinateEntity_y.polyline.positions = [this._coorinateAxisPosition, endPosition];
  35839. translateCartesian = new Cesium.Cartesian3(0, 0, this._tz);
  35840. endPosition = this._getTranslatePostion(this._coorinateAxisPosition, translateCartesian);
  35841. this._coordinateEntity_z.polyline.positions = [this._coorinateAxisPosition, endPosition];
  35842. this._coordinateEntity_x.position = this._coorinateAxisPosition;
  35843. this._coordinateEntity_y.position = this._coorinateAxisPosition;
  35844. this._coordinateEntity_z.position = this._coorinateAxisPosition;
  35845. this._coordinateAxisUpdateEditEntity(this._editCoorinateAxis);
  35846. this._editCoorinateAxis = void 0;
  35847. }
  35848. },
  35849. _moveEditEntityByCoordinateAxis: function(strPosition, endPosition, heightDifference) {
  35850. let movePosition = Cesium.Cartesian3.subtract(endPosition, strPosition, new Cesium.Cartesian3());
  35851. for (let i2 = 0; i2 < this._moveInitPositions.length; i2++) {
  35852. let moveResult = Cesium.Cartesian3.add(this._moveInitPositions[i2], movePosition, new Cesium.Cartesian3());
  35853. this._moveUpdatePositions[i2] = moveResult.clone();
  35854. }
  35855. for (let i2 = 0; i2 < this._moveInitHeights.length; i2++) {
  35856. this._moveUpdateHeights[i2] = parseFloat(this._moveInitHeights[i2]) + heightDifference * -1;
  35857. }
  35858. },
  35859. _coordinateAxisActivateEditEntity: function(moveAxisEntity) {
  35860. let _self = this;
  35861. let bindEntity = moveAxisEntity.getBindEntity();
  35862. if (bindEntity === void 0)
  35863. return;
  35864. let bindEntityType = bindEntity.getEntityType();
  35865. if (bindEntityType === DrawTools.DrawType.VideoWall) {
  35866. let wall = bindEntity.wall;
  35867. this._moveInitPositions = wall.positions._value;
  35868. this._moveInitHeights = wall.minimumHeights._value;
  35869. this._moveInitHeight = wall.maximumHeights._value[0] - wall.minimumHeights._value[0];
  35870. this._moveUpdatePositions = [];
  35871. for (let i2 = 0; i2 < this._moveInitPositions.length; i2++) {
  35872. this._moveUpdatePositions.push(this._moveInitPositions[i2].clone());
  35873. }
  35874. wall.positions = new Cesium.CallbackProperty(function() {
  35875. return _self._moveUpdatePositions;
  35876. }, false);
  35877. this._moveUpdateHeights = [];
  35878. for (let i2 = 0; i2 < this._moveInitHeights.length; i2++) {
  35879. this._moveUpdateHeights.push(this._moveInitHeights[i2]);
  35880. }
  35881. wall.minimumHeights = new Cesium.CallbackProperty(function() {
  35882. return _self._moveUpdateHeights;
  35883. }, false);
  35884. wall.maximumHeights = new Cesium.CallbackProperty(function() {
  35885. let maxHeights = [];
  35886. for (let i2 = 0; i2 < _self._moveUpdateHeights.length; i2++) {
  35887. maxHeights.push(parseFloat(_self._moveUpdateHeights[i2]) + _self._moveInitHeight);
  35888. }
  35889. return maxHeights;
  35890. }, false);
  35891. }
  35892. },
  35893. _coordinateAxisUpdateEditEntity: function(moveAxisEntity) {
  35894. let bindEntity = moveAxisEntity.getBindEntity();
  35895. if (bindEntity === void 0)
  35896. return;
  35897. let bindEntityType = bindEntity.getEntityType();
  35898. if (bindEntityType === DrawTools.DrawType.VideoWall) {
  35899. let wall = bindEntity.wall;
  35900. wall.positions = this._moveUpdatePositions;
  35901. wall.minimumHeights = this._moveUpdateHeights;
  35902. let maxHeights = [];
  35903. for (let i2 = 0; i2 < this._moveUpdateHeights.length; i2++) {
  35904. maxHeights.push(parseFloat(this._moveUpdateHeights[i2]) + this._moveInitHeight);
  35905. }
  35906. wall.maximumHeights = maxHeights;
  35907. }
  35908. },
  35909. _coordinateCalculateEntityOrientation: function(entity, options2) {
  35910. let position2 = entity.position._value;
  35911. let orientation = entity.orientation === void 0 ? new Cesium.Cartesian3(0, 0, 0) : entity.orientation._value;
  35912. let transform3 = Cesium.Matrix4.fromTranslationQuaternionRotationScale(
  35913. position2,
  35914. orientation,
  35915. new Cesium.Cartesian3(1, 1, 1),
  35916. new Cesium.Matrix4()
  35917. );
  35918. let _rotateX = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(options2.x));
  35919. let _rotateY = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(options2.y));
  35920. let _rotateZ = Cesium.Matrix3.fromRotationX(Cesium.Math.toRadians(options2.z));
  35921. transform3 = Cesium.Matrix4.multiplyByMatrix3(transform3, _rotateX, transform3);
  35922. transform3 = Cesium.Matrix4.multiplyByMatrix3(transform3, _rotateY, transform3);
  35923. transform3 = Cesium.Matrix4.multiplyByMatrix3(transform3, _rotateZ, transform3);
  35924. let m3 = Cesium.Matrix4.getRotation(transform3, new Cesium.Matrix3());
  35925. let resOrientation = new Cesium.Quaternion();
  35926. Cesium.Quaternion.fromRotationMatrix(m3, resOrientation);
  35927. return resOrientation;
  35928. },
  35929. _removeCoorinateAxis: function() {
  35930. if (this._coordinateAxisEntityName !== void 0) {
  35931. this._removeEntityByName(this._coordinateAxisEntityName);
  35932. }
  35933. if (this._eventCoorinateAxis !== void 0) {
  35934. this._clearEvent(this._eventCoorinateAxis);
  35935. this._eventCoorinateAxis = void 0;
  35936. }
  35937. }
  35938. });
  35939. Object.assign(DrawTools.prototype, {
  35940. _setEntityIsEdit(entity) {
  35941. let _self = this;
  35942. entity.setIsEdit(true);
  35943. this._unActivateEdit();
  35944. this._sendShowPropertyDialog(entity);
  35945. let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  35946. this._registerLeftClickEvent(handler, function(event2) {
  35947. _self._unActivateEdit();
  35948. let feature2 = _self._viewer.scene.pick(event2.position);
  35949. if (feature2 !== void 0 && feature2.id instanceof Cesium.Entity) {
  35950. let featureType = feature2.id.getEditType();
  35951. let entityType = feature2.id.getEntityType();
  35952. if (featureType === DrawTools.EditPointType.Node || featureType === DrawTools.EditPointType.Middle || featureType === DrawTools.EditPointType.Center || featureType === DrawTools.EditPointType.CoordinateAxis || featureType === DrawTools.EditPointType.OdlineStrartNode || featureType === DrawTools.EditPointType.OdlineEndNode || entityType === DrawTools.DrawType.Polyline || entityType === DrawTools.DrawType.ArrowPolyline || entityType === DrawTools.DrawType.DynamicPolyline || entityType === DrawTools.DrawType.GrowPolyline || entityType === DrawTools.DrawType.OutlinePolyline || entityType === DrawTools.DrawType.OdLine || entityType === DrawTools.DrawType.Polygon || entityType === DrawTools.DrawType.SpatialLine || entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle || entityType === DrawTools.DrawType.Rectangle || entityType === DrawTools.DrawType.NormalWall || entityType === DrawTools.DrawType.DynamicWall || entityType === DrawTools.DrawType.House || entityType === DrawTools.DrawType.TextWall || entityType === DrawTools.DrawType.VideoWall) {
  35953. _self._sendShowPropertyDialog(feature2.id);
  35954. }
  35955. }
  35956. });
  35957. },
  35958. _sendShowPropertyDialog(entity) {
  35959. let _self = this;
  35960. let editEntityType = entity.getEntityType();
  35961. if (entity.getIsEdit() === void 0 || entity.getIsEdit() === false || editEntityType === void 0) {
  35962. this._unActivateEdit();
  35963. return;
  35964. }
  35965. let editProperty = entity.getParams();
  35966. if (editEntityType === DrawTools.DrawType.OdLine) {
  35967. editProperty = entity.parent.getParams();
  35968. }
  35969. this._console("\u9009\u62E9\u5B9E\u4F53\u7684\u5C5E\u6027", editProperty);
  35970. if (editProperty !== void 0 && this.onEditProperty !== void 0) {
  35971. this._openPropertyEditDialog(editProperty, function(params) {
  35972. _self.updateEditEntityProperty(params);
  35973. }, function() {
  35974. _self._removeEditEntity();
  35975. });
  35976. }
  35977. this._activateEdit(entity);
  35978. },
  35979. _removeEditEntity() {
  35980. if (this._editEntity !== void 0) {
  35981. this._console("\u79FB\u9664\u5B9E\u4F53", this._editEntity);
  35982. let entityType = this._editEntity.getEntityType();
  35983. if (entityType === DrawTools.DrawType.OdLine) {
  35984. let fatherEntityId = this._editEntity.parent.id;
  35985. let removeEntitys = [];
  35986. for (let entity of this._entities.values) {
  35987. if (entity.parent !== void 0 && entity.parent.id === fatherEntityId) {
  35988. removeEntitys.push(entity);
  35989. }
  35990. }
  35991. for (let removeEntity of removeEntitys) {
  35992. this._removeEntityByObject(removeEntity);
  35993. }
  35994. } else {
  35995. this._removeEntityByObject(this._editEntity);
  35996. }
  35997. this._unActivateEdit();
  35998. this._editEntity = void 0;
  35999. }
  36000. },
  36001. updateEditEntityProperty: function(params) {
  36002. if (this._editEntity === void 0)
  36003. return;
  36004. if (this._editEntity.getIsEdit() === void 0 || this._editEntity.getIsEdit() === false)
  36005. return;
  36006. let editEntityType = this._editEntity.getEntityType();
  36007. if (editEntityType === void 0)
  36008. return;
  36009. if (editEntityType === DrawTools.DrawType.NormalWall || editEntityType === DrawTools.DrawType.DynamicWall || editEntityType === DrawTools.DrawType.TextWall) {
  36010. this._updateWallProperty(params);
  36011. } else if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36012. this._updateCircleProperty(params);
  36013. } else if (editEntityType === DrawTools.DrawType.House) {
  36014. this._updateHouseProperty(params);
  36015. } else if (editEntityType === DrawTools.DrawType.VideoWall) {
  36016. this._updateVideoWallProperty(params);
  36017. } else if (editEntityType === DrawTools.DrawType.Polyline) {
  36018. this._updatePolylineProperty(params);
  36019. } else if (editEntityType === DrawTools.DrawType.Polygon) {
  36020. this._updatePolygonProperty(params);
  36021. } else if (editEntityType === DrawTools.DrawType.Rectangle) {
  36022. this._updateRectangleProperty(params);
  36023. } else if (editEntityType === DrawTools.DrawType.SpatialLine) {
  36024. this._updateSpatialPolylineProperty(params);
  36025. } else if (editEntityType === DrawTools.DrawType.OdLine) {
  36026. this._updateOdlineProperty(params);
  36027. }
  36028. },
  36029. _updateOdlineProperty(params) {
  36030. let _self = this;
  36031. let fatherEntity = this._editEntity.parent;
  36032. this._editOdlineEntities = [];
  36033. for (let entity of this._entities.values) {
  36034. if (entity.parent !== void 0 && entity.parent.id === fatherEntity.id) {
  36035. this._editOdlineEntities.push(entity);
  36036. }
  36037. }
  36038. let meterialImage = this._image_arrow_reverse;
  36039. if (params.order === this._param.order_add) {
  36040. meterialImage = this._image_arrow_reverse;
  36041. } else if (params.order === this._param.order_minus) {
  36042. meterialImage = this._image_arrow_forward;
  36043. }
  36044. let odLineMaterial = new WallMaterialProperty({
  36045. viewer: _self._viewer,
  36046. trailImage: meterialImage,
  36047. duration: params.duration,
  36048. color: Cesium.Color.fromCssColorString(params.color),
  36049. param: {
  36050. direction: params.direction,
  36051. count: params.count,
  36052. order: params.order
  36053. }
  36054. });
  36055. for (let entity of this._editOdlineEntities) {
  36056. entity.polyline.material = odLineMaterial;
  36057. let positions = entity.polyline.positions._value;
  36058. let strPoint = positions.first();
  36059. let endPoint = positions.last();
  36060. let newPositios = this._calculateOdlinePositios(
  36061. strPoint,
  36062. endPoint,
  36063. parseInt(params.odlineHeight),
  36064. parseInt(params.odlineCount)
  36065. );
  36066. entity.polyline.positions = newPositios;
  36067. entity.polyline.width = parseInt(params.lineWidth);
  36068. }
  36069. fatherEntity.setParams(params);
  36070. },
  36071. _updateSpatialPolylineProperty(params) {
  36072. let material = this._editEntity.polyline.material;
  36073. let newMaterial = void 0;
  36074. if (material instanceof Cesium.ColorMaterialProperty) {
  36075. newMaterial = this._materialColorProperty({
  36076. color: params.color
  36077. });
  36078. }
  36079. if (newMaterial !== void 0)
  36080. this._editEntity.polyline.material = newMaterial;
  36081. this._editEntity.polyline.width = parseFloat(params.lineWidth);
  36082. this._editEntity.setParams(params);
  36083. },
  36084. _updateRectangleProperty(params) {
  36085. let material = this._editEntity.rectangle.material;
  36086. if (material instanceof Cesium.ColorMaterialProperty) {
  36087. let newMaterial = this._materialColorProperty({
  36088. color: params.color
  36089. });
  36090. this._editEntity.rectangle.material = newMaterial;
  36091. }
  36092. if (this._editEntity.polyline !== void 0) {
  36093. let newMaterial = this._materialColorProperty({
  36094. color: params.outlineColor
  36095. });
  36096. this._editEntity.polyline.material = newMaterial;
  36097. this._editEntity.polyline.width = parseFloat(params.outlineWidth);
  36098. }
  36099. this._editEntity.setParams(params);
  36100. },
  36101. _updatePolygonProperty(params) {
  36102. let material = this._editEntity.polygon.material;
  36103. if (material instanceof Cesium.ColorMaterialProperty) {
  36104. let newMaterial = this._materialColorProperty({
  36105. color: params.color
  36106. });
  36107. this._editEntity.polygon.material = newMaterial;
  36108. }
  36109. if (this._editEntity.polyline !== void 0) {
  36110. let newMaterial = this._materialColorProperty({
  36111. color: params.outlineColor
  36112. });
  36113. this._editEntity.polyline.material = newMaterial;
  36114. this._editEntity.polyline.width = parseFloat(params.outlineWidth);
  36115. }
  36116. this._editEntity.setParams(params);
  36117. },
  36118. _updatePolylineProperty(params) {
  36119. let material = this._editEntity.polyline.material;
  36120. let newMaterial = void 0;
  36121. if (material instanceof Cesium.ColorMaterialProperty) {
  36122. newMaterial = this._materialColorProperty({
  36123. color: params.color
  36124. });
  36125. } else if (material instanceof Cesium.PolylineArrowMaterialProperty) {
  36126. newMaterial = this._materialPolylineArrowProperty({
  36127. color: params.color
  36128. });
  36129. } else if (material instanceof WallMaterialProperty) {
  36130. let materialImage = this._image_h_l_r;
  36131. if (params.order === this._param.order_minus) {
  36132. materialImage = this._image_h_r_l;
  36133. } else if (params.order === this._param.order_add) {
  36134. materialImage = this._image_h_l_r;
  36135. }
  36136. newMaterial = new WallMaterialProperty({
  36137. viewer: this._viewer,
  36138. trailImage: materialImage,
  36139. duration: params.duration,
  36140. color: Cesium.Color.fromCssColorString(params.color),
  36141. param: {
  36142. count: parseInt(params.count),
  36143. direction: params.direction,
  36144. order: params.order
  36145. }
  36146. });
  36147. } else if (material instanceof Cesium.PolylineGlowMaterialProperty) {
  36148. newMaterial = this._materialPolylineGlowProperty({
  36149. color: params.color,
  36150. power: parseFloat(params.power)
  36151. });
  36152. } else if (material instanceof Cesium.PolylineOutlineMaterialProperty) {
  36153. newMaterial = this._materialPolylineOutlineProperty({
  36154. color: params.color,
  36155. outlineWidth: parseFloat(params.outlineWidth),
  36156. outlineColor: params.outlineColor
  36157. });
  36158. }
  36159. if (newMaterial !== void 0)
  36160. this._editEntity.polyline.material = newMaterial;
  36161. this._editEntity.polyline.width = params.lineWidth;
  36162. this._editEntity.setParams(params);
  36163. },
  36164. _updateHouseProperty(params) {
  36165. let entityParams = this._editEntity.getParams();
  36166. let polygonMaterial = this._editEntity.polygon.material;
  36167. if (polygonMaterial instanceof Cesium.ColorMaterialProperty) {
  36168. let material = this._materialColorProperty({
  36169. color: params.color
  36170. });
  36171. this._editEntity.polygon.material = material;
  36172. this._editEntity.polygon.extrudedHeight = parseFloat(params.height) + parseFloat(
  36173. entityParams.bottomHeight
  36174. );
  36175. this._editEntity.setParams(params);
  36176. }
  36177. },
  36178. _updateCircleProperty(params) {
  36179. let circleMaterial = this._editEntity.ellipse.material;
  36180. if (circleMaterial instanceof CircleMaterialProperty) {
  36181. let material = new CircleMaterialProperty({
  36182. viewer: this._viewer,
  36183. duration: params.duration,
  36184. color: Cesium.Color.fromCssColorString(params.color),
  36185. count: parseFloat(params.count)
  36186. });
  36187. this._editEntity.ellipse.material = material;
  36188. } else if (circleMaterial instanceof Cesium.ColorMaterialProperty) {
  36189. let material = this._materialColorProperty({
  36190. color: params.color
  36191. });
  36192. this._editEntity.ellipse.material = material;
  36193. if (this._editEntity.polyline !== void 0) {
  36194. let newMaterial = this._materialColorProperty({
  36195. color: params.outlineColor
  36196. });
  36197. this._editEntity.polyline.material = newMaterial;
  36198. this._editEntity.polyline.width = parseFloat(params.outlineWidth);
  36199. }
  36200. }
  36201. this._editEntity.setParams(params);
  36202. },
  36203. _updateVideoWallProperty(params) {
  36204. let videoElement = document.getElementById("wallVideo");
  36205. if (videoElement !== null) {
  36206. document.body.removeChild(videoElement);
  36207. }
  36208. videoElement = document.createElement("video");
  36209. videoElement.id = "wallVideo";
  36210. videoElement.setAttribute("crossorigin", "anonymous");
  36211. videoElement.setAttribute("width", "1024px");
  36212. videoElement.setAttribute("height", "256px");
  36213. videoElement.setAttribute("controls", "controls");
  36214. videoElement.setAttribute("src", params.videoUrl);
  36215. videoElement.setAttribute("loop", "loop");
  36216. videoElement.play();
  36217. document.body.appendChild(videoElement);
  36218. let minimumHeights = this._editEntity.wall.minimumHeights._value;
  36219. let maximumHeights = [];
  36220. for (let i2 = 0; i2 < minimumHeights.length; i2++) {
  36221. maximumHeights.push(minimumHeights[i2] + parseFloat(params.height));
  36222. }
  36223. this._editEntity.wall.maximumHeights = maximumHeights;
  36224. this._editEntity.wall.material = videoElement;
  36225. let wallPositions = this._editEntity.wall.positions._value;
  36226. let newPositions = [];
  36227. for (let wallPosition of wallPositions) {
  36228. let transform3 = Cesium.Transforms.eastNorthUpToFixedFrame(wallPosition);
  36229. let m = new Cesium.Matrix4();
  36230. Cesium.Matrix4.setTranslation(Cesium.Matrix4.IDENTITY, new Cesium.Cartesian3(
  36231. parseFloat(params.axisX),
  36232. parseFloat(params.axisY),
  36233. parseFloat(params.axisZ)
  36234. ), m);
  36235. let moveMatrix = Cesium.Matrix4.multiply(transform3, m, transform3);
  36236. let newPosition = new Cesium.Cartesian3();
  36237. Cesium.Matrix4.getTranslation(moveMatrix, newPosition);
  36238. newPositions.push(newPosition);
  36239. }
  36240. this._editEntity.wall.positions = newPositions;
  36241. params.axisX = params.axisY = params.axisZ = 0;
  36242. this._editEntity.setParams(params);
  36243. this._activateEdit(this._editEntity);
  36244. },
  36245. _updateWallProperty(params) {
  36246. let minHeights = this._editEntity.wall.minimumHeights._value;
  36247. let maxHeights = [];
  36248. for (let i2 = 0; i2 < minHeights.length; i2++) {
  36249. maxHeights.push(minHeights[i2] + parseFloat(params.height));
  36250. }
  36251. this._editEntity.wall.maximumHeights = maxHeights;
  36252. this._sketchWallMaxHeights = maxHeights;
  36253. let wallMaterial = this._editEntity.wall.material;
  36254. if (wallMaterial instanceof Cesium.ImageMaterialProperty) {
  36255. let material = this._materialTextImageProperty({
  36256. color: params.color,
  36257. text: params.text
  36258. });
  36259. this._editEntity.wall.material = material;
  36260. } else if (wallMaterial instanceof WallMaterialProperty) {
  36261. let materialImage = this._image_h_l_r;
  36262. if (params.direction === this._param.direction_h && params.order === this._param.order_add) {
  36263. materialImage = this._image_h_l_r;
  36264. } else if (params.direction === this._param.direction_h && params.order === this._param.order_add) {
  36265. materialImage = this._image_h_r_l;
  36266. } else if (params.direction === this._param.direction_v && params.order === this._param.order_minus) {
  36267. materialImage = this._image_v_t_b;
  36268. } else if (params.direction === this._param.direction_v && params.order === this._param.order_add) {
  36269. materialImage = this._image_v_b_t;
  36270. }
  36271. let material = new WallMaterialProperty({
  36272. viewer: this._viewer,
  36273. trailImage: materialImage,
  36274. duration: params.duration,
  36275. color: Cesium.Color.fromCssColorString(params.color),
  36276. param: {
  36277. count: parseFloat(params.count),
  36278. direction: params.direction,
  36279. order: params.order
  36280. }
  36281. });
  36282. this._editEntity.wall.material = material;
  36283. } else if (wallMaterial instanceof Cesium.ColorMaterialProperty) {
  36284. let material = this._materialColorProperty({
  36285. color: params.color
  36286. });
  36287. this._editEntity.wall.material = material;
  36288. }
  36289. this._editEntity.setParams(params);
  36290. },
  36291. rotationEntity(options2) {
  36292. if (this._editEntity === void 0)
  36293. return;
  36294. this._coordinateCalculateEntityOrientation(this._editEntity, options2);
  36295. },
  36296. _getEntityEditData: function(entity) {
  36297. if (entity instanceof Cesium.Entity) {
  36298. let editEntityType = entity.getEntityType();
  36299. if (editEntityType === DrawTools.DrawType.Polyline || editEntityType === DrawTools.DrawType.SpatialLine) {
  36300. return entity.polyline.positions._value;
  36301. } else if (editEntityType === DrawTools.DrawType.Polygon || editEntityType === DrawTools.DrawType.House) {
  36302. let positions = entity.polygon.hierarchy._value.positions;
  36303. if (positions[0].x !== positions[positions.length - 1].x) {
  36304. positions.push(positions[0].clone());
  36305. }
  36306. return positions;
  36307. } else if (editEntityType === DrawTools.DrawType.Rectangle) {
  36308. let rect = entity.rectangle.coordinates._value;
  36309. let gNw = Cesium.Rectangle.northwest(rect);
  36310. if (gNw.height <= 0) {
  36311. let height2 = this._queryHeightFromGeo(Cesium.Math.toDegrees(gNw.longitude), Cesium.Math.toDegrees(gNw.latitude));
  36312. gNw.height = height2;
  36313. }
  36314. let cNw = Cesium.Cartesian3.fromRadians(gNw.longitude, gNw.latitude, gNw.height);
  36315. let gSe = Cesium.Rectangle.southeast(rect);
  36316. if (gSe.height <= 0) {
  36317. let height2 = this._queryHeightFromGeo(Cesium.Math.toDegrees(gSe.longitude), Cesium.Math.toDegrees(gSe.latitude));
  36318. gSe.height = height2;
  36319. }
  36320. let cSe = Cesium.Cartesian3.fromRadians(gSe.longitude, gSe.latitude, gSe.height);
  36321. return [cNw, cSe];
  36322. } else if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36323. let centerPosition = entity.position._value;
  36324. let radius = entity.ellipse.semiMajorAxis._value;
  36325. let cbPoint = this._calculateCircleBoundaryPoint(centerPosition, radius);
  36326. return [centerPosition, cbPoint];
  36327. } else if (editEntityType === DrawTools.DrawType.NormalWall || editEntityType === DrawTools.DrawType.DynamicWall || editEntityType === DrawTools.DrawType.TextWall) {
  36328. this._sketchWallHeights = [];
  36329. this._sketchWallMaxHeights = [];
  36330. let minHeights = entity.wall.minimumHeights._value;
  36331. let maxHeights = entity.wall.maximumHeights._value;
  36332. for (let i2 = 0; i2 < minHeights.length; i2++) {
  36333. this._sketchWallHeights.push(minHeights[i2]);
  36334. this._sketchWallMaxHeights.push(maxHeights[i2]);
  36335. }
  36336. return entity.wall.positions._value;
  36337. } else if (editEntityType === DrawTools.DrawType.VideoWall) {
  36338. let positions = entity.wall.positions._value;
  36339. return [positions[0].clone()];
  36340. } else {
  36341. return [];
  36342. }
  36343. } else {
  36344. return [];
  36345. }
  36346. },
  36347. _calculateCircleBoundaryPoint: function(centerPosition, radius) {
  36348. let gCenter = Cesium.Ellipsoid.WGS84.cartesianToCartographic(centerPosition);
  36349. let cPoint = point([Cesium.Math.toDegrees(gCenter.longitude), Cesium.Math.toDegrees(
  36350. gCenter.latitude
  36351. )]);
  36352. let boundaryPoint = destination(cPoint, radius / 1e3, 90, {
  36353. units: "kilometers"
  36354. }).geometry.coordinates;
  36355. let height2 = this._queryHeightFromGeo(boundaryPoint[0], boundaryPoint[1]);
  36356. let cbPoint = Cesium.Cartesian3.fromDegrees(boundaryPoint[0], boundaryPoint[1], height2);
  36357. return cbPoint;
  36358. },
  36359. _calculateCenterPosition: function(positions) {
  36360. if (positions === void 0 || positions.length === 0)
  36361. return void 0;
  36362. else if (positions.length === 1) {
  36363. return positions[0];
  36364. } else if (positions.length === 2) {
  36365. let pt0 = this._cartesian3ToGeo(positions[0]);
  36366. let pt1 = this._cartesian3ToGeo(positions[1]);
  36367. let point0 = point([pt0.longitude, pt0.latitude]);
  36368. let point1 = point([pt1.longitude, pt1.latitude]);
  36369. let center2 = midpoint(point0, point1).geometry.coordinates;
  36370. let height2 = this._queryHeightFromGeo(center2[0], center2[1]);
  36371. return Cesium.Cartesian3.fromDegrees(center2[0], center2[1], height2);
  36372. } else {
  36373. let geoPoints = [
  36374. []
  36375. ];
  36376. for (let i2 = 0; i2 < positions.length; i2++) {
  36377. let geoPoint = this._cartesian3ToGeo(positions[i2]);
  36378. geoPoints[0].push([geoPoint.longitude, geoPoint.latitude]);
  36379. }
  36380. geoPoints[0].push(geoPoints[0][0]);
  36381. let polygon$1 = polygon(geoPoints);
  36382. let center2 = centerOfMass(polygon$1).geometry.coordinates;
  36383. let height2 = this._queryHeightFromGeo(center2[0], center2[1]);
  36384. return Cesium.Cartesian3.fromDegrees(center2[0], center2[1], height2);
  36385. }
  36386. },
  36387. _calculateTransformPosition: function(position2, distance2, bearing2, options2) {
  36388. let geoPoint = this._cartesian3ToGeo(position2);
  36389. let point$1 = point([geoPoint.longitude, geoPoint.latitude]);
  36390. let resPoint = destination(point$1, distance2, bearing2, options2).geometry.coordinates;
  36391. let height2 = geoPoint.height;
  36392. if (options2 !== void 0 && options2.calculateHeight !== void 0 && options2.calculateHeight === true) {
  36393. height2 = this._queryHeightFromGeo(resPoint[0], resPoint[1]);
  36394. }
  36395. let cPosition = Cesium.Cartesian3.fromDegrees(
  36396. resPoint[0],
  36397. resPoint[1],
  36398. height2
  36399. );
  36400. return cPosition;
  36401. },
  36402. _unActivateEdit: function() {
  36403. this._clearEditPoint();
  36404. this._removeCoorinateAxis();
  36405. this._closePropertyEditDialog();
  36406. },
  36407. _activateEdit: function(editEntity) {
  36408. let entityType = editEntity.getEntityType();
  36409. let entityIsEdit = editEntity.getIsEdit();
  36410. if (entityIsEdit === void 0 || entityType === void 0 || entityIsEdit === false) {
  36411. this._console("\u8BE5\u5B9E\u4F53\u4E0D\u53EF\u7F16\u8F91");
  36412. return;
  36413. }
  36414. if (entityType === DrawTools.DrawType.OdLine) {
  36415. this._activeteOdlineEdit(editEntity);
  36416. } else {
  36417. this._activeteNormalEdit(editEntity);
  36418. }
  36419. },
  36420. _activeteOdlineEdit: function(editEntity) {
  36421. let _self = this;
  36422. let entityType = editEntity.getEntityType();
  36423. if (entityType === void 0 || entityType !== DrawTools.DrawType.OdLine) {
  36424. this._console("\u8BE5\u5B9E\u4F53\u4E0D\u53EF\u7F16\u8F91\u6216\u8BE5\u5B9E\u4F53\u4E0D\u662FOD\u7EBF\u7C7B\u578B");
  36425. return;
  36426. }
  36427. let faterEntityId = editEntity.parent.id;
  36428. this._editOdlineEntities = [];
  36429. for (let entity of this._entities.values) {
  36430. if (entity.parent !== void 0 && entity.parent.id === faterEntityId) {
  36431. this._editOdlineEntities.push(entity);
  36432. }
  36433. }
  36434. if (this._editOdlineEntities.length === 0)
  36435. return;
  36436. this._editEntity = this._editOdlineEntities[0];
  36437. for (let i2 = 0; i2 < this._editOdlineEntities.length; i2++) {
  36438. let entity = this._editOdlineEntities[i2];
  36439. let positions = entity.polyline.positions._value;
  36440. if (i2 === 0) {
  36441. this._createEditOdlineStartPoint(positions.first(), entity);
  36442. this._createEditOdlineEndPoint(positions.last(), entity);
  36443. } else {
  36444. this._createEditOdlineEndPoint(positions.last(), entity);
  36445. }
  36446. }
  36447. if (this._sketchEditHandler === void 0) {
  36448. this._sketchEditHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  36449. }
  36450. this._registerLeftDownEvent(this._sketchEditHandler, function(event2) {
  36451. _self._eventEditMouseDown(event2);
  36452. });
  36453. this._registerMouseMoveEvent(this._sketchEditHandler, function(event2) {
  36454. _self._eventEditMouseMove(event2);
  36455. });
  36456. this._registerLeftUpEvent(this._sketchEditHandler, function(event2) {
  36457. _self._eventEditMouseUp(event2);
  36458. });
  36459. },
  36460. _activeteNormalEdit: function(editEntity) {
  36461. let _self = this;
  36462. let positions = this._getEntityEditData(editEntity);
  36463. this._removePointEntitys();
  36464. let entityType = editEntity.getEntityType();
  36465. this._editEntity = editEntity;
  36466. if (entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle) {
  36467. this._createEditCenterPoint(positions[0]);
  36468. this._createEditNodePoint(positions, 1);
  36469. } else if (entityType === DrawTools.DrawType.VideoWall) {
  36470. if (!this._isRuntimeApp()) {
  36471. let position2 = positions[0];
  36472. this._removeCoorinateAxis();
  36473. this._createCoordinateAxis(position2);
  36474. }
  36475. } else {
  36476. this._createEditNodePoint(positions);
  36477. let centerPosition = this._calculateCenterPosition(positions);
  36478. if (centerPosition !== void 0) {
  36479. this._createEditCenterPoint(centerPosition);
  36480. }
  36481. }
  36482. if (entityType !== DrawTools.DrawType.Rectangle && entityType !== DrawTools.DrawType.Circle && entityType !== DrawTools.DrawType.DynamicCircle && entityType !== DrawTools.DrawType.VideoWall) {
  36483. if (entityType === DrawTools.DrawType.SpatialLine) {
  36484. this._createEditMiddlePoint(positions, true);
  36485. } else {
  36486. this._createEditMiddlePoint(positions);
  36487. }
  36488. }
  36489. if (this._sketchEditHandler === void 0) {
  36490. this._sketchEditHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  36491. }
  36492. this._registerLeftDownEvent(this._sketchEditHandler, function(event2) {
  36493. _self._eventEditMouseDown(event2);
  36494. });
  36495. this._registerMouseMoveEvent(this._sketchEditHandler, function(event2) {
  36496. _self._eventEditMouseMove(event2);
  36497. });
  36498. this._registerLeftUpEvent(this._sketchEditHandler, function(event2) {
  36499. _self._eventEditMouseUp(event2);
  36500. });
  36501. },
  36502. _eventEditMouseDown: function(event2) {
  36503. let _self = this;
  36504. let feature2 = _self._viewer.scene.pick(event2.position);
  36505. if (feature2 != void 0 && feature2.id instanceof Cesium.Entity) {
  36506. let featureType = feature2.id.getEditType();
  36507. if (featureType === void 0)
  36508. return;
  36509. _self._viewer.scene.screenSpaceCameraController.enableRotate = false;
  36510. let entityPosition = feature2.id.position._value;
  36511. _self._editPointEntity = feature2.id;
  36512. _self._setMousePointerStyle();
  36513. if (featureType.type === DrawTools.EditPointType.Node || featureType.type === DrawTools.EditPointType.Middle) {
  36514. _self._entityCallbackPropertyByMouseDown();
  36515. _self._removeEntityByObject(_self._editPointEntity);
  36516. if (_self._sketchEditEntitySpatialName != void 0) {
  36517. _self._removeEntityByName(_self._sketchEditEntitySpatialName);
  36518. }
  36519. } else if (featureType.type === DrawTools.EditPointType.Center) {
  36520. _self._entityCenterMouseDownEvent();
  36521. } else if (featureType.type === DrawTools.EditPointType.OdlineEndNode) {
  36522. _self._removeEntityByObject(_self._editPointEntity);
  36523. _self._editEntity = featureType.joinEntity;
  36524. let params = _self._editEntity.parent.getParams();
  36525. _self._sketchEditPoints = [];
  36526. let joinEntityPositions = _self._editEntity.polyline.positions._value;
  36527. _self._sketchEditPoints.push(joinEntityPositions.first());
  36528. _self._sketchEditPoints.push(joinEntityPositions.last());
  36529. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(function() {
  36530. let positions = _self._calculateOdlinePositios(_self._sketchEditPoints[0], _self._sketchEditPoints[1], parseInt(params.odlineHeight), parseInt(params.odlineCount));
  36531. return positions;
  36532. }, false);
  36533. } else if (featureType.type === DrawTools.EditPointType.OdlineStrartNode) {
  36534. _self._removeEntityByObject(_self._editPointEntity);
  36535. _self._editEntity = featureType.joinEntity;
  36536. let params = _self._editEntity.parent.getParams();
  36537. _self._sketchEditPoints = [];
  36538. let joinEntityPositions = _self._editEntity.polyline.positions._value;
  36539. _self._sketchEditPoints.push(joinEntityPositions.first());
  36540. for (let odEntity of _self._editOdlineEntities) {
  36541. let odEntityPositions = odEntity.polyline.positions._value;
  36542. let lastPosition = odEntityPositions.last();
  36543. _self._sketchEditPoints.push(lastPosition.clone());
  36544. odEntity.polyline.positions = new Cesium.CallbackProperty(function() {
  36545. let positions = _self._calculateOdlinePositios(
  36546. _self._sketchEditPoints[0],
  36547. lastPosition,
  36548. parseInt(params.odlineHeight),
  36549. parseInt(params.odlineCount)
  36550. );
  36551. return positions;
  36552. }, false);
  36553. }
  36554. }
  36555. if (featureType.type === DrawTools.EditPointType.Middle) {
  36556. let index2 = featureType.index;
  36557. _self._sketchEditPoints.splice(index2, 0, entityPosition);
  36558. _self._sketchEditIndex = index2;
  36559. if (_self._sketchWallHeights != void 0 && _self._sketchWallHeights.length > 0) {
  36560. let geoPoint = _self._cartesian3ToGeo(entityPosition);
  36561. let height2 = _self._queryHeightFromGeo(geoPoint.longitude, geoPoint.latitude);
  36562. _self._sketchWallHeights.splice(index2, 0, height2);
  36563. let heightDifference = _self._sketchWallMaxHeights[0] - _self._sketchWallHeights[0];
  36564. _self._sketchWallMaxHeights.splice(index2, 0, height2 + heightDifference);
  36565. }
  36566. _self._tooltipInit("\u62D6\u52A8\u4E2D\u70B9\uFF0C\u6539\u53D8\u5F62\u72B6", event2.position);
  36567. } else if (featureType.type === DrawTools.EditPointType.Node) {
  36568. _self._sketchEditIndex = featureType.index;
  36569. _self._tooltipInit("\u62D6\u52A8\u8282\u70B9\uFF0C\u6539\u53D8\u5F62\u72B6", event2.position);
  36570. } else if (featureType.type === DrawTools.EditPointType.Spatial) {
  36571. _self._sketchEditIndex = featureType.index;
  36572. _self._tooltipInit("\u62D6\u52A8\u8282\u70B9\uFF0C\u6539\u53D8\u9AD8\u5EA6", event2.position);
  36573. } else if (featureType.type === DrawTools.EditPointType.CoordinateAxis) {
  36574. _self._tooltipInit("\u62D6\u52A8\u5750\u6807\u8F74\uFF0C\u6539\u53D8\u4F4D\u7F6E", event2.position);
  36575. } else if (featureType.type === DrawTools.EditPointType.OdlineEndNode || featureType.type === DrawTools.EditPointType.OdlineStrartNode) {
  36576. _self._tooltipInit("\u62D6\u52A8\u8282\u70B9\uFF0C\u6539\u53D8OD\u7EBF\u4F4D\u7F6E", event2.position);
  36577. }
  36578. }
  36579. },
  36580. _eventEditMouseMove: function(event2) {
  36581. let _self = this;
  36582. if (_self._editPointEntity != void 0) {
  36583. let loc2 = _self._transfromFromScreenPoint(event2.endPosition);
  36584. if (!Cesium.defined(loc2.sLocation))
  36585. return;
  36586. _self._editPosition = loc2.sLocation;
  36587. let editEntityType = _self._editPointEntity.getEditType();
  36588. if (editEntityType.type === DrawTools.EditPointType.Node) {
  36589. _self._sketchEditPoints[_self._sketchEditIndex] = loc2.sLocation;
  36590. let editEntityType2 = _self._editEntity.getEntityType();
  36591. if (editEntityType2 != DrawTools.DrawType.Rectangle && editEntityType2 != DrawTools.DrawType.Circle && editEntityType2 != DrawTools.DrawType.DynamicCircle) {
  36592. if ((editEntityType2 === DrawTools.DrawType.Polygon || editEntityType2 === DrawTools.DrawType.House) && _self._sketchEditIndex === 0) {
  36593. _self._sketchEditPoints[_self._sketchEditPoints.length - 1] = loc2.sLocation;
  36594. } else if (editEntityType2 === DrawTools.DrawType.NormalWall || editEntityType2 === DrawTools.DrawType.DynamicWall || editEntityType2 === DrawTools.DrawType.TextWall) {
  36595. _self._sketchWallHeights[_self._sketchEditIndex] = loc2.gLocation.height;
  36596. }
  36597. _self._removeEntityByName(_self._sketchEditEntityMiddleName);
  36598. if (editEntityType2 === DrawTools.DrawType.SpatialLine) {
  36599. _self._createEditMiddlePoint(_self._sketchEditPoints, true);
  36600. } else {
  36601. _self._createEditMiddlePoint(_self._sketchEditPoints);
  36602. }
  36603. }
  36604. } else if (editEntityType.type === DrawTools.EditPointType.Middle) {
  36605. _self._sketchEditPoints[_self._sketchEditIndex] = loc2.sLocation;
  36606. } else if (editEntityType.type === DrawTools.EditPointType.Center) {
  36607. _self._entityCenterMouseMoveEvent(event2);
  36608. } else if (editEntityType.type === DrawTools.EditPointType.Spatial) {
  36609. let ellipsoid = _self._viewer.scene.globe.ellipsoid;
  36610. let cartesian = _self._viewer.camera.pickEllipsoid(
  36611. event2.endPosition,
  36612. ellipsoid
  36613. );
  36614. let bottomPoint = _self._sketchEditPoints[_self._sketchEditIndex];
  36615. let heightDifference = cartesian.z - bottomPoint.z;
  36616. if (heightDifference > 0 && heightDifference < 500) {
  36617. for (let i2 = 0; i2 < _self._sketchWallHeights.length; i2++) {
  36618. _self._sketchWallMaxHeights[i2] = _self._sketchWallHeights[i2] + heightDifference;
  36619. }
  36620. }
  36621. } else if (editEntityType.type === DrawTools.EditPointType.OdlineEndNode) {
  36622. _self._sketchEditPoints[_self._sketchEditPoints.length - 1] = loc2.sLocation;
  36623. } else if (editEntityType.type === DrawTools.EditPointType.OdlineStrartNode) {
  36624. _self._sketchEditPoints[0] = loc2.sLocation;
  36625. }
  36626. _self._tooltipInit("\u62AC\u8D77\u9F20\u6807\uFF0C\u5B8C\u6210\u66F4\u6539", event2.endPosition);
  36627. }
  36628. },
  36629. _eventEditMouseUp: function(event2) {
  36630. let _self = this;
  36631. if (_self._editPointEntity != void 0) {
  36632. _self._viewer.scene.screenSpaceCameraController.enableRotate = true;
  36633. _self._tooltipRemove();
  36634. _self._setMouseDefaultStyle();
  36635. let editEntityPointType = _self._editPointEntity.getEditType().type;
  36636. let entityType = _self._editEntity.getEntityType();
  36637. if (editEntityPointType === DrawTools.EditPointType.CoordinateAxis)
  36638. ;
  36639. else if (editEntityPointType === DrawTools.EditPointType.OdlineEndNode) {
  36640. let params = _self._editEntity.parent.getParams();
  36641. let positions = _self._calculateOdlinePositios(_self._sketchEditPoints[0], _self._sketchEditPoints[1], parseInt(params.odlineHeight), parseInt(params.odlineCount));
  36642. _self._editEntity.polyline.positions = positions;
  36643. _self._createEditOdlineEndPoint(_self._sketchEditPoints[1], _self._editEntity);
  36644. } else if (editEntityPointType === DrawTools.EditPointType.OdlineStrartNode) {
  36645. let params = _self._editEntity.parent.getParams();
  36646. let index2 = 1;
  36647. for (let odEntity of _self._editOdlineEntities) {
  36648. let lastPosition = _self._sketchEditPoints[index2++];
  36649. let positions = _self._calculateOdlinePositios(
  36650. _self._sketchEditPoints[0],
  36651. lastPosition,
  36652. parseInt(params.odlineHeight),
  36653. parseInt(params.odlineCount)
  36654. );
  36655. odEntity.polyline.positions = positions;
  36656. }
  36657. _self._createEditOdlineStartPoint(_self._sketchEditPoints[0], _self._editOdlineEntities[0]);
  36658. } else {
  36659. if (editEntityPointType === DrawTools.EditPointType.Node || editEntityPointType === DrawTools.EditPointType.Middle) {
  36660. _self._entityCallbackPropertyByMouseUp();
  36661. } else if (editEntityPointType === DrawTools.EditPointType.Center) {
  36662. _self._entityCenterMouseUpEvent(event2);
  36663. }
  36664. _self._removeEntityByName(_self._sketchEditEntityNodeName);
  36665. _self._removeEntityByName(_self._sketchEditEntityMiddleName);
  36666. _self._removeEntityByName(_self._sketchEditEntityCenterName);
  36667. if (entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle) {
  36668. let centerPosition = _self._editEntity.position._value;
  36669. let boundaryPosition = _self._calculateCircleBoundaryPoint(
  36670. centerPosition,
  36671. _self._sketchEllipseRadius
  36672. );
  36673. _self._sketchEditPoints[0] = centerPosition;
  36674. _self._sketchEditPoints[1] = boundaryPosition;
  36675. _self._createEditNodePoint(_self._sketchEditPoints, 1);
  36676. _self._createEditCenterPoint(centerPosition);
  36677. } else {
  36678. _self._createEditNodePoint(_self._sketchEditPoints);
  36679. let centerPosition = _self._calculateCenterPosition(_self._sketchEditPoints);
  36680. _self._createEditCenterPoint(centerPosition);
  36681. }
  36682. if (entityType != DrawTools.DrawType.Rectangle && entityType != DrawTools.DrawType.Circle && entityType != DrawTools.DrawType.DynamicCircle) {
  36683. if (entityType === DrawTools.DrawType.SpatialLine) {
  36684. _self._createEditMiddlePoint(_self._sketchEditPoints, true);
  36685. } else {
  36686. _self._createEditMiddlePoint(_self._sketchEditPoints);
  36687. }
  36688. }
  36689. }
  36690. _self._editPointEntity = void 0;
  36691. }
  36692. },
  36693. _entityCenterMouseDownEvent: function() {
  36694. let _self = this;
  36695. let entityPosition = this._editEntity.position._value;
  36696. this._removeEntityByName(this._sketchEditEntityNodeName);
  36697. this._removeEntityByName(this._sketchEditEntityMiddleName);
  36698. this._removeEntityByName(this._sketchEditEntityCenterName);
  36699. this._startPoint = entityPosition;
  36700. this._startMovePoints = [];
  36701. this._movePoint = entityPosition;
  36702. let editEntityType = this._editEntity.getEntityType();
  36703. if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36704. if (this._editEntity.polyline !== void 0) {
  36705. for (let i2 = 0; i2 < this._ellipseOutlineCoordinates.length; i2++) {
  36706. this._startMovePoints.push(this._ellipseOutlineCoordinates[i2]);
  36707. }
  36708. this._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36709. function() {
  36710. return _self._ellipseOutlineCoordinates;
  36711. },
  36712. false
  36713. );
  36714. }
  36715. this._editEntity.position = new Cesium.CallbackProperty(function() {
  36716. return _self._movePoint;
  36717. }, false);
  36718. } else if (editEntityType === DrawTools.DrawType.Polygon || editEntityType === DrawTools.DrawType.House) {
  36719. for (let i2 = 0; i2 < this._sketchEditPoints.length; i2++) {
  36720. this._startMovePoints.push(this._sketchEditPoints[i2]);
  36721. }
  36722. _self._editEntity.polygon.hierarchy = new Cesium.CallbackProperty(function() {
  36723. return {
  36724. positions: _self._sketchEditPoints
  36725. };
  36726. }, false);
  36727. if (_self._editEntity.polyline != void 0) {
  36728. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(function() {
  36729. return _self._sketchEditPoints;
  36730. }, false);
  36731. }
  36732. } else if (editEntityType === DrawTools.DrawType.Polyline || editEntityType === DrawTools.DrawType.SpatialLine) {
  36733. for (let i2 = 0; i2 < this._sketchEditPoints.length; i2++) {
  36734. this._startMovePoints.push(this._sketchEditPoints[i2]);
  36735. }
  36736. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(function() {
  36737. return _self._sketchEditPoints;
  36738. }, false);
  36739. } else if (editEntityType === DrawTools.DrawType.Rectangle) {
  36740. for (let i2 = 0; i2 < this._sketchEditPoints.length; i2++) {
  36741. this._startMovePoints.push(this._sketchEditPoints[i2]);
  36742. }
  36743. _self._editEntity.rectangle.coordinates = new Cesium.CallbackProperty(_self._callUpdateRectangleCoordinates(_self._sketchEditPoints), false);
  36744. if (_self._editEntity.polyline != void 0) {
  36745. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36746. _self._callUpdateRectangleOutlineCoordinates(),
  36747. false
  36748. );
  36749. }
  36750. }
  36751. },
  36752. _entityCenterMouseMoveEvent: function(event2) {
  36753. this._calculatePositionsByCenter(event2.endPosition, false);
  36754. },
  36755. _calculatePositionsByCenter: function(screenPosition, calculateHeight) {
  36756. let strLoc = this._cartesian3ToGeo(this._startPoint);
  36757. let endLoc = this._transfromFromScreenPoint(screenPosition);
  36758. var point1 = point([strLoc.longitude, strLoc.latitude]);
  36759. var point2 = point([endLoc.gLocation.lng, endLoc.gLocation.lat]);
  36760. var bearing$1 = bearing(point1, point2);
  36761. var options2 = {
  36762. units: "kilometers",
  36763. calculateHeight
  36764. };
  36765. var distance$1 = distance(point1, point2, options2);
  36766. let editEntityType = this._editEntity.getEntityType();
  36767. if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36768. for (let i2 = 0; i2 < this._startMovePoints.length; i2++) {
  36769. let position2 = this._calculateTransformPosition(
  36770. this._startMovePoints[i2],
  36771. distance$1,
  36772. bearing$1,
  36773. options2
  36774. );
  36775. this._ellipseOutlineCoordinates[i2] = position2.clone();
  36776. }
  36777. this._movePoint = endLoc.sLocation;
  36778. } else {
  36779. for (let i2 = 0; i2 < this._startMovePoints.length; i2++) {
  36780. let position2 = this._calculateTransformPosition(
  36781. this._startMovePoints[i2],
  36782. distance$1,
  36783. bearing$1,
  36784. options2
  36785. );
  36786. this._sketchEditPoints[i2] = position2.clone();
  36787. }
  36788. }
  36789. },
  36790. _entityCenterMouseUpEvent: function(event2) {
  36791. this._calculatePositionsByCenter(event2.position, true);
  36792. let _self = this;
  36793. let editEntityType = this._editEntity.getEntityType();
  36794. if (editEntityType === DrawTools.DrawType.Circle || editEntityType === DrawTools.DrawType.DynamicCircle) {
  36795. this._editEntity.position = this._movePoint;
  36796. if (this._editEntity.polyline !== void 0) {
  36797. this._editEntity.polyline.positions = this._ellipseOutlineCoordinates;
  36798. }
  36799. } else if (editEntityType === DrawTools.DrawType.Polyline || editEntityType === DrawTools.DrawType.SpatialLine) {
  36800. this._editEntity.polyline.positions = this._sketchEditPoints;
  36801. } else if (editEntityType === DrawTools.DrawType.Polygon || editEntityType === DrawTools.DrawType.House) {
  36802. this._editEntity.polygon.hierarchy = {
  36803. positions: _self._sketchEditPoints
  36804. };
  36805. if (this._editEntity.polyline != void 0) {
  36806. this._editEntity.polyline.positions = this._sketchEditPoints;
  36807. }
  36808. } else if (editEntityType === DrawTools.DrawType.Rectangle) {
  36809. this._editEntity.rectangle.coordinates = Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]);
  36810. if (this._editEntity.polyline != void 0) {
  36811. this._editEntity.polyline.positions = _self._rectangleOutlineCoordinates;
  36812. }
  36813. }
  36814. },
  36815. _entityCallbackPropertyByMouseUp: function() {
  36816. let _self = this;
  36817. let entityType = _self._editEntity.getEntityType();
  36818. if (entityType === DrawTools.DrawType.Polyline) {
  36819. _self._editEntity.polyline.positions = _self._sketchEditPoints;
  36820. } else if (entityType === DrawTools.DrawType.Polygon || entityType === DrawTools.DrawType.House) {
  36821. _self._editEntity.polygon.hierarchy = {
  36822. positions: _self._sketchEditPoints
  36823. };
  36824. if (_self._editEntity.polyline != void 0) {
  36825. let polygonPositions = _self._editEntity.polygon.hierarchy._value.positions;
  36826. let linePositions = [];
  36827. for (let i2 = 0; i2 < polygonPositions.length; i2++) {
  36828. linePositions.push(polygonPositions[i2].clone());
  36829. }
  36830. if (linePositions[0].x !== linePositions[linePositions.length - 1].x) {
  36831. linePositions.push(linePositions[0].clone());
  36832. }
  36833. _self._editEntity.polyline.positions = linePositions;
  36834. }
  36835. } else if (entityType === DrawTools.DrawType.Rectangle) {
  36836. _self._editEntity.rectangle.coordinates = Cesium.Rectangle.fromDegrees(_self._rectangleCoordinates[0], _self._rectangleCoordinates[1], _self._rectangleCoordinates[2], _self._rectangleCoordinates[3]);
  36837. if (_self._editEntity.polyline != void 0) {
  36838. _self._editEntity.polyline.positions = _self._rectangleOutlineCoordinates;
  36839. }
  36840. } else if (entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle) {
  36841. _self._editEntity.ellipse.semiMajorAxis = _self._sketchEllipseRadius;
  36842. _self._editEntity.ellipse.semiMinorAxis = _self._sketchEllipseRadius;
  36843. if (_self._editEntity.polyline != void 0) {
  36844. _self._editEntity.polyline.positions = _self._ellipseOutlineCoordinates;
  36845. }
  36846. } else if (entityType === DrawTools.DrawType.NormalWall || entityType === DrawTools.DrawType.DynamicWall || entityType === DrawTools.DrawType.TextWall) {
  36847. _self._editEntity.wall.positions = _self._sketchEditPoints;
  36848. _self._editEntity.wall.minimumHeights = _self._sketchWallHeights;
  36849. _self._editEntity.wall.maximumHeights = _self._sketchWallMaxHeights;
  36850. }
  36851. },
  36852. _entityCallbackPropertyByMouseDown: function() {
  36853. let _self = this;
  36854. let entityType = _self._editEntity.getEntityType();
  36855. if (entityType === DrawTools.DrawType.Polyline || entityType === DrawTools.DrawType.SpatialLine) {
  36856. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36857. function() {
  36858. return _self._sketchEditPoints;
  36859. },
  36860. false
  36861. );
  36862. } else if (entityType === DrawTools.DrawType.Polygon || entityType === DrawTools.DrawType.House) {
  36863. _self._editEntity.polygon.hierarchy = new Cesium.CallbackProperty(
  36864. function() {
  36865. return {
  36866. positions: _self._sketchEditPoints
  36867. };
  36868. },
  36869. false
  36870. );
  36871. if (_self._editEntity.polyline != void 0) {
  36872. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36873. function() {
  36874. let polygonPositions = _self._sketchEditPoints;
  36875. let linePositions = [];
  36876. for (let i2 = 0; i2 < polygonPositions.length; i2++) {
  36877. linePositions.push(polygonPositions[i2].clone());
  36878. }
  36879. if (linePositions[0].x !== linePositions[linePositions.length - 1].x) {
  36880. linePositions.push(linePositions[0].clone());
  36881. }
  36882. return linePositions;
  36883. },
  36884. false
  36885. );
  36886. }
  36887. } else if (entityType === DrawTools.DrawType.Rectangle) {
  36888. _self._editEntity.rectangle.coordinates = new Cesium.CallbackProperty(
  36889. _self._callUpdateRectangleCoordinates(_self._sketchEditPoints),
  36890. false
  36891. );
  36892. if (_self._editEntity.polyline != void 0) {
  36893. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36894. _self._callUpdateRectangleOutlineCoordinates(),
  36895. false
  36896. );
  36897. }
  36898. } else if (entityType === DrawTools.DrawType.Circle || entityType === DrawTools.DrawType.DynamicCircle) {
  36899. if (_self._editPointEntity.getEditType().index === 1) {
  36900. _self._editEntity.ellipse.semiMajorAxis = new Cesium.CallbackProperty(
  36901. _self._callUpdateEllipseMinorAxis(_self._sketchEditPoints),
  36902. false
  36903. );
  36904. _self._editEntity.ellipse.semiMinorAxis = new Cesium.CallbackProperty(
  36905. _self._callUpdateEllipseMinorAxis(_self._sketchEditPoints),
  36906. false
  36907. );
  36908. }
  36909. if (_self._editEntity.polyline != void 0) {
  36910. _self._editEntity.polyline.positions = new Cesium.CallbackProperty(
  36911. _self._callEllipseOutlineCoordinate(_self._sketchEditPoints),
  36912. false
  36913. );
  36914. }
  36915. } else if (entityType === DrawTools.DrawType.NormalWall || entityType === DrawTools.DrawType.DynamicWall || entityType === DrawTools.DrawType.TextWall) {
  36916. _self._editEntity.wall.positions = new Cesium.CallbackProperty(function() {
  36917. return _self._sketchEditPoints;
  36918. }, false);
  36919. _self._editEntity.wall.minimumHeights = new Cesium.CallbackProperty(function() {
  36920. return _self._sketchWallHeights;
  36921. }, false);
  36922. _self._editEntity.wall.maximumHeights = new Cesium.CallbackProperty(function() {
  36923. return _self._sketchWallMaxHeights;
  36924. }, false);
  36925. }
  36926. },
  36927. _createEditPointEntity(options2) {
  36928. let _self = this;
  36929. if (options2 === void 0 || options2.position === void 0)
  36930. return;
  36931. if (options2 === void 0 || options2.editType === void 0)
  36932. return;
  36933. let color2 = options2.color != void 0 ? options2.color : [255, 0, 0, 1];
  36934. let size = options2.size != void 0 && typeof options2.size === "number" ? options2.size : 9;
  36935. let outlineWidth = options2.outlineWidth != void 0 && typeof options2.outlineWidth === "number" ? options2.outlineWidth : 1;
  36936. let outlineColor = options2.outlineColor != void 0 ? options2.outlineColor : [255, 255, 255, 1];
  36937. let pointEntity = new Cesium.Entity({
  36938. name: options2.name != void 0 ? options2.name : _self._sketchEntityName,
  36939. position: options2.position,
  36940. point: {
  36941. show: true,
  36942. pixelSize: size,
  36943. heightReference: Cesium.HeightReference.NONE,
  36944. color: _self._toColorFromArray(color2),
  36945. outlineWidth,
  36946. outlineColor: _self._toColorFromArray(outlineColor),
  36947. disableDepthTestDistance: 15e11
  36948. }
  36949. });
  36950. pointEntity.setEditType(options2.editType);
  36951. _self._entities.add(pointEntity);
  36952. },
  36953. _createEditNodePoint(positions, startIndex) {
  36954. this._sketchEditEntityNodeName = "SketchEditEntityNode";
  36955. let _self = this;
  36956. this._sketchEditPoints = [];
  36957. let strIndex = startIndex === void 0 ? 0 : startIndex;
  36958. for (let i2 = 0; i2 < positions.length; i2++) {
  36959. let position2 = positions[i2];
  36960. this._sketchEditPoints.push(position2.clone());
  36961. if (i2 < strIndex)
  36962. continue;
  36963. if (i2 !== 0 && position2.x === positions[0].x && position2.y === positions[0].y && position2.z === positions[0].z) {
  36964. continue;
  36965. }
  36966. let geoPoint = this._cartesian3ToGeo(position2);
  36967. let height2 = this._queryHeightFromGeo(geoPoint.longitude, geoPoint.latitude);
  36968. let newPosition = Cesium.Cartesian3.fromDegrees(geoPoint.longitude, geoPoint.latitude, height2);
  36969. _self._createEditPointEntity({
  36970. name: _self._sketchEditEntityNodeName,
  36971. position: newPosition,
  36972. size: 12,
  36973. color: [0, 0, 255, 1],
  36974. editType: {
  36975. type: DrawTools.EditPointType.Node,
  36976. index: i2
  36977. }
  36978. });
  36979. }
  36980. },
  36981. _createEditSpatialPoint(positions, heights, startIndex) {
  36982. return;
  36983. },
  36984. _createEditMiddlePoint(positions, isSpatial = false) {
  36985. this._sketchEditEntityMiddleName = "SketchEditEntityMiddle";
  36986. let _self = this;
  36987. if (!isSpatial) {
  36988. for (let i2 = 1; i2 < positions.length; i2++) {
  36989. let p1 = positions[i2 - 1];
  36990. let p2 = positions[i2];
  36991. let pCenter = this._calculateMiddlePoint(p1, p2);
  36992. this._createEditPointEntity({
  36993. name: _self._sketchEditEntityMiddleName,
  36994. position: pCenter,
  36995. size: 9,
  36996. color: [255, 255, 0, 1],
  36997. editType: {
  36998. type: DrawTools.EditPointType.Middle,
  36999. index: i2
  37000. }
  37001. });
  37002. }
  37003. } else {
  37004. for (let i2 = 1; i2 < positions.length; i2++) {
  37005. let p1 = positions[i2 - 1];
  37006. let p2 = positions[i2];
  37007. let pCenter = {
  37008. x: (p1.x + p2.x) / 2,
  37009. y: (p1.y + p2.y) / 2,
  37010. z: (p1.z + p2.z) / 2
  37011. };
  37012. this._createEditPointEntity({
  37013. name: _self._sketchEditEntityMiddleName,
  37014. position: pCenter,
  37015. size: 9,
  37016. color: [255, 255, 0, 1],
  37017. editType: {
  37018. type: DrawTools.EditPointType.Middle,
  37019. index: i2
  37020. }
  37021. });
  37022. }
  37023. }
  37024. },
  37025. _createEditCenterPoint(position2) {
  37026. let _self = this;
  37027. this._sketchEditEntityCenterName = "SketchEditEntityCenter";
  37028. this._createEditPointEntity({
  37029. name: _self._sketchEditEntityCenterName,
  37030. position: position2,
  37031. size: 12,
  37032. color: [0, 255, 0, 0.1],
  37033. outlineWidth: 2,
  37034. outlineColor: [255, 255, 255, 1],
  37035. editType: {
  37036. type: DrawTools.EditPointType.Center
  37037. }
  37038. });
  37039. if (this._editEntity != void 0) {
  37040. this._editEntity.position = position2.clone();
  37041. }
  37042. },
  37043. _createEditOdlineEndPoint(position2, joinEntity) {
  37044. this._sketchEditEntityNodeName = "SketchEditEntityNode";
  37045. let _self = this;
  37046. let geoPoint = this._cartesian3ToGeo(position2);
  37047. let height2 = this._queryHeightFromGeo(geoPoint.longitude, geoPoint.latitude);
  37048. Cesium.Cartesian3.fromDegrees(geoPoint.longitude, geoPoint.latitude, height2);
  37049. _self._createEditPointEntity({
  37050. name: _self._sketchEditEntityNodeName,
  37051. position: position2,
  37052. size: 12,
  37053. color: [0, 0, 255, 1],
  37054. editType: {
  37055. type: DrawTools.EditPointType.OdlineEndNode,
  37056. joinEntity
  37057. }
  37058. });
  37059. },
  37060. _createEditOdlineStartPoint(position2, joinEntity) {
  37061. this._sketchEditEntityNodeName = "SketchEditEntityNode";
  37062. let _self = this;
  37063. let geoPoint = this._cartesian3ToGeo(position2);
  37064. let height2 = this._queryHeightFromGeo(geoPoint.longitude, geoPoint.latitude);
  37065. Cesium.Cartesian3.fromDegrees(geoPoint.longitude, geoPoint.latitude, height2);
  37066. _self._createEditPointEntity({
  37067. name: _self._sketchEditEntityNodeName,
  37068. position: position2,
  37069. size: 12,
  37070. color: [0, 255, 0, 0.6],
  37071. editType: {
  37072. type: DrawTools.EditPointType.OdlineStrartNode,
  37073. joinEntity
  37074. }
  37075. });
  37076. },
  37077. _calculateMiddlePoint(position1, position2) {
  37078. let g1 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position1);
  37079. let g2 = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  37080. let pt1 = [Cesium.Math.toDegrees(g1.longitude), Cesium.Math.toDegrees(g1.latitude)];
  37081. let pt2 = [Cesium.Math.toDegrees(g2.longitude), Cesium.Math.toDegrees(g2.latitude)];
  37082. let tpt1 = point(pt1);
  37083. let tpt2 = point(pt2);
  37084. let midpoint$1 = midpoint(tpt1, tpt2).geometry.coordinates;
  37085. let height2 = this._queryHeightFromGeo(midpoint$1[0], midpoint$1[1]);
  37086. let result = Cesium.Cartesian3.fromDegrees(midpoint$1[0], midpoint$1[1], height2);
  37087. return result;
  37088. },
  37089. _cartesian3ToGeo: function(position2) {
  37090. let g = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  37091. return {
  37092. longitude: Cesium.Math.toDegrees(g.longitude),
  37093. latitude: Cesium.Math.toDegrees(g.latitude),
  37094. height: g.height
  37095. };
  37096. },
  37097. _queryHeightFromGeo: function(longitude, latitude) {
  37098. if (longitude === void 0 || latitude === void 0 || typeof longitude != "number" || typeof latitude != "number")
  37099. return 0;
  37100. let rLng = Cesium.Math.toRadians(longitude);
  37101. let rLat = Cesium.Math.toRadians(latitude);
  37102. let cartographic = new Cesium.Cartographic(rLng, rLat);
  37103. let noQueryEntities = [];
  37104. for (let i2 = 0; i2 < this._entities.values.length; i2++) {
  37105. if (this._entities.values[i2].name === this._sketchEntityName) {
  37106. noQueryEntities.push(this._entities.values[i2]);
  37107. }
  37108. }
  37109. let height2 = this._viewer.scene.sampleHeight(cartographic, noQueryEntities);
  37110. if (height2 === void 0)
  37111. return 0;
  37112. else
  37113. return height2;
  37114. },
  37115. _queryHeightFromGeoAsync: function(longitude, latitude, callComplete) {
  37116. if (longitude === void 0 || latitude === void 0 || typeof longitude != "number" || typeof latitude != "number")
  37117. return 0;
  37118. let rLng = Cesium.Math.toRadians(longitude);
  37119. let rLat = Cesium.Math.toRadians(latitude);
  37120. let cartographic = new Cesium.Cartographic(rLng, rLat);
  37121. let promise = this._viewer.scene.sampleHeightMostDetailed([cartographic]);
  37122. promise.then(function(updatedPositions) {
  37123. if (callComplete)
  37124. callComplete(updatedPositions[0].height);
  37125. });
  37126. },
  37127. _clearEditPoint: function() {
  37128. if (this._sketchEditHandler != void 0) {
  37129. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOWN);
  37130. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP);
  37131. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  37132. }
  37133. this._sketchEditPoints = [];
  37134. this._sketchEditIndex = void 0;
  37135. this._editEntity = void 0;
  37136. this._removeEntityByName(this._sketchEditEntityNodeName);
  37137. this._removeEntityByName(this._sketchEditEntityMiddleName);
  37138. this._removeEntityByName(this._sketchEditEntityCenterName);
  37139. this._removeEntityByName(this._sketchEditEntitySpatialName);
  37140. }
  37141. });
  37142. Object.assign(DrawTools.prototype, {
  37143. _checkColor: function(color2) {
  37144. if (color2 === void 0 || color2 === null)
  37145. return false;
  37146. if (typeof color2 != "number")
  37147. return false;
  37148. let intColor = parseInt(color2);
  37149. if (intColor < 0 || intColor > 255)
  37150. return false;
  37151. return true;
  37152. },
  37153. _checkAlpha: function(alpha) {
  37154. if (alpha === void 0 || alpha === null)
  37155. return false;
  37156. if (typeof alpha != "number")
  37157. return false;
  37158. let floatAlpha = parseFloat(alpha);
  37159. if (floatAlpha < 0 || floatAlpha > 1)
  37160. return false;
  37161. return true;
  37162. },
  37163. _checkColorAndAlpha: function(colorAndAlpah) {
  37164. let setColor = void 0;
  37165. if (!colorAndAlpah || colorAndAlpah.length === void 0 || colorAndAlpah.length === 0)
  37166. return void 0;
  37167. if (colorAndAlpah.length === 1 && this._checkColor(colorAndAlpah[0])) {
  37168. setColor = [colorAndAlpah[0], 0, 0, 1];
  37169. } else if (colorAndAlpah.length === 2 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  37170. colorAndAlpah[1]
  37171. )) {
  37172. setColor = [colorAndAlpah[0], colorAndAlpah[1], 0, 1];
  37173. } else if (colorAndAlpah.length === 3 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  37174. colorAndAlpah[1]
  37175. ) && this._checkColor(colorAndAlpah[2])) {
  37176. setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], 1];
  37177. } else if (colorAndAlpah.length === 4 && this._checkColor(colorAndAlpah[0]) && this._checkColor(
  37178. colorAndAlpah[1]
  37179. ) && this._checkColor(colorAndAlpah[2]) && this._checkAlpha(
  37180. colorAndAlpah[3]
  37181. )) {
  37182. setColor = [colorAndAlpah[0], colorAndAlpah[1], colorAndAlpah[2], colorAndAlpah[3]];
  37183. }
  37184. return setColor;
  37185. }
  37186. });
  37187. Object.assign(DrawTools.prototype, {
  37188. _initOperationDom: function() {
  37189. let _self = this;
  37190. this._operationDomId = "drawButtonDiv";
  37191. this._operationDom = document.getElementById(this._operationDomId);
  37192. this._removeOperationDom();
  37193. this._createOperationMainDom();
  37194. if ([
  37195. DrawTools.DrawType.Rectangle,
  37196. DrawTools.DrawType.Circle,
  37197. DrawTools.DrawType.DynamicCircle,
  37198. DrawTools.DrawType.VideoWall
  37199. ].indexOf(this._drawType) === -1) {
  37200. let btnUndo = this._createOperationUndoButtonDom();
  37201. btnUndo.onclick = function() {
  37202. _self._operationExecuteEvent(Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  37203. };
  37204. }
  37205. if ([
  37206. DrawTools.DrawType.Rectangle,
  37207. DrawTools.DrawType.Circle,
  37208. DrawTools.DrawType.DynamicCircle,
  37209. DrawTools.DrawType.VideoWall
  37210. ] === -1) {
  37211. let btnCompletion = this._crateOperationCompletionButtonDom();
  37212. btnCompletion.onclick = function() {
  37213. _self._operationExecuteEvent(Cesium.ScreenSpaceEventType.LEFT_CLICK);
  37214. };
  37215. } else {
  37216. let btnCompletion = this._crateOperationCompletionButtonDom();
  37217. btnCompletion.onclick = function() {
  37218. _self._operationExecuteEvent(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  37219. };
  37220. }
  37221. },
  37222. _operationExecuteEvent(eventType) {
  37223. if (this._drawEventHandler !== void 0 && this._drawEventHandler.isDestroyed() === false) {
  37224. let event2 = {
  37225. position: new Cesium.Cartesian2(300, 300)
  37226. };
  37227. let action = this._drawEventHandler.getInputAction(eventType);
  37228. action(event2);
  37229. }
  37230. },
  37231. _createOperationMainDom: function() {
  37232. this._operationDom = document.createElement("div");
  37233. this._operationDom.id = this._operationDomId;
  37234. this._operationDom.style.width = "80px";
  37235. this._operationDom.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
  37236. this._operationDom.style.borderRadius = "5px";
  37237. this._operationDom.style.display = "flex";
  37238. this._operationDom.style.flexDirection = "column";
  37239. this._operationDom.style.padding = "8px";
  37240. this._operationDom.style.justifyContent = "center";
  37241. this._operationDom.style.position = "absolute";
  37242. this._operationDom.style.bottom = "150px";
  37243. this._operationDom.style.right = "10px";
  37244. document.body.appendChild(this._operationDom);
  37245. },
  37246. _createOperationUndoButtonDom: function() {
  37247. let btnUndo = document.createElement("button");
  37248. btnUndo.id = "btnDrawBackout";
  37249. btnUndo.style.height = "30px";
  37250. btnUndo.style.marginBottom = "8px";
  37251. btnUndo.style.backgroundColor = "rgba(52, 137, 255, 1.0)";
  37252. btnUndo.style.color = "rgb(255, 255, 255)";
  37253. btnUndo.style.border = "0px solid red";
  37254. btnUndo.style.borderRadius = "5px";
  37255. btnUndo.innerHTML = "\u56DE\u9000";
  37256. btnUndo.style.fontSize = "13px";
  37257. btnUndo.style.cursor = "pointer";
  37258. this._operationDom.appendChild(btnUndo);
  37259. return btnUndo;
  37260. },
  37261. _crateOperationCompletionButtonDom: function() {
  37262. let btnCompletion = document.createElement("button");
  37263. btnCompletion.id = "btnDrawComplete";
  37264. btnCompletion.style.height = "30px";
  37265. btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
  37266. btnCompletion.style.color = "rgb(255, 255, 255)";
  37267. btnCompletion.style.border = "0px solid red";
  37268. btnCompletion.style.borderRadius = "5px";
  37269. btnCompletion.innerHTML = "\u5B8C\u6210";
  37270. btnCompletion.style.fontSize = "13px";
  37271. btnCompletion.style.cursor = "pointer";
  37272. this._operationDom.appendChild(btnCompletion);
  37273. return btnCompletion;
  37274. },
  37275. _removeOperationDom: function() {
  37276. if (this._operationDom !== null && this._operationDom !== void 0) {
  37277. document.body.removeChild(this._operationDom);
  37278. this._operationDom = void 0;
  37279. }
  37280. },
  37281. _createOperationDom: function() {
  37282. if (this._isRuntimeApp()) {
  37283. this._initOperationDom();
  37284. }
  37285. }
  37286. });
  37287. Object.assign(DrawTools.prototype, {
  37288. _openPropertyEditDialog: function(params, callEdit, callRemove) {
  37289. this._editPropertyDialogDomId = "dialog-property-dom";
  37290. this._registerDOMPropertyEdit = "dialog-edit-property";
  37291. let PropertyEditComponent = customElements.get(this._registerDOMPropertyEdit);
  37292. if (PropertyEditComponent === void 0) {
  37293. PropertyEditComponent = defineCustomElement(DialogEditProperty$2);
  37294. customElements.define(this._registerDOMPropertyEdit, PropertyEditComponent);
  37295. }
  37296. this._closePropertyEditDialog();
  37297. let dialogPropertyElement = new PropertyEditComponent({
  37298. params
  37299. });
  37300. dialogPropertyElement.id = this._editPropertyDialogDomId;
  37301. dialogPropertyElement.showDialog = true;
  37302. document.body.appendChild(dialogPropertyElement);
  37303. dialogPropertyElement.addEventListener(
  37304. "submit",
  37305. (e) => {
  37306. if (callEdit)
  37307. callEdit(e.detail[0]);
  37308. },
  37309. false
  37310. );
  37311. dialogPropertyElement.addEventListener(
  37312. "remove",
  37313. (e) => {
  37314. if (callRemove)
  37315. callRemove();
  37316. },
  37317. false
  37318. );
  37319. },
  37320. _closePropertyEditDialog() {
  37321. let dom2 = document.getElementById(this._editPropertyDialogDomId);
  37322. if (dom2 !== null && dom2 !== void 0) {
  37323. document.body.removeChild(dom2);
  37324. }
  37325. }
  37326. });
  37327. DrawTools.DrawType = Object.freeze({
  37328. Point: "point",
  37329. Polyline: "polyline",
  37330. ArrowPolyline: "arrowPolyline",
  37331. DynamicPolyline: "dynamicPolyline",
  37332. GrowPolyline: "\u53D1\u5149\u7EBF",
  37333. OutlinePolyline: "outlinePolyline",
  37334. OdLine: "odLine",
  37335. Polygon: "polygon",
  37336. SpatialLine: "spatialLine",
  37337. Circle: "circle",
  37338. DynamicCircle: "dynamicCircle",
  37339. Rectangle: "rectangle",
  37340. NormalWall: "normalWall",
  37341. DynamicWall: "dynamicWall",
  37342. House: "house",
  37343. TextWall: "text",
  37344. VideoWall: "videoWall"
  37345. });
  37346. DrawTools.IconType = Object.freeze({
  37347. Normal: "normal",
  37348. Blue: "blue",
  37349. Green: "green",
  37350. Violet: "violter"
  37351. });
  37352. DrawTools.EditPointType = Object.freeze({
  37353. Node: "node",
  37354. Middle: "middle",
  37355. Center: "center",
  37356. CoordinateAxis: "coordinateAxis",
  37357. OdlineStrartNode: "odlineStartNode",
  37358. OdlineEndNode: "odlineEndNode"
  37359. });
  37360. DrawTools.WallType = Object.freeze({
  37361. ColorWall: "colorWall",
  37362. DynamicWall: "dynamicWall",
  37363. TextWall: "textWall"
  37364. });
  37365. DrawTools.CircleType = Object.freeze({
  37366. ColorCircle: "colorCircle",
  37367. DynamicCircle: "dynamicCircle"
  37368. });
  37369. DrawTools.PolylineType = Object.freeze({
  37370. NormalPolyline: "normalPolyline",
  37371. ArrowsPolyline: "arrowsPolyline",
  37372. DynamicPolyline: "dynamicPolyline",
  37373. DottedPolyline: "dottedPolyline",
  37374. GrowPolyline: "growPolyline",
  37375. OutlinePolyline: "outlinePolyline"
  37376. });
  37377. DrawTools.PolygonType = Object.freeze({
  37378. NormalPolygon: "normalPolygon",
  37379. HousePolygon: "housePolygon"
  37380. });
  37381. DrawTools.RuntimeEnvironment = Object.freeze({
  37382. App: "app",
  37383. Web: "web"
  37384. });
  37385. class WallMaterialProperty {
  37386. constructor(options2) {
  37387. this._viewer = options2.viewer;
  37388. this._definitionChanged = new Cesium.Event();
  37389. this._color = void 0;
  37390. this.color = options2.color || Cesium.Color.BLUE;
  37391. this.duration = options2.duration || 1e3;
  37392. this.trailImage = options2.trailImage;
  37393. this._time = new Date().getTime();
  37394. this._materialTypeName = "WallMaterial" + this._guid();
  37395. this._param = {
  37396. color: this.color._value.toCssColorString(),
  37397. image: this.trailImage,
  37398. duration: this.duration,
  37399. count: 0,
  37400. direction: "",
  37401. order: ""
  37402. };
  37403. Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
  37404. fabric: {
  37405. type: this._materialTypeName,
  37406. uniforms: {
  37407. time: -20,
  37408. color: new Cesium.Color(1, 0, 0, 0.5),
  37409. image: options2.trailImage
  37410. },
  37411. source: this._getDirectionWallShader(options2.param)
  37412. },
  37413. translucent: function(material) {
  37414. return true;
  37415. }
  37416. });
  37417. }
  37418. _guid() {
  37419. function S4() {
  37420. return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
  37421. }
  37422. return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
  37423. }
  37424. getType(time) {
  37425. return this._materialTypeName;
  37426. }
  37427. getValue(time, result) {
  37428. if (!Cesium.defined(result)) {
  37429. result = {};
  37430. }
  37431. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
  37432. result.image = this.trailImage;
  37433. if (this.duration) {
  37434. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  37435. }
  37436. this._viewer.scene.requestRender();
  37437. return result;
  37438. }
  37439. equals(other) {
  37440. return this === other || other instanceof WallMaterialProperty && Cesium.Property.equals(this._color, other._color) && other._param.order === this._param.order && other._param.count === this._param.count && other._param.direction === this._param.direction && other.duration === this.duration;
  37441. }
  37442. _getDirectionWallShader(options2) {
  37443. let op = Cesium.defaultValue(options2, {});
  37444. let count = op.count !== void 0 && typeof op.count === "number" && op.count > 0 ? op.count : 1;
  37445. let direction = op.direction === "horizontal" ? "horizontal" : "vertical";
  37446. let order = op.order === "+" ? "+" : "-";
  37447. this._param.count = count;
  37448. this._param.direction = direction;
  37449. this._param.order = order;
  37450. let materail = "";
  37451. materail += "czm_material czm_getMaterial(czm_materialInput materialInput){\n czm_material material = czm_getDefaultMaterial(materialInput);\n vec2 st = materialInput.st;\n";
  37452. if (direction === "vertical") {
  37453. materail += " vec4 colorImage = texture2D(image,vec2(st.s,fract(float(" + count + ")*st.t " + order + " time)));\n";
  37454. } else if (direction === "horizontal") {
  37455. materail += " vec4 colorImage = texture2D(image, vec2(fract(float(" + count + ")*st.s " + order + " time), st.t));\n";
  37456. }
  37457. materail += " vec4 fragColor;\n fragColor.rgb = color.rgb / 1.0;\n fragColor = czm_gammaCorrect(fragColor);\n material.alpha = colorImage.a * color.a;\n material.diffuse = color.rgb;\n material.emission = fragColor.rgb;\n return material;\n}";
  37458. return materail;
  37459. }
  37460. }
  37461. Object.defineProperties(WallMaterialProperty.prototype, {
  37462. isConstant: {
  37463. get: function() {
  37464. return false;
  37465. }
  37466. },
  37467. definitionChanged: {
  37468. get: function() {
  37469. return this._definitionChanged;
  37470. }
  37471. },
  37472. color: Cesium.createPropertyDescriptor("color")
  37473. });
  37474. class CircleMaterialProperty {
  37475. constructor(options2) {
  37476. this._viewer = options2.viewer;
  37477. this._definitionChanged = new Cesium.Event();
  37478. this._color = void 0;
  37479. this.color = options2.color || Cesium.Color.BLUE;
  37480. this.count = options2.count || 1;
  37481. this.duration = options2.duration || 1e3;
  37482. this._time = new Date().getTime();
  37483. this._materialTypeName = "jtCircleMaterial";
  37484. this._param = {
  37485. color: this.color._value.toCssColorString(),
  37486. duration: this.duration,
  37487. count: this.count
  37488. };
  37489. Cesium.Material._materialCache.addMaterial(this._materialTypeName, {
  37490. fabric: {
  37491. type: this._materialTypeName,
  37492. uniforms: {
  37493. time: 0,
  37494. color: new Cesium.Color(1, 0, 0, 0.5),
  37495. count: 1
  37496. },
  37497. source: this._getCircleMaterial()
  37498. },
  37499. translucent: function(material) {
  37500. return true;
  37501. }
  37502. });
  37503. }
  37504. _getCircleMaterial() {
  37505. let circleMaterial = "czm_material czm_getMaterial(czm_materialInput materialInput)\n{\n czm_material material = czm_getDefaultMaterial(materialInput);\n material.diffuse = 1.5 * color.rgb;\n vec2 st = materialInput.st;\n vec3 str = materialInput.str;\n float dis = distance(st, vec2(0.5, 0.5));\n float per = fract(time);\n if (abs(str.z) > 0.001)\n {\n //\u7740\u8272\u5668\u6E32\u67D3\u505C\u6B62\uFF0C\u4E0D\u5728\u7ED8\u5236\u5185\u5BB9 \n discard;\n }\n if (dis > 0.5)\n {\n //\u8D85\u51FA\u534A\u5F84\u8303\u56F4\u65F6\uFF0C\u7740\u8272\u5668\u6E32\u67D3\u505C\u6B62 \n discard;\n } else {\n //\u628A\u534A\u5F84\u5206\u6210count\u4EFD\uFF0C\u6BCF\u4E24\u4EFD\u4E4B\u95F4\u7684\u95F4\u9694\u8DDD\u79BB \n float perDis = 0.5 / count;\n float disNum;\n float bl = 0.0;\n //\u5FAA\u73AF\uFF0C\u6700\u591A999\u4E2A\u73AF \n for (int i = 0; i <= 999; i++)\n {\n //\u5224\u65AD\u662F\u5426\u5C5E\u4E8E\u6570\u91CF\u5185\u7684\u73AF \n if (float(i) <= count)\n {\n disNum = perDis * float(i) - dis + per / count;\n if (disNum > 0.0)\n {\n if (disNum < perDis)\n {\n bl = 1.0 - disNum / perDis;\n } else if (disNum - perDis < perDis) {\n bl = 1.0 - abs(1.0 - disNum / perDis);\n }\n material.alpha = color.a * pow(bl, 3.0);\n }\n }\n }\n }\n return material;\n}\n";
  37506. return circleMaterial;
  37507. }
  37508. }
  37509. Object.assign(CircleMaterialProperty.prototype, {
  37510. getType: function(time) {
  37511. return this._materialTypeName;
  37512. },
  37513. getValue: function(time, result) {
  37514. if (!Cesium.defined(result)) {
  37515. result = {};
  37516. }
  37517. result.color = Cesium.Property.getValueOrClonedDefault(this._color, time, Cesium.Color.BLUE, result.color);
  37518. result.count = this.count;
  37519. if (this.duration) {
  37520. result.time = (new Date().getTime() - this._time) % this.duration / this.duration;
  37521. }
  37522. this._viewer.scene.requestRender();
  37523. return result;
  37524. },
  37525. equals: function(other) {
  37526. return this === other || other instanceof CircleMaterialProperty && Cesium.Property.equals(this._color, other._color);
  37527. }
  37528. });
  37529. Object.defineProperties(CircleMaterialProperty.prototype, {
  37530. isConstant: {
  37531. get: function() {
  37532. return false;
  37533. }
  37534. },
  37535. definitionChanged: {
  37536. get: function() {
  37537. return this._definitionChanged;
  37538. }
  37539. },
  37540. color: Cesium.createPropertyDescriptor("color")
  37541. });
  37542. const _checkAppOrWeb = function() {
  37543. if (window.navigator.userAgent.match(
  37544. /(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i
  37545. )) {
  37546. return "App";
  37547. } else {
  37548. return "Web";
  37549. }
  37550. };
  37551. const isRuntimeApp = function() {
  37552. if (_checkAppOrWeb() === "App") {
  37553. return true;
  37554. }
  37555. return false;
  37556. };
  37557. const isRuntimeWeb = function() {
  37558. if (_checkAppOrWeb() === "Web") {
  37559. return true;
  37560. }
  37561. return false;
  37562. };
  37563. function createOperationMainDom() {
  37564. let buttonDiv = document.createElement("div");
  37565. buttonDiv.id = "drawButtonDiv";
  37566. buttonDiv.style.width = "80px";
  37567. buttonDiv.style.backgroundColor = "rgba(5, 45, 155, 0.7)";
  37568. buttonDiv.style.borderRadius = "5px";
  37569. buttonDiv.style.display = "flex";
  37570. buttonDiv.style.flexDirection = "column";
  37571. buttonDiv.style.padding = "8px";
  37572. buttonDiv.style.justifyContent = "center";
  37573. buttonDiv.style.position = "absolute";
  37574. buttonDiv.style.bottom = "150px";
  37575. buttonDiv.style.right = "10px";
  37576. let btnUndo = document.createElement("button");
  37577. btnUndo.id = "btnDrawBackout";
  37578. btnUndo.style.height = "30px";
  37579. btnUndo.style.marginBottom = "8px";
  37580. btnUndo.style.backgroundColor = "rgba(52, 137, 255, 1.0)";
  37581. btnUndo.style.color = "rgb(255, 255, 255)";
  37582. btnUndo.style.border = "0px solid red";
  37583. btnUndo.style.borderRadius = "5px";
  37584. btnUndo.innerHTML = "\u56DE\u9000";
  37585. btnUndo.style.fontSize = "13px";
  37586. btnUndo.style.cursor = "pointer";
  37587. buttonDiv.appendChild(btnUndo);
  37588. let btnCompletion = document.createElement("button");
  37589. btnCompletion.id = "btnDrawComplete";
  37590. btnCompletion.style.height = "30px";
  37591. btnCompletion.style.backgroundColor = "rgba(88, 185, 45, 1.0)";
  37592. btnCompletion.style.color = "rgb(255, 255, 255)";
  37593. btnCompletion.style.border = "0px solid red";
  37594. btnCompletion.style.borderRadius = "5px";
  37595. btnCompletion.innerHTML = "\u5B8C\u6210";
  37596. btnCompletion.style.fontSize = "13px";
  37597. btnCompletion.style.cursor = "pointer";
  37598. buttonDiv.appendChild(btnCompletion);
  37599. document.body.appendChild(buttonDiv);
  37600. }
  37601. function showTooltipMessage(message) {
  37602. let msgMainDom = document.getElementById("messageMainDom");
  37603. if (msgMainDom !== null && msgMainDom !== void 0) {
  37604. document.body.removeChild(msgMainDom);
  37605. }
  37606. msgMainDom = document.createElement("div");
  37607. msgMainDom.style.width = "30%";
  37608. msgMainDom.style.backgroundColor = "rgba(237, 248, 230, 1.0)";
  37609. msgMainDom.style.height = "45px";
  37610. msgMainDom.style.border = "solid 2px rgb(219, 241, 208)";
  37611. msgMainDom.style.borderRadius = "8px";
  37612. msgMainDom.style.display = "flex";
  37613. msgMainDom.style.alignItems = "center";
  37614. msgMainDom.style.paddingLeft = "10px";
  37615. msgMainDom.style.color = "rgb(91, 188, 48)";
  37616. msgMainDom.style.fontSize = "14px";
  37617. msgMainDom.style.fontWeight = "600";
  37618. msgMainDom.style.position = "absolute";
  37619. msgMainDom.style.left = "35%";
  37620. msgMainDom.style.transition = "transform 1s";
  37621. msgMainDom.style.transform = "translateY(-90px)";
  37622. msgMainDom.style.top = "0px";
  37623. msgMainDom.style.zIndex = 1e3;
  37624. document.body.appendChild(msgMainDom);
  37625. let strHtml = "";
  37626. strHtml += "<div style='";
  37627. strHtml += "background-color: rgb(88, 185, 45);";
  37628. strHtml += "color: rgb(255, 255, 255);";
  37629. strHtml += "height: 24px;";
  37630. strHtml += "width: 24px;";
  37631. strHtml += "border-radius: 20px;";
  37632. strHtml += "display: flex;";
  37633. strHtml += "justify-content: center;";
  37634. strHtml += "align-items: center;";
  37635. strHtml += "font-size: 14px;";
  37636. strHtml += "margin-right: 18px;";
  37637. strHtml += "'>&#10003</div>";
  37638. strHtml += "<div>" + message + "</div>";
  37639. msgMainDom.innerHTML = strHtml;
  37640. msgMainDom.addEventListener("transitionend", function() {
  37641. setTimeout(function() {
  37642. document.body.removeChild(msgMainDom);
  37643. }, 1e3);
  37644. }, false);
  37645. setTimeout(function() {
  37646. msgMainDom.style.transform = "translateY(50px)";
  37647. }, 100);
  37648. }
  37649. var RuntimeEnvironment = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  37650. __proto__: null,
  37651. isRuntimeApp,
  37652. isRuntimeWeb,
  37653. createOperationMainDom,
  37654. showTooltipMessage
  37655. }, Symbol.toStringTag, { value: "Module" }));
  37656. class DrawStraightArrow {
  37657. constructor(arg) {
  37658. this.viewer = arg.viewer;
  37659. this.Cesium = arg.Cesium;
  37660. this.floatingPoint = null;
  37661. this._straightArrow = null;
  37662. this._straightArrowLast = null;
  37663. this._positions = [];
  37664. this._entities_point = [];
  37665. this._entities_straightArrow = [];
  37666. this._straightArrowData = null;
  37667. this.DrawStartEvent = new Cesium.Event();
  37668. this.DrawEndEvent = new Cesium.Event();
  37669. this._tooltip = createTooltip(this.viewer.container);
  37670. this._param = {
  37671. id: "DrawStraightArrow",
  37672. polygonColor: "rgba(0,255,0,0.5)",
  37673. outlineColor: "rgba(255, 255, 255, 1)",
  37674. outlineWidth: 1
  37675. };
  37676. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  37677. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  37678. }
  37679. get straightArrow() {
  37680. return this._straightArrowLast;
  37681. }
  37682. getData() {
  37683. return this._straightArrowData;
  37684. }
  37685. computePosition(data) {
  37686. var $this = this;
  37687. var length = data.length;
  37688. var p1 = data[0];
  37689. var p2 = data[length - 1];
  37690. var firstPoint = $this.cartesianToLatlng(p1);
  37691. var endPoints = $this.cartesianToLatlng(p2);
  37692. var arrow = [];
  37693. var res = $this.fineArrow([firstPoint[0], firstPoint[1]], [endPoints[0], endPoints[1]]);
  37694. for (var i2 = 0; i2 < res.length; i2++) {
  37695. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  37696. arrow.push(cart3);
  37697. }
  37698. $this._straightArrowData = [firstPoint, endPoints];
  37699. return new $this.Cesium.PolygonHierarchy(arrow);
  37700. }
  37701. addload(data) {
  37702. var $this = this;
  37703. if (data.length < 2) {
  37704. return null;
  37705. }
  37706. var length = data.length;
  37707. var p1 = data[0];
  37708. var p2 = data[length - 1];
  37709. var arrow = [];
  37710. var res = $this.fineArrow([p1[0], p1[1]], [p2[0], p2[1]]);
  37711. for (var i2 = 0; i2 < res.length; i2++) {
  37712. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  37713. arrow.push(cart3);
  37714. }
  37715. var arrowEntity = $this.viewer.entities.add({
  37716. Type: "DrawStraightArrow",
  37717. Position: data,
  37718. id: data.id || $this.objId,
  37719. polygon: {
  37720. hierarchy: new $this.Cesium.PolygonHierarchy(arrow),
  37721. show: true,
  37722. fill: true,
  37723. clampToGround: true,
  37724. material: $this.polygonMaterial
  37725. }
  37726. });
  37727. return arrowEntity;
  37728. }
  37729. startCreate(drawType) {
  37730. if (isRuntimeApp()) {
  37731. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  37732. }
  37733. var $this = this;
  37734. this.drawType = drawType;
  37735. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  37736. this.handler.setInputAction(function(evt) {
  37737. if (isRuntimeApp()) {
  37738. var cartesian = $this.getCatesian3FromPX(evt.position);
  37739. if (!cartesian) {
  37740. return;
  37741. }
  37742. $this.createPoint(cartesian);
  37743. $this._positions.push(cartesian);
  37744. if ($this._positions.length === 2) {
  37745. showTooltipMessage("\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  37746. $this.destroy();
  37747. if (!$this.Cesium.defined($this._straightArrow)) {
  37748. $this._straightArrow = $this.createStraightArrow();
  37749. createOperationMainDom();
  37750. document.getElementById("btnDrawBackout").style.display = "none";
  37751. document.getElementById("btnDrawComplete").onclick = () => {
  37752. $this._straightArrowData = $this._positions.concat();
  37753. $this.viewer.entities.remove($this._straightArrow);
  37754. $this._straightArrow = null;
  37755. $this._positions = [];
  37756. var lnglatArr = [];
  37757. for (var i2 = 0; i2 < $this._straightArrowData.length; i2++) {
  37758. var lnglat = $this.cartesianToLatlng($this._straightArrowData[i2]);
  37759. lnglatArr.push(lnglat);
  37760. }
  37761. $this._straightArrowData = lnglatArr;
  37762. var straightArrow = $this.addload($this._straightArrowData);
  37763. $this._entities_straightArrow.push(straightArrow);
  37764. $this._straightArrowLast = straightArrow;
  37765. $this.clearPoint();
  37766. $this.destroy();
  37767. let buttonDiv = document.getElementById("drawButtonDiv");
  37768. if (buttonDiv) {
  37769. document.body.removeChild(buttonDiv);
  37770. }
  37771. };
  37772. }
  37773. }
  37774. } else {
  37775. clearTimeout($this._timer);
  37776. $this._timer = setTimeout(function() {
  37777. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  37778. var cartesian2 = $this.getCatesian3FromPX(evt.position);
  37779. if ($this._positions.length == 0) {
  37780. $this._positions.push(cartesian2.clone());
  37781. $this.floatingPoint = $this.createPoint(cartesian2);
  37782. $this._positions.push(cartesian2);
  37783. }
  37784. if (!$this._straightArrow) {
  37785. $this.createPoint(cartesian2);
  37786. } else {
  37787. $this._straightArrowData = $this._positions.concat();
  37788. $this.viewer.entities.remove($this._straightArrow);
  37789. $this._straightArrow = null;
  37790. $this._positions = [];
  37791. $this.floatingPoint.position.setValue(cartesian2);
  37792. var lnglatArr = [];
  37793. for (var i2 = 0; i2 < $this._straightArrowData.length; i2++) {
  37794. var lnglat = $this.cartesianToLatlng($this._straightArrowData[i2]);
  37795. lnglatArr.push(lnglat);
  37796. }
  37797. $this._straightArrowData = lnglatArr;
  37798. var straightArrow = $this.addload($this._straightArrowData);
  37799. $this._entities_straightArrow.push(straightArrow);
  37800. $this._straightArrowLast = straightArrow;
  37801. $this.clearPoint();
  37802. $this.destroy();
  37803. $this._tooltip.setVisible(false);
  37804. }
  37805. }, 200);
  37806. }
  37807. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  37808. this.handler.setInputAction(function(evt) {
  37809. if (isRuntimeApp())
  37810. return;
  37811. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  37812. if ($this._positions.length < 2)
  37813. return;
  37814. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u7ED3\u675F\u7ED8\u5236");
  37815. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  37816. if (!$this.Cesium.defined($this._straightArrow)) {
  37817. $this._straightArrow = $this.createStraightArrow();
  37818. }
  37819. $this.floatingPoint.position.setValue(cartesian);
  37820. if ($this._straightArrow) {
  37821. $this._positions.pop();
  37822. $this._positions.push(cartesian);
  37823. }
  37824. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  37825. }
  37826. createStraightArrow() {
  37827. var $this = this;
  37828. var arrowEntity = $this.viewer.entities.add({
  37829. polygon: {
  37830. hierarchy: new $this.Cesium.CallbackProperty(
  37831. function() {
  37832. var length = $this._positions.length;
  37833. var p1 = $this._positions[0];
  37834. var p2 = $this._positions[length - 1];
  37835. var firstPoint = $this.cartesianToLatlng(p1);
  37836. var endPoints = $this.cartesianToLatlng(p2);
  37837. var arrow = [];
  37838. var res = $this.fineArrow([firstPoint[0], firstPoint[1]], [endPoints[0], endPoints[1]]);
  37839. for (var i2 = 0; i2 < res.length; i2++) {
  37840. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  37841. arrow.push(cart3);
  37842. }
  37843. return new $this.Cesium.PolygonHierarchy(arrow);
  37844. },
  37845. false
  37846. ),
  37847. show: true,
  37848. fill: true,
  37849. clampToGround: true,
  37850. material: $this.polygonMaterial
  37851. }
  37852. });
  37853. $this._entities_straightArrow.push(arrowEntity);
  37854. return arrowEntity;
  37855. }
  37856. createPoint(cartesian) {
  37857. var $this = this;
  37858. var point2 = this.viewer.entities.add({
  37859. position: cartesian,
  37860. point: {
  37861. pixelSize: 10,
  37862. color: $this.Cesium.Color.RED,
  37863. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  37864. }
  37865. });
  37866. $this._entities_point.push(point2);
  37867. return point2;
  37868. }
  37869. cartesianToLatlng(cartesian) {
  37870. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  37871. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  37872. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  37873. return [lng, lat];
  37874. }
  37875. destroy() {
  37876. if (this.handler) {
  37877. this.handler.destroy();
  37878. this.handler = null;
  37879. }
  37880. }
  37881. clearPoint() {
  37882. this.DrawEndEvent.raiseEvent(this._straightArrowLast, this._straightArrowData, this.drawType);
  37883. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  37884. this.viewer.entities.remove(this._entities_point[i2]);
  37885. }
  37886. this._entities_point = [];
  37887. }
  37888. clear() {
  37889. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  37890. this.viewer.entities.remove(this._entities_point[i2]);
  37891. }
  37892. for (var i2 = 0; i2 < this._entities_straightArrow.length; i2++) {
  37893. this.viewer.entities.remove(this._entities_straightArrow[i2]);
  37894. }
  37895. this.floatingPoint = null;
  37896. this._straightArrow = null;
  37897. this._straightArrowLast = null;
  37898. this._positions = [];
  37899. this._entities_point = [];
  37900. this._entities_straightArrow = [];
  37901. this._straightArrowData = null;
  37902. }
  37903. getCatesian3FromPX(px) {
  37904. var cartesian;
  37905. var ray = this.viewer.camera.getPickRay(px);
  37906. if (!ray)
  37907. return null;
  37908. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  37909. return cartesian;
  37910. }
  37911. fineArrowDefualParam() {
  37912. return {
  37913. tailWidthFactor: 0.15,
  37914. neckWidthFactor: 0.2,
  37915. headWidthFactor: 0.25,
  37916. headAngle: Math.PI / 8.5,
  37917. neckAngle: Math.PI / 13
  37918. };
  37919. }
  37920. fineArrow(tailPoint, headerPoint) {
  37921. var $this = this;
  37922. if (tailPoint.length < 2 || headerPoint.length < 2)
  37923. return;
  37924. let tailWidthFactor = $this.fineArrowDefualParam().tailWidthFactor;
  37925. let neckWidthFactor = $this.fineArrowDefualParam().neckWidthFactor;
  37926. let headWidthFactor = $this.fineArrowDefualParam().headWidthFactor;
  37927. let headAngle = $this.fineArrowDefualParam().headAngle;
  37928. let neckAngle = $this.fineArrowDefualParam().neckAngle;
  37929. var o = [];
  37930. o[0] = tailPoint;
  37931. o[1] = headerPoint;
  37932. var e = o[0], r2 = o[1], n = $this.getBaseLength(o), g = n * tailWidthFactor, i2 = n * neckWidthFactor, s = n * headWidthFactor, a = $this.getThirdPoint(r2, e, Math.PI / 2, g, true), l = $this.getThirdPoint(r2, e, Math.PI / 2, g, false), u = $this.getThirdPoint(e, r2, headAngle, s, false), c = $this.getThirdPoint(e, r2, headAngle, s, true), p = $this.getThirdPoint(e, r2, neckAngle, i2, false), h2 = $this.getThirdPoint(e, r2, neckAngle, i2, true), d2 = [];
  37933. d2.push(a[0], a[1], p[0], p[1], u[0], u[1], r2[0], r2[1], c[0], c[1], h2[0], h2[1], l[0], l[1], e[0], e[1]);
  37934. return $this.Cesium.Cartesian3.fromDegreesArray(d2);
  37935. }
  37936. getBaseLength(t2) {
  37937. return Math.pow(this.wholeDistance(t2), 0.99);
  37938. }
  37939. wholeDistance(t2) {
  37940. for (var o = 0, e = 0; e < t2.length - 1; e++)
  37941. o += this.distance(t2[e], t2[e + 1]);
  37942. return o;
  37943. }
  37944. distance(t2, o) {
  37945. return Math.sqrt(Math.pow(t2[0] - o[0], 2) + Math.pow(t2[1] - o[1], 2));
  37946. }
  37947. getThirdPoint(t2, o, e, r2, n) {
  37948. var g = this.getAzimuth(t2, o), i2 = n ? g + e : g - e, s = r2 * Math.cos(i2), a = r2 * Math.sin(i2);
  37949. return [o[0] + s, o[1] + a];
  37950. }
  37951. getAzimuth(t2, o) {
  37952. var e, r2 = Math.asin(Math.abs(o[1] - t2[1]) / this.distance(t2, o));
  37953. return o[1] >= t2[1] && o[0] >= t2[0] ? e = r2 + Math.PI : o[1] >= t2[1] && o[0] < t2[0] ? e = 2 * Math.PI - r2 : o[1] < t2[1] && o[0] < t2[0] ? e = r2 : o[1] < t2[1] && o[0] >= t2[0] && (e = Math.PI - r2), e;
  37954. }
  37955. }
  37956. class DrawAttackArrow {
  37957. constructor(arg) {
  37958. __publicField(this, "getAttackArrowBodyPoints", function(t2, o, e, r2) {
  37959. var $this = this;
  37960. for (var n = $this.wholeDistance(t2), g = $this.getBaseLength(t2), i2 = g * r2, s = $this.distance(o, e), a = (i2 - s) / 2, l = 0, u = [], c = [], p = 1; p < t2.length - 1; p++) {
  37961. var h2 = $this.getAngleOfThreePoints(t2[p - 1], t2[p], t2[p + 1]) / 2;
  37962. l += $this.distance(t2[p - 1], t2[p]);
  37963. var d2 = (i2 / 2 - l / n * a) / Math.sin(h2), f = $this.getThirdPoint(t2[p - 1], t2[p], Math.PI - h2, d2, true), E2 = $this.getThirdPoint(t2[p - 1], t2[p], h2, d2, false);
  37964. u.push(f), c.push(E2);
  37965. }
  37966. return u.concat(c);
  37967. });
  37968. __publicField(this, "getQBSplinePoints", function(t2) {
  37969. if (t2.length <= 2)
  37970. return t2;
  37971. var o = 2, e = [], r2 = t2.length - o - 1, y = 0;
  37972. e.push(t2[0]);
  37973. for (var n = 0; r2 >= n; n++)
  37974. for (var g = 0; 1 >= g; g += 0.05) {
  37975. for (var i2 = y = 0, s = 0; o >= s; s++) {
  37976. var a = this.getQuadricBSplineFactor(s, g);
  37977. i2 += a * t2[n + s][0], y += a * t2[n + s][1];
  37978. }
  37979. e.push([i2, y]);
  37980. }
  37981. return e.push(t2[t2.length - 1]), e;
  37982. });
  37983. __publicField(this, "getQuadricBSplineFactor", function(t2, o) {
  37984. return 0 == t2 ? Math.pow(o - 1, 2) / 2 : 1 == t2 ? (-2 * Math.pow(o, 2) + 2 * o + 1) / 2 : 2 == t2 ? Math.pow(o, 2) / 2 : 0;
  37985. });
  37986. __publicField(this, "array2Dto1D", function(array) {
  37987. var newArray = [];
  37988. array.forEach(function(elt) {
  37989. newArray.push(elt[0]);
  37990. newArray.push(elt[1]);
  37991. });
  37992. return newArray;
  37993. });
  37994. this.objId = Number(new Date().getTime() + "" + Number(Math.random() * 1e3).toFixed(0));
  37995. this.viewer = arg.viewer;
  37996. this.Cesium = arg.Cesium;
  37997. this.floatingPoint = null;
  37998. this._AttackArrow = null;
  37999. this._AttackArrowLast = null;
  38000. this._positions = [];
  38001. this._entities_point = [];
  38002. this._entities_AttackArrow = [];
  38003. this._AttackArrowData = null;
  38004. this.DrawStartEvent = new Cesium.Event();
  38005. this.DrawEndEvent = new Cesium.Event();
  38006. this._tooltip = createTooltip(this.viewer.container);
  38007. this._param = {
  38008. id: "DrawStraightArrow",
  38009. polygonColor: "rgba(0,255,0,0.5)",
  38010. outlineColor: "rgba(255, 255, 255, 1)",
  38011. outlineWidth: 1
  38012. };
  38013. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  38014. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  38015. }
  38016. get AttackArrow() {
  38017. return this._AttackArrowLast;
  38018. }
  38019. getData() {
  38020. return this._AttackArrowData;
  38021. }
  38022. addload(data) {
  38023. var $this = this;
  38024. if (data.length < 3) {
  38025. return null;
  38026. }
  38027. var res = $this.fineArrow(data);
  38028. var returnData = res.polygonalPoint;
  38029. var arrowEntity = $this.viewer.entities.add({
  38030. Type: "DrawAttackArrow",
  38031. Position: data,
  38032. id: data.id || $this.objId,
  38033. polygon: {
  38034. hierarchy: new $this.Cesium.PolygonHierarchy(returnData),
  38035. show: true,
  38036. fill: true,
  38037. clampToGround: true,
  38038. material: $this.polygonMaterial
  38039. }
  38040. });
  38041. return arrowEntity;
  38042. }
  38043. computePosition(data) {
  38044. let $this = this;
  38045. var lnglatArr = [];
  38046. for (var i2 = 0; i2 < data.length; i2++) {
  38047. var lnglat = $this.cartesianToLatlng(data[i2]);
  38048. lnglatArr.push(lnglat);
  38049. }
  38050. $this._AttackArrowData = lnglatArr;
  38051. var res = $this.fineArrow(lnglatArr);
  38052. var returnData = res.polygonalPoint;
  38053. return new $this.Cesium.PolygonHierarchy(returnData);
  38054. }
  38055. startCreate(drawType) {
  38056. if (isRuntimeApp()) {
  38057. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38058. }
  38059. var $this = this;
  38060. this.drawType = drawType;
  38061. this.handler = new $this.Cesium.ScreenSpaceEventHandler($this.viewer.scene.canvas);
  38062. this.handler.setInputAction(function(evt) {
  38063. if (isRuntimeApp()) {
  38064. var cartesian = $this.getCatesian3FromPX(evt.position);
  38065. if (!cartesian) {
  38066. return;
  38067. }
  38068. $this.createPoint(cartesian);
  38069. $this._positions.push(cartesian);
  38070. if ($this._positions.length <= 2) {
  38071. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38072. } else {
  38073. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  38074. if ($this._positions.length === 3) {
  38075. if (!$this.Cesium.defined($this._AttackArrow)) {
  38076. $this._AttackArrow = $this.createAttackArrow();
  38077. createOperationMainDom();
  38078. document.getElementById("btnDrawBackout").style.display = "none";
  38079. document.getElementById("btnDrawComplete").onclick = () => {
  38080. $this._AttackArrowData = $this._positions.concat();
  38081. $this.viewer.entities.remove($this._AttackArrow);
  38082. $this._AttackArrow = null;
  38083. $this._positions = [];
  38084. let lnglatArr = [];
  38085. for (var i2 = 0; i2 < $this._AttackArrowData.length; i2++) {
  38086. var lnglat = $this.cartesianToLatlng($this._AttackArrowData[i2]);
  38087. lnglatArr.push(lnglat);
  38088. }
  38089. $this._AttackArrowData = lnglatArr;
  38090. var straightArrow = $this.addload(lnglatArr);
  38091. $this._entities_AttackArrow.push(straightArrow);
  38092. $this._AttackArrowLast = straightArrow;
  38093. $this.clearPoint();
  38094. $this.destroy();
  38095. let buttonDiv = document.getElementById("drawButtonDiv");
  38096. if (buttonDiv) {
  38097. document.body.removeChild(buttonDiv);
  38098. }
  38099. };
  38100. }
  38101. }
  38102. }
  38103. } else {
  38104. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  38105. clearTimeout($this._timer);
  38106. $this._timer = setTimeout(function() {
  38107. var cartesian2 = $this.getCatesian3FromPX(evt.position);
  38108. if (!cartesian2) {
  38109. return;
  38110. }
  38111. if ($this._positions.length == 0) {
  38112. $this.floatingPoint = $this.createPoint(cartesian2);
  38113. $this.createPoint(cartesian2);
  38114. }
  38115. if ($this._positions.length == 1) {
  38116. $this._positions.push(cartesian2.clone());
  38117. $this.createPoint(cartesian2);
  38118. }
  38119. $this._positions.push(cartesian2);
  38120. }, 200);
  38121. }
  38122. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  38123. this.handler.setInputAction(function(evt) {
  38124. if (isRuntimeApp())
  38125. return;
  38126. if ($this._positions.length == 0) {
  38127. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38128. } else {
  38129. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38130. }
  38131. if ($this._positions.length < 3)
  38132. return;
  38133. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  38134. if (!$this.Cesium.defined($this._AttackArrow)) {
  38135. $this._AttackArrow = $this.createAttackArrow();
  38136. }
  38137. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  38138. if (!cartesian) {
  38139. return;
  38140. }
  38141. $this.floatingPoint.position.setValue(cartesian);
  38142. if ($this._AttackArrow) {
  38143. $this._positions.pop();
  38144. $this._positions.push(cartesian);
  38145. }
  38146. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  38147. this.handler.setInputAction(function(evt) {
  38148. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  38149. this.handler.setInputAction(function(evt) {
  38150. if (isRuntimeApp())
  38151. return;
  38152. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u53CC\u51FB");
  38153. clearTimeout($this._timer);
  38154. var cartesian = $this.getCatesian3FromPX(evt.position);
  38155. $this._positions.pop();
  38156. $this._positions.push(cartesian);
  38157. $this._AttackArrowData = $this._positions.concat();
  38158. $this.viewer.entities.remove($this._AttackArrow);
  38159. $this._AttackArrow = null;
  38160. $this._positions = [];
  38161. $this.floatingPoint.position.setValue(cartesian);
  38162. let lnglatArr = [];
  38163. for (var i2 = 0; i2 < $this._AttackArrowData.length; i2++) {
  38164. var lnglat = $this.cartesianToLatlng($this._AttackArrowData[i2]);
  38165. lnglatArr.push(lnglat);
  38166. }
  38167. $this._AttackArrowData = lnglatArr;
  38168. var straightArrow = $this.addload(lnglatArr);
  38169. $this._entities_AttackArrow.push(straightArrow);
  38170. $this._AttackArrowLast = straightArrow;
  38171. $this.clearPoint();
  38172. $this.destroy();
  38173. $this._tooltip.setVisible(false);
  38174. }, $this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  38175. }
  38176. createAttackArrow() {
  38177. var $this = this;
  38178. var arrowEntity = $this.viewer.entities.add({
  38179. polygon: {
  38180. hierarchy: new $this.Cesium.CallbackProperty(
  38181. function() {
  38182. var lnglatArr = [];
  38183. for (var i2 = 0; i2 < $this._positions.length; i2++) {
  38184. var lnglat = $this.cartesianToLatlng($this._positions[i2]);
  38185. lnglatArr.push(lnglat);
  38186. }
  38187. var res = $this.fineArrow(lnglatArr);
  38188. var returnData = res.polygonalPoint;
  38189. return new $this.Cesium.PolygonHierarchy(returnData);
  38190. },
  38191. false
  38192. ),
  38193. show: true,
  38194. fill: true,
  38195. clampToGround: true,
  38196. material: $this.polygonMaterial
  38197. }
  38198. });
  38199. $this._entities_AttackArrow.push(arrowEntity);
  38200. return arrowEntity;
  38201. }
  38202. createPoint(cartesian) {
  38203. var $this = this;
  38204. var point2 = this.viewer.entities.add({
  38205. position: cartesian,
  38206. point: {
  38207. pixelSize: 10,
  38208. color: $this.Cesium.Color.RED,
  38209. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  38210. }
  38211. });
  38212. point2.objId = this.objId;
  38213. $this._entities_point.push(point2);
  38214. return point2;
  38215. }
  38216. cartesianToLatlng(cartesian) {
  38217. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  38218. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  38219. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  38220. let alt = cartographic.height;
  38221. return [lng, lat, alt];
  38222. }
  38223. destroy() {
  38224. if (this.handler) {
  38225. this.handler.destroy();
  38226. this.handler = null;
  38227. }
  38228. }
  38229. clearPoint() {
  38230. this.DrawEndEvent.raiseEvent(this._AttackArrowLast, this._AttackArrowData, this.drawType);
  38231. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38232. this.viewer.entities.remove(this._entities_point[i2]);
  38233. }
  38234. this._entities_point = [];
  38235. }
  38236. clear() {
  38237. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38238. this.viewer.entities.remove(this._entities_point[i2]);
  38239. }
  38240. for (var i2 = 0; i2 < this._entities_AttackArrow.length; i2++) {
  38241. this.viewer.entities.remove(this._entities_AttackArrow[i2]);
  38242. }
  38243. this.floatingPoint = null;
  38244. this._AttackArrow = null;
  38245. this._AttackArrowLast = null;
  38246. this._positions = [];
  38247. this._entities_point = [];
  38248. this._entities_AttackArrow = [];
  38249. this._AttackArrowData = null;
  38250. }
  38251. getCatesian3FromPX(px) {
  38252. var cartesian;
  38253. var ray = this.viewer.camera.getPickRay(px);
  38254. if (!ray)
  38255. return null;
  38256. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  38257. return cartesian;
  38258. }
  38259. fineArrowDefualParam() {
  38260. return {
  38261. headHeightFactor: 0.18,
  38262. headWidthFactor: 0.3,
  38263. neckHeightFactor: 0.85,
  38264. neckWidthFactor: 0.15,
  38265. tailWidthFactor: 0.1,
  38266. headTailFactor: 0.8,
  38267. swallowTailFactor: 1
  38268. };
  38269. }
  38270. fineArrow(inputPoint) {
  38271. var $this = this;
  38272. inputPoint = $this.dereplication(inputPoint);
  38273. let tailWidthFactor = $this.fineArrowDefualParam().tailWidthFactor;
  38274. let swallowTailFactor = $this.fineArrowDefualParam().swallowTailFactor;
  38275. let swallowTailPnt = $this.fineArrowDefualParam().swallowTailPnt;
  38276. var result = {
  38277. controlPoint: null,
  38278. polygonalPoint: null
  38279. };
  38280. result.controlPoint = inputPoint;
  38281. var t2 = inputPoint.length;
  38282. if (!(2 > t2)) {
  38283. if (2 == inputPoint.length) {
  38284. result.polygonalPoint = inputPoint;
  38285. return result;
  38286. }
  38287. var o = inputPoint, e = o[0], r2 = o[1];
  38288. $this.isClockWise(o[0], o[1], o[2]) && (e = o[1], r2 = o[0]);
  38289. var n = $this.mid(e, r2), g = [n].concat(o.slice(2)), i2 = $this.getAttackArrowHeadPoints(g, e, r2, $this.fineArrowDefualParam()), s = i2[0], a = i2[4], l = $this.distance(e, r2), u = $this.getBaseLength(g), c = u * tailWidthFactor * swallowTailFactor;
  38290. swallowTailPnt = $this.getThirdPoint(g[1], g[0], 0, c, true);
  38291. var p = l / u, h2 = $this.getAttackArrowBodyPoints(g, s, a, p), t2 = h2.length, d2 = [e].concat(h2.slice(0, t2 / 2));
  38292. d2.push(s);
  38293. var f = [r2].concat(h2.slice(t2 / 2, t2));
  38294. var newArray = [];
  38295. f.push(a), d2 = $this.getQBSplinePoints(d2), f = $this.getQBSplinePoints(f), newArray = $this.array2Dto1D(d2.concat(i2, f.reverse(), [swallowTailPnt, d2[0]]));
  38296. result.polygonalPoint = $this.Cesium.Cartesian3.fromDegreesArray(newArray);
  38297. }
  38298. return result;
  38299. }
  38300. getArrowBodyPoints(t2, o, e, r2) {
  38301. var $this = this;
  38302. for (var n = $this.wholeDistance(t2), g = $this.getBaseLength(t2), i2 = g * r2, s = $this.distance(o, e), a = (i2 - s) / 2, l = 0, u = [], c = [], p = 1; p < t2.length - 1; p++) {
  38303. var h2 = $this.getAngleOfThreePoints(t2[p - 1], t2[p], t2[p + 1]) / 2;
  38304. l += $this.distance(t2[p - 1], t2[p]);
  38305. var d2 = (i2 / 2 - l / n * a) / Math.sin(h2), f = $this.getThirdPoint(t2[p - 1], t2[p], Math.PI - h2, d2, true), E2 = $this.getThirdPoint(t2[p - 1], t2[p], h2, d2, false);
  38306. u.push(f), c.push(E2);
  38307. }
  38308. return u.concat(c);
  38309. }
  38310. getAttackArrowHeadPoints(t2, o, e, defaultParam) {
  38311. var $this = this;
  38312. let headHeightFactor = defaultParam.headHeightFactor;
  38313. let headTailFactor = defaultParam.headTailFactor;
  38314. let headWidthFactor = defaultParam.headWidthFactor;
  38315. let neckWidthFactor = defaultParam.neckWidthFactor;
  38316. let neckHeightFactor = defaultParam.neckHeightFactor;
  38317. var r2 = $this.getBaseLength(t2), n = r2 * headHeightFactor, g = t2[t2.length - 1];
  38318. r2 = $this.distance(g, t2[t2.length - 2]);
  38319. var i2 = $this.distance(o, e);
  38320. n > i2 * headTailFactor && (n = i2 * headTailFactor);
  38321. var s = n * headWidthFactor, a = n * neckWidthFactor;
  38322. n = n > r2 ? r2 : n;
  38323. var l = n * neckHeightFactor, u = $this.getThirdPoint(t2[t2.length - 2], g, 0, n, true), c = $this.getThirdPoint(t2[t2.length - 2], g, 0, l, true), p = $this.getThirdPoint(g, u, Math.PI / 2, s, false), h2 = $this.getThirdPoint(g, u, Math.PI / 2, s, true), d2 = $this.getThirdPoint(g, c, Math.PI / 2, a, false), f = $this.getThirdPoint(g, c, Math.PI / 2, a, true);
  38324. return [d2, p, g, h2, f];
  38325. }
  38326. getAngleOfThreePoints(t2, o, e) {
  38327. var r2 = this.getAzimuth(o, t2) - this.getAzimuth(o, e);
  38328. return 0 > r2 ? r2 + Math.PI * 2 : r2;
  38329. }
  38330. dereplication(array) {
  38331. var last = array[array.length - 1];
  38332. var change = false;
  38333. var newArray = [];
  38334. newArray = array.filter(function(i2) {
  38335. if (i2[0] != last[0] && i2[1] != last[1]) {
  38336. return i2;
  38337. }
  38338. change = true;
  38339. });
  38340. if (change)
  38341. newArray.push(last);
  38342. return newArray;
  38343. }
  38344. getBaseLength(t2) {
  38345. return Math.pow(this.wholeDistance(t2), 0.99);
  38346. }
  38347. wholeDistance(t2) {
  38348. for (var o = 0, e = 0; e < t2.length - 1; e++)
  38349. o += this.distance(t2[e], t2[e + 1]);
  38350. return o;
  38351. }
  38352. distance(t2, o) {
  38353. return Math.sqrt(Math.pow(t2[0] - o[0], 2) + Math.pow(t2[1] - o[1], 2));
  38354. }
  38355. getThirdPoint(t2, o, e, r2, n) {
  38356. var g = this.getAzimuth(t2, o), i2 = n ? g + e : g - e, s = r2 * Math.cos(i2), a = r2 * Math.sin(i2);
  38357. return [o[0] + s, o[1] + a];
  38358. }
  38359. getAzimuth(t2, o) {
  38360. var e, r2 = Math.asin(Math.abs(o[1] - t2[1]) / this.distance(t2, o));
  38361. return o[1] >= t2[1] && o[0] >= t2[0] ? e = r2 + Math.PI : o[1] >= t2[1] && o[0] < t2[0] ? e = 2 * Math.PI - r2 : o[1] < t2[1] && o[0] < t2[0] ? e = r2 : o[1] < t2[1] && o[0] >= t2[0] && (e = Math.PI - r2), e;
  38362. }
  38363. isClockWise(t2, o, e) {
  38364. return (e[1] - t2[1]) * (o[0] - t2[0]) > (o[1] - t2[1]) * (e[0] - t2[0]);
  38365. }
  38366. mid(t2, o) {
  38367. return [(t2[0] + o[0]) / 2, (t2[1] + o[1]) / 2];
  38368. }
  38369. }
  38370. class DrawPincerArrow {
  38371. constructor(arg) {
  38372. this.viewer = arg.viewer;
  38373. this.Cesium = arg.Cesium;
  38374. this.floatingPoint = null;
  38375. this._PincerArrow = null;
  38376. this._PincerArrowLast = null;
  38377. this._positions = [];
  38378. this._entities_point = [];
  38379. this._entities_PincerArrow = [];
  38380. this._PincerArrowData = null;
  38381. this.DrawStartEvent = new Cesium.Event();
  38382. this.DrawEndEvent = new Cesium.Event();
  38383. this._tooltip = createTooltip(this.viewer.container);
  38384. this._param = {
  38385. id: "DrawStraightArrow",
  38386. polygonColor: "rgba(0,255,0,0.5)",
  38387. outlineColor: "rgba(255, 255, 255, 1)",
  38388. outlineWidth: 1
  38389. };
  38390. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  38391. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  38392. }
  38393. get PincerArrow() {
  38394. return this._PincerArrowLast;
  38395. }
  38396. getData() {
  38397. return this._PincerArrowData;
  38398. }
  38399. addload(data) {
  38400. var $this = this;
  38401. if (data.length < 3) {
  38402. return;
  38403. }
  38404. var res = $this.doubleArrow(data);
  38405. var returnData = res.polygonalPoint;
  38406. var arrowEntity = $this.viewer.entities.add({
  38407. Type: "DrawPincerArrow",
  38408. Position: data,
  38409. id: data.id || $this.objId,
  38410. polygon: {
  38411. hierarchy: new $this.Cesium.PolygonHierarchy(returnData),
  38412. show: true,
  38413. fill: true,
  38414. clampToGround: true,
  38415. material: $this.polygonMaterial
  38416. }
  38417. });
  38418. return arrowEntity;
  38419. }
  38420. computePosition(data) {
  38421. let $this = this;
  38422. var lnglatArr = [];
  38423. for (var i2 = 0; i2 < data.length; i2++) {
  38424. var lnglat = $this.cartesianToLatlng(data[i2]);
  38425. lnglatArr.push(lnglat);
  38426. }
  38427. $this._PincerArrowData = lnglatArr;
  38428. var res = $this.doubleArrow(lnglatArr);
  38429. var returnData = res.polygonalPoint;
  38430. return new $this.Cesium.PolygonHierarchy(returnData);
  38431. }
  38432. startCreate(drawType) {
  38433. if (isRuntimeApp()) {
  38434. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38435. }
  38436. var $this = this;
  38437. this.drawType = drawType;
  38438. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  38439. this.handler.setInputAction(function(evt) {
  38440. if (isRuntimeApp()) {
  38441. var cartesian = $this.getCatesian3FromPX(evt.position);
  38442. if (!cartesian) {
  38443. return;
  38444. }
  38445. $this.createPoint(cartesian);
  38446. $this._positions.push(cartesian);
  38447. if ($this._positions.length < 3 || $this._positions.length === 4) {
  38448. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38449. }
  38450. if ($this._positions.length === 2) {
  38451. if (!$this.Cesium.defined($this._PincerArrow)) {
  38452. $this._PincerArrow = $this.createPincerArrow();
  38453. }
  38454. }
  38455. if ($this._positions.length === 3) {
  38456. $this._positions.pop();
  38457. $this._positions.push(cartesian);
  38458. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  38459. createOperationMainDom();
  38460. document.getElementById("btnDrawBackout").style.display = "none";
  38461. document.getElementById("btnDrawComplete").onclick = () => {
  38462. $this._PincerArrowData = $this._positions.concat();
  38463. $this.viewer.entities.remove($this._PincerArrow);
  38464. $this._PincerArrow = null;
  38465. $this._positions = [];
  38466. var lnglatArr = [];
  38467. for (var i2 = 0; i2 < $this._PincerArrowData.length; i2++) {
  38468. var lnglat = $this.cartesianToLatlng($this._PincerArrowData[i2]);
  38469. lnglatArr.push(lnglat);
  38470. }
  38471. $this._PincerArrowData = lnglatArr;
  38472. var pincerArrow = $this.addload(lnglatArr);
  38473. $this._entities_PincerArrow.push(pincerArrow);
  38474. $this._PincerArrowLast = pincerArrow;
  38475. $this.clearPoint();
  38476. $this.destroy();
  38477. let buttonDiv = document.getElementById("drawButtonDiv");
  38478. if (buttonDiv) {
  38479. document.body.removeChild(buttonDiv);
  38480. }
  38481. };
  38482. }
  38483. if ($this._positions.length === 5) {
  38484. showTooltipMessage("\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  38485. $this.destroy();
  38486. }
  38487. } else {
  38488. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  38489. clearTimeout($this._timer);
  38490. $this._timer = setTimeout(function() {
  38491. var cartesian2 = $this.getCatesian3FromPX(evt.position);
  38492. if (!cartesian2) {
  38493. return;
  38494. }
  38495. if ($this._positions.length == 0) {
  38496. $this.floatingPoint = $this.createPoint(cartesian2);
  38497. }
  38498. if ($this._positions.length < 5) {
  38499. $this._positions.push(cartesian2);
  38500. $this.createPoint(cartesian2);
  38501. }
  38502. if ($this._positions.length == 5) {
  38503. $this._positions[4] = cartesian2;
  38504. $this.floatingPoint.position.setValue(cartesian2);
  38505. }
  38506. }, 200);
  38507. }
  38508. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  38509. this.handler.setInputAction(function(evt) {
  38510. if (isRuntimeApp())
  38511. return;
  38512. if ($this._positions.length == 0) {
  38513. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38514. } else {
  38515. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38516. }
  38517. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  38518. if (!cartesian)
  38519. return;
  38520. if ($this._positions.length < 2)
  38521. return;
  38522. if (!$this.Cesium.defined($this._PincerArrow)) {
  38523. if ($this._positions.length == 2) {
  38524. $this._positions.push(cartesian);
  38525. }
  38526. $this._PincerArrow = $this.createPincerArrow();
  38527. }
  38528. $this.floatingPoint.position.setValue(cartesian);
  38529. if ($this._positions.length == 3) {
  38530. $this._positions[2] = cartesian;
  38531. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  38532. }
  38533. if ($this._positions.length > 3) {
  38534. $this._positions.pop();
  38535. $this._positions.push(cartesian);
  38536. if ($this._positions === 4) {
  38537. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38538. }
  38539. if ($this._positions.length == 5) {
  38540. $this._tooltip.showAt(evt.endPosition, "\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  38541. }
  38542. }
  38543. console.log($this._positions.length);
  38544. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  38545. this.handler.setInputAction(function(evt) {
  38546. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  38547. this.handler.setInputAction(function(evt) {
  38548. if (isRuntimeApp())
  38549. return;
  38550. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u53CC\u51FB");
  38551. clearTimeout($this._timer);
  38552. if (!$this._PincerArrow) {
  38553. return;
  38554. }
  38555. var cartesian = $this.getCatesian3FromPX(evt.position);
  38556. if (!cartesian)
  38557. return;
  38558. $this._positions.pop();
  38559. $this._PincerArrowData = $this._positions.concat();
  38560. $this.viewer.entities.remove($this._PincerArrow);
  38561. $this._PincerArrow = null;
  38562. $this._positions = [];
  38563. $this.floatingPoint.position.setValue(cartesian);
  38564. var lnglatArr = [];
  38565. for (var i2 = 0; i2 < $this._PincerArrowData.length; i2++) {
  38566. var lnglat = $this.cartesianToLatlng($this._PincerArrowData[i2]);
  38567. lnglatArr.push(lnglat);
  38568. }
  38569. $this._PincerArrowData = lnglatArr;
  38570. var pincerArrow = $this.addload(lnglatArr);
  38571. $this._entities_PincerArrow.push(pincerArrow);
  38572. $this._PincerArrowLast = pincerArrow;
  38573. $this.clearPoint();
  38574. $this.destroy();
  38575. $this._tooltip.setVisible(false);
  38576. }, $this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  38577. }
  38578. createPincerArrow() {
  38579. var $this = this;
  38580. $this._computeTempPositions();
  38581. var arrowEntity = $this.viewer.entities.add({
  38582. polygon: {
  38583. hierarchy: new $this.Cesium.CallbackProperty(
  38584. function() {
  38585. var lnglatArr = [];
  38586. for (var i2 = 0; i2 < $this._positions.length; i2++) {
  38587. var lnglat = $this.cartesianToLatlng($this._positions[i2]);
  38588. lnglatArr.push(lnglat);
  38589. }
  38590. var res = $this.doubleArrow(lnglatArr);
  38591. var returnData = res.polygonalPoint;
  38592. return new $this.Cesium.PolygonHierarchy(returnData);
  38593. },
  38594. false
  38595. ),
  38596. show: true,
  38597. fill: true,
  38598. clampToGround: true,
  38599. material: $this.polygonMaterial
  38600. }
  38601. });
  38602. $this._entities_PincerArrow.push(arrowEntity);
  38603. return arrowEntity;
  38604. }
  38605. createPoint(cartesian) {
  38606. var $this = this;
  38607. var point2 = this.viewer.entities.add({
  38608. position: cartesian,
  38609. point: {
  38610. pixelSize: 10,
  38611. color: $this.Cesium.Color.RED,
  38612. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  38613. }
  38614. });
  38615. $this._entities_point.push(point2);
  38616. return point2;
  38617. }
  38618. cartesianToLatlng(cartesian) {
  38619. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  38620. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  38621. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  38622. let alt = cartographic.height;
  38623. return [lng, lat, alt];
  38624. }
  38625. destroy() {
  38626. if (this.handler) {
  38627. this.handler.destroy();
  38628. this.handler = null;
  38629. }
  38630. }
  38631. clearPoint() {
  38632. this.DrawEndEvent.raiseEvent(this._PincerArrowLast, this._PincerArrowData, this.drawType);
  38633. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38634. this.viewer.entities.remove(this._entities_point[i2]);
  38635. }
  38636. this._entities_point = [];
  38637. }
  38638. clear() {
  38639. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  38640. this.viewer.entities.remove(this._entities_point[i2]);
  38641. }
  38642. for (var i2 = 0; i2 < this._entities_PincerArrow.length; i2++) {
  38643. this.viewer.entities.remove(this._entities_PincerArrow[i2]);
  38644. }
  38645. this.floatingPoint = null;
  38646. this._PincerArrow = null;
  38647. this._PincerArrowLast = null;
  38648. this._positions = [];
  38649. this._entities_point = [];
  38650. this._entities_PincerArrow = [];
  38651. this._PincerArrowData = null;
  38652. }
  38653. getCatesian3FromPX(px) {
  38654. var cartesian;
  38655. var ray = this.viewer.camera.getPickRay(px);
  38656. if (!ray)
  38657. return null;
  38658. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  38659. return cartesian;
  38660. }
  38661. _computeTempPositions() {
  38662. var _this = this;
  38663. var pnts = [].concat(_this._positions);
  38664. var num = pnts.length;
  38665. var first = pnts[0];
  38666. var last = pnts[num - 1];
  38667. if (_this._isSimpleXYZ(first, last) == false) {
  38668. pnts.push(first);
  38669. num += 1;
  38670. }
  38671. _this.tempPositions = [];
  38672. for (var i2 = 1; i2 < num; i2++) {
  38673. var p1 = pnts[i2 - 1];
  38674. var p2 = pnts[i2];
  38675. var cp = _this._computeCenterPotition(p1, p2);
  38676. _this.tempPositions.push(p1);
  38677. _this.tempPositions.push(cp);
  38678. }
  38679. }
  38680. _isSimpleXYZ(p1, p2) {
  38681. if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
  38682. return true;
  38683. }
  38684. return false;
  38685. }
  38686. _computeCenterPotition(p1, p2) {
  38687. var _this = this;
  38688. var c1 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p1);
  38689. var c2 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p2);
  38690. var cm = new _this.Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5);
  38691. var cp = _this.viewer.scene.globe.ellipsoid.cartographicToCartesian(cm);
  38692. return cp;
  38693. }
  38694. doubleArrow(inputPoint) {
  38695. var $this = this;
  38696. this.connPoint = null;
  38697. this.tempPoint4 = null;
  38698. this.points = inputPoint;
  38699. var result = {
  38700. controlPoint: null,
  38701. polygonalPoint: null
  38702. };
  38703. var t2 = inputPoint.length;
  38704. if (!(2 > t2)) {
  38705. if (2 == t2)
  38706. return inputPoint;
  38707. var o = this.points[0], e = this.points[1], r2 = this.points[2], t2 = inputPoint.length;
  38708. 3 == t2 ? this.tempPoint4 = $this.getTempPoint4(o, e, r2) : this.tempPoint4 = this.points[3], 3 == t2 || 4 == t2 ? this.connPoint = $this.mid(o, e) : this.connPoint = this.points[4];
  38709. var n, g;
  38710. $this.isClockWise(o, e, r2) ? (n = $this.getArrowPoints(o, this.connPoint, this.tempPoint4, false), g = $this.getArrowPoints(this.connPoint, e, r2, true)) : (n = $this.getArrowPoints(e, this.connPoint, r2, false), g = $this.getArrowPoints(this.connPoint, o, this.tempPoint4, true));
  38711. var i2 = n.length, s = (i2 - 5) / 2, a = n.slice(0, s), l = n.slice(s, s + 5), u = n.slice(s + 5, i2), c = g.slice(0, s), p = g.slice(s, s + 5), h2 = g.slice(s + 5, i2);
  38712. c = $this.getBezierPoints(c);
  38713. var d2 = $this.getBezierPoints(h2.concat(a.slice(1)));
  38714. u = $this.getBezierPoints(u);
  38715. var f = c.concat(p, d2, l, u);
  38716. var newArray = $this.array2Dto1D(f);
  38717. result.controlPoint = [o, e, r2, this.tempPoint4, this.connPoint];
  38718. result.polygonalPoint = $this.Cesium.Cartesian3.fromDegreesArray(newArray);
  38719. }
  38720. return result;
  38721. }
  38722. getTempPoint4(t2, o, e) {
  38723. var $this = this;
  38724. var r2, n, g, i2, s = $this.mid(t2, o), a = $this.distance(s, e), l = $this.getAngleOfThreePoints(t2, s, e);
  38725. return l < Math.PI / 2 ? (n = a * Math.sin(l), g = a * Math.cos(l), i2 = $this.getThirdPoint(t2, s, Math.PI / 2, n, false), r2 = $this.getThirdPoint(s, i2, Math.PI / 2, g, true)) : l >= Math.PI / 2 && l < Math.PI ? (n = a * Math.sin(Math.PI - l), g = a * Math.cos(Math.PI - l), i2 = $this.getThirdPoint(t2, s, Math.PI / 2, n, false), r2 = $this.getThirdPoint(s, i2, Math.PI / 2, g, false)) : l >= Math.PI && l < 1.5 * Math.PI ? (n = a * Math.sin(l - Math.PI), g = a * Math.cos(l - Math.PI), i2 = $this.getThirdPoint(t2, s, Math.PI / 2, n, true), r2 = $this.getThirdPoint(s, i2, Math.PI / 2, g, true)) : (n = a * Math.sin(2 * Math.PI - l), g = a * Math.cos(2 * Math.PI - l), i2 = $this.getThirdPoint(t2, s, Math.PI / 2, n, true), r2 = $this.getThirdPoint(s, i2, Math.PI / 2, g, false)), r2;
  38726. }
  38727. mid(t2, o) {
  38728. return [(t2[0] + o[0]) / 2, (t2[1] + o[1]) / 2];
  38729. }
  38730. isClockWise(t2, o, e) {
  38731. return (e[1] - t2[1]) * (o[0] - t2[0]) > (o[1] - t2[1]) * (e[0] - t2[0]);
  38732. }
  38733. getArrowPoints(t2, o, e, r2) {
  38734. var $this = this;
  38735. var doubleArrowDefualParam = {
  38736. type: "doublearrow",
  38737. headHeightFactor: 0.25,
  38738. headWidthFactor: 0.3,
  38739. neckHeightFactor: 0.85,
  38740. fixPointCount: 4,
  38741. neckWidthFactor: 0.15
  38742. };
  38743. this.type = doubleArrowDefualParam.type, this.headHeightFactor = doubleArrowDefualParam.headHeightFactor, this.headWidthFactor = doubleArrowDefualParam.headWidthFactor, this.neckHeightFactor = doubleArrowDefualParam.neckHeightFactor, this.neckWidthFactor = doubleArrowDefualParam.neckWidthFactor;
  38744. var n = $this.mid(t2, o), g = $this.distance(n, e), i2 = $this.getThirdPoint(e, n, 0, 0.3 * g, true), s = $this.getThirdPoint(e, n, 0, 0.5 * g, true);
  38745. i2 = $this.getThirdPoint(n, i2, Math.PI / 2, g / 5, r2), s = $this.getThirdPoint(n, s, Math.PI / 2, g / 4, r2);
  38746. var a = [n, i2, s, e], l = $this.getArrowHeadPoints(a, this.headHeightFactor, this.headWidthFactor, this.neckHeightFactor, this.neckWidthFactor), u = l[0], c = l[4], p = $this.distance(t2, o) / $this.getBaseLength(a) / 2, h2 = $this.getArrowBodyPoints(a, u, c, p), d2 = h2.length, f = h2.slice(0, d2 / 2), E2 = h2.slice(d2 / 2, d2);
  38747. return f.push(u), E2.push(c), f = f.reverse(), f.push(o), E2 = E2.reverse(), E2.push(t2), f.reverse().concat(l, E2);
  38748. }
  38749. getArrowHeadPoints(t2, o, e) {
  38750. var $this = this;
  38751. var doubleArrowDefualParam = {
  38752. type: "doublearrow",
  38753. headHeightFactor: 0.25,
  38754. headWidthFactor: 0.3,
  38755. neckHeightFactor: 0.85,
  38756. fixPointCount: 4,
  38757. neckWidthFactor: 0.15
  38758. };
  38759. this.type = doubleArrowDefualParam.type, this.headHeightFactor = doubleArrowDefualParam.headHeightFactor, this.headWidthFactor = doubleArrowDefualParam.headWidthFactor, this.neckHeightFactor = doubleArrowDefualParam.neckHeightFactor, this.neckWidthFactor = doubleArrowDefualParam.neckWidthFactor;
  38760. var r2 = $this.getBaseLength(t2), n = r2 * this.headHeightFactor, g = t2[t2.length - 1], i2 = ($this.distance(o, e), n * this.headWidthFactor), s = n * this.neckWidthFactor, a = n * this.neckHeightFactor, l = $this.getThirdPoint(t2[t2.length - 2], g, 0, n, true), u = $this.getThirdPoint(t2[t2.length - 2], g, 0, a, true), c = $this.getThirdPoint(g, l, Math.PI / 2, i2, false), p = $this.getThirdPoint(g, l, Math.PI / 2, i2, true), h2 = $this.getThirdPoint(g, u, Math.PI / 2, s, false), d2 = $this.getThirdPoint(g, u, Math.PI / 2, s, true);
  38761. return [h2, c, g, p, d2];
  38762. }
  38763. getArrowBodyPoints(t2, o, e, r2) {
  38764. var $this = this;
  38765. for (var n = $this.wholeDistance(t2), g = $this.getBaseLength(t2), i2 = g * r2, s = $this.distance(o, e), a = (i2 - s) / 2, l = 0, u = [], c = [], p = 1; p < t2.length - 1; p++) {
  38766. var h2 = $this.getAngleOfThreePoints(t2[p - 1], t2[p], t2[p + 1]) / 2;
  38767. l += $this.distance(t2[p - 1], t2[p]);
  38768. var d2 = (i2 / 2 - l / n * a) / Math.sin(h2), f = $this.getThirdPoint(t2[p - 1], t2[p], Math.PI - h2, d2, true), E2 = $this.getThirdPoint(t2[p - 1], t2[p], h2, d2, false);
  38769. u.push(f), c.push(E2);
  38770. }
  38771. return u.concat(c);
  38772. }
  38773. getBezierPoints(t2) {
  38774. if (t2.length <= 2)
  38775. return t2;
  38776. for (var o = [], e = t2.length - 1, r2 = 0; 1 >= r2; r2 += 0.01) {
  38777. for (var n = 0, y = 0, g = 0; e >= g; g++) {
  38778. var i2 = this.getBinomialFactor(e, g), s = Math.pow(r2, g), a = Math.pow(1 - r2, e - g);
  38779. n += i2 * s * a * t2[g][0], y += i2 * s * a * t2[g][1];
  38780. }
  38781. o.push([n, y]);
  38782. }
  38783. return o.push(t2[e]), o;
  38784. }
  38785. getBaseLength(t2) {
  38786. return Math.pow(this.wholeDistance(t2), 0.99);
  38787. }
  38788. wholeDistance(t2) {
  38789. for (var o = 0, e = 0; e < t2.length - 1; e++)
  38790. o += this.distance(t2[e], t2[e + 1]);
  38791. return o;
  38792. }
  38793. getBinomialFactor(t2, o) {
  38794. return this.getFactorial(t2) / (this.getFactorial(o) * this.getFactorial(t2 - o));
  38795. }
  38796. getFactorial(t2) {
  38797. if (1 >= t2)
  38798. return 1;
  38799. if (2 == t2)
  38800. return 2;
  38801. if (3 == t2)
  38802. return 6;
  38803. if (4 == t2)
  38804. return 24;
  38805. if (5 == t2)
  38806. return 120;
  38807. for (var o = 1, e = 1; t2 >= e; e++)
  38808. o *= e;
  38809. return o;
  38810. }
  38811. array2Dto1D(array) {
  38812. var newArray = [];
  38813. array.forEach(function(elt) {
  38814. newArray.push(elt[0]);
  38815. newArray.push(elt[1]);
  38816. });
  38817. return newArray;
  38818. }
  38819. distance(t2, o) {
  38820. return Math.sqrt(Math.pow(t2[0] - o[0], 2) + Math.pow(t2[1] - o[1], 2));
  38821. }
  38822. getAngleOfThreePoints(t2, o, e) {
  38823. var r2 = this.getAzimuth(o, t2) - this.getAzimuth(o, e);
  38824. return 0 > r2 ? r2 + 2 * Math.PI : r2;
  38825. }
  38826. getAzimuth(t2, o) {
  38827. var e, r2 = Math.asin(Math.abs(o[1] - t2[1]) / this.distance(t2, o));
  38828. return o[1] >= t2[1] && o[0] >= t2[0] ? e = r2 + Math.PI : o[1] >= t2[1] && o[0] < t2[0] ? e = 2 * Math.PI - r2 : o[1] < t2[1] && o[0] < t2[0] ? e = r2 : o[1] < t2[1] && o[0] >= t2[0] && (e = Math.PI - r2), e;
  38829. }
  38830. getThirdPoint(t2, o, e, r2, n) {
  38831. var g = this.getAzimuth(t2, o), i2 = n ? g + e : g - e, s = r2 * Math.cos(i2), a = r2 * Math.sin(i2);
  38832. return [o[0] + s, o[1] + a];
  38833. }
  38834. }
  38835. class DrawGatheringPlace {
  38836. constructor(arg) {
  38837. this.viewer = arg.viewer;
  38838. this.Cesium = arg.Cesium;
  38839. this.tt = 0.4;
  38840. this.floatingPoint = null;
  38841. this.drawHandler = null;
  38842. this.gatheringPlace = null;
  38843. this._gatheringPlaceLast = null;
  38844. this._positions = [];
  38845. this._entities_point = [];
  38846. this._entities_PincerArrow = [];
  38847. this._gatheringPlaceData = null;
  38848. this.DrawStartEvent = new Cesium.Event();
  38849. this.DrawEndEvent = new Cesium.Event();
  38850. this._tooltip = createTooltip(this.viewer.container);
  38851. this._param = {
  38852. id: "DrawStraightArrow",
  38853. polygonColor: "rgba(0,255,0,0.5)",
  38854. outlineColor: "rgba(255, 255, 255, 1)",
  38855. outlineWidth: 1
  38856. };
  38857. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  38858. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  38859. }
  38860. get PincerArrow() {
  38861. return this._gatheringPlaceLast;
  38862. }
  38863. getData() {
  38864. return this._gatheringPlaceData;
  38865. }
  38866. computePosition(data) {
  38867. var $this = this;
  38868. if (data.length < 3) {
  38869. return;
  38870. }
  38871. var gatheringPlace = [];
  38872. var lonLats = [];
  38873. var res = $this.fineGatheringPlace(data);
  38874. for (var i2 = 0; i2 < res.length; i2++) {
  38875. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  38876. gatheringPlace.push(cart3);
  38877. }
  38878. for (let q2 = 0; q2 < data.length; q2++) {
  38879. lonLats.push($this.cartesianToLatlng(data[q2]));
  38880. }
  38881. this._gatheringPlaceData = lonLats;
  38882. return new $this.Cesium.PolygonHierarchy(gatheringPlace);
  38883. }
  38884. addload(data) {
  38885. var $this = this;
  38886. if (data.length < 3) {
  38887. return;
  38888. }
  38889. var gatheringPlace = [];
  38890. var lnglatArr = [];
  38891. for (var i2 = 0; i2 < data.length; i2++) {
  38892. var lnglat = $this.LatlngTocartesian(data[i2]);
  38893. lnglatArr.push(lnglat);
  38894. }
  38895. var res = $this.fineGatheringPlace(lnglatArr);
  38896. for (var i2 = 0; i2 < res.length; i2++) {
  38897. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  38898. gatheringPlace.push(cart3);
  38899. }
  38900. var pHierarchy = new $this.Cesium.PolygonHierarchy(gatheringPlace);
  38901. var arrowEntity = $this.viewer.entities.add({
  38902. Type: "DrawGatheringPlace",
  38903. Position: data,
  38904. id: data.id || $this.objId,
  38905. polygon: {
  38906. hierarchy: pHierarchy,
  38907. show: true,
  38908. fill: true,
  38909. clampToGround: true,
  38910. material: $this.polygonMaterial
  38911. }
  38912. });
  38913. return arrowEntity;
  38914. }
  38915. startCreate(drawType) {
  38916. if (isRuntimeApp()) {
  38917. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38918. }
  38919. var $this = this;
  38920. this.drawType = drawType;
  38921. this.handler = new $this.Cesium.ScreenSpaceEventHandler($this.viewer.scene.canvas);
  38922. this.handler.setInputAction(function(event2) {
  38923. if (isRuntimeApp()) {
  38924. var cartesian = $this.getCatesian3FromPX(event2.position);
  38925. if (!cartesian) {
  38926. return;
  38927. }
  38928. $this.createPoint(cartesian);
  38929. $this._positions.push(cartesian);
  38930. if ($this._positions.length < 3) {
  38931. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38932. }
  38933. if ($this._positions.length === 3) {
  38934. showTooltipMessage("\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  38935. $this.destroy();
  38936. if (!$this.Cesium.defined($this.gatheringPlace)) {
  38937. $this.gatheringPlace = $this.createGatheringPlace();
  38938. createOperationMainDom();
  38939. document.getElementById("btnDrawBackout").style.display = "none";
  38940. document.getElementById("btnDrawComplete").onclick = () => {
  38941. $this._gatheringPlaceData = $this._positions.concat();
  38942. $this.viewer.entities.remove($this.gatheringPlace);
  38943. $this.gatheringPlace = null;
  38944. var lnglatArr = [];
  38945. for (var i2 = 0; i2 < $this._gatheringPlaceData.length; i2++) {
  38946. var lnglat = $this.cartesianToLatlng($this._gatheringPlaceData[i2]);
  38947. lnglatArr.push(lnglat);
  38948. }
  38949. $this._gatheringPlaceData = lnglatArr;
  38950. var pincerArrow = $this.addload(lnglatArr);
  38951. $this._entities_PincerArrow.push(pincerArrow);
  38952. $this._gatheringPlaceLast = pincerArrow;
  38953. $this.viewer.entities.remove($this.floatingPoint);
  38954. $this.floatingPoint = null;
  38955. $this.clearPoint();
  38956. $this.destroy();
  38957. let buttonDiv = document.getElementById("drawButtonDiv");
  38958. if (buttonDiv) {
  38959. document.body.removeChild(buttonDiv);
  38960. }
  38961. };
  38962. }
  38963. }
  38964. } else {
  38965. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  38966. clearTimeout($this._timer);
  38967. $this._timer = setTimeout(function() {
  38968. var position2 = event2.position;
  38969. if (!$this.Cesium.defined(position2)) {
  38970. return;
  38971. }
  38972. var ray = $this.viewer.camera.getPickRay(position2);
  38973. if (!$this.Cesium.defined(ray)) {
  38974. return;
  38975. }
  38976. var cartesian2 = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  38977. if (!$this.Cesium.defined(cartesian2)) {
  38978. return;
  38979. }
  38980. if ($this._positions.length == 0) {
  38981. $this._positions.push(cartesian2.clone());
  38982. $this.floatingPoint = $this.createPoint(cartesian2);
  38983. }
  38984. if ($this._positions.length <= 2) {
  38985. $this.createPoint(cartesian2);
  38986. $this._positions.push(cartesian2);
  38987. }
  38988. }, 200);
  38989. }
  38990. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  38991. this.handler.setInputAction(function(event2) {
  38992. if (isRuntimeApp())
  38993. return;
  38994. if ($this._positions.length == 0) {
  38995. $this._tooltip.showAt(event2.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  38996. } else {
  38997. $this._tooltip.showAt(event2.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  38998. }
  38999. if ($this._positions.length < 2) {
  39000. return;
  39001. }
  39002. if ($this._positions.length == 3) {
  39003. $this._tooltip.showAt(event2.endPosition, "\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  39004. }
  39005. var position2 = event2.endPosition;
  39006. if (!$this.Cesium.defined(position2)) {
  39007. return;
  39008. }
  39009. var ray = $this.viewer.camera.getPickRay(position2);
  39010. if (!$this.Cesium.defined(ray)) {
  39011. return;
  39012. }
  39013. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  39014. if (!$this.Cesium.defined(cartesian)) {
  39015. return;
  39016. }
  39017. if (!$this.Cesium.defined($this.gatheringPlace)) {
  39018. $this.gatheringPlace = $this.createGatheringPlace();
  39019. }
  39020. $this.floatingPoint.position.setValue(cartesian);
  39021. if ($this.gatheringPlace) {
  39022. if ($this._positions.length == 3) {
  39023. $this._positions[1] = cartesian;
  39024. } else {
  39025. $this._positions.pop();
  39026. $this._positions.push(cartesian);
  39027. }
  39028. }
  39029. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  39030. this.handler.setInputAction(function(movement) {
  39031. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  39032. this.handler.setInputAction(function(movement) {
  39033. if (isRuntimeApp())
  39034. return;
  39035. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u53CC\u51FB");
  39036. clearTimeout($this._timer);
  39037. if ($this._positions.length >= 3) {
  39038. $this._gatheringPlaceData = $this._positions.concat();
  39039. $this.viewer.entities.remove($this.gatheringPlace);
  39040. $this.gatheringPlace = null;
  39041. var lnglatArr = [];
  39042. for (var i2 = 0; i2 < $this._gatheringPlaceData.length; i2++) {
  39043. var lnglat = $this.cartesianToLatlng($this._gatheringPlaceData[i2]);
  39044. lnglatArr.push(lnglat);
  39045. }
  39046. $this._gatheringPlaceData = lnglatArr;
  39047. var pincerArrow = $this.addload(lnglatArr);
  39048. $this._entities_PincerArrow.push(pincerArrow);
  39049. $this._gatheringPlaceLast = pincerArrow;
  39050. $this.viewer.entities.remove($this.floatingPoint);
  39051. $this.floatingPoint = null;
  39052. $this.clearPoint();
  39053. $this.destroy();
  39054. $this._tooltip.setVisible(false);
  39055. }
  39056. }, Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  39057. }
  39058. createGatheringPlace() {
  39059. let $this = this;
  39060. var gatheringPlaceEntity = $this.viewer.entities.add({
  39061. polygon: {
  39062. hierarchy: new $this.Cesium.CallbackProperty(function() {
  39063. if ($this._positions.length < 3) {
  39064. return;
  39065. }
  39066. var gatheringPlace = [];
  39067. var res = $this.fineGatheringPlace($this._positions);
  39068. for (var i2 = 0; i2 < res.length; i2++) {
  39069. var cart3 = new $this.Cesium.Cartesian3(res[i2].x, res[i2].y, res[i2].z);
  39070. gatheringPlace.push(cart3);
  39071. }
  39072. var pHierarchy = new $this.Cesium.PolygonHierarchy(gatheringPlace);
  39073. var lonLats = $this.cartesianToLatlng($this._positions);
  39074. pHierarchy.keyPoints = lonLats;
  39075. return pHierarchy;
  39076. }, false),
  39077. show: true,
  39078. fill: true,
  39079. clampToGround: true,
  39080. material: $this.polygonMaterial
  39081. }
  39082. });
  39083. $this._entities_PincerArrow.push(gatheringPlaceEntity);
  39084. return gatheringPlaceEntity;
  39085. }
  39086. createPoint(cartesian) {
  39087. var $this = this;
  39088. var point2 = this.viewer.entities.add({
  39089. position: cartesian,
  39090. point: {
  39091. pixelSize: 10,
  39092. color: $this.Cesium.Color.RED,
  39093. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  39094. }
  39095. });
  39096. $this._entities_point.push(point2);
  39097. return point2;
  39098. }
  39099. cartesianToLatlng(cartesian) {
  39100. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  39101. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  39102. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  39103. let alt = cartographic.height;
  39104. return [lng, lat, alt];
  39105. }
  39106. destroy() {
  39107. if (this.handler) {
  39108. this.handler.destroy();
  39109. this.handler = null;
  39110. }
  39111. }
  39112. clearPoint() {
  39113. this.DrawEndEvent.raiseEvent(this._gatheringPlaceLast, this._gatheringPlaceData, this.drawType);
  39114. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39115. this.viewer.entities.remove(this._entities_point[i2]);
  39116. }
  39117. this._entities_point = [];
  39118. }
  39119. clear() {
  39120. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39121. this.viewer.entities.remove(this._entities_point[i2]);
  39122. }
  39123. for (var i2 = 0; i2 < this._entities_PincerArrow.length; i2++) {
  39124. this.viewer.entities.remove(this._entities_PincerArrow[i2]);
  39125. }
  39126. this.floatingPoint = null;
  39127. this._PincerArrow = null;
  39128. this._PincerArrowLast = null;
  39129. this._positions = [];
  39130. this._entities_point = [];
  39131. this._entities_PincerArrow = [];
  39132. this._PincerArrowData = null;
  39133. }
  39134. getCatesian3FromPX(px) {
  39135. var cartesian;
  39136. var ray = this.viewer.camera.getPickRay(px);
  39137. if (!ray)
  39138. return null;
  39139. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  39140. return cartesian;
  39141. }
  39142. _computeTempPositions() {
  39143. var _this = this;
  39144. var pnts = [].concat(_this._positions);
  39145. var num = pnts.length;
  39146. var first = pnts[0];
  39147. var last = pnts[num - 1];
  39148. if (_this._isSimpleXYZ(first, last) == false) {
  39149. pnts.push(first);
  39150. num += 1;
  39151. }
  39152. _this.tempPositions = [];
  39153. for (var i2 = 1; i2 < num; i2++) {
  39154. var p1 = pnts[i2 - 1];
  39155. var p2 = pnts[i2];
  39156. var cp = _this._computeCenterPotition(p1, p2);
  39157. _this.tempPositions.push(p1);
  39158. _this.tempPositions.push(cp);
  39159. }
  39160. }
  39161. _isSimpleXYZ(p1, p2) {
  39162. if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
  39163. return true;
  39164. }
  39165. return false;
  39166. }
  39167. _computeCenterPotition(p1, p2) {
  39168. var _this = this;
  39169. var c1 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p1);
  39170. var c2 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p2);
  39171. var cm = new _this.Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5);
  39172. var cp = _this.viewer.scene.globe.ellipsoid.cartographicToCartesian(cm);
  39173. return cp;
  39174. }
  39175. getLonLat(cartesian) {
  39176. var cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  39177. cartographic.height = this.viewer.scene.globe.getHeight(cartographic);
  39178. var pos = {
  39179. lon: cartographic.longitude,
  39180. lat: cartographic.latitude,
  39181. alt: cartographic.height
  39182. };
  39183. pos.lon = this.Cesium.Math.toDegrees(pos.lon);
  39184. pos.lat = this.Cesium.Math.toDegrees(pos.lat);
  39185. return pos;
  39186. }
  39187. LatlngTocartesian(latlng) {
  39188. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  39189. return cartesian3;
  39190. }
  39191. fineGatheringPlace(gatherPosition) {
  39192. let $this = this;
  39193. let points2 = gatherPosition.length;
  39194. if (points2 < 2) {
  39195. return false;
  39196. } else {
  39197. let pnts = new Array();
  39198. gatherPosition.forEach(function(item) {
  39199. var posLonLat = $this.getLonLat(item);
  39200. pnts.push([posLonLat.lon, posLonLat.lat]);
  39201. });
  39202. if (pnts.length === 2) {
  39203. let mid2 = $this.mid(pnts[0], pnts[1]);
  39204. let d2 = $this.distance(pnts[0], mid2) / 0.9;
  39205. let pnt = $this.getThirdPoint(pnts[0], mid2, Math.PI / 2, d2, true);
  39206. pnts = [pnts[0], pnt, pnts[1]];
  39207. }
  39208. let mid = $this.mid(pnts[0], pnts[2]);
  39209. pnts.push(mid, pnts[0], pnts[1]);
  39210. let [normals, pnt1, pnt2, pnt3, pList] = [
  39211. [],
  39212. void 0,
  39213. void 0,
  39214. void 0,
  39215. []
  39216. ];
  39217. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39218. pnt1 = pnts[i2];
  39219. pnt2 = pnts[i2 + 1];
  39220. pnt3 = pnts[i2 + 2];
  39221. let normalPoints = $this.getBisectorNormals($this.tt, pnt1, pnt2, pnt3);
  39222. normals = normals.concat(normalPoints);
  39223. }
  39224. let count = normals.length;
  39225. normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
  39226. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39227. pnt1 = pnts[i2];
  39228. pnt2 = pnts[i2 + 1];
  39229. pList = pList.concat(pnt1);
  39230. for (let t2 = 0; t2 <= 100; t2++) {
  39231. let pnt = $this.getCubicValue(t2 / 100, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  39232. pList = pList.concat(pnt);
  39233. }
  39234. pList = pList.concat(pnt2);
  39235. }
  39236. return Cesium.Cartesian3.fromDegreesArray(pList);
  39237. }
  39238. }
  39239. mid(t2, o) {
  39240. return [(t2[0] + o[0]) / 2, (t2[1] + o[1]) / 2];
  39241. }
  39242. distance(t2, o) {
  39243. return Math.sqrt(Math.pow(t2[0] - o[0], 2) + Math.pow(t2[1] - o[1], 2));
  39244. }
  39245. getThirdPoint(t2, o, e, r2, n) {
  39246. var g = this.getAzimuth(t2, o), i2 = n ? g + e : g - e, s = r2 * Math.cos(i2), a = r2 * Math.sin(i2);
  39247. return [o[0] + s, o[1] + a];
  39248. }
  39249. getAzimuth(t2, o) {
  39250. var e, r2 = Math.asin(Math.abs(o[1] - t2[1]) / this.distance(t2, o));
  39251. return o[1] >= t2[1] && o[0] >= t2[0] ? e = r2 + Math.PI : o[1] >= t2[1] && o[0] < t2[0] ? e = 2 * Math.PI - r2 : o[1] < t2[1] && o[0] < t2[0] ? e = r2 : o[1] < t2[1] && o[0] >= t2[0] && (e = Math.PI - r2), e;
  39252. }
  39253. getBisectorNormals(t2, o, e, r2) {
  39254. var n = this.getNormal(o, e, r2), g = Math.sqrt(n[0] * n[0] + n[1] * n[1]), i2 = n[0] / g, s = n[1] / g, a = this.distance(o, e), l = this.distance(e, r2);
  39255. if (g > 1e-4)
  39256. if (this.isClockWise(o, e, r2)) {
  39257. var u = t2 * a, c = e[0] - u * s, p = e[1] + u * i2, h2 = [c, p];
  39258. u = t2 * l, c = e[0] + u * s, p = e[1] - u * i2;
  39259. var d2 = [c, p];
  39260. } else
  39261. u = t2 * a, c = e[0] + u * s, p = e[1] - u * i2, h2 = [c, p], u = t2 * l, c = e[0] - u * s, p = e[1] + u * i2, d2 = [c, p];
  39262. else
  39263. c = e[0] + t2 * (o[0] - e[0]), p = e[1] + t2 * (o[1] - e[1]), h2 = [c, p], c = e[0] + t2 * (r2[0] - e[0]), p = e[1] + t2 * (r2[1] - e[1]), d2 = [c, p];
  39264. return [h2, d2];
  39265. }
  39266. getNormal(t2, o, e) {
  39267. var r2 = t2[0] - o[0], n = t2[1] - o[1], g = Math.sqrt(r2 * r2 + n * n);
  39268. r2 /= g, n /= g;
  39269. var i2 = e[0] - o[0], s = e[1] - o[1], a = Math.sqrt(i2 * i2 + s * s);
  39270. i2 /= a, s /= a;
  39271. var l = r2 + i2, u = n + s;
  39272. return [l, u];
  39273. }
  39274. isClockWise(t2, o, e) {
  39275. return (e[1] - t2[1]) * (o[0] - t2[0]) > (o[1] - t2[1]) * (e[0] - t2[0]);
  39276. }
  39277. getCubicValue(t2, o, e, r2, n) {
  39278. t2 = Math.max(Math.min(t2, 1), 0);
  39279. var g = 1 - t2, i2 = t2 * t2, s = i2 * t2, a = g * g, l = a * g, u = l * o[0] + 3 * a * t2 * e[0] + 3 * g * i2 * r2[0] + s * n[0], c = l * o[1] + 3 * a * t2 * e[1] + 3 * g * i2 * r2[1] + s * n[1];
  39280. return [u, c];
  39281. }
  39282. }
  39283. class DrawClosedCurve {
  39284. constructor(arg) {
  39285. this.viewer = arg.viewer;
  39286. this.Cesium = arg.Cesium;
  39287. this.floatingPoint = null;
  39288. this._ClosedCurve = null;
  39289. this._ClosedCurveLast = null;
  39290. this._positions = [];
  39291. this._entities_point = [];
  39292. this._entities_ClosedCurve = [];
  39293. this._ClosedCurveData = null;
  39294. this.ZERO_TOLERANCE = 1e-4;
  39295. this.FITTING_COUNT = 100;
  39296. this.t = 0.3;
  39297. this.objId = Number(new Date().getTime() + "" + Number(Math.random() * 1e3).toFixed(0));
  39298. this.DrawStartEvent = new Cesium.Event();
  39299. this.DrawEndEvent = new Cesium.Event();
  39300. this._tooltip = createTooltip(this.viewer.container);
  39301. this._param = {
  39302. id: "DrawStraightArrow",
  39303. polygonColor: "rgba(0,255,0,0.5)",
  39304. outlineColor: "rgba(255, 255, 255, 1)",
  39305. outlineWidth: 1
  39306. };
  39307. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  39308. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  39309. }
  39310. get ClosedCurve() {
  39311. return this._ClosedCurveLast;
  39312. }
  39313. getData() {
  39314. return this._ClosedCurveData;
  39315. }
  39316. computePosition(data) {
  39317. let $this = this;
  39318. if (data.length < 2)
  39319. return;
  39320. let pnts = [];
  39321. for (let p = 0; p < data.length; p++) {
  39322. pnts.push($this.cartesianToLatlng(data[p]));
  39323. }
  39324. this._ClosedCurveData = Array.from(pnts);
  39325. pnts.push(pnts[0], pnts[1]);
  39326. let [normals, pList] = [
  39327. [],
  39328. []
  39329. ];
  39330. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39331. let normalPoints = $this.getBisectorNormals($this.t, pnts[i2], pnts[i2 + 1], pnts[i2 + 2]);
  39332. normals = normals.concat(normalPoints);
  39333. }
  39334. let count = normals.length;
  39335. normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
  39336. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39337. let pnt1 = pnts[i2];
  39338. let pnt2 = pnts[i2 + 1];
  39339. pList.push($this.LatlngTocartesian(pnt1));
  39340. for (let t2 = 0; t2 <= $this.FITTING_COUNT; t2++) {
  39341. let pnt = $this.getCubicValue(t2 / $this.FITTING_COUNT, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  39342. pList.push($this.LatlngTocartesian(pnt));
  39343. }
  39344. pList.push($this.LatlngTocartesian(pnt2));
  39345. }
  39346. let PolygonHierarchy = new $this.Cesium.PolygonHierarchy(pList);
  39347. return {
  39348. PolygonHierarchy,
  39349. pList
  39350. };
  39351. }
  39352. addload(data) {
  39353. let $this = this;
  39354. if (data.length < 2)
  39355. return;
  39356. let pnts = Array.from(data);
  39357. pnts.push(pnts[0], pnts[1]);
  39358. let [normals, pList] = [
  39359. [],
  39360. []
  39361. ];
  39362. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39363. let normalPoints = $this.getBisectorNormals($this.t, pnts[i2], pnts[i2 + 1], pnts[i2 + 2]);
  39364. normals = normals.concat(normalPoints);
  39365. }
  39366. let count = normals.length;
  39367. normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
  39368. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39369. let pnt1 = pnts[i2];
  39370. let pnt2 = pnts[i2 + 1];
  39371. pList.push($this.LatlngTocartesian(pnt1));
  39372. for (let t2 = 0; t2 <= $this.FITTING_COUNT; t2++) {
  39373. let pnt = $this.getCubicValue(t2 / $this.FITTING_COUNT, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  39374. pList.push($this.LatlngTocartesian(pnt));
  39375. }
  39376. pList.push($this.LatlngTocartesian(pnt2));
  39377. }
  39378. console.log(data, pnts);
  39379. var arrowEntity = $this.viewer.entities.add({
  39380. Type: "DrawClosedCurve",
  39381. Position: data,
  39382. id: data.id || $this.objId,
  39383. polygon: {
  39384. hierarchy: new $this.Cesium.PolygonHierarchy(pList),
  39385. show: true,
  39386. fill: true,
  39387. clampToGround: true,
  39388. material: $this.polygonMaterial
  39389. },
  39390. polyline: {
  39391. positions: pList,
  39392. show: true,
  39393. material: new Cesium.PolylineDashMaterialProperty({
  39394. color: Cesium.Color.YELLOW
  39395. }),
  39396. width: 3,
  39397. clampToGround: true
  39398. }
  39399. });
  39400. return arrowEntity;
  39401. }
  39402. startCreate(drawType) {
  39403. if (isRuntimeApp()) {
  39404. showTooltipMessage("\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  39405. }
  39406. var $this = this;
  39407. this.drawType = drawType;
  39408. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  39409. this.handler.setInputAction(function(evt) {
  39410. if (isRuntimeApp()) {
  39411. var cartesian = $this.getCatesian3FromPX(evt.position);
  39412. if (!cartesian) {
  39413. return;
  39414. }
  39415. $this.createPoint(cartesian);
  39416. $this._positions.push(cartesian);
  39417. if ($this._positions.length > 2) {
  39418. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u70B9\u51FB\u5B8C\u6210\u6309\u94AE\uFF0C\u7ED3\u675F\u7ED8\u5236");
  39419. if ($this._positions.length === 3) {
  39420. if (!$this.Cesium.defined($this._ClosedCurve)) {
  39421. $this._ClosedCurve = $this.createClosedCurve();
  39422. createOperationMainDom();
  39423. document.getElementById("btnDrawBackout").style.display = "none";
  39424. document.getElementById("btnDrawComplete").onclick = () => {
  39425. $this._ClosedCurveData = $this._positions.concat();
  39426. $this.viewer.entities.remove($this._ClosedCurve);
  39427. $this._ClosedCurve = null;
  39428. $this._positions = [];
  39429. var lnglatArr = [];
  39430. for (var i2 = 0; i2 < $this._ClosedCurveData.length; i2++) {
  39431. var lnglat = $this.cartesianToLatlng($this._ClosedCurveData[i2]);
  39432. lnglatArr.push(lnglat);
  39433. }
  39434. $this._ClosedCurveData = lnglatArr;
  39435. var ClosedCurve = $this.addload(lnglatArr);
  39436. $this._entities_ClosedCurve.push(ClosedCurve);
  39437. $this._ClosedCurveLast = ClosedCurve;
  39438. $this.clearPoint();
  39439. $this.destroy();
  39440. let buttonDiv = document.getElementById("drawButtonDiv");
  39441. if (buttonDiv) {
  39442. document.body.removeChild(buttonDiv);
  39443. }
  39444. };
  39445. }
  39446. }
  39447. } else {
  39448. showTooltipMessage("\u70B9\u51FB\u6DFB\u52A0\u70B9");
  39449. }
  39450. } else {
  39451. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u5355\u51FB");
  39452. clearTimeout($this._timer);
  39453. $this._timer = setTimeout(function() {
  39454. var cartesian2 = $this.getCatesian3FromPX(evt.position);
  39455. if ($this._positions.length == 0) {
  39456. $this.floatingPoint = $this.createPoint(cartesian2);
  39457. }
  39458. $this._positions.push(cartesian2);
  39459. $this.createPoint(cartesian2);
  39460. }, 200);
  39461. }
  39462. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  39463. this.handler.setInputAction(function(evt) {
  39464. if (isRuntimeApp())
  39465. return;
  39466. if ($this._positions.length == 0) {
  39467. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u5F00\u59CB\u7ED8\u5236");
  39468. } else {
  39469. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9");
  39470. }
  39471. if ($this._positions.length < 2)
  39472. return;
  39473. $this._tooltip.showAt(evt.endPosition, "\u70B9\u51FB\u6DFB\u52A0\u70B9\uFF0C\u53CC\u51FB\u7ED3\u675F\u7ED8\u5236");
  39474. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  39475. if ($this._positions.length == 2) {
  39476. $this._positions.push(cartesian);
  39477. }
  39478. $this._positions.pop();
  39479. $this._positions.push(cartesian);
  39480. if (!$this.Cesium.defined($this._ClosedCurve)) {
  39481. $this._ClosedCurve = $this.createClosedCurve();
  39482. }
  39483. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  39484. this.handler.setInputAction(function(evt) {
  39485. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  39486. this.handler.setInputAction(function(evt) {
  39487. if (isRuntimeApp())
  39488. return;
  39489. console.log("\u76D1\u542C\u9F20\u6807\u4E8B\u4EF6", "\u53CC\u51FB");
  39490. clearTimeout($this._timer);
  39491. if (!$this._ClosedCurve)
  39492. return;
  39493. var cartesian = $this.getCatesian3FromPX(evt.position);
  39494. $this._positions.pop();
  39495. $this._positions.push(cartesian);
  39496. $this._ClosedCurveData = $this._positions.concat();
  39497. $this.viewer.entities.remove($this._ClosedCurve);
  39498. $this._ClosedCurve = null;
  39499. $this._positions = [];
  39500. $this.floatingPoint.position.setValue(cartesian);
  39501. var lnglatArr = [];
  39502. for (var i2 = 0; i2 < $this._ClosedCurveData.length; i2++) {
  39503. var lnglat = $this.cartesianToLatlng($this._ClosedCurveData[i2]);
  39504. lnglatArr.push(lnglat);
  39505. }
  39506. $this._ClosedCurveData = lnglatArr;
  39507. var ClosedCurve = $this.addload(lnglatArr);
  39508. $this._entities_ClosedCurve.push(ClosedCurve);
  39509. $this._ClosedCurveLast = ClosedCurve;
  39510. $this.clearPoint();
  39511. $this.destroy();
  39512. $this._tooltip.setVisible(false);
  39513. }, $this.Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  39514. }
  39515. createClosedCurve() {
  39516. var $this = this;
  39517. $this.pLists = "";
  39518. var arrowEntity = $this.viewer.entities.add({
  39519. polygon: {
  39520. hierarchy: new $this.Cesium.CallbackProperty(
  39521. function() {
  39522. if ($this._positions.length < 2)
  39523. return;
  39524. let pnts = [];
  39525. for (let p = 0; p < $this._positions.length; p++) {
  39526. pnts.push($this.cartesianToLatlng($this._positions[p]));
  39527. }
  39528. pnts.push(pnts[0], pnts[1]);
  39529. let [normals, pList] = [
  39530. [],
  39531. []
  39532. ];
  39533. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39534. let normalPoints = $this.getBisectorNormals($this.t, pnts[i2], pnts[i2 + 1], pnts[i2 + 2]);
  39535. normals = normals.concat(normalPoints);
  39536. }
  39537. let count = normals.length;
  39538. normals = [normals[count - 1]].concat(normals.slice(0, count - 1));
  39539. for (let i2 = 0; i2 < pnts.length - 2; i2++) {
  39540. let pnt1 = pnts[i2];
  39541. let pnt2 = pnts[i2 + 1];
  39542. pList.push($this.LatlngTocartesian(pnt1));
  39543. for (let t2 = 0; t2 <= $this.FITTING_COUNT; t2++) {
  39544. let pnt = $this.getCubicValue(t2 / $this.FITTING_COUNT, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  39545. pList.push($this.LatlngTocartesian(pnt));
  39546. }
  39547. pList.push($this.LatlngTocartesian(pnt2));
  39548. }
  39549. $this.pLists = pList;
  39550. return new $this.Cesium.PolygonHierarchy(pList);
  39551. },
  39552. false
  39553. ),
  39554. show: true,
  39555. fill: true,
  39556. clampToGround: true,
  39557. material: $this.polygonMaterial
  39558. },
  39559. polyline: {
  39560. positions: new $this.Cesium.CallbackProperty(
  39561. function() {
  39562. return $this.pLists;
  39563. },
  39564. false
  39565. ),
  39566. show: true,
  39567. material: new Cesium.PolylineDashMaterialProperty({
  39568. color: Cesium.Color.YELLOW
  39569. }),
  39570. width: 3,
  39571. clampToGround: true
  39572. }
  39573. });
  39574. $this._entities_ClosedCurve.push(arrowEntity);
  39575. return arrowEntity;
  39576. }
  39577. createPoint(cartesian) {
  39578. var $this = this;
  39579. var point2 = this.viewer.entities.add({
  39580. position: cartesian,
  39581. point: {
  39582. pixelSize: 10,
  39583. color: $this.Cesium.Color.RED,
  39584. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  39585. }
  39586. });
  39587. $this._entities_point.push(point2);
  39588. return point2;
  39589. }
  39590. cartesianToLatlng(cartesian) {
  39591. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  39592. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  39593. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  39594. return [lng, lat];
  39595. }
  39596. LatlngTocartesian(latlng) {
  39597. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  39598. return cartesian3;
  39599. }
  39600. lonLatToMercator(Latlng) {
  39601. var E2 = Latlng[0];
  39602. var N2 = Latlng[1];
  39603. var x = E2 * 2003750834e-2 / 180;
  39604. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  39605. y = y * 2003750834e-2 / 180;
  39606. return [x, y];
  39607. }
  39608. WebMercator2lonLat(mercator) {
  39609. let x = mercator[0] / 2003750834e-2 * 180;
  39610. let ly = mercator[1] / 2003750834e-2 * 180;
  39611. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  39612. return [x, y];
  39613. }
  39614. destroy() {
  39615. if (this.handler) {
  39616. this.handler.destroy();
  39617. this.handler = null;
  39618. }
  39619. }
  39620. clearPoint() {
  39621. this.DrawEndEvent.raiseEvent(this._ClosedCurveLast, this._ClosedCurveData);
  39622. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39623. this.viewer.entities.remove(this._entities_point[i2]);
  39624. }
  39625. this._entities_point = [];
  39626. }
  39627. clear() {
  39628. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39629. this.viewer.entities.remove(this._entities_point[i2]);
  39630. }
  39631. for (var i2 = 0; i2 < this._entities_ClosedCurve.length; i2++) {
  39632. this.viewer.entities.remove(this._entities_ClosedCurve[i2]);
  39633. }
  39634. this.floatingPoint = null;
  39635. this._ClosedCurve = null;
  39636. this._ClosedCurveLast = null;
  39637. this._positions = [];
  39638. this._entities_point = [];
  39639. this._entities_ClosedCurve = [];
  39640. this._ClosedCurveData = null;
  39641. }
  39642. getCatesian3FromPX(px) {
  39643. var cartesian;
  39644. var ray = this.viewer.camera.getPickRay(px);
  39645. if (!ray)
  39646. return null;
  39647. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  39648. return cartesian;
  39649. }
  39650. getBisectorNormals(t2, pnt1, pnt2, pnt3) {
  39651. let $this = this;
  39652. let normal = $this.getNormal(pnt1, pnt2, pnt3);
  39653. let [bisectorNormalRight, bisectorNormalLeft, dt2, x, y] = [null, null, null, null, null];
  39654. let dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  39655. let uX = normal[0] / dist;
  39656. let uY = normal[1] / dist;
  39657. let d1 = $this.MathDistance(pnt1, pnt2);
  39658. let d2 = $this.MathDistance(pnt2, pnt3);
  39659. if (dist > $this.ZERO_TOLERANCE) {
  39660. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  39661. dt2 = t2 * d1;
  39662. x = pnt2[0] - dt2 * uY;
  39663. y = pnt2[1] + dt2 * uX;
  39664. bisectorNormalRight = [x, y];
  39665. dt2 = t2 * d2;
  39666. x = pnt2[0] + dt2 * uY;
  39667. y = pnt2[1] - dt2 * uX;
  39668. bisectorNormalLeft = [x, y];
  39669. } else {
  39670. dt2 = t2 * d1;
  39671. x = pnt2[0] + dt2 * uY;
  39672. y = pnt2[1] - dt2 * uX;
  39673. bisectorNormalRight = [x, y];
  39674. dt2 = t2 * d2;
  39675. x = pnt2[0] - dt2 * uY;
  39676. y = pnt2[1] + dt2 * uX;
  39677. bisectorNormalLeft = [x, y];
  39678. }
  39679. } else {
  39680. x = pnt2[0] + t2 * (pnt1[0] - pnt2[0]);
  39681. y = pnt2[1] + t2 * (pnt1[1] - pnt2[1]);
  39682. bisectorNormalRight = [x, y];
  39683. x = pnt2[0] + t2 * (pnt3[0] - pnt2[0]);
  39684. y = pnt2[1] + t2 * (pnt3[1] - pnt2[1]);
  39685. bisectorNormalLeft = [x, y];
  39686. }
  39687. return [bisectorNormalRight, bisectorNormalLeft];
  39688. }
  39689. getNormal(pnt1, pnt2, pnt3) {
  39690. let dX1 = pnt1[0] - pnt2[0];
  39691. let dY1 = pnt1[1] - pnt2[1];
  39692. let d1 = Math.sqrt(dX1 * dX1 + dY1 * dY1);
  39693. dX1 /= d1;
  39694. dY1 /= d1;
  39695. let dX2 = pnt3[0] - pnt2[0];
  39696. let dY2 = pnt3[1] - pnt2[1];
  39697. let d2 = Math.sqrt(dX2 * dX2 + dY2 * dY2);
  39698. dX2 /= d2;
  39699. dY2 /= d2;
  39700. let uX = dX1 + dX2;
  39701. let uY = dY1 + dY2;
  39702. return [uX, uY];
  39703. }
  39704. MathDistance(pnt1, pnt2) {
  39705. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  39706. }
  39707. isClockWise(pnt1, pnt2, pnt3) {
  39708. return (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
  39709. }
  39710. getCubicValue(t2, startPnt, cPnt1, cPnt2, endPnt) {
  39711. t2 = Math.max(Math.min(t2, 1), 0);
  39712. let [tp, t22] = [1 - t2, t2 * t2];
  39713. let t3 = t22 * t2;
  39714. let tp2 = tp * tp;
  39715. let tp3 = tp2 * tp;
  39716. let x = tp3 * startPnt[0] + 3 * tp2 * t2 * cPnt1[0] + 3 * tp * t22 * cPnt2[0] + t3 * endPnt[0];
  39717. let y = tp3 * startPnt[1] + 3 * tp2 * t2 * cPnt1[1] + 3 * tp * t22 * cPnt2[1] + t3 * endPnt[1];
  39718. return [x, y];
  39719. }
  39720. }
  39721. class DrawSector {
  39722. constructor(arg) {
  39723. this.viewer = arg.viewer;
  39724. this.Cesium = arg.Cesium;
  39725. this.floatingPoint = null;
  39726. this._sector = null;
  39727. this._sectorLast = null;
  39728. this._positions = [];
  39729. this._entities_point = [];
  39730. this._entities_sector = [];
  39731. this._sectorData = null;
  39732. this.DrawStartEvent = new Cesium.Event();
  39733. this.DrawEndEvent = new Cesium.Event();
  39734. this._param = {
  39735. id: "DrawStraightArrow",
  39736. polygonColor: "rgba(0,255,0,0.5)",
  39737. outlineColor: "rgba(255, 255, 255, 1)",
  39738. outlineWidth: 1
  39739. };
  39740. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  39741. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  39742. }
  39743. get sector() {
  39744. return this._sectorLast;
  39745. }
  39746. getData() {
  39747. return this._sectorData;
  39748. }
  39749. computePosition(data) {
  39750. let $this = this;
  39751. let pnts = data;
  39752. let center2 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[0]));
  39753. let pnt2 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[1]));
  39754. let pnt3 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[2]));
  39755. var radius = $this.MathDistance(pnt2, center2);
  39756. var startAngle = $this.getAzimuth(pnt2, center2);
  39757. var endAngle = $this.getAzimuth(pnt3, center2);
  39758. var pList = $this.getArcPoints(center2, radius, startAngle, endAngle);
  39759. pList.push(pnts[0], pList[0]);
  39760. let arrow = [];
  39761. for (var i2 = 0; i2 < pList.length; i2++) {
  39762. var cart3 = new $this.Cesium.Cartesian3(pList[i2].x, pList[i2].y, pList[i2].z);
  39763. arrow.push(cart3);
  39764. }
  39765. var lnglatArr = [];
  39766. for (var d2 = 0; d2 < data.length; d2++) {
  39767. lnglatArr.push($this.cartesianToLatlng(data[d2]));
  39768. }
  39769. $this._sectorData = lnglatArr;
  39770. return new $this.Cesium.PolygonHierarchy(arrow);
  39771. }
  39772. addload(data) {
  39773. var $this = this;
  39774. let pnts = data;
  39775. let center2 = $this.lonLatToMercator(pnts[0]);
  39776. let pnt2 = $this.lonLatToMercator(pnts[1]);
  39777. let pnt3 = $this.lonLatToMercator(pnts[2]);
  39778. var radius = $this.MathDistance(pnt2, center2);
  39779. var startAngle = $this.getAzimuth(pnt2, center2);
  39780. var endAngle = $this.getAzimuth(pnt3, center2);
  39781. var pList = $this.getArcPoints(center2, radius, startAngle, endAngle);
  39782. let pntsc = $this.Cesium.Cartesian3.fromDegrees(pnts[0][0], pnts[0][1]);
  39783. pList.push(pntsc, pList[0]);
  39784. let arrow = [];
  39785. for (var i2 = 0; i2 < pList.length; i2++) {
  39786. var cart3 = new $this.Cesium.Cartesian3(pList[i2].x, pList[i2].y, pList[i2].z);
  39787. arrow.push(cart3);
  39788. }
  39789. var arrowEntity = $this.viewer.entities.add({
  39790. Type: "DrawSector",
  39791. Position: data,
  39792. id: data.id || $this.objId,
  39793. polygon: {
  39794. hierarchy: new $this.Cesium.PolygonHierarchy(arrow),
  39795. show: true,
  39796. fill: true,
  39797. clampToGround: true,
  39798. material: $this.Cesium.Color.AQUA.withAlpha(0.9)
  39799. }
  39800. });
  39801. return arrowEntity;
  39802. }
  39803. startCreate() {
  39804. var $this = this;
  39805. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  39806. this.handler.setInputAction(function(evt) {
  39807. var cartesian = $this.getCatesian3FromPX(evt.position);
  39808. if ($this._positions.length < 3) {
  39809. $this.floatingPoint = $this.createPoint(cartesian);
  39810. $this._positions.push(cartesian);
  39811. }
  39812. if (!$this._sector)
  39813. ;
  39814. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  39815. this.handler.setInputAction(function(evt) {
  39816. if ($this._positions.length < 2)
  39817. return;
  39818. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  39819. if ($this._positions.length == 2) {
  39820. $this._positions.push(cartesian);
  39821. }
  39822. if ($this._positions.length == 3) {
  39823. $this._positions.pop();
  39824. $this._positions.push(cartesian);
  39825. if (!$this.Cesium.defined($this._sector)) {
  39826. $this._sector = $this.createsector();
  39827. }
  39828. }
  39829. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  39830. this.handler.setInputAction(function(evt) {
  39831. if (!$this._sector)
  39832. return;
  39833. var cartesian = $this.getCatesian3FromPX(evt.position);
  39834. $this._positions.pop();
  39835. $this._positions.push(cartesian);
  39836. $this._sectorData = $this._positions.concat();
  39837. $this.viewer.entities.remove($this._sector);
  39838. $this._sector = null;
  39839. $this._positions = [];
  39840. $this.floatingPoint.position.setValue(cartesian);
  39841. var lnglatArr = [];
  39842. for (var i2 = 0; i2 < $this._sectorData.length; i2++) {
  39843. var lnglat = $this.cartesianToLatlng($this._sectorData[i2]);
  39844. lnglatArr.push(lnglat);
  39845. }
  39846. $this._sectorData = lnglatArr;
  39847. var sector = $this.addload(lnglatArr);
  39848. $this._entities_sector.push(sector);
  39849. $this._sectorLast = sector;
  39850. $this.clearPoint();
  39851. $this.destroy();
  39852. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  39853. }
  39854. createsector() {
  39855. var $this = this;
  39856. var arrowEntity = $this.viewer.entities.add(
  39857. {
  39858. polygon: {
  39859. hierarchy: new $this.Cesium.CallbackProperty(
  39860. function() {
  39861. let pnts = $this._positions;
  39862. let center2 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[0]));
  39863. let pnt2 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[1]));
  39864. let pnt3 = $this.lonLatToMercator($this.cartesianToLatlng(pnts[2]));
  39865. var radius = $this.MathDistance(pnt2, center2);
  39866. var startAngle = $this.getAzimuth(pnt2, center2);
  39867. var endAngle = $this.getAzimuth(pnt3, center2);
  39868. var pList = $this.getArcPoints(center2, radius, startAngle, endAngle);
  39869. pList.push(pnts[0], pList[0]);
  39870. for (var i2 = 0; i2 < pList.length; i2++) {
  39871. new $this.Cesium.Cartesian3(pList[i2].x, pList[i2].y, pList[i2].z);
  39872. }
  39873. return new $this.Cesium.PolygonHierarchy(pList);
  39874. },
  39875. false
  39876. ),
  39877. show: true,
  39878. fill: true,
  39879. clampToGround: true,
  39880. material: $this.Cesium.Color.AQUA.withAlpha(0.5)
  39881. }
  39882. }
  39883. );
  39884. $this._entities_sector.push(arrowEntity);
  39885. return arrowEntity;
  39886. }
  39887. createPoint(cartesian) {
  39888. var $this = this;
  39889. var point2 = this.viewer.entities.add({
  39890. position: cartesian,
  39891. point: {
  39892. pixelSize: 10,
  39893. color: $this.Cesium.Color.RED,
  39894. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  39895. }
  39896. });
  39897. $this._entities_point.push(point2);
  39898. return point2;
  39899. }
  39900. cartesianToLatlng(cartesian) {
  39901. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  39902. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  39903. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  39904. return [lng, lat];
  39905. }
  39906. lonLatToMercator(Latlng) {
  39907. var E2 = Latlng[0];
  39908. var N2 = Latlng[1];
  39909. var x = E2 * 2003750834e-2 / 180;
  39910. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  39911. y = y * 2003750834e-2 / 180;
  39912. return [x, y];
  39913. }
  39914. WebMercator2lonLat(mercator) {
  39915. let x = mercator[0] / 2003750834e-2 * 180;
  39916. let ly = mercator[1] / 2003750834e-2 * 180;
  39917. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  39918. return [x, y];
  39919. }
  39920. destroy() {
  39921. if (this.handler) {
  39922. this.handler.destroy();
  39923. this.handler = null;
  39924. }
  39925. }
  39926. clearPoint() {
  39927. this.DrawEndEvent.raiseEvent(this._sectorLast, this._sectorData);
  39928. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39929. this.viewer.entities.remove(this._entities_point[i2]);
  39930. }
  39931. this._entities_point = [];
  39932. }
  39933. clear() {
  39934. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  39935. this.viewer.entities.remove(this._entities_point[i2]);
  39936. }
  39937. for (var i2 = 0; i2 < this._entities_sector.length; i2++) {
  39938. this.viewer.entities.remove(this._entities_sector[i2]);
  39939. }
  39940. this.floatingPoint = null;
  39941. this._sector = null;
  39942. this._sectorLast = null;
  39943. this._positions = [];
  39944. this._entities_point = [];
  39945. this._entities_sector = [];
  39946. this._sectorData = null;
  39947. }
  39948. getCatesian3FromPX(px) {
  39949. var cartesian;
  39950. var ray = this.viewer.camera.getPickRay(px);
  39951. if (!ray)
  39952. return null;
  39953. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  39954. return cartesian;
  39955. }
  39956. MathDistance(pnt1, pnt2) {
  39957. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  39958. }
  39959. getAzimuth(startPoint, endPoint) {
  39960. var azimuth;
  39961. var angle = Math.asin(Math.abs(endPoint[1] - startPoint[1]) / this.MathDistance(startPoint, endPoint));
  39962. if (endPoint[1] >= startPoint[1] && endPoint[0] >= startPoint[0]) {
  39963. azimuth = angle + Math.PI;
  39964. } else if (endPoint[1] >= startPoint[1] && endPoint[0] < startPoint[0]) {
  39965. azimuth = Math.PI * 2 - angle;
  39966. } else if (endPoint[1] < startPoint[1] && endPoint[0] < startPoint[0]) {
  39967. azimuth = angle;
  39968. } else if (endPoint[1] < startPoint[1] && endPoint[0] >= startPoint[0]) {
  39969. azimuth = Math.PI - angle;
  39970. }
  39971. return azimuth;
  39972. }
  39973. getArcPoints(center2, radius, startAngle, endAngle) {
  39974. var x = null, y = null, pnts = [], angleDiff = endAngle - startAngle;
  39975. angleDiff = angleDiff < 0 ? angleDiff + Math.PI * 2 : angleDiff;
  39976. for (var i2 = 0; i2 <= 100; i2++) {
  39977. var angle = startAngle + angleDiff * i2 / 100;
  39978. x = center2[0] + radius * Math.cos(angle);
  39979. y = center2[1] + radius * Math.sin(angle);
  39980. let latlon = this.WebMercator2lonLat([x, y]);
  39981. pnts.push(this.Cesium.Cartesian3.fromDegrees(latlon[0], latlon[1]));
  39982. }
  39983. return pnts;
  39984. }
  39985. }
  39986. class DrawBowLine {
  39987. constructor(arg) {
  39988. this.viewer = arg.viewer;
  39989. this.Cesium = arg.Cesium;
  39990. this.tt = 0.4;
  39991. this.floatingPoint = null;
  39992. this.drawHandler = null;
  39993. this.DrawBowLine = null;
  39994. this._DrawBowLineLast = null;
  39995. this._positions = [];
  39996. this._entities_point = [];
  39997. this._entities_PincerArrow = [];
  39998. this._DrawBowLineData = null;
  39999. this.DrawStartEvent = new Cesium.Event();
  40000. this.DrawEndEvent = new Cesium.Event();
  40001. this._param = {
  40002. id: "DrawStraightArrow",
  40003. polygonColor: "rgba(0,255,0,0.5)",
  40004. outlineColor: "rgba(255, 255, 255, 1)",
  40005. outlineWidth: 1
  40006. };
  40007. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  40008. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  40009. }
  40010. get PincerArrow() {
  40011. return this._DrawBowLineLast;
  40012. }
  40013. getData() {
  40014. return this._DrawBowLineData;
  40015. }
  40016. computePosition(data) {
  40017. var $this = this;
  40018. if (data.length < 3) {
  40019. return;
  40020. }
  40021. var DrawBowLine2 = [];
  40022. let positions = [];
  40023. for (var i2 = 0; i2 < data.length; i2++) {
  40024. positions.push($this.cartesianToLatlng(data[i2]));
  40025. var cart3 = $this.lonLatToMercator($this.cartesianToLatlng(data[i2]));
  40026. DrawBowLine2.push(cart3);
  40027. }
  40028. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowLine2[0], DrawBowLine2[2], DrawBowLine2[1], null, null];
  40029. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40030. let radius = $this.MathDistance(pnt1, center2);
  40031. let angle1 = $this.getAzimuth(pnt1, center2);
  40032. let angle2 = $this.getAzimuth(pnt2, center2);
  40033. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40034. startAngle = angle2;
  40035. endAngle = angle1;
  40036. } else {
  40037. startAngle = angle1;
  40038. endAngle = angle2;
  40039. }
  40040. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40041. let pHierarchy = [];
  40042. for (var l = 0; l < getArcPoint.length; l++) {
  40043. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40044. pHierarchy.push(cart3);
  40045. }
  40046. $this._DrawBowLineData = positions;
  40047. return pHierarchy;
  40048. }
  40049. addload(data) {
  40050. var $this = this;
  40051. if (data.length < 3) {
  40052. return;
  40053. }
  40054. var DrawBowLine2 = [];
  40055. for (var i2 = 0; i2 < data.length; i2++) {
  40056. var cart3 = $this.lonLatToMercator(data[i2]);
  40057. DrawBowLine2.push(cart3);
  40058. }
  40059. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowLine2[0], DrawBowLine2[2], DrawBowLine2[1], null, null];
  40060. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40061. let radius = $this.MathDistance(pnt1, center2);
  40062. let angle1 = $this.getAzimuth(pnt1, center2);
  40063. let angle2 = $this.getAzimuth(pnt2, center2);
  40064. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40065. startAngle = angle2;
  40066. endAngle = angle1;
  40067. } else {
  40068. startAngle = angle1;
  40069. endAngle = angle2;
  40070. }
  40071. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40072. let pHierarchy = [];
  40073. for (var l = 0; l < getArcPoint.length; l++) {
  40074. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40075. pHierarchy.push(cart3);
  40076. }
  40077. var arrowEntity = $this.viewer.entities.add({
  40078. Type: "DrawBowLine",
  40079. Position: data,
  40080. id: data.id || $this.objId,
  40081. polyline: {
  40082. positions: pHierarchy,
  40083. show: true,
  40084. material: $this.Cesium.Color.YELLOW,
  40085. width: 3,
  40086. clampToGround: true
  40087. }
  40088. });
  40089. return arrowEntity;
  40090. }
  40091. startCreate(drawType) {
  40092. this.drawType = drawType;
  40093. var $this = this;
  40094. this.handler = new $this.Cesium.ScreenSpaceEventHandler($this.viewer.scene.canvas);
  40095. this.handler.setInputAction(function(event2) {
  40096. var position2 = event2.position;
  40097. if (!$this.Cesium.defined(position2)) {
  40098. return;
  40099. }
  40100. var ray = $this.viewer.camera.getPickRay(position2);
  40101. if (!$this.Cesium.defined(ray)) {
  40102. return;
  40103. }
  40104. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  40105. if (!$this.Cesium.defined(cartesian)) {
  40106. return;
  40107. }
  40108. if ($this._positions.length == 0) {
  40109. $this._positions.push(cartesian.clone());
  40110. $this.floatingPoint = $this.createPoint(cartesian);
  40111. }
  40112. if ($this._positions.length <= 2) {
  40113. $this.createPoint(cartesian);
  40114. $this._positions.push(cartesian);
  40115. }
  40116. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  40117. this.handler.setInputAction(function(event2) {
  40118. if ($this._positions.length < 2) {
  40119. return;
  40120. }
  40121. var position2 = event2.endPosition;
  40122. if (!$this.Cesium.defined(position2)) {
  40123. return;
  40124. }
  40125. var ray = $this.viewer.camera.getPickRay(position2);
  40126. if (!$this.Cesium.defined(ray)) {
  40127. return;
  40128. }
  40129. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  40130. if (!$this.Cesium.defined(cartesian)) {
  40131. return;
  40132. }
  40133. if (!$this.Cesium.defined($this.DrawBowLine)) {
  40134. $this.DrawBowLine = $this.createDrawBowLine();
  40135. }
  40136. $this.floatingPoint.position.setValue(cartesian);
  40137. if ($this.DrawBowLine) {
  40138. if ($this._positions.length == 3) {
  40139. $this._positions[1] = cartesian;
  40140. } else {
  40141. $this._positions.pop();
  40142. $this._positions.push(cartesian);
  40143. }
  40144. }
  40145. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  40146. this.handler.setInputAction(function(movement) {
  40147. if ($this._positions.length >= 3) {
  40148. $this._DrawBowLineData = $this._positions.concat();
  40149. $this.viewer.entities.remove($this.DrawBowLine);
  40150. $this.DrawBowLine = null;
  40151. var lnglatArr = [];
  40152. for (var i2 = 0; i2 < $this._DrawBowLineData.length; i2++) {
  40153. var lnglat = $this.cartesianToLatlng($this._DrawBowLineData[i2]);
  40154. lnglatArr.push(lnglat);
  40155. }
  40156. $this._DrawBowLineData = lnglatArr;
  40157. var pincerArrow = $this.addload(lnglatArr);
  40158. $this._entities_PincerArrow.push(pincerArrow);
  40159. $this._DrawBowLineLast = pincerArrow;
  40160. $this.viewer.entities.remove($this.floatingPoint);
  40161. $this.floatingPoint = null;
  40162. $this.clearPoint();
  40163. $this.destroy();
  40164. }
  40165. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  40166. }
  40167. createDrawBowLine() {
  40168. let $this = this;
  40169. var DrawBowLineEntity = $this.viewer.entities.add({
  40170. polyline: {
  40171. positions: new $this.Cesium.CallbackProperty(function() {
  40172. if ($this._positions.length < 3) {
  40173. return;
  40174. }
  40175. var DrawBowLine2 = [];
  40176. for (var i2 = 0; i2 < $this._positions.length; i2++) {
  40177. var cart3 = $this.lonLatToMercator($this.cartesianToLatlng($this._positions[i2]));
  40178. DrawBowLine2.push(cart3);
  40179. }
  40180. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowLine2[0], DrawBowLine2[2], DrawBowLine2[1], null, null];
  40181. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40182. let radius = $this.MathDistance(pnt1, center2);
  40183. let angle1 = $this.getAzimuth(pnt1, center2);
  40184. let angle2 = $this.getAzimuth(pnt2, center2);
  40185. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40186. startAngle = angle2;
  40187. endAngle = angle1;
  40188. } else {
  40189. startAngle = angle1;
  40190. endAngle = angle2;
  40191. }
  40192. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40193. let pHierarchy = [];
  40194. for (var l = 0; l < getArcPoint.length; l++) {
  40195. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40196. pHierarchy.push(cart3);
  40197. }
  40198. return pHierarchy;
  40199. }, false),
  40200. show: true,
  40201. material: $this.Cesium.Color.YELLOW,
  40202. width: 3,
  40203. clampToGround: true
  40204. }
  40205. });
  40206. $this._entities_PincerArrow.push(DrawBowLineEntity);
  40207. return DrawBowLineEntity;
  40208. }
  40209. createPoint(cartesian) {
  40210. var $this = this;
  40211. var point2 = this.viewer.entities.add({
  40212. position: cartesian,
  40213. point: {
  40214. pixelSize: 10,
  40215. color: $this.Cesium.Color.RED,
  40216. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  40217. }
  40218. });
  40219. $this._entities_point.push(point2);
  40220. return point2;
  40221. }
  40222. cartesianToLatlng(cartesian) {
  40223. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40224. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  40225. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  40226. cartographic.height;
  40227. return [lng, lat];
  40228. }
  40229. destroy() {
  40230. if (this.handler) {
  40231. this.handler.destroy();
  40232. this.handler = null;
  40233. }
  40234. }
  40235. clearPoint() {
  40236. this.DrawEndEvent.raiseEvent(this._DrawBowLineLast, this._DrawBowLineData, this.drawType);
  40237. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40238. this.viewer.entities.remove(this._entities_point[i2]);
  40239. }
  40240. this._entities_point = [];
  40241. }
  40242. clear() {
  40243. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40244. this.viewer.entities.remove(this._entities_point[i2]);
  40245. }
  40246. for (var i2 = 0; i2 < this._entities_PincerArrow.length; i2++) {
  40247. this.viewer.entities.remove(this._entities_PincerArrow[i2]);
  40248. }
  40249. this.floatingPoint = null;
  40250. this._PincerArrow = null;
  40251. this._PincerArrowLast = null;
  40252. this._positions = [];
  40253. this._entities_point = [];
  40254. this._entities_PincerArrow = [];
  40255. this._PincerArrowData = null;
  40256. }
  40257. getCatesian3FromPX(px) {
  40258. var cartesian;
  40259. var ray = this.viewer.camera.getPickRay(px);
  40260. if (!ray)
  40261. return null;
  40262. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  40263. return cartesian;
  40264. }
  40265. _computeTempPositions() {
  40266. var _this = this;
  40267. var pnts = [].concat(_this._positions);
  40268. var num = pnts.length;
  40269. var first = pnts[0];
  40270. var last = pnts[num - 1];
  40271. if (_this._isSimpleXYZ(first, last) == false) {
  40272. pnts.push(first);
  40273. num += 1;
  40274. }
  40275. _this.tempPositions = [];
  40276. for (var i2 = 1; i2 < num; i2++) {
  40277. var p1 = pnts[i2 - 1];
  40278. var p2 = pnts[i2];
  40279. var cp = _this._computeCenterPotition(p1, p2);
  40280. _this.tempPositions.push(p1);
  40281. _this.tempPositions.push(cp);
  40282. }
  40283. }
  40284. _isSimpleXYZ(p1, p2) {
  40285. if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
  40286. return true;
  40287. }
  40288. return false;
  40289. }
  40290. _computeCenterPotition(p1, p2) {
  40291. var _this = this;
  40292. var c1 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p1);
  40293. var c2 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p2);
  40294. var cm = new _this.Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5);
  40295. var cp = _this.viewer.scene.globe.ellipsoid.cartographicToCartesian(cm);
  40296. return cp;
  40297. }
  40298. getLonLat(cartesian) {
  40299. var cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40300. cartographic.height = this.viewer.scene.globe.getHeight(cartographic);
  40301. var pos = {
  40302. lon: cartographic.longitude,
  40303. lat: cartographic.latitude,
  40304. alt: cartographic.height
  40305. };
  40306. pos.lon = this.Cesium.Math.toDegrees(pos.lon);
  40307. pos.lat = this.Cesium.Math.toDegrees(pos.lat);
  40308. return pos;
  40309. }
  40310. LatlngTocartesian(latlng) {
  40311. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  40312. return cartesian3;
  40313. }
  40314. lonLatToMercator(Latlng) {
  40315. var E2 = Latlng[0];
  40316. var N2 = Latlng[1];
  40317. var x = E2 * 2003750834e-2 / 180;
  40318. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  40319. y = y * 2003750834e-2 / 180;
  40320. return [x, y];
  40321. }
  40322. WebMercator2lonLat(mercator) {
  40323. let x = mercator[0] / 2003750834e-2 * 180;
  40324. let ly = mercator[1] / 2003750834e-2 * 180;
  40325. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  40326. return [x, y];
  40327. }
  40328. getCircleCenterOfThreePoints(point1, point2, point3) {
  40329. let pntA = [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
  40330. let pntB = [pntA[0] - point1[1] + point2[1], pntA[1] + point1[0] - point2[0]];
  40331. let pntC = [(point1[0] + point3[0]) / 2, (point1[1] + point3[1]) / 2];
  40332. let pntD = [pntC[0] - point1[1] + point3[1], pntC[1] + point1[0] - point3[0]];
  40333. return this.getIntersectPoint(pntA, pntB, pntC, pntD);
  40334. }
  40335. getIntersectPoint(pntA, pntB, pntC, pntD) {
  40336. if (pntA[1] === pntB[1]) {
  40337. let f2 = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  40338. let x2 = f2 * (pntA[1] - pntC[1]) + pntC[0];
  40339. let y2 = pntA[1];
  40340. return [x2, y2];
  40341. }
  40342. if (pntC[1] === pntD[1]) {
  40343. let e2 = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  40344. let x2 = e2 * (pntC[1] - pntA[1]) + pntA[0];
  40345. let y2 = pntC[1];
  40346. return [x2, y2];
  40347. }
  40348. let e = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  40349. let f = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  40350. let y = (e * pntA[1] - pntA[0] - f * pntC[1] + pntC[0]) / (e - f);
  40351. let x = e * y - e * pntA[1] + pntA[0];
  40352. return [x, y];
  40353. }
  40354. MathDistance(pnt1, pnt2) {
  40355. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  40356. }
  40357. getAzimuth(startPoint, endPoint) {
  40358. let azimuth;
  40359. let angle = Math.asin(Math.abs(endPoint[1] - startPoint[1]) / this.MathDistance(startPoint, endPoint));
  40360. if (endPoint[1] >= startPoint[1] && endPoint[0] >= startPoint[0]) {
  40361. azimuth = angle + Math.PI;
  40362. } else if (endPoint[1] >= startPoint[1] && endPoint[0] < startPoint[0]) {
  40363. azimuth = Math.PI * 2 - angle;
  40364. } else if (endPoint[1] < startPoint[1] && endPoint[0] < startPoint[0]) {
  40365. azimuth = angle;
  40366. } else if (endPoint[1] < startPoint[1] && endPoint[0] >= startPoint[0]) {
  40367. azimuth = Math.PI - angle;
  40368. }
  40369. return azimuth;
  40370. }
  40371. isClockWise(pnt1, pnt2, pnt3) {
  40372. return (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
  40373. }
  40374. getArcPoints(center2, radius, startAngle, endAngle) {
  40375. let [x, y, pnts, angleDiff] = [null, null, [], endAngle - startAngle];
  40376. angleDiff = angleDiff < 0 ? angleDiff + Math.PI * 2 : angleDiff;
  40377. for (let i2 = 0; i2 <= 100; i2++) {
  40378. let angle = startAngle + angleDiff * i2 / 100;
  40379. x = center2[0] + radius * Math.cos(angle);
  40380. y = center2[1] + radius * Math.sin(angle);
  40381. pnts.push([x, y]);
  40382. }
  40383. return pnts;
  40384. }
  40385. }
  40386. class DrawBowPlane {
  40387. constructor(arg) {
  40388. this.viewer = arg.viewer;
  40389. this.Cesium = arg.Cesium;
  40390. this.tt = 0.4;
  40391. this.floatingPoint = null;
  40392. this.drawHandler = null;
  40393. this.DrawBowPlane = null;
  40394. this._DrawBowPlaneLast = null;
  40395. this._positions = [];
  40396. this._entities_point = [];
  40397. this._entities_PincerArrow = [];
  40398. this._DrawBowPlaneData = null;
  40399. this.DrawStartEvent = new Cesium.Event();
  40400. this.DrawEndEvent = new Cesium.Event();
  40401. this._param = {
  40402. id: "DrawStraightArrow",
  40403. polygonColor: "rgba(0,255,0,0.5)",
  40404. outlineColor: "rgba(255, 255, 255, 1)",
  40405. outlineWidth: 1
  40406. };
  40407. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  40408. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  40409. }
  40410. get PincerArrow() {
  40411. return this._DrawBowPlaneLast;
  40412. }
  40413. getData() {
  40414. return this._DrawBowPlaneData;
  40415. }
  40416. computePosition(data) {
  40417. var $this = this;
  40418. if (data.length < 3) {
  40419. return;
  40420. }
  40421. var DrawBowPlane2 = [];
  40422. let positions = [];
  40423. for (var i2 = 0; i2 < data.length; i2++) {
  40424. positions.push($this.cartesianToLatlng(data[i2]));
  40425. var cart3 = $this.lonLatToMercator($this.cartesianToLatlng(data[i2]));
  40426. DrawBowPlane2.push(cart3);
  40427. }
  40428. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowPlane2[0], DrawBowPlane2[2], DrawBowPlane2[1], null, null];
  40429. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40430. let radius = $this.MathDistance(pnt1, center2);
  40431. let angle1 = $this.getAzimuth(pnt1, center2);
  40432. let angle2 = $this.getAzimuth(pnt2, center2);
  40433. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40434. startAngle = angle2;
  40435. endAngle = angle1;
  40436. } else {
  40437. startAngle = angle1;
  40438. endAngle = angle2;
  40439. }
  40440. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40441. let pHierarchy = [];
  40442. for (var l = 0; l < getArcPoint.length; l++) {
  40443. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40444. pHierarchy.push(cart3);
  40445. }
  40446. pHierarchy.push(pHierarchy[0]);
  40447. $this._DrawBowPlaneData = positions;
  40448. return new $this.Cesium.PolygonHierarchy(pHierarchy);
  40449. }
  40450. addload(data) {
  40451. var $this = this;
  40452. if (data.length < 3) {
  40453. return;
  40454. }
  40455. var DrawBowPlane2 = [];
  40456. for (var i2 = 0; i2 < data.length; i2++) {
  40457. var cart3 = $this.lonLatToMercator(data[i2]);
  40458. DrawBowPlane2.push(cart3);
  40459. }
  40460. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowPlane2[0], DrawBowPlane2[2], DrawBowPlane2[1], null, null];
  40461. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40462. let radius = $this.MathDistance(pnt1, center2);
  40463. let angle1 = $this.getAzimuth(pnt1, center2);
  40464. let angle2 = $this.getAzimuth(pnt2, center2);
  40465. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40466. startAngle = angle2;
  40467. endAngle = angle1;
  40468. } else {
  40469. startAngle = angle1;
  40470. endAngle = angle2;
  40471. }
  40472. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40473. let pHierarchy = [];
  40474. for (var l = 0; l < getArcPoint.length; l++) {
  40475. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40476. pHierarchy.push(cart3);
  40477. }
  40478. pHierarchy.push(pHierarchy[0]);
  40479. var arrowEntity = $this.viewer.entities.add(
  40480. {
  40481. Type: "DrawBowPlane",
  40482. Position: data,
  40483. id: data.id || $this.objId,
  40484. polygon: {
  40485. hierarchy: new $this.Cesium.PolygonHierarchy(pHierarchy),
  40486. show: true,
  40487. material: $this.Cesium.Color.YELLOW,
  40488. width: 3,
  40489. clampToGround: true,
  40490. outlineWidth: 3,
  40491. outline: true,
  40492. outlineColor: Cesium.Color.MAGENTA
  40493. }
  40494. }
  40495. );
  40496. return arrowEntity;
  40497. }
  40498. startCreate(drawType) {
  40499. this.drawType = drawType;
  40500. var $this = this;
  40501. this.handler = new $this.Cesium.ScreenSpaceEventHandler($this.viewer.scene.canvas);
  40502. this.handler.setInputAction(function(event2) {
  40503. var position2 = event2.position;
  40504. if (!$this.Cesium.defined(position2)) {
  40505. return;
  40506. }
  40507. var ray = $this.viewer.camera.getPickRay(position2);
  40508. if (!$this.Cesium.defined(ray)) {
  40509. return;
  40510. }
  40511. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  40512. if (!$this.Cesium.defined(cartesian)) {
  40513. return;
  40514. }
  40515. if ($this._positions.length == 0) {
  40516. $this._positions.push(cartesian.clone());
  40517. $this.floatingPoint = $this.createPoint(cartesian);
  40518. }
  40519. if ($this._positions.length <= 2) {
  40520. $this.createPoint(cartesian);
  40521. $this._positions.push(cartesian);
  40522. }
  40523. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  40524. this.handler.setInputAction(function(event2) {
  40525. if ($this._positions.length < 2) {
  40526. return;
  40527. }
  40528. var position2 = event2.endPosition;
  40529. if (!$this.Cesium.defined(position2)) {
  40530. return;
  40531. }
  40532. var ray = $this.viewer.camera.getPickRay(position2);
  40533. if (!$this.Cesium.defined(ray)) {
  40534. return;
  40535. }
  40536. var cartesian = $this.viewer.scene.globe.pick(ray, $this.viewer.scene);
  40537. if (!$this.Cesium.defined(cartesian)) {
  40538. return;
  40539. }
  40540. if (!$this.Cesium.defined($this.DrawBowPlane)) {
  40541. $this.DrawBowPlane = $this.createDrawBowPlane();
  40542. }
  40543. $this.floatingPoint.position.setValue(cartesian);
  40544. if ($this.DrawBowPlane) {
  40545. if ($this._positions.length == 3) {
  40546. $this._positions[1] = cartesian;
  40547. } else {
  40548. $this._positions.pop();
  40549. $this._positions.push(cartesian);
  40550. }
  40551. }
  40552. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  40553. this.handler.setInputAction(function(movement) {
  40554. if ($this._positions.length >= 3) {
  40555. $this._DrawBowPlaneData = $this._positions.concat();
  40556. $this.viewer.entities.remove($this.DrawBowPlane);
  40557. $this.DrawBowPlane = null;
  40558. var lnglatArr = [];
  40559. for (var i2 = 0; i2 < $this._DrawBowPlaneData.length; i2++) {
  40560. var lnglat = $this.cartesianToLatlng($this._DrawBowPlaneData[i2]);
  40561. lnglatArr.push(lnglat);
  40562. }
  40563. $this._DrawBowPlaneData = lnglatArr;
  40564. var pincerArrow = $this.addload(lnglatArr);
  40565. $this._entities_PincerArrow.push(pincerArrow);
  40566. $this._DrawBowPlaneLast = pincerArrow;
  40567. $this.viewer.entities.remove($this.floatingPoint);
  40568. $this.floatingPoint = null;
  40569. $this.clearPoint();
  40570. $this.destroy();
  40571. }
  40572. }, Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  40573. }
  40574. createDrawBowPlane() {
  40575. let $this = this;
  40576. var DrawBowPlaneEntity = $this.viewer.entities.add(
  40577. {
  40578. polygon: {
  40579. hierarchy: new $this.Cesium.CallbackProperty(function() {
  40580. if ($this._positions.length < 3) {
  40581. return;
  40582. }
  40583. var DrawBowPlane2 = [];
  40584. for (var i2 = 0; i2 < $this._positions.length; i2++) {
  40585. var cart3 = $this.lonLatToMercator($this.cartesianToLatlng($this._positions[i2]));
  40586. DrawBowPlane2.push(cart3);
  40587. }
  40588. let [pnt1, pnt2, pnt3, startAngle, endAngle] = [DrawBowPlane2[0], DrawBowPlane2[2], DrawBowPlane2[1], null, null];
  40589. let center2 = $this.getCircleCenterOfThreePoints(pnt1, pnt2, pnt3);
  40590. let radius = $this.MathDistance(pnt1, center2);
  40591. let angle1 = $this.getAzimuth(pnt1, center2);
  40592. let angle2 = $this.getAzimuth(pnt2, center2);
  40593. if ($this.isClockWise(pnt1, pnt2, pnt3)) {
  40594. startAngle = angle2;
  40595. endAngle = angle1;
  40596. } else {
  40597. startAngle = angle1;
  40598. endAngle = angle2;
  40599. }
  40600. let getArcPoint = $this.getArcPoints(center2, radius, startAngle, endAngle);
  40601. let pHierarchy = [];
  40602. for (var l = 0; l < getArcPoint.length; l++) {
  40603. var cart3 = $this.LatlngTocartesian($this.WebMercator2lonLat(getArcPoint[l]));
  40604. pHierarchy.push(cart3);
  40605. }
  40606. pHierarchy.push(pHierarchy[0]);
  40607. return new $this.Cesium.PolygonHierarchy(pHierarchy);
  40608. }, false),
  40609. show: true,
  40610. material: $this.Cesium.Color.YELLOW,
  40611. clampToGround: true
  40612. }
  40613. }
  40614. );
  40615. $this._entities_PincerArrow.push(DrawBowPlaneEntity);
  40616. return DrawBowPlaneEntity;
  40617. }
  40618. createPoint(cartesian) {
  40619. var $this = this;
  40620. var point2 = this.viewer.entities.add({
  40621. position: cartesian,
  40622. point: {
  40623. pixelSize: 10,
  40624. color: $this.Cesium.Color.RED,
  40625. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  40626. }
  40627. });
  40628. $this._entities_point.push(point2);
  40629. return point2;
  40630. }
  40631. cartesianToLatlng(cartesian) {
  40632. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40633. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  40634. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  40635. cartographic.height;
  40636. return [lng, lat];
  40637. }
  40638. destroy() {
  40639. if (this.handler) {
  40640. this.handler.destroy();
  40641. this.handler = null;
  40642. }
  40643. }
  40644. clearPoint() {
  40645. this.DrawEndEvent.raiseEvent(this._DrawBowPlaneLast, this._DrawBowPlaneData, this.drawType);
  40646. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40647. this.viewer.entities.remove(this._entities_point[i2]);
  40648. }
  40649. this._entities_point = [];
  40650. }
  40651. clear() {
  40652. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40653. this.viewer.entities.remove(this._entities_point[i2]);
  40654. }
  40655. for (var i2 = 0; i2 < this._entities_PincerArrow.length; i2++) {
  40656. this.viewer.entities.remove(this._entities_PincerArrow[i2]);
  40657. }
  40658. this.floatingPoint = null;
  40659. this._PincerArrow = null;
  40660. this._PincerArrowLast = null;
  40661. this._positions = [];
  40662. this._entities_point = [];
  40663. this._entities_PincerArrow = [];
  40664. this._PincerArrowData = null;
  40665. }
  40666. getCatesian3FromPX(px) {
  40667. var cartesian;
  40668. var ray = this.viewer.camera.getPickRay(px);
  40669. if (!ray)
  40670. return null;
  40671. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  40672. return cartesian;
  40673. }
  40674. _computeTempPositions() {
  40675. var _this = this;
  40676. var pnts = [].concat(_this._positions);
  40677. var num = pnts.length;
  40678. var first = pnts[0];
  40679. var last = pnts[num - 1];
  40680. if (_this._isSimpleXYZ(first, last) == false) {
  40681. pnts.push(first);
  40682. num += 1;
  40683. }
  40684. _this.tempPositions = [];
  40685. for (var i2 = 1; i2 < num; i2++) {
  40686. var p1 = pnts[i2 - 1];
  40687. var p2 = pnts[i2];
  40688. var cp = _this._computeCenterPotition(p1, p2);
  40689. _this.tempPositions.push(p1);
  40690. _this.tempPositions.push(cp);
  40691. }
  40692. }
  40693. _isSimpleXYZ(p1, p2) {
  40694. if (p1.x == p2.x && p1.y == p2.y && p1.z == p2.z) {
  40695. return true;
  40696. }
  40697. return false;
  40698. }
  40699. _computeCenterPotition(p1, p2) {
  40700. var _this = this;
  40701. var c1 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p1);
  40702. var c2 = _this.viewer.scene.globe.ellipsoid.cartesianToCartographic(p2);
  40703. var cm = new _this.Cesium.EllipsoidGeodesic(c1, c2).interpolateUsingFraction(0.5);
  40704. var cp = _this.viewer.scene.globe.ellipsoid.cartographicToCartesian(cm);
  40705. return cp;
  40706. }
  40707. getLonLat(cartesian) {
  40708. var cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40709. cartographic.height = this.viewer.scene.globe.getHeight(cartographic);
  40710. var pos = {
  40711. lon: cartographic.longitude,
  40712. lat: cartographic.latitude,
  40713. alt: cartographic.height
  40714. };
  40715. pos.lon = this.Cesium.Math.toDegrees(pos.lon);
  40716. pos.lat = this.Cesium.Math.toDegrees(pos.lat);
  40717. return pos;
  40718. }
  40719. LatlngTocartesian(latlng) {
  40720. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  40721. return cartesian3;
  40722. }
  40723. lonLatToMercator(Latlng) {
  40724. var E2 = Latlng[0];
  40725. var N2 = Latlng[1];
  40726. var x = E2 * 2003750834e-2 / 180;
  40727. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  40728. y = y * 2003750834e-2 / 180;
  40729. return [x, y];
  40730. }
  40731. WebMercator2lonLat(mercator) {
  40732. let x = mercator[0] / 2003750834e-2 * 180;
  40733. let ly = mercator[1] / 2003750834e-2 * 180;
  40734. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  40735. return [x, y];
  40736. }
  40737. getCircleCenterOfThreePoints(point1, point2, point3) {
  40738. let pntA = [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
  40739. let pntB = [pntA[0] - point1[1] + point2[1], pntA[1] + point1[0] - point2[0]];
  40740. let pntC = [(point1[0] + point3[0]) / 2, (point1[1] + point3[1]) / 2];
  40741. let pntD = [pntC[0] - point1[1] + point3[1], pntC[1] + point1[0] - point3[0]];
  40742. return this.getIntersectPoint(pntA, pntB, pntC, pntD);
  40743. }
  40744. getIntersectPoint(pntA, pntB, pntC, pntD) {
  40745. if (pntA[1] === pntB[1]) {
  40746. let f2 = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  40747. let x2 = f2 * (pntA[1] - pntC[1]) + pntC[0];
  40748. let y2 = pntA[1];
  40749. return [x2, y2];
  40750. }
  40751. if (pntC[1] === pntD[1]) {
  40752. let e2 = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  40753. let x2 = e2 * (pntC[1] - pntA[1]) + pntA[0];
  40754. let y2 = pntC[1];
  40755. return [x2, y2];
  40756. }
  40757. let e = (pntB[0] - pntA[0]) / (pntB[1] - pntA[1]);
  40758. let f = (pntD[0] - pntC[0]) / (pntD[1] - pntC[1]);
  40759. let y = (e * pntA[1] - pntA[0] - f * pntC[1] + pntC[0]) / (e - f);
  40760. let x = e * y - e * pntA[1] + pntA[0];
  40761. return [x, y];
  40762. }
  40763. MathDistance(pnt1, pnt2) {
  40764. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  40765. }
  40766. getAzimuth(startPoint, endPoint) {
  40767. let azimuth;
  40768. let angle = Math.asin(Math.abs(endPoint[1] - startPoint[1]) / this.MathDistance(startPoint, endPoint));
  40769. if (endPoint[1] >= startPoint[1] && endPoint[0] >= startPoint[0]) {
  40770. azimuth = angle + Math.PI;
  40771. } else if (endPoint[1] >= startPoint[1] && endPoint[0] < startPoint[0]) {
  40772. azimuth = Math.PI * 2 - angle;
  40773. } else if (endPoint[1] < startPoint[1] && endPoint[0] < startPoint[0]) {
  40774. azimuth = angle;
  40775. } else if (endPoint[1] < startPoint[1] && endPoint[0] >= startPoint[0]) {
  40776. azimuth = Math.PI - angle;
  40777. }
  40778. return azimuth;
  40779. }
  40780. isClockWise(pnt1, pnt2, pnt3) {
  40781. return (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
  40782. }
  40783. getArcPoints(center2, radius, startAngle, endAngle) {
  40784. let [x, y, pnts, angleDiff] = [null, null, [], endAngle - startAngle];
  40785. angleDiff = angleDiff < 0 ? angleDiff + Math.PI * 2 : angleDiff;
  40786. for (let i2 = 0; i2 <= 100; i2++) {
  40787. let angle = startAngle + angleDiff * i2 / 100;
  40788. x = center2[0] + radius * Math.cos(angle);
  40789. y = center2[1] + radius * Math.sin(angle);
  40790. pnts.push([x, y]);
  40791. }
  40792. return pnts;
  40793. }
  40794. }
  40795. class DrawCurve {
  40796. constructor(arg) {
  40797. this.viewer = arg.viewer;
  40798. this.Cesium = arg.Cesium;
  40799. this.floatingPoint = null;
  40800. this._curveline = null;
  40801. this._curvelineLast = null;
  40802. this._positions = [];
  40803. this._entities_point = [];
  40804. this._entities_line = [];
  40805. this._curvelineData = null;
  40806. this.DrawStartEvent = new Cesium.Event();
  40807. this.DrawEndEvent = new Cesium.Event();
  40808. this.ZERO_TOLERANCE = 1e-4;
  40809. this.FITTING_COUNT = 100;
  40810. this.t = 0.3;
  40811. this._param = {
  40812. id: "DrawStraightArrow",
  40813. polygonColor: "rgba(0,255,0,0.5)",
  40814. outlineColor: "rgba(255, 255, 255, 1)",
  40815. outlineWidth: 1
  40816. };
  40817. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  40818. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  40819. }
  40820. get curveline() {
  40821. return this._curvelineLast;
  40822. }
  40823. getData() {
  40824. return this._curvelineData;
  40825. }
  40826. addload(data) {
  40827. var $this = this;
  40828. let pnts = [];
  40829. for (let p = 0; p < data.length; p++) {
  40830. pnts.push($this.lonLatToMercator(data[p]));
  40831. }
  40832. let CurvePoints = $this.getCurvePoints(pnts);
  40833. let point2 = [];
  40834. for (let i2 = 0; i2 < CurvePoints.length; i2++) {
  40835. point2.push($this.LatlngTocartesian($this.WebMercator2lonLat(CurvePoints[i2])));
  40836. }
  40837. var polyline = this.viewer.entities.add({
  40838. Type: "DrawCurve",
  40839. Position: data,
  40840. id: data.id || $this.objId,
  40841. polyline: {
  40842. positions: point2,
  40843. show: true,
  40844. material: $this.Cesium.Color.YELLOW,
  40845. width: 3,
  40846. clampToGround: true
  40847. }
  40848. });
  40849. return polyline;
  40850. }
  40851. computePosition(data) {
  40852. let pnts = [];
  40853. let position2 = [];
  40854. for (let p = 0; p < data.length; p++) {
  40855. position2.push(this.cartesianToLatlng(data[p]));
  40856. pnts.push(this.lonLatToMercator(this.cartesianToLatlng(data[p])));
  40857. }
  40858. this._curvelineData = position2;
  40859. let CurvePoints = this.getCurvePoints(pnts);
  40860. let point2 = [];
  40861. for (let i2 = 0; i2 < CurvePoints.length; i2++) {
  40862. point2.push(this.LatlngTocartesian(this.WebMercator2lonLat(CurvePoints[i2])));
  40863. }
  40864. return point2;
  40865. }
  40866. startCreate(drawType) {
  40867. this.drawType = drawType;
  40868. var $this = this;
  40869. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  40870. this.handler.setInputAction(function(evt) {
  40871. var cartesian = $this.getCatesian3FromPX(evt.position);
  40872. if ($this._positions.length == 0) {
  40873. $this._positions.push(cartesian.clone());
  40874. $this.floatingPoint = $this.createPoint(cartesian);
  40875. $this.createPoint(cartesian);
  40876. }
  40877. $this._positions.push(cartesian);
  40878. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  40879. this.handler.setInputAction(function(evt) {
  40880. if ($this._positions.length < 3)
  40881. return;
  40882. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  40883. if (!$this.Cesium.defined($this._curveline)) {
  40884. $this._curveline = $this.createCurveline();
  40885. }
  40886. $this.floatingPoint.position.setValue(cartesian);
  40887. if ($this._curveline) {
  40888. $this._positions.pop();
  40889. $this._positions.push(cartesian);
  40890. }
  40891. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  40892. this.handler.setInputAction(function(evt) {
  40893. if (!$this._curveline)
  40894. return;
  40895. var cartesian = $this.getCatesian3FromPX(evt.position);
  40896. $this._positions.pop();
  40897. $this._positions.push(cartesian);
  40898. $this.createPoint(cartesian);
  40899. $this._curvelineData = $this._positions.concat();
  40900. $this.viewer.entities.remove($this._curveline);
  40901. $this._curveline = null;
  40902. $this._positions = [];
  40903. $this.floatingPoint.position.setValue(cartesian);
  40904. let lnglatArr = [];
  40905. for (var i2 = 0; i2 < $this._curvelineData.length; i2++) {
  40906. var lnglat = $this.cartesianToLatlng($this._curvelineData[i2]);
  40907. lnglatArr.push(lnglat);
  40908. }
  40909. $this._curvelineData = lnglatArr;
  40910. var line = $this.addload($this._curvelineData);
  40911. $this._entities_line.push(line);
  40912. $this._curvelineLast = line;
  40913. $this.clearPoint();
  40914. $this.destroy();
  40915. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  40916. }
  40917. createPoint(cartesian) {
  40918. var $this = this;
  40919. var point2 = this.viewer.entities.add({
  40920. position: cartesian,
  40921. point: {
  40922. pixelSize: 10,
  40923. color: $this.Cesium.Color.RED,
  40924. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  40925. }
  40926. });
  40927. $this._entities_point.push(point2);
  40928. return point2;
  40929. }
  40930. createCurveline() {
  40931. var $this = this;
  40932. var polyline = this.viewer.entities.add({
  40933. polyline: {
  40934. positions: new $this.Cesium.CallbackProperty(function() {
  40935. let pnts = [];
  40936. for (let p = 0; p < $this._positions.length; p++) {
  40937. pnts.push($this.lonLatToMercator($this.cartesianToLatlng($this._positions[p])));
  40938. }
  40939. let CurvePoints = $this.getCurvePoints(pnts);
  40940. let point2 = [];
  40941. for (let i2 = 0; i2 < CurvePoints.length; i2++) {
  40942. point2.push($this.LatlngTocartesian($this.WebMercator2lonLat(CurvePoints[i2])));
  40943. }
  40944. return point2;
  40945. }, false),
  40946. show: true,
  40947. material: $this.Cesium.Color.YELLOW,
  40948. width: 3,
  40949. clampToGround: true
  40950. }
  40951. });
  40952. $this._entities_line.push(polyline);
  40953. return polyline;
  40954. }
  40955. clearPoint() {
  40956. this.DrawEndEvent.raiseEvent(this._curvelineLast, this._curvelineData, this.drawType);
  40957. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40958. this.viewer.entities.remove(this._entities_point[i2]);
  40959. }
  40960. this._entities_point = [];
  40961. }
  40962. destroy() {
  40963. if (this.handler) {
  40964. this.handler.destroy();
  40965. this.handler = null;
  40966. }
  40967. }
  40968. clear() {
  40969. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  40970. this.viewer.entities.remove(this._entities_point[i2]);
  40971. }
  40972. for (var i2 = 0; i2 < this._entities_line.length; i2++) {
  40973. this.viewer.entities.remove(this._entities_line[i2]);
  40974. }
  40975. this.floatingPoint = null;
  40976. this._curveline = null;
  40977. this._curvelineLast = null;
  40978. this._positions = [];
  40979. this._entities_point = [];
  40980. this._entities_line = [];
  40981. this._curvelineData = null;
  40982. }
  40983. getCatesian3FromPX(px) {
  40984. var cartesian;
  40985. var ray = this.viewer.camera.getPickRay(px);
  40986. if (!ray)
  40987. return null;
  40988. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  40989. return cartesian;
  40990. }
  40991. cartesianToLatlng(cartesian) {
  40992. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  40993. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  40994. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  40995. return [lng, lat];
  40996. }
  40997. LatlngTocartesian(latlng) {
  40998. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  40999. return cartesian3;
  41000. }
  41001. lonLatToMercator(Latlng) {
  41002. var E2 = Latlng[0];
  41003. var N2 = Latlng[1];
  41004. var x = E2 * 2003750834e-2 / 180;
  41005. var y = Math.log(Math.tan((90 + N2) * Math.PI / 360)) / (Math.PI / 180);
  41006. y = y * 2003750834e-2 / 180;
  41007. return [x, y];
  41008. }
  41009. WebMercator2lonLat(mercator) {
  41010. let x = mercator[0] / 2003750834e-2 * 180;
  41011. let ly = mercator[1] / 2003750834e-2 * 180;
  41012. let y = 180 / Math.PI * (2 * Math.atan(Math.exp(ly * Math.PI / 180)) - Math.PI / 2);
  41013. return [x, y];
  41014. }
  41015. getCurvePoints(controlPoints) {
  41016. let leftControl = this.getLeftMostControlPoint(controlPoints, this.t);
  41017. let [pnt1, pnt2, pnt3, normals, points2] = [null, null, null, [leftControl], []];
  41018. for (let i2 = 0; i2 < controlPoints.length - 2; i2++) {
  41019. [pnt1, pnt2, pnt3] = [controlPoints[i2], controlPoints[i2 + 1], controlPoints[i2 + 2]];
  41020. let normalPoints = this.getBisectorNormals(this.t, pnt1, pnt2, pnt3);
  41021. normals = normals.concat(normalPoints);
  41022. }
  41023. let rightControl = this.getRightMostControlPoint(controlPoints, this.t);
  41024. if (rightControl) {
  41025. normals.push(rightControl);
  41026. }
  41027. for (let i2 = 0; i2 < controlPoints.length - 1; i2++) {
  41028. pnt1 = controlPoints[i2];
  41029. pnt2 = controlPoints[i2 + 1];
  41030. points2.push(pnt1);
  41031. for (let t2 = 0; t2 < this.FITTING_COUNT; t2++) {
  41032. let pnt = this.getCubicValue(t2 / this.FITTING_COUNT, pnt1, normals[i2 * 2], normals[i2 * 2 + 1], pnt2);
  41033. points2.push(pnt);
  41034. }
  41035. points2.push(pnt2);
  41036. }
  41037. return points2;
  41038. }
  41039. getLeftMostControlPoint(controlPoints, t2) {
  41040. let [pnt1, pnt2, pnt3, controlX, controlY] = [controlPoints[0], controlPoints[1], controlPoints[2], null, null];
  41041. let pnts = this.getBisectorNormals(0, pnt1, pnt2, pnt3);
  41042. let normalRight = pnts[0];
  41043. let normal = this.getNormal(pnt1, pnt2, pnt3);
  41044. let dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  41045. if (dist > this.ZERO_TOLERANCE) {
  41046. let mid = this.Mid(pnt1, pnt2);
  41047. let pX = pnt1[0] - mid[0];
  41048. let pY = pnt1[1] - mid[1];
  41049. let d1 = this.MathDistance(pnt1, pnt2);
  41050. let n = 2 / d1;
  41051. let nX = -n * pY;
  41052. let nY = n * pX;
  41053. let a11 = nX * nX - nY * nY;
  41054. let a12 = 2 * nX * nY;
  41055. let a22 = nY * nY - nX * nX;
  41056. let dX = normalRight[0] - mid[0];
  41057. let dY = normalRight[1] - mid[1];
  41058. controlX = mid[0] + a11 * dX + a12 * dY;
  41059. controlY = mid[1] + a12 * dX + a22 * dY;
  41060. } else {
  41061. controlX = pnt1[0] + t2 * (pnt2[0] - pnt1[0]);
  41062. controlY = pnt1[1] + t2 * (pnt2[1] - pnt1[1]);
  41063. }
  41064. return [controlX, controlY];
  41065. }
  41066. getBisectorNormals(t2, pnt1, pnt2, pnt3) {
  41067. let normal = this.getNormal(pnt1, pnt2, pnt3);
  41068. let [bisectorNormalRight, bisectorNormalLeft, dt2, x, y] = [null, null, null, null, null];
  41069. let dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  41070. let uX = normal[0] / dist;
  41071. let uY = normal[1] / dist;
  41072. let d1 = this.MathDistance(pnt1, pnt2);
  41073. let d2 = this.MathDistance(pnt2, pnt3);
  41074. if (dist > this.ZERO_TOLERANCE) {
  41075. if (this.isClockWise(pnt1, pnt2, pnt3)) {
  41076. dt2 = t2 * d1;
  41077. x = pnt2[0] - dt2 * uY;
  41078. y = pnt2[1] + dt2 * uX;
  41079. bisectorNormalRight = [x, y];
  41080. dt2 = t2 * d2;
  41081. x = pnt2[0] + dt2 * uY;
  41082. y = pnt2[1] - dt2 * uX;
  41083. bisectorNormalLeft = [x, y];
  41084. } else {
  41085. dt2 = t2 * d1;
  41086. x = pnt2[0] + dt2 * uY;
  41087. y = pnt2[1] - dt2 * uX;
  41088. bisectorNormalRight = [x, y];
  41089. dt2 = t2 * d2;
  41090. x = pnt2[0] - dt2 * uY;
  41091. y = pnt2[1] + dt2 * uX;
  41092. bisectorNormalLeft = [x, y];
  41093. }
  41094. } else {
  41095. x = pnt2[0] + t2 * (pnt1[0] - pnt2[0]);
  41096. y = pnt2[1] + t2 * (pnt1[1] - pnt2[1]);
  41097. bisectorNormalRight = [x, y];
  41098. x = pnt2[0] + t2 * (pnt3[0] - pnt2[0]);
  41099. y = pnt2[1] + t2 * (pnt3[1] - pnt2[1]);
  41100. bisectorNormalLeft = [x, y];
  41101. }
  41102. return [bisectorNormalRight, bisectorNormalLeft];
  41103. }
  41104. getNormal(pnt1, pnt2, pnt3) {
  41105. let dX1 = pnt1[0] - pnt2[0];
  41106. let dY1 = pnt1[1] - pnt2[1];
  41107. let d1 = Math.sqrt(dX1 * dX1 + dY1 * dY1);
  41108. dX1 /= d1;
  41109. dY1 /= d1;
  41110. let dX2 = pnt3[0] - pnt2[0];
  41111. let dY2 = pnt3[1] - pnt2[1];
  41112. let d2 = Math.sqrt(dX2 * dX2 + dY2 * dY2);
  41113. dX2 /= d2;
  41114. dY2 /= d2;
  41115. let uX = dX1 + dX2;
  41116. let uY = dY1 + dY2;
  41117. return [uX, uY];
  41118. }
  41119. isClockWise(pnt1, pnt2, pnt3) {
  41120. return (pnt3[1] - pnt1[1]) * (pnt2[0] - pnt1[0]) > (pnt2[1] - pnt1[1]) * (pnt3[0] - pnt1[0]);
  41121. }
  41122. Mid(point1, point2) {
  41123. return [(point1[0] + point2[0]) / 2, (point1[1] + point2[1]) / 2];
  41124. }
  41125. MathDistance(pnt1, pnt2) {
  41126. return Math.sqrt(Math.pow(pnt1[0] - pnt2[0], 2) + Math.pow(pnt1[1] - pnt2[1], 2));
  41127. }
  41128. getRightMostControlPoint(controlPoints, t2) {
  41129. let count = controlPoints.length;
  41130. let pnt1 = controlPoints[count - 3];
  41131. let pnt2 = controlPoints[count - 2];
  41132. let pnt3 = controlPoints[count - 1];
  41133. let pnts = this.getBisectorNormals(0, pnt1, pnt2, pnt3);
  41134. let normalLeft = pnts[1];
  41135. let normal = this.getNormal(pnt1, pnt2, pnt3);
  41136. let dist = Math.sqrt(normal[0] * normal[0] + normal[1] * normal[1]);
  41137. let [controlX, controlY] = [null, null];
  41138. if (dist > this.ZERO_TOLERANCE) {
  41139. let mid = this.Mid(pnt2, pnt3);
  41140. let pX = pnt3[0] - mid[0];
  41141. let pY = pnt3[1] - mid[1];
  41142. let d1 = this.MathDistance(pnt2, pnt3);
  41143. let n = 2 / d1;
  41144. let nX = -n * pY;
  41145. let nY = n * pX;
  41146. let a11 = nX * nX - nY * nY;
  41147. let a12 = 2 * nX * nY;
  41148. let a22 = nY * nY - nX * nX;
  41149. let dX = normalLeft[0] - mid[0];
  41150. let dY = normalLeft[1] - mid[1];
  41151. controlX = mid[0] + a11 * dX + a12 * dY;
  41152. controlY = mid[1] + a12 * dX + a22 * dY;
  41153. } else {
  41154. controlX = pnt3[0] + t2 * (pnt2[0] - pnt3[0]);
  41155. controlY = pnt3[1] + t2 * (pnt2[1] - pnt3[1]);
  41156. }
  41157. return [controlX, controlY];
  41158. }
  41159. getCubicValue(t2, startPnt, cPnt1, cPnt2, endPnt) {
  41160. t2 = Math.max(Math.min(t2, 1), 0);
  41161. let [tp, t22] = [1 - t2, t2 * t2];
  41162. let t3 = t22 * t2;
  41163. let tp2 = tp * tp;
  41164. let tp3 = tp2 * tp;
  41165. let x = tp3 * startPnt[0] + 3 * tp2 * t2 * cPnt1[0] + 3 * tp * t22 * cPnt2[0] + t3 * endPnt[0];
  41166. let y = tp3 * startPnt[1] + 3 * tp2 * t2 * cPnt1[1] + 3 * tp * t22 * cPnt2[1] + t3 * endPnt[1];
  41167. return [x, y];
  41168. }
  41169. }
  41170. class DrawCurveFlag {
  41171. constructor(arg) {
  41172. this.viewer = arg.viewer;
  41173. this.Cesium = arg.Cesium;
  41174. this.identificationPoint = null;
  41175. this.CurveFlag = null;
  41176. this.CurveFlagLast = null;
  41177. this.positions = [];
  41178. this.entitiesPoint = [];
  41179. this.entitiesCurveFlag = [];
  41180. this.CurveFlagData = null;
  41181. this.DrawStartEvent = new Cesium.Event();
  41182. this.DrawEndEvent = new Cesium.Event();
  41183. this._param = {
  41184. id: "DrawStraightArrow",
  41185. polygonColor: "rgba(0,255,0,0.5)",
  41186. outlineColor: "rgba(255, 255, 255, 1)",
  41187. outlineWidth: 1
  41188. };
  41189. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  41190. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  41191. }
  41192. getData() {
  41193. return this.CurveFlagData;
  41194. }
  41195. computePosition(data) {
  41196. let $this = this;
  41197. var lnglatArr = [];
  41198. for (var i2 = 0; i2 < data.length; i2++) {
  41199. var lnglat = $this.cartesianToLatlng(data[i2]);
  41200. lnglatArr.push(lnglat);
  41201. }
  41202. let startPoint = lnglatArr[0];
  41203. let endPoint = lnglatArr[lnglatArr.length - 1];
  41204. let point1 = startPoint;
  41205. let point2 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41206. let point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
  41207. let point4 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41208. let point5 = [endPoint[0], startPoint[1]];
  41209. let point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41210. let point7 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]];
  41211. let point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
  41212. let point9 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]];
  41213. let point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41214. let point11 = [startPoint[0], endPoint[1]];
  41215. let curve1 = $this.getBezierPoints([point1, point2, point3, point4, point5]);
  41216. let curve2 = $this.getBezierPoints([point6, point7, point8, point9, point10]);
  41217. let componentspolygon = [];
  41218. componentspolygon = curve1.concat(curve2);
  41219. let PolygonHierarchy = new $this.Cesium.PolygonHierarchy(componentspolygon);
  41220. let componentspolyline = [];
  41221. componentspolyline = curve1.concat(curve2);
  41222. componentspolyline.push($this.LatlngTocartesian(point1));
  41223. componentspolyline.push($this.LatlngTocartesian(point11));
  41224. $this.CurveFlagData = lnglatArr;
  41225. return [PolygonHierarchy, componentspolyline];
  41226. }
  41227. addload(data) {
  41228. var $this = this;
  41229. if (data.length < 2)
  41230. return;
  41231. let startPoint = data[0];
  41232. let endPoint = data[data.length - 1];
  41233. let point1 = startPoint;
  41234. let point2 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41235. let point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
  41236. let point4 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41237. let point5 = [endPoint[0], startPoint[1]];
  41238. let point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41239. let point7 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]];
  41240. let point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
  41241. let point9 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]];
  41242. let point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41243. let point11 = [startPoint[0], endPoint[1]];
  41244. let curve1 = $this.getBezierPoints([point1, point2, point3, point4, point5]);
  41245. let curve2 = $this.getBezierPoints([point6, point7, point8, point9, point10]);
  41246. let componentspolygon = [];
  41247. componentspolygon = curve1.concat(curve2);
  41248. let componentspolyline = [];
  41249. componentspolyline = curve1.concat(curve2);
  41250. componentspolyline.push($this.LatlngTocartesian(point1));
  41251. componentspolyline.push($this.LatlngTocartesian(point11));
  41252. var shape = this.viewer.entities.add({
  41253. Type: "DrawCurveFlag",
  41254. Position: data,
  41255. id: data.id || $this.objId,
  41256. polygon: {
  41257. hierarchy: new $this.Cesium.PolygonHierarchy(componentspolygon),
  41258. extrudedHeight: 1,
  41259. material: $this.Cesium.Color.RED
  41260. },
  41261. polyline: {
  41262. positions: componentspolyline,
  41263. show: true,
  41264. material: $this.Cesium.Color.YELLOW,
  41265. width: 5,
  41266. clampToGround: true
  41267. }
  41268. });
  41269. $this.entitiesCurveFlag.push(shape);
  41270. return shape;
  41271. }
  41272. startCreate(drawType) {
  41273. this.drawType = drawType;
  41274. var $this = this;
  41275. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  41276. this.handler.setInputAction(function(evt) {
  41277. var cartesian = $this.getCatesian3FromPX(evt.position);
  41278. if ($this.positions.length == 0) {
  41279. $this.positions.push(cartesian.clone());
  41280. $this.identificationPoint = $this.createPoint(cartesian);
  41281. $this.createPoint(cartesian);
  41282. $this.positions.push(cartesian);
  41283. }
  41284. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  41285. this.handler.setInputAction(function(evt) {
  41286. if ($this.positions.length < 2)
  41287. return;
  41288. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  41289. if (!$this.Cesium.defined($this.CurveFlag)) {
  41290. $this.CurveFlag = $this.createCurveFlag();
  41291. }
  41292. $this.identificationPoint.position.setValue(cartesian);
  41293. if ($this.CurveFlag) {
  41294. $this.positions.pop();
  41295. $this.positions.push(cartesian);
  41296. }
  41297. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  41298. this.handler.setInputAction(function(evt) {
  41299. if (!$this.CurveFlag)
  41300. return;
  41301. var cartesian = $this.getCatesian3FromPX(evt.position);
  41302. $this.positions.pop();
  41303. $this.positions.push(cartesian);
  41304. $this.createPoint(cartesian);
  41305. $this.CurveFlagData = $this.positions.concat();
  41306. $this.viewer.entities.remove($this.CurveFlag);
  41307. $this.CurveFlag = null;
  41308. $this.positions = [];
  41309. $this.identificationPoint.position.setValue(cartesian);
  41310. var lnglatArr = [];
  41311. for (var i2 = 0; i2 < $this.CurveFlagData.length; i2++) {
  41312. var lnglat = $this.cartesianToLatlng($this.CurveFlagData[i2]);
  41313. lnglatArr.push(lnglat);
  41314. }
  41315. $this.CurveFlagData = lnglatArr;
  41316. var CurveFlag = $this.addload([$this.CurveFlagData[0], $this.CurveFlagData[$this.CurveFlagData.length - 1]]);
  41317. $this.entitiesCurveFlag.push(CurveFlag);
  41318. $this.CurveFlagLast = CurveFlag;
  41319. $this.clearPoint();
  41320. $this.destroy();
  41321. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  41322. }
  41323. createPoint(cartesian) {
  41324. var $this = this;
  41325. var point2 = this.viewer.entities.add({
  41326. position: cartesian,
  41327. point: {
  41328. pixelSize: 10,
  41329. color: $this.Cesium.Color.RED,
  41330. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  41331. }
  41332. });
  41333. $this.entitiesPoint.push(point2);
  41334. return point2;
  41335. }
  41336. createCurveFlag() {
  41337. var $this = this;
  41338. var polygon2 = this.viewer.entities.add({
  41339. polygon: {
  41340. hierarchy: new $this.Cesium.CallbackProperty(function() {
  41341. if ($this.positions.length < 2)
  41342. return;
  41343. let lonlat = [];
  41344. let components = [];
  41345. let length = $this.positions.length;
  41346. for (let i2 = 0; i2 < length; i2++) {
  41347. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41348. }
  41349. let startPoint = lonlat[0];
  41350. let endPoint = lonlat[lonlat.length - 1];
  41351. let point1 = startPoint;
  41352. let point2 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41353. let point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
  41354. let point4 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41355. let point5 = [endPoint[0], startPoint[1]];
  41356. let point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41357. let point7 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]];
  41358. let point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
  41359. let point9 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]];
  41360. let point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41361. [startPoint[0], endPoint[1]];
  41362. let curve1 = $this.getBezierPoints([point1, point2, point3, point4, point5]);
  41363. let curve2 = $this.getBezierPoints([point6, point7, point8, point9, point10]);
  41364. components = curve1.concat(curve2);
  41365. return new $this.Cesium.PolygonHierarchy(components);
  41366. }, false),
  41367. extrudedHeight: 1,
  41368. material: $this.Cesium.Color.RED
  41369. },
  41370. polyline: {
  41371. positions: new $this.Cesium.CallbackProperty(function() {
  41372. if ($this.positions.length < 2)
  41373. return;
  41374. let lonlat = [];
  41375. let components = [];
  41376. let length = $this.positions.length;
  41377. for (let i2 = 0; i2 < length; i2++) {
  41378. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41379. }
  41380. let startPoint = lonlat[0];
  41381. let endPoint = lonlat[lonlat.length - 1];
  41382. let point1 = startPoint;
  41383. let point2 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41384. let point3 = [(startPoint[0] + endPoint[0]) / 2, startPoint[1]];
  41385. let point4 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], -(endPoint[1] - startPoint[1]) / 8 + startPoint[1]];
  41386. let point5 = [endPoint[0], startPoint[1]];
  41387. let point6 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41388. let point7 = [(endPoint[0] - startPoint[0]) * 3 / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 3 / 8 + startPoint[1]];
  41389. let point8 = [(startPoint[0] + endPoint[0]) / 2, (startPoint[1] + endPoint[1]) / 2];
  41390. let point9 = [(endPoint[0] - startPoint[0]) / 4 + startPoint[0], (endPoint[1] - startPoint[1]) * 5 / 8 + startPoint[1]];
  41391. let point10 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41392. let point11 = [startPoint[0], endPoint[1]];
  41393. let curve1 = $this.getBezierPoints([point1, point2, point3, point4, point5]);
  41394. let curve2 = $this.getBezierPoints([point6, point7, point8, point9, point10]);
  41395. components = curve1.concat(curve2);
  41396. components.push($this.LatlngTocartesian(point1));
  41397. components.push($this.LatlngTocartesian(point11));
  41398. return components;
  41399. }, false),
  41400. show: true,
  41401. material: $this.Cesium.Color.YELLOW,
  41402. width: 5,
  41403. clampToGround: true
  41404. }
  41405. });
  41406. $this.entitiesCurveFlag.push(polygon2);
  41407. return polygon2;
  41408. }
  41409. cartesianToLatlng(cartesian) {
  41410. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  41411. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  41412. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  41413. return [lng, lat];
  41414. }
  41415. LatlngTocartesian(latlng) {
  41416. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  41417. return cartesian3;
  41418. }
  41419. clearPoint() {
  41420. this.DrawEndEvent.raiseEvent(this.CurveFlagLast, [this.CurveFlagData[0], this.CurveFlagData[this.CurveFlagData.length - 1]], this.drawType);
  41421. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41422. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41423. }
  41424. this.entitiesPoint = [];
  41425. }
  41426. destroy() {
  41427. if (this.handler) {
  41428. this.handler.destroy();
  41429. this.handler = null;
  41430. }
  41431. }
  41432. clear() {
  41433. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41434. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41435. }
  41436. for (var i2 = 0; i2 < this.entitiesCurveFlag.length; i2++) {
  41437. this.viewer.entities.remove(this.entitiesCurveFlag[i2]);
  41438. }
  41439. this.identificationPoint = null;
  41440. this.CurveFlag = null;
  41441. this.CurveFlagLast = null;
  41442. this.positions = [];
  41443. this.entitiesPoint = [];
  41444. this.entitiesCurveFlag = [];
  41445. this.CurveFlagData = null;
  41446. }
  41447. getCatesian3FromPX(px) {
  41448. var cartesian;
  41449. var ray = this.viewer.camera.getPickRay(px);
  41450. if (!ray)
  41451. return null;
  41452. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  41453. return cartesian;
  41454. }
  41455. getBezierPoints(points2) {
  41456. let $this = this;
  41457. if (points2.length <= 2) {
  41458. return points2;
  41459. } else {
  41460. let bezierPoints = [];
  41461. let n = points2.length - 1;
  41462. for (let t2 = 0; t2 <= 1; t2 += 0.01) {
  41463. let [x, y] = [0, 0];
  41464. for (let index2 = 0; index2 <= n; index2++) {
  41465. let factor = $this.getBinomialFactor(n, index2);
  41466. let a = Math.pow(t2, index2);
  41467. let b = Math.pow(1 - t2, n - index2);
  41468. x += factor * a * b * points2[index2][0];
  41469. y += factor * a * b * points2[index2][1];
  41470. }
  41471. bezierPoints.push($this.LatlngTocartesian([x, y]));
  41472. }
  41473. bezierPoints.push($this.LatlngTocartesian(points2[n]));
  41474. return bezierPoints;
  41475. }
  41476. }
  41477. getBinomialFactor(n, index2) {
  41478. return this.getFactorial(n) / (this.getFactorial(index2) * this.getFactorial(n - index2));
  41479. }
  41480. getFactorial(n) {
  41481. let result = 1;
  41482. switch (n) {
  41483. case n <= 1:
  41484. result = 1;
  41485. break;
  41486. case n === 2:
  41487. result = 2;
  41488. break;
  41489. case n === 3:
  41490. result = 6;
  41491. break;
  41492. case n === 24:
  41493. result = 24;
  41494. break;
  41495. case n === 5:
  41496. result = 120;
  41497. break;
  41498. default:
  41499. for (let i2 = 1; i2 <= n; i2++) {
  41500. result *= i2;
  41501. }
  41502. break;
  41503. }
  41504. return result;
  41505. }
  41506. }
  41507. class DrawRectFlag {
  41508. constructor(arg) {
  41509. this.viewer = arg.viewer;
  41510. this.Cesium = arg.Cesium;
  41511. this.identificationPoint = null;
  41512. this.RectFlag = null;
  41513. this.RectFlagLast = null;
  41514. this.positions = [];
  41515. this.entitiesPoint = [];
  41516. this.entitiesRectFlag = [];
  41517. this.RectFlagData = null;
  41518. this.DrawStartEvent = new Cesium.Event();
  41519. this.DrawEndEvent = new Cesium.Event();
  41520. this._param = {
  41521. id: "DrawStraightArrow",
  41522. polygonColor: "rgba(0,255,0,0.5)",
  41523. outlineColor: "rgba(255, 255, 255, 1)",
  41524. outlineWidth: 1
  41525. };
  41526. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  41527. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  41528. }
  41529. getData() {
  41530. return this.RectFlagData;
  41531. }
  41532. computePosition(data) {
  41533. let $this = this;
  41534. var lnglatArr = [];
  41535. for (var i2 = 0; i2 < data.length; i2++) {
  41536. var lnglat = $this.cartesianToLatlng(data[i2]);
  41537. lnglatArr.push(lnglat);
  41538. }
  41539. let startPoint = lnglatArr[0];
  41540. let endPoint = lnglatArr[lnglatArr.length - 1];
  41541. let point0 = lnglatArr[0];
  41542. var point1 = [endPoint[0], startPoint[1]];
  41543. var point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41544. var point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41545. var point4 = [startPoint[0], endPoint[1]];
  41546. let componentspolygon = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0]);
  41547. let componentspolyline = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0, ...point4]);
  41548. let PolygonHierarchy = new $this.Cesium.PolygonHierarchy(componentspolygon);
  41549. $this.RectFlagData = lnglatArr;
  41550. console.log([PolygonHierarchy, componentspolyline]);
  41551. return [PolygonHierarchy, componentspolyline];
  41552. }
  41553. addload(data) {
  41554. var $this = this;
  41555. if (data.length < 2)
  41556. return;
  41557. let startPoint = data[0];
  41558. let endPoint = data[data.length - 1];
  41559. let point0 = data[0];
  41560. var point1 = [endPoint[0], startPoint[1]];
  41561. var point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41562. var point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41563. var point4 = [startPoint[0], endPoint[1]];
  41564. let componentspolygon = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0]);
  41565. let componentspolyline = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0, ...point4]);
  41566. var shape = this.viewer.entities.add({
  41567. Type: "DrawRectFlag",
  41568. Position: data,
  41569. id: data.id || $this.objId,
  41570. polygon: {
  41571. hierarchy: new $this.Cesium.PolygonHierarchy(componentspolygon),
  41572. extrudedHeight: 1,
  41573. material: $this.Cesium.Color.RED
  41574. },
  41575. polyline: {
  41576. positions: componentspolyline,
  41577. show: true,
  41578. material: $this.Cesium.Color.YELLOW,
  41579. width: 5,
  41580. clampToGround: true
  41581. }
  41582. });
  41583. $this.entitiesRectFlag.push(shape);
  41584. return shape;
  41585. }
  41586. startCreate(drawType) {
  41587. this.drawType = drawType;
  41588. var $this = this;
  41589. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  41590. this.handler.setInputAction(function(evt) {
  41591. var cartesian = $this.getCatesian3FromPX(evt.position);
  41592. if ($this.positions.length == 0) {
  41593. $this.positions.push(cartesian.clone());
  41594. $this.identificationPoint = $this.createPoint(cartesian);
  41595. $this.createPoint(cartesian);
  41596. $this.positions.push(cartesian);
  41597. }
  41598. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  41599. this.handler.setInputAction(function(evt) {
  41600. if ($this.positions.length < 2)
  41601. return;
  41602. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  41603. if (!$this.Cesium.defined($this.RectFlag)) {
  41604. $this.RectFlag = $this.createRectFlag();
  41605. }
  41606. $this.identificationPoint.position.setValue(cartesian);
  41607. if ($this.RectFlag) {
  41608. $this.positions.pop();
  41609. $this.positions.push(cartesian);
  41610. }
  41611. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  41612. this.handler.setInputAction(function(evt) {
  41613. if (!$this.RectFlag)
  41614. return;
  41615. var cartesian = $this.getCatesian3FromPX(evt.position);
  41616. $this.positions.pop();
  41617. $this.positions.push(cartesian);
  41618. $this.createPoint(cartesian);
  41619. $this.RectFlagData = $this.positions.concat();
  41620. $this.viewer.entities.remove($this.RectFlag);
  41621. $this.RectFlag = null;
  41622. $this.positions = [];
  41623. $this.identificationPoint.position.setValue(cartesian);
  41624. var lnglatArr = [];
  41625. for (var i2 = 0; i2 < $this.RectFlagData.length; i2++) {
  41626. var lnglat = $this.cartesianToLatlng($this.RectFlagData[i2]);
  41627. lnglatArr.push(lnglat);
  41628. }
  41629. $this.RectFlagData = lnglatArr;
  41630. var RectFlag = $this.addload([$this.RectFlagData[0], $this.RectFlagData[$this.RectFlagData.length - 1]]);
  41631. $this.entitiesRectFlag.push(RectFlag);
  41632. $this.RectFlagLast = RectFlag;
  41633. $this.clearPoint();
  41634. $this.destroy();
  41635. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  41636. }
  41637. createPoint(cartesian) {
  41638. var $this = this;
  41639. var point2 = this.viewer.entities.add({
  41640. position: cartesian,
  41641. point: {
  41642. pixelSize: 10,
  41643. color: $this.Cesium.Color.RED,
  41644. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  41645. }
  41646. });
  41647. $this.entitiesPoint.push(point2);
  41648. return point2;
  41649. }
  41650. createRectFlag() {
  41651. console.log("232323");
  41652. var $this = this;
  41653. var polygon2 = this.viewer.entities.add({
  41654. polygon: {
  41655. hierarchy: new $this.Cesium.CallbackProperty(function() {
  41656. if ($this.positions.length < 2)
  41657. return;
  41658. let lonlat = [];
  41659. let length = $this.positions.length;
  41660. for (let i2 = 0; i2 < length; i2++) {
  41661. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41662. }
  41663. let startPoint = lonlat[0];
  41664. let endPoint = lonlat[lonlat.length - 1];
  41665. let point0 = lonlat[0];
  41666. var point1 = [endPoint[0], startPoint[1]];
  41667. var point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41668. var point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41669. [startPoint[0], endPoint[1]];
  41670. let components = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0]);
  41671. return new $this.Cesium.PolygonHierarchy(components);
  41672. }, false),
  41673. extrudedHeight: 1,
  41674. material: $this.Cesium.Color.RED
  41675. },
  41676. polyline: {
  41677. positions: new $this.Cesium.CallbackProperty(function() {
  41678. if ($this.positions.length < 2)
  41679. return;
  41680. let lonlat = [];
  41681. let length = $this.positions.length;
  41682. for (let i2 = 0; i2 < length; i2++) {
  41683. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41684. }
  41685. let startPoint = lonlat[0];
  41686. let endPoint = lonlat[lonlat.length - 1];
  41687. let point0 = lonlat[0];
  41688. var point1 = [endPoint[0], startPoint[1]];
  41689. var point2 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41690. var point3 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41691. var point4 = [startPoint[0], endPoint[1]];
  41692. let components = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point3, ...point0, ...point4]);
  41693. return components;
  41694. }, false),
  41695. show: true,
  41696. material: $this.Cesium.Color.YELLOW,
  41697. width: 5,
  41698. clampToGround: true
  41699. }
  41700. });
  41701. $this.entitiesRectFlag.push(polygon2);
  41702. return polygon2;
  41703. }
  41704. cartesianToLatlng(cartesian) {
  41705. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  41706. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  41707. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  41708. return [lng, lat];
  41709. }
  41710. LatlngTocartesian(latlng) {
  41711. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  41712. return cartesian3;
  41713. }
  41714. clearPoint() {
  41715. this.DrawEndEvent.raiseEvent(this.RectFlagLast, [this.RectFlagData[0], this.RectFlagData[this.RectFlagData.length - 1]], this.drawType);
  41716. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41717. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41718. }
  41719. this.entitiesPoint = [];
  41720. }
  41721. destroy() {
  41722. if (this.handler) {
  41723. this.handler.destroy();
  41724. this.handler = null;
  41725. }
  41726. }
  41727. clear() {
  41728. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41729. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41730. }
  41731. for (var i2 = 0; i2 < this.entitiesRectFlag.length; i2++) {
  41732. this.viewer.entities.remove(this.entitiesRectFlag[i2]);
  41733. }
  41734. this.identificationPoint = null;
  41735. this.RectFlag = null;
  41736. this.RectFlagLast = null;
  41737. this.positions = [];
  41738. this.entitiesPoint = [];
  41739. this.entitiesRectFlag = [];
  41740. this.RectFlagData = null;
  41741. }
  41742. getCatesian3FromPX(px) {
  41743. var cartesian;
  41744. var ray = this.viewer.camera.getPickRay(px);
  41745. if (!ray)
  41746. return null;
  41747. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  41748. return cartesian;
  41749. }
  41750. }
  41751. class DrawTriangleFlag {
  41752. constructor(arg) {
  41753. this.viewer = arg.viewer;
  41754. this.Cesium = arg.Cesium;
  41755. this.identificationPoint = null;
  41756. this.TriangleFlag = null;
  41757. this.TriangleFlagLast = null;
  41758. this.positions = [];
  41759. this.entitiesPoint = [];
  41760. this.entitiesTriangleFlag = [];
  41761. this.TriangleFlagData = null;
  41762. this.DrawStartEvent = new Cesium.Event();
  41763. this.DrawEndEvent = new Cesium.Event();
  41764. this._param = {
  41765. id: "DrawStraightArrow",
  41766. polygonColor: "rgba(0,255,0,0.5)",
  41767. outlineColor: "rgba(255, 255, 255, 1)",
  41768. outlineWidth: 1
  41769. };
  41770. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  41771. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  41772. }
  41773. getData() {
  41774. return this.TriangleFlagData;
  41775. }
  41776. computePosition(data) {
  41777. let $this = this;
  41778. var lnglatArr = [];
  41779. for (var i2 = 0; i2 < data.length; i2++) {
  41780. var lnglat = $this.cartesianToLatlng(data[i2]);
  41781. lnglatArr.push(lnglat);
  41782. }
  41783. let startPoint = lnglatArr[0];
  41784. let endPoint = lnglatArr[lnglatArr.length - 1];
  41785. let point0 = lnglatArr[0];
  41786. var point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41787. var point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41788. var point3 = [startPoint[0], endPoint[1]];
  41789. let componentspolygon = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0]);
  41790. let componentspolyline = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0, ...point3]);
  41791. let PolygonHierarchy = new $this.Cesium.PolygonHierarchy(componentspolygon);
  41792. $this.TriangleFlagData = lnglatArr;
  41793. console.log([PolygonHierarchy, componentspolyline]);
  41794. return [PolygonHierarchy, componentspolyline];
  41795. }
  41796. addload(data) {
  41797. var $this = this;
  41798. if (data.length < 2)
  41799. return;
  41800. let startPoint = data[0];
  41801. let endPoint = data[data.length - 1];
  41802. let point0 = data[0];
  41803. var point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41804. var point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41805. var point3 = [startPoint[0], endPoint[1]];
  41806. let componentspolygon = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0]);
  41807. let componentspolyline = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0, ...point3]);
  41808. var shape = this.viewer.entities.add({
  41809. Type: "DrawTriangleFlag",
  41810. Position: data,
  41811. id: data.id || $this.objId,
  41812. polygon: {
  41813. hierarchy: new $this.Cesium.PolygonHierarchy(componentspolygon),
  41814. extrudedHeight: 1,
  41815. material: $this.Cesium.Color.RED
  41816. },
  41817. polyline: {
  41818. positions: componentspolyline,
  41819. show: true,
  41820. material: $this.Cesium.Color.YELLOW,
  41821. width: 5,
  41822. clampToGround: true
  41823. }
  41824. });
  41825. $this.entitiesTriangleFlag.push(shape);
  41826. return shape;
  41827. }
  41828. startCreate(drawType) {
  41829. this.drawType = drawType;
  41830. var $this = this;
  41831. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  41832. this.handler.setInputAction(function(evt) {
  41833. var cartesian = $this.getCatesian3FromPX(evt.position);
  41834. if ($this.positions.length == 0) {
  41835. $this.positions.push(cartesian.clone());
  41836. $this.identificationPoint = $this.createPoint(cartesian);
  41837. $this.createPoint(cartesian);
  41838. $this.positions.push(cartesian);
  41839. }
  41840. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  41841. this.handler.setInputAction(function(evt) {
  41842. if ($this.positions.length < 2)
  41843. return;
  41844. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  41845. if (!$this.Cesium.defined($this.TriangleFlag)) {
  41846. $this.TriangleFlag = $this.createTriangleFlag();
  41847. }
  41848. $this.identificationPoint.position.setValue(cartesian);
  41849. if ($this.TriangleFlag) {
  41850. $this.positions.pop();
  41851. $this.positions.push(cartesian);
  41852. }
  41853. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  41854. this.handler.setInputAction(function(evt) {
  41855. if (!$this.TriangleFlag)
  41856. return;
  41857. var cartesian = $this.getCatesian3FromPX(evt.position);
  41858. $this.positions.pop();
  41859. $this.positions.push(cartesian);
  41860. $this.createPoint(cartesian);
  41861. $this.TriangleFlagData = $this.positions.concat();
  41862. $this.viewer.entities.remove($this.TriangleFlag);
  41863. $this.TriangleFlag = null;
  41864. $this.positions = [];
  41865. $this.identificationPoint.position.setValue(cartesian);
  41866. var lnglatArr = [];
  41867. for (var i2 = 0; i2 < $this.TriangleFlagData.length; i2++) {
  41868. var lnglat = $this.cartesianToLatlng($this.TriangleFlagData[i2]);
  41869. lnglatArr.push(lnglat);
  41870. }
  41871. $this.TriangleFlagData = lnglatArr;
  41872. var TriangleFlag = $this.addload([$this.TriangleFlagData[0], $this.TriangleFlagData[$this.TriangleFlagData.length - 1]]);
  41873. $this.entitiesTriangleFlag.push(TriangleFlag);
  41874. $this.TriangleFlagLast = TriangleFlag;
  41875. $this.clearPoint();
  41876. $this.destroy();
  41877. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  41878. }
  41879. createPoint(cartesian) {
  41880. var $this = this;
  41881. var point2 = this.viewer.entities.add({
  41882. position: cartesian,
  41883. point: {
  41884. pixelSize: 10,
  41885. color: $this.Cesium.Color.RED,
  41886. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  41887. }
  41888. });
  41889. $this.entitiesPoint.push(point2);
  41890. return point2;
  41891. }
  41892. createTriangleFlag() {
  41893. console.log("232323");
  41894. var $this = this;
  41895. var polygon2 = this.viewer.entities.add({
  41896. polygon: {
  41897. hierarchy: new $this.Cesium.CallbackProperty(function() {
  41898. if ($this.positions.length < 2)
  41899. return;
  41900. let lonlat = [];
  41901. let length = $this.positions.length;
  41902. for (let i2 = 0; i2 < length; i2++) {
  41903. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41904. }
  41905. let startPoint = lonlat[0];
  41906. let endPoint = lonlat[lonlat.length - 1];
  41907. let point0 = lonlat[0];
  41908. var point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41909. var point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41910. [startPoint[0], endPoint[1]];
  41911. let components = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0]);
  41912. return new $this.Cesium.PolygonHierarchy(components);
  41913. }, false),
  41914. extrudedHeight: 1,
  41915. material: $this.Cesium.Color.RED
  41916. },
  41917. polyline: {
  41918. positions: new $this.Cesium.CallbackProperty(function() {
  41919. if ($this.positions.length < 2)
  41920. return;
  41921. let lonlat = [];
  41922. let length = $this.positions.length;
  41923. for (let i2 = 0; i2 < length; i2++) {
  41924. lonlat.push($this.cartesianToLatlng($this.positions[i2]));
  41925. }
  41926. let startPoint = lonlat[0];
  41927. let endPoint = lonlat[lonlat.length - 1];
  41928. let point0 = lonlat[0];
  41929. var point1 = [endPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41930. var point2 = [startPoint[0], (startPoint[1] + endPoint[1]) / 2];
  41931. var point3 = [startPoint[0], endPoint[1]];
  41932. let components = $this.Cesium.Cartesian3.fromDegreesArray([...point0, ...point1, ...point2, ...point0, ...point3]);
  41933. return components;
  41934. }, false),
  41935. show: true,
  41936. material: $this.Cesium.Color.YELLOW,
  41937. width: 5,
  41938. clampToGround: true
  41939. }
  41940. });
  41941. $this.entitiesTriangleFlag.push(polygon2);
  41942. return polygon2;
  41943. }
  41944. cartesianToLatlng(cartesian) {
  41945. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  41946. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  41947. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  41948. return [lng, lat];
  41949. }
  41950. LatlngTocartesian(latlng) {
  41951. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  41952. return cartesian3;
  41953. }
  41954. clearPoint() {
  41955. this.DrawEndEvent.raiseEvent(this.TriangleFlagLast, [this.TriangleFlagData[0], this.TriangleFlagData[this.TriangleFlagData.length - 1]], this.drawType);
  41956. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41957. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41958. }
  41959. this.entitiesPoint = [];
  41960. }
  41961. destroy() {
  41962. if (this.handler) {
  41963. this.handler.destroy();
  41964. this.handler = null;
  41965. }
  41966. }
  41967. clear() {
  41968. for (var i2 = 0; i2 < this.entitiesPoint.length; i2++) {
  41969. this.viewer.entities.remove(this.entitiesPoint[i2]);
  41970. }
  41971. for (var i2 = 0; i2 < this.entitiesTriangleFlag.length; i2++) {
  41972. this.viewer.entities.remove(this.entitiesTriangleFlag[i2]);
  41973. }
  41974. this.identificationPoint = null;
  41975. this.TriangleFlag = null;
  41976. this.TriangleFlagLast = null;
  41977. this.positions = [];
  41978. this.entitiesPoint = [];
  41979. this.entitiesTriangleFlag = [];
  41980. this.TriangleFlagData = null;
  41981. }
  41982. getCatesian3FromPX(px) {
  41983. var cartesian;
  41984. var ray = this.viewer.camera.getPickRay(px);
  41985. if (!ray)
  41986. return null;
  41987. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  41988. return cartesian;
  41989. }
  41990. }
  41991. class DrawPoint$1 {
  41992. constructor(arg) {
  41993. this.viewer = arg.viewer;
  41994. this.Cesium = arg.Cesium;
  41995. this._point = null;
  41996. this._pointData = null;
  41997. this._entities = [];
  41998. this.DrawStartEvent = new Cesium.Event();
  41999. this.DrawEndEvent = new Cesium.Event();
  42000. this._param = {
  42001. id: "DrawStraightArrow",
  42002. polygonColor: "rgba(0,255,0,0.5)",
  42003. outlineColor: "rgba(255, 255, 255, 1)",
  42004. outlineWidth: 1
  42005. };
  42006. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42007. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42008. }
  42009. get point() {
  42010. return this._point;
  42011. }
  42012. addload(data) {
  42013. return this.createPoint(data);
  42014. }
  42015. getData() {
  42016. return this._pointData;
  42017. }
  42018. computePosition(data) {
  42019. let $this = this;
  42020. var lnglatArr = [];
  42021. for (var i2 = 0; i2 < data.length; i2++) {
  42022. var lnglat = $this.cartesianToLatlng(data[i2]);
  42023. lnglatArr.push(lnglat);
  42024. }
  42025. $this._pointData = lnglatArr;
  42026. let point2 = lnglatArr[0];
  42027. return $this.Cesium.Cartesian3.fromDegrees(point2[0], point2[1]);
  42028. }
  42029. startCreate(drawType) {
  42030. this.drawType = drawType;
  42031. var $this = this;
  42032. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42033. this.handler.setInputAction(function(evt) {
  42034. var cartesian = $this.getCatesian3FromPX(evt.position);
  42035. if (!cartesian)
  42036. return;
  42037. let latlon = $this.cartesianToLatlng(cartesian);
  42038. var point2 = $this.createPoint(latlon);
  42039. $this._pointData = cartesian;
  42040. $this._point = point2;
  42041. $this.DrawEndEvent.raiseEvent($this._point, latlon, $this.drawType);
  42042. $this.destroy();
  42043. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42044. }
  42045. createPoint(cartesian) {
  42046. var $this = this;
  42047. var point2 = this.viewer.entities.add({
  42048. Type: "DrawPoint",
  42049. Position: [cartesian],
  42050. position: $this.Cesium.Cartesian3.fromDegrees(cartesian[0], cartesian[1]),
  42051. id: cartesian.id || $this.objId,
  42052. billboard: {
  42053. image: "./static/poi2.png",
  42054. verticalOrigin: Cesium.VerticalOrigin.BOTTOM
  42055. }
  42056. });
  42057. $this._entities.push(point2);
  42058. return point2;
  42059. }
  42060. cartesianToLatlng(cartesian) {
  42061. let ellipsoid = this.viewer.scene.globe.ellipsoid;
  42062. let cartographic = ellipsoid.cartesianToCartographic(cartesian);
  42063. let lat = Cesium.Math.toDegrees(cartographic.latitude);
  42064. let lng = Cesium.Math.toDegrees(cartographic.longitude);
  42065. return [lng, lat];
  42066. }
  42067. destroy() {
  42068. if (this.handler) {
  42069. this.handler.destroy();
  42070. this.handler = null;
  42071. }
  42072. }
  42073. clear() {
  42074. for (var i2 = 0; i2 < this._entities.length; i2++) {
  42075. this.viewer.entities.remove(this._entities[i2]);
  42076. }
  42077. this._entities = [];
  42078. this._point = null;
  42079. }
  42080. getCatesian3FromPX(px) {
  42081. var cartesian;
  42082. var ray = this.viewer.camera.getPickRay(px);
  42083. if (!ray)
  42084. return null;
  42085. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42086. return cartesian;
  42087. }
  42088. }
  42089. class DrawPolyline {
  42090. constructor(arg) {
  42091. this.viewer = arg.viewer;
  42092. this.Cesium = arg.Cesium;
  42093. this._polyline = null;
  42094. this._polylineLast = null;
  42095. this._positions = [];
  42096. this._entities_point = [];
  42097. this._entities_line = [];
  42098. this._polylineData = null;
  42099. this.DrawStartEvent = new Cesium.Event();
  42100. this.DrawEndEvent = new Cesium.Event();
  42101. this._param = {
  42102. id: "DrawStraightArrow",
  42103. polygonColor: "rgba(0,255,0,0.5)",
  42104. outlineColor: "rgba(255, 255, 255, 1)",
  42105. outlineWidth: 1
  42106. };
  42107. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42108. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42109. }
  42110. get line() {
  42111. return this._polylineLast;
  42112. }
  42113. getData() {
  42114. return this._polylineData;
  42115. }
  42116. computePosition(data) {
  42117. let $this = this;
  42118. var lnglatArr = [];
  42119. for (var i2 = 0; i2 < data.length; i2++) {
  42120. var lnglat = $this.cartesianToLatlng(data[i2]);
  42121. lnglatArr.push(lnglat);
  42122. }
  42123. $this._polylineData = lnglatArr;
  42124. return data;
  42125. }
  42126. addload(data) {
  42127. var $this = this;
  42128. var lnglatArr = [];
  42129. for (var i2 = 0; i2 < data.length; i2++) {
  42130. var lnglat = $this.LatlngTocartesian(data[i2]);
  42131. lnglatArr.push(lnglat);
  42132. }
  42133. var polyline = this.viewer.entities.add({
  42134. Type: "DrawPolyline",
  42135. Position: data,
  42136. id: data.id || $this.objId,
  42137. polyline: {
  42138. positions: lnglatArr,
  42139. show: true,
  42140. material: $this.Cesium.Color.RED,
  42141. width: 3,
  42142. clampToGround: true
  42143. }
  42144. });
  42145. return polyline;
  42146. }
  42147. startCreate(drawType) {
  42148. this.drawType = drawType;
  42149. var $this = this;
  42150. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42151. this.handler.setInputAction(function(evt) {
  42152. var cartesian = $this.getCatesian3FromPX(evt.position);
  42153. if ($this._positions.length == 0) {
  42154. $this._positions.push(cartesian.clone());
  42155. }
  42156. $this._positions.push(cartesian);
  42157. $this.createPoint(cartesian);
  42158. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42159. this.handler.setInputAction(function(evt) {
  42160. if ($this._positions.length < 1)
  42161. return;
  42162. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  42163. if (!$this.Cesium.defined($this._polyline)) {
  42164. $this._polyline = $this.createPolyline();
  42165. }
  42166. if ($this._polyline) {
  42167. $this._positions.pop();
  42168. $this._positions.push(cartesian);
  42169. }
  42170. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42171. this.handler.setInputAction(function(evt) {
  42172. if (!$this._polyline)
  42173. return;
  42174. var cartesian = $this.getCatesian3FromPX(evt.position);
  42175. $this._positions.pop();
  42176. $this.createPoint(cartesian);
  42177. $this._polylineData = $this._positions.concat();
  42178. $this.viewer.entities.remove($this._polyline);
  42179. $this._polyline = null;
  42180. $this._positions = [];
  42181. var lnglatArr = [];
  42182. for (var i2 = 0; i2 < $this._polylineData.length; i2++) {
  42183. var lnglat = $this.cartesianToLatlng($this._polylineData[i2]);
  42184. lnglatArr.push(lnglat);
  42185. }
  42186. $this._polylineData = lnglatArr;
  42187. var line = $this.addload($this._polylineData);
  42188. $this._entities_line.push(line);
  42189. $this._polylineLast = line;
  42190. $this.clearPoint();
  42191. $this.destroy();
  42192. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  42193. }
  42194. createPoint(cartesian) {
  42195. var $this = this;
  42196. var point2 = this.viewer.entities.add({
  42197. position: cartesian,
  42198. point: {
  42199. pixelSize: 10,
  42200. color: $this.Cesium.Color.RED,
  42201. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  42202. }
  42203. });
  42204. $this._entities_point.push(point2);
  42205. return point2;
  42206. }
  42207. createPolyline() {
  42208. var $this = this;
  42209. var polyline = this.viewer.entities.add({
  42210. polyline: {
  42211. positions: new $this.Cesium.CallbackProperty(function() {
  42212. return $this._positions;
  42213. }, false),
  42214. show: true,
  42215. material: $this.Cesium.Color.RED,
  42216. width: 3,
  42217. clampToGround: true
  42218. }
  42219. });
  42220. $this._entities_line.push(polyline);
  42221. return polyline;
  42222. }
  42223. cartesianToLatlng(cartesian) {
  42224. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42225. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  42226. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  42227. return [lng, lat];
  42228. }
  42229. LatlngTocartesian(latlng) {
  42230. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  42231. return cartesian3;
  42232. }
  42233. clearPoint() {
  42234. this.DrawEndEvent.raiseEvent(this._polylineLast, this._polylineData, this.drawType);
  42235. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42236. this.viewer.entities.remove(this._entities_point[i2]);
  42237. }
  42238. this._entities_point = [];
  42239. }
  42240. destroy() {
  42241. if (this.handler) {
  42242. this.handler.destroy();
  42243. this.handler = null;
  42244. }
  42245. }
  42246. clear() {
  42247. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42248. this.viewer.entities.remove(this._entities_point[i2]);
  42249. }
  42250. for (var i2 = 0; i2 < this._entities_line.length; i2++) {
  42251. this.viewer.entities.remove(this._entities_line[i2]);
  42252. }
  42253. this._polyline = null;
  42254. this._positions = [];
  42255. this._entities_point = [];
  42256. this._entities_line = [];
  42257. this._polylineData = null;
  42258. this._polylineLast = null;
  42259. }
  42260. getCatesian3FromPX(px) {
  42261. var cartesian;
  42262. var ray = this.viewer.camera.getPickRay(px);
  42263. if (!ray)
  42264. return null;
  42265. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42266. return cartesian;
  42267. }
  42268. }
  42269. class DrawPolygon {
  42270. constructor(arg) {
  42271. this.viewer = arg.viewer;
  42272. this.Cesium = arg.Cesium;
  42273. this._polygon = null;
  42274. this._polygonLast = null;
  42275. this._positions = [];
  42276. this._entities_point = [];
  42277. this._entities_polygon = [];
  42278. this._polygonData = null;
  42279. this.DrawStartEvent = new Cesium.Event();
  42280. this.DrawEndEvent = new Cesium.Event();
  42281. this._param = {
  42282. id: "DrawStraightArrow",
  42283. polygonColor: "rgba(0,255,0,0.5)",
  42284. outlineColor: "rgba(255, 255, 255, 1)",
  42285. outlineWidth: 1
  42286. };
  42287. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42288. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42289. }
  42290. get polygon() {
  42291. return this._polygonLast;
  42292. }
  42293. getData() {
  42294. return this._polygonData;
  42295. }
  42296. computePosition(data) {
  42297. let $this = this;
  42298. var lnglatArr = [];
  42299. for (var i2 = 0; i2 < data.length; i2++) {
  42300. var lnglat = $this.cartesianToLatlng(data[i2]);
  42301. lnglatArr.push(lnglat);
  42302. }
  42303. $this._polygonData = lnglatArr;
  42304. return new $this.Cesium.PolygonHierarchy(data);
  42305. }
  42306. addload(data) {
  42307. var $this = this;
  42308. var lnglatArr = [];
  42309. for (var i2 = 0; i2 < data.length; i2++) {
  42310. var lnglat = $this.LatlngTocartesian(data[i2]);
  42311. lnglatArr.push(lnglat);
  42312. }
  42313. return this.viewer.entities.add({
  42314. Type: "DrawPolygon",
  42315. Position: data,
  42316. id: data.id || $this.objId,
  42317. polygon: {
  42318. hierarchy: new $this.Cesium.PolygonHierarchy(lnglatArr),
  42319. clampToGround: true,
  42320. show: true,
  42321. fill: true,
  42322. material: $this.Cesium.Color.RED.withAlpha(0.9),
  42323. width: 3,
  42324. outlineColor: $this.Cesium.Color.BLACK,
  42325. outlineWidth: 1,
  42326. outline: false
  42327. }
  42328. });
  42329. }
  42330. startCreate(drawType) {
  42331. this.drawType = drawType;
  42332. var $this = this;
  42333. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42334. this.handler.setInputAction(function(evt) {
  42335. var cartesian = $this.getCatesian3FromPX(evt.position);
  42336. if ($this._positions.length == 0) {
  42337. $this._positions.push(cartesian.clone());
  42338. }
  42339. $this.createPoint(cartesian);
  42340. $this._positions.push(cartesian);
  42341. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42342. this.handler.setInputAction(function(evt) {
  42343. if ($this._positions.length < 1)
  42344. return;
  42345. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  42346. if ($this._positions.length == 3) {
  42347. if (!$this.Cesium.defined($this._polygon)) {
  42348. $this._polygon = $this.createPolygon();
  42349. }
  42350. }
  42351. $this._positions.pop();
  42352. $this._positions.push(cartesian);
  42353. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42354. this.handler.setInputAction(function(evt) {
  42355. if (!$this._polygon)
  42356. return;
  42357. var cartesian = $this.getCatesian3FromPX(evt.position);
  42358. $this._positions.pop();
  42359. $this.createPoint(cartesian);
  42360. $this._polygonData = $this._positions.concat();
  42361. $this.viewer.entities.remove($this._positions);
  42362. $this._positions = null;
  42363. $this._positions = [];
  42364. var lnglatArr = [];
  42365. for (var i2 = 0; i2 < $this._polygonData.length; i2++) {
  42366. var lnglat = $this.cartesianToLatlng($this._polygonData[i2]);
  42367. lnglatArr.push(lnglat);
  42368. }
  42369. $this._polygonData = lnglatArr;
  42370. var Polygon = $this.addload($this._polygonData);
  42371. $this._entities_polygon.push(Polygon);
  42372. $this._polygonLast = Polygon;
  42373. $this.clearPoint();
  42374. $this.destroy();
  42375. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  42376. }
  42377. createPolygon() {
  42378. var $this = this;
  42379. var polygon2 = this.viewer.entities.add({
  42380. polygon: {
  42381. hierarchy: new $this.Cesium.CallbackProperty(function() {
  42382. return new $this.Cesium.PolygonHierarchy($this._positions);
  42383. }, false),
  42384. clampToGround: true,
  42385. show: true,
  42386. fill: true,
  42387. material: $this.Cesium.Color.RED.withAlpha(0.5),
  42388. width: 3,
  42389. outlineColor: $this.Cesium.Color.BLACK,
  42390. outlineWidth: 1,
  42391. outline: false
  42392. }
  42393. });
  42394. $this._entities_polygon.push(polygon2);
  42395. return polygon2;
  42396. }
  42397. cartesianToLatlng(cartesian) {
  42398. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42399. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  42400. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  42401. return [lng, lat];
  42402. }
  42403. LatlngTocartesian(latlng) {
  42404. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  42405. return cartesian3;
  42406. }
  42407. clearPoint() {
  42408. this.DrawEndEvent.raiseEvent(this._polygonLast, this._polygonData, this.drawType);
  42409. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42410. this.viewer.entities.remove(this._entities_point[i2]);
  42411. }
  42412. this._entities_point = [];
  42413. }
  42414. createPoint(cartesian) {
  42415. var $this = this;
  42416. var point2 = this.viewer.entities.add({
  42417. position: cartesian,
  42418. point: {
  42419. pixelSize: 10,
  42420. color: $this.Cesium.Color.RED,
  42421. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  42422. }
  42423. });
  42424. $this._entities_point.push(point2);
  42425. return point2;
  42426. }
  42427. destroy() {
  42428. if (this.handler) {
  42429. this.handler.destroy();
  42430. this.handler = null;
  42431. }
  42432. }
  42433. clear() {
  42434. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42435. this.viewer.entities.remove(this._entities_point[i2]);
  42436. }
  42437. for (var i2 = 0; i2 < this._entities_polygon.length; i2++) {
  42438. this.viewer.entities.remove(this._entities_polygon[i2]);
  42439. }
  42440. this._polygon = null;
  42441. this._polygonLast = null;
  42442. this._positions = [];
  42443. this._entities_point = [];
  42444. this._entities_polygon = [];
  42445. this._polygonData = null;
  42446. }
  42447. getCatesian3FromPX(px) {
  42448. var cartesian;
  42449. var ray = this.viewer.camera.getPickRay(px);
  42450. if (!ray)
  42451. return null;
  42452. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42453. return cartesian;
  42454. }
  42455. }
  42456. class DrawRectangle {
  42457. constructor(arg) {
  42458. this.viewer = arg.viewer;
  42459. this.Cesium = arg.Cesium;
  42460. this.floatingPoint = null;
  42461. this._rectangle = null;
  42462. this._rectangleLast = null;
  42463. this._positions = [];
  42464. this._entities_point = [];
  42465. this._entities_rectangle = [];
  42466. this._rectangleData = null;
  42467. this.DrawStartEvent = new Cesium.Event();
  42468. this.DrawEndEvent = new Cesium.Event();
  42469. this._param = {
  42470. id: "DrawStraightArrow",
  42471. polygonColor: "rgba(0,255,0,0.5)",
  42472. outlineColor: "rgba(255, 255, 255, 1)",
  42473. outlineWidth: 1
  42474. };
  42475. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42476. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42477. }
  42478. get line() {
  42479. return this._rectangleLast;
  42480. }
  42481. getData() {
  42482. return this._rectangleData;
  42483. }
  42484. computePosition(data) {
  42485. let $this = this;
  42486. var lnglatArr = [];
  42487. for (var i2 = 0; i2 < data.length; i2++) {
  42488. var lnglat = $this.cartesianToLatlng(data[i2]);
  42489. lnglatArr.push(lnglat);
  42490. }
  42491. $this._rectangleData = lnglatArr;
  42492. return new $this.Cesium.Rectangle.fromCartesianArray(data);
  42493. }
  42494. addload(data) {
  42495. var $this = this;
  42496. var lnglatArr = [];
  42497. for (var i2 = 0; i2 < data.length; i2++) {
  42498. var lnglat = $this.LatlngTocartesian(data[i2]);
  42499. lnglatArr.push(lnglat);
  42500. }
  42501. var shape = this.viewer.entities.add({
  42502. Type: "DrawRectangle",
  42503. Position: data,
  42504. id: data.id || $this.objId,
  42505. rectangle: {
  42506. coordinates: $this.Cesium.Rectangle.fromCartesianArray(lnglatArr),
  42507. material: $this.Cesium.Color.RED.withAlpha(0.9)
  42508. }
  42509. });
  42510. $this._entities_rectangle.push(shape);
  42511. return shape;
  42512. }
  42513. startCreate(drawType) {
  42514. this.drawType = drawType;
  42515. var $this = this;
  42516. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42517. this.handler.setInputAction(function(evt) {
  42518. var cartesian = $this.getCatesian3FromPX(evt.position);
  42519. if ($this._positions.length == 0) {
  42520. $this._positions.push(cartesian.clone());
  42521. $this.floatingPoint = $this.createPoint(cartesian);
  42522. $this.createPoint(cartesian);
  42523. $this._positions.push(cartesian);
  42524. }
  42525. if ($this._positions.length == 2) {
  42526. $this._positions.push(cartesian);
  42527. }
  42528. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42529. this.handler.setInputAction(function(evt) {
  42530. if ($this._positions.length < 3)
  42531. return;
  42532. var cartesian = $this.getCatesian3FromPX(evt.endPosition);
  42533. if (!$this.Cesium.defined($this._rectangle)) {
  42534. $this._rectangle = $this.createRectangle();
  42535. }
  42536. $this.floatingPoint.position.setValue(cartesian);
  42537. if ($this._rectangle) {
  42538. $this._positions.pop();
  42539. $this._positions.push(cartesian);
  42540. }
  42541. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42542. this.handler.setInputAction(function(evt) {
  42543. if (!$this._rectangle)
  42544. return;
  42545. var cartesian = $this.getCatesian3FromPX(evt.position);
  42546. $this._positions.pop();
  42547. $this._positions.push(cartesian);
  42548. $this.createPoint(cartesian);
  42549. $this._rectangleData = $this._positions.concat();
  42550. $this.viewer.entities.remove($this._rectangle);
  42551. $this._rectangle = null;
  42552. $this._positions = [];
  42553. $this.floatingPoint.position.setValue(cartesian);
  42554. var lnglatArr = [];
  42555. for (var i2 = 0; i2 < $this._rectangleData.length; i2++) {
  42556. var lnglat = $this.cartesianToLatlng($this._rectangleData[i2]);
  42557. lnglatArr.push(lnglat);
  42558. }
  42559. $this._rectangleData = lnglatArr;
  42560. var rectangle = $this.addload([$this._rectangleData[0], $this._rectangleData[$this._rectangleData.length - 1]]);
  42561. $this._entities_rectangle.push(rectangle);
  42562. $this._rectangleLast = rectangle;
  42563. $this.clearPoint();
  42564. $this.destroy();
  42565. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  42566. }
  42567. createPoint(cartesian) {
  42568. var $this = this;
  42569. var point2 = this.viewer.entities.add({
  42570. position: cartesian,
  42571. point: {
  42572. pixelSize: 10,
  42573. color: $this.Cesium.Color.RED,
  42574. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  42575. }
  42576. });
  42577. $this._entities_point.push(point2);
  42578. return point2;
  42579. }
  42580. createRectangle() {
  42581. var $this = this;
  42582. var shape = this.viewer.entities.add({
  42583. name: "rectangle",
  42584. rectangle: {
  42585. coordinates: new $this.Cesium.CallbackProperty(function() {
  42586. var obj = $this.Cesium.Rectangle.fromCartesianArray($this._positions);
  42587. return obj;
  42588. }, false),
  42589. material: $this.Cesium.Color.RED.withAlpha(0.5)
  42590. }
  42591. });
  42592. $this._entities_rectangle.push(shape);
  42593. return shape;
  42594. }
  42595. cartesianToLatlng(cartesian) {
  42596. var latlng = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42597. var lat = this.Cesium.Math.toDegrees(latlng.latitude);
  42598. var lng = this.Cesium.Math.toDegrees(latlng.longitude);
  42599. return [lng, lat];
  42600. }
  42601. LatlngTocartesian(latlng) {
  42602. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  42603. return cartesian3;
  42604. }
  42605. clearPoint() {
  42606. this.DrawEndEvent.raiseEvent(this._rectangleLast, [this._rectangleData[0], this._rectangleData[this._rectangleData.length - 1]], this.drawType);
  42607. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42608. this.viewer.entities.remove(this._entities_point[i2]);
  42609. }
  42610. this._entities_point = [];
  42611. }
  42612. destroy() {
  42613. if (this.handler) {
  42614. this.handler.destroy();
  42615. this.handler = null;
  42616. }
  42617. }
  42618. clear() {
  42619. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42620. this.viewer.entities.remove(this._entities_point[i2]);
  42621. }
  42622. for (var i2 = 0; i2 < this._entities_rectangle.length; i2++) {
  42623. this.viewer.entities.remove(this._entities_rectangle[i2]);
  42624. }
  42625. this.floatingPoint = null;
  42626. this._rectangle = null;
  42627. this._rectangleLast = null;
  42628. this._positions = [];
  42629. this._entities_point = [];
  42630. this._entities_rectangle = [];
  42631. this._rectangleData = null;
  42632. }
  42633. getCatesian3FromPX(px) {
  42634. var cartesian;
  42635. var ray = this.viewer.camera.getPickRay(px);
  42636. if (!ray)
  42637. return null;
  42638. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42639. return cartesian;
  42640. }
  42641. }
  42642. class DrawCircle {
  42643. constructor(arg) {
  42644. this.viewer = arg.viewer;
  42645. this.Cesium = arg.Cesium;
  42646. this._cicle = null;
  42647. this.floatingPoint = null;
  42648. this._cicleLast = null;
  42649. this._positions = [];
  42650. this._entities_point = [];
  42651. this._entities_cicle = [];
  42652. this._cicleData = null;
  42653. this.DrawStartEvent = new Cesium.Event();
  42654. this.DrawEndEvent = new Cesium.Event();
  42655. this._param = {
  42656. id: "DrawStraightArrow",
  42657. polygonColor: "rgba(0,255,0,0.5)",
  42658. outlineColor: "rgba(255, 255, 255, 1)",
  42659. outlineWidth: 1
  42660. };
  42661. this.polygonMaterial = Cesium.Color.fromCssColorString(this._param.polygonColor);
  42662. this.outlineMaterial = Cesium.Color.fromCssColorString(this._param.outlineColor);
  42663. }
  42664. get cicle() {
  42665. return this._cicleLast;
  42666. }
  42667. addload(data) {
  42668. var that = this;
  42669. let lnglatArr = [];
  42670. for (var i2 = 0; i2 < data.length; i2++) {
  42671. var lnglat = that.LatlngTocartesian(data[i2]);
  42672. lnglatArr.push(lnglat);
  42673. }
  42674. var value = lnglatArr;
  42675. var r2 = Math.sqrt(
  42676. Math.pow(value[0].x - value[value.length - 1].x, 2) + Math.pow(value[0].y - value[value.length - 1].y, 2)
  42677. );
  42678. var position2 = value[0];
  42679. var shape = that.viewer.entities.add({
  42680. Type: "DrawCircle",
  42681. Position: [data[0], data[data.length - 1]],
  42682. position: position2,
  42683. id: data.id || that.objId,
  42684. ellipse: {
  42685. semiMinorAxis: r2,
  42686. semiMajorAxis: r2,
  42687. material: that.Cesium.Color.RED.withAlpha(0.9),
  42688. show: true,
  42689. clampToGround: true
  42690. }
  42691. });
  42692. return shape;
  42693. }
  42694. getData() {
  42695. return this._cicleData;
  42696. }
  42697. computePosition(data) {
  42698. var that = this;
  42699. let lnglatArr = [];
  42700. for (var i2 = 0; i2 < data.length; i2++) {
  42701. var lnglat = that.cartesianToLatlng(data[i2]);
  42702. lnglatArr.push(lnglat);
  42703. }
  42704. that._cicleData = lnglatArr;
  42705. var value = data;
  42706. var r2 = Math.sqrt(
  42707. Math.pow(value[0].x - value[value.length - 1].x, 2) + Math.pow(value[0].y - value[value.length - 1].y, 2)
  42708. );
  42709. var position2 = value[0];
  42710. return { position: position2, r: r2 };
  42711. }
  42712. startCreate(drawType) {
  42713. this.drawType = drawType;
  42714. this.handler = new this.Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42715. this.viewer.scene.globe.depthTestAgainstTerrain = true;
  42716. var $this = this;
  42717. this.handler.setInputAction(function(evt) {
  42718. $this.viewer.scene.globe.depthTestAgainstTerrain = true;
  42719. var cartesian = $this.getCatesian3FromPX(evt.position);
  42720. if ($this._positions.length == 0) {
  42721. $this._positions.push(cartesian.clone());
  42722. $this.floatingPoint = $this.createPoint(cartesian);
  42723. $this._positions.push(cartesian);
  42724. }
  42725. if (!$this._cicle) {
  42726. $this.createPoint(cartesian);
  42727. }
  42728. }, $this.Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42729. this.handler.setInputAction(function(evt) {
  42730. if ($this._positions.length < 1)
  42731. return;
  42732. var cartesian = $this.viewer.scene.pickPosition(evt.endPosition);
  42733. if (!$this.Cesium.defined($this._cicle)) {
  42734. $this._cicle = $this.createCicle();
  42735. }
  42736. $this.floatingPoint.position.setValue(cartesian);
  42737. if ($this._cicle) {
  42738. $this._positions.pop();
  42739. $this._positions.push(cartesian);
  42740. }
  42741. }, $this.Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  42742. this.handler.setInputAction(function(evt) {
  42743. if (!$this._cicle)
  42744. return;
  42745. $this.viewer.scene.globe.depthTestAgainstTerrain = false;
  42746. var cartesian = $this.viewer.scene.pickPosition(evt.position);
  42747. $this._positions.pop();
  42748. $this._positions.push(cartesian);
  42749. $this._cicleData = $this._positions.concat();
  42750. $this.viewer.entities.remove($this._cicle);
  42751. $this._cicle = null;
  42752. $this._positions = [];
  42753. $this.floatingPoint.position.setValue(cartesian);
  42754. let lnglatArr = [];
  42755. for (var i2 = 0; i2 < $this._cicleData.length; i2++) {
  42756. var lnglat = $this.cartesianToLatlng($this._cicleData[i2]);
  42757. lnglatArr.push(lnglat);
  42758. }
  42759. $this._cicleData = lnglatArr;
  42760. var cicle = $this.addload($this._cicleData);
  42761. $this._entities_cicle.push(cicle);
  42762. $this._cicleLast = cicle;
  42763. $this.clearPoint();
  42764. $this.destroy();
  42765. }, $this.Cesium.ScreenSpaceEventType.RIGHT_CLICK);
  42766. }
  42767. createCicle() {
  42768. var that = this;
  42769. var shape = this.viewer.entities.add({
  42770. position: that._positions[0],
  42771. ellipse: {
  42772. semiMinorAxis: new that.Cesium.CallbackProperty(function() {
  42773. var r2 = Math.sqrt(
  42774. Math.pow(that._positions[0].x - that._positions[that._positions.length - 1].x, 2) + Math.pow(that._positions[0].y - that._positions[that._positions.length - 1].y, 2)
  42775. );
  42776. return r2 ? r2 : r2 + 1;
  42777. }, false),
  42778. semiMajorAxis: new that.Cesium.CallbackProperty(function() {
  42779. var r2 = Math.sqrt(
  42780. Math.pow(that._positions[0].x - that._positions[that._positions.length - 1].x, 2) + Math.pow(that._positions[0].y - that._positions[that._positions.length - 1].y, 2)
  42781. );
  42782. return r2 ? r2 : r2 + 1;
  42783. }, false),
  42784. material: that.Cesium.Color.RED.withAlpha(0.5),
  42785. outline: true
  42786. }
  42787. });
  42788. that._entities_cicle.push(shape);
  42789. return shape;
  42790. }
  42791. createPoint(cartesian) {
  42792. var $this = this;
  42793. var point2 = this.viewer.entities.add({
  42794. position: cartesian,
  42795. point: {
  42796. pixelSize: 10,
  42797. color: $this.Cesium.Color.RED,
  42798. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  42799. }
  42800. });
  42801. $this._entities_point.push(point2);
  42802. return point2;
  42803. }
  42804. getCatesian3FromPX(px) {
  42805. var cartesian;
  42806. var ray = this.viewer.camera.getPickRay(px);
  42807. if (!ray)
  42808. return null;
  42809. cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  42810. return cartesian;
  42811. }
  42812. cartesianToLatlng(cartesian) {
  42813. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  42814. let lat = this.Cesium.Math.toDegrees(cartographic.latitude);
  42815. let lng = this.Cesium.Math.toDegrees(cartographic.longitude);
  42816. cartographic.height;
  42817. return [lng, lat];
  42818. }
  42819. LatlngTocartesian(latlng) {
  42820. let cartesian3 = this.Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1], 0);
  42821. return cartesian3;
  42822. }
  42823. destroy() {
  42824. if (this.handler) {
  42825. this.handler.destroy();
  42826. this.handler = null;
  42827. }
  42828. }
  42829. clearPoint() {
  42830. this.DrawEndEvent.raiseEvent(this._cicleLast, this._cicleData, this.drawType);
  42831. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42832. this.viewer.entities.remove(this._entities_point[i2]);
  42833. }
  42834. this._entities_point = [];
  42835. }
  42836. clear() {
  42837. for (var i2 = 0; i2 < this._entities_point.length; i2++) {
  42838. this.viewer.entities.remove(this._entities_point[i2]);
  42839. }
  42840. for (var i2 = 0; i2 < this._entities_cicle.length; i2++) {
  42841. this.viewer.entities.remove(this._entities_cicle[i2]);
  42842. }
  42843. this._cicle = null;
  42844. this.floatingPoint = null;
  42845. this._cicleLast = null;
  42846. this._positions = [];
  42847. this._entities_point = [];
  42848. this._entities_cicle = [];
  42849. this._cicleData = null;
  42850. }
  42851. }
  42852. let MilitaryPlot = {
  42853. DrawStraightArrow,
  42854. DrawAttackArrow,
  42855. DrawPincerArrow,
  42856. DrawGatheringPlace,
  42857. DrawClosedCurve,
  42858. DrawSector,
  42859. DrawBowLine,
  42860. DrawBowPlane,
  42861. DrawCurve,
  42862. DrawCurveFlag,
  42863. DrawRectFlag,
  42864. DrawTriangleFlag,
  42865. DrawPoint: DrawPoint$1,
  42866. DrawPolyline,
  42867. DrawPolygon,
  42868. DrawRectangle,
  42869. DrawCircle
  42870. };
  42871. class EntityEdit {
  42872. constructor(viewer2) {
  42873. this.viewer = viewer2;
  42874. this.DrawExample = "";
  42875. this.midVertexEntities = [];
  42876. this.initEventHandler();
  42877. }
  42878. initEventHandler() {
  42879. this.eventHandler = new Cesium.ScreenSpaceEventHandler(this.viewer.scene.canvas);
  42880. this.EditEndEvent = new Cesium.Event();
  42881. this.EditEndEntity = new Cesium.Event();
  42882. }
  42883. activate() {
  42884. this.deactivate();
  42885. this.initLeftClickEventHandler();
  42886. }
  42887. deactivate() {
  42888. this.DrawExample = "";
  42889. this.eventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42890. this.unRegisterEvents();
  42891. this.clearAllEditVertex();
  42892. }
  42893. clearAllEditVertex() {
  42894. this.clearEditVertex();
  42895. this.clearMidVertex();
  42896. }
  42897. initLeftClickEventHandler() {
  42898. this.eventHandler.setInputAction((e) => {
  42899. let id = this.viewer.scene.pick(e.position);
  42900. if (!id || !id.id) {
  42901. this.handleEditEntity();
  42902. return;
  42903. }
  42904. if (!id.id || !id.id.Type)
  42905. return;
  42906. if (this.editEntity && this.editEntity.id == id.id.id)
  42907. return;
  42908. this.handleEditEntity();
  42909. this.handlePickEditEntity(id.id);
  42910. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  42911. }
  42912. handleEditEntity() {
  42913. this.unRegisterEvents();
  42914. this.clearAllEditVertex();
  42915. let editEntity = this.editEntity;
  42916. if (!editEntity)
  42917. return;
  42918. this.closeEntityEditMode();
  42919. this.editEntity = void 0;
  42920. if (!this.isEdited)
  42921. return;
  42922. this.EditEndEvent.raiseEvent(editEntity);
  42923. this.isEdited = false;
  42924. this.isEditing = false;
  42925. }
  42926. handlePickEditEntity(pickId) {
  42927. const EditableTypes = ["DrawAttackArrow", "DrawCircle", "DrawCurve", "DrawPincerArrow", "DrawPoint", "DrawPolygon", "DrawPolyline", "DrawRectangle", "DrawStraightArrow", "DrawGatheringPlace", "DrawSector", "DrawClosedCurve", "DrawBowLine", "DrawBowPlane", "DrawRectFlag", "DrawTriangleFlag", "DrawCurveFlag"];
  42928. if (EditableTypes.indexOf(pickId.Type) == -1)
  42929. return;
  42930. this.editEntity = pickId;
  42931. this.EditEndEntity.raiseEvent(this.editEntity);
  42932. this.isEditing = false;
  42933. this.isEdited = false;
  42934. this.editPositions = this.getEditEntityPositions();
  42935. this.EditMoveCenterPositoin = this.getCenterPosition();
  42936. this.openEntityEditModel();
  42937. this.clearAllEditVertex();
  42938. this.unRegisterEvents();
  42939. this.createEditVertex();
  42940. this.createMidVertex();
  42941. this.registerEvents();
  42942. }
  42943. openEntityEditModel() {
  42944. if (this.DrawExample == "")
  42945. return;
  42946. switch (this.editEntity.Type) {
  42947. case "DrawStraightArrow":
  42948. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  42949. return this.DrawExample.computePosition(this.editPositions);
  42950. }, false);
  42951. break;
  42952. case "DrawAttackArrow":
  42953. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  42954. return this.DrawExample.computePosition(this.editPositions);
  42955. }, false);
  42956. break;
  42957. case "DrawPincerArrow":
  42958. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  42959. return this.DrawExample.computePosition(this.editPositions);
  42960. }, false);
  42961. break;
  42962. case "DrawGatheringPlace":
  42963. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  42964. return this.DrawExample.computePosition(this.editPositions);
  42965. }, false);
  42966. break;
  42967. case "DrawClosedCurve":
  42968. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  42969. return this.DrawExample.computePosition(this.editPositions).PolygonHierarchy;
  42970. }, false);
  42971. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  42972. return this.DrawExample.computePosition(this.editPositions).pList;
  42973. }, false);
  42974. break;
  42975. case "DrawCircle":
  42976. this.editEntity.position = new Cesium.CallbackProperty((e) => {
  42977. return this.DrawExample.computePosition(this.editPositions).position;
  42978. }, false);
  42979. this.editEntity.ellipse.semiMinorAxis = new Cesium.CallbackProperty((e) => {
  42980. return this.DrawExample.computePosition(this.editPositions).r;
  42981. }, false);
  42982. this.editEntity.ellipse.semiMajorAxis = new Cesium.CallbackProperty((e) => {
  42983. return this.DrawExample.computePosition(this.editPositions).r;
  42984. }, false);
  42985. break;
  42986. case "DrawCurve":
  42987. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  42988. return this.DrawExample.computePosition(this.editPositions);
  42989. }, false);
  42990. break;
  42991. case "DrawPoint":
  42992. this.editEntity.position = new Cesium.CallbackProperty((e) => {
  42993. return this.editPositions[0];
  42994. }, false);
  42995. break;
  42996. case "DrawPolygon":
  42997. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  42998. return this.DrawExample.computePosition(this.editPositions);
  42999. }, false);
  43000. break;
  43001. case "DrawPolyline":
  43002. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43003. return this.DrawExample.computePosition(this.editPositions);
  43004. }, false);
  43005. break;
  43006. case "DrawRectangle":
  43007. this.editEntity.rectangle.coordinates = new Cesium.CallbackProperty((e) => {
  43008. return this.DrawExample.computePosition(this.editPositions);
  43009. }, false);
  43010. break;
  43011. case "DrawSector":
  43012. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43013. return this.DrawExample.computePosition(this.editPositions);
  43014. }, false);
  43015. break;
  43016. case "DrawBowLine":
  43017. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43018. return this.DrawExample.computePosition(this.editPositions);
  43019. }, false);
  43020. break;
  43021. case "DrawBowPlane":
  43022. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43023. return this.DrawExample.computePosition(this.editPositions);
  43024. }, false);
  43025. break;
  43026. case "DrawRectFlag":
  43027. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43028. return this.DrawExample.computePosition(this.editPositions)[0];
  43029. }, false);
  43030. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43031. return this.DrawExample.computePosition(this.editPositions)[1];
  43032. }, false);
  43033. break;
  43034. case "DrawTriangleFlag":
  43035. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43036. return this.DrawExample.computePosition(this.editPositions)[0];
  43037. }, false);
  43038. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43039. return this.DrawExample.computePosition(this.editPositions)[1];
  43040. }, false);
  43041. break;
  43042. case "DrawCurveFlag":
  43043. this.editEntity.polygon.hierarchy = new Cesium.CallbackProperty((e) => {
  43044. return this.DrawExample.computePosition(this.editPositions)[0];
  43045. }, false);
  43046. this.editEntity.polyline.positions = new Cesium.CallbackProperty((e) => {
  43047. return this.DrawExample.computePosition(this.editPositions)[1];
  43048. }, false);
  43049. break;
  43050. }
  43051. }
  43052. closeEntityEditMode() {
  43053. if (this.DrawExample == "")
  43054. return;
  43055. let position2 = "";
  43056. switch (this.editEntity.Type) {
  43057. case "DrawStraightArrow":
  43058. position2 = this.DrawExample.computePosition(this.editPositions);
  43059. this.editEntity.polygon.hierarchy = position2;
  43060. this.editEntity.Position = this.DrawExample.getData();
  43061. break;
  43062. case "DrawAttackArrow":
  43063. position2 = this.DrawExample.computePosition(this.editPositions);
  43064. this.editEntity.polygon.hierarchy = position2;
  43065. this.editEntity.Position = this.DrawExample.getData();
  43066. break;
  43067. case "DrawPincerArrow":
  43068. position2 = this.DrawExample.computePosition(this.editPositions);
  43069. this.editEntity.polygon.hierarchy = position2;
  43070. this.editEntity.Position = this.DrawExample.getData();
  43071. break;
  43072. case "DrawGatheringPlace":
  43073. position2 = this.DrawExample.computePosition(this.editPositions);
  43074. this.editEntity.polygon.hierarchy = position2;
  43075. this.editEntity.Position = this.DrawExample.getData();
  43076. break;
  43077. case "DrawClosedCurve":
  43078. position2 = this.DrawExample.computePosition(this.editPositions);
  43079. this.editEntity.polygon.hierarchy = position2.PolygonHierarchy;
  43080. this.editEntity.polyline.positions = position2.pList;
  43081. this.editEntity.Position = this.DrawExample.getData();
  43082. break;
  43083. case "DrawCircle":
  43084. position2 = this.DrawExample.computePosition(this.editPositions);
  43085. this.editEntity.position = position2.position;
  43086. this.editEntity.ellipse.semiMinorAxis = position2.r;
  43087. this.editEntity.ellipse.semiMajorAxis = position2.r;
  43088. this.editEntity.Position = this.DrawExample.getData();
  43089. break;
  43090. case "DrawCurve":
  43091. position2 = this.DrawExample.computePosition(this.editPositions);
  43092. this.editEntity.polyline.positions = position2;
  43093. this.editEntity.Position = this.DrawExample.getData();
  43094. break;
  43095. case "DrawPoint":
  43096. position2 = this.DrawExample.computePosition(this.editPositions);
  43097. this.editEntity.position = position2;
  43098. this.editEntity.Position = this.DrawExample.getData();
  43099. break;
  43100. case "DrawPolygon":
  43101. position2 = this.DrawExample.computePosition(this.editPositions);
  43102. this.editEntity.polygon.hierarchy = position2;
  43103. this.editEntity.Position = this.DrawExample.getData();
  43104. break;
  43105. case "DrawPolyline":
  43106. position2 = this.DrawExample.computePosition(this.editPositions);
  43107. this.editEntity.polyline.positions = position2;
  43108. this.editEntity.Position = this.DrawExample.getData();
  43109. break;
  43110. case "DrawRectangle":
  43111. position2 = this.DrawExample.computePosition(this.editPositions);
  43112. this.editEntity.rectangle.coordinates = position2;
  43113. this.editEntity.Position = this.DrawExample.getData();
  43114. break;
  43115. case "DrawSector":
  43116. position2 = this.DrawExample.computePosition(this.editPositions);
  43117. this.editEntity.polygon.hierarchy = position2;
  43118. this.editEntity.Position = this.DrawExample.getData();
  43119. break;
  43120. case "DrawBowLine":
  43121. position2 = this.DrawExample.computePosition(this.editPositions);
  43122. this.editEntity.polyline.positions = position2;
  43123. this.editEntity.Position = this.DrawExample.getData();
  43124. break;
  43125. case "DrawBowPlane":
  43126. position2 = this.DrawExample.computePosition(this.editPositions);
  43127. this.editEntity.polygon.hierarchy = position2;
  43128. this.editEntity.Position = this.DrawExample.getData();
  43129. break;
  43130. case "DrawRectFlag":
  43131. position2 = this.DrawExample.computePosition(this.editPositions);
  43132. this.editEntity.polygon.hierarchy = position2[0];
  43133. this.editEntity.polyline.positions = position2[1];
  43134. this.editEntity.Position = this.DrawExample.getData();
  43135. break;
  43136. case "DrawTriangleFlag":
  43137. position2 = this.DrawExample.computePosition(this.editPositions);
  43138. this.editEntity.polygon.hierarchy = position2[0];
  43139. this.editEntity.polyline.positions = position2[1];
  43140. this.editEntity.Position = this.DrawExample.getData();
  43141. break;
  43142. case "DrawCurveFlag":
  43143. position2 = this.DrawExample.computePosition(this.editPositions);
  43144. this.editEntity.polygon.hierarchy = position2[0];
  43145. this.editEntity.polyline.positions = position2[1];
  43146. this.editEntity.Position = this.DrawExample.getData();
  43147. break;
  43148. }
  43149. }
  43150. getEditEntityPositions() {
  43151. let position2 = this.editEntity.Position;
  43152. let positionArr = [];
  43153. switch (this.editEntity.Type) {
  43154. case "DrawAttackArrow":
  43155. for (let i2 = 0; i2 < position2.length; i2++) {
  43156. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43157. }
  43158. return positionArr;
  43159. case "DrawCircle":
  43160. for (let i2 = 0; i2 < position2.length; i2++) {
  43161. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43162. }
  43163. return positionArr;
  43164. case "DrawCurve":
  43165. for (let i2 = 0; i2 < position2.length; i2++) {
  43166. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43167. }
  43168. return positionArr;
  43169. case "DrawPincerArrow":
  43170. for (let i2 = 0; i2 < position2.length; i2++) {
  43171. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43172. }
  43173. return positionArr;
  43174. case "DrawPoint":
  43175. for (let i2 = 0; i2 < position2.length; i2++) {
  43176. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43177. }
  43178. return positionArr;
  43179. case "DrawPolygon":
  43180. for (let i2 = 0; i2 < position2.length; i2++) {
  43181. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43182. }
  43183. return positionArr;
  43184. case "DrawPolyline":
  43185. for (let i2 = 0; i2 < position2.length; i2++) {
  43186. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43187. }
  43188. return positionArr;
  43189. case "DrawRectangle":
  43190. for (let i2 = 0; i2 < position2.length; i2++) {
  43191. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43192. }
  43193. return positionArr;
  43194. case "DrawStraightArrow":
  43195. for (let i2 = 0; i2 < position2.length; i2++) {
  43196. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43197. }
  43198. return positionArr;
  43199. case "DrawGatheringPlace":
  43200. for (let i2 = 0; i2 < position2.length; i2++) {
  43201. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43202. }
  43203. return positionArr;
  43204. case "DrawSector":
  43205. for (let i2 = 0; i2 < position2.length; i2++) {
  43206. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43207. }
  43208. return positionArr;
  43209. case "DrawClosedCurve":
  43210. for (let i2 = 0; i2 < position2.length; i2++) {
  43211. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43212. }
  43213. return positionArr;
  43214. case "DrawBowLine":
  43215. for (let i2 = 0; i2 < position2.length; i2++) {
  43216. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43217. }
  43218. return positionArr;
  43219. case "DrawBowPlane":
  43220. for (let i2 = 0; i2 < position2.length; i2++) {
  43221. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43222. }
  43223. return positionArr;
  43224. case "DrawRectFlag":
  43225. for (let i2 = 0; i2 < position2.length; i2++) {
  43226. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43227. }
  43228. return positionArr;
  43229. case "DrawTriangleFlag":
  43230. for (let i2 = 0; i2 < position2.length; i2++) {
  43231. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43232. }
  43233. return positionArr;
  43234. case "DrawCurveFlag":
  43235. for (let i2 = 0; i2 < position2.length; i2++) {
  43236. positionArr.push(this.LatlngTocartesian(position2[i2]));
  43237. }
  43238. return positionArr;
  43239. }
  43240. }
  43241. registerEvents() {
  43242. this.initLeftDownEventHandler();
  43243. this.initMouseMoveEventHandler();
  43244. this.initLeftUpEventHandler();
  43245. }
  43246. unRegisterEvents() {
  43247. this.eventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOWN);
  43248. this.eventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP);
  43249. this.eventHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  43250. }
  43251. initLeftDownEventHandler() {
  43252. this.eventHandler.setInputAction((e) => {
  43253. let id = this.viewer.scene.pick(e.position);
  43254. if (!id || !id.id || !id.id.type)
  43255. return;
  43256. if (id.id.type == "EditVertex" || id.id.type == "EditMove") {
  43257. this.isEditing = true;
  43258. this.viewer.scene.screenSpaceCameraController.enableRotate = false;
  43259. this.viewer.enableCursorStyle = false;
  43260. this.viewer._element.style.cursor = "";
  43261. document.body.style.cursor = "move";
  43262. this.editVertext = id.id;
  43263. this.editVertext.show = false;
  43264. this.clearMidVertex();
  43265. } else if (id.id.type == "EditMidVertex") {
  43266. this.editPositions.splice(id.id.vertexIndex, 0, id.id.position._value);
  43267. this.clearAllEditVertex();
  43268. this.createEditVertex();
  43269. this.createMidVertex();
  43270. this.isEdited = true;
  43271. } else {
  43272. return;
  43273. }
  43274. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  43275. }
  43276. initLeftUpEventHandler() {
  43277. this.eventHandler.setInputAction((e) => {
  43278. if (!this.isEditing)
  43279. return;
  43280. this.viewer.enableCursorStyle = true;
  43281. document.body.style.cursor = "default";
  43282. this.viewer.scene.screenSpaceCameraController.enableRotate = true;
  43283. this.editVertext.show = true;
  43284. this.isEditing = false;
  43285. this.clearMidVertex();
  43286. this.createMidVertex();
  43287. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  43288. }
  43289. initMouseMoveEventHandler() {
  43290. this.eventHandler.setInputAction((e) => {
  43291. var position2 = e.endPosition;
  43292. var ray = this.viewer.scene.camera.getPickRay(position2);
  43293. var cartesian = this.viewer.scene.globe.pick(ray, this.viewer.scene);
  43294. if (!cartesian)
  43295. return;
  43296. if (!this.isEditing)
  43297. return;
  43298. if (this.editVertext.type == "EditMove") {
  43299. let startPosition = this.EditMoveCenterPositoin;
  43300. if (!startPosition)
  43301. return;
  43302. this.moveEntityByOffset(startPosition, cartesian);
  43303. } else if (this.editVertext.type == "EditVertex" || this.editVertext.type == "EditMidVertex") {
  43304. this.editPositions[this.editVertext.vertexIndex] = cartesian;
  43305. }
  43306. this.isEdited = true;
  43307. this.EditMoveCenterPositoin = this.getCenterPosition();
  43308. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  43309. }
  43310. getCenterPosition() {
  43311. let points2 = [];
  43312. let maxHeight = 0;
  43313. if (this.editEntity.Type == "DrawCircle" || this.editEntity.Type == "DrawPoint" || this.editEntity.Type == "DrawSector") {
  43314. return this.editPositions[0];
  43315. }
  43316. this.editPositions.forEach((position2) => {
  43317. const point3d = this.cartesian3ToPoint3D(position2);
  43318. points2.push([point3d.x, point3d.y]);
  43319. if (maxHeight < point3d.z)
  43320. maxHeight = point3d.z;
  43321. });
  43322. let geo = lineString(points2);
  43323. let bbox2 = bbox$1(geo);
  43324. let bboxPolygon$1 = bboxPolygon(bbox2);
  43325. let pointOnFeature = center(bboxPolygon$1);
  43326. let lonLat = pointOnFeature.geometry.coordinates;
  43327. return Cesium.Cartesian3.fromDegrees(lonLat[0], lonLat[1], maxHeight);
  43328. }
  43329. moveEntityByOffset(startPosition, endPosition) {
  43330. let startPoint3d = this.cartesian3ToPoint3D(startPosition);
  43331. let endPoint3d = this.cartesian3ToPoint3D(endPosition);
  43332. let offsetX = endPoint3d.x - startPoint3d.x;
  43333. let offsetY = endPoint3d.y - startPoint3d.y;
  43334. let element;
  43335. for (let i2 = 0; i2 < this.editPositions.length; i2++) {
  43336. element = this.cartesian3ToPoint3D(this.editPositions[i2]);
  43337. element.x += offsetX;
  43338. element.y += offsetY;
  43339. this.editPositions[i2] = Cesium.Cartesian3.fromDegrees(element.x, element.y, element.z);
  43340. }
  43341. }
  43342. createEditVertex() {
  43343. this.vertexEntities = [];
  43344. this.editPositions.forEach((p, index2) => {
  43345. const entity = this.viewer.entities.add({
  43346. position: new Cesium.CallbackProperty((e) => {
  43347. return this.editPositions[index2];
  43348. }, false),
  43349. type: "EditVertex",
  43350. vertexIndex: index2,
  43351. point: {
  43352. show: true,
  43353. pixelSize: 10,
  43354. color: new Cesium.Color(0, 0, 1, 1),
  43355. outlineWidth: 1,
  43356. outlineColor: new Cesium.Color(1, 1, 1, 1),
  43357. disableDepthTestDistance: 15e11,
  43358. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  43359. }
  43360. });
  43361. this.vertexEntities.push(entity);
  43362. });
  43363. if (this.editEntity.Type == "DrawCircle") {
  43364. this.vertexEntities[0].show = false;
  43365. }
  43366. if (this.editPositions.length == 1) {
  43367. return;
  43368. }
  43369. this.createEditMoveCenterEntity();
  43370. }
  43371. createEditMoveCenterEntity() {
  43372. this.EditMoveCenterEntity = this.viewer.entities.add({
  43373. position: new Cesium.CallbackProperty((e) => {
  43374. return this.EditMoveCenterPositoin;
  43375. }, false),
  43376. type: "EditMove",
  43377. point: {
  43378. show: true,
  43379. pixelSize: 12,
  43380. color: new Cesium.Color(0, 1, 0, 0.1),
  43381. outlineWidth: 2,
  43382. outlineColor: new Cesium.Color(1, 1, 1, 1),
  43383. disableDepthTestDistance: 15e11,
  43384. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  43385. }
  43386. });
  43387. }
  43388. clearEditVertex() {
  43389. if (this.vertexEntities) {
  43390. this.vertexEntities.forEach((item) => {
  43391. this.viewer.entities.remove(item);
  43392. });
  43393. }
  43394. this.vertexEntities = [];
  43395. this.viewer.entities.remove(this.EditMoveCenterEntity);
  43396. }
  43397. createMidVertex() {
  43398. if (this.editEntity.Type == "DrawCircle" || this.editEntity.Type == "DrawPincerArrow" || this.editEntity.Type == "DrawRectangle" || this.editEntity.Type == "DrawStraightArrow" || this.editEntity.Type == "DrawGatheringPlace" || this.editEntity.Type == "DrawSector" || this.editEntity.Type == "DrawBowLine" || this.editEntity.Type == "DrawBowPlane" || this.editEntity.Type == "DrawRectFlag" || this.editEntity.Type == "DrawTriangleFlag" || this.editEntity.Type == "DrawCurveFlag") {
  43399. return;
  43400. }
  43401. this.midVertexEntities = [];
  43402. for (let i2 = 0; i2 < this.editPositions.length; i2++) {
  43403. const p1 = this.editPositions[i2];
  43404. const p2 = this.editPositions[i2 + 1];
  43405. let mideP = this.midPosition(p1, p2);
  43406. const entity = this.viewer.entities.add({
  43407. position: mideP,
  43408. type: "EditMidVertex",
  43409. vertexIndex: i2 + 1,
  43410. point: {
  43411. show: true,
  43412. pixelSize: 10,
  43413. color: new Cesium.Color(0, 1, 0, 1),
  43414. outlineWidth: 1,
  43415. outlineColor: new Cesium.Color(1, 1, 1, 1),
  43416. disableDepthTestDistance: 15e11,
  43417. heightReference: Cesium.HeightReference.CLAMP_TO_GROUND
  43418. }
  43419. });
  43420. this.midVertexEntities.push(entity);
  43421. }
  43422. }
  43423. clearMidVertex() {
  43424. if (this.midVertexEntities) {
  43425. this.midVertexEntities.forEach((item) => {
  43426. this.viewer.entities.remove(item);
  43427. });
  43428. }
  43429. this.midVertexEntities = [];
  43430. }
  43431. cartesian3ToPoint3D(position2) {
  43432. const cartographic = Cesium.Cartographic.fromCartesian(position2);
  43433. const lon = Cesium.Math.toDegrees(cartographic.longitude);
  43434. const lat = Cesium.Math.toDegrees(cartographic.latitude);
  43435. return {
  43436. x: lon,
  43437. y: lat,
  43438. z: cartographic.height
  43439. };
  43440. }
  43441. midPosition(first, second) {
  43442. if (!first || !second)
  43443. return null;
  43444. let point3d1 = this.cartesian3ToPoint3D(first);
  43445. let point3d2 = this.cartesian3ToPoint3D(second);
  43446. let midLonLat = {
  43447. x: (point3d1.x + point3d2.x) / 2,
  43448. y: (point3d1.y + point3d2.y) / 2,
  43449. z: (point3d1.z + point3d2.z) / 2
  43450. };
  43451. return Cesium.Cartesian3.fromDegrees(midLonLat.x, midLonLat.y, midLonLat.z);
  43452. }
  43453. cartesianToLatlng(cartesian) {
  43454. let cartographic = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(cartesian);
  43455. let lat = new Cesium.Math.toDegrees(cartographic.latitude);
  43456. let lng = new Cesium.Math.toDegrees(cartographic.longitude);
  43457. cartographic.height;
  43458. return [lng, lat];
  43459. }
  43460. LatlngTocartesian(latlng) {
  43461. let cartesian3 = new Cesium.Cartesian3.fromDegrees(latlng[0], latlng[1]);
  43462. return cartesian3;
  43463. }
  43464. }
  43465. var _style_0$1 = `@charset "UTF-8";:root{--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary-rgb:64,158,255;--el-color-success-rgb:103,194,58;--el-color-warning-rgb:230,162,60;--el-color-danger-rgb:245,108,108;--el-color-error-rgb:245,108,108;--el-color-info-rgb:144,147,153;--el-font-size-extra-large:20px;--el-font-size-large:18px;--el-font-size-medium:16px;--el-font-size-base:14px;--el-font-size-small:13px;--el-font-size-extra-small:12px;--el-font-family:"Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","\\5fae\\8f6f\\96c5\\9ed1",Arial,sans-serif;--el-font-weight-primary:500;--el-font-line-height-primary:24px;--el-index-normal:1;--el-index-top:1000;--el-index-popper:2000;--el-border-radius-base:4px;--el-border-radius-small:2px;--el-border-radius-round:20px;--el-border-radius-circle:100%;--el-transition-duration:.3s;--el-transition-duration-fast:.2s;--el-transition-function-ease-in-out-bezier:cubic-bezier(.645, .045, .355, 1);--el-transition-function-fast-bezier:cubic-bezier(.23, 1, .32, 1);--el-transition-all:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);--el-transition-fade:opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-md-fade:transform var(--el-transition-duration) var(--el-transition-function-fast-bezier),opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-fade-linear:opacity var(--el-transition-duration-fast) linear;--el-transition-border:border-color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-box-shadow:box-shadow var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-color:color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-component-size-large:40px;--el-component-size:32px;--el-component-size-small:24px}:root{color-scheme:light;--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary:#409eff;--el-color-primary-light-3:#79bbff;--el-color-primary-light-5:#a0cfff;--el-color-primary-light-7:#c6e2ff;--el-color-primary-light-8:#d9ecff;--el-color-primary-light-9:#ecf5ff;--el-color-primary-dark-2:#337ecc;--el-color-success:#67c23a;--el-color-success-light-3:#95d475;--el-color-success-light-5:#b3e19d;--el-color-success-light-7:#d1edc4;--el-color-success-light-8:#e1f3d8;--el-color-success-light-9:#f0f9eb;--el-color-success-dark-2:#529b2e;--el-color-warning:#e6a23c;--el-color-warning-light-3:#eebe77;--el-color-warning-light-5:#f3d19e;--el-color-warning-light-7:#f8e3c5;--el-color-warning-light-8:#faecd8;--el-color-warning-light-9:#fdf6ec;--el-color-warning-dark-2:#b88230;--el-color-danger:#f56c6c;--el-color-danger-light-3:#f89898;--el-color-danger-light-5:#fab6b6;--el-color-danger-light-7:#fcd3d3;--el-color-danger-light-8:#fde2e2;--el-color-danger-light-9:#fef0f0;--el-color-danger-dark-2:#c45656;--el-color-error:#f56c6c;--el-color-error-light-3:#f89898;--el-color-error-light-5:#fab6b6;--el-color-error-light-7:#fcd3d3;--el-color-error-light-8:#fde2e2;--el-color-error-light-9:#fef0f0;--el-color-error-dark-2:#c45656;--el-color-info:#909399;--el-color-info-light-3:#b1b3b8;--el-color-info-light-5:#c8c9cc;--el-color-info-light-7:#dedfe0;--el-color-info-light-8:#e9e9eb;--el-color-info-light-9:#f4f4f5;--el-color-info-dark-2:#73767a;--el-bg-color:#ffffff;--el-bg-color-page:#f2f3f5;--el-bg-color-overlay:#ffffff;--el-text-color-primary:#303133;--el-text-color-regular:#606266;--el-text-color-secondary:#909399;--el-text-color-placeholder:#a8abb2;--el-text-color-disabled:#c0c4cc;--el-border-color:#dcdfe6;--el-border-color-light:#e4e7ed;--el-border-color-lighter:#ebeef5;--el-border-color-extra-light:#f2f6fc;--el-border-color-dark:#d4d7de;--el-border-color-darker:#cdd0d6;--el-fill-color:#f0f2f5;--el-fill-color-light:#f5f7fa;--el-fill-color-lighter:#fafafa;--el-fill-color-extra-light:#fafcff;--el-fill-color-dark:#ebedf0;--el-fill-color-darker:#e6e8eb;--el-fill-color-blank:#ffffff;--el-box-shadow:0px 12px 32px 4px rgba(0, 0, 0, .04),0px 8px 20px rgba(0, 0, 0, .08);--el-box-shadow-light:0px 0px 12px rgba(0, 0, 0, .12);--el-box-shadow-lighter:0px 0px 6px rgba(0, 0, 0, .12);--el-box-shadow-dark:0px 16px 48px 16px rgba(0, 0, 0, .08),0px 12px 32px rgba(0, 0, 0, .12),0px 8px 16px -8px rgba(0, 0, 0, .16);--el-disabled-bg-color:var(--el-fill-color-light);--el-disabled-text-color:var(--el-text-color-placeholder);--el-disabled-border-color:var(--el-border-color-light);--el-overlay-color:rgba(0, 0, 0, .8);--el-overlay-color-light:rgba(0, 0, 0, .7);--el-overlay-color-lighter:rgba(0, 0, 0, .5);--el-mask-color:rgba(255, 255, 255, .9);--el-mask-color-extra-light:rgba(255, 255, 255, .3);--el-border-width:1px;--el-border-style:solid;--el-border-color-hover:var(--el-text-color-disabled);--el-border:var(--el-border-width) var(--el-border-style) var(--el-border-color);--el-svg-monochrome-grey:var(--el-border-color)}.fade-in-linear-enter-active,.fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.fade-in-linear-enter-from,.fade-in-linear-leave-to{opacity:0}.el-fade-in-linear-enter-active,.el-fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.el-fade-in-linear-enter-from,.el-fade-in-linear-leave-to{opacity:0}.el-fade-in-enter-active,.el-fade-in-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-fade-in-enter-from,.el-fade-in-leave-active{opacity:0}.el-zoom-in-center-enter-active,.el-zoom-in-center-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-zoom-in-center-enter-from,.el-zoom-in-center-leave-active{opacity:0;transform:scaleX(0)}.el-zoom-in-top-enter-active,.el-zoom-in-top-leave-active{opacity:1;transform:scaleY(1);transition:var(--el-transition-md-fade);transform-origin:center top}.el-zoom-in-top-enter-active[data-popper-placement^=top],.el-zoom-in-top-leave-active[data-popper-placement^=top]{transform-origin:center bottom}.el-zoom-in-top-enter-from,.el-zoom-in-top-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-bottom-enter-active,.el-zoom-in-bottom-leave-active{opacity:1;transform:scaleY(1);transition:var(--el-transition-md-fade);transform-origin:center bottom}.el-zoom-in-bottom-enter-from,.el-zoom-in-bottom-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-left-enter-active,.el-zoom-in-left-leave-active{opacity:1;transform:scale(1);transition:var(--el-transition-md-fade);transform-origin:top left}.el-zoom-in-left-enter-from,.el-zoom-in-left-leave-active{opacity:0;transform:scale(.45)}.collapse-transition{transition:var(--el-transition-duration) height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.el-collapse-transition-enter-active,.el-collapse-transition-leave-active{transition:var(--el-transition-duration) max-height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.horizontal-collapse-transition{transition:var(--el-transition-duration) width ease-in-out,var(--el-transition-duration) padding-left ease-in-out,var(--el-transition-duration) padding-right ease-in-out}.el-list-enter-active,.el-list-leave-active{transition:all 1s}.el-list-enter-from,.el-list-leave-to{opacity:0;transform:translateY(-30px)}.el-list-leave-active{position:absolute!important}.el-opacity-transition{transition:opacity var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-icon-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon--right{margin-left:5px}.el-icon--left{margin-right:5px}@-webkit-keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.el-icon{--color:inherit;height:1em;width:1em;line-height:1em;display:inline-flex;justify-content:center;align-items:center;position:relative;fill:currentColor;color:var(--color);font-size:inherit}.el-icon.is-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon svg{height:1em;width:1em}.el-affix--fixed{position:fixed}.el-alert{--el-alert-padding:8px 16px;--el-alert-border-radius-base:var(--el-border-radius-base);--el-alert-title-font-size:13px;--el-alert-description-font-size:12px;--el-alert-close-font-size:12px;--el-alert-close-customed-font-size:13px;--el-alert-icon-size:16px;--el-alert-icon-large-size:28px;width:100%;padding:var(--el-alert-padding);margin:0;box-sizing:border-box;border-radius:var(--el-alert-border-radius-base);position:relative;background-color:var(--el-color-white);overflow:hidden;opacity:1;display:flex;align-items:center;transition:opacity var(--el-transition-duration-fast)}.el-alert.is-light .el-alert__close-btn{color:var(--el-text-color-placeholder)}.el-alert.is-dark .el-alert__close-btn,.el-alert.is-dark .el-alert__description{color:var(--el-color-white)}.el-alert.is-center{justify-content:center}.el-alert--success{--el-alert-bg-color:var(--el-color-success-light-9)}.el-alert--success.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-success)}.el-alert--success.is-light .el-alert__description{color:var(--el-color-success)}.el-alert--success.is-dark{background-color:var(--el-color-success);color:var(--el-color-white)}.el-alert--info{--el-alert-bg-color:var(--el-color-info-light-9)}.el-alert--info.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-info)}.el-alert--info.is-light .el-alert__description{color:var(--el-color-info)}.el-alert--info.is-dark{background-color:var(--el-color-info);color:var(--el-color-white)}.el-alert--warning{--el-alert-bg-color:var(--el-color-warning-light-9)}.el-alert--warning.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-warning)}.el-alert--warning.is-light .el-alert__description{color:var(--el-color-warning)}.el-alert--warning.is-dark{background-color:var(--el-color-warning);color:var(--el-color-white)}.el-alert--error{--el-alert-bg-color:var(--el-color-error-light-9)}.el-alert--error.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-error)}.el-alert--error.is-light .el-alert__description{color:var(--el-color-error)}.el-alert--error.is-dark{background-color:var(--el-color-error);color:var(--el-color-white)}.el-alert__content{display:table-cell;padding:0 8px}.el-alert .el-alert__icon{font-size:var(--el-alert-icon-size);width:var(--el-alert-icon-size)}.el-alert .el-alert__icon.is-big{font-size:var(--el-alert-icon-large-size);width:var(--el-alert-icon-large-size)}.el-alert__title{font-size:var(--el-alert-title-font-size);line-height:18px;vertical-align:text-top}.el-alert__title.is-bold{font-weight:700}.el-alert .el-alert__description{font-size:var(--el-alert-description-font-size);margin:5px 0 0}.el-alert .el-alert__close-btn{font-size:var(--el-alert-close-font-size);opacity:1;position:absolute;top:12px;right:15px;cursor:pointer}.el-alert .el-alert__close-btn.is-customed{font-style:normal;font-size:var(--el-alert-close-customed-font-size);top:9px}.el-alert-fade-enter-from,.el-alert-fade-leave-active{opacity:0}.el-aside{overflow:auto;box-sizing:border-box;flex-shrink:0;width:var(--el-aside-width,300px)}.el-autocomplete{position:relative;display:inline-block}.el-autocomplete__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-autocomplete__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-autocomplete__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-autocomplete-suggestion{border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-autocomplete-suggestion__wrap{max-height:280px;padding:10px 0;box-sizing:border-box}.el-autocomplete-suggestion__list{margin:0;padding:0}.el-autocomplete-suggestion li{padding:0 20px;margin:0;line-height:34px;cursor:pointer;color:var(--el-text-color-regular);font-size:var(--el-font-size-base);list-style:none;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-autocomplete-suggestion li:hover,.el-autocomplete-suggestion li.highlighted{background-color:var(--el-fill-color-light)}.el-autocomplete-suggestion li.divider{margin-top:6px;border-top:1px solid var(--el-color-black)}.el-autocomplete-suggestion li.divider:last-child{margin-bottom:-6px}.el-autocomplete-suggestion.is-loading li{text-align:center;height:100px;line-height:100px;font-size:20px;color:var(--el-text-color-secondary)}.el-autocomplete-suggestion.is-loading li:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-autocomplete-suggestion.is-loading li:hover{background-color:var(--el-bg-color-overlay)}.el-autocomplete-suggestion.is-loading .el-icon-loading{vertical-align:middle}.el-avatar{--el-avatar-text-color:var(--el-color-white);--el-avatar-bg-color:var(--el-text-color-disabled);--el-avatar-text-size:14px;--el-avatar-icon-size:18px;--el-avatar-border-radius:var(--el-border-radius-base);--el-avatar-size-large:56px;--el-avatar-size-small:24px;--el-avatar-size:40px;display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;text-align:center;overflow:hidden;color:var(--el-avatar-text-color);background:var(--el-avatar-bg-color);width:var(--el-avatar-size);height:var(--el-avatar-size);font-size:var(--el-avatar-text-size)}.el-avatar>img{display:block;height:100%}.el-avatar--circle{border-radius:50%}.el-avatar--square{border-radius:var(--el-avatar-border-radius)}.el-avatar--icon{font-size:var(--el-avatar-icon-size)}.el-avatar--small{--el-avatar-size:24px}.el-avatar--large{--el-avatar-size:56px}.el-backtop{--el-backtop-bg-color:var(--el-bg-color-overlay);--el-backtop-text-color:var(--el-color-primary);--el-backtop-hover-bg-color:var(--el-border-color-extra-light);position:fixed;background-color:var(--el-backtop-bg-color);width:40px;height:40px;border-radius:50%;color:var(--el-backtop-text-color);display:flex;align-items:center;justify-content:center;font-size:20px;box-shadow:var(--el-box-shadow-lighter);cursor:pointer;z-index:5}.el-backtop:hover{background-color:var(--el-backtop-hover-bg-color)}.el-backtop__icon{font-size:20px}.el-badge{--el-badge-bg-color:var(--el-color-danger);--el-badge-radius:10px;--el-badge-font-size:12px;--el-badge-padding:6px;--el-badge-size:18px;position:relative;vertical-align:middle;display:inline-block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.el-badge__content{background-color:var(--el-badge-bg-color);border-radius:var(--el-badge-radius);color:var(--el-color-white);display:inline-flex;justify-content:center;align-items:center;font-size:var(--el-badge-font-size);height:var(--el-badge-size);padding:0 var(--el-badge-padding);white-space:nowrap;border:1px solid var(--el-bg-color)}.el-badge__content.is-fixed{position:absolute;top:0;right:calc(1px + var(--el-badge-size)/ 2);transform:translateY(-50%) translate(100%);z-index:var(--el-index-normal)}.el-badge__content.is-fixed.is-dot{right:5px}.el-badge__content.is-dot{height:8px;width:8px;padding:0;right:0;border-radius:50%}.el-badge__content--primary{background-color:var(--el-color-primary)}.el-badge__content--success{background-color:var(--el-color-success)}.el-badge__content--warning{background-color:var(--el-color-warning)}.el-badge__content--info{background-color:var(--el-color-info)}.el-badge__content--danger{background-color:var(--el-color-danger)}.el-breadcrumb{font-size:14px;line-height:1}.el-breadcrumb:after,.el-breadcrumb:before{display:table;content:""}.el-breadcrumb:after{clear:both}.el-breadcrumb__separator{margin:0 9px;font-weight:700;color:var(--el-text-color-placeholder)}.el-breadcrumb__separator.el-icon{margin:0 6px;font-weight:400}.el-breadcrumb__separator.el-icon svg{vertical-align:middle}.el-breadcrumb__item{float:left;display:inline-flex;align-items:center}.el-breadcrumb__inner{color:var(--el-text-color-regular)}.el-breadcrumb__inner a,.el-breadcrumb__inner.is-link{font-weight:700;text-decoration:none;transition:var(--el-transition-color);color:var(--el-text-color-primary)}.el-breadcrumb__inner a:hover,.el-breadcrumb__inner.is-link:hover{color:var(--el-color-primary);cursor:pointer}.el-breadcrumb__item:last-child .el-breadcrumb__inner,.el-breadcrumb__item:last-child .el-breadcrumb__inner a,.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover{font-weight:400;color:var(--el-text-color-regular);cursor:text}.el-breadcrumb__item:last-child .el-breadcrumb__separator{display:none}.el-button-group{display:inline-block;vertical-align:middle}.el-button-group:after,.el-button-group:before{display:table;content:""}.el-button-group:after{clear:both}.el-button-group>.el-button{float:left;position:relative}.el-button-group>.el-button+.el-button{margin-left:0}.el-button-group>.el-button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.el-button-group>.el-button:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.el-button-group>.el-button:first-child:last-child{border-top-right-radius:var(--el-border-radius-base);border-bottom-right-radius:var(--el-border-radius-base);border-top-left-radius:var(--el-border-radius-base);border-bottom-left-radius:var(--el-border-radius-base)}.el-button-group>.el-button:first-child:last-child.is-round{border-radius:var(--el-border-radius-round)}.el-button-group>.el-button:first-child:last-child.is-circle{border-radius:50%}.el-button-group>.el-button:not(:first-child):not(:last-child){border-radius:0}.el-button-group>.el-button:not(:last-child){margin-right:-1px}.el-button-group>.el-button:active,.el-button-group>.el-button:focus,.el-button-group>.el-button:hover{z-index:1}.el-button-group>.el-button.is-active{z-index:1}.el-button-group>.el-dropdown>.el-button{border-top-left-radius:0;border-bottom-left-radius:0;border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button{--el-button-font-weight:var(--el-font-weight-primary);--el-button-border-color:var(--el-border-color);--el-button-bg-color:var(--el-fill-color-blank);--el-button-text-color:var(--el-text-color-regular);--el-button-disabled-text-color:var(--el-disabled-text-color);--el-button-disabled-bg-color:var(--el-fill-color-blank);--el-button-disabled-border-color:var(--el-border-color-light);--el-button-divide-border-color:rgba(255, 255, 255, .5);--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-color-primary-light-9);--el-button-hover-border-color:var(--el-color-primary-light-7);--el-button-active-text-color:var(--el-button-hover-text-color);--el-button-active-border-color:var(--el-color-primary);--el-button-active-bg-color:var(--el-button-hover-bg-color);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-hover-link-text-color:var(--el-color-info);--el-button-active-color:var(--el-text-color-primary)}.el-button{display:inline-flex;justify-content:center;align-items:center;line-height:1;height:32px;white-space:nowrap;cursor:pointer;color:var(--el-button-text-color);text-align:center;box-sizing:border-box;outline:0;transition:.1s;font-weight:var(--el-button-font-weight);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-webkit-appearance:none;background-color:var(--el-button-bg-color);border:var(--el-border);border-color:var(--el-button-border-color);padding:8px 15px;font-size:var(--el-font-size-base);border-radius:var(--el-border-radius-base)}.el-button:focus,.el-button:hover{color:var(--el-button-hover-text-color);border-color:var(--el-button-hover-border-color);background-color:var(--el-button-hover-bg-color);outline:0}.el-button:active{color:var(--el-button-active-text-color);border-color:var(--el-button-active-border-color);background-color:var(--el-button-active-bg-color);outline:0}.el-button:focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px}.el-button>span{display:inline-flex;align-items:center}.el-button+.el-button{margin-left:12px}.el-button.is-round{padding:8px 15px}.el-button::-moz-focus-inner{border:0}.el-button [class*=el-icon]+span{margin-left:6px}.el-button [class*=el-icon] svg{vertical-align:bottom}.el-button.is-plain{--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-fill-color-blank);--el-button-hover-border-color:var(--el-color-primary)}.el-button.is-active{color:var(--el-button-active-text-color);border-color:var(--el-button-active-border-color);background-color:var(--el-button-active-bg-color);outline:0}.el-button.is-disabled,.el-button.is-disabled:focus,.el-button.is-disabled:hover{color:var(--el-button-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color);border-color:var(--el-button-disabled-border-color)}.el-button.is-loading{position:relative;pointer-events:none}.el-button.is-loading:before{z-index:1;pointer-events:none;content:"";position:absolute;left:-1px;top:-1px;right:-1px;bottom:-1px;border-radius:inherit;background-color:var(--el-mask-color-extra-light)}.el-button.is-round{border-radius:var(--el-border-radius-round)}.el-button.is-circle{border-radius:50%;padding:8px}.el-button.is-text{color:var(--el-button-text-color);border:0 solid transparent;background-color:transparent}.el-button.is-text.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important}.el-button.is-text:not(.is-disabled):focus,.el-button.is-text:not(.is-disabled):hover{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled):focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px}.el-button.is-text:not(.is-disabled):active{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled).is-has-bg:focus,.el-button.is-text:not(.is-disabled).is-has-bg:hover{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg:active{background-color:var(--el-fill-color-dark)}.el-button__text--expand{letter-spacing:.3em;margin-right:-.3em}.el-button.is-link{border-color:transparent;color:var(--el-button-text-color);background:0 0;padding:2px;height:auto}.el-button.is-link:focus,.el-button.is-link:hover{color:var(--el-button-hover-link-text-color)}.el-button.is-link.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important;border-color:transparent!important}.el-button.is-link:not(.is-disabled):focus,.el-button.is-link:not(.is-disabled):hover{border-color:transparent;background-color:transparent}.el-button.is-link:not(.is-disabled):active{color:var(--el-button-active-color);border-color:transparent;background-color:transparent}.el-button--text{border-color:transparent;background:0 0;color:var(--el-color-primary);padding-left:0;padding-right:0}.el-button--text.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important;border-color:transparent!important}.el-button--text:not(.is-disabled):focus,.el-button--text:not(.is-disabled):hover{color:var(--el-color-primary-light-3);border-color:transparent;background-color:transparent}.el-button--text:not(.is-disabled):active{color:var(--el-color-primary-dark-2);border-color:transparent;background-color:transparent}.el-button__link--expand{letter-spacing:.3em;margin-right:-.3em}.el-button--primary{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-primary);--el-button-border-color:var(--el-color-primary);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-active-color:var(--el-color-primary-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-primary-light-5);--el-button-hover-bg-color:var(--el-color-primary-light-3);--el-button-hover-border-color:var(--el-color-primary-light-3);--el-button-active-bg-color:var(--el-color-primary-dark-2);--el-button-active-border-color:var(--el-color-primary-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-primary-light-5);--el-button-disabled-border-color:var(--el-color-primary-light-5)}.el-button--primary.is-link,.el-button--primary.is-plain,.el-button--primary.is-text{--el-button-text-color:var(--el-color-primary);--el-button-bg-color:var(--el-color-primary-light-9);--el-button-border-color:var(--el-color-primary-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-primary);--el-button-hover-border-color:var(--el-color-primary);--el-button-active-text-color:var(--el-color-white)}.el-button--primary.is-link.is-disabled,.el-button--primary.is-link.is-disabled:active,.el-button--primary.is-link.is-disabled:focus,.el-button--primary.is-link.is-disabled:hover,.el-button--primary.is-plain.is-disabled,.el-button--primary.is-plain.is-disabled:active,.el-button--primary.is-plain.is-disabled:focus,.el-button--primary.is-plain.is-disabled:hover,.el-button--primary.is-text.is-disabled,.el-button--primary.is-text.is-disabled:active,.el-button--primary.is-text.is-disabled:focus,.el-button--primary.is-text.is-disabled:hover{color:var(--el-color-primary-light-5);background-color:var(--el-color-primary-light-9);border-color:var(--el-color-primary-light-8)}.el-button--success{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-success);--el-button-border-color:var(--el-color-success);--el-button-outline-color:var(--el-color-success-light-5);--el-button-active-color:var(--el-color-success-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-success-light-5);--el-button-hover-bg-color:var(--el-color-success-light-3);--el-button-hover-border-color:var(--el-color-success-light-3);--el-button-active-bg-color:var(--el-color-success-dark-2);--el-button-active-border-color:var(--el-color-success-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-success-light-5);--el-button-disabled-border-color:var(--el-color-success-light-5)}.el-button--success.is-link,.el-button--success.is-plain,.el-button--success.is-text{--el-button-text-color:var(--el-color-success);--el-button-bg-color:var(--el-color-success-light-9);--el-button-border-color:var(--el-color-success-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-success);--el-button-hover-border-color:var(--el-color-success);--el-button-active-text-color:var(--el-color-white)}.el-button--success.is-link.is-disabled,.el-button--success.is-link.is-disabled:active,.el-button--success.is-link.is-disabled:focus,.el-button--success.is-link.is-disabled:hover,.el-button--success.is-plain.is-disabled,.el-button--success.is-plain.is-disabled:active,.el-button--success.is-plain.is-disabled:focus,.el-button--success.is-plain.is-disabled:hover,.el-button--success.is-text.is-disabled,.el-button--success.is-text.is-disabled:active,.el-button--success.is-text.is-disabled:focus,.el-button--success.is-text.is-disabled:hover{color:var(--el-color-success-light-5);background-color:var(--el-color-success-light-9);border-color:var(--el-color-success-light-8)}.el-button--warning{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-warning);--el-button-border-color:var(--el-color-warning);--el-button-outline-color:var(--el-color-warning-light-5);--el-button-active-color:var(--el-color-warning-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-warning-light-5);--el-button-hover-bg-color:var(--el-color-warning-light-3);--el-button-hover-border-color:var(--el-color-warning-light-3);--el-button-active-bg-color:var(--el-color-warning-dark-2);--el-button-active-border-color:var(--el-color-warning-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-warning-light-5);--el-button-disabled-border-color:var(--el-color-warning-light-5)}.el-button--warning.is-link,.el-button--warning.is-plain,.el-button--warning.is-text{--el-button-text-color:var(--el-color-warning);--el-button-bg-color:var(--el-color-warning-light-9);--el-button-border-color:var(--el-color-warning-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-warning);--el-button-hover-border-color:var(--el-color-warning);--el-button-active-text-color:var(--el-color-white)}.el-button--warning.is-link.is-disabled,.el-button--warning.is-link.is-disabled:active,.el-button--warning.is-link.is-disabled:focus,.el-button--warning.is-link.is-disabled:hover,.el-button--warning.is-plain.is-disabled,.el-button--warning.is-plain.is-disabled:active,.el-button--warning.is-plain.is-disabled:focus,.el-button--warning.is-plain.is-disabled:hover,.el-button--warning.is-text.is-disabled,.el-button--warning.is-text.is-disabled:active,.el-button--warning.is-text.is-disabled:focus,.el-button--warning.is-text.is-disabled:hover{color:var(--el-color-warning-light-5);background-color:var(--el-color-warning-light-9);border-color:var(--el-color-warning-light-8)}.el-button--danger{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-danger);--el-button-border-color:var(--el-color-danger);--el-button-outline-color:var(--el-color-danger-light-5);--el-button-active-color:var(--el-color-danger-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-danger-light-5);--el-button-hover-bg-color:var(--el-color-danger-light-3);--el-button-hover-border-color:var(--el-color-danger-light-3);--el-button-active-bg-color:var(--el-color-danger-dark-2);--el-button-active-border-color:var(--el-color-danger-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-danger-light-5);--el-button-disabled-border-color:var(--el-color-danger-light-5)}.el-button--danger.is-link,.el-button--danger.is-plain,.el-button--danger.is-text{--el-button-text-color:var(--el-color-danger);--el-button-bg-color:var(--el-color-danger-light-9);--el-button-border-color:var(--el-color-danger-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-danger);--el-button-hover-border-color:var(--el-color-danger);--el-button-active-text-color:var(--el-color-white)}.el-button--danger.is-link.is-disabled,.el-button--danger.is-link.is-disabled:active,.el-button--danger.is-link.is-disabled:focus,.el-button--danger.is-link.is-disabled:hover,.el-button--danger.is-plain.is-disabled,.el-button--danger.is-plain.is-disabled:active,.el-button--danger.is-plain.is-disabled:focus,.el-button--danger.is-plain.is-disabled:hover,.el-button--danger.is-text.is-disabled,.el-button--danger.is-text.is-disabled:active,.el-button--danger.is-text.is-disabled:focus,.el-button--danger.is-text.is-disabled:hover{color:var(--el-color-danger-light-5);background-color:var(--el-color-danger-light-9);border-color:var(--el-color-danger-light-8)}.el-button--info{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-info);--el-button-border-color:var(--el-color-info);--el-button-outline-color:var(--el-color-info-light-5);--el-button-active-color:var(--el-color-info-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-info-light-5);--el-button-hover-bg-color:var(--el-color-info-light-3);--el-button-hover-border-color:var(--el-color-info-light-3);--el-button-active-bg-color:var(--el-color-info-dark-2);--el-button-active-border-color:var(--el-color-info-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-info-light-5);--el-button-disabled-border-color:var(--el-color-info-light-5)}.el-button--info.is-link,.el-button--info.is-plain,.el-button--info.is-text{--el-button-text-color:var(--el-color-info);--el-button-bg-color:var(--el-color-info-light-9);--el-button-border-color:var(--el-color-info-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-info);--el-button-hover-border-color:var(--el-color-info);--el-button-active-text-color:var(--el-color-white)}.el-button--info.is-link.is-disabled,.el-button--info.is-link.is-disabled:active,.el-button--info.is-link.is-disabled:focus,.el-button--info.is-link.is-disabled:hover,.el-button--info.is-plain.is-disabled,.el-button--info.is-plain.is-disabled:active,.el-button--info.is-plain.is-disabled:focus,.el-button--info.is-plain.is-disabled:hover,.el-button--info.is-text.is-disabled,.el-button--info.is-text.is-disabled:active,.el-button--info.is-text.is-disabled:focus,.el-button--info.is-text.is-disabled:hover{color:var(--el-color-info-light-5);background-color:var(--el-color-info-light-9);border-color:var(--el-color-info-light-8)}.el-button--large{--el-button-size:40px;height:var(--el-button-size);padding:12px 19px;font-size:var(--el-font-size-base);border-radius:var(--el-border-radius-base)}.el-button--large [class*=el-icon]+span{margin-left:8px}.el-button--large.is-round{padding:12px 19px}.el-button--large.is-circle{width:var(--el-button-size);padding:12px}.el-button--small{--el-button-size:24px;height:var(--el-button-size);padding:5px 11px;font-size:12px;border-radius:calc(var(--el-border-radius-base) - 1px)}.el-button--small [class*=el-icon]+span{margin-left:4px}.el-button--small.is-round{padding:5px 11px}.el-button--small.is-circle{width:var(--el-button-size);padding:5px}.el-calendar{--el-calendar-border:var(--el-table-border, 1px solid var(--el-border-color-lighter));--el-calendar-header-border-bottom:var(--el-calendar-border);--el-calendar-selected-bg-color:var(--el-color-primary-light-9);--el-calendar-cell-width:85px;background-color:var(--el-fill-color-blank)}.el-calendar__header{display:flex;justify-content:space-between;padding:12px 20px;border-bottom:var(--el-calendar-header-border-bottom)}.el-calendar__title{color:var(--el-text-color);align-self:center}.el-calendar__body{padding:12px 20px 35px}.el-calendar-table{table-layout:fixed;width:100%}.el-calendar-table thead th{padding:12px 0;color:var(--el-text-color-regular);font-weight:400}.el-calendar-table:not(.is-range) td.next,.el-calendar-table:not(.is-range) td.prev{color:var(--el-text-color-placeholder)}.el-calendar-table td{border-bottom:var(--el-calendar-border);border-right:var(--el-calendar-border);vertical-align:top;transition:background-color var(--el-transition-duration-fast) ease}.el-calendar-table td.is-selected{background-color:var(--el-calendar-selected-bg-color)}.el-calendar-table td.is-today{color:var(--el-color-primary)}.el-calendar-table tr:first-child td{border-top:var(--el-calendar-border)}.el-calendar-table tr td:first-child{border-left:var(--el-calendar-border)}.el-calendar-table tr.el-calendar-table__row--hide-border td{border-top:none}.el-calendar-table .el-calendar-day{box-sizing:border-box;padding:8px;height:var(--el-calendar-cell-width)}.el-calendar-table .el-calendar-day:hover{cursor:pointer;background-color:var(--el-calendar-selected-bg-color)}.el-card{--el-card-border-color:var(--el-border-color-light);--el-card-border-radius:4px;--el-card-padding:20px;--el-card-bg-color:var(--el-fill-color-blank)}.el-card{border-radius:var(--el-card-border-radius);border:1px solid var(--el-card-border-color);background-color:var(--el-card-bg-color);overflow:hidden;color:var(--el-text-color-primary);transition:var(--el-transition-duration)}.el-card.is-always-shadow{box-shadow:var(--el-box-shadow-light)}.el-card.is-hover-shadow:focus,.el-card.is-hover-shadow:hover{box-shadow:var(--el-box-shadow-light)}.el-card__header{padding:calc(var(--el-card-padding) - 2px) var(--el-card-padding);border-bottom:1px solid var(--el-card-border-color);box-sizing:border-box}.el-card__body{padding:var(--el-card-padding)}.el-carousel__item{position:absolute;top:0;left:0;width:100%;height:100%;display:inline-block;overflow:hidden;z-index:calc(var(--el-index-normal) - 1)}.el-carousel__item.is-active{z-index:calc(var(--el-index-normal) - 1)}.el-carousel__item.is-animating{transition:transform .4s ease-in-out}.el-carousel__item--card{width:50%;transition:transform .4s ease-in-out}.el-carousel__item--card.is-in-stage{cursor:pointer;z-index:var(--el-index-normal)}.el-carousel__item--card.is-in-stage.is-hover .el-carousel__mask,.el-carousel__item--card.is-in-stage:hover .el-carousel__mask{opacity:.12}.el-carousel__item--card.is-active{z-index:calc(var(--el-index-normal) + 1)}.el-carousel__mask{position:absolute;width:100%;height:100%;top:0;left:0;background-color:var(--el-color-white);opacity:.24;transition:var(--el-transition-duration-fast)}.el-carousel{--el-carousel-arrow-font-size:12px;--el-carousel-arrow-size:36px;--el-carousel-arrow-background:rgba(31, 45, 61, .11);--el-carousel-arrow-hover-background:rgba(31, 45, 61, .23);--el-carousel-indicator-width:30px;--el-carousel-indicator-height:2px;--el-carousel-indicator-padding-horizontal:4px;--el-carousel-indicator-padding-vertical:12px;--el-carousel-indicator-out-color:var(--el-border-color-hover);position:relative}.el-carousel--horizontal{overflow-x:hidden}.el-carousel--vertical{overflow-y:hidden}.el-carousel__container{position:relative;height:300px}.el-carousel__arrow{border:none;outline:0;padding:0;margin:0;height:var(--el-carousel-arrow-size);width:var(--el-carousel-arrow-size);cursor:pointer;transition:var(--el-transition-duration);border-radius:50%;background-color:var(--el-carousel-arrow-background);color:#fff;position:absolute;top:50%;z-index:10;transform:translateY(-50%);text-align:center;font-size:var(--el-carousel-arrow-font-size);display:inline-flex;justify-content:center;align-items:center}.el-carousel__arrow--left{left:16px}.el-carousel__arrow--right{right:16px}.el-carousel__arrow:hover{background-color:var(--el-carousel-arrow-hover-background)}.el-carousel__arrow i{cursor:pointer}.el-carousel__indicators{position:absolute;list-style:none;margin:0;padding:0;z-index:calc(var(--el-index-normal) + 1)}.el-carousel__indicators--horizontal{bottom:0;left:50%;transform:translate(-50%)}.el-carousel__indicators--vertical{right:0;top:50%;transform:translateY(-50%)}.el-carousel__indicators--outside{bottom:calc(var(--el-carousel-indicator-height) + var(--el-carousel-indicator-padding-vertical) * 2);text-align:center;position:static;transform:none}.el-carousel__indicators--outside .el-carousel__indicator:hover button{opacity:.64}.el-carousel__indicators--outside button{background-color:var(--el-carousel-indicator-out-color);opacity:.24}.el-carousel__indicators--labels{left:0;right:0;transform:none;text-align:center}.el-carousel__indicators--labels .el-carousel__button{height:auto;width:auto;padding:2px 18px;font-size:12px;color:#000}.el-carousel__indicators--labels .el-carousel__indicator{padding:6px 4px}.el-carousel__indicator{background-color:transparent;cursor:pointer}.el-carousel__indicator:hover button{opacity:.72}.el-carousel__indicator--horizontal{display:inline-block;padding:var(--el-carousel-indicator-padding-vertical) var(--el-carousel-indicator-padding-horizontal)}.el-carousel__indicator--vertical{padding:var(--el-carousel-indicator-padding-horizontal) var(--el-carousel-indicator-padding-vertical)}.el-carousel__indicator--vertical .el-carousel__button{width:var(--el-carousel-indicator-height);height:calc(var(--el-carousel-indicator-width)/ 2)}.el-carousel__indicator.is-active button{opacity:1}.el-carousel__button{display:block;opacity:.48;width:var(--el-carousel-indicator-width);height:var(--el-carousel-indicator-height);background-color:#fff;border:none;outline:0;padding:0;margin:0;cursor:pointer;transition:var(--el-transition-duration)}.carousel-arrow-left-enter-from,.carousel-arrow-left-leave-active{transform:translateY(-50%) translate(-10px);opacity:0}.carousel-arrow-right-enter-from,.carousel-arrow-right-leave-active{transform:translateY(-50%) translate(10px);opacity:0}.el-cascader-panel{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color)}.el-cascader-panel{display:flex;border-radius:var(--el-cascader-menu-radius);font-size:var(--el-cascader-menu-font-size)}.el-cascader-panel.is-bordered{border:var(--el-cascader-menu-border);border-radius:var(--el-cascader-menu-radius)}.el-cascader-menu{min-width:180px;box-sizing:border-box;color:var(--el-cascader-menu-text-color);border-right:var(--el-cascader-menu-border)}.el-cascader-menu:last-child{border-right:none}.el-cascader-menu:last-child .el-cascader-node{padding-right:20px}.el-cascader-menu__wrap.el-scrollbar__wrap{height:204px}.el-cascader-menu__list{position:relative;min-height:100%;margin:0;padding:6px 0;list-style:none;box-sizing:border-box}.el-cascader-menu__hover-zone{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.el-cascader-menu__empty-text{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;align-items:center;color:var(--el-cascader-color-empty)}.el-cascader-menu__empty-text .is-loading{margin-right:2px}.el-cascader-node{position:relative;display:flex;align-items:center;padding:0 30px 0 20px;height:34px;line-height:34px;outline:0}.el-cascader-node.is-selectable.in-active-path{color:var(--el-cascader-menu-text-color)}.el-cascader-node.in-active-path,.el-cascader-node.is-active,.el-cascader-node.is-selectable.in-checked-path{color:var(--el-cascader-menu-selected-text-color);font-weight:700}.el-cascader-node:not(.is-disabled){cursor:pointer}.el-cascader-node:not(.is-disabled):focus,.el-cascader-node:not(.is-disabled):hover{background:var(--el-cascader-node-background-hover)}.el-cascader-node.is-disabled{color:var(--el-cascader-node-color-disabled);cursor:not-allowed}.el-cascader-node__prefix{position:absolute;left:10px}.el-cascader-node__postfix{position:absolute;right:10px}.el-cascader-node__label{flex:1;text-align:left;padding:0 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-cascader-node>.el-checkbox{margin-right:0}.el-cascader-node>.el-radio{margin-right:0}.el-cascader-node>.el-radio .el-radio__label{padding-left:0}.el-cascader{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color);display:inline-block;vertical-align:middle;position:relative;font-size:var(--el-font-size-base);line-height:32px;outline:0}.el-cascader:not(.is-disabled):hover .el-input__wrapper{cursor:pointer;box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-cascader .el-input{display:flex;cursor:pointer}.el-cascader .el-input .el-input__inner{text-overflow:ellipsis;cursor:pointer}.el-cascader .el-input .el-input__suffix-inner .el-icon{height:calc(100% - 2px)}.el-cascader .el-input .el-input__suffix-inner .el-icon svg{vertical-align:middle}.el-cascader .el-input .icon-arrow-down{transition:transform var(--el-transition-duration);font-size:14px}.el-cascader .el-input .icon-arrow-down.is-reverse{transform:rotate(180deg)}.el-cascader .el-input .icon-circle-close:hover{color:var(--el-input-clear-hover-color,var(--el-text-color-secondary))}.el-cascader .el-input.is-focus .el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-focus-border-color,var(--el-color-primary)) inset}.el-cascader--large{font-size:14px;line-height:40px}.el-cascader--small{font-size:12px;line-height:24px}.el-cascader.is-disabled .el-cascader__label{z-index:calc(var(--el-index-normal) + 1);color:var(--el-disabled-text-color)}.el-cascader__dropdown{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color)}.el-cascader__dropdown{font-size:var(--el-cascader-menu-font-size);border-radius:var(--el-cascader-menu-radius)}.el-cascader__dropdown.el-popper{background:var(--el-cascader-menu-fill);border:var(--el-cascader-menu-border);box-shadow:var(--el-cascader-menu-shadow)}.el-cascader__dropdown.el-popper .el-popper__arrow:before{border:var(--el-cascader-menu-border)}.el-cascader__dropdown.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-cascader__dropdown.el-popper{box-shadow:var(--el-cascader-menu-shadow)}.el-cascader__tags{position:absolute;left:0;right:30px;top:50%;transform:translateY(-50%);display:flex;flex-wrap:wrap;line-height:normal;text-align:left;box-sizing:border-box}.el-cascader__tags .el-tag{display:inline-flex;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:var(--el-cascader-tag-background)}.el-cascader__tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__tags .el-tag>span{flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__tags .el-tag .el-icon-close{flex:none;background-color:var(--el-text-color-placeholder);color:var(--el-color-white)}.el-cascader__tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-cascader__collapse-tags{white-space:normal;z-index:var(--el-index-normal)}.el-cascader__collapse-tags .el-tag{display:inline-flex;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:var(--el-fill-color)}.el-cascader__collapse-tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__collapse-tags .el-tag>span{flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__collapse-tags .el-tag .el-icon-close{flex:none;background-color:var(--el-text-color-placeholder);color:var(--el-color-white)}.el-cascader__collapse-tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-cascader__suggestion-panel{border-radius:var(--el-cascader-menu-radius)}.el-cascader__suggestion-list{max-height:204px;margin:0;padding:6px 0;font-size:var(--el-font-size-base);color:var(--el-cascader-menu-text-color);text-align:center}.el-cascader__suggestion-item{display:flex;justify-content:space-between;align-items:center;height:34px;padding:0 15px;text-align:left;outline:0;cursor:pointer}.el-cascader__suggestion-item:focus,.el-cascader__suggestion-item:hover{background:var(--el-cascader-node-background-hover)}.el-cascader__suggestion-item.is-checked{color:var(--el-cascader-menu-selected-text-color);font-weight:700}.el-cascader__suggestion-item>span{margin-right:10px}.el-cascader__empty-text{margin:10px 0;color:var(--el-cascader-color-empty)}.el-cascader__search-input{flex:1;height:24px;min-width:60px;margin:2px 0 2px 11px;padding:0;color:var(--el-cascader-menu-text-color);border:none;outline:0;box-sizing:border-box;background:0 0}.el-cascader__search-input::-moz-placeholder{color:transparent}.el-cascader__search-input:-ms-input-placeholder{color:transparent}.el-cascader__search-input::placeholder{color:transparent}.el-check-tag{background-color:var(--el-color-info-light-9);border-radius:var(--el-border-radius-base);color:var(--el-color-info);cursor:pointer;display:inline-block;font-size:var(--el-font-size-base);line-height:var(--el-font-size-base);padding:7px 15px;transition:var(--el-transition-all);font-weight:700}.el-check-tag:hover{background-color:var(--el-color-info-light-7)}.el-check-tag.is-checked{background-color:var(--el-color-primary-light-8);color:var(--el-color-primary)}.el-check-tag.is-checked:hover{background-color:var(--el-color-primary-light-7)}.el-checkbox-button{--el-checkbox-button-checked-bg-color:var(--el-color-primary);--el-checkbox-button-checked-text-color:var(--el-color-white);--el-checkbox-button-checked-border-color:var(--el-color-primary)}.el-checkbox-button{position:relative;display:inline-block}.el-checkbox-button__inner{display:inline-block;line-height:1;font-weight:var(--el-checkbox-font-weight);white-space:nowrap;vertical-align:middle;cursor:pointer;background:var(--el-button-bg-color,var(--el-fill-color-blank));border:var(--el-border);border-left:0;color:var(--el-button-text-color,var(--el-text-color-regular));-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:0;margin:0;position:relative;transition:var(--el-transition-all);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:8px 15px;font-size:var(--el-font-size-base);border-radius:0}.el-checkbox-button__inner.is-round{padding:8px 15px}.el-checkbox-button__inner:hover{color:var(--el-color-primary)}.el-checkbox-button__inner [class*=el-icon-]{line-height:.9}.el-checkbox-button__inner [class*=el-icon-]+span{margin-left:5px}.el-checkbox-button__original{opacity:0;outline:0;position:absolute;margin:0;z-index:-1}.el-checkbox-button.is-checked .el-checkbox-button__inner{color:var(--el-checkbox-button-checked-text-color);background-color:var(--el-checkbox-button-checked-bg-color);border-color:var(--el-checkbox-button-checked-border-color);box-shadow:-1px 0 0 0 var(--el-color-primary-light-7)}.el-checkbox-button.is-checked:first-child .el-checkbox-button__inner{border-left-color:var(--el-checkbox-button-checked-border-color)}.el-checkbox-button.is-disabled .el-checkbox-button__inner{color:var(--el-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color,var(--el-fill-color-blank));border-color:var(--el-button-disabled-border-color,var(--el-border-color-light));box-shadow:none}.el-checkbox-button.is-disabled:first-child .el-checkbox-button__inner{border-left-color:var(--el-button-disabled-border-color,var(--el-border-color-light))}.el-checkbox-button:first-child .el-checkbox-button__inner{border-left:var(--el-border);border-top-left-radius:var(--el-border-radius-base);border-bottom-left-radius:var(--el-border-radius-base);box-shadow:none!important}.el-checkbox-button.is-focus .el-checkbox-button__inner{border-color:var(--el-checkbox-button-checked-border-color)}.el-checkbox-button:last-child .el-checkbox-button__inner{border-top-right-radius:var(--el-border-radius-base);border-bottom-right-radius:var(--el-border-radius-base)}.el-checkbox-button--large .el-checkbox-button__inner{padding:12px 19px;font-size:var(--el-font-size-base);border-radius:0}.el-checkbox-button--large .el-checkbox-button__inner.is-round{padding:12px 19px}.el-checkbox-button--small .el-checkbox-button__inner{padding:5px 11px;font-size:12px;border-radius:0}.el-checkbox-button--small .el-checkbox-button__inner.is-round{padding:5px 11px}.el-checkbox-group{font-size:0;line-height:0}.el-checkbox{--el-checkbox-font-size:14px;--el-checkbox-font-weight:var(--el-font-weight-primary);--el-checkbox-text-color:var(--el-text-color-regular);--el-checkbox-input-height:14px;--el-checkbox-input-width:14px;--el-checkbox-border-radius:var(--el-border-radius-small);--el-checkbox-bg-color:var(--el-fill-color-blank);--el-checkbox-input-border:var(--el-border);--el-checkbox-disabled-border-color:var(--el-border-color);--el-checkbox-disabled-input-fill:var(--el-fill-color-light);--el-checkbox-disabled-icon-color:var(--el-text-color-placeholder);--el-checkbox-disabled-checked-input-fill:var(--el-border-color-extra-light);--el-checkbox-disabled-checked-input-border-color:var(--el-border-color);--el-checkbox-disabled-checked-icon-color:var(--el-text-color-placeholder);--el-checkbox-checked-text-color:var(--el-color-primary);--el-checkbox-checked-input-border-color:var(--el-color-primary);--el-checkbox-checked-bg-color:var(--el-color-primary);--el-checkbox-checked-icon-color:var(--el-color-white);--el-checkbox-input-border-color-hover:var(--el-color-primary)}.el-checkbox{color:var(--el-checkbox-text-color);font-weight:var(--el-checkbox-font-weight);font-size:var(--el-font-size-base);position:relative;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:30px;height:32px}.el-checkbox.is-disabled{cursor:not-allowed}.el-checkbox.is-bordered{padding:0 15px 0 9px;border-radius:var(--el-border-radius-base);border:var(--el-border);box-sizing:border-box}.el-checkbox.is-bordered.is-checked{border-color:var(--el-color-primary)}.el-checkbox.is-bordered.is-disabled{border-color:var(--el-border-color-lighter)}.el-checkbox.is-bordered.el-checkbox--large{padding:0 19px 0 11px;border-radius:var(--el-border-radius-base)}.el-checkbox.is-bordered.el-checkbox--large .el-checkbox__label{font-size:var(--el-font-size-base)}.el-checkbox.is-bordered.el-checkbox--large .el-checkbox__inner{height:14px;width:14px}.el-checkbox.is-bordered.el-checkbox--small{padding:0 11px 0 7px;border-radius:calc(var(--el-border-radius-base) - 1px)}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__label{font-size:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner{height:12px;width:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner:after{height:6px;width:2px}.el-checkbox input:focus-visible+.el-checkbox__inner{outline:2px solid var(--el-checkbox-input-border-color-hover);outline-offset:1px;border-radius:var(--el-checkbox-border-radius)}.el-checkbox__input{white-space:nowrap;cursor:pointer;outline:0;display:inline-flex;position:relative}.el-checkbox__input.is-disabled .el-checkbox__inner{background-color:var(--el-checkbox-disabled-input-fill);border-color:var(--el-checkbox-disabled-border-color);cursor:not-allowed}.el-checkbox__input.is-disabled .el-checkbox__inner:after{cursor:not-allowed;border-color:var(--el-checkbox-disabled-icon-color)}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner{background-color:var(--el-checkbox-disabled-checked-input-fill);border-color:var(--el-checkbox-disabled-checked-input-border-color)}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner:after{border-color:var(--el-checkbox-disabled-checked-icon-color)}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner{background-color:var(--el-checkbox-disabled-checked-input-fill);border-color:var(--el-checkbox-disabled-checked-input-border-color)}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner:before{background-color:var(--el-checkbox-disabled-checked-icon-color);border-color:var(--el-checkbox-disabled-checked-icon-color)}.el-checkbox__input.is-disabled+span.el-checkbox__label{color:var(--el-disabled-text-color);cursor:not-allowed}.el-checkbox__input.is-checked .el-checkbox__inner{background-color:var(--el-checkbox-checked-bg-color);border-color:var(--el-checkbox-checked-input-border-color)}.el-checkbox__input.is-checked .el-checkbox__inner:after{transform:rotate(45deg) scaleY(1)}.el-checkbox__input.is-checked+.el-checkbox__label{color:var(--el-checkbox-checked-text-color)}.el-checkbox__input.is-focus:not(.is-checked) .el-checkbox__original:not(:focus-visible){border-color:var(--el-checkbox-input-border-color-hover)}.el-checkbox__input.is-indeterminate .el-checkbox__inner{background-color:var(--el-checkbox-checked-bg-color);border-color:var(--el-checkbox-checked-input-border-color)}.el-checkbox__input.is-indeterminate .el-checkbox__inner:before{content:"";position:absolute;display:block;background-color:var(--el-checkbox-checked-icon-color);height:2px;transform:scale(.5);left:0;right:0;top:5px}.el-checkbox__input.is-indeterminate .el-checkbox__inner:after{display:none}.el-checkbox__inner{display:inline-block;position:relative;border:var(--el-checkbox-input-border);border-radius:var(--el-checkbox-border-radius);box-sizing:border-box;width:var(--el-checkbox-input-width);height:var(--el-checkbox-input-height);background-color:var(--el-checkbox-bg-color);z-index:var(--el-index-normal);transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46),outline .25s cubic-bezier(.71,-.46,.29,1.46)}.el-checkbox__inner:hover{border-color:var(--el-checkbox-input-border-color-hover)}.el-checkbox__inner:after{box-sizing:content-box;content:"";border:1px solid var(--el-checkbox-checked-icon-color);border-left:0;border-top:0;height:7px;left:4px;position:absolute;top:1px;transform:rotate(45deg) scaleY(0);width:3px;transition:transform .15s ease-in 50ms;transform-origin:center}.el-checkbox__original{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;z-index:-1}.el-checkbox__label{display:inline-block;padding-left:8px;line-height:1;font-size:var(--el-checkbox-font-size)}.el-checkbox.el-checkbox--large{height:40px}.el-checkbox.el-checkbox--large .el-checkbox__label{font-size:14px}.el-checkbox.el-checkbox--large .el-checkbox__inner{width:14px;height:14px}.el-checkbox.el-checkbox--small{height:24px}.el-checkbox.el-checkbox--small .el-checkbox__label{font-size:12px}.el-checkbox.el-checkbox--small .el-checkbox__inner{width:12px;height:12px}.el-checkbox.el-checkbox--small .el-checkbox__input.is-indeterminate .el-checkbox__inner:before{top:4px}.el-checkbox.el-checkbox--small .el-checkbox__inner:after{width:2px;height:6px}.el-checkbox:last-of-type{margin-right:0}[class*=el-col-]{box-sizing:border-box}[class*=el-col-].is-guttered{display:block;min-height:1px}.el-col-0,.el-col-0.is-guttered{display:none}.el-col-0{max-width:0%;flex:0 0 0%}.el-col-offset-0{margin-left:0}.el-col-pull-0{position:relative;right:0}.el-col-push-0{position:relative;left:0}.el-col-1{max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-offset-1{margin-left:4.1666666667%}.el-col-pull-1{position:relative;right:4.1666666667%}.el-col-push-1{position:relative;left:4.1666666667%}.el-col-2{max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-offset-2{margin-left:8.3333333333%}.el-col-pull-2{position:relative;right:8.3333333333%}.el-col-push-2{position:relative;left:8.3333333333%}.el-col-3{max-width:12.5%;flex:0 0 12.5%}.el-col-offset-3{margin-left:12.5%}.el-col-pull-3{position:relative;right:12.5%}.el-col-push-3{position:relative;left:12.5%}.el-col-4{max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-offset-4{margin-left:16.6666666667%}.el-col-pull-4{position:relative;right:16.6666666667%}.el-col-push-4{position:relative;left:16.6666666667%}.el-col-5{max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-offset-5{margin-left:20.8333333333%}.el-col-pull-5{position:relative;right:20.8333333333%}.el-col-push-5{position:relative;left:20.8333333333%}.el-col-6{max-width:25%;flex:0 0 25%}.el-col-offset-6{margin-left:25%}.el-col-pull-6{position:relative;right:25%}.el-col-push-6{position:relative;left:25%}.el-col-7{max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-offset-7{margin-left:29.1666666667%}.el-col-pull-7{position:relative;right:29.1666666667%}.el-col-push-7{position:relative;left:29.1666666667%}.el-col-8{max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-offset-8{margin-left:33.3333333333%}.el-col-pull-8{position:relative;right:33.3333333333%}.el-col-push-8{position:relative;left:33.3333333333%}.el-col-9{max-width:37.5%;flex:0 0 37.5%}.el-col-offset-9{margin-left:37.5%}.el-col-pull-9{position:relative;right:37.5%}.el-col-push-9{position:relative;left:37.5%}.el-col-10{max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-offset-10{margin-left:41.6666666667%}.el-col-pull-10{position:relative;right:41.6666666667%}.el-col-push-10{position:relative;left:41.6666666667%}.el-col-11{max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-offset-11{margin-left:45.8333333333%}.el-col-pull-11{position:relative;right:45.8333333333%}.el-col-push-11{position:relative;left:45.8333333333%}.el-col-12{max-width:50%;flex:0 0 50%}.el-col-offset-12{margin-left:50%}.el-col-pull-12{position:relative;right:50%}.el-col-push-12{position:relative;left:50%}.el-col-13{max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-offset-13{margin-left:54.1666666667%}.el-col-pull-13{position:relative;right:54.1666666667%}.el-col-push-13{position:relative;left:54.1666666667%}.el-col-14{max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-offset-14{margin-left:58.3333333333%}.el-col-pull-14{position:relative;right:58.3333333333%}.el-col-push-14{position:relative;left:58.3333333333%}.el-col-15{max-width:62.5%;flex:0 0 62.5%}.el-col-offset-15{margin-left:62.5%}.el-col-pull-15{position:relative;right:62.5%}.el-col-push-15{position:relative;left:62.5%}.el-col-16{max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-offset-16{margin-left:66.6666666667%}.el-col-pull-16{position:relative;right:66.6666666667%}.el-col-push-16{position:relative;left:66.6666666667%}.el-col-17{max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-offset-17{margin-left:70.8333333333%}.el-col-pull-17{position:relative;right:70.8333333333%}.el-col-push-17{position:relative;left:70.8333333333%}.el-col-18{max-width:75%;flex:0 0 75%}.el-col-offset-18{margin-left:75%}.el-col-pull-18{position:relative;right:75%}.el-col-push-18{position:relative;left:75%}.el-col-19{max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-offset-19{margin-left:79.1666666667%}.el-col-pull-19{position:relative;right:79.1666666667%}.el-col-push-19{position:relative;left:79.1666666667%}.el-col-20{max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-offset-20{margin-left:83.3333333333%}.el-col-pull-20{position:relative;right:83.3333333333%}.el-col-push-20{position:relative;left:83.3333333333%}.el-col-21{max-width:87.5%;flex:0 0 87.5%}.el-col-offset-21{margin-left:87.5%}.el-col-pull-21{position:relative;right:87.5%}.el-col-push-21{position:relative;left:87.5%}.el-col-22{max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-offset-22{margin-left:91.6666666667%}.el-col-pull-22{position:relative;right:91.6666666667%}.el-col-push-22{position:relative;left:91.6666666667%}.el-col-23{max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-offset-23{margin-left:95.8333333333%}.el-col-pull-23{position:relative;right:95.8333333333%}.el-col-push-23{position:relative;left:95.8333333333%}.el-col-24{max-width:100%;flex:0 0 100%}.el-col-offset-24{margin-left:100%}.el-col-pull-24{position:relative;right:100%}.el-col-push-24{position:relative;left:100%}@media only screen and (max-width:768px){.el-col-xs-0,.el-col-xs-0.is-guttered{display:none}.el-col-xs-0{max-width:0%;flex:0 0 0%}.el-col-xs-offset-0{margin-left:0}.el-col-xs-pull-0{position:relative;right:0}.el-col-xs-push-0{position:relative;left:0}.el-col-xs-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-xs-offset-1{margin-left:4.1666666667%}.el-col-xs-pull-1{position:relative;right:4.1666666667%}.el-col-xs-push-1{position:relative;left:4.1666666667%}.el-col-xs-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-xs-offset-2{margin-left:8.3333333333%}.el-col-xs-pull-2{position:relative;right:8.3333333333%}.el-col-xs-push-2{position:relative;left:8.3333333333%}.el-col-xs-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-xs-offset-3{margin-left:12.5%}.el-col-xs-pull-3{position:relative;right:12.5%}.el-col-xs-push-3{position:relative;left:12.5%}.el-col-xs-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-xs-offset-4{margin-left:16.6666666667%}.el-col-xs-pull-4{position:relative;right:16.6666666667%}.el-col-xs-push-4{position:relative;left:16.6666666667%}.el-col-xs-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-xs-offset-5{margin-left:20.8333333333%}.el-col-xs-pull-5{position:relative;right:20.8333333333%}.el-col-xs-push-5{position:relative;left:20.8333333333%}.el-col-xs-6{display:block;max-width:25%;flex:0 0 25%}.el-col-xs-offset-6{margin-left:25%}.el-col-xs-pull-6{position:relative;right:25%}.el-col-xs-push-6{position:relative;left:25%}.el-col-xs-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-xs-offset-7{margin-left:29.1666666667%}.el-col-xs-pull-7{position:relative;right:29.1666666667%}.el-col-xs-push-7{position:relative;left:29.1666666667%}.el-col-xs-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-xs-offset-8{margin-left:33.3333333333%}.el-col-xs-pull-8{position:relative;right:33.3333333333%}.el-col-xs-push-8{position:relative;left:33.3333333333%}.el-col-xs-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-xs-offset-9{margin-left:37.5%}.el-col-xs-pull-9{position:relative;right:37.5%}.el-col-xs-push-9{position:relative;left:37.5%}.el-col-xs-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-xs-offset-10{margin-left:41.6666666667%}.el-col-xs-pull-10{position:relative;right:41.6666666667%}.el-col-xs-push-10{position:relative;left:41.6666666667%}.el-col-xs-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-xs-offset-11{margin-left:45.8333333333%}.el-col-xs-pull-11{position:relative;right:45.8333333333%}.el-col-xs-push-11{position:relative;left:45.8333333333%}.el-col-xs-12{display:block;max-width:50%;flex:0 0 50%}.el-col-xs-offset-12{margin-left:50%}.el-col-xs-pull-12{position:relative;right:50%}.el-col-xs-push-12{position:relative;left:50%}.el-col-xs-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-xs-offset-13{margin-left:54.1666666667%}.el-col-xs-pull-13{position:relative;right:54.1666666667%}.el-col-xs-push-13{position:relative;left:54.1666666667%}.el-col-xs-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-xs-offset-14{margin-left:58.3333333333%}.el-col-xs-pull-14{position:relative;right:58.3333333333%}.el-col-xs-push-14{position:relative;left:58.3333333333%}.el-col-xs-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-xs-offset-15{margin-left:62.5%}.el-col-xs-pull-15{position:relative;right:62.5%}.el-col-xs-push-15{position:relative;left:62.5%}.el-col-xs-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-xs-offset-16{margin-left:66.6666666667%}.el-col-xs-pull-16{position:relative;right:66.6666666667%}.el-col-xs-push-16{position:relative;left:66.6666666667%}.el-col-xs-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-xs-offset-17{margin-left:70.8333333333%}.el-col-xs-pull-17{position:relative;right:70.8333333333%}.el-col-xs-push-17{position:relative;left:70.8333333333%}.el-col-xs-18{display:block;max-width:75%;flex:0 0 75%}.el-col-xs-offset-18{margin-left:75%}.el-col-xs-pull-18{position:relative;right:75%}.el-col-xs-push-18{position:relative;left:75%}.el-col-xs-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-xs-offset-19{margin-left:79.1666666667%}.el-col-xs-pull-19{position:relative;right:79.1666666667%}.el-col-xs-push-19{position:relative;left:79.1666666667%}.el-col-xs-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-xs-offset-20{margin-left:83.3333333333%}.el-col-xs-pull-20{position:relative;right:83.3333333333%}.el-col-xs-push-20{position:relative;left:83.3333333333%}.el-col-xs-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-xs-offset-21{margin-left:87.5%}.el-col-xs-pull-21{position:relative;right:87.5%}.el-col-xs-push-21{position:relative;left:87.5%}.el-col-xs-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-xs-offset-22{margin-left:91.6666666667%}.el-col-xs-pull-22{position:relative;right:91.6666666667%}.el-col-xs-push-22{position:relative;left:91.6666666667%}.el-col-xs-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-xs-offset-23{margin-left:95.8333333333%}.el-col-xs-pull-23{position:relative;right:95.8333333333%}.el-col-xs-push-23{position:relative;left:95.8333333333%}.el-col-xs-24{display:block;max-width:100%;flex:0 0 100%}.el-col-xs-offset-24{margin-left:100%}.el-col-xs-pull-24{position:relative;right:100%}.el-col-xs-push-24{position:relative;left:100%}}@media only screen and (min-width:768px){.el-col-sm-0,.el-col-sm-0.is-guttered{display:none}.el-col-sm-0{max-width:0%;flex:0 0 0%}.el-col-sm-offset-0{margin-left:0}.el-col-sm-pull-0{position:relative;right:0}.el-col-sm-push-0{position:relative;left:0}.el-col-sm-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-sm-offset-1{margin-left:4.1666666667%}.el-col-sm-pull-1{position:relative;right:4.1666666667%}.el-col-sm-push-1{position:relative;left:4.1666666667%}.el-col-sm-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-sm-offset-2{margin-left:8.3333333333%}.el-col-sm-pull-2{position:relative;right:8.3333333333%}.el-col-sm-push-2{position:relative;left:8.3333333333%}.el-col-sm-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-sm-offset-3{margin-left:12.5%}.el-col-sm-pull-3{position:relative;right:12.5%}.el-col-sm-push-3{position:relative;left:12.5%}.el-col-sm-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-sm-offset-4{margin-left:16.6666666667%}.el-col-sm-pull-4{position:relative;right:16.6666666667%}.el-col-sm-push-4{position:relative;left:16.6666666667%}.el-col-sm-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-sm-offset-5{margin-left:20.8333333333%}.el-col-sm-pull-5{position:relative;right:20.8333333333%}.el-col-sm-push-5{position:relative;left:20.8333333333%}.el-col-sm-6{display:block;max-width:25%;flex:0 0 25%}.el-col-sm-offset-6{margin-left:25%}.el-col-sm-pull-6{position:relative;right:25%}.el-col-sm-push-6{position:relative;left:25%}.el-col-sm-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-sm-offset-7{margin-left:29.1666666667%}.el-col-sm-pull-7{position:relative;right:29.1666666667%}.el-col-sm-push-7{position:relative;left:29.1666666667%}.el-col-sm-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-sm-offset-8{margin-left:33.3333333333%}.el-col-sm-pull-8{position:relative;right:33.3333333333%}.el-col-sm-push-8{position:relative;left:33.3333333333%}.el-col-sm-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-sm-offset-9{margin-left:37.5%}.el-col-sm-pull-9{position:relative;right:37.5%}.el-col-sm-push-9{position:relative;left:37.5%}.el-col-sm-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-sm-offset-10{margin-left:41.6666666667%}.el-col-sm-pull-10{position:relative;right:41.6666666667%}.el-col-sm-push-10{position:relative;left:41.6666666667%}.el-col-sm-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-sm-offset-11{margin-left:45.8333333333%}.el-col-sm-pull-11{position:relative;right:45.8333333333%}.el-col-sm-push-11{position:relative;left:45.8333333333%}.el-col-sm-12{display:block;max-width:50%;flex:0 0 50%}.el-col-sm-offset-12{margin-left:50%}.el-col-sm-pull-12{position:relative;right:50%}.el-col-sm-push-12{position:relative;left:50%}.el-col-sm-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-sm-offset-13{margin-left:54.1666666667%}.el-col-sm-pull-13{position:relative;right:54.1666666667%}.el-col-sm-push-13{position:relative;left:54.1666666667%}.el-col-sm-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-sm-offset-14{margin-left:58.3333333333%}.el-col-sm-pull-14{position:relative;right:58.3333333333%}.el-col-sm-push-14{position:relative;left:58.3333333333%}.el-col-sm-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-sm-offset-15{margin-left:62.5%}.el-col-sm-pull-15{position:relative;right:62.5%}.el-col-sm-push-15{position:relative;left:62.5%}.el-col-sm-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-sm-offset-16{margin-left:66.6666666667%}.el-col-sm-pull-16{position:relative;right:66.6666666667%}.el-col-sm-push-16{position:relative;left:66.6666666667%}.el-col-sm-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-sm-offset-17{margin-left:70.8333333333%}.el-col-sm-pull-17{position:relative;right:70.8333333333%}.el-col-sm-push-17{position:relative;left:70.8333333333%}.el-col-sm-18{display:block;max-width:75%;flex:0 0 75%}.el-col-sm-offset-18{margin-left:75%}.el-col-sm-pull-18{position:relative;right:75%}.el-col-sm-push-18{position:relative;left:75%}.el-col-sm-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-sm-offset-19{margin-left:79.1666666667%}.el-col-sm-pull-19{position:relative;right:79.1666666667%}.el-col-sm-push-19{position:relative;left:79.1666666667%}.el-col-sm-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-sm-offset-20{margin-left:83.3333333333%}.el-col-sm-pull-20{position:relative;right:83.3333333333%}.el-col-sm-push-20{position:relative;left:83.3333333333%}.el-col-sm-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-sm-offset-21{margin-left:87.5%}.el-col-sm-pull-21{position:relative;right:87.5%}.el-col-sm-push-21{position:relative;left:87.5%}.el-col-sm-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-sm-offset-22{margin-left:91.6666666667%}.el-col-sm-pull-22{position:relative;right:91.6666666667%}.el-col-sm-push-22{position:relative;left:91.6666666667%}.el-col-sm-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-sm-offset-23{margin-left:95.8333333333%}.el-col-sm-pull-23{position:relative;right:95.8333333333%}.el-col-sm-push-23{position:relative;left:95.8333333333%}.el-col-sm-24{display:block;max-width:100%;flex:0 0 100%}.el-col-sm-offset-24{margin-left:100%}.el-col-sm-pull-24{position:relative;right:100%}.el-col-sm-push-24{position:relative;left:100%}}@media only screen and (min-width:992px){.el-col-md-0,.el-col-md-0.is-guttered{display:none}.el-col-md-0{max-width:0%;flex:0 0 0%}.el-col-md-offset-0{margin-left:0}.el-col-md-pull-0{position:relative;right:0}.el-col-md-push-0{position:relative;left:0}.el-col-md-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-md-offset-1{margin-left:4.1666666667%}.el-col-md-pull-1{position:relative;right:4.1666666667%}.el-col-md-push-1{position:relative;left:4.1666666667%}.el-col-md-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-md-offset-2{margin-left:8.3333333333%}.el-col-md-pull-2{position:relative;right:8.3333333333%}.el-col-md-push-2{position:relative;left:8.3333333333%}.el-col-md-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-md-offset-3{margin-left:12.5%}.el-col-md-pull-3{position:relative;right:12.5%}.el-col-md-push-3{position:relative;left:12.5%}.el-col-md-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-md-offset-4{margin-left:16.6666666667%}.el-col-md-pull-4{position:relative;right:16.6666666667%}.el-col-md-push-4{position:relative;left:16.6666666667%}.el-col-md-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-md-offset-5{margin-left:20.8333333333%}.el-col-md-pull-5{position:relative;right:20.8333333333%}.el-col-md-push-5{position:relative;left:20.8333333333%}.el-col-md-6{display:block;max-width:25%;flex:0 0 25%}.el-col-md-offset-6{margin-left:25%}.el-col-md-pull-6{position:relative;right:25%}.el-col-md-push-6{position:relative;left:25%}.el-col-md-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-md-offset-7{margin-left:29.1666666667%}.el-col-md-pull-7{position:relative;right:29.1666666667%}.el-col-md-push-7{position:relative;left:29.1666666667%}.el-col-md-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-md-offset-8{margin-left:33.3333333333%}.el-col-md-pull-8{position:relative;right:33.3333333333%}.el-col-md-push-8{position:relative;left:33.3333333333%}.el-col-md-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-md-offset-9{margin-left:37.5%}.el-col-md-pull-9{position:relative;right:37.5%}.el-col-md-push-9{position:relative;left:37.5%}.el-col-md-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-md-offset-10{margin-left:41.6666666667%}.el-col-md-pull-10{position:relative;right:41.6666666667%}.el-col-md-push-10{position:relative;left:41.6666666667%}.el-col-md-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-md-offset-11{margin-left:45.8333333333%}.el-col-md-pull-11{position:relative;right:45.8333333333%}.el-col-md-push-11{position:relative;left:45.8333333333%}.el-col-md-12{display:block;max-width:50%;flex:0 0 50%}.el-col-md-offset-12{margin-left:50%}.el-col-md-pull-12{position:relative;right:50%}.el-col-md-push-12{position:relative;left:50%}.el-col-md-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-md-offset-13{margin-left:54.1666666667%}.el-col-md-pull-13{position:relative;right:54.1666666667%}.el-col-md-push-13{position:relative;left:54.1666666667%}.el-col-md-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-md-offset-14{margin-left:58.3333333333%}.el-col-md-pull-14{position:relative;right:58.3333333333%}.el-col-md-push-14{position:relative;left:58.3333333333%}.el-col-md-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-md-offset-15{margin-left:62.5%}.el-col-md-pull-15{position:relative;right:62.5%}.el-col-md-push-15{position:relative;left:62.5%}.el-col-md-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-md-offset-16{margin-left:66.6666666667%}.el-col-md-pull-16{position:relative;right:66.6666666667%}.el-col-md-push-16{position:relative;left:66.6666666667%}.el-col-md-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-md-offset-17{margin-left:70.8333333333%}.el-col-md-pull-17{position:relative;right:70.8333333333%}.el-col-md-push-17{position:relative;left:70.8333333333%}.el-col-md-18{display:block;max-width:75%;flex:0 0 75%}.el-col-md-offset-18{margin-left:75%}.el-col-md-pull-18{position:relative;right:75%}.el-col-md-push-18{position:relative;left:75%}.el-col-md-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-md-offset-19{margin-left:79.1666666667%}.el-col-md-pull-19{position:relative;right:79.1666666667%}.el-col-md-push-19{position:relative;left:79.1666666667%}.el-col-md-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-md-offset-20{margin-left:83.3333333333%}.el-col-md-pull-20{position:relative;right:83.3333333333%}.el-col-md-push-20{position:relative;left:83.3333333333%}.el-col-md-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-md-offset-21{margin-left:87.5%}.el-col-md-pull-21{position:relative;right:87.5%}.el-col-md-push-21{position:relative;left:87.5%}.el-col-md-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-md-offset-22{margin-left:91.6666666667%}.el-col-md-pull-22{position:relative;right:91.6666666667%}.el-col-md-push-22{position:relative;left:91.6666666667%}.el-col-md-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-md-offset-23{margin-left:95.8333333333%}.el-col-md-pull-23{position:relative;right:95.8333333333%}.el-col-md-push-23{position:relative;left:95.8333333333%}.el-col-md-24{display:block;max-width:100%;flex:0 0 100%}.el-col-md-offset-24{margin-left:100%}.el-col-md-pull-24{position:relative;right:100%}.el-col-md-push-24{position:relative;left:100%}}@media only screen and (min-width:1200px){.el-col-lg-0,.el-col-lg-0.is-guttered{display:none}.el-col-lg-0{max-width:0%;flex:0 0 0%}.el-col-lg-offset-0{margin-left:0}.el-col-lg-pull-0{position:relative;right:0}.el-col-lg-push-0{position:relative;left:0}.el-col-lg-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-lg-offset-1{margin-left:4.1666666667%}.el-col-lg-pull-1{position:relative;right:4.1666666667%}.el-col-lg-push-1{position:relative;left:4.1666666667%}.el-col-lg-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-lg-offset-2{margin-left:8.3333333333%}.el-col-lg-pull-2{position:relative;right:8.3333333333%}.el-col-lg-push-2{position:relative;left:8.3333333333%}.el-col-lg-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-lg-offset-3{margin-left:12.5%}.el-col-lg-pull-3{position:relative;right:12.5%}.el-col-lg-push-3{position:relative;left:12.5%}.el-col-lg-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-lg-offset-4{margin-left:16.6666666667%}.el-col-lg-pull-4{position:relative;right:16.6666666667%}.el-col-lg-push-4{position:relative;left:16.6666666667%}.el-col-lg-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-lg-offset-5{margin-left:20.8333333333%}.el-col-lg-pull-5{position:relative;right:20.8333333333%}.el-col-lg-push-5{position:relative;left:20.8333333333%}.el-col-lg-6{display:block;max-width:25%;flex:0 0 25%}.el-col-lg-offset-6{margin-left:25%}.el-col-lg-pull-6{position:relative;right:25%}.el-col-lg-push-6{position:relative;left:25%}.el-col-lg-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-lg-offset-7{margin-left:29.1666666667%}.el-col-lg-pull-7{position:relative;right:29.1666666667%}.el-col-lg-push-7{position:relative;left:29.1666666667%}.el-col-lg-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-lg-offset-8{margin-left:33.3333333333%}.el-col-lg-pull-8{position:relative;right:33.3333333333%}.el-col-lg-push-8{position:relative;left:33.3333333333%}.el-col-lg-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-lg-offset-9{margin-left:37.5%}.el-col-lg-pull-9{position:relative;right:37.5%}.el-col-lg-push-9{position:relative;left:37.5%}.el-col-lg-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-lg-offset-10{margin-left:41.6666666667%}.el-col-lg-pull-10{position:relative;right:41.6666666667%}.el-col-lg-push-10{position:relative;left:41.6666666667%}.el-col-lg-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-lg-offset-11{margin-left:45.8333333333%}.el-col-lg-pull-11{position:relative;right:45.8333333333%}.el-col-lg-push-11{position:relative;left:45.8333333333%}.el-col-lg-12{display:block;max-width:50%;flex:0 0 50%}.el-col-lg-offset-12{margin-left:50%}.el-col-lg-pull-12{position:relative;right:50%}.el-col-lg-push-12{position:relative;left:50%}.el-col-lg-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-lg-offset-13{margin-left:54.1666666667%}.el-col-lg-pull-13{position:relative;right:54.1666666667%}.el-col-lg-push-13{position:relative;left:54.1666666667%}.el-col-lg-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-lg-offset-14{margin-left:58.3333333333%}.el-col-lg-pull-14{position:relative;right:58.3333333333%}.el-col-lg-push-14{position:relative;left:58.3333333333%}.el-col-lg-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-lg-offset-15{margin-left:62.5%}.el-col-lg-pull-15{position:relative;right:62.5%}.el-col-lg-push-15{position:relative;left:62.5%}.el-col-lg-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-lg-offset-16{margin-left:66.6666666667%}.el-col-lg-pull-16{position:relative;right:66.6666666667%}.el-col-lg-push-16{position:relative;left:66.6666666667%}.el-col-lg-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-lg-offset-17{margin-left:70.8333333333%}.el-col-lg-pull-17{position:relative;right:70.8333333333%}.el-col-lg-push-17{position:relative;left:70.8333333333%}.el-col-lg-18{display:block;max-width:75%;flex:0 0 75%}.el-col-lg-offset-18{margin-left:75%}.el-col-lg-pull-18{position:relative;right:75%}.el-col-lg-push-18{position:relative;left:75%}.el-col-lg-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-lg-offset-19{margin-left:79.1666666667%}.el-col-lg-pull-19{position:relative;right:79.1666666667%}.el-col-lg-push-19{position:relative;left:79.1666666667%}.el-col-lg-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-lg-offset-20{margin-left:83.3333333333%}.el-col-lg-pull-20{position:relative;right:83.3333333333%}.el-col-lg-push-20{position:relative;left:83.3333333333%}.el-col-lg-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-lg-offset-21{margin-left:87.5%}.el-col-lg-pull-21{position:relative;right:87.5%}.el-col-lg-push-21{position:relative;left:87.5%}.el-col-lg-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-lg-offset-22{margin-left:91.6666666667%}.el-col-lg-pull-22{position:relative;right:91.6666666667%}.el-col-lg-push-22{position:relative;left:91.6666666667%}.el-col-lg-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-lg-offset-23{margin-left:95.8333333333%}.el-col-lg-pull-23{position:relative;right:95.8333333333%}.el-col-lg-push-23{position:relative;left:95.8333333333%}.el-col-lg-24{display:block;max-width:100%;flex:0 0 100%}.el-col-lg-offset-24{margin-left:100%}.el-col-lg-pull-24{position:relative;right:100%}.el-col-lg-push-24{position:relative;left:100%}}@media only screen and (min-width:1920px){.el-col-xl-0,.el-col-xl-0.is-guttered{display:none}.el-col-xl-0{max-width:0%;flex:0 0 0%}.el-col-xl-offset-0{margin-left:0}.el-col-xl-pull-0{position:relative;right:0}.el-col-xl-push-0{position:relative;left:0}.el-col-xl-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-xl-offset-1{margin-left:4.1666666667%}.el-col-xl-pull-1{position:relative;right:4.1666666667%}.el-col-xl-push-1{position:relative;left:4.1666666667%}.el-col-xl-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-xl-offset-2{margin-left:8.3333333333%}.el-col-xl-pull-2{position:relative;right:8.3333333333%}.el-col-xl-push-2{position:relative;left:8.3333333333%}.el-col-xl-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-xl-offset-3{margin-left:12.5%}.el-col-xl-pull-3{position:relative;right:12.5%}.el-col-xl-push-3{position:relative;left:12.5%}.el-col-xl-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-xl-offset-4{margin-left:16.6666666667%}.el-col-xl-pull-4{position:relative;right:16.6666666667%}.el-col-xl-push-4{position:relative;left:16.6666666667%}.el-col-xl-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-xl-offset-5{margin-left:20.8333333333%}.el-col-xl-pull-5{position:relative;right:20.8333333333%}.el-col-xl-push-5{position:relative;left:20.8333333333%}.el-col-xl-6{display:block;max-width:25%;flex:0 0 25%}.el-col-xl-offset-6{margin-left:25%}.el-col-xl-pull-6{position:relative;right:25%}.el-col-xl-push-6{position:relative;left:25%}.el-col-xl-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-xl-offset-7{margin-left:29.1666666667%}.el-col-xl-pull-7{position:relative;right:29.1666666667%}.el-col-xl-push-7{position:relative;left:29.1666666667%}.el-col-xl-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-xl-offset-8{margin-left:33.3333333333%}.el-col-xl-pull-8{position:relative;right:33.3333333333%}.el-col-xl-push-8{position:relative;left:33.3333333333%}.el-col-xl-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-xl-offset-9{margin-left:37.5%}.el-col-xl-pull-9{position:relative;right:37.5%}.el-col-xl-push-9{position:relative;left:37.5%}.el-col-xl-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-xl-offset-10{margin-left:41.6666666667%}.el-col-xl-pull-10{position:relative;right:41.6666666667%}.el-col-xl-push-10{position:relative;left:41.6666666667%}.el-col-xl-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-xl-offset-11{margin-left:45.8333333333%}.el-col-xl-pull-11{position:relative;right:45.8333333333%}.el-col-xl-push-11{position:relative;left:45.8333333333%}.el-col-xl-12{display:block;max-width:50%;flex:0 0 50%}.el-col-xl-offset-12{margin-left:50%}.el-col-xl-pull-12{position:relative;right:50%}.el-col-xl-push-12{position:relative;left:50%}.el-col-xl-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-xl-offset-13{margin-left:54.1666666667%}.el-col-xl-pull-13{position:relative;right:54.1666666667%}.el-col-xl-push-13{position:relative;left:54.1666666667%}.el-col-xl-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-xl-offset-14{margin-left:58.3333333333%}.el-col-xl-pull-14{position:relative;right:58.3333333333%}.el-col-xl-push-14{position:relative;left:58.3333333333%}.el-col-xl-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-xl-offset-15{margin-left:62.5%}.el-col-xl-pull-15{position:relative;right:62.5%}.el-col-xl-push-15{position:relative;left:62.5%}.el-col-xl-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-xl-offset-16{margin-left:66.6666666667%}.el-col-xl-pull-16{position:relative;right:66.6666666667%}.el-col-xl-push-16{position:relative;left:66.6666666667%}.el-col-xl-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-xl-offset-17{margin-left:70.8333333333%}.el-col-xl-pull-17{position:relative;right:70.8333333333%}.el-col-xl-push-17{position:relative;left:70.8333333333%}.el-col-xl-18{display:block;max-width:75%;flex:0 0 75%}.el-col-xl-offset-18{margin-left:75%}.el-col-xl-pull-18{position:relative;right:75%}.el-col-xl-push-18{position:relative;left:75%}.el-col-xl-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-xl-offset-19{margin-left:79.1666666667%}.el-col-xl-pull-19{position:relative;right:79.1666666667%}.el-col-xl-push-19{position:relative;left:79.1666666667%}.el-col-xl-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-xl-offset-20{margin-left:83.3333333333%}.el-col-xl-pull-20{position:relative;right:83.3333333333%}.el-col-xl-push-20{position:relative;left:83.3333333333%}.el-col-xl-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-xl-offset-21{margin-left:87.5%}.el-col-xl-pull-21{position:relative;right:87.5%}.el-col-xl-push-21{position:relative;left:87.5%}.el-col-xl-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-xl-offset-22{margin-left:91.6666666667%}.el-col-xl-pull-22{position:relative;right:91.6666666667%}.el-col-xl-push-22{position:relative;left:91.6666666667%}.el-col-xl-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-xl-offset-23{margin-left:95.8333333333%}.el-col-xl-pull-23{position:relative;right:95.8333333333%}.el-col-xl-push-23{position:relative;left:95.8333333333%}.el-col-xl-24{display:block;max-width:100%;flex:0 0 100%}.el-col-xl-offset-24{margin-left:100%}.el-col-xl-pull-24{position:relative;right:100%}.el-col-xl-push-24{position:relative;left:100%}}.el-collapse{--el-collapse-border-color:var(--el-border-color-lighter);--el-collapse-header-height:48px;--el-collapse-header-bg-color:var(--el-fill-color-blank);--el-collapse-header-text-color:var(--el-text-color-primary);--el-collapse-header-font-size:13px;--el-collapse-content-bg-color:var(--el-fill-color-blank);--el-collapse-content-font-size:13px;--el-collapse-content-text-color:var(--el-text-color-primary);border-top:1px solid var(--el-collapse-border-color);border-bottom:1px solid var(--el-collapse-border-color)}.el-collapse-item.is-disabled .el-collapse-item__header{color:var(--el-text-color-disabled);cursor:not-allowed}.el-collapse-item__header{display:flex;align-items:center;height:var(--el-collapse-header-height);line-height:var(--el-collapse-header-height);background-color:var(--el-collapse-header-bg-color);color:var(--el-collapse-header-text-color);cursor:pointer;border-bottom:1px solid var(--el-collapse-border-color);font-size:var(--el-collapse-header-font-size);font-weight:500;transition:border-bottom-color var(--el-transition-duration);outline:0}.el-collapse-item__arrow{margin:0 8px 0 auto;transition:transform var(--el-transition-duration);font-weight:300}.el-collapse-item__arrow.is-active{transform:rotate(90deg)}.el-collapse-item__header.focusing:focus:not(:hover){color:var(--el-color-primary)}.el-collapse-item__header.is-active{border-bottom-color:transparent}.el-collapse-item__wrap{will-change:height;background-color:var(--el-collapse-content-bg-color);overflow:hidden;box-sizing:border-box;border-bottom:1px solid var(--el-collapse-border-color)}.el-collapse-item__content{padding-bottom:25px;font-size:var(--el-collapse-content-font-size);color:var(--el-collapse-content-text-color);line-height:1.7692307692}.el-collapse-item:last-child{margin-bottom:-1px}.el-color-predefine{display:flex;font-size:12px;margin-top:8px;width:280px}.el-color-predefine__colors{display:flex;flex:1;flex-wrap:wrap}.el-color-predefine__color-selector{margin:0 0 8px 8px;width:20px;height:20px;border-radius:4px;cursor:pointer}.el-color-predefine__color-selector:nth-child(10n+1){margin-left:0}.el-color-predefine__color-selector.selected{box-shadow:0 0 3px 2px var(--el-color-primary)}.el-color-predefine__color-selector>div{display:flex;height:100%;border-radius:3px}.el-color-predefine__color-selector.is-alpha{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.el-color-hue-slider{position:relative;box-sizing:border-box;width:280px;height:12px;background-color:red;padding:0 2px;float:right}.el-color-hue-slider__bar{position:relative;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);height:100%}.el-color-hue-slider__thumb{position:absolute;cursor:pointer;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid var(--el-border-color-lighter);box-shadow:0 0 2px #0009;z-index:1}.el-color-hue-slider.is-vertical{width:12px;height:180px;padding:2px 0}.el-color-hue-slider.is-vertical .el-color-hue-slider__bar{background:linear-gradient(to bottom,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}.el-color-hue-slider.is-vertical .el-color-hue-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-svpanel{position:relative;width:280px;height:180px}.el-color-svpanel__black,.el-color-svpanel__white{position:absolute;top:0;left:0;right:0;bottom:0}.el-color-svpanel__white{background:linear-gradient(to right,#fff,rgba(255,255,255,0))}.el-color-svpanel__black{background:linear-gradient(to top,#000,rgba(0,0,0,0))}.el-color-svpanel__cursor{position:absolute}.el-color-svpanel__cursor>div{cursor:head;width:4px;height:4px;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px #0000004d,0 0 1px 2px #0006;border-radius:50%;transform:translate(-2px,-2px)}.el-color-alpha-slider{position:relative;box-sizing:border-box;width:280px;height:12px;background-image:linear-gradient(45deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(45deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%);background-size:12px 12px;background-position:0 0,6px 0,6px -6px,0 6px}.el-color-alpha-slider__bar{position:relative;background:linear-gradient(to right,rgba(255,255,255,0) 0,var(--el-bg-color) 100%);height:100%}.el-color-alpha-slider__thumb{position:absolute;cursor:pointer;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid var(--el-border-color-lighter);box-shadow:0 0 2px #0009;z-index:1}.el-color-alpha-slider.is-vertical{width:20px;height:180px}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__bar{background:linear-gradient(to bottom,rgba(255,255,255,0) 0,#fff 100%)}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-dropdown{width:300px}.el-color-dropdown__main-wrapper{margin-bottom:6px}.el-color-dropdown__main-wrapper:after{content:"";display:table;clear:both}.el-color-dropdown__btns{margin-top:12px;text-align:right}.el-color-dropdown__value{float:left;line-height:26px;font-size:12px;color:#000;width:160px}.el-color-picker{display:inline-block;position:relative;line-height:normal;outline:0}.el-color-picker:hover:not(.is-disabled) .el-color-picker__trigger{border:1px solid var(--el-border-color-hover)}.el-color-picker:focus-visible:not(.is-disabled) .el-color-picker__trigger{outline:2px solid var(--el-color-primary);outline-offset:1px}.el-color-picker.is-disabled .el-color-picker__trigger{cursor:not-allowed}.el-color-picker--large{height:40px}.el-color-picker--large .el-color-picker__trigger{height:40px;width:40px}.el-color-picker--large .el-color-picker__mask{height:38px;width:38px}.el-color-picker--small{height:24px}.el-color-picker--small .el-color-picker__trigger{height:24px;width:24px}.el-color-picker--small .el-color-picker__mask{height:22px;width:22px}.el-color-picker--small .el-color-picker__empty,.el-color-picker--small .el-color-picker__icon{transform:scale(.8)}.el-color-picker__mask{height:30px;width:30px;border-radius:4px;position:absolute;top:1px;left:1px;z-index:1;cursor:not-allowed;background-color:#ffffffb3}.el-color-picker__trigger{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;height:32px;width:32px;padding:4px;border:1px solid var(--el-border-color);border-radius:4px;font-size:0;position:relative;cursor:pointer}.el-color-picker__color{position:relative;display:block;box-sizing:border-box;border:1px solid var(--el-text-color-secondary);border-radius:var(--el-border-radius-small);width:100%;height:100%;text-align:center}.el-color-picker__color.is-alpha{background-image:linear-gradient(45deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(45deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%);background-size:12px 12px;background-position:0 0,6px 0,6px -6px,0 6px}.el-color-picker__color-inner{display:inline-flex;justify-content:center;align-items:center;width:100%;height:100%}.el-color-picker .el-color-picker__empty{font-size:12px;color:var(--el-text-color-secondary)}.el-color-picker .el-color-picker__icon{display:inline-flex;justify-content:center;align-items:center;color:#fff;font-size:12px}.el-color-picker__panel{position:absolute;z-index:10;padding:6px;box-sizing:content-box;background-color:#fff;border-radius:var(--el-border-radius-base);box-shadow:var(--el-box-shadow-light)}.el-color-picker__panel.el-popper{border:1px solid var(--el-border-color-lighter)}.el-color-picker,.el-color-picker__panel{--el-color-picker-alpha-bg-a:#ccc;--el-color-picker-alpha-bg-b:transparent}.dark .el-color-picker,.dark .el-color-picker__panel{--el-color-picker-alpha-bg-a:#333333}.el-container{display:flex;flex-direction:row;flex:1;flex-basis:auto;box-sizing:border-box;min-width:0}.el-container.is-vertical{flex-direction:column}.el-date-table{font-size:12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-date-table.is-week-mode .el-date-table__row:hover .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table.is-week-mode .el-date-table__row:hover td.available:hover{color:var(--el-datepicker-text-color)}.el-date-table.is-week-mode .el-date-table__row:hover td:first-child .el-date-table-cell{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table.is-week-mode .el-date-table__row:hover td:last-child .el-date-table-cell{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table.is-week-mode .el-date-table__row.current .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table td{width:32px;height:30px;padding:4px 0;box-sizing:border-box;text-align:center;cursor:pointer;position:relative}.el-date-table td .el-date-table-cell{height:30px;padding:3px 0;box-sizing:border-box}.el-date-table td .el-date-table-cell .el-date-table-cell__text{width:24px;height:24px;display:block;margin:0 auto;line-height:24px;position:absolute;left:50%;transform:translate(-50%);border-radius:50%}.el-date-table td.next-month,.el-date-table td.prev-month{color:var(--el-datepicker-off-text-color)}.el-date-table td.today{position:relative}.el-date-table td.today .el-date-table-cell__text{color:var(--el-color-primary);font-weight:700}.el-date-table td.today.end-date .el-date-table-cell__text,.el-date-table td.today.start-date .el-date-table-cell__text{color:#fff}.el-date-table td.available:hover{color:var(--el-datepicker-hover-text-color)}.el-date-table td.in-range .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table td.in-range .el-date-table-cell:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-date-table td.current:not(.disabled) .el-date-table-cell__text{color:#fff;background-color:var(--el-datepicker-active-color)}.el-date-table td.current:not(.disabled):focus-visible .el-date-table-cell__text{outline:2px solid var(--el-datepicker-active-color);outline-offset:1px}.el-date-table td.end-date .el-date-table-cell,.el-date-table td.start-date .el-date-table-cell{color:#fff}.el-date-table td.end-date .el-date-table-cell__text,.el-date-table td.start-date .el-date-table-cell__text{background-color:var(--el-datepicker-active-color)}.el-date-table td.start-date .el-date-table-cell{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table td.end-date .el-date-table-cell{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table td.disabled .el-date-table-cell{background-color:var(--el-fill-color-light);opacity:1;cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-date-table td.selected .el-date-table-cell{margin-left:5px;margin-right:5px;background-color:var(--el-datepicker-inrange-bg-color);border-radius:15px}.el-date-table td.selected .el-date-table-cell:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-date-table td.selected .el-date-table-cell__text{background-color:var(--el-datepicker-active-color);color:#fff;border-radius:15px}.el-date-table td.week{font-size:80%;color:var(--el-datepicker-header-text-color)}.el-date-table td:focus{outline:0}.el-date-table th{padding:5px;color:var(--el-datepicker-header-text-color);font-weight:400;border-bottom:solid 1px var(--el-border-color-lighter)}.el-month-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-month-table td{text-align:center;padding:8px 0;cursor:pointer}.el-month-table td div{height:48px;padding:6px 0;box-sizing:border-box}.el-month-table td.today .cell{color:var(--el-color-primary);font-weight:700}.el-month-table td.today.end-date .cell,.el-month-table td.today.start-date .cell{color:#fff}.el-month-table td.disabled .cell{background-color:var(--el-fill-color-light);cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-month-table td.disabled .cell:hover{color:var(--el-text-color-placeholder)}.el-month-table td .cell{width:60px;height:36px;display:block;line-height:36px;color:var(--el-datepicker-text-color);margin:0 auto;border-radius:18px}.el-month-table td .cell:hover{color:var(--el-datepicker-hover-text-color)}.el-month-table td.in-range div{background-color:var(--el-datepicker-inrange-bg-color)}.el-month-table td.in-range div:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-month-table td.end-date div,.el-month-table td.start-date div{color:#fff}.el-month-table td.end-date .cell,.el-month-table td.start-date .cell{color:#fff;background-color:var(--el-datepicker-active-color)}.el-month-table td.start-date div{border-top-left-radius:24px;border-bottom-left-radius:24px}.el-month-table td.end-date div{border-top-right-radius:24px;border-bottom-right-radius:24px}.el-month-table td.current:not(.disabled) .cell{color:var(--el-datepicker-active-color)}.el-month-table td:focus-visible{outline:0}.el-month-table td:focus-visible .cell{outline:2px solid var(--el-datepicker-active-color)}.el-year-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-year-table .el-icon{color:var(--el-datepicker-icon-color)}.el-year-table td{text-align:center;padding:20px 3px;cursor:pointer}.el-year-table td.today .cell{color:var(--el-color-primary);font-weight:700}.el-year-table td.disabled .cell{background-color:var(--el-fill-color-light);cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-year-table td.disabled .cell:hover{color:var(--el-text-color-placeholder)}.el-year-table td .cell{width:48px;height:36px;display:block;line-height:36px;color:var(--el-datepicker-text-color);border-radius:18px;margin:0 auto}.el-year-table td .cell:hover{color:var(--el-datepicker-hover-text-color)}.el-year-table td.current:not(.disabled) .cell{color:var(--el-datepicker-active-color)}.el-year-table td:focus-visible{outline:0}.el-year-table td:focus-visible .cell{outline:2px solid var(--el-datepicker-active-color)}.el-time-spinner.has-seconds .el-time-spinner__wrapper{width:33.3%}.el-time-spinner__wrapper{max-height:192px;overflow:auto;display:inline-block;width:50%;vertical-align:top;position:relative}.el-time-spinner__wrapper.el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default){padding-bottom:15px}.el-time-spinner__wrapper.is-arrow{box-sizing:border-box;text-align:center;overflow:hidden}.el-time-spinner__wrapper.is-arrow .el-time-spinner__list{transform:translateY(-32px)}.el-time-spinner__wrapper.is-arrow .el-time-spinner__item:hover:not(.is-disabled):not(.is-active){background:var(--el-fill-color-light);cursor:default}.el-time-spinner__arrow{font-size:12px;color:var(--el-text-color-secondary);position:absolute;left:0;width:100%;z-index:var(--el-index-normal);text-align:center;height:30px;line-height:30px;cursor:pointer}.el-time-spinner__arrow:hover{color:var(--el-color-primary)}.el-time-spinner__arrow.arrow-up{top:10px}.el-time-spinner__arrow.arrow-down{bottom:10px}.el-time-spinner__input.el-input{width:70%}.el-time-spinner__input.el-input .el-input__inner{padding:0;text-align:center}.el-time-spinner__list{padding:0;margin:0;list-style:none;text-align:center}.el-time-spinner__list:after,.el-time-spinner__list:before{content:"";display:block;width:100%;height:80px}.el-time-spinner__item{height:32px;line-height:32px;font-size:12px;color:var(--el-text-color-regular)}.el-time-spinner__item:hover:not(.is-disabled):not(.is-active){background:var(--el-fill-color-light);cursor:pointer}.el-time-spinner__item.is-active:not(.is-disabled){color:var(--el-text-color-primary);font-weight:700}.el-time-spinner__item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-picker__popper{--el-datepicker-border-color:var(--el-disabled-border-color)}.el-picker__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-datepicker-border-color);box-shadow:var(--el-box-shadow-light)}.el-picker__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-datepicker-border-color)}.el-picker__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-date-editor{--el-date-editor-width:220px;--el-date-editor-monthrange-width:300px;--el-date-editor-daterange-width:350px;--el-date-editor-datetimerange-width:400px;--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary);position:relative;display:inline-block;text-align:left}.el-date-editor.el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset}.el-date-editor.el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-date-editor.el-input,.el-date-editor.el-input__wrapper{width:var(--el-date-editor-width);height:var(--el-input-height,var(--el-component-size))}.el-date-editor--monthrange{--el-date-editor-width:var(--el-date-editor-monthrange-width)}.el-date-editor--daterange,.el-date-editor--timerange{--el-date-editor-width:var(--el-date-editor-daterange-width)}.el-date-editor--datetimerange{--el-date-editor-width:var(--el-date-editor-datetimerange-width)}.el-date-editor--dates .el-input__wrapper{text-overflow:ellipsis;white-space:nowrap}.el-date-editor .close-icon,.el-date-editor .clear-icon{cursor:pointer}.el-date-editor .clear-icon:hover{color:var(--el-text-color-secondary)}.el-date-editor .el-range__icon{height:inherit;font-size:14px;color:var(--el-text-color-placeholder);float:left}.el-date-editor .el-range__icon svg{vertical-align:middle}.el-date-editor .el-range-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;outline:0;display:inline-block;height:30px;line-height:30px;margin:0;padding:0;width:39%;text-align:center;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);background-color:transparent}.el-date-editor .el-range-input::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-input:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-input::placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-separator{flex:1;display:inline-flex;justify-content:center;align-items:center;height:100%;padding:0 5px;margin:0;font-size:14px;word-break:keep-all;color:var(--el-text-color-primary)}.el-date-editor .el-range__close-icon{font-size:14px;color:var(--el-text-color-placeholder);height:inherit;width:unset;cursor:pointer}.el-date-editor .el-range__close-icon:hover{color:var(--el-text-color-secondary)}.el-date-editor .el-range__close-icon svg{vertical-align:middle}.el-date-editor .el-range__close-icon--hidden{opacity:0;visibility:hidden}.el-range-editor.el-input__wrapper{display:inline-flex;align-items:center;padding:0 10px}.el-range-editor.is-active,.el-range-editor.is-active:hover{box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-range-editor--large{line-height:var(--el-component-size-large)}.el-range-editor--large.el-input__wrapper{height:var(--el-component-size-large)}.el-range-editor--large .el-range-separator{line-height:40px;font-size:14px}.el-range-editor--large .el-range-input{height:38px;line-height:38px;font-size:14px}.el-range-editor--small{line-height:var(--el-component-size-small)}.el-range-editor--small.el-input__wrapper{height:var(--el-component-size-small)}.el-range-editor--small .el-range-separator{line-height:24px;font-size:12px}.el-range-editor--small .el-range-input{height:22px;line-height:22px;font-size:12px}.el-range-editor.is-disabled{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-range-editor.is-disabled:focus,.el-range-editor.is-disabled:hover{border-color:var(--el-disabled-border-color)}.el-range-editor.is-disabled input{background-color:var(--el-disabled-bg-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-range-editor.is-disabled input::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled input:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled input::placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled .el-range-separator{color:var(--el-disabled-text-color)}.el-picker-panel{color:var(--el-text-color-regular);background:var(--el-bg-color-overlay);border-radius:var(--el-border-radius-base);line-height:30px}.el-picker-panel .el-time-panel{margin:5px 0;border:solid 1px var(--el-datepicker-border-color);background-color:var(--el-bg-color-overlay);box-shadow:var(--el-box-shadow-light)}.el-picker-panel__body-wrapper:after,.el-picker-panel__body:after{content:"";display:table;clear:both}.el-picker-panel__content{position:relative;margin:15px}.el-picker-panel__footer{border-top:1px solid var(--el-datepicker-inner-border-color);padding:4px 12px;text-align:right;background-color:var(--el-bg-color-overlay);position:relative;font-size:0}.el-picker-panel__shortcut{display:block;width:100%;border:0;background-color:transparent;line-height:28px;font-size:14px;color:var(--el-datepicker-text-color);padding-left:12px;text-align:left;outline:0;cursor:pointer}.el-picker-panel__shortcut:hover{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__shortcut.active{background-color:#e6f1fe;color:var(--el-datepicker-active-color)}.el-picker-panel__btn{border:1px solid var(--el-fill-color-darker);color:var(--el-text-color-primary);line-height:24px;border-radius:2px;padding:0 20px;cursor:pointer;background-color:transparent;outline:0;font-size:12px}.el-picker-panel__btn[disabled]{color:var(--el-text-color-disabled);cursor:not-allowed}.el-picker-panel__icon-btn{font-size:12px;color:var(--el-datepicker-icon-color);border:0;background:0 0;cursor:pointer;outline:0;margin-top:8px}.el-picker-panel__icon-btn:hover{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__icon-btn:focus-visible{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__icon-btn.is-disabled{color:var(--el-text-color-disabled)}.el-picker-panel__icon-btn.is-disabled:hover{cursor:not-allowed}.el-picker-panel__icon-btn .el-icon{cursor:pointer;font-size:inherit}.el-picker-panel__link-btn{vertical-align:middle}.el-picker-panel [slot=sidebar],.el-picker-panel__sidebar{position:absolute;top:0;bottom:0;width:110px;border-right:1px solid var(--el-datepicker-inner-border-color);box-sizing:border-box;padding-top:6px;background-color:var(--el-bg-color-overlay);overflow:auto}.el-picker-panel [slot=sidebar]+.el-picker-panel__body,.el-picker-panel__sidebar+.el-picker-panel__body{margin-left:110px}.el-date-picker{--el-datepicker-text-color:var(--el-text-color-regular);--el-datepicker-off-text-color:var(--el-text-color-placeholder);--el-datepicker-header-text-color:var(--el-text-color-regular);--el-datepicker-icon-color:var(--el-text-color-primary);--el-datepicker-border-color:var(--el-disabled-border-color);--el-datepicker-inner-border-color:var(--el-border-color-light);--el-datepicker-inrange-bg-color:var(--el-border-color-extra-light);--el-datepicker-inrange-hover-bg-color:var(--el-border-color-extra-light);--el-datepicker-active-color:var(--el-color-primary);--el-datepicker-hover-text-color:var(--el-color-primary)}.el-date-picker{width:322px}.el-date-picker.has-sidebar.has-time{width:434px}.el-date-picker.has-sidebar{width:438px}.el-date-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-picker .el-picker-panel__content{width:292px}.el-date-picker table{table-layout:fixed;width:100%}.el-date-picker__editor-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-picker__time-header{position:relative;border-bottom:1px solid var(--el-datepicker-inner-border-color);font-size:12px;padding:8px 5px 5px;display:table;width:100%;box-sizing:border-box}.el-date-picker__header{margin:12px;text-align:center}.el-date-picker__header--bordered{margin-bottom:0;padding-bottom:12px;border-bottom:solid 1px var(--el-border-color-lighter)}.el-date-picker__header--bordered+.el-picker-panel__content{margin-top:0}.el-date-picker__header-label{font-size:16px;font-weight:500;padding:0 5px;line-height:22px;text-align:center;cursor:pointer;color:var(--el-text-color-regular)}.el-date-picker__header-label:hover{color:var(--el-datepicker-hover-text-color)}.el-date-picker__header-label:focus-visible{outline:0;color:var(--el-datepicker-hover-text-color)}.el-date-picker__header-label.active{color:var(--el-datepicker-active-color)}.el-date-picker__prev-btn{float:left}.el-date-picker__next-btn{float:right}.el-date-picker__time-wrap{padding:10px;text-align:center}.el-date-picker__time-label{float:left;cursor:pointer;line-height:30px;margin-left:10px}.el-date-picker .el-time-panel{position:absolute}.el-date-range-picker{--el-datepicker-text-color:var(--el-text-color-regular);--el-datepicker-off-text-color:var(--el-text-color-placeholder);--el-datepicker-header-text-color:var(--el-text-color-regular);--el-datepicker-icon-color:var(--el-text-color-primary);--el-datepicker-border-color:var(--el-disabled-border-color);--el-datepicker-inner-border-color:var(--el-border-color-light);--el-datepicker-inrange-bg-color:var(--el-border-color-extra-light);--el-datepicker-inrange-hover-bg-color:var(--el-border-color-extra-light);--el-datepicker-active-color:var(--el-color-primary);--el-datepicker-hover-text-color:var(--el-color-primary)}.el-date-range-picker{width:646px}.el-date-range-picker.has-sidebar{width:756px}.el-date-range-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-range-picker table{table-layout:fixed;width:100%}.el-date-range-picker .el-picker-panel__body{min-width:513px}.el-date-range-picker .el-picker-panel__content{margin:0}.el-date-range-picker__header{position:relative;text-align:center;height:28px}.el-date-range-picker__header [class*=arrow-left]{float:left}.el-date-range-picker__header [class*=arrow-right]{float:right}.el-date-range-picker__header div{font-size:16px;font-weight:500;margin-right:50px}.el-date-range-picker__content{float:left;width:50%;box-sizing:border-box;margin:0;padding:16px}.el-date-range-picker__content.is-left{border-right:1px solid var(--el-datepicker-inner-border-color)}.el-date-range-picker__content .el-date-range-picker__header div{margin-left:50px;margin-right:50px}.el-date-range-picker__editors-wrap{box-sizing:border-box;display:table-cell}.el-date-range-picker__editors-wrap.is-right{text-align:right}.el-date-range-picker__time-header{position:relative;border-bottom:1px solid var(--el-datepicker-inner-border-color);font-size:12px;padding:8px 5px 5px;display:table;width:100%;box-sizing:border-box}.el-date-range-picker__time-header>.el-icon-arrow-right{font-size:20px;vertical-align:middle;display:table-cell;color:var(--el-datepicker-icon-color)}.el-date-range-picker__time-picker-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-range-picker__time-picker-wrap .el-picker-panel{position:absolute;top:13px;right:0;z-index:1;background:#fff}.el-date-range-picker__time-picker-wrap .el-time-panel{position:absolute}.el-time-range-picker{width:354px;overflow:visible}.el-time-range-picker__content{position:relative;text-align:center;padding:10px;z-index:1}.el-time-range-picker__cell{box-sizing:border-box;margin:0;padding:4px 7px 7px;width:50%;display:inline-block}.el-time-range-picker__header{margin-bottom:5px;text-align:center;font-size:14px}.el-time-range-picker__body{border-radius:2px;border:1px solid var(--el-datepicker-border-color)}.el-time-panel{border-radius:2px;position:relative;width:180px;left:0;z-index:var(--el-index-top);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:content-box}.el-time-panel__content{font-size:0;position:relative;overflow:hidden}.el-time-panel__content:after,.el-time-panel__content:before{content:"";top:50%;position:absolute;margin-top:-16px;height:32px;z-index:-1;left:0;right:0;box-sizing:border-box;padding-top:6px;text-align:left}.el-time-panel__content:after{left:50%;margin-left:12%;margin-right:12%}.el-time-panel__content:before{padding-left:50%;margin-right:12%;margin-left:12%;border-top:1px solid var(--el-border-color-light);border-bottom:1px solid var(--el-border-color-light)}.el-time-panel__content.has-seconds:after{left:66.6666666667%}.el-time-panel__content.has-seconds:before{padding-left:33.3333333333%}.el-time-panel__footer{border-top:1px solid var(--el-timepicker-inner-border-color,var(--el-border-color-light));padding:4px;height:36px;line-height:25px;text-align:right;box-sizing:border-box}.el-time-panel__btn{border:none;line-height:28px;padding:0 5px;margin:0 5px;cursor:pointer;background-color:transparent;outline:0;font-size:12px;color:var(--el-text-color-primary)}.el-time-panel__btn.confirm{font-weight:800;color:var(--el-timepicker-active-color,var(--el-color-primary))}.el-descriptions{--el-descriptions-table-border:1px solid var(--el-border-color-lighter);--el-descriptions-item-bordered-label-background:var(--el-fill-color-light);box-sizing:border-box;font-size:var(--el-font-size-base);color:var(--el-text-color-primary)}.el-descriptions__header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.el-descriptions__title{color:var(--el-text-color-primary);font-size:16px;font-weight:700}.el-descriptions__body{background-color:var(--el-fill-color-blank)}.el-descriptions__body .el-descriptions__table{border-collapse:collapse;width:100%}.el-descriptions__body .el-descriptions__table .el-descriptions__cell{box-sizing:border-box;text-align:left;font-weight:400;line-height:23px;font-size:14px}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-left{text-align:left}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-center{text-align:center}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-right{text-align:right}.el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{border:var(--el-descriptions-table-border);padding:8px 11px}.el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:12px}.el-descriptions--large{font-size:14px}.el-descriptions--large .el-descriptions__header{margin-bottom:20px}.el-descriptions--large .el-descriptions__header .el-descriptions__title{font-size:16px}.el-descriptions--large .el-descriptions__body .el-descriptions__table .el-descriptions__cell{font-size:14px}.el-descriptions--large .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{padding:12px 15px}.el-descriptions--large .el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:16px}.el-descriptions--small{font-size:12px}.el-descriptions--small .el-descriptions__header{margin-bottom:12px}.el-descriptions--small .el-descriptions__header .el-descriptions__title{font-size:14px}.el-descriptions--small .el-descriptions__body .el-descriptions__table .el-descriptions__cell{font-size:12px}.el-descriptions--small .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{padding:4px 7px}.el-descriptions--small .el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:8px}.el-descriptions__label.el-descriptions__cell.is-bordered-label{font-weight:700;color:var(--el-text-color-regular);background:var(--el-descriptions-item-bordered-label-background)}.el-descriptions__label:not(.is-bordered-label){color:var(--el-text-color-primary);margin-right:16px}.el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:6px}.el-descriptions__content.el-descriptions__cell.is-bordered-content{color:var(--el-text-color-primary)}.el-descriptions__content:not(.is-bordered-label){color:var(--el-text-color-regular)}.el-descriptions--large .el-descriptions__label:not(.is-bordered-label){margin-right:16px}.el-descriptions--large .el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:8px}.el-descriptions--small .el-descriptions__label:not(.is-bordered-label){margin-right:12px}.el-descriptions--small .el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:4px}:root{--el-popup-modal-bg-color:var(--el-color-black);--el-popup-modal-opacity:.5}.v-modal-enter{-webkit-animation:v-modal-in var(--el-transition-duration-fast) ease;animation:v-modal-in var(--el-transition-duration-fast) ease}.v-modal-leave{-webkit-animation:v-modal-out var(--el-transition-duration-fast) ease forwards;animation:v-modal-out var(--el-transition-duration-fast) ease forwards}@-webkit-keyframes v-modal-in{0%{opacity:0}}@keyframes v-modal-in{0%{opacity:0}}@-webkit-keyframes v-modal-out{to{opacity:0}}@keyframes v-modal-out{to{opacity:0}}.v-modal{position:fixed;left:0;top:0;width:100%;height:100%;opacity:var(--el-popup-modal-opacity);background:var(--el-popup-modal-bg-color)}.el-popup-parent--hidden{overflow:hidden}.el-dialog{--el-dialog-width:50%;--el-dialog-margin-top:15vh;--el-dialog-bg-color:var(--el-bg-color);--el-dialog-box-shadow:var(--el-box-shadow);--el-dialog-title-font-size:var(--el-font-size-large);--el-dialog-content-font-size:14px;--el-dialog-font-line-height:var(--el-font-line-height-primary);--el-dialog-padding-primary:20px;--el-dialog-border-radius:var(--el-border-radius-small);position:relative;margin:var(--el-dialog-margin-top,15vh) auto 50px;background:var(--el-dialog-bg-color);border-radius:var(--el-dialog-border-radius);box-shadow:var(--el-dialog-box-shadow);box-sizing:border-box;width:var(--el-dialog-width,50%)}.el-dialog:focus{outline:0!important}.el-dialog.is-align-center{margin:auto}.el-dialog.is-fullscreen{--el-dialog-width:100%;--el-dialog-margin-top:0;margin-bottom:0;height:100%;overflow:auto}.el-dialog__wrapper{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto;margin:0}.el-dialog.is-draggable .el-dialog__header{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-dialog__header{padding:var(--el-dialog-padding-primary);padding-bottom:10px;margin-right:16px}.el-dialog__headerbtn{position:absolute;top:6px;right:0;padding:0;width:54px;height:54px;background:0 0;border:none;outline:0;cursor:pointer;font-size:var(--el-message-close-size,16px)}.el-dialog__headerbtn .el-dialog__close{color:var(--el-color-info);font-size:inherit}.el-dialog__headerbtn:focus .el-dialog__close,.el-dialog__headerbtn:hover .el-dialog__close{color:var(--el-color-primary)}.el-dialog__title{line-height:var(--el-dialog-font-line-height);font-size:var(--el-dialog-title-font-size);color:var(--el-text-color-primary)}.el-dialog__body{padding:calc(var(--el-dialog-padding-primary) + 10px) var(--el-dialog-padding-primary);color:var(--el-text-color-regular);font-size:var(--el-dialog-content-font-size)}.el-dialog__footer{padding:var(--el-dialog-padding-primary);padding-top:10px;text-align:right;box-sizing:border-box}.el-dialog--center{text-align:center}.el-dialog--center .el-dialog__body{text-align:initial;padding:25px calc(var(--el-dialog-padding-primary) + 5px) 30px}.el-dialog--center .el-dialog__footer{text-align:inherit}.el-overlay-dialog{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto}.dialog-fade-enter-active{-webkit-animation:modal-fade-in var(--el-transition-duration);animation:modal-fade-in var(--el-transition-duration)}.dialog-fade-enter-active .el-overlay-dialog{-webkit-animation:dialog-fade-in var(--el-transition-duration);animation:dialog-fade-in var(--el-transition-duration)}.dialog-fade-leave-active{-webkit-animation:modal-fade-out var(--el-transition-duration);animation:modal-fade-out var(--el-transition-duration)}.dialog-fade-leave-active .el-overlay-dialog{-webkit-animation:dialog-fade-out var(--el-transition-duration);animation:dialog-fade-out var(--el-transition-duration)}@-webkit-keyframes dialog-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes dialog-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes dialog-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes dialog-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@-webkit-keyframes modal-fade-in{0%{opacity:0}to{opacity:1}}@keyframes modal-fade-in{0%{opacity:0}to{opacity:1}}@-webkit-keyframes modal-fade-out{0%{opacity:1}to{opacity:0}}@keyframes modal-fade-out{0%{opacity:1}to{opacity:0}}.el-divider{position:relative}.el-divider--horizontal{display:block;height:1px;width:100%;margin:24px 0;border-top:1px var(--el-border-color) var(--el-border-style)}.el-divider--vertical{display:inline-block;width:1px;height:1em;margin:0 8px;vertical-align:middle;position:relative;border-left:1px var(--el-border-color) var(--el-border-style)}.el-divider__text{position:absolute;background-color:var(--el-bg-color);padding:0 20px;font-weight:500;color:var(--el-text-color-primary);font-size:14px}.el-divider__text.is-left{left:20px;transform:translateY(-50%)}.el-divider__text.is-center{left:50%;transform:translate(-50%) translateY(-50%)}.el-divider__text.is-right{right:20px;transform:translateY(-50%)}.el-drawer{--el-drawer-bg-color:var(--el-dialog-bg-color, var(--el-bg-color));--el-drawer-padding-primary:var(--el-dialog-padding-primary, 20px)}.el-drawer{position:absolute;box-sizing:border-box;background-color:var(--el-drawer-bg-color);display:flex;flex-direction:column;box-shadow:var(--el-box-shadow-dark);overflow:hidden;transition:all var(--el-transition-duration)}.el-drawer .rtl,.el-drawer .ltr,.el-drawer .ttb,.el-drawer .btt{transform:translate(0)}.el-drawer__sr-focus:focus{outline:0!important}.el-drawer__header{align-items:center;color:#72767b;display:flex;margin-bottom:32px;padding:var(--el-drawer-padding-primary);padding-bottom:0}.el-drawer__header>:first-child{flex:1}.el-drawer__title{margin:0;flex:1;line-height:inherit;font-size:1rem}.el-drawer__footer{padding:var(--el-drawer-padding-primary);padding-top:10px;text-align:right}.el-drawer__close-btn{display:inline-flex;border:none;cursor:pointer;font-size:var(--el-font-size-extra-large);color:inherit;background-color:transparent;outline:0}.el-drawer__close-btn:focus i,.el-drawer__close-btn:hover i{color:var(--el-color-primary)}.el-drawer__body{flex:1;padding:var(--el-drawer-padding-primary);overflow:auto}.el-drawer__body>*{box-sizing:border-box}.el-drawer.ltr,.el-drawer.rtl{height:100%;top:0;bottom:0}.el-drawer.btt,.el-drawer.ttb{width:100%;left:0;right:0}.el-drawer.ltr{left:0}.el-drawer.rtl{right:0}.el-drawer.ttb{top:0}.el-drawer.btt{bottom:0}.el-drawer-fade-enter-active,.el-drawer-fade-leave-active{transition:all var(--el-transition-duration)}.el-drawer-fade-enter-active,.el-drawer-fade-enter-from,.el-drawer-fade-enter-to,.el-drawer-fade-leave-active,.el-drawer-fade-leave-from,.el-drawer-fade-leave-to{overflow:hidden!important}.el-drawer-fade-enter-from,.el-drawer-fade-leave-to{opacity:0}.el-drawer-fade-enter-to,.el-drawer-fade-leave-from{opacity:1}.el-drawer-fade-enter-from .rtl,.el-drawer-fade-leave-to .rtl{transform:translate(100%)}.el-drawer-fade-enter-from .ltr,.el-drawer-fade-leave-to .ltr{transform:translate(-100%)}.el-drawer-fade-enter-from .ttb,.el-drawer-fade-leave-to .ttb{transform:translateY(-100%)}.el-drawer-fade-enter-from .btt,.el-drawer-fade-leave-to .btt{transform:translateY(100%)}.el-dropdown{--el-dropdown-menu-box-shadow:var(--el-box-shadow-light);--el-dropdown-menuItem-hover-fill:var(--el-color-primary-light-9);--el-dropdown-menuItem-hover-color:var(--el-color-primary);--el-dropdown-menu-index:10;display:inline-flex;position:relative;color:var(--el-text-color-regular);font-size:var(--el-font-size-base);line-height:1;vertical-align:top}.el-dropdown.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-dropdown__popper{--el-dropdown-menu-box-shadow:var(--el-box-shadow-light);--el-dropdown-menuItem-hover-fill:var(--el-color-primary-light-9);--el-dropdown-menuItem-hover-color:var(--el-color-primary);--el-dropdown-menu-index:10}.el-dropdown__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-dropdown-menu-box-shadow)}.el-dropdown__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-dropdown__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-dropdown__popper .el-dropdown-menu{border:none}.el-dropdown__popper .el-dropdown__popper-selfdefine{outline:0}.el-dropdown__popper .el-scrollbar__bar{z-index:calc(var(--el-dropdown-menu-index) + 1)}.el-dropdown__popper .el-dropdown__list{list-style:none;padding:0;margin:0;box-sizing:border-box}.el-dropdown .el-dropdown__caret-button{padding-left:0;padding-right:0;display:inline-flex;justify-content:center;align-items:center;width:32px;border-left:none}.el-dropdown .el-dropdown__caret-button>span{display:inline-flex}.el-dropdown .el-dropdown__caret-button:before{content:"";position:absolute;display:block;width:1px;top:-1px;bottom:-1px;left:0;background:var(--el-overlay-color-lighter)}.el-dropdown .el-dropdown__caret-button.el-button:before{background:var(--el-border-color);opacity:.5}.el-dropdown .el-dropdown__caret-button .el-dropdown__icon{font-size:inherit;padding-left:0}.el-dropdown .el-dropdown-selfdefine{outline:0}.el-dropdown--large .el-dropdown__caret-button{width:40px}.el-dropdown--small .el-dropdown__caret-button{width:24px}.el-dropdown-menu{position:relative;top:0;left:0;z-index:var(--el-dropdown-menu-index);padding:5px 0;margin:0;background-color:var(--el-bg-color-overlay);border:none;border-radius:var(--el-border-radius-base);box-shadow:none;list-style:none}.el-dropdown-menu__item{display:flex;align-items:center;white-space:nowrap;list-style:none;line-height:22px;padding:5px 16px;margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);cursor:pointer;outline:0}.el-dropdown-menu__item:not(.is-disabled):focus{background-color:var(--el-dropdown-menuItem-hover-fill);color:var(--el-dropdown-menuItem-hover-color)}.el-dropdown-menu__item i{margin-right:5px}.el-dropdown-menu__item--divided{margin:6px 0;border-top:1px solid var(--el-border-color-lighter)}.el-dropdown-menu__item.is-disabled{cursor:not-allowed;color:var(--el-text-color-disabled)}.el-dropdown-menu--large{padding:7px 0}.el-dropdown-menu--large .el-dropdown-menu__item{padding:7px 20px;line-height:22px;font-size:14px}.el-dropdown-menu--large .el-dropdown-menu__item--divided{margin:8px 0}.el-dropdown-menu--small{padding:3px 0}.el-dropdown-menu--small .el-dropdown-menu__item{padding:2px 12px;line-height:20px;font-size:12px}.el-dropdown-menu--small .el-dropdown-menu__item--divided{margin:4px 0}.el-empty{--el-empty-padding:40px 0;--el-empty-image-width:160px;--el-empty-description-margin-top:20px;--el-empty-bottom-margin-top:20px;--el-empty-fill-color-0:var(--el-color-white);--el-empty-fill-color-1:#fcfcfd;--el-empty-fill-color-2:#f8f9fb;--el-empty-fill-color-3:#f7f8fc;--el-empty-fill-color-4:#eeeff3;--el-empty-fill-color-5:#edeef2;--el-empty-fill-color-6:#e9ebef;--el-empty-fill-color-7:#e5e7e9;--el-empty-fill-color-8:#e0e3e9;--el-empty-fill-color-9:#d5d7de;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:var(--el-empty-padding)}.el-empty__image{width:var(--el-empty-image-width)}.el-empty__image img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;height:100%;vertical-align:top;-o-object-fit:contain;object-fit:contain}.el-empty__image svg{color:var(--el-svg-monochrome-grey);fill:currentColor;width:100%;height:100%;vertical-align:top}.el-empty__description{margin-top:var(--el-empty-description-margin-top)}.el-empty__description p{margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-secondary)}.el-empty__bottom{margin-top:var(--el-empty-bottom-margin-top)}.el-footer{--el-footer-padding:0 20px;--el-footer-height:60px;padding:var(--el-footer-padding);box-sizing:border-box;flex-shrink:0;height:var(--el-footer-height)}.el-form{--el-form-label-font-size:var(--el-font-size-base)}.el-form--label-left .el-form-item__label{justify-content:flex-start}.el-form--label-top .el-form-item{display:block}.el-form--label-top .el-form-item .el-form-item__label{display:block;height:auto;text-align:left;margin-bottom:8px;line-height:22px}.el-form--inline .el-form-item{display:inline-flex;vertical-align:middle;margin-right:32px}.el-form--inline.el-form--label-top{display:flex;flex-wrap:wrap}.el-form--inline.el-form--label-top .el-form-item{display:block}.el-form--large.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:12px;line-height:22px}.el-form--default.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:8px;line-height:22px}.el-form--small.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:4px;line-height:20px}.el-form-item{display:flex;--font-size:14px;margin-bottom:18px}.el-form-item .el-form-item{margin-bottom:0}.el-form-item .el-input__validateIcon{display:none}.el-form-item--large{--font-size:14px;--el-form-label-font-size:var(--font-size);margin-bottom:22px}.el-form-item--large .el-form-item__label{height:40px;line-height:40px}.el-form-item--large .el-form-item__content{line-height:40px}.el-form-item--large .el-form-item__error{padding-top:4px}.el-form-item--default{--font-size:14px;--el-form-label-font-size:var(--font-size);margin-bottom:18px}.el-form-item--default .el-form-item__label{height:32px;line-height:32px}.el-form-item--default .el-form-item__content{line-height:32px}.el-form-item--default .el-form-item__error{padding-top:2px}.el-form-item--small{--font-size:12px;--el-form-label-font-size:var(--font-size);margin-bottom:18px}.el-form-item--small .el-form-item__label{height:24px;line-height:24px}.el-form-item--small .el-form-item__content{line-height:24px}.el-form-item--small .el-form-item__error{padding-top:2px}.el-form-item__label-wrap{display:flex}.el-form-item__label{display:inline-flex;justify-content:flex-end;align-items:flex-start;flex:0 0 auto;font-size:var(--el-form-label-font-size);color:var(--el-text-color-regular);height:32px;line-height:32px;padding:0 12px 0 0;box-sizing:border-box}.el-form-item__content{display:flex;flex-wrap:wrap;align-items:center;flex:1;line-height:32px;position:relative;font-size:var(--font-size);min-width:0}.el-form-item__content .el-input-group{vertical-align:top}.el-form-item__error{color:var(--el-color-danger);font-size:12px;line-height:1;padding-top:2px;position:absolute;top:100%;left:0}.el-form-item__error--inline{position:relative;top:auto;left:auto;display:inline-block;margin-left:10px}.el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label-wrap>.el-form-item__label:before,.el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label:before{content:"*";color:var(--el-color-danger);margin-right:4px}.el-form-item.is-required:not(.is-no-asterisk).asterisk-right>.el-form-item__label-wrap>.el-form-item__label:after,.el-form-item.is-required:not(.is-no-asterisk).asterisk-right>.el-form-item__label:after{content:"*";color:var(--el-color-danger);margin-left:4px}.el-form-item.is-error .el-select-v2__wrapper,.el-form-item.is-error .el-select-v2__wrapper:focus,.el-form-item.is-error .el-textarea__inner,.el-form-item.is-error .el-textarea__inner:focus{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-form-item.is-error .el-input__wrapper{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-form-item.is-error .el-input-group__append .el-input__wrapper,.el-form-item.is-error .el-input-group__prepend .el-input__wrapper{box-shadow:0 0 0 1px transparent inset}.el-form-item.is-error .el-input__validateIcon{color:var(--el-color-danger)}.el-form-item--feedback .el-input__validateIcon{display:inline-flex}.el-header{--el-header-padding:0 20px;--el-header-height:60px;padding:var(--el-header-padding);box-sizing:border-box;flex-shrink:0;height:var(--el-header-height)}.el-image-viewer__wrapper{position:fixed;top:0;right:0;bottom:0;left:0}.el-image-viewer__btn{position:absolute;z-index:1;display:flex;align-items:center;justify-content:center;border-radius:50%;opacity:.8;cursor:pointer;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__btn .el-icon{font-size:inherit;cursor:pointer}.el-image-viewer__close{top:40px;right:40px;width:40px;height:40px;font-size:40px}.el-image-viewer__canvas{position:static;width:100%;height:100%;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__actions{left:50%;bottom:30px;transform:translate(-50%);width:282px;height:44px;padding:0 23px;background-color:var(--el-text-color-regular);border-color:#fff;border-radius:22px}.el-image-viewer__actions__inner{width:100%;height:100%;text-align:justify;cursor:default;font-size:23px;color:#fff;display:flex;align-items:center;justify-content:space-around}.el-image-viewer__prev{top:50%;transform:translateY(-50%);left:40px;width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__next{top:50%;transform:translateY(-50%);right:40px;text-indent:2px;width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__close{width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__mask{position:absolute;width:100%;height:100%;top:0;left:0;opacity:.5;background:#000}.viewer-fade-enter-active{-webkit-animation:viewer-fade-in var(--el-transition-duration);animation:viewer-fade-in var(--el-transition-duration)}.viewer-fade-leave-active{-webkit-animation:viewer-fade-out var(--el-transition-duration);animation:viewer-fade-out var(--el-transition-duration)}@-webkit-keyframes viewer-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes viewer-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes viewer-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes viewer-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}.el-image__error,.el-image__inner,.el-image__placeholder,.el-image__wrapper{width:100%;height:100%}.el-image{position:relative;display:inline-block;overflow:hidden}.el-image__inner{vertical-align:top;opacity:1}.el-image__inner.is-loading{opacity:0}.el-image__wrapper{position:absolute;top:0;left:0}.el-image__placeholder{background:var(--el-fill-color-light)}.el-image__error{display:flex;justify-content:center;align-items:center;font-size:14px;background:var(--el-fill-color-light);color:var(--el-text-color-placeholder);vertical-align:middle}.el-image__preview{cursor:pointer}.el-input-number{position:relative;display:inline-flex;width:150px;line-height:30px}.el-input-number .el-input__wrapper{padding-left:42px;padding-right:42px}.el-input-number .el-input__inner{-webkit-appearance:none;-moz-appearance:textfield;text-align:center;line-height:1}.el-input-number .el-input__inner::-webkit-inner-spin-button,.el-input-number .el-input__inner::-webkit-outer-spin-button{margin:0;-webkit-appearance:none}.el-input-number__decrease,.el-input-number__increase{display:flex;justify-content:center;align-items:center;height:auto;position:absolute;z-index:1;top:1px;bottom:1px;width:32px;background:var(--el-fill-color-light);color:var(--el-text-color-regular);cursor:pointer;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-input-number__decrease:hover,.el-input-number__increase:hover{color:var(--el-color-primary)}.el-input-number__decrease:hover~.el-input:not(.is-disabled) .el-input_wrapper,.el-input-number__increase:hover~.el-input:not(.is-disabled) .el-input_wrapper{box-shadow:0 0 0 1px var(--el-input-focus-border-color,var(--el-color-primary)) inset}.el-input-number__decrease.is-disabled,.el-input-number__increase.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-input-number__increase{right:1px;border-radius:0 var(--el-border-radius-base) var(--el-border-radius-base) 0;border-left:var(--el-border)}.el-input-number__decrease{left:1px;border-radius:var(--el-border-radius-base) 0 0 var(--el-border-radius-base);border-right:var(--el-border)}.el-input-number.is-disabled .el-input-number__decrease,.el-input-number.is-disabled .el-input-number__increase{border-color:var(--el-disabled-border-color);color:var(--el-disabled-border-color)}.el-input-number.is-disabled .el-input-number__decrease:hover,.el-input-number.is-disabled .el-input-number__increase:hover{color:var(--el-disabled-border-color);cursor:not-allowed}.el-input-number--large{width:180px;line-height:38px}.el-input-number--large .el-input-number__decrease,.el-input-number--large .el-input-number__increase{width:40px;font-size:14px}.el-input-number--large .el-input__wrapper{padding-left:47px;padding-right:47px}.el-input-number--small{width:120px;line-height:22px}.el-input-number--small .el-input-number__decrease,.el-input-number--small .el-input-number__increase{width:24px;font-size:12px}.el-input-number--small .el-input__wrapper{padding-left:31px;padding-right:31px}.el-input-number--small .el-input-number__decrease [class*=el-icon],.el-input-number--small .el-input-number__increase [class*=el-icon]{transform:scale(.9)}.el-input-number.is-without-controls .el-input__wrapper{padding-left:15px;padding-right:15px}.el-input-number.is-controls-right .el-input__wrapper{padding-left:15px;padding-right:42px}.el-input-number.is-controls-right .el-input-number__decrease,.el-input-number.is-controls-right .el-input-number__increase{--el-input-number-controls-height:15px;height:var(--el-input-number-controls-height);line-height:var(--el-input-number-controls-height)}.el-input-number.is-controls-right .el-input-number__decrease [class*=el-icon],.el-input-number.is-controls-right .el-input-number__increase [class*=el-icon]{transform:scale(.8)}.el-input-number.is-controls-right .el-input-number__increase{bottom:auto;left:auto;border-radius:0 var(--el-border-radius-base) 0 0;border-bottom:var(--el-border)}.el-input-number.is-controls-right .el-input-number__decrease{right:1px;top:auto;left:auto;border-right:none;border-left:var(--el-border);border-radius:0 0 var(--el-border-radius-base) 0}.el-input-number.is-controls-right[class*=large] [class*=decrease],.el-input-number.is-controls-right[class*=large] [class*=increase]{--el-input-number-controls-height:19px}.el-input-number.is-controls-right[class*=small] [class*=decrease],.el-input-number.is-controls-right[class*=small] [class*=increase]{--el-input-number-controls-height:11px}.el-textarea{--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary)}.el-textarea{position:relative;display:inline-block;width:100%;vertical-align:bottom;font-size:var(--el-font-size-base)}.el-textarea__inner{position:relative;display:block;resize:vertical;padding:5px 11px;line-height:1.5;box-sizing:border-box;width:100%;font-size:inherit;font-family:inherit;color:var(--el-input-text-color,var(--el-text-color-regular));background-color:var(--el-input-bg-color,var(--el-fill-color-blank));background-image:none;-webkit-appearance:none;box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset;border-radius:var(--el-input-border-radius,var(--el-border-radius-base));transition:var(--el-transition-box-shadow);border:none}.el-textarea__inner::-moz-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner:-ms-input-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner::placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-textarea__inner:focus{outline:0;box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-textarea .el-input__count{color:var(--el-color-info);background:var(--el-fill-color-blank);position:absolute;font-size:12px;line-height:14px;bottom:5px;right:10px}.el-textarea.is-disabled .el-textarea__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-textarea.is-disabled .el-textarea__inner::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-disabled .el-textarea__inner:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-disabled .el-textarea__inner::placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-exceed .el-textarea__inner{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-textarea.is-exceed .el-input__count{color:var(--el-color-danger)}.el-input{--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary)}.el-input{--el-input-height:var(--el-component-size);position:relative;font-size:var(--el-font-size-base);display:inline-flex;width:100%;line-height:var(--el-input-height);box-sizing:border-box;vertical-align:middle}.el-input::-webkit-scrollbar{z-index:11;width:6px}.el-input::-webkit-scrollbar:horizontal{height:6px}.el-input::-webkit-scrollbar-thumb{border-radius:5px;width:6px;background:var(--el-text-color-disabled)}.el-input::-webkit-scrollbar-corner{background:var(--el-fill-color-blank)}.el-input::-webkit-scrollbar-track{background:var(--el-fill-color-blank)}.el-input::-webkit-scrollbar-track-piece{background:var(--el-fill-color-blank);width:6px}.el-input .el-input__clear,.el-input .el-input__password{color:var(--el-input-icon-color);font-size:14px;cursor:pointer}.el-input .el-input__clear:hover,.el-input .el-input__password:hover{color:var(--el-input-clear-hover-color)}.el-input .el-input__count{height:100%;display:inline-flex;align-items:center;color:var(--el-color-info);font-size:12px}.el-input .el-input__count .el-input__count-inner{background:var(--el-fill-color-blank);line-height:initial;display:inline-block;padding-left:8px}.el-input__wrapper{display:inline-flex;flex-grow:1;align-items:center;justify-content:center;padding:1px 11px;background-color:var(--el-input-bg-color,var(--el-fill-color-blank));background-image:none;border-radius:var(--el-input-border-radius,var(--el-border-radius-base));transition:var(--el-transition-box-shadow);transform:translateZ(0);box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset}.el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 32px) - 2px);width:100%;flex-grow:1;-webkit-appearance:none;color:var(--el-input-text-color,var(--el-text-color-regular));font-size:inherit;height:var(--el-input-inner-height);line-height:var(--el-input-inner-height);padding:0;outline:0;border:none;background:0 0;box-sizing:border-box}.el-input__inner:focus{outline:0}.el-input__inner::-moz-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner:-ms-input-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner::placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner[type=password]::-ms-reveal{display:none}.el-input__prefix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--el-input-icon-color,var(--el-text-color-placeholder));transition:all var(--el-transition-duration);pointer-events:none}.el-input__prefix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}.el-input__prefix-inner>:last-child{margin-right:8px}.el-input__prefix-inner>:first-child,.el-input__prefix-inner>:first-child.el-input__icon{margin-left:0}.el-input__suffix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--el-input-icon-color,var(--el-text-color-placeholder));transition:all var(--el-transition-duration);pointer-events:none}.el-input__suffix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}.el-input__suffix-inner>:first-child{margin-left:8px}.el-input .el-input__icon{height:inherit;line-height:inherit;display:flex;justify-content:center;align-items:center;transition:all var(--el-transition-duration);margin-left:8px}.el-input__validateIcon{pointer-events:none}.el-input.is-active .el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-focus-color,) inset}.el-input.is-disabled{cursor:not-allowed}.el-input.is-disabled .el-input__wrapper{background-color:var(--el-disabled-bg-color);box-shadow:0 0 0 1px var(--el-disabled-border-color) inset}.el-input.is-disabled .el-input__inner{color:var(--el-disabled-text-color);-webkit-text-fill-color:var(--el-disabled-text-color);cursor:not-allowed}.el-input.is-disabled .el-input__inner::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__inner:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__inner::placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__icon{cursor:not-allowed}.el-input.is-exceed .el-input__wrapper{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-input.is-exceed .el-input__suffix .el-input__count{color:var(--el-color-danger)}.el-input--large{--el-input-height:var(--el-component-size-large);font-size:14px}.el-input--large .el-input__wrapper{padding:1px 15px}.el-input--large .el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 40px) - 2px)}.el-input--small{--el-input-height:var(--el-component-size-small);font-size:12px}.el-input--small .el-input__wrapper{padding:1px 7px}.el-input--small .el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 24px) - 2px)}.el-input-group{display:inline-flex;width:100%;align-items:stretch}.el-input-group__append,.el-input-group__prepend{background-color:var(--el-fill-color-light);color:var(--el-color-info);position:relative;display:inline-flex;align-items:center;justify-content:center;min-height:100%;border-radius:var(--el-input-border-radius);padding:0 20px;white-space:nowrap}.el-input-group__append:focus,.el-input-group__prepend:focus{outline:0}.el-input-group__append .el-button,.el-input-group__append .el-select,.el-input-group__prepend .el-button,.el-input-group__prepend .el-select{display:inline-block;margin:0 -20px}.el-input-group__append button.el-button,.el-input-group__append button.el-button:hover,.el-input-group__append div.el-select .el-input__wrapper,.el-input-group__append div.el-select:hover .el-input__wrapper,.el-input-group__prepend button.el-button,.el-input-group__prepend button.el-button:hover,.el-input-group__prepend div.el-select .el-input__wrapper,.el-input-group__prepend div.el-select:hover .el-input__wrapper{border-color:transparent;background-color:transparent;color:inherit}.el-input-group__append .el-button,.el-input-group__append .el-input,.el-input-group__prepend .el-button,.el-input-group__prepend .el-input{font-size:inherit}.el-input-group__prepend{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 0 var(--el-input-border-color) inset,0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset}.el-input-group__append{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset,-1px 0 0 0 var(--el-input-border-color) inset}.el-input-group--prepend>.el-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0}.el-input-group--prepend .el-input-group__prepend .el-select .el-input .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select .el-input .el-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 0 var(--el-input-border-color) inset,0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__wrapper{box-shadow:1px 0 0 0 var(--el-input-focus-border-color) inset,1px 0 0 0 var(--el-input-focus-border-color),0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important;z-index:2}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__wrapper:focus{outline:0;z-index:2;box-shadow:1px 0 0 0 var(--el-input-focus-border-color) inset,1px 0 0 0 var(--el-input-focus-border-color),0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important}.el-input-group--prepend .el-input-group__prepend .el-select:hover .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select:hover .el-input__wrapper{z-index:1;box-shadow:1px 0 0 0 var(--el-input-hover-border-color) inset,1px 0 0 0 var(--el-input-hover-border-color),0 1px 0 0 var(--el-input-hover-border-color) inset,0 -1px 0 0 var(--el-input-hover-border-color) inset!important}.el-input-group--append>.el-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0}.el-input-group--append .el-input-group__append .el-select .el-input .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select .el-input .el-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset,-1px 0 0 0 var(--el-input-border-color) inset}.el-input-group--append .el-input-group__append .el-select .el-input.is-focus .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select .el-input.is-focus .el-input__wrapper{z-index:2;box-shadow:-1px 0 0 0 var(--el-input-focus-border-color),-1px 0 0 0 var(--el-input-focus-border-color) inset,0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important}.el-input-group--append .el-input-group__append .el-select:hover .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select:hover .el-input__wrapper{z-index:1;box-shadow:-1px 0 0 0 var(--el-input-hover-border-color),-1px 0 0 0 var(--el-input-hover-border-color) inset,0 1px 0 0 var(--el-input-hover-border-color) inset,0 -1px 0 0 var(--el-input-hover-border-color) inset!important}.el-link{--el-link-font-size:var(--el-font-size-base);--el-link-font-weight:var(--el-font-weight-primary);--el-link-text-color:var(--el-text-color-regular);--el-link-hover-text-color:var(--el-color-primary);--el-link-disabled-text-color:var(--el-text-color-placeholder)}.el-link{display:inline-flex;flex-direction:row;align-items:center;justify-content:center;vertical-align:middle;position:relative;text-decoration:none;outline:0;cursor:pointer;padding:0;font-size:var(--el-link-font-size);font-weight:var(--el-link-font-weight);color:var(--el-link-text-color)}.el-link:hover{color:var(--el-link-hover-text-color)}.el-link.is-underline:hover:after{content:"";position:absolute;left:0;right:0;height:0;bottom:0;border-bottom:1px solid var(--el-link-hover-text-color)}.el-link.is-disabled{color:var(--el-link-disabled-text-color);cursor:not-allowed}.el-link [class*=el-icon-]+span{margin-left:5px}.el-link.el-link--default:after{border-color:var(--el-link-hover-text-color)}.el-link__inner{display:inline-flex;justify-content:center;align-items:center}.el-link.el-link--primary{--el-link-text-color:var(--el-color-primary);--el-link-hover-text-color:var(--el-color-primary-light-3);--el-link-disabled-text-color:var(--el-color-primary-light-5)}.el-link.el-link--primary:after{border-color:var(--el-link-text-color)}.el-link.el-link--primary.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--success{--el-link-text-color:var(--el-color-success);--el-link-hover-text-color:var(--el-color-success-light-3);--el-link-disabled-text-color:var(--el-color-success-light-5)}.el-link.el-link--success:after{border-color:var(--el-link-text-color)}.el-link.el-link--success.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--warning{--el-link-text-color:var(--el-color-warning);--el-link-hover-text-color:var(--el-color-warning-light-3);--el-link-disabled-text-color:var(--el-color-warning-light-5)}.el-link.el-link--warning:after{border-color:var(--el-link-text-color)}.el-link.el-link--warning.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--danger{--el-link-text-color:var(--el-color-danger);--el-link-hover-text-color:var(--el-color-danger-light-3);--el-link-disabled-text-color:var(--el-color-danger-light-5)}.el-link.el-link--danger:after{border-color:var(--el-link-text-color)}.el-link.el-link--danger.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--error{--el-link-text-color:var(--el-color-error);--el-link-hover-text-color:var(--el-color-error-light-3);--el-link-disabled-text-color:var(--el-color-error-light-5)}.el-link.el-link--error:after{border-color:var(--el-link-text-color)}.el-link.el-link--error.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--info{--el-link-text-color:var(--el-color-info);--el-link-hover-text-color:var(--el-color-info-light-3);--el-link-disabled-text-color:var(--el-color-info-light-5)}.el-link.el-link--info:after{border-color:var(--el-link-text-color)}.el-link.el-link--info.is-underline:hover:after{border-color:var(--el-link-text-color)}:root{--el-loading-spinner-size:42px;--el-loading-fullscreen-spinner-size:50px}.el-loading-parent--relative{position:relative!important}.el-loading-parent--hidden{overflow:hidden!important}.el-loading-mask{position:absolute;z-index:2000;background-color:var(--el-mask-color);margin:0;top:0;right:0;bottom:0;left:0;transition:opacity var(--el-transition-duration)}.el-loading-mask.is-fullscreen{position:fixed}.el-loading-mask.is-fullscreen .el-loading-spinner{margin-top:calc((0px - var(--el-loading-fullscreen-spinner-size))/ 2)}.el-loading-mask.is-fullscreen .el-loading-spinner .circular{height:var(--el-loading-fullscreen-spinner-size);width:var(--el-loading-fullscreen-spinner-size)}.el-loading-spinner{top:50%;margin-top:calc((0px - var(--el-loading-spinner-size))/ 2);width:100%;text-align:center;position:absolute}.el-loading-spinner .el-loading-text{color:var(--el-color-primary);margin:3px 0;font-size:14px}.el-loading-spinner .circular{display:inline;height:var(--el-loading-spinner-size);width:var(--el-loading-spinner-size);-webkit-animation:loading-rotate 2s linear infinite;animation:loading-rotate 2s linear infinite}.el-loading-spinner .path{-webkit-animation:loading-dash 1.5s ease-in-out infinite;animation:loading-dash 1.5s ease-in-out infinite;stroke-dasharray:90,150;stroke-dashoffset:0;stroke-width:2;stroke:var(--el-color-primary);stroke-linecap:round}.el-loading-spinner i{color:var(--el-color-primary)}.el-loading-fade-enter-from,.el-loading-fade-leave-to{opacity:0}@-webkit-keyframes loading-rotate{to{transform:rotate(360deg)}}@keyframes loading-rotate{to{transform:rotate(360deg)}}@-webkit-keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}@keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}.el-main{--el-main-padding:20px;display:block;flex:1;flex-basis:auto;overflow:auto;box-sizing:border-box;padding:var(--el-main-padding)}:root{--el-menu-active-color:var(--el-color-primary);--el-menu-text-color:var(--el-text-color-primary);--el-menu-hover-text-color:var(--el-color-primary);--el-menu-bg-color:var(--el-fill-color-blank);--el-menu-hover-bg-color:var(--el-color-primary-light-9);--el-menu-item-height:56px;--el-menu-sub-item-height:calc(var(--el-menu-item-height) - 6px);--el-menu-horizontal-sub-item-height:36px;--el-menu-item-font-size:var(--el-font-size-base);--el-menu-item-hover-fill:var(--el-color-primary-light-9);--el-menu-border-color:var(--el-border-color);--el-menu-base-level-padding:20px;--el-menu-level-padding:20px;--el-menu-icon-width:24px}.el-menu{border-right:solid 1px var(--el-menu-border-color);list-style:none;position:relative;margin:0;padding-left:0;background-color:var(--el-menu-bg-color);box-sizing:border-box}.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-menu-item,.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-menu-item-group__title,.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-sub-menu__title{white-space:nowrap;padding-left:calc(var(--el-menu-base-level-padding) + var(--el-menu-level) * var(--el-menu-level-padding))}.el-menu--horizontal{display:flex;flex-wrap:nowrap;border-bottom:solid 1px var(--el-menu-border-color);border-right:none}.el-menu--horizontal>.el-menu-item{display:inline-flex;justify-content:center;align-items:center;height:100%;margin:0;border-bottom:2px solid transparent;color:var(--el-menu-text-color)}.el-menu--horizontal>.el-menu-item a,.el-menu--horizontal>.el-menu-item a:hover{color:inherit}.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus,.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover{background-color:#fff}.el-menu--horizontal>.el-sub-menu:focus,.el-menu--horizontal>.el-sub-menu:hover{outline:0}.el-menu--horizontal>.el-sub-menu:hover .el-sub-menu__title{color:var(--el-menu-hover-text-color)}.el-menu--horizontal>.el-sub-menu.is-active .el-sub-menu__title{border-bottom:2px solid var(--el-menu-active-color);color:var(--el-menu-active-color)}.el-menu--horizontal>.el-sub-menu .el-sub-menu__title{height:100%;border-bottom:2px solid transparent;color:var(--el-menu-text-color)}.el-menu--horizontal>.el-sub-menu .el-sub-menu__title:hover{background-color:var(--el-bg-color-overlay)}.el-menu--horizontal .el-menu .el-menu-item,.el-menu--horizontal .el-menu .el-sub-menu__title{background-color:var(--el-menu-bg-color);display:flex;align-items:center;height:var(--el-menu-horizontal-sub-item-height);line-height:var(--el-menu-horizontal-sub-item-height);padding:0 10px;color:var(--el-menu-text-color)}.el-menu--horizontal .el-menu .el-sub-menu__title{padding-right:40px}.el-menu--horizontal .el-menu .el-menu-item.is-active,.el-menu--horizontal .el-menu .el-sub-menu.is-active>.el-sub-menu__title{color:var(--el-menu-active-color)}.el-menu--horizontal .el-menu-item:not(.is-disabled):focus,.el-menu--horizontal .el-menu-item:not(.is-disabled):hover{outline:0;color:var(--el-menu-hover-text-color);background-color:var(--el-menu-hover-bg-color)}.el-menu--horizontal>.el-menu-item.is-active{border-bottom:2px solid var(--el-menu-active-color);color:var(--el-menu-active-color)!important}.el-menu--collapse{width:calc(var(--el-menu-icon-width) + var(--el-menu-base-level-padding) * 2)}.el-menu--collapse>.el-menu-item [class^=el-icon],.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title [class^=el-icon],.el-menu--collapse>.el-sub-menu>.el-sub-menu__title [class^=el-icon]{margin:0;vertical-align:middle;width:var(--el-menu-icon-width);text-align:center}.el-menu--collapse>.el-menu-item .el-sub-menu__icon-arrow,.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow,.el-menu--collapse>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow{display:none}.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title>span,.el-menu--collapse>.el-menu-item>span,.el-menu--collapse>.el-sub-menu>.el-sub-menu__title>span{height:0;width:0;overflow:hidden;visibility:hidden;display:inline-block}.el-menu--collapse>.el-menu-item.is-active i{color:inherit}.el-menu--collapse .el-menu .el-sub-menu{min-width:200px}.el-menu--popup{z-index:100;min-width:200px;border:none;padding:5px 0;border-radius:var(--el-border-radius-small);box-shadow:var(--el-box-shadow-light)}.el-menu .el-icon{flex-shrink:0}.el-menu-item{display:flex;align-items:center;height:var(--el-menu-item-height);line-height:var(--el-menu-item-height);font-size:var(--el-menu-item-font-size);color:var(--el-menu-text-color);padding:0 var(--el-menu-base-level-padding);list-style:none;cursor:pointer;position:relative;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration),color var(--el-transition-duration);box-sizing:border-box;white-space:nowrap}.el-menu-item *{vertical-align:bottom}.el-menu-item i{color:inherit}.el-menu-item:focus,.el-menu-item:hover{outline:0}.el-menu-item:hover{background-color:var(--el-menu-hover-bg-color)}.el-menu-item.is-disabled{opacity:.25;cursor:not-allowed;background:0 0!important}.el-menu-item [class^=el-icon]{margin-right:5px;width:var(--el-menu-icon-width);text-align:center;font-size:18px;vertical-align:middle}.el-menu-item.is-active{color:var(--el-menu-active-color)}.el-menu-item.is-active i{color:inherit}.el-menu-item .el-menu-tooltip__trigger{position:absolute;left:0;top:0;height:100%;width:100%;display:inline-flex;align-items:center;box-sizing:border-box;padding:0 var(--el-menu-base-level-padding)}.el-sub-menu{list-style:none;margin:0;padding-left:0}.el-sub-menu__title{display:flex;align-items:center;height:var(--el-menu-item-height);line-height:var(--el-menu-item-height);font-size:var(--el-menu-item-font-size);color:var(--el-menu-text-color);padding:0 var(--el-menu-base-level-padding);list-style:none;cursor:pointer;position:relative;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration),color var(--el-transition-duration);box-sizing:border-box;white-space:nowrap;padding-right:calc(var(--el-menu-base-level-padding) + var(--el-menu-icon-width))}.el-sub-menu__title *{vertical-align:bottom}.el-sub-menu__title i{color:inherit}.el-sub-menu__title:focus,.el-sub-menu__title:hover{outline:0}.el-sub-menu__title.is-disabled{opacity:.25;cursor:not-allowed;background:0 0!important}.el-sub-menu__title:hover{background-color:var(--el-menu-hover-bg-color)}.el-sub-menu .el-menu{border:none}.el-sub-menu .el-menu-item{height:var(--el-menu-sub-item-height);line-height:var(--el-menu-sub-item-height)}.el-sub-menu__hide-arrow .el-sub-menu__icon-arrow{display:none!important}.el-sub-menu.is-active .el-sub-menu__title{border-bottom-color:var(--el-menu-active-color)}.el-sub-menu.is-disabled .el-menu-item,.el-sub-menu.is-disabled .el-sub-menu__title{opacity:.25;cursor:not-allowed;background:0 0!important}.el-sub-menu .el-icon{vertical-align:middle;margin-right:5px;width:var(--el-menu-icon-width);text-align:center;font-size:18px}.el-sub-menu .el-icon.el-sub-menu__icon-more{margin-right:0!important}.el-sub-menu .el-sub-menu__icon-arrow{position:absolute;top:50%;right:var(--el-menu-base-level-padding);margin-top:-6px;transition:transform var(--el-transition-duration);font-size:12px;margin-right:0;width:inherit}.el-menu-item-group>ul{padding:0}.el-menu-item-group__title{padding:7px 0 7px var(--el-menu-base-level-padding);line-height:normal;font-size:12px;color:var(--el-text-color-secondary)}.horizontal-collapse-transition .el-sub-menu__title .el-sub-menu__icon-arrow{transition:var(--el-transition-duration-fast);opacity:0}.el-message-box{--el-messagebox-title-color:var(--el-text-color-primary);--el-messagebox-width:420px;--el-messagebox-border-radius:4px;--el-messagebox-font-size:var(--el-font-size-large);--el-messagebox-content-font-size:var(--el-font-size-base);--el-messagebox-content-color:var(--el-text-color-regular);--el-messagebox-error-font-size:12px;--el-messagebox-padding-primary:15px}.el-message-box{display:inline-block;max-width:var(--el-messagebox-width);width:100%;padding-bottom:10px;vertical-align:middle;background-color:var(--el-bg-color);border-radius:var(--el-messagebox-border-radius);border:1px solid var(--el-border-color-lighter);font-size:var(--el-messagebox-font-size);box-shadow:var(--el-box-shadow-light);text-align:left;overflow:hidden;-webkit-backface-visibility:hidden;backface-visibility:hidden;box-sizing:border-box}.el-message-box:focus{outline:0!important}.el-overlay.is-message-box .el-overlay-message-box{text-align:center;position:fixed;top:0;right:0;bottom:0;left:0;padding:16px;overflow:auto}.el-overlay.is-message-box .el-overlay-message-box:after{content:"";display:inline-block;height:100%;width:0;vertical-align:middle}.el-message-box.is-draggable .el-message-box__header{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-message-box__header{position:relative;padding:var(--el-messagebox-padding-primary);padding-bottom:10px}.el-message-box__title{padding-left:0;margin-bottom:0;font-size:var(--el-messagebox-font-size);line-height:1;color:var(--el-messagebox-title-color)}.el-message-box__headerbtn{position:absolute;top:var(--el-messagebox-padding-primary);right:var(--el-messagebox-padding-primary);padding:0;border:none;outline:0;background:0 0;font-size:var(--el-message-close-size,16px);cursor:pointer}.el-message-box__headerbtn .el-message-box__close{color:var(--el-color-info);font-size:inherit}.el-message-box__headerbtn:focus .el-message-box__close,.el-message-box__headerbtn:hover .el-message-box__close{color:var(--el-color-primary)}.el-message-box__content{padding:10px var(--el-messagebox-padding-primary);color:var(--el-messagebox-content-color);font-size:var(--el-messagebox-content-font-size)}.el-message-box__container{position:relative}.el-message-box__input{padding-top:15px}.el-message-box__input div.invalid>input{border-color:var(--el-color-error)}.el-message-box__input div.invalid>input:focus{border-color:var(--el-color-error)}.el-message-box__status{position:absolute;top:50%;transform:translateY(-50%);font-size:24px!important}.el-message-box__status:before{padding-left:1px}.el-message-box__status.el-icon{position:absolute}.el-message-box__status+.el-message-box__message{padding-left:36px;padding-right:12px;word-break:break-word}.el-message-box__status.el-message-box-icon--success{--el-messagebox-color:var(--el-color-success);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--info{--el-messagebox-color:var(--el-color-info);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--warning{--el-messagebox-color:var(--el-color-warning);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--error{--el-messagebox-color:var(--el-color-error);color:var(--el-messagebox-color)}.el-message-box__message{margin:0}.el-message-box__message p{margin:0;line-height:24px}.el-message-box__errormsg{color:var(--el-color-error);font-size:var(--el-messagebox-error-font-size);min-height:18px;margin-top:2px}.el-message-box__btns{padding:5px 15px 0;display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center}.el-message-box__btns button:nth-child(2){margin-left:10px}.el-message-box__btns-reverse{flex-direction:row-reverse}.el-message-box--center .el-message-box__title{position:relative;display:flex;align-items:center;justify-content:center}.el-message-box--center .el-message-box__status{position:relative;top:auto;padding-right:5px;text-align:center;transform:translateY(-1px)}.el-message-box--center .el-message-box__message{margin-left:0}.el-message-box--center .el-message-box__btns{justify-content:center}.el-message-box--center .el-message-box__content{padding-left:calc(var(--el-messagebox-padding-primary) + 12px);padding-right:calc(var(--el-messagebox-padding-primary) + 12px);text-align:center}.fade-in-linear-enter-active .el-overlay-message-box{-webkit-animation:msgbox-fade-in var(--el-transition-duration);animation:msgbox-fade-in var(--el-transition-duration)}.fade-in-linear-leave-active .el-overlay-message-box{animation:msgbox-fade-in var(--el-transition-duration) reverse}@-webkit-keyframes msgbox-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes msgbox-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes msgbox-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes msgbox-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}.el-message{--el-message-bg-color:var(--el-color-info-light-9);--el-message-border-color:var(--el-border-color-lighter);--el-message-padding:15px 19px;--el-message-close-size:16px;--el-message-close-icon-color:var(--el-text-color-placeholder);--el-message-close-hover-color:var(--el-text-color-secondary)}.el-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;max-width:calc(100% - 32px);box-sizing:border-box;border-radius:var(--el-border-radius-base);border-width:var(--el-border-width);border-style:var(--el-border-style);border-color:var(--el-message-border-color);position:fixed;left:50%;top:20px;transform:translate(-50%);background-color:var(--el-message-bg-color);transition:opacity var(--el-transition-duration),transform .4s,top .4s;padding:var(--el-message-padding);display:flex;align-items:center}.el-message.is-center{justify-content:center}.el-message.is-closable .el-message__content{padding-right:31px}.el-message p{margin:0}.el-message--success{--el-message-bg-color:var(--el-color-success-light-9);--el-message-border-color:var(--el-color-success-light-8);--el-message-text-color:var(--el-color-success)}.el-message--success .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--success{color:var(--el-message-text-color)}.el-message--info{--el-message-bg-color:var(--el-color-info-light-9);--el-message-border-color:var(--el-color-info-light-8);--el-message-text-color:var(--el-color-info)}.el-message--info .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--info{color:var(--el-message-text-color)}.el-message--warning{--el-message-bg-color:var(--el-color-warning-light-9);--el-message-border-color:var(--el-color-warning-light-8);--el-message-text-color:var(--el-color-warning)}.el-message--warning .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--warning{color:var(--el-message-text-color)}.el-message--error{--el-message-bg-color:var(--el-color-error-light-9);--el-message-border-color:var(--el-color-error-light-8);--el-message-text-color:var(--el-color-error)}.el-message--error .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--error{color:var(--el-message-text-color)}.el-message__icon{margin-right:10px}.el-message .el-message__badge{position:absolute;top:-8px;right:-8px}.el-message__content{padding:0;font-size:14px;line-height:1}.el-message__content:focus{outline-width:0}.el-message .el-message__closeBtn{position:absolute;top:50%;right:19px;transform:translateY(-50%);cursor:pointer;color:var(--el-message-close-icon-color);font-size:var(--el-message-close-size)}.el-message .el-message__closeBtn:focus{outline-width:0}.el-message .el-message__closeBtn:hover{color:var(--el-message-close-hover-color)}.el-message-fade-enter-from,.el-message-fade-leave-to{opacity:0;transform:translate(-50%,-100%)}.el-notification{--el-notification-width:330px;--el-notification-padding:14px 26px 14px 13px;--el-notification-radius:8px;--el-notification-shadow:var(--el-box-shadow-light);--el-notification-border-color:var(--el-border-color-lighter);--el-notification-icon-size:24px;--el-notification-close-font-size:var(--el-message-close-size, 16px);--el-notification-group-margin-left:13px;--el-notification-group-margin-right:8px;--el-notification-content-font-size:var(--el-font-size-base);--el-notification-content-color:var(--el-text-color-regular);--el-notification-title-font-size:16px;--el-notification-title-color:var(--el-text-color-primary);--el-notification-close-color:var(--el-text-color-secondary);--el-notification-close-hover-color:var(--el-text-color-regular)}.el-notification{display:flex;width:var(--el-notification-width);padding:var(--el-notification-padding);border-radius:var(--el-notification-radius);box-sizing:border-box;border:1px solid var(--el-notification-border-color);position:fixed;background-color:var(--el-bg-color-overlay);box-shadow:var(--el-notification-shadow);transition:opacity var(--el-transition-duration),transform var(--el-transition-duration),left var(--el-transition-duration),right var(--el-transition-duration),top .4s,bottom var(--el-transition-duration);overflow-wrap:anywhere;overflow:hidden;z-index:9999}.el-notification.right{right:16px}.el-notification.left{left:16px}.el-notification__group{margin-left:var(--el-notification-group-margin-left);margin-right:var(--el-notification-group-margin-right)}.el-notification__title{font-weight:700;font-size:var(--el-notification-title-font-size);line-height:var(--el-notification-icon-size);color:var(--el-notification-title-color);margin:0}.el-notification__content{font-size:var(--el-notification-content-font-size);line-height:24px;margin:6px 0 0;color:var(--el-notification-content-color);text-align:justify}.el-notification__content p{margin:0}.el-notification .el-notification__icon{height:var(--el-notification-icon-size);width:var(--el-notification-icon-size);font-size:var(--el-notification-icon-size)}.el-notification .el-notification__closeBtn{position:absolute;top:18px;right:15px;cursor:pointer;color:var(--el-notification-close-color);font-size:var(--el-notification-close-font-size)}.el-notification .el-notification__closeBtn:hover{color:var(--el-notification-close-hover-color)}.el-notification .el-notification--success{--el-notification-icon-color:var(--el-color-success);color:var(--el-notification-icon-color)}.el-notification .el-notification--info{--el-notification-icon-color:var(--el-color-info);color:var(--el-notification-icon-color)}.el-notification .el-notification--warning{--el-notification-icon-color:var(--el-color-warning);color:var(--el-notification-icon-color)}.el-notification .el-notification--error{--el-notification-icon-color:var(--el-color-error);color:var(--el-notification-icon-color)}.el-notification-fade-enter-from.right{right:0;transform:translate(100%)}.el-notification-fade-enter-from.left{left:0;transform:translate(-100%)}.el-notification-fade-leave-to{opacity:0}.el-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;height:100%;background-color:var(--el-overlay-color-lighter);overflow:auto}.el-overlay .el-overlay-root{height:0}.el-page-header.is-contentful .el-page-header__main{border-top:1px solid var(--el-border-color-light);margin-top:16px}.el-page-header__header{display:flex;align-items:center;justify-content:space-between;line-height:24px}.el-page-header__left{display:flex;align-items:center;margin-right:40px;position:relative}.el-page-header__back{display:flex;align-items:center;cursor:pointer}.el-page-header__left .el-divider--vertical{margin:0 16px}.el-page-header__icon{font-size:16px;margin-right:10px;display:flex;align-items:center}.el-page-header__icon .el-icon{font-size:inherit}.el-page-header__title{font-size:14px;font-weight:500}.el-page-header__content{font-size:18px;color:var(--el-text-color-primary)}.el-page-header__breadcrumb{margin-bottom:16px}.el-pagination{--el-pagination-font-size:14px;--el-pagination-bg-color:var(--el-fill-color-blank);--el-pagination-text-color:var(--el-text-color-primary);--el-pagination-border-radius:2px;--el-pagination-button-color:var(--el-text-color-primary);--el-pagination-button-width:32px;--el-pagination-button-height:32px;--el-pagination-button-disabled-color:var(--el-text-color-placeholder);--el-pagination-button-disabled-bg-color:var(--el-fill-color-blank);--el-pagination-button-bg-color:var(--el-fill-color);--el-pagination-hover-color:var(--el-color-primary);--el-pagination-font-size-small:12px;--el-pagination-button-width-small:24px;--el-pagination-button-height-small:24px;--el-pagination-item-gap:16px;white-space:nowrap;color:var(--el-pagination-text-color);font-size:var(--el-pagination-font-size);font-weight:400;display:flex;align-items:center}.el-pagination .el-input__inner{text-align:center;-moz-appearance:textfield}.el-pagination .el-select .el-input{width:128px}.el-pagination button{display:flex;justify-content:center;align-items:center;font-size:var(--el-pagination-font-size);min-width:var(--el-pagination-button-width);height:var(--el-pagination-button-height);line-height:var(--el-pagination-button-height);color:var(--el-pagination-button-color);background:var(--el-pagination-bg-color);padding:0 4px;border:none;border-radius:var(--el-pagination-border-radius);cursor:pointer;text-align:center;box-sizing:border-box}.el-pagination button *{pointer-events:none}.el-pagination button:focus{outline:0}.el-pagination button:hover{color:var(--el-pagination-hover-color)}.el-pagination button.is-active{color:var(--el-pagination-hover-color);cursor:default;font-weight:700}.el-pagination button.is-active.is-disabled{font-weight:700;color:var(--el-text-color-secondary)}.el-pagination button.is-disabled,.el-pagination button:disabled{color:var(--el-pagination-button-disabled-color);background-color:var(--el-pagination-button-disabled-bg-color);cursor:not-allowed}.el-pagination button:focus-visible{outline:1px solid var(--el-pagination-hover-color);outline-offset:-1px}.el-pagination .btn-next .el-icon,.el-pagination .btn-prev .el-icon{display:block;font-size:12px;font-weight:700;width:inherit}.el-pagination>.is-first{margin-left:0!important}.el-pagination>.is-last{margin-right:0!important}.el-pagination .btn-prev{margin-left:var(--el-pagination-item-gap)}.el-pagination__sizes,.el-pagination__total{margin-left:var(--el-pagination-item-gap);font-weight:400;color:var(--el-text-color-regular)}.el-pagination__total[disabled=true]{color:var(--el-text-color-placeholder)}.el-pagination__jump{display:flex;align-items:center;margin-left:var(--el-pagination-item-gap);font-weight:400;color:var(--el-text-color-regular)}.el-pagination__jump[disabled=true]{color:var(--el-text-color-placeholder)}.el-pagination__goto{margin-right:8px}.el-pagination__editor{text-align:center;box-sizing:border-box}.el-pagination__editor.el-input{width:56px}.el-pagination__editor .el-input__inner::-webkit-inner-spin-button,.el-pagination__editor .el-input__inner::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.el-pagination__classifier{margin-left:8px}.el-pagination__rightwrapper{flex:1;display:flex;align-items:center;justify-content:flex-end}.el-pagination.is-background .btn-next,.el-pagination.is-background .btn-prev,.el-pagination.is-background .el-pager li{margin:0 4px;background-color:var(--el-pagination-button-bg-color)}.el-pagination.is-background .btn-next.is-active,.el-pagination.is-background .btn-prev.is-active,.el-pagination.is-background .el-pager li.is-active{background-color:var(--el-color-primary);color:var(--el-color-white)}.el-pagination.is-background .btn-next.is-disabled,.el-pagination.is-background .btn-next:disabled,.el-pagination.is-background .btn-prev.is-disabled,.el-pagination.is-background .btn-prev:disabled,.el-pagination.is-background .el-pager li.is-disabled,.el-pagination.is-background .el-pager li:disabled{color:var(--el-text-color-placeholder);background-color:var(--el-disabled-bg-color)}.el-pagination.is-background .btn-next.is-disabled.is-active,.el-pagination.is-background .btn-next:disabled.is-active,.el-pagination.is-background .btn-prev.is-disabled.is-active,.el-pagination.is-background .btn-prev:disabled.is-active,.el-pagination.is-background .el-pager li.is-disabled.is-active,.el-pagination.is-background .el-pager li:disabled.is-active{color:var(--el-text-color-secondary);background-color:var(--el-fill-color-dark)}.el-pagination.is-background .btn-prev{margin-left:var(--el-pagination-item-gap)}.el-pagination--small .btn-next,.el-pagination--small .btn-prev,.el-pagination--small .el-pager li{height:var(--el-pagination-button-height-small);line-height:var(--el-pagination-button-height-small);font-size:var(--el-pagination-font-size-small);min-width:var(--el-pagination-button-width-small)}.el-pagination--small button,.el-pagination--small span:not([class*=suffix]){font-size:var(--el-pagination-font-size-small)}.el-pagination--small .el-select .el-input{width:100px}.el-pager{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;font-size:0;padding:0;margin:0;display:flex;align-items:center}.el-pager li{display:flex;justify-content:center;align-items:center;font-size:var(--el-pagination-font-size);min-width:var(--el-pagination-button-width);height:var(--el-pagination-button-height);line-height:var(--el-pagination-button-height);color:var(--el-pagination-button-color);background:var(--el-pagination-bg-color);padding:0 4px;border:none;border-radius:var(--el-pagination-border-radius);cursor:pointer;text-align:center;box-sizing:border-box}.el-pager li *{pointer-events:none}.el-pager li:focus{outline:0}.el-pager li:hover{color:var(--el-pagination-hover-color)}.el-pager li.is-active{color:var(--el-pagination-hover-color);cursor:default;font-weight:700}.el-pager li.is-active.is-disabled{font-weight:700;color:var(--el-text-color-secondary)}.el-pager li.is-disabled,.el-pager li:disabled{color:var(--el-pagination-button-disabled-color);background-color:var(--el-pagination-button-disabled-bg-color);cursor:not-allowed}.el-pager li:focus-visible{outline:1px solid var(--el-pagination-hover-color);outline-offset:-1px}.el-popconfirm__main{display:flex;align-items:center}.el-popconfirm__icon{margin-right:5px}.el-popconfirm__action{text-align:right;margin-top:8px}.el-popover{--el-popover-bg-color:var(--el-bg-color-overlay);--el-popover-font-size:var(--el-font-size-base);--el-popover-border-color:var(--el-border-color-lighter);--el-popover-padding:12px;--el-popover-padding-large:18px 20px;--el-popover-title-font-size:16px;--el-popover-title-text-color:var(--el-text-color-primary);--el-popover-border-radius:4px}.el-popover.el-popper{background:var(--el-popover-bg-color);min-width:150px;border-radius:var(--el-popover-border-radius);border:1px solid var(--el-popover-border-color);padding:var(--el-popover-padding);z-index:var(--el-index-popper);color:var(--el-text-color-regular);line-height:1.4;text-align:justify;font-size:var(--el-popover-font-size);box-shadow:var(--el-box-shadow-light);word-break:break-all;box-sizing:border-box}.el-popover.el-popper--plain{padding:var(--el-popover-padding-large)}.el-popover__title{color:var(--el-popover-title-text-color);font-size:var(--el-popover-title-font-size);line-height:1;margin-bottom:12px}.el-popover__reference:focus:hover,.el-popover__reference:focus:not(.focusing){outline-width:0}.el-popover.el-popper.is-dark{--el-popover-bg-color:var(--el-text-color-primary);--el-popover-border-color:var(--el-text-color-primary);--el-popover-title-text-color:var(--el-bg-color);color:var(--el-bg-color)}.el-popover.el-popper:focus,.el-popover.el-popper:focus:active{outline-width:0}.el-progress{position:relative;line-height:1;display:flex;align-items:center}.el-progress__text{font-size:14px;color:var(--el-text-color-regular);margin-left:5px;min-width:50px;line-height:1}.el-progress__text i{vertical-align:middle;display:block}.el-progress--circle,.el-progress--dashboard{display:inline-block}.el-progress--circle .el-progress__text,.el-progress--dashboard .el-progress__text{position:absolute;top:50%;left:0;width:100%;text-align:center;margin:0;transform:translateY(-50%)}.el-progress--circle .el-progress__text i,.el-progress--dashboard .el-progress__text i{vertical-align:middle;display:inline-block}.el-progress--without-text .el-progress__text{display:none}.el-progress--without-text .el-progress-bar{padding-right:0;margin-right:0;display:block}.el-progress--text-inside .el-progress-bar{padding-right:0;margin-right:0}.el-progress.is-success .el-progress-bar__inner{background-color:var(--el-color-success)}.el-progress.is-success .el-progress__text{color:var(--el-color-success)}.el-progress.is-warning .el-progress-bar__inner{background-color:var(--el-color-warning)}.el-progress.is-warning .el-progress__text{color:var(--el-color-warning)}.el-progress.is-exception .el-progress-bar__inner{background-color:var(--el-color-danger)}.el-progress.is-exception .el-progress__text{color:var(--el-color-danger)}.el-progress-bar{flex-grow:1;box-sizing:border-box}.el-progress-bar__outer{height:6px;border-radius:100px;background-color:var(--el-border-color-lighter);overflow:hidden;position:relative;vertical-align:middle}.el-progress-bar__inner{position:absolute;left:0;top:0;height:100%;background-color:var(--el-color-primary);text-align:right;border-radius:100px;line-height:1;white-space:nowrap;transition:width .6s ease}.el-progress-bar__inner:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-progress-bar__inner--indeterminate{transform:translateZ(0);-webkit-animation:indeterminate 3s infinite;animation:indeterminate 3s infinite}.el-progress-bar__inner--striped{background-image:linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 50%,rgba(0,0,0,.1) 50%,rgba(0,0,0,.1) 75%,transparent 75%,transparent);background-size:1.25em 1.25em}.el-progress-bar__inner--striped.el-progress-bar__inner--striped-flow{-webkit-animation:striped-flow 3s linear infinite;animation:striped-flow 3s linear infinite}.el-progress-bar__innerText{display:inline-block;vertical-align:middle;color:#fff;font-size:12px;margin:0 5px}@-webkit-keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}@keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}@-webkit-keyframes indeterminate{0%{left:-100%}to{left:100%}}@keyframes indeterminate{0%{left:-100%}to{left:100%}}@-webkit-keyframes striped-flow{0%{background-position:-100%}to{background-position:100%}}@keyframes striped-flow{0%{background-position:-100%}to{background-position:100%}}.el-radio-button{--el-radio-button-checked-bg-color:var(--el-color-primary);--el-radio-button-checked-text-color:var(--el-color-white);--el-radio-button-checked-border-color:var(--el-color-primary);--el-radio-button-disabled-checked-fill:var(--el-border-color-extra-light)}.el-radio-button{position:relative;display:inline-block;outline:0}.el-radio-button__inner{display:inline-block;line-height:1;white-space:nowrap;vertical-align:middle;background:var(--el-button-bg-color,var(--el-fill-color-blank));border:var(--el-border);font-weight:var(--el-button-font-weight,var(--el-font-weight-primary));border-left:0;color:var(--el-button-text-color,var(--el-text-color-regular));-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:0;margin:0;position:relative;cursor:pointer;transition:var(--el-transition-all);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:8px 15px;font-size:var(--el-font-size-base);border-radius:0}.el-radio-button__inner.is-round{padding:8px 15px}.el-radio-button__inner:hover{color:var(--el-color-primary)}.el-radio-button__inner [class*=el-icon-]{line-height:.9}.el-radio-button__inner [class*=el-icon-]+span{margin-left:5px}.el-radio-button:first-child .el-radio-button__inner{border-left:var(--el-border);border-radius:var(--el-border-radius-base) 0 0 var(--el-border-radius-base);box-shadow:none!important}.el-radio-button__original-radio{opacity:0;outline:0;position:absolute;z-index:-1}.el-radio-button__original-radio:checked+.el-radio-button__inner{color:var(--el-radio-button-checked-text-color,var(--el-color-white));background-color:var(--el-radio-button-checked-bg-color,var(--el-color-primary));border-color:var(--el-radio-button-checked-border-color,var(--el-color-primary));box-shadow:-1px 0 0 0 var(--el-radio-button-checked-border-color,var(--el-color-primary))}.el-radio-button__original-radio:focus-visible+.el-radio-button__inner{border-left:var(--el-border);border-left-color:var(--el-radio-button-checked-border-color,var(--el-color-primary));outline:2px solid var(--el-radio-button-checked-border-color);outline-offset:1px;z-index:2;border-radius:var(--el-border-radius-base);box-shadow:none}.el-radio-button__original-radio:disabled+.el-radio-button__inner{color:var(--el-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color,var(--el-fill-color-blank));border-color:var(--el-button-disabled-border-color,var(--el-border-color-light));box-shadow:none}.el-radio-button__original-radio:disabled:checked+.el-radio-button__inner{background-color:var(--el-radio-button-disabled-checked-fill)}.el-radio-button:last-child .el-radio-button__inner{border-radius:0 var(--el-border-radius-base) var(--el-border-radius-base) 0}.el-radio-button:first-child:last-child .el-radio-button__inner{border-radius:var(--el-border-radius-base)}.el-radio-button--large .el-radio-button__inner{padding:12px 19px;font-size:var(--el-font-size-base);border-radius:0}.el-radio-button--large .el-radio-button__inner.is-round{padding:12px 19px}.el-radio-button--small .el-radio-button__inner{padding:5px 11px;font-size:12px;border-radius:0}.el-radio-button--small .el-radio-button__inner.is-round{padding:5px 11px}.el-radio-group{display:inline-flex;align-items:center;flex-wrap:wrap;font-size:0}.el-radio{--el-radio-font-size:var(--el-font-size-base);--el-radio-text-color:var(--el-text-color-regular);--el-radio-font-weight:var(--el-font-weight-primary);--el-radio-input-height:14px;--el-radio-input-width:14px;--el-radio-input-border-radius:var(--el-border-radius-circle);--el-radio-input-bg-color:var(--el-fill-color-blank);--el-radio-input-border:var(--el-border);--el-radio-input-border-color:var(--el-border-color);--el-radio-input-border-color-hover:var(--el-color-primary)}.el-radio{color:var(--el-radio-text-color);font-weight:var(--el-radio-font-weight);position:relative;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;outline:0;font-size:var(--el-font-size-base);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:32px;height:32px}.el-radio.el-radio--large{height:40px}.el-radio.el-radio--small{height:24px}.el-radio.is-bordered{padding:0 15px 0 9px;border-radius:var(--el-border-radius-base);border:var(--el-border);box-sizing:border-box}.el-radio.is-bordered.is-checked{border-color:var(--el-color-primary)}.el-radio.is-bordered.is-disabled{cursor:not-allowed;border-color:var(--el-border-color-lighter)}.el-radio.is-bordered.el-radio--large{padding:0 19px 0 11px;border-radius:var(--el-border-radius-base)}.el-radio.is-bordered.el-radio--large .el-radio__label{font-size:var(--el-font-size-base)}.el-radio.is-bordered.el-radio--large .el-radio__inner{height:14px;width:14px}.el-radio.is-bordered.el-radio--small{padding:0 11px 0 7px;border-radius:var(--el-border-radius-base)}.el-radio.is-bordered.el-radio--small .el-radio__label{font-size:12px}.el-radio.is-bordered.el-radio--small .el-radio__inner{height:12px;width:12px}.el-radio:last-child{margin-right:0}.el-radio__input{white-space:nowrap;cursor:pointer;outline:0;display:inline-flex;position:relative;vertical-align:middle}.el-radio__input.is-disabled .el-radio__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);cursor:not-allowed}.el-radio__input.is-disabled .el-radio__inner:after{cursor:not-allowed;background-color:var(--el-disabled-bg-color)}.el-radio__input.is-disabled .el-radio__inner+.el-radio__label{cursor:not-allowed}.el-radio__input.is-disabled.is-checked .el-radio__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color)}.el-radio__input.is-disabled.is-checked .el-radio__inner:after{background-color:var(--el-text-color-placeholder)}.el-radio__input.is-disabled+span.el-radio__label{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-radio__input.is-checked .el-radio__inner{border-color:var(--el-color-primary);background:var(--el-color-primary)}.el-radio__input.is-checked .el-radio__inner:after{transform:translate(-50%,-50%) scale(1)}.el-radio__input.is-checked+.el-radio__label{color:var(--el-color-primary)}.el-radio__input.is-focus .el-radio__inner{border-color:var(--el-radio-input-border-color-hover)}.el-radio__inner{border:var(--el-radio-input-border);border-radius:var(--el-radio-input-border-radius);width:var(--el-radio-input-width);height:var(--el-radio-input-height);background-color:var(--el-radio-input-bg-color);position:relative;cursor:pointer;display:inline-block;box-sizing:border-box}.el-radio__inner:hover{border-color:var(--el-radio-input-border-color-hover)}.el-radio__inner:after{width:4px;height:4px;border-radius:var(--el-radio-input-border-radius);background-color:var(--el-color-white);content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%) scale(0);transition:transform .15s ease-in}.el-radio__original{opacity:0;outline:0;position:absolute;z-index:-1;top:0;left:0;right:0;bottom:0;margin:0}.el-radio__original:focus-visible+.el-radio__inner{outline:2px solid var(--el-radio-input-border-color-hover);outline-offset:1px;border-radius:var(--el-radio-input-border-radius)}.el-radio:focus:not(:focus-visible):not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner{box-shadow:0 0 2px 2px var(--el-radio-input-border-color-hover)}.el-radio__label{font-size:var(--el-radio-font-size);padding-left:8px}.el-radio.el-radio--large .el-radio__label{font-size:14px}.el-radio.el-radio--large .el-radio__inner{width:14px;height:14px}.el-radio.el-radio--small .el-radio__label{font-size:12px}.el-radio.el-radio--small .el-radio__inner{width:12px;height:12px}.el-rate{--el-rate-height:20px;--el-rate-font-size:var(--el-font-size-base);--el-rate-icon-size:18px;--el-rate-icon-margin:6px;--el-rate-void-color:var(--el-border-color-darker);--el-rate-fill-color:#f7ba2a;--el-rate-disabled-void-color:var(--el-fill-color);--el-rate-text-color:var(--el-text-color-primary)}.el-rate{display:inline-flex;align-items:center;height:32px}.el-rate:active,.el-rate:focus{outline:0}.el-rate__item{cursor:pointer;display:inline-block;position:relative;font-size:0;vertical-align:middle;color:var(--el-rate-void-color);line-height:normal}.el-rate .el-rate__icon{position:relative;display:inline-block;font-size:var(--el-rate-icon-size);margin-right:var(--el-rate-icon-margin);transition:var(--el-transition-duration)}.el-rate .el-rate__icon.hover{transform:scale(1.15)}.el-rate .el-rate__icon .path2{position:absolute;left:0;top:0}.el-rate .el-rate__icon.is-active{color:var(--el-rate-fill-color)}.el-rate__decimal{position:absolute;top:0;left:0;display:inline-block;overflow:hidden;color:var(--el-rate-fill-color)}.el-rate__text{font-size:var(--el-rate-font-size);vertical-align:middle;color:var(--el-rate-text-color)}.el-rate--large{height:40px}.el-rate--small{height:24px}.el-rate--small .el-rate__icon{font-size:14px}.el-rate.is-disabled .el-rate__item{cursor:auto;color:var(--el-rate-disabled-void-color)}.el-result{--el-result-padding:40px 30px;--el-result-icon-font-size:64px;--el-result-title-font-size:20px;--el-result-title-margin-top:20px;--el-result-subtitle-margin-top:10px;--el-result-extra-margin-top:30px}.el-result{display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:var(--el-result-padding)}.el-result__icon svg{width:var(--el-result-icon-font-size);height:var(--el-result-icon-font-size)}.el-result__title{margin-top:var(--el-result-title-margin-top)}.el-result__title p{margin:0;font-size:var(--el-result-title-font-size);color:var(--el-text-color-primary);line-height:1.3}.el-result__subtitle{margin-top:var(--el-result-subtitle-margin-top)}.el-result__subtitle p{margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);line-height:1.3}.el-result__extra{margin-top:var(--el-result-extra-margin-top)}.el-result .icon-primary{--el-result-color:var(--el-color-primary);color:var(--el-result-color)}.el-result .icon-success{--el-result-color:var(--el-color-success);color:var(--el-result-color)}.el-result .icon-warning{--el-result-color:var(--el-color-warning);color:var(--el-result-color)}.el-result .icon-danger{--el-result-color:var(--el-color-danger);color:var(--el-result-color)}.el-result .icon-error{--el-result-color:var(--el-color-error);color:var(--el-result-color)}.el-result .icon-info{--el-result-color:var(--el-color-info);color:var(--el-result-color)}.el-row{display:flex;flex-wrap:wrap;position:relative;box-sizing:border-box}.el-row.is-justify-center{justify-content:center}.el-row.is-justify-end{justify-content:flex-end}.el-row.is-justify-space-between{justify-content:space-between}.el-row.is-justify-space-around{justify-content:space-around}.el-row.is-justify-space-evenly{justify-content:space-evenly}.el-row.is-align-middle{align-items:center}.el-row.is-align-bottom{align-items:flex-end}.el-scrollbar{--el-scrollbar-opacity:.3;--el-scrollbar-bg-color:var(--el-text-color-secondary);--el-scrollbar-hover-opacity:.5;--el-scrollbar-hover-bg-color:var(--el-text-color-secondary)}.el-scrollbar{overflow:hidden;position:relative;height:100%}.el-scrollbar__wrap{overflow:auto;height:100%}.el-scrollbar__wrap--hidden-default{scrollbar-width:none}.el-scrollbar__wrap--hidden-default::-webkit-scrollbar{display:none}.el-scrollbar__thumb{position:relative;display:block;width:0;height:0;cursor:pointer;border-radius:inherit;background-color:var(--el-scrollbar-bg-color,var(--el-text-color-secondary));transition:var(--el-transition-duration) background-color;opacity:var(--el-scrollbar-opacity,.3)}.el-scrollbar__thumb:hover{background-color:var(--el-scrollbar-hover-bg-color,var(--el-text-color-secondary));opacity:var(--el-scrollbar-hover-opacity,.5)}.el-scrollbar__bar{position:absolute;right:2px;bottom:2px;z-index:1;border-radius:4px}.el-scrollbar__bar.is-vertical{width:6px;top:2px}.el-scrollbar__bar.is-vertical>div{width:100%}.el-scrollbar__bar.is-horizontal{height:6px;left:2px}.el-scrollbar__bar.is-horizontal>div{height:100%}.el-scrollbar-fade-enter-active{transition:opacity .34s ease-out}.el-scrollbar-fade-leave-active{transition:opacity .12s ease-out}.el-scrollbar-fade-enter-from,.el-scrollbar-fade-leave-active{opacity:0}.el-select-dropdown{z-index:calc(var(--el-index-top) + 1);border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown__option-item.is-selected:not(.is-multiple).is-disabled{color:var(--el-text-color-disabled)}.el-select-dropdown__option-item.is-selected:not(.is-multiple).is-disabled:after{background-color:var(--el-text-color-disabled)}.el-select-dropdown__option-item:hover:not(.hover){background-color:transparent}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-disabled.is-selected{color:var(--el-text-color-disabled)}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:var(--el-select-font-size)}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;margin:6px 0!important;padding:0!important;box-sizing:border-box}.el-select-dropdown__option-item{font-size:var(--el-select-font-size);padding:0 32px 0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--el-text-color-regular);height:34px;line-height:34px;box-sizing:border-box;cursor:pointer}.el-select-dropdown__option-item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-select-dropdown__option-item.is-disabled:hover{background-color:var(--el-bg-color)}.el-select-dropdown__option-item.is-selected{background-color:var(--el-fill-color-light);font-weight:700}.el-select-dropdown__option-item.is-selected:not(.is-multiple){color:var(--el-color-primary)}.el-select-dropdown__option-item.hover{background-color:var(--el-fill-color-light)!important}.el-select-dropdown__option-item:hover{background-color:var(--el-fill-color-light)}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay)}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected .el-icon{position:absolute;right:20px;top:0;height:inherit;font-size:12px}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected .el-icon svg{height:inherit;vertical-align:middle}.el-select-group{margin:0;padding:0}.el-select-group__wrap{position:relative;list-style:none;margin:0;padding:0}.el-select-group__wrap:not(:last-of-type){padding-bottom:24px}.el-select-group__wrap:not(:last-of-type):after{content:"";position:absolute;display:block;left:20px;right:20px;bottom:12px;height:1px;background:var(--el-border-color-light)}.el-select-group__split-dash{position:absolute;left:20px;right:20px;height:1px;background:var(--el-border-color-light)}.el-select-group__title{padding-left:20px;font-size:12px;color:var(--el-color-info);line-height:30px}.el-select-group .el-select-dropdown__item{padding-left:20px}.el-select-v2{--el-select-border-color-hover:var(--el-border-color-hover);--el-select-disabled-border:var(--el-disabled-border-color);--el-select-font-size:var(--el-font-size-base);--el-select-close-hover-color:var(--el-text-color-secondary);--el-select-input-color:var(--el-text-color-placeholder);--el-select-multiple-input-color:var(--el-text-color-regular);--el-select-input-focus-border-color:var(--el-color-primary);--el-select-input-font-size:14px}.el-select-v2{display:inline-block;position:relative;vertical-align:middle;font-size:14px}.el-select-v2__wrapper{display:flex;align-items:center;flex-wrap:wrap;position:relative;box-sizing:border-box;cursor:pointer;padding:1px 30px 1px 0;border:1px solid var(--el-border-color);border-radius:var(--el-border-radius-base);background-color:var(--el-fill-color-blank);transition:var(--el-transition-duration)}.el-select-v2__wrapper:hover{border-color:var(--el-text-color-placeholder)}.el-select-v2__wrapper.is-filterable{cursor:text}.el-select-v2__wrapper.is-focused{border-color:var(--el-color-primary)}.el-select-v2__wrapper.is-hovering:not(.is-focused){border-color:var(--el-border-color-hover)}.el-select-v2__wrapper.is-disabled{cursor:not-allowed;background-color:var(--el-fill-color-light);color:var(--el-text-color-placeholder);border-color:var(--el-select-disabled-border)}.el-select-v2__wrapper.is-disabled:hover{border-color:var(--el-select-disabled-border)}.el-select-v2__wrapper.is-disabled.is-focus{border-color:var(--el-input-focus-border-color)}.el-select-v2__wrapper.is-disabled .is-transparent{opacity:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-select-v2__wrapper.is-disabled .el-select-v2__caret,.el-select-v2__wrapper.is-disabled .el-select-v2__combobox-input{cursor:not-allowed}.el-select-v2__wrapper .el-select-v2__input-wrapper{box-sizing:border-box;position:relative;-webkit-margin-start:12px;margin-inline-start:12px;max-width:100%;overflow:hidden}.el-select-v2__wrapper,.el-select-v2__wrapper .el-select-v2__input-wrapper{line-height:32px}.el-select-v2__wrapper .el-select-v2__input-wrapper input{--el-input-inner-height:calc(var(--el-component-size, 32px) - 8px);height:var(--el-input-inner-height);line-height:var(--el-input-inner-height);min-width:4px;width:100%;background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:0 0;border:none;margin:2px 0;outline:0;padding:0}.el-select-v2 .el-select-v2__tags-text{display:inline-block;line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-select-v2__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:14px}.el-select-v2__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-select-v2__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-select-v2__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-select-v2--large .el-select-v2__wrapper .el-select-v2__combobox-input{height:32px}.el-select-v2--large .el-select-v2__caret,.el-select-v2--large .el-select-v2__suffix{height:40px}.el-select-v2--large .el-select-v2__placeholder{font-size:14px;line-height:40px}.el-select-v2--small .el-select-v2__wrapper .el-select-v2__combobox-input{height:16px}.el-select-v2--small .el-select-v2__caret,.el-select-v2--small .el-select-v2__suffix{height:24px}.el-select-v2--small .el-select-v2__placeholder{font-size:12px;line-height:24px}.el-select-v2 .el-select-v2__selection>span{display:inline-block}.el-select-v2:hover .el-select-v2__combobox-input{border-color:var(--el-select-border-color-hover)}.el-select-v2 .el-select__selection-text{text-overflow:ellipsis;display:inline-block;overflow-x:hidden;vertical-align:bottom}.el-select-v2 .el-select-v2__combobox-input{padding-right:35px;display:block;color:var(--el-text-color-regular)}.el-select-v2 .el-select-v2__combobox-input:focus{border-color:var(--el-select-input-focus-border-color)}.el-select-v2__input{border:none;outline:0;padding:0;margin-left:15px;color:var(--el-select-multiple-input-color);font-size:var(--el-select-font-size);-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px}.el-select-v2__input.is-small{height:14px}.el-select-v2__close{cursor:pointer;position:absolute;top:8px;z-index:var(--el-index-top);right:25px;color:var(--el-select-input-color);line-height:18px;font-size:var(--el-select-input-font-size)}.el-select-v2__close:hover{color:var(--el-select-close-hover-color)}.el-select-v2__suffix{display:inline-flex;position:absolute;right:12px;height:32px;top:50%;transform:translateY(-50%);color:var(--el-input-icon-color,var(--el-text-color-placeholder))}.el-select-v2__suffix .el-input__icon{height:inherit}.el-select-v2__suffix .el-input__icon:not(:first-child){margin-left:8px}.el-select-v2__caret{color:var(--el-select-input-color);font-size:var(--el-select-input-font-size);transition:var(--el-transition-duration);transform:rotate(180deg);cursor:pointer}.el-select-v2__caret.is-reverse{transform:rotate(0)}.el-select-v2__caret.is-show-close{font-size:var(--el-select-font-size);text-align:center;transform:rotate(180deg);border-radius:var(--el-border-radius-circle);color:var(--el-select-input-color);transition:var(--el-transition-color)}.el-select-v2__caret.is-show-close:hover{color:var(--el-select-close-hover-color)}.el-select-v2__caret.el-icon{height:inherit}.el-select-v2__caret.el-icon svg{vertical-align:middle}.el-select-v2__selection{white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;width:100%}.el-select-v2__input-calculator{left:0;position:absolute;top:0;visibility:hidden;white-space:pre;z-index:999}.el-select-v2__selected-item{line-height:inherit;height:inherit;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-wrap:wrap}.el-select-v2__placeholder{position:absolute;top:50%;transform:translateY(-50%);-webkit-margin-start:12px;margin-inline-start:12px;width:calc(100% - 52px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--el-input-text-color,var(--el-text-color-regular))}.el-select-v2__placeholder.is-transparent{color:var(--el-text-color-placeholder)}.el-select-v2 .el-select-v2__selection .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 0 2px 6px;background-color:var(--el-fill-color)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;color:var(--el-color-white)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select-v2.el-select-v2--small .el-select-v2__selection .el-tag{margin:1px 0 1px 6px;height:18px}.el-select-dropdown{z-index:calc(var(--el-index-top) + 1);border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay)}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.hover{background-color:var(--el-fill-color-light)}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected:after{content:"";position:absolute;top:50%;right:20px;border-top:none;border-right:none;background-repeat:no-repeat;background-position:center;background-color:var(--el-color-primary);-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask-size:100% 100%;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;-webkit-mask-size:100% 100%;transform:translateY(-50%);width:12px;height:12px}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.is-disabled:after{background-color:var(--el-text-color-disabled)}.el-select-dropdown .el-select-dropdown__option-item.is-selected:after{content:"";position:absolute;top:50%;right:20px;border-top:none;border-right:none;background-repeat:no-repeat;background-position:center;background-color:var(--el-color-primary);-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask-size:100% 100%;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;-webkit-mask-size:100% 100%;transform:translateY(-50%);width:12px;height:12px}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown .el-select-dropdown__item.is-disabled:hover{background-color:unset}.el-select-dropdown .el-select-dropdown__item.is-disabled.selected{color:var(--el-text-color-disabled)}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:var(--el-select-font-size)}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;padding:6px 0;margin:0;box-sizing:border-box}.el-select{--el-select-border-color-hover:var(--el-border-color-hover);--el-select-disabled-border:var(--el-disabled-border-color);--el-select-font-size:var(--el-font-size-base);--el-select-close-hover-color:var(--el-text-color-secondary);--el-select-input-color:var(--el-text-color-placeholder);--el-select-multiple-input-color:var(--el-text-color-regular);--el-select-input-focus-border-color:var(--el-color-primary);--el-select-input-font-size:14px}.el-select{display:inline-block;position:relative;vertical-align:middle;line-height:32px}.el-select__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-select__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-select__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-select__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-select__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-select__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-select .el-select-tags-wrapper.has-prefix{margin-left:6px}.el-select--large{line-height:40px}.el-select--large .el-select-tags-wrapper.has-prefix{margin-left:8px}.el-select--small{line-height:24px}.el-select--small .el-select-tags-wrapper.has-prefix{margin-left:4px}.el-select .el-select__tags>span{display:inline-block}.el-select:hover:not(.el-select--disabled) .el-input__wrapper{box-shadow:0 0 0 1px var(--el-select-border-color-hover) inset}.el-select .el-select__tags-text{display:inline-block;line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-select .el-input__wrapper{cursor:pointer}.el-select .el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-select-input-focus-border-color) inset!important}.el-select .el-input__inner{cursor:pointer}.el-select .el-input{display:flex}.el-select .el-input .el-select__caret{color:var(--el-select-input-color);font-size:var(--el-select-input-font-size);transition:transform var(--el-transition-duration);transform:rotate(0);cursor:pointer}.el-select .el-input .el-select__caret.is-reverse{transform:rotate(-180deg)}.el-select .el-input .el-select__caret.is-show-close{font-size:var(--el-select-font-size);text-align:center;transform:rotate(0);border-radius:var(--el-border-radius-circle);color:var(--el-select-input-color);transition:var(--el-transition-color)}.el-select .el-input .el-select__caret.is-show-close:hover{color:var(--el-select-close-hover-color)}.el-select .el-input .el-select__caret.el-icon{position:relative;height:inherit;z-index:2}.el-select .el-input.is-disabled .el-input__wrapper{cursor:not-allowed}.el-select .el-input.is-disabled .el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-select-disabled-border) inset}.el-select .el-input.is-disabled .el-input__inner,.el-select .el-input.is-disabled .el-select__caret{cursor:not-allowed}.el-select .el-input.is-focus .el-input__wrapper{box-shadow:0 0 0 1px var(--el-select-input-focus-border-color) inset!important}.el-select__input{border:none;outline:0;padding:0;margin-left:15px;color:var(--el-select-multiple-input-color);font-size:var(--el-select-font-size);-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px;background-color:transparent}.el-select__input.is-disabled{cursor:not-allowed}.el-select__input--iOS{position:absolute;left:0;top:0;z-index:6}.el-select__input.is-small{height:14px}.el-select__close{cursor:pointer;position:absolute;top:8px;z-index:var(--el-index-top);right:25px;color:var(--el-select-input-color);line-height:18px;font-size:var(--el-select-input-font-size)}.el-select__close:hover{color:var(--el-select-close-hover-color)}.el-select__tags{position:absolute;line-height:normal;top:50%;transform:translateY(-50%);white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;cursor:pointer}.el-select__tags .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 6px 2px 0}.el-select__tags .el-tag:last-child{margin-right:0}.el-select__tags .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;top:0;color:#fff}.el-select__tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select__tags .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select__tags .el-tag--info{background-color:var(--el-fill-color)}.el-select__tags.is-disabled{cursor:not-allowed}.el-select__collapse-tags{white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;cursor:pointer}.el-select__collapse-tags .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 6px 2px 0}.el-select__collapse-tags .el-tag:last-child{margin-right:0}.el-select__collapse-tags .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;top:0;color:#fff}.el-select__collapse-tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select__collapse-tags .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select__collapse-tags .el-tag--info{background-color:var(--el-fill-color)}.el-select__collapse-tag{line-height:inherit;height:inherit;display:flex}.el-skeleton{--el-skeleton-circle-size:var(--el-avatar-size)}.el-skeleton__item{background:var(--el-skeleton-color);display:inline-block;height:16px;border-radius:var(--el-border-radius-base);width:100%}.el-skeleton__circle{border-radius:50%;width:var(--el-skeleton-circle-size);height:var(--el-skeleton-circle-size);line-height:var(--el-skeleton-circle-size)}.el-skeleton__button{height:40px;width:64px;border-radius:4px}.el-skeleton__p{width:100%}.el-skeleton__p.is-last{width:61%}.el-skeleton__p.is-first{width:33%}.el-skeleton__text{width:100%;height:var(--el-font-size-small)}.el-skeleton__caption{height:var(--el-font-size-extra-small)}.el-skeleton__h1{height:var(--el-font-size-extra-large)}.el-skeleton__h3{height:var(--el-font-size-large)}.el-skeleton__h5{height:var(--el-font-size-medium)}.el-skeleton__image{width:unset;display:flex;align-items:center;justify-content:center;border-radius:0}.el-skeleton__image svg{color:var(--el-svg-monochrome-grey);fill:currentColor;width:22%;height:22%}.el-skeleton{--el-skeleton-color:var(--el-fill-color);--el-skeleton-to-color:var(--el-fill-color-darker)}@-webkit-keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}@keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}.el-skeleton{width:100%}.el-skeleton__first-line,.el-skeleton__paragraph{height:16px;margin-top:16px;background:var(--el-skeleton-color)}.el-skeleton.is-animated .el-skeleton__item{background:linear-gradient(90deg,var(--el-skeleton-color) 25%,var(--el-skeleton-to-color) 37%,var(--el-skeleton-color) 63%);background-size:400% 100%;-webkit-animation:el-skeleton-loading 1.4s ease infinite;animation:el-skeleton-loading 1.4s ease infinite}.el-slider{--el-slider-main-bg-color:var(--el-color-primary);--el-slider-runway-bg-color:var(--el-border-color-light);--el-slider-stop-bg-color:var(--el-color-white);--el-slider-disabled-color:var(--el-text-color-placeholder);--el-slider-border-radius:3px;--el-slider-height:6px;--el-slider-button-size:20px;--el-slider-button-wrapper-size:36px;--el-slider-button-wrapper-offset:-15px}.el-slider{width:100%;height:32px;display:flex;align-items:center}.el-slider__runway{flex:1;height:var(--el-slider-height);background-color:var(--el-slider-runway-bg-color);border-radius:var(--el-slider-border-radius);position:relative;cursor:pointer}.el-slider__runway.show-input{margin-right:30px;width:auto}.el-slider__runway.is-disabled{cursor:default}.el-slider__runway.is-disabled .el-slider__bar{background-color:var(--el-slider-disabled-color)}.el-slider__runway.is-disabled .el-slider__button{border-color:var(--el-slider-disabled-color)}.el-slider__runway.is-disabled .el-slider__button-wrapper.hover,.el-slider__runway.is-disabled .el-slider__button-wrapper:hover,.el-slider__runway.is-disabled .el-slider__button-wrapper.dragging{cursor:not-allowed}.el-slider__runway.is-disabled .el-slider__button.dragging,.el-slider__runway.is-disabled .el-slider__button.hover,.el-slider__runway.is-disabled .el-slider__button:hover{transform:scale(1)}.el-slider__runway.is-disabled .el-slider__button.hover,.el-slider__runway.is-disabled .el-slider__button:hover,.el-slider__runway.is-disabled .el-slider__button.dragging{cursor:not-allowed}.el-slider__input{flex-shrink:0;width:130px}.el-slider__bar{height:var(--el-slider-height);background-color:var(--el-slider-main-bg-color);border-top-left-radius:var(--el-slider-border-radius);border-bottom-left-radius:var(--el-slider-border-radius);position:absolute}.el-slider__button-wrapper{height:var(--el-slider-button-wrapper-size);width:var(--el-slider-button-wrapper-size);position:absolute;z-index:1;top:var(--el-slider-button-wrapper-offset);transform:translate(-50%);background-color:transparent;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:normal;outline:0}.el-slider__button-wrapper:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-slider__button-wrapper.hover,.el-slider__button-wrapper:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button-wrapper.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__button{display:inline-block;width:var(--el-slider-button-size);height:var(--el-slider-button-size);vertical-align:middle;border:solid 2px var(--el-slider-main-bg-color);background-color:var(--el-color-white);border-radius:50%;box-sizing:border-box;transition:var(--el-transition-duration-fast);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-slider__button.dragging,.el-slider__button.hover,.el-slider__button:hover{transform:scale(1.2)}.el-slider__button.hover,.el-slider__button:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__stop{position:absolute;height:var(--el-slider-height);width:var(--el-slider-height);border-radius:var(--el-border-radius-circle);background-color:var(--el-slider-stop-bg-color);transform:translate(-50%)}.el-slider__marks{top:0;left:12px;width:18px;height:100%}.el-slider__marks-text{position:absolute;transform:translate(-50%);font-size:14px;color:var(--el-color-info);margin-top:15px;white-space:pre}.el-slider.is-vertical{position:relative;display:inline-flex;width:auto;height:100%;flex:0}.el-slider.is-vertical .el-slider__runway{width:var(--el-slider-height);height:100%;margin:0 16px}.el-slider.is-vertical .el-slider__bar{width:var(--el-slider-height);height:auto;border-radius:0 0 3px 3px}.el-slider.is-vertical .el-slider__button-wrapper{top:auto;left:var(--el-slider-button-wrapper-offset);transform:translateY(50%)}.el-slider.is-vertical .el-slider__stop{transform:translateY(50%)}.el-slider.is-vertical .el-slider__marks-text{margin-top:0;left:15px;transform:translateY(50%)}.el-slider--large{height:40px}.el-slider--small{height:24px}.el-space{display:inline-flex;vertical-align:top}.el-space__item{display:flex;flex-wrap:wrap}.el-space__item>*{flex:1}.el-space--vertical{flex-direction:column}.el-time-spinner{width:100%;white-space:nowrap}.el-spinner{display:inline-block;vertical-align:middle}.el-spinner-inner{-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite;width:50px;height:50px}.el-spinner-inner .path{stroke:var(--el-border-color-lighter);stroke-linecap:round;-webkit-animation:dash 1.5s ease-in-out infinite;animation:dash 1.5s ease-in-out infinite}@-webkit-keyframes rotate{to{transform:rotate(360deg)}}@keyframes rotate{to{transform:rotate(360deg)}}@-webkit-keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}.el-step{position:relative;flex-shrink:1}.el-step:last-of-type .el-step__line{display:none}.el-step:last-of-type.is-flex{flex-basis:auto!important;flex-shrink:0;flex-grow:0}.el-step:last-of-type .el-step__description,.el-step:last-of-type .el-step__main{padding-right:0}.el-step__head{position:relative;width:100%}.el-step__head.is-process{color:var(--el-text-color-primary);border-color:var(--el-text-color-primary)}.el-step__head.is-wait{color:var(--el-text-color-placeholder);border-color:var(--el-text-color-placeholder)}.el-step__head.is-success{color:var(--el-color-success);border-color:var(--el-color-success)}.el-step__head.is-error{color:var(--el-color-danger);border-color:var(--el-color-danger)}.el-step__head.is-finish{color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-step__icon{position:relative;z-index:1;display:inline-flex;justify-content:center;align-items:center;width:24px;height:24px;font-size:14px;box-sizing:border-box;background:var(--el-bg-color);transition:.15s ease-out}.el-step__icon.is-text{border-radius:50%;border:2px solid;border-color:inherit}.el-step__icon.is-icon{width:40px}.el-step__icon-inner{display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:center;font-weight:700;line-height:1;color:inherit}.el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:25px;font-weight:400}.el-step__icon-inner.is-status{transform:translateY(1px)}.el-step__line{position:absolute;border-color:inherit;background-color:var(--el-text-color-placeholder)}.el-step__line-inner{display:block;border-width:1px;border-style:solid;border-color:inherit;transition:.15s ease-out;box-sizing:border-box;width:0;height:0}.el-step__main{white-space:normal;text-align:left}.el-step__title{font-size:16px;line-height:38px}.el-step__title.is-process{font-weight:700;color:var(--el-text-color-primary)}.el-step__title.is-wait{color:var(--el-text-color-placeholder)}.el-step__title.is-success{color:var(--el-color-success)}.el-step__title.is-error{color:var(--el-color-danger)}.el-step__title.is-finish{color:var(--el-color-primary)}.el-step__description{padding-right:10%;margin-top:-5px;font-size:12px;line-height:20px;font-weight:400}.el-step__description.is-process{color:var(--el-text-color-primary)}.el-step__description.is-wait{color:var(--el-text-color-placeholder)}.el-step__description.is-success{color:var(--el-color-success)}.el-step__description.is-error{color:var(--el-color-danger)}.el-step__description.is-finish{color:var(--el-color-primary)}.el-step.is-horizontal{display:inline-block}.el-step.is-horizontal .el-step__line{height:2px;top:11px;left:0;right:0}.el-step.is-vertical{display:flex}.el-step.is-vertical .el-step__head{flex-grow:0;width:24px}.el-step.is-vertical .el-step__main{padding-left:10px;flex-grow:1}.el-step.is-vertical .el-step__title{line-height:24px;padding-bottom:8px}.el-step.is-vertical .el-step__line{width:2px;top:0;bottom:0;left:11px}.el-step.is-vertical .el-step__icon.is-icon{width:24px}.el-step.is-center .el-step__head,.el-step.is-center .el-step__main{text-align:center}.el-step.is-center .el-step__description{padding-left:20%;padding-right:20%}.el-step.is-center .el-step__line{left:50%;right:-50%}.el-step.is-simple{display:flex;align-items:center}.el-step.is-simple .el-step__head{width:auto;font-size:0;padding-right:10px}.el-step.is-simple .el-step__icon{background:0 0;width:16px;height:16px;font-size:12px}.el-step.is-simple .el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:18px}.el-step.is-simple .el-step__icon-inner.is-status{transform:scale(.8) translateY(1px)}.el-step.is-simple .el-step__main{position:relative;display:flex;align-items:stretch;flex-grow:1}.el-step.is-simple .el-step__title{font-size:16px;line-height:20px}.el-step.is-simple:not(:last-of-type) .el-step__title{max-width:50%;word-break:break-all}.el-step.is-simple .el-step__arrow{flex-grow:1;display:flex;align-items:center;justify-content:center}.el-step.is-simple .el-step__arrow:after,.el-step.is-simple .el-step__arrow:before{content:"";display:inline-block;position:absolute;height:15px;width:1px;background:var(--el-text-color-placeholder)}.el-step.is-simple .el-step__arrow:before{transform:rotate(-45deg) translateY(-4px);transform-origin:0 0}.el-step.is-simple .el-step__arrow:after{transform:rotate(45deg) translateY(4px);transform-origin:100% 100%}.el-step.is-simple:last-of-type .el-step__arrow{display:none}.el-steps{display:flex}.el-steps--simple{padding:13px 8%;border-radius:4px;background:var(--el-fill-color-light)}.el-steps--horizontal{white-space:nowrap}.el-steps--vertical{height:100%;flex-flow:column}.el-switch{--el-switch-on-color:var(--el-color-primary);--el-switch-off-color:var(--el-border-color)}.el-switch{display:inline-flex;align-items:center;position:relative;font-size:14px;line-height:20px;height:32px;vertical-align:middle}.el-switch.is-disabled .el-switch__core,.el-switch.is-disabled .el-switch__label{cursor:not-allowed}.el-switch__label{transition:var(--el-transition-duration-fast);height:20px;display:inline-block;font-size:14px;font-weight:500;cursor:pointer;vertical-align:middle;color:var(--el-text-color-primary)}.el-switch__label.is-active{color:var(--el-color-primary)}.el-switch__label--left{margin-right:10px}.el-switch__label--right{margin-left:10px}.el-switch__label *{line-height:1;font-size:14px;display:inline-block}.el-switch__label .el-icon{height:inherit}.el-switch__label .el-icon svg{vertical-align:middle}.el-switch__input{position:absolute;width:0;height:0;opacity:0;margin:0}.el-switch__input:focus-visible~.el-switch__core{outline:2px solid var(--el-switch-on-color);outline-offset:1px}.el-switch__core{display:inline-flex;position:relative;align-items:center;min-width:40px;height:20px;border:1px solid var(--el-switch-border-color,var(--el-switch-off-color));outline:0;border-radius:10px;box-sizing:border-box;background:var(--el-switch-off-color);cursor:pointer;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration)}.el-switch__core .el-switch__inner{width:100%;transition:all var(--el-transition-duration);height:16px;display:flex;justify-content:center;align-items:center;overflow:hidden;padding:0 4px 0 18px}.el-switch__core .el-switch__inner .is-icon,.el-switch__core .el-switch__inner .is-text{font-size:12px;color:var(--el-color-white);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-switch__core .el-switch__action{position:absolute;left:1px;border-radius:var(--el-border-radius-circle);transition:all var(--el-transition-duration);width:16px;height:16px;background-color:var(--el-color-white);display:flex;justify-content:center;align-items:center;color:var(--el-switch-off-color)}.el-switch.is-checked .el-switch__core{border-color:var(--el-switch-border-color,var(--el-switch-on-color));background-color:var(--el-switch-on-color)}.el-switch.is-checked .el-switch__core .el-switch__action{left:calc(100% - 17px);color:var(--el-switch-on-color)}.el-switch.is-checked .el-switch__core .el-switch__inner{padding:0 18px 0 4px}.el-switch.is-disabled{opacity:.6}.el-switch--wide .el-switch__label.el-switch__label--left span{left:10px}.el-switch--wide .el-switch__label.el-switch__label--right span{right:10px}.el-switch .label-fade-enter-from,.el-switch .label-fade-leave-active{opacity:0}.el-switch--large{font-size:14px;line-height:24px;height:40px}.el-switch--large .el-switch__label{height:24px;font-size:14px}.el-switch--large .el-switch__label *{font-size:14px}.el-switch--large .el-switch__core{min-width:50px;height:24px;border-radius:12px}.el-switch--large .el-switch__core .el-switch__inner{height:20px;padding:0 6px 0 22px}.el-switch--large .el-switch__core .el-switch__action{width:20px;height:20px}.el-switch--large.is-checked .el-switch__core .el-switch__action{left:calc(100% - 21px)}.el-switch--large.is-checked .el-switch__core .el-switch__inner{padding:0 22px 0 6px}.el-switch--small{font-size:12px;line-height:16px;height:24px}.el-switch--small .el-switch__label{height:16px;font-size:12px}.el-switch--small .el-switch__label *{font-size:12px}.el-switch--small .el-switch__core{min-width:30px;height:16px;border-radius:8px}.el-switch--small .el-switch__core .el-switch__inner{height:12px;padding:0 2px 0 14px}.el-switch--small .el-switch__core .el-switch__action{width:12px;height:12px}.el-switch--small.is-checked .el-switch__core .el-switch__action{left:calc(100% - 13px)}.el-switch--small.is-checked .el-switch__core .el-switch__inner{padding:0 14px 0 2px}.el-table-column--selection .cell{padding-left:14px;padding-right:14px}.el-table-filter{border:solid 1px var(--el-border-color-lighter);border-radius:2px;background-color:#fff;box-shadow:var(--el-box-shadow-light);box-sizing:border-box}.el-table-filter__list{padding:5px 0;margin:0;list-style:none;min-width:100px}.el-table-filter__list-item{line-height:36px;padding:0 10px;cursor:pointer;font-size:var(--el-font-size-base)}.el-table-filter__list-item:hover{background-color:var(--el-color-primary-light-9);color:var(--el-color-primary)}.el-table-filter__list-item.is-active{background-color:var(--el-color-primary);color:#fff}.el-table-filter__content{min-width:100px}.el-table-filter__bottom{border-top:1px solid var(--el-border-color-lighter);padding:8px}.el-table-filter__bottom button{background:0 0;border:none;color:var(--el-text-color-regular);cursor:pointer;font-size:var(--el-font-size-small);padding:0 3px}.el-table-filter__bottom button:hover{color:var(--el-color-primary)}.el-table-filter__bottom button:focus{outline:0}.el-table-filter__bottom button.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-table-filter__wrap{max-height:280px}.el-table-filter__checkbox-group{padding:10px}.el-table-filter__checkbox-group label.el-checkbox{display:flex;align-items:center;margin-right:5px;margin-bottom:12px;margin-left:5px;height:unset}.el-table-filter__checkbox-group .el-checkbox:last-child{margin-bottom:0}.el-table{--el-table-border-color:var(--el-border-color-lighter);--el-table-border:1px solid var(--el-table-border-color);--el-table-text-color:var(--el-text-color-regular);--el-table-header-text-color:var(--el-text-color-secondary);--el-table-row-hover-bg-color:var(--el-fill-color-light);--el-table-current-row-bg-color:var(--el-color-primary-light-9);--el-table-header-bg-color:var(--el-bg-color);--el-table-fixed-box-shadow:var(--el-box-shadow-light);--el-table-bg-color:var(--el-fill-color-blank);--el-table-tr-bg-color:var(--el-fill-color-blank);--el-table-expanded-cell-bg-color:var(--el-fill-color-blank);--el-table-fixed-left-column:inset 10px 0 10px -10px rgba(0, 0, 0, .15);--el-table-fixed-right-column:inset -10px 0 10px -10px rgba(0, 0, 0, .15)}.el-table{position:relative;overflow:hidden;box-sizing:border-box;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:100%;max-width:100%;background-color:var(--el-table-bg-color);font-size:14px;color:var(--el-table-text-color)}.el-table__inner-wrapper{position:relative;display:flex;flex-direction:column;height:100%}.el-table__inner-wrapper:before{left:0;bottom:0;width:100%;height:1px}.el-table.has-footer.el-table--fluid-height tr:last-child td.el-table__cell,.el-table.has-footer.el-table--scrollable-y tr:last-child td.el-table__cell{border-bottom-color:transparent}.el-table__empty-block{position:-webkit-sticky;position:sticky;left:0;min-height:60px;text-align:center;width:100%;display:flex;justify-content:center;align-items:center}.el-table__empty-text{line-height:60px;width:50%;color:var(--el-text-color-secondary)}.el-table__expand-column .cell{padding:0;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-table__expand-icon{position:relative;cursor:pointer;color:var(--el-text-color-regular);font-size:12px;transition:transform var(--el-transition-duration-fast) ease-in-out;height:20px}.el-table__expand-icon--expanded{transform:rotate(90deg)}.el-table__expand-icon>.el-icon{font-size:12px}.el-table__expanded-cell{background-color:var(--el-table-expanded-cell-bg-color)}.el-table__expanded-cell[class*=cell]{padding:20px 50px}.el-table__expanded-cell:hover{background-color:transparent!important}.el-table__placeholder{display:inline-block;width:20px}.el-table__append-wrapper{overflow:hidden}.el-table--fit{border-right:0;border-bottom:0}.el-table--fit .el-table__cell.gutter{border-right-width:1px}.el-table thead{color:var(--el-table-header-text-color);font-weight:500}.el-table thead.is-group th.el-table__cell{background:var(--el-fill-color-light)}.el-table .el-table__cell{padding:8px 0;min-width:0;box-sizing:border-box;text-overflow:ellipsis;vertical-align:middle;position:relative;text-align:left;z-index:1}.el-table .el-table__cell.is-center{text-align:center}.el-table .el-table__cell.is-right{text-align:right}.el-table .el-table__cell.gutter{width:15px;border-right-width:0;border-bottom-width:0;padding:0}.el-table .el-table__cell.is-hidden>*{visibility:hidden}.el-table .cell{box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:normal;word-break:break-all;line-height:23px;padding:0 12px}.el-table .cell.el-tooltip{white-space:nowrap;min-width:50px}.el-table--large{font-size:var(--el-font-size-base)}.el-table--large .el-table__cell{padding:12px 0}.el-table--large .cell{padding:0 16px}.el-table--default{font-size:14px}.el-table--default .el-table__cell{padding:8px 0}.el-table--default .cell{padding:0 12px}.el-table--small{font-size:12px}.el-table--small .el-table__cell{padding:4px 0}.el-table--small .cell{padding:0 8px}.el-table tr{background-color:var(--el-table-tr-bg-color)}.el-table tr input[type=checkbox]{margin:0}.el-table td.el-table__cell,.el-table th.el-table__cell.is-leaf{border-bottom:var(--el-table-border)}.el-table th.el-table__cell.is-sortable{cursor:pointer}.el-table th.el-table__cell{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:var(--el-table-header-bg-color)}.el-table th.el-table__cell>.cell.highlight{color:var(--el-color-primary)}.el-table th.el-table__cell.required>div:before{display:inline-block;content:"";width:8px;height:8px;border-radius:50%;background:#ff4d51;margin-right:5px;vertical-align:middle}.el-table td.el-table__cell div{box-sizing:border-box}.el-table td.el-table__cell.gutter{width:0}.el-table__footer-wrapper{border-top:var(--el-table-border)}.el-table--border .el-table__inner-wrapper:after,.el-table--border:after,.el-table--border:before,.el-table__inner-wrapper:before{content:"";position:absolute;background-color:var(--el-table-border-color);z-index:3}.el-table--border .el-table__inner-wrapper:after{left:0;top:0;width:100%;height:1px}.el-table--border:before{top:-1px;left:0;width:1px;height:100%}.el-table--border:after{top:-1px;right:0;width:1px;height:100%}.el-table--border .el-table__inner-wrapper{border-right:none;border-bottom:none}.el-table--border .el-table__footer-wrapper{position:relative;flex-shrink:0}.el-table--border .el-table__cell{border-right:var(--el-table-border)}.el-table--border th.el-table__cell.gutter:last-of-type{border-bottom:var(--el-table-border);border-bottom-width:1px}.el-table--border th.el-table__cell{border-bottom:var(--el-table-border)}.el-table--hidden{visibility:hidden}.el-table__body-wrapper,.el-table__footer-wrapper,.el-table__header-wrapper{width:100%}.el-table__body-wrapper tr td.el-table-fixed-column--left,.el-table__body-wrapper tr td.el-table-fixed-column--right,.el-table__body-wrapper tr th.el-table-fixed-column--left,.el-table__body-wrapper tr th.el-table-fixed-column--right,.el-table__footer-wrapper tr td.el-table-fixed-column--left,.el-table__footer-wrapper tr td.el-table-fixed-column--right,.el-table__footer-wrapper tr th.el-table-fixed-column--left,.el-table__footer-wrapper tr th.el-table-fixed-column--right,.el-table__header-wrapper tr td.el-table-fixed-column--left,.el-table__header-wrapper tr td.el-table-fixed-column--right,.el-table__header-wrapper tr th.el-table-fixed-column--left,.el-table__header-wrapper tr th.el-table-fixed-column--right{position:-webkit-sticky!important;position:sticky!important;z-index:2;background:var(--el-bg-color)}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-last-column:before{content:"";position:absolute;top:0;width:10px;bottom:-1px;overflow-x:hidden;overflow-y:hidden;box-shadow:none;touch-action:none;pointer-events:none}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-first-column:before{left:-10px}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-last-column:before{right:-10px;box-shadow:none}.el-table__body-wrapper tr td.el-table__fixed-right-patch,.el-table__body-wrapper tr th.el-table__fixed-right-patch,.el-table__footer-wrapper tr td.el-table__fixed-right-patch,.el-table__footer-wrapper tr th.el-table__fixed-right-patch,.el-table__header-wrapper tr td.el-table__fixed-right-patch,.el-table__header-wrapper tr th.el-table__fixed-right-patch{position:-webkit-sticky!important;position:sticky!important;z-index:2;background:#fff;right:0}.el-table__header-wrapper{flex-shrink:0}.el-table__header-wrapper tr th.el-table-fixed-column--left,.el-table__header-wrapper tr th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table__body,.el-table__footer,.el-table__header{table-layout:fixed;border-collapse:separate}.el-table__footer-wrapper,.el-table__header-wrapper{overflow:hidden}.el-table__footer-wrapper tbody td.el-table__cell,.el-table__header-wrapper tbody td.el-table__cell{background-color:var(--el-table-row-hover-bg-color);color:var(--el-table-text-color)}.el-table__body-wrapper .el-table-column--selection>.cell,.el-table__header-wrapper .el-table-column--selection>.cell{display:inline-flex;align-items:center;height:23px}.el-table__body-wrapper .el-table-column--selection .el-checkbox,.el-table__header-wrapper .el-table-column--selection .el-checkbox{height:unset}.el-table.is-scrolling-left .el-table-fixed-column--right.is-first-column:before{box-shadow:var(--el-table-fixed-right-column)}.el-table.is-scrolling-left.el-table--border .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:var(--el-table-border)}.el-table.is-scrolling-left th.el-table-fixed-column--left{background-color:var(--el-table-header-bg-color)}.el-table.is-scrolling-right .el-table-fixed-column--left.is-last-column:before{box-shadow:var(--el-table-fixed-left-column)}.el-table.is-scrolling-right .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:none}.el-table.is-scrolling-right th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table.is-scrolling-middle .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:none}.el-table.is-scrolling-middle .el-table-fixed-column--right.is-first-column:before{box-shadow:var(--el-table-fixed-right-column)}.el-table.is-scrolling-middle .el-table-fixed-column--left.is-last-column:before{box-shadow:var(--el-table-fixed-left-column)}.el-table.is-scrolling-none .el-table-fixed-column--left.is-first-column:before,.el-table.is-scrolling-none .el-table-fixed-column--left.is-last-column:before,.el-table.is-scrolling-none .el-table-fixed-column--right.is-first-column:before,.el-table.is-scrolling-none .el-table-fixed-column--right.is-last-column:before{box-shadow:none}.el-table.is-scrolling-none th.el-table-fixed-column--left,.el-table.is-scrolling-none th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table__body-wrapper{overflow:hidden;position:relative;flex:1}.el-table__body-wrapper .el-scrollbar__bar{z-index:2}.el-table .caret-wrapper{display:inline-flex;flex-direction:column;align-items:center;height:14px;width:24px;vertical-align:middle;cursor:pointer;overflow:initial;position:relative}.el-table .sort-caret{width:0;height:0;border:solid 5px transparent;position:absolute;left:7px}.el-table .sort-caret.ascending{border-bottom-color:var(--el-text-color-placeholder);top:-5px}.el-table .sort-caret.descending{border-top-color:var(--el-text-color-placeholder);bottom:-3px}.el-table .ascending .sort-caret.ascending{border-bottom-color:var(--el-color-primary)}.el-table .descending .sort-caret.descending{border-top-color:var(--el-color-primary)}.el-table .hidden-columns{visibility:hidden;position:absolute;z-index:-1}.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{background:var(--el-fill-color-lighter)}.el-table--striped .el-table__body tr.el-table__row--striped.current-row td.el-table__cell{background-color:var(--el-table-current-row-bg-color)}.el-table__body tr.hover-row.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped>td.el-table__cell,.el-table__body tr.hover-row>td.el-table__cell{background-color:var(--el-table-row-hover-bg-color)}.el-table__body tr.current-row>td.el-table__cell{background-color:var(--el-table-current-row-bg-color)}.el-table__column-resize-proxy{position:absolute;left:200px;top:0;bottom:0;width:0;border-left:var(--el-table-border);z-index:10}.el-table__column-filter-trigger{display:inline-block;cursor:pointer}.el-table__column-filter-trigger i{color:var(--el-color-info);font-size:14px;vertical-align:middle}.el-table__border-left-patch{top:0;left:0;width:1px;height:100%;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table__border-bottom-patch{left:0;height:1px;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table__border-right-patch{top:0;height:100%;width:1px;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table--enable-row-transition .el-table__body td.el-table__cell{transition:background-color .25s ease}.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{background-color:var(--el-table-row-hover-bg-color)}.el-table [class*=el-table__row--level] .el-table__expand-icon{display:inline-block;width:12px;line-height:12px;height:12px;text-align:center;margin-right:8px}.el-table .el-table.el-table--border .el-table__cell{border-right:var(--el-table-border)}.el-table:not(.el-table--border) .el-table__cell{border-right:none}.el-table:not(.el-table--border)>.el-table__inner-wrapper:after{content:none}.el-table-v2{--el-table-border-color:var(--el-border-color-lighter);--el-table-border:1px solid var(--el-table-border-color);--el-table-text-color:var(--el-text-color-regular);--el-table-header-text-color:var(--el-text-color-secondary);--el-table-row-hover-bg-color:var(--el-fill-color-light);--el-table-current-row-bg-color:var(--el-color-primary-light-9);--el-table-header-bg-color:var(--el-bg-color);--el-table-fixed-box-shadow:var(--el-box-shadow-light);--el-table-bg-color:var(--el-fill-color-blank);--el-table-tr-bg-color:var(--el-fill-color-blank);--el-table-expanded-cell-bg-color:var(--el-fill-color-blank);--el-table-fixed-left-column:inset 10px 0 10px -10px rgba(0, 0, 0, .15);--el-table-fixed-right-column:inset -10px 0 10px -10px rgba(0, 0, 0, .15)}.el-table-v2{font-size:14px}.el-table-v2 *{box-sizing:border-box}.el-table-v2__root{position:relative}.el-table-v2__root:hover .el-table-v2__main .el-virtual-scrollbar{opacity:1}.el-table-v2__main{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);left:0}.el-table-v2__main .el-vl__horizontal,.el-table-v2__main .el-vl__vertical{z-index:2}.el-table-v2__left{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);left:0;box-shadow:2px 0 4px #0000000f}.el-table-v2__left .el-virtual-scrollbar{opacity:0}.el-table-v2__left .el-vl__horizontal,.el-table-v2__left .el-vl__vertical{z-index:-1}.el-table-v2__right{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);right:0;box-shadow:-2px 0 4px #0000000f}.el-table-v2__right .el-virtual-scrollbar{opacity:0}.el-table-v2__right .el-vl__horizontal,.el-table-v2__right .el-vl__vertical{z-index:-1}.el-table-v2__header-row,.el-table-v2__row{-webkit-padding-end:var(--el-table-scrollbar-size);padding-inline-end:var(--el-table-scrollbar-size)}.el-table-v2__header-wrapper{overflow:hidden}.el-table-v2__header{position:relative;overflow:hidden}.el-table-v2__footer{position:absolute;left:0;right:0;bottom:0;overflow:hidden}.el-table-v2__empty{position:absolute;left:0}.el-table-v2__overlay{position:absolute;left:0;right:0;top:0;bottom:0;z-index:9999}.el-table-v2__header-row{display:flex;border-bottom:var(--el-table-border)}.el-table-v2__header-cell{display:flex;align-items:center;padding:0 8px;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;background-color:var(--el-table-header-bg-color);color:var(--el-table-header-text-color);font-weight:700}.el-table-v2__header-cell.is-align-center{justify-content:center;text-align:center}.el-table-v2__header-cell.is-align-right{justify-content:flex-end;text-align:right}.el-table-v2__header-cell.is-sortable{cursor:pointer}.el-table-v2__header-cell:hover .el-icon{display:block}.el-table-v2__sort-icon{transition:opacity,display var(--el-transition-duration);opacity:.6;display:none}.el-table-v2__sort-icon.is-sorting{display:block;opacity:1}.el-table-v2__row{border-bottom:var(--el-table-border);display:flex;align-items:center;transition:background-color var(--el-transition-duration)}.el-table-v2__row.is-hovered,.el-table-v2__row:hover{background-color:var(--el-table-row-hover-bg-color)}.el-table-v2__row-cell{height:100%;overflow:hidden;display:flex;align-items:center;padding:0 8px}.el-table-v2__row-cell.is-align-center{justify-content:center;text-align:center}.el-table-v2__row-cell.is-align-right{justify-content:flex-end;text-align:right}.el-table-v2__expand-icon{margin:0 4px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-table-v2__expand-icon svg{transition:transform var(--el-transition-duration)}.el-table-v2__expand-icon.is-expanded svg{transform:rotate(90deg)}.el-table-v2:not(.is-dynamic) .el-table-v2__cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-table-v2.is-dynamic .el-table-v2__row{overflow:hidden;align-items:stretch}.el-table-v2.is-dynamic .el-table-v2__row .el-table-v2__row-cell{word-break:break-all}.el-tabs{--el-tabs-header-height:40px}.el-tabs__header{padding:0;position:relative;margin:0 0 15px}.el-tabs__active-bar{position:absolute;bottom:0;left:0;height:2px;background-color:var(--el-color-primary);z-index:1;transition:width var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier),transform var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);list-style:none}.el-tabs__new-tab{display:flex;align-items:center;justify-content:center;float:right;border:1px solid var(--el-border-color);height:20px;width:20px;line-height:20px;margin:10px 0 10px 10px;border-radius:3px;text-align:center;font-size:12px;color:var(--el-text-color-primary);cursor:pointer;transition:all .15s}.el-tabs__new-tab .is-icon-plus{height:inherit;width:inherit;transform:scale(.8)}.el-tabs__new-tab .is-icon-plus svg{vertical-align:middle}.el-tabs__new-tab:hover{color:var(--el-color-primary)}.el-tabs__nav-wrap{overflow:hidden;margin-bottom:-1px;position:relative}.el-tabs__nav-wrap:after{content:"";position:absolute;left:0;bottom:0;width:100%;height:2px;background-color:var(--el-border-color-light);z-index:var(--el-index-normal)}.el-tabs__nav-wrap.is-scrollable{padding:0 20px;box-sizing:border-box}.el-tabs__nav-scroll{overflow:hidden}.el-tabs__nav-next,.el-tabs__nav-prev{position:absolute;cursor:pointer;line-height:44px;font-size:12px;color:var(--el-text-color-secondary);width:20px;text-align:center}.el-tabs__nav-next{right:0}.el-tabs__nav-prev{left:0}.el-tabs__nav{display:flex;white-space:nowrap;position:relative;transition:transform var(--el-transition-duration);float:left;z-index:calc(var(--el-index-normal) + 1)}.el-tabs__nav.is-stretch{min-width:100%;display:flex}.el-tabs__nav.is-stretch>*{flex:1;text-align:center}.el-tabs__item{padding:0 20px;height:var(--el-tabs-header-height);box-sizing:border-box;display:flex;align-items:center;justify-content:center;list-style:none;font-size:var(--el-font-size-base);font-weight:500;color:var(--el-text-color-primary);position:relative}.el-tabs__item:focus,.el-tabs__item:focus:active{outline:0}.el-tabs__item:focus-visible{box-shadow:0 0 2px 2px var(--el-color-primary) inset;border-radius:3px}.el-tabs__item .is-icon-close{border-radius:50%;text-align:center;transition:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);margin-left:5px}.el-tabs__item .is-icon-close:before{transform:scale(.9);display:inline-block}.el-tabs__item .is-icon-close:hover{background-color:var(--el-text-color-placeholder);color:#fff}.el-tabs__item.is-active{color:var(--el-color-primary)}.el-tabs__item:hover{color:var(--el-color-primary);cursor:pointer}.el-tabs__item.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-tabs__content{overflow:hidden;position:relative}.el-tabs--card>.el-tabs__header{border-bottom:1px solid var(--el-border-color-light);height:var(--el-tabs-header-height)}.el-tabs--card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--card>.el-tabs__header .el-tabs__nav{border:1px solid var(--el-border-color-light);border-bottom:none;border-radius:4px 4px 0 0;box-sizing:border-box}.el-tabs--card>.el-tabs__header .el-tabs__active-bar{display:none}.el-tabs--card>.el-tabs__header .el-tabs__item .is-icon-close{position:relative;font-size:12px;width:0;height:14px;overflow:hidden;right:-2px;transform-origin:100% 50%}.el-tabs--card>.el-tabs__header .el-tabs__item{border-bottom:1px solid transparent;border-left:1px solid var(--el-border-color-light);transition:color var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier),padding var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier)}.el-tabs--card>.el-tabs__header .el-tabs__item:first-child{border-left:none}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover{padding-left:13px;padding-right:13px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover .is-icon-close{width:14px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active{border-bottom-color:var(--el-bg-color)}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable{padding-left:20px;padding-right:20px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable .is-icon-close{width:14px}.el-tabs--border-card{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color)}.el-tabs--border-card>.el-tabs__content{padding:15px}.el-tabs--border-card>.el-tabs__header{background-color:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color-light);margin:0}.el-tabs--border-card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--border-card>.el-tabs__header .el-tabs__item{transition:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);border:1px solid transparent;margin-top:-1px;color:var(--el-text-color-secondary)}.el-tabs--border-card>.el-tabs__header .el-tabs__item:first-child{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item+.el-tabs__item{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay);border-right-color:var(--el-border-color);border-left-color:var(--el-border-color)}.el-tabs--border-card>.el-tabs__header .el-tabs__item:not(.is-disabled):hover{color:var(--el-color-primary)}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-disabled{color:var(--el-disabled-text-color)}.el-tabs--border-card>.el-tabs__header .is-scrollable .el-tabs__item:first-child{margin-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:nth-child(2),.el-tabs--bottom .el-tabs__item.is-top:nth-child(2),.el-tabs--top .el-tabs__item.is-bottom:nth-child(2),.el-tabs--top .el-tabs__item.is-top:nth-child(2){padding-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:last-child,.el-tabs--bottom .el-tabs__item.is-top:last-child,.el-tabs--top .el-tabs__item.is-bottom:last-child,.el-tabs--top .el-tabs__item.is-top:last-child{padding-right:0}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2){padding-left:20px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover{padding-left:13px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child{padding-right:20px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover{padding-right:13px}.el-tabs--bottom .el-tabs__header.is-bottom{margin-bottom:0;margin-top:10px}.el-tabs--bottom.el-tabs--border-card .el-tabs__header.is-bottom{border-bottom:0;border-top:1px solid var(--el-border-color)}.el-tabs--bottom.el-tabs--border-card .el-tabs__nav-wrap.is-bottom{margin-top:-1px;margin-bottom:0}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom:not(.is-active){border:1px solid transparent}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom{margin:0 -1px -1px}.el-tabs--left,.el-tabs--right{overflow:hidden}.el-tabs--left .el-tabs__header.is-left,.el-tabs--left .el-tabs__header.is-right,.el-tabs--left .el-tabs__nav-scroll,.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__header.is-left,.el-tabs--right .el-tabs__header.is-right,.el-tabs--right .el-tabs__nav-scroll,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{height:100%}.el-tabs--left .el-tabs__active-bar.is-left,.el-tabs--left .el-tabs__active-bar.is-right,.el-tabs--right .el-tabs__active-bar.is-left,.el-tabs--right .el-tabs__active-bar.is-right{top:0;bottom:auto;width:2px;height:auto}.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{margin-bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{height:30px;line-height:30px;width:100%;text-align:center;cursor:pointer}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i{transform:rotate(90deg)}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{left:auto;top:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next{right:auto;bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--left .el-tabs__nav-wrap.is-right.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-right.is-scrollable{padding:30px 0}.el-tabs--left .el-tabs__nav-wrap.is-left:after,.el-tabs--left .el-tabs__nav-wrap.is-right:after,.el-tabs--right .el-tabs__nav-wrap.is-left:after,.el-tabs--right .el-tabs__nav-wrap.is-right:after{height:100%;width:2px;bottom:auto;top:0}.el-tabs--left .el-tabs__nav.is-left,.el-tabs--left .el-tabs__nav.is-right,.el-tabs--right .el-tabs__nav.is-left,.el-tabs--right .el-tabs__nav.is-right{flex-direction:column}.el-tabs--left .el-tabs__item.is-left,.el-tabs--right .el-tabs__item.is-left{justify-content:flex-end}.el-tabs--left .el-tabs__item.is-right,.el-tabs--right .el-tabs__item.is-right{justify-content:flex-start}.el-tabs--left .el-tabs__header.is-left{float:left;margin-bottom:0;margin-right:10px}.el-tabs--left .el-tabs__nav-wrap.is-left{margin-right:-1px}.el-tabs--left .el-tabs__nav-wrap.is-left:after{left:auto;right:0}.el-tabs--left .el-tabs__active-bar.is-left{right:0;left:auto}.el-tabs--left .el-tabs__item.is-left{text-align:right}.el-tabs--left.el-tabs--card .el-tabs__active-bar.is-left{display:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left{border-left:none;border-right:1px solid var(--el-border-color-light);border-bottom:none;border-top:1px solid var(--el-border-color-light);text-align:left}.el-tabs--left.el-tabs--card .el-tabs__item.is-left:first-child{border-right:1px solid var(--el-border-color-light);border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active{border:1px solid var(--el-border-color-light);border-right-color:#fff;border-left:none;border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:first-child{border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:last-child{border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__nav{border-radius:4px 0 0 4px;border-bottom:1px solid var(--el-border-color-light);border-right:none}.el-tabs--left.el-tabs--card .el-tabs__new-tab{float:none}.el-tabs--left.el-tabs--border-card .el-tabs__header.is-left{border-right:1px solid var(--el-border-color)}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left{border:1px solid transparent;margin:-1px 0 -1px -1px}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.el-tabs--right .el-tabs__header.is-right{float:right;margin-bottom:0;margin-left:10px}.el-tabs--right .el-tabs__nav-wrap.is-right{margin-left:-1px}.el-tabs--right .el-tabs__nav-wrap.is-right:after{left:0;right:auto}.el-tabs--right .el-tabs__active-bar.is-right{left:0}.el-tabs--right.el-tabs--card .el-tabs__active-bar.is-right{display:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right{border-bottom:none;border-top:1px solid var(--el-border-color-light)}.el-tabs--right.el-tabs--card .el-tabs__item.is-right:first-child{border-left:1px solid var(--el-border-color-light);border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active{border:1px solid var(--el-border-color-light);border-left-color:#fff;border-right:none;border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:first-child{border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:last-child{border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__nav{border-radius:0 4px 4px 0;border-bottom:1px solid var(--el-border-color-light);border-left:none}.el-tabs--right.el-tabs--border-card .el-tabs__header.is-right{border-left:1px solid var(--el-border-color)}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right{border:1px solid transparent;margin:-1px -1px -1px 0}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.slideInLeft-transition,.slideInRight-transition{display:inline-block}.slideInRight-enter{-webkit-animation:slideInRight-enter var(--el-transition-duration);animation:slideInRight-enter var(--el-transition-duration)}.slideInRight-leave{position:absolute;left:0;right:0;-webkit-animation:slideInRight-leave var(--el-transition-duration);animation:slideInRight-leave var(--el-transition-duration)}.slideInLeft-enter{-webkit-animation:slideInLeft-enter var(--el-transition-duration);animation:slideInLeft-enter var(--el-transition-duration)}.slideInLeft-leave{position:absolute;left:0;right:0;-webkit-animation:slideInLeft-leave var(--el-transition-duration);animation:slideInLeft-leave var(--el-transition-duration)}@-webkit-keyframes slideInRight-enter{0%{opacity:0;transform-origin:0 0;transform:translate(100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@keyframes slideInRight-enter{0%{opacity:0;transform-origin:0 0;transform:translate(100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@-webkit-keyframes slideInRight-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(100%);opacity:0}}@keyframes slideInRight-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(100%);opacity:0}}@-webkit-keyframes slideInLeft-enter{0%{opacity:0;transform-origin:0 0;transform:translate(-100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@keyframes slideInLeft-enter{0%{opacity:0;transform-origin:0 0;transform:translate(-100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@-webkit-keyframes slideInLeft-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(-100%);opacity:0}}@keyframes slideInLeft-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(-100%);opacity:0}}.el-tag{--el-tag-font-size:12px;--el-tag-border-radius:4px;--el-tag-border-radius-rounded:9999px}.el-tag{--el-tag-bg-color:var(--el-color-primary-light-9);--el-tag-border-color:var(--el-color-primary-light-8);--el-tag-hover-color:var(--el-color-primary);--el-tag-text-color:var(--el-color-primary);background-color:var(--el-tag-bg-color);border-color:var(--el-tag-border-color);color:var(--el-tag-text-color);display:inline-flex;justify-content:center;align-items:center;height:24px;padding:0 9px;font-size:var(--el-tag-font-size);line-height:1;border-width:1px;border-style:solid;border-radius:var(--el-tag-border-radius);box-sizing:border-box;white-space:nowrap;--el-icon-size:14px}.el-tag.el-tag--primary{--el-tag-bg-color:var(--el-color-primary-light-9);--el-tag-border-color:var(--el-color-primary-light-8);--el-tag-hover-color:var(--el-color-primary)}.el-tag.el-tag--success{--el-tag-bg-color:var(--el-color-success-light-9);--el-tag-border-color:var(--el-color-success-light-8);--el-tag-hover-color:var(--el-color-success)}.el-tag.el-tag--warning{--el-tag-bg-color:var(--el-color-warning-light-9);--el-tag-border-color:var(--el-color-warning-light-8);--el-tag-hover-color:var(--el-color-warning)}.el-tag.el-tag--danger{--el-tag-bg-color:var(--el-color-danger-light-9);--el-tag-border-color:var(--el-color-danger-light-8);--el-tag-hover-color:var(--el-color-danger)}.el-tag.el-tag--error{--el-tag-bg-color:var(--el-color-error-light-9);--el-tag-border-color:var(--el-color-error-light-8);--el-tag-hover-color:var(--el-color-error)}.el-tag.el-tag--info{--el-tag-bg-color:var(--el-color-info-light-9);--el-tag-border-color:var(--el-color-info-light-8);--el-tag-hover-color:var(--el-color-info)}.el-tag.el-tag--primary{--el-tag-text-color:var(--el-color-primary)}.el-tag.el-tag--success{--el-tag-text-color:var(--el-color-success)}.el-tag.el-tag--warning{--el-tag-text-color:var(--el-color-warning)}.el-tag.el-tag--danger{--el-tag-text-color:var(--el-color-danger)}.el-tag.el-tag--error{--el-tag-text-color:var(--el-color-error)}.el-tag.el-tag--info{--el-tag-text-color:var(--el-color-info)}.el-tag.is-hit{border-color:var(--el-color-primary)}.el-tag.is-round{border-radius:var(--el-tag-border-radius-rounded)}.el-tag .el-tag__close{color:var(--el-tag-text-color)}.el-tag .el-tag__close:hover{color:var(--el-color-white);background-color:var(--el-tag-hover-color)}.el-tag .el-icon{border-radius:50%;cursor:pointer;font-size:calc(var(--el-icon-size) - 2px);height:var(--el-icon-size);width:var(--el-icon-size)}.el-tag .el-tag__close{margin-left:6px}.el-tag--dark{--el-tag-bg-color:var(--el-color-primary);--el-tag-border-color:var(--el-color-primary);--el-tag-hover-color:var(--el-color-primary-light-3);--el-tag-text-color:var(--el-color-white)}.el-tag--dark.el-tag--primary{--el-tag-bg-color:var(--el-color-primary);--el-tag-border-color:var(--el-color-primary);--el-tag-hover-color:var(--el-color-primary-light-3)}.el-tag--dark.el-tag--success{--el-tag-bg-color:var(--el-color-success);--el-tag-border-color:var(--el-color-success);--el-tag-hover-color:var(--el-color-success-light-3)}.el-tag--dark.el-tag--warning{--el-tag-bg-color:var(--el-color-warning);--el-tag-border-color:var(--el-color-warning);--el-tag-hover-color:var(--el-color-warning-light-3)}.el-tag--dark.el-tag--danger{--el-tag-bg-color:var(--el-color-danger);--el-tag-border-color:var(--el-color-danger);--el-tag-hover-color:var(--el-color-danger-light-3)}.el-tag--dark.el-tag--error{--el-tag-bg-color:var(--el-color-error);--el-tag-border-color:var(--el-color-error);--el-tag-hover-color:var(--el-color-error-light-3)}.el-tag--dark.el-tag--info{--el-tag-bg-color:var(--el-color-info);--el-tag-border-color:var(--el-color-info);--el-tag-hover-color:var(--el-color-info-light-3)}.el-tag--dark.el-tag--primary,.el-tag--dark.el-tag--success,.el-tag--dark.el-tag--warning,.el-tag--dark.el-tag--danger,.el-tag--dark.el-tag--error,.el-tag--dark.el-tag--info{--el-tag-text-color:var(--el-color-white)}.el-tag--plain{--el-tag-border-color:var(--el-color-primary-light-5);--el-tag-hover-color:var(--el-color-primary);--el-tag-bg-color:var(--el-fill-color-blank)}.el-tag--plain.el-tag--primary{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-primary-light-5);--el-tag-hover-color:var(--el-color-primary)}.el-tag--plain.el-tag--success{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-success-light-5);--el-tag-hover-color:var(--el-color-success)}.el-tag--plain.el-tag--warning{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-warning-light-5);--el-tag-hover-color:var(--el-color-warning)}.el-tag--plain.el-tag--danger{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-danger-light-5);--el-tag-hover-color:var(--el-color-danger)}.el-tag--plain.el-tag--error{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-error-light-5);--el-tag-hover-color:var(--el-color-error)}.el-tag--plain.el-tag--info{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-info-light-5);--el-tag-hover-color:var(--el-color-info)}.el-tag.is-closable{padding-right:5px}.el-tag--large{padding:0 11px;height:32px;--el-icon-size:16px}.el-tag--large .el-tag__close{margin-left:8px}.el-tag--large.is-closable{padding-right:7px}.el-tag--small{padding:0 7px;height:20px;--el-icon-size:12px}.el-tag--small .el-tag__close{margin-left:4px}.el-tag--small.is-closable{padding-right:3px}.el-tag--small .el-icon-close{transform:scale(.8)}.el-tag.el-tag--primary.is-hit{border-color:var(--el-color-primary)}.el-tag.el-tag--success.is-hit{border-color:var(--el-color-success)}.el-tag.el-tag--warning.is-hit{border-color:var(--el-color-warning)}.el-tag.el-tag--danger.is-hit{border-color:var(--el-color-danger)}.el-tag.el-tag--error.is-hit{border-color:var(--el-color-error)}.el-tag.el-tag--info.is-hit{border-color:var(--el-color-info)}.el-text{--el-text-font-size:var(--el-font-size-base);--el-text-color:var(--el-text-color-regular)}.el-text{align-self:center;margin:0;padding:0;font-size:var(--el-text-font-size);color:var(--el-text-color);word-break:break-all}.el-text.is-truncated{display:inline-block;max-width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.el-text--large{--el-text-font-size:var(--el-font-size-medium)}.el-text--default{--el-text-font-size:var(--el-font-size-base)}.el-text--small{--el-text-font-size:var(--el-font-size-extra-small)}.el-text.el-text--primary{--el-text-color:var(--el-color-primary)}.el-text.el-text--success{--el-text-color:var(--el-color-success)}.el-text.el-text--warning{--el-text-color:var(--el-color-warning)}.el-text.el-text--danger{--el-text-color:var(--el-color-danger)}.el-text.el-text--error{--el-text-color:var(--el-color-error)}.el-text.el-text--info{--el-text-color:var(--el-color-info)}.el-text>.el-icon{vertical-align:-2px}.time-select{margin:5px 0;min-width:0}.time-select .el-picker-panel__content{max-height:200px;margin:0}.time-select-item{padding:8px 10px;font-size:14px;line-height:20px}.time-select-item.disabled{color:var(--el-datepicker-border-color);cursor:not-allowed}.time-select-item:hover{background-color:var(--el-fill-color-light);font-weight:700;cursor:pointer}.time-select .time-select-item.selected:not(.disabled){color:var(--el-color-primary);font-weight:700}.el-timeline-item{position:relative;padding-bottom:20px}.el-timeline-item__wrapper{position:relative;padding-left:28px;top:-3px}.el-timeline-item__tail{position:absolute;left:4px;height:100%;border-left:2px solid var(--el-timeline-node-color)}.el-timeline-item .el-timeline-item__icon{color:var(--el-color-white);font-size:var(--el-font-size-small)}.el-timeline-item__node{position:absolute;background-color:var(--el-timeline-node-color);border-color:var(--el-timeline-node-color);border-radius:50%;box-sizing:border-box;display:flex;justify-content:center;align-items:center}.el-timeline-item__node--normal{left:-1px;width:var(--el-timeline-node-size-normal);height:var(--el-timeline-node-size-normal)}.el-timeline-item__node--large{left:-2px;width:var(--el-timeline-node-size-large);height:var(--el-timeline-node-size-large)}.el-timeline-item__node.is-hollow{background:var(--el-color-white);border-style:solid;border-width:2px}.el-timeline-item__node--primary{background-color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-timeline-item__node--success{background-color:var(--el-color-success);border-color:var(--el-color-success)}.el-timeline-item__node--warning{background-color:var(--el-color-warning);border-color:var(--el-color-warning)}.el-timeline-item__node--danger{background-color:var(--el-color-danger);border-color:var(--el-color-danger)}.el-timeline-item__node--info{background-color:var(--el-color-info);border-color:var(--el-color-info)}.el-timeline-item__dot{position:absolute;display:flex;justify-content:center;align-items:center}.el-timeline-item__content{color:var(--el-text-color-primary)}.el-timeline-item__timestamp{color:var(--el-text-color-secondary);line-height:1;font-size:var(--el-font-size-small)}.el-timeline-item__timestamp.is-top{margin-bottom:8px;padding-top:4px}.el-timeline-item__timestamp.is-bottom{margin-top:8px}.el-timeline{--el-timeline-node-size-normal:12px;--el-timeline-node-size-large:14px;--el-timeline-node-color:var(--el-border-color-light)}.el-timeline{margin:0;font-size:var(--el-font-size-base);list-style:none}.el-timeline .el-timeline-item:last-child .el-timeline-item__tail{display:none}.el-timeline .el-timeline-item__center{display:flex;align-items:center}.el-timeline .el-timeline-item__center .el-timeline-item__wrapper{width:100%}.el-timeline .el-timeline-item__center .el-timeline-item__tail{top:0}.el-timeline .el-timeline-item__center:first-child .el-timeline-item__tail{height:calc(50% + 10px);top:calc(50% - 10px)}.el-timeline .el-timeline-item__center:last-child .el-timeline-item__tail{display:block;height:calc(50% - 10px)}.el-tooltip-v2__content{--el-tooltip-v2-padding:5px 10px;--el-tooltip-v2-border-radius:4px;--el-tooltip-v2-border-color:var(--el-border-color);border-radius:var(--el-tooltip-v2-border-radius);color:var(--el-color-black);background-color:var(--el-color-white);padding:var(--el-tooltip-v2-padding);border:1px solid var(--el-border-color)}.el-tooltip-v2__arrow{position:absolute;color:var(--el-color-white);width:var(--el-tooltip-v2-arrow-width);height:var(--el-tooltip-v2-arrow-height);pointer-events:none;left:var(--el-tooltip-v2-arrow-x);top:var(--el-tooltip-v2-arrow-y)}.el-tooltip-v2__arrow:before{content:"";width:0;height:0;border:var(--el-tooltip-v2-arrow-border-width) solid transparent;position:absolute}.el-tooltip-v2__arrow:after{content:"";width:0;height:0;border:var(--el-tooltip-v2-arrow-border-width) solid transparent;position:absolute}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow{bottom:0}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow:before{border-top-color:var(--el-color-white);border-top-width:var(--el-tooltip-v2-arrow-border-width);border-bottom:0;top:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow:after{border-top-color:var(--el-border-color);border-top-width:var(--el-tooltip-v2-arrow-border-width);border-bottom:0;top:100%;z-index:-1}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow{top:0}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow:before{border-bottom-color:var(--el-color-white);border-bottom-width:var(--el-tooltip-v2-arrow-border-width);border-top:0;bottom:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow:after{border-bottom-color:var(--el-border-color);border-bottom-width:var(--el-tooltip-v2-arrow-border-width);border-top:0;bottom:100%;z-index:-1}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow{right:0}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow:before{border-left-color:var(--el-color-white);border-left-width:var(--el-tooltip-v2-arrow-border-width);border-right:0;left:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow:after{border-left-color:var(--el-border-color);border-left-width:var(--el-tooltip-v2-arrow-border-width);border-right:0;left:100%;z-index:-1}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow{left:0}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow:before{border-right-color:var(--el-color-white);border-right-width:var(--el-tooltip-v2-arrow-border-width);border-left:0;right:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow:after{border-right-color:var(--el-border-color);border-right-width:var(--el-tooltip-v2-arrow-border-width);border-left:0;right:100%;z-index:-1}.el-tooltip-v2__content.is-dark{--el-tooltip-v2-border-color:transparent;background-color:var(--el-color-black);color:var(--el-color-white);border-color:transparent}.el-tooltip-v2__content.is-dark .el-tooltip-v2__arrow{background-color:var(--el-color-black);border-color:transparent}.el-transfer{--el-transfer-border-color:var(--el-border-color-lighter);--el-transfer-border-radius:var(--el-border-radius-base);--el-transfer-panel-width:200px;--el-transfer-panel-header-height:40px;--el-transfer-panel-header-bg-color:var(--el-fill-color-light);--el-transfer-panel-footer-height:40px;--el-transfer-panel-body-height:278px;--el-transfer-item-height:30px;--el-transfer-filter-height:32px}.el-transfer{font-size:var(--el-font-size-base)}.el-transfer__buttons{display:inline-block;vertical-align:middle;padding:0 30px}.el-transfer__button{vertical-align:top}.el-transfer__button:nth-child(2){margin:0 0 0 10px}.el-transfer__button i,.el-transfer__button span{font-size:14px}.el-transfer__button .el-icon+span{margin-left:0}.el-transfer-panel{overflow:hidden;background:var(--el-bg-color-overlay);display:inline-block;text-align:left;vertical-align:middle;width:var(--el-transfer-panel-width);max-height:100%;box-sizing:border-box;position:relative}.el-transfer-panel__body{height:var(--el-transfer-panel-body-height);border-left:1px solid var(--el-transfer-border-color);border-right:1px solid var(--el-transfer-border-color);border-bottom:1px solid var(--el-transfer-border-color);border-bottom-left-radius:var(--el-transfer-border-radius);border-bottom-right-radius:var(--el-transfer-border-radius);overflow:hidden}.el-transfer-panel__body.is-with-footer{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.el-transfer-panel__list{margin:0;padding:6px 0;list-style:none;height:var(--el-transfer-panel-body-height);overflow:auto;box-sizing:border-box}.el-transfer-panel__list.is-filterable{height:calc(100% - var(--el-transfer-filter-height) - 30px);padding-top:0}.el-transfer-panel__item{height:var(--el-transfer-item-height);line-height:var(--el-transfer-item-height);padding-left:15px;display:block!important}.el-transfer-panel__item+.el-transfer-panel__item{margin-left:0}.el-transfer-panel__item.el-checkbox{color:var(--el-text-color-regular)}.el-transfer-panel__item:hover{color:var(--el-color-primary)}.el-transfer-panel__item.el-checkbox .el-checkbox__label{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;box-sizing:border-box;padding-left:22px;line-height:var(--el-transfer-item-height)}.el-transfer-panel__item .el-checkbox__input{position:absolute;top:8px}.el-transfer-panel__filter{text-align:center;padding:15px;box-sizing:border-box}.el-transfer-panel__filter .el-input__inner{height:var(--el-transfer-filter-height);width:100%;font-size:12px;display:inline-block;box-sizing:border-box;border-radius:calc(var(--el-transfer-filter-height)/ 2)}.el-transfer-panel__filter .el-icon-circle-close{cursor:pointer}.el-transfer-panel .el-transfer-panel__header{display:flex;align-items:center;height:var(--el-transfer-panel-header-height);background:var(--el-transfer-panel-header-bg-color);margin:0;padding-left:15px;border:1px solid var(--el-transfer-border-color);border-top-left-radius:var(--el-transfer-border-radius);border-top-right-radius:var(--el-transfer-border-radius);box-sizing:border-box;color:var(--el-color-black)}.el-transfer-panel .el-transfer-panel__header .el-checkbox{position:relative;display:flex;width:100%;align-items:center}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label{font-size:16px;color:var(--el-text-color-primary);font-weight:400}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label span{position:absolute;right:15px;top:50%;transform:translate3d(0,-50%,0);color:var(--el-text-color-secondary);font-size:12px;font-weight:400}.el-transfer-panel .el-transfer-panel__footer{height:var(--el-transfer-panel-footer-height);background:var(--el-bg-color-overlay);margin:0;padding:0;border:1px solid var(--el-transfer-border-color);border-bottom-left-radius:var(--el-transfer-border-radius);border-bottom-right-radius:var(--el-transfer-border-radius)}.el-transfer-panel .el-transfer-panel__footer:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-transfer-panel .el-transfer-panel__footer .el-checkbox{padding-left:20px;color:var(--el-text-color-regular)}.el-transfer-panel .el-transfer-panel__empty{margin:0;height:var(--el-transfer-item-height);line-height:var(--el-transfer-item-height);padding:6px 15px 0;color:var(--el-text-color-secondary);text-align:center}.el-transfer-panel .el-checkbox__label{padding-left:8px}.el-transfer-panel .el-checkbox__inner{height:14px;width:14px;border-radius:3px}.el-transfer-panel .el-checkbox__inner:after{height:6px;width:3px;left:4px}.el-tree{--el-tree-node-hover-bg-color:var(--el-fill-color-light);--el-tree-text-color:var(--el-text-color-regular);--el-tree-expand-icon-color:var(--el-text-color-placeholder)}.el-tree{position:relative;cursor:default;background:var(--el-fill-color-blank);color:var(--el-tree-text-color);font-size:var(--el-font-size-base)}.el-tree__empty-block{position:relative;min-height:60px;text-align:center;width:100%;height:100%}.el-tree__empty-text{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);color:var(--el-text-color-secondary);font-size:var(--el-font-size-base)}.el-tree__drop-indicator{position:absolute;left:0;right:0;height:1px;background-color:var(--el-color-primary)}.el-tree-node{white-space:nowrap;outline:0}.el-tree-node:focus>.el-tree-node__content{background-color:var(--el-tree-node-hover-bg-color)}.el-tree-node.is-drop-inner>.el-tree-node__content .el-tree-node__label{background-color:var(--el-color-primary);color:#fff}.el-tree-node__content{display:flex;align-items:center;height:26px;cursor:pointer}.el-tree-node__content>.el-tree-node__expand-icon{padding:6px;box-sizing:content-box}.el-tree-node__content>label.el-checkbox{margin-right:8px}.el-tree-node__content:hover{background-color:var(--el-tree-node-hover-bg-color)}.el-tree.is-dragging .el-tree-node__content{cursor:move}.el-tree.is-dragging .el-tree-node__content *{pointer-events:none}.el-tree.is-dragging.is-drop-not-allow .el-tree-node__content{cursor:not-allowed}.el-tree-node__expand-icon{cursor:pointer;color:var(--el-tree-expand-icon-color);font-size:12px;transform:rotate(0);transition:transform var(--el-transition-duration) ease-in-out}.el-tree-node__expand-icon.expanded{transform:rotate(90deg)}.el-tree-node__expand-icon.is-leaf{color:transparent;cursor:default}.el-tree-node__expand-icon.is-hidden{visibility:hidden}.el-tree-node__loading-icon{margin-right:8px;font-size:var(--el-font-size-base);color:var(--el-tree-expand-icon-color)}.el-tree-node>.el-tree-node__children{overflow:hidden;background-color:transparent}.el-tree-node.is-expanded>.el-tree-node__children{display:block}.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:var(--el-color-primary-light-9)}.el-tree-select{--el-tree-node-hover-bg-color:var(--el-fill-color-light);--el-tree-text-color:var(--el-text-color-regular);--el-tree-expand-icon-color:var(--el-text-color-placeholder)}.el-tree-select__popper .el-tree-node__expand-icon{margin-left:8px}.el-tree-select__popper .el-tree-node.is-checked>.el-tree-node__content .el-select-dropdown__item.selected:after{content:none}.el-tree-select__popper .el-select-dropdown__item{flex:1;background:0 0!important;padding-left:0;height:20px;line-height:20px}.el-upload{--el-upload-dragger-padding-horizontal:40px;--el-upload-dragger-padding-vertical:10px}.el-upload{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;outline:0}.el-upload__input{display:none}.el-upload__tip{font-size:12px;color:var(--el-text-color-regular);margin-top:7px}.el-upload iframe{position:absolute;z-index:-1;top:0;left:0;opacity:0}.el-upload--picture-card{--el-upload-picture-card-size:148px;background-color:var(--el-fill-color-lighter);border:1px dashed var(--el-border-color-darker);border-radius:6px;box-sizing:border-box;width:var(--el-upload-picture-card-size);height:var(--el-upload-picture-card-size);cursor:pointer;vertical-align:top;display:inline-flex;justify-content:center;align-items:center}.el-upload--picture-card i{font-size:28px;color:var(--el-text-color-secondary)}.el-upload--picture-card:hover{border-color:var(--el-color-primary);color:var(--el-color-primary)}.el-upload.is-drag{display:block}.el-upload:focus{border-color:var(--el-color-primary);color:var(--el-color-primary)}.el-upload:focus .el-upload-dragger{border-color:var(--el-color-primary)}.el-upload-dragger{padding:var(--el-upload-dragger-padding-horizontal) var(--el-upload-dragger-padding-vertical);background-color:var(--el-fill-color-blank);border:1px dashed var(--el-border-color);border-radius:6px;box-sizing:border-box;text-align:center;cursor:pointer;position:relative;overflow:hidden}.el-upload-dragger .el-icon--upload{font-size:67px;color:var(--el-text-color-placeholder);margin-bottom:16px;line-height:50px}.el-upload-dragger+.el-upload__tip{text-align:center}.el-upload-dragger~.el-upload__files{border-top:var(--el-border);margin-top:7px;padding-top:5px}.el-upload-dragger .el-upload__text{color:var(--el-text-color-regular);font-size:14px;text-align:center}.el-upload-dragger .el-upload__text em{color:var(--el-color-primary);font-style:normal}.el-upload-dragger:hover{border-color:var(--el-color-primary)}.el-upload-dragger.is-dragover{padding:calc(var(--el-upload-dragger-padding-horizontal) - 1px) calc(var(--el-upload-dragger-padding-vertical) - 1px);background-color:var(--el-color-primary-light-9);border:2px dashed var(--el-color-primary)}.el-upload-list{margin:10px 0 0;padding:0;list-style:none;position:relative}.el-upload-list__item{transition:all .5s cubic-bezier(.55,0,.1,1);font-size:14px;color:var(--el-text-color-regular);margin-bottom:5px;position:relative;box-sizing:border-box;border-radius:4px;width:100%}.el-upload-list__item .el-progress{position:absolute;top:20px;width:100%}.el-upload-list__item .el-progress__text{position:absolute;right:0;top:-13px}.el-upload-list__item .el-progress-bar{margin-right:0;padding-right:0}.el-upload-list__item .el-icon--upload-success{color:var(--el-color-success)}.el-upload-list__item .el-icon--close{display:none;position:absolute;right:5px;top:50%;cursor:pointer;opacity:.75;color:var(--el-text-color-regular);transition:opacity var(--el-transition-duration);transform:translateY(-50%)}.el-upload-list__item .el-icon--close:hover{opacity:1;color:var(--el-color-primary)}.el-upload-list__item .el-icon--close-tip{display:none;position:absolute;top:1px;right:5px;font-size:12px;cursor:pointer;opacity:1;color:var(--el-color-primary);font-style:normal}.el-upload-list__item:hover{background-color:var(--el-fill-color-light)}.el-upload-list__item:hover .el-icon--close{display:inline-flex}.el-upload-list__item:hover .el-progress__text{display:none}.el-upload-list__item .el-upload-list__item-info{display:inline-flex;justify-content:center;flex-direction:column;width:calc(100% - 30px);margin-left:4px}.el-upload-list__item.is-success .el-upload-list__item-status-label{display:inline-flex}.el-upload-list__item.is-success .el-upload-list__item-name:focus,.el-upload-list__item.is-success .el-upload-list__item-name:hover{color:var(--el-color-primary);cursor:pointer}.el-upload-list__item.is-success:focus:not(:hover) .el-icon--close-tip{display:inline-block}.el-upload-list__item.is-success:active,.el-upload-list__item.is-success:not(.focusing):focus{outline-width:0}.el-upload-list__item.is-success:active .el-icon--close-tip,.el-upload-list__item.is-success:not(.focusing):focus .el-icon--close-tip{display:none}.el-upload-list__item.is-success:focus .el-upload-list__item-status-label,.el-upload-list__item.is-success:hover .el-upload-list__item-status-label{display:none;opacity:0}.el-upload-list__item-name{color:var(--el-text-color-regular);display:inline-flex;text-align:center;align-items:center;padding:0 4px;transition:color var(--el-transition-duration);font-size:var(--el-font-size-base)}.el-upload-list__item-name .el-icon{margin-right:6px;color:var(--el-text-color-secondary)}.el-upload-list__item-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-upload-list__item-status-label{position:absolute;right:5px;top:0;line-height:inherit;display:none;height:100%;justify-content:center;align-items:center;transition:opacity var(--el-transition-duration)}.el-upload-list__item-delete{position:absolute;right:10px;top:0;font-size:12px;color:var(--el-text-color-regular);display:none}.el-upload-list__item-delete:hover{color:var(--el-color-primary)}.el-upload-list--picture-card{--el-upload-list-picture-card-size:148px;display:inline-flex;flex-wrap:wrap;margin:0}.el-upload-list--picture-card .el-upload-list__item{overflow:hidden;background-color:var(--el-fill-color-blank);border:1px solid var(--el-border-color);border-radius:6px;box-sizing:border-box;width:var(--el-upload-list-picture-card-size);height:var(--el-upload-list-picture-card-size);margin:0 8px 8px 0;padding:0;display:inline-flex}.el-upload-list--picture-card .el-upload-list__item .el-icon--check,.el-upload-list--picture-card .el-upload-list__item .el-icon--circle-check{color:#fff}.el-upload-list--picture-card .el-upload-list__item .el-icon--close{display:none}.el-upload-list--picture-card .el-upload-list__item:hover .el-upload-list__item-status-label{opacity:0;display:block}.el-upload-list--picture-card .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture-card .el-upload-list__item .el-upload-list__item-name{display:none}.el-upload-list--picture-card .el-upload-list__item-thumbnail{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.el-upload-list--picture-card .el-upload-list__item-status-label{right:-15px;top:-6px;width:40px;height:24px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-list--picture-card .el-upload-list__item-status-label i{font-size:12px;margin-top:11px;transform:rotate(-45deg)}.el-upload-list--picture-card .el-upload-list__item-actions{position:absolute;width:100%;height:100%;left:0;top:0;cursor:default;display:inline-flex;justify-content:center;align-items:center;color:#fff;opacity:0;font-size:20px;background-color:var(--el-overlay-color-lighter);transition:opacity var(--el-transition-duration)}.el-upload-list--picture-card .el-upload-list__item-actions span{display:none;cursor:pointer}.el-upload-list--picture-card .el-upload-list__item-actions span+span{margin-left:1rem}.el-upload-list--picture-card .el-upload-list__item-actions .el-upload-list__item-delete{position:static;font-size:inherit;color:inherit}.el-upload-list--picture-card .el-upload-list__item-actions:hover{opacity:1}.el-upload-list--picture-card .el-upload-list__item-actions:hover span{display:inline-flex}.el-upload-list--picture-card .el-progress{top:50%;left:50%;transform:translate(-50%,-50%);bottom:auto;width:126px}.el-upload-list--picture-card .el-progress .el-progress__text{top:50%}.el-upload-list--picture .el-upload-list__item{overflow:hidden;z-index:0;background-color:var(--el-fill-color-blank);border:1px solid var(--el-border-color);border-radius:6px;box-sizing:border-box;margin-top:10px;padding:10px;display:flex;align-items:center}.el-upload-list--picture .el-upload-list__item .el-icon--check,.el-upload-list--picture .el-upload-list__item .el-icon--circle-check{color:#fff}.el-upload-list--picture .el-upload-list__item:hover .el-upload-list__item-status-label{opacity:0;display:inline-flex}.el-upload-list--picture .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture .el-upload-list__item.is-success .el-upload-list__item-name i{display:none}.el-upload-list--picture .el-upload-list__item .el-icon--close{top:5px;transform:translateY(0)}.el-upload-list--picture .el-upload-list__item-thumbnail{display:inline-flex;justify-content:center;align-items:center;width:70px;height:70px;-o-object-fit:contain;object-fit:contain;position:relative;z-index:1;background-color:var(--el-color-white)}.el-upload-list--picture .el-upload-list__item-status-label{position:absolute;right:-17px;top:-7px;width:46px;height:26px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-list--picture .el-upload-list__item-status-label i{font-size:12px;margin-top:12px;transform:rotate(-45deg)}.el-upload-list--picture .el-progress{position:relative;top:-7px}.el-upload-cover{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;z-index:10;cursor:default}.el-upload-cover:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-upload-cover img{display:block;width:100%;height:100%}.el-upload-cover__label{right:-15px;top:-6px;width:40px;height:24px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-cover__label i{font-size:12px;margin-top:11px;transform:rotate(-45deg);color:#fff}.el-upload-cover__progress{display:inline-block;vertical-align:middle;position:static;width:243px}.el-upload-cover__progress+.el-upload__inner{opacity:0}.el-upload-cover__content{position:absolute;top:0;left:0;width:100%;height:100%}.el-upload-cover__interact{position:absolute;bottom:0;left:0;width:100%;height:100%;background-color:var(--el-overlay-color-light);text-align:center}.el-upload-cover__interact .btn{display:inline-block;color:#fff;font-size:14px;cursor:pointer;vertical-align:middle;transition:var(--el-transition-md-fade);margin-top:60px}.el-upload-cover__interact .btn i{margin-top:0}.el-upload-cover__interact .btn span{opacity:0;transition:opacity .15s linear}.el-upload-cover__interact .btn:not(:first-child){margin-left:35px}.el-upload-cover__interact .btn:hover{transform:translateY(-13px)}.el-upload-cover__interact .btn:hover span{opacity:1}.el-upload-cover__interact .btn i{color:#fff;display:block;font-size:24px;line-height:inherit;margin:0 auto 5px}.el-upload-cover__title{position:absolute;bottom:0;left:0;background-color:#fff;height:36px;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:400;text-align:left;padding:0 10px;margin:0;line-height:36px;font-size:14px;color:var(--el-text-color-primary)}.el-upload-cover+.el-upload__inner{opacity:0;position:relative;z-index:1}.el-vl__wrapper{position:relative}.el-vl__wrapper:hover .el-virtual-scrollbar,.el-vl__wrapper.always-on .el-virtual-scrollbar{opacity:1}.el-vl__window{scrollbar-width:none}.el-vl__window::-webkit-scrollbar{display:none}.el-virtual-scrollbar{opacity:0;transition:opacity .34s ease-out}.el-virtual-scrollbar.always-on{opacity:1}.el-vg__wrapper{position:relative}.el-popper{--el-popper-border-radius:var(--el-popover-border-radius, 4px)}.el-popper{position:absolute;border-radius:var(--el-popper-border-radius);padding:5px 11px;z-index:2000;font-size:12px;line-height:20px;min-width:10px;word-wrap:break-word;visibility:visible}.el-popper.is-dark{color:var(--el-bg-color);background:var(--el-text-color-primary);border:1px solid var(--el-text-color-primary)}.el-popper.is-dark .el-popper__arrow:before{border:1px solid var(--el-text-color-primary);background:var(--el-text-color-primary);right:0}.el-popper.is-light{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light)}.el-popper.is-light .el-popper__arrow:before{border:1px solid var(--el-border-color-light);background:var(--el-bg-color-overlay);right:0}.el-popper.is-pure{padding:0}.el-popper__arrow{position:absolute;width:10px;height:10px;z-index:-1}.el-popper__arrow:before{position:absolute;width:10px;height:10px;z-index:-1;content:" ";transform:rotate(45deg);background:var(--el-text-color-primary);box-sizing:border-box}.el-popper[data-popper-placement^=top]>.el-popper__arrow{bottom:-5px}.el-popper[data-popper-placement^=top]>.el-popper__arrow:before{border-bottom-right-radius:2px}.el-popper[data-popper-placement^=bottom]>.el-popper__arrow{top:-5px}.el-popper[data-popper-placement^=bottom]>.el-popper__arrow:before{border-top-left-radius:2px}.el-popper[data-popper-placement^=left]>.el-popper__arrow{right:-5px}.el-popper[data-popper-placement^=left]>.el-popper__arrow:before{border-top-right-radius:2px}.el-popper[data-popper-placement^=right]>.el-popper__arrow{left:-5px}.el-popper[data-popper-placement^=right]>.el-popper__arrow:before{border-bottom-left-radius:2px}.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent!important;border-left-color:transparent!important}.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent!important;border-right-color:transparent!important}.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent!important;border-bottom-color:transparent!important}.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent!important;border-top-color:transparent!important}.el-select-dropdown__item{font-size:var(--el-font-size-base);padding:0 32px 0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--el-text-color-regular);height:34px;line-height:34px;box-sizing:border-box;cursor:pointer}.el-select-dropdown__item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-select-dropdown__item.hover,.el-select-dropdown__item:hover{background-color:var(--el-fill-color-light)}.el-select-dropdown__item.selected{color:var(--el-color-primary);font-weight:700}.el-statistic{--el-statistic-title-font-weight:400;--el-statistic-title-font-size:var(--el-font-size-extra-small);--el-statistic-title-color:var(--el-text-color-regular);--el-statistic-content-font-weight:400;--el-statistic-content-font-size:var(--el-font-size-extra-large);--el-statistic-content-color:var(--el-text-color-primary)}.el-statistic__head{font-weight:var(--el-statistic-title-font-weight);font-size:var(--el-statistic-title-font-size);color:var(--el-statistic-title-color);line-height:20px;margin-bottom:4px}.el-statistic__content{font-weight:var(--el-statistic-content-font-weight);font-size:var(--el-statistic-content-font-size);color:var(--el-statistic-content-color)}.el-statistic__value{display:inline-block}.el-statistic__prefix{margin-right:4px;display:inline-block}.el-statistic__suffix{margin-left:4px;display:inline-block}.el-button{height:32rem!important;padding:8rem 15rem!important;font-size:14rem!important}.el-input__wrapper{padding:1rem 11rem!important}.el-input{height:32rem!important;font-size:14rem!important}.jt-drawing-row .col-left{font-size:14rem!important}.el-color-picker__trigger{height:32rem!important;padding:4rem!important}.el-radio-button__inner{padding:8rem 15rem!important;font-size:14rem}.el-textarea__inner{padding:5rem 11rem!important;font-size:14rem}.el-input__inner{height:32rem!important;font-size:14rem!important}.jt-drawing-row{display:flex;flex-direction:row;height:40rem;align-items:center}.jt-drawing-row .col-left{display:flex;align-items:center;justify-content:right;width:60rem;font-family:Alimama_ShuHeiTi_Bold;font-weight:700;margin-right:8rem}.jt-drawing-row .col-main{flex:1;display:flex;flex-direction:row}.jt-drawing-row .col-main .el-input--suffix{background-color:#fff0}.jt-drawing-row .col-main .el-input--suffix *{background-color:#fff0;color:#fff}.jt-drawing-row .col-main .el-input-number__decrease,.jt-drawing-row .col-main .el-input-number__increase{background-color:#3489ff;color:#fff}.jt-drawing-dialog{pointer-events:none}.jt-drawing-dialog .el-dialog{pointer-events:auto;position:absolute!important;background:rgba(5,45,155,.7);min-width:280rem;overflow:hidden;margin-top:0rem}.jt-drawing-dialog .el-dialog .el-dialog__header{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyCAIAAAD9fhrKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4NTc1YTY2Yi1hY2U5LTUyNDctODM5MS01MGJjMjM4MDkxMDkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDY4MTUxMzk2RDM1MTFFRDkzM0JDNEQ5N0IwQTIxRjYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDY4MTUxMzg2RDM1MTFFRDkzM0JDNEQ5N0IwQTIxRjYiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6YjZlNTUzODYtMzRjZC02NDQyLWI4OTktODY4YTdiYTNkMzgyIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjg1NzVhNjZiLWFjZTktNTI0Ny04MzkxLTUwYmMyMzgwOTEwOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Po+VQtwAACdUSURBVHja7H1bluM4kiUMfEjuHpFZtY4+/TGLmQ3MmTMbnf1MdUX6QyIJ2MAAAjC8+JB7ZHZXh7LKQ6IoECSBy2sXFwb4/X/+X2FfEqDv5dh35mXeC+k2CzD/+XfxL72BeVbv04KI7uP6ByD7pZTy6ToMnUTwv3f7rgWG/cNXrhz7AcVtUfOiwP/kOg6mLGRVoq1JUewjsAoLWJQ2RdlTg7CD+y+eJW3MziVU1dfK/wV2LIhXJpQJ/nQhOUFWWxDJRYjnwnfItkB2Z8w/yC7sr9fnXpj8Y/9d27hw/2D4zm/0/4V92EcRtq+bMP9J+AX98UdadxN8oy/D/tXdBeWAvsBQM7/FvwklxzemJ0xyfrflu6JG1T+Hc1mrhKEA/wfTQ9BfAD119x9Ca2R1ZjuEqwdq/Kb7C9vO3oQzZJ9AKdAzqDuoGVC5r3r3j8Gp62XoJaT9g3WBDK3crwwIdfB+mxUmyJP0HXNGAj/uM1zNQWTs8MChMOvJEQYMuDxdepBAQGM7810t2MHIioItnEqwbOx66GBadMSXHHQiCgBHFmDV8h+rJcQPEUaLk+WIFi5YDnyQXPoUs0R+oyTfEWvdkKFaskPYju0t1RLCDrxM/luoHejIm+0qbZ9g6+P2/snOBWDRQVPAggLOgMEBFRh7PoY+DPaJvUIYIvjeb3eG9b39tH6zFoL0Q9eHzVt6A1qOKMdYE7cD+lsBDCtdya7B2QINBEj1YZqMxSAwIKL7J3DVdI0WHbWgY4HdyIp2Z7d+lvreTa+hfHep/M/ZhZS9Gr7pbthqXsmtsdXpepS9MHXTi5xf5XIzX3XXf/tfBkmer2MHkPKdGr0SOckyXGzoO60IYIGBUcEdYFZKSuikFMBLT7pxQprYwXrifAZwtfto3pi9bVEcXVKSVcKtPYT5lSnMlOAaQMKKUobEv2UXF9a7kx4vbkRWnGsxAKxnAIRnrPAtg9FFYM8l93Pg/YA9A31zZCeJfOOBv3znykOv2KG6W/YVpu+xtlHUjlvWXGzu3Dqd6rflx/ZRkH+0vEFofssYCXAbtSNB7O6gxylGfNhRGFFJOdT6jbbFR4jEcHa4EqKrlkOsD2LKs2J9AlGKdVtucv4I9TdQpftrrH88BUSO3QVHI7RaboRWiJW7zy+zoW/jd4Ie0b472y+Q2F+AwHXuXv79f39/GiHr3pCgXQpSxaMeYOx7cxYGBHIKkHIKQhxJ6MOimxQI25jVdWBCy0Up941DSE4JAfKQtUURDcqawrT21YUUnVHkUVoJfByheE0DCGLysIiwkiEX6zwZctkHb3JHofU0ivee7aJx/QoxOTT6b2OVMCmE/0RU0SctOfsqnOz6rS9KszI5Umh2dJHWNjsFXSsw+7nIcCEtKuys2VfILxcWwIf8TdGrI3wxQpQHU/zi5JEjD8HWclhMxX4ecMHgi4ZesOgyBGsZWokCrWD5kPM9otXwbOLK9OphesYiOWvWFA3qddNbivHFc81iq7r8ZrrvJ2Jz/zjuRqnuvQm46rtmsFO0Yaql4w7U4fH5YuJD+JiWsB3Dj9HRYdp0J81LGE7nySMmPZfxflbAemw6wGW42RLMj+bZHEtcL1145NmiPEMWGKmNAwOMkYchZyaenRYiWmgpLx0xcGfXrjwXdMw5xSG/3ZJ/5LKXa0D++I4+R9gKVwwtuVrpNzj6HS7syt/Fuj+E5ghJAAblHeFxG2rhzyWNfgRrZ2HPNDDCVjQm2P4ltPk9kZUfRRmssXRMgzGIhftL7zdCpBuClYxYi02LC7KWwK+JSH4Yj5tEhZiyjLwfBaiq4lSKGonKgzUBK5xdQr5C9wfT/5HCfx5vJhcRkQtYKVrN77BMnjtJPT5pGHK4LCCKHSBidDe/rzQt2S+7CEINL4bBsX7XiNURcTdot5/18NIPXVfiFK8GNB/tGZYhiWBSvt/n8gnN7+9kEccCJSSH4Ai4fsG+stU3BzDI+OEPMS/K7GXgz0foAf6wgVkiYIkJMk2F7/NimBayADDClrZIJDCHLUQBGTdCcKAsPXcKWqODsqABuJPFJApGpx+sskHE20jmINK6KFuAbxvgmR2cCoTE3le5KAoeODNymG7ZKP/IcbdjNrEZTmzVfzMaySEojcE3QeokTnEoYVCFCSxGAT4e3uCU7i/oxMokDCzQKq8MFeTRyv1OquEZoU/pURFgisp1oFhnfiWaxgYCkkEGH8SZMJDi1kBadlvEEcol+x6q4tQ2TwMGw8ClHzF2snu6vN0nFx4mwOUAyILQNNPY4tN1WKUeKDAr/Cj/Cg3QPBnMmhxm4bKoD1PUSML8SmcCZmCmC+dUCwizumlWobYFbEWUs3o8psoXijTeElqsCBeCVE+4wFcEIQsVg9IZNC3hyZhgI7AY1LUVv9KWFJhM/SZioY23iHN1O6bsJGd2lS1VZra/AzY0/HatTsQXG6Vl75MOhoySNjhIHlCzvq6xxMEmVCXH4sSms9wKMmLFeA0bHMxEK9Nl5jehZrEerTM8BUHmaIU5WvHzCvWW06u0NC2pJSZohXJQw3eUXfOZggX1wYMwhn1xU2EfqjZfHYhv1/F9MhGbZjw9xIkrAM0GJG6zoUs5ZhUHRR+PhWCKMGscDDlaNPUUgzcf9+V6IUVLJFSLUSp+ahC3m/9f+v6+UHDoQ9EYCAewWu81rILXyrY4cYMkdHfEyjNNYONMPOLDVd3L1MqVeWGmSqVgiyJ1j2AYptSYtACA2Haz94jN1gOprhSLFbEThhIAErkEIO7TIkOhwPA3+6EQ9cNhUUnEdAvW+0A4SnYdmCiZGhdwHfZCkTMpjlDZD9t8KtlFp+4ATNSuyJjcc1T2KC/rOGQmtIs04uc7uC+0MtxK6GVFFei14VY0QFiEfZipdpiVCajl/RXU1Azi7DaS2HoCRNzlVOmFzTt949XvwlMlKqzoWYnqZIDjZRxvcrkZJiWYkuUwa90NDUi836fn67h2X4dZWHKi+JMANJIMWf1tMphlbj4obTFr7GjokGNSEo95LMIUtgAvfTct2haFERQgYAF6FuMxCDzaoR+rDvQOfIQc+6Af0XaCFPjWYDvV+pEPVmCizfvxv3DqfqgA07sb9sRjARdgfVS/UoLHR31svBBwn/aHa8WPlf8Q07rh1pM6KZBHytXSMB1cx1z+YnQoFYOygQjMhB6RGaZ4ed6jkIRgmuNUihYrWg0erdoxYM7+AlotFAnqZQUxOej+2QNfDa0QK5aOiFZ/gKVp6eGTM9Xjt5UJihpdrYfsFbjKHxWHAAtqStYeyUKv0Zj+dB36DoCcpVHAQd+DV2xaFnz7mEyIZ5AmpeWV2DCQHS8rCcOzDGaZkI7uDmEW6Vl2FBIjI8mU+IxFetgiRZ94n2LUA1Cu5peAm8IjUgA17nnx7qqIXLGXeG0fU9sHYm5eozMNJg9kmldiOsn516qC4TGjS/JgwEQWxYY0iqWqDbVYK2tnpddKJPeCl4O1nbG0TImKmSyOdWJxUuXZ8aFMVp9Ej6/7G3MWUIv4ivFELH7H+UsyIBf0b3qZzt8NmPC1TaiKLlZBZkuDVqjWAcFuxP4pRSseyWJlWNAfjmxQ0ysQTcvFdX6t1OW3fMyxQZ8OhO/YstLtM6xtLEuCAshgEkcDWXbo0KBJMnDDBHIb0M3Xceh7mQwacg0+CEAx1lsDNYN1Xn2nb2/3ZRz70WEWRHaUR4jZaVgY6SU5/KdZRRjSvDH7wUR/wyCQJe/bWI9WQ66oka8RIUMAiD67YDFksV6ira3UD6E+BhLHBDBvIomCE4Ij1vigaFbY3hh/y0+zRLBsH5Ect8nUjo0MZKcTY3NMj4gN8QsTXplrzFgPUhKvQC42p0JVWVobpxjbWiFNWrOVzmkIYhEAZo4EZw1dPhC1R6sLmv8hVAc9c90qPTUTA8r5DbQSVZP/GjF1epXYGSVtaZen4WsHsA4oVbgl0kc6Zv8MUkrrRZiUghSzwqGUJiv8FXuac4NxxKuCWVl4aPe72LlE93mxCIP3aca+uww976xHYMsAUkeeMhMeLkyLYtw1nUyUMAQdmVGIFpPBO0g4R2YchsTXtQ5HYsmngY0JZJxLeDK4WiYgC+fdxvVvwTggMW/7UNmF6aLYjuxYfh+Moj/E5p55rzBy8Ky1MLkwfw85ugh+UrGqaRzBL0V5IhBHNzBUOF6ZFmxhJU5JFHRRM3ChyKV0kUlOLFa0rZogBvpV6joCVWzqDCw3WO4GrcRqtnrScvScvDaMkGIU307AZ2mawIo1awW6/qJ6O+aYjH4WV6+lTNQC9w0w6wvqdHjcBWqerHwECq0MDzS9ZobJYgp3ZoEnSuZBcrPB42iBJlItZM5xfmUhkhZYA7r+Ns3OFzUtNPPIY9YGbHE6sApMvZ1UeafpRrhq2SH049okePiARMLw4lIAL2+CwGAYxSihQxwKTQbbgJ011EZTEmoAcVQxzo7wY4eiFo1gHtIhYh7YAVblTxRYcehAnYwgYJPwM+kzfx/tEsmbvLbpr4oZfuifDeysoer+wvwnDfE3g5u8f2Y6OvPclsyljPKCkkWRoOhyt0DFXZXSGdcXlg+DVqFwsi/IIYw9J7/dGBB0bUfdOppvqEVuTGWiVfesB6ptKwKsq1e1GL3p0jrAsKLWzW9wLmPhASeE35nG9WiqItzmmd/LBLNMQDfRCRPQ+EaZ+rASfYYNLNJbwiwraaEdXnHOCRNpMmBKzYIJT0oIlzWoyvuiHacOdxWCuB4mzMTJW4nOFWLGCF7pYBRzKXD+hWGnAsICPEM6oue9W7w34THCvTHf5SxZx5PbDz5Rsb3bkXrioYd2qz6lnbIYjShoVKmgi9b0acyIp30nSbSGrjL8V8BNIue75mDYkJoCoBDxkSNW5nLvo5UkT/yHcEpO6hwL2K/6b6K/rA6JClDhgYaHVVfABnj1BzlU3XNQkqzcDRBVGYrdCFTgY55pvJYZHSJh0po8oQ5ooPSOlkJLgAp6axDxeumtFZ5uyETWCXwaRyjHgJyzPM4ByglXJ+DSy7stAeIMU4xhIvg5oOEmQp6IghEBhBBCCREjx/wWOgTiJ4pMiq8RaEgTNZz1JW37m6pTnOEMhMGmEWx746PGmkdk2WzAZ2e0HUuUryBUVfAqQS3wF9nbSLDjc4MqlIr7DxjsyOkN1OIIEUppw7Qh82okgSd/yKVfyflNqpufv5Wq7KsPVSJNZh7Z3Kl8TAL3BpMfe/WfuvEbnsAc19ZJ3yOZ4ccPa9bkGBSAyZIjUtBX/3qCSpXRw2yH3lK526Jc+cus3jWNQoJzfmKpH6/IVRAuh1n95CxagkndGI0O6wgiJBHOqnuDV6OK0EzkdlAGupzeBh7lpHRZPLggxqxRAn+AFlV9KgcF8W0sOGhiP96yP9no8djVEJsUoKQPmDHcAqRSllZKQuQ5IPtCJ1JOk5ujcs+XC9A0KU1q9o/VTnWJqFSyqhaxstbQN7ncc6s741ZU1eEbTWbG2nAg7t2kDXp1GrCSYReoh4TbjyYW9jByxNUW4kHP43BfFhqP416H4KhEpOk7Gp+crbROtZpsy7C4a9/d7Pij2dcAzjtSUVIyACiTiTCsCFFXZxX9SSwmvgRgNIrxRwZegXn5CxbAy2teXCjn/IsBNwsMRRxQDUOWaazPGJmom+MqTKe1s6i5FHaHXDAxdjSfZAefbdtjO9sqRHV/qPgudmgjxqmKUNGxMm6CdUcRZrQMc5BiGKENBHQOrbASVWFuSk06vFYWrRYvufc2Euwy2wH3WGEWikZzAxVl0UpkM28i3HVXbcvPoRMrcWc9Kj/+9Dnnwzry5IQ2Zomq+LXyF8KUwZAheZ/mKOMB8PDQORWeiJJBMhWw9D2kwz8UgUthMOtu0MoG4d450TtbaUKpMoWLcS53LHPwsTO332b+g6hkIRTBMpefgcdqq8GCtTsoc/ghcNMApn6FypjgCvIC6mmudjnLKennBCU5ecQjT1k8+ZOW4HWcNmI+Oo9lbFUFstT/WTHxYq4cYTcSt0KZKWIlXytN8zZRFFlDPfe5rBK4LghdVgBmDIuK6pwEJnJraMA7pMnMV+2n9TTQCnG/gT3Ok0+EhFsToUVNzCoHiZidU4LBLJK0bjQrMEkesMIWwEqOKAuqDIbPQoxnT1X2OLVW+O4+WS+ozWxDVvih7zvws5UxyWNTm0kQQjea9oNioudYbpVKfVJ8XF9wR3Uy5TKQMiZrMU9DRClg4335nYYGSgFUmkU546r8Nkxtyaa5ZGUC7Nz96v6t7aIyKbV+lPIn6cDpVgnVw7X2wdzqpetDXylyYdkVOWyl7CiOsl3IyM5mHdVxKnMMrKN4s1wMWik/zc9wn6sFvtKBgQW3S6bjmKI6MlstCUtMJHZJLvZ+jLkLt9Fq+/nBc5N8FrCwkavveGBYbC80+FWutvP4ZCfHt/uEGvPgyB5LUeIr7CqD+QXbKgY3zR+DiQagboasadPs1IfWhmcNfZdoWJlchKkRwu9mqJ6JESfL+9bWHow/btoKBPk+72+BOsYLBd51EHP9CZ6lETMuloBYDIErwyDVprDdPrI5vVgkOWq9P/IIPVjO9semovRogYjtjRW2VSFVWCN+WAwL5mN03BNwNWhFG3RuW03izAwf3SieJoeUWHO6CdU/CWlzOeRDmY0AUGS2We2Cyhx2HHEzR7v8roNoVUrseKxl7KpX+ABgcR4koFQNEsxqznfnuVFCT8x+yNKzZVZk5hd9smb5vDLMLs/dAbnt3v4ldjarkAQFsOEVcbmrWrTL/mS0ye7vk4rPniwNRGqPggihMXrlwI18HDAHKEhd2lAMswtRptvHhgiFNcnpSBIF3EztUOYthk0hbEM/2tCnWukcoK277Ra7e5VEKyVKYbMSMQNaBZ5SM0FoDXp4sjmOM3cw1jTskrqhz4bqDi0RHPepCVVZYIiVM6P8CuPzmuU9y7EVjG8t/MdCad/RCo6hFZ4OCc8PIO8NG5eYdZvUnXIuhPAoWpjJDHXpx76LFwViGJVJrPlIov/e8CE7P9qlVKYg0TCudlDJ8CZNehXwC8Is1liLkGwP02uHmIOsiIlmipCk9HGJIidpYV/AChAkOUiTjIgs711mCYN0lLNIQ1oLlwW3rSTWxNp2URwUoTEqB7VsL1D0lXTkBCE95W37FbsgmOUmbJAsgaK0QebyFFZOByu2hyhKlOGeaKf6ZMRHw4D9C9lEcTE8S06vujcIOKSzeEoZqyqHU0NE+YSDpDmD2WIZ1K5VN/3Q3RNl46tEvXhC2dyXT/FhDasJPznuiE2exakWwywT6H3cab5OktvXN8K+k7Q6Tj4jmvdkyJNGBsnMZz2YFj3Ns7K4YOK5y2BFdxS5vsZM862Hc8gX6JKUQvZcTrCWJXthaQCAz5CJxApZsIciW0YIc7isdKZKVFjLebCT/a6aL6GWGXd3GgXUdJzyPWw0zloNoWa5Fzmgi329t9WxzgUplVwCmOdbqIANf5Dod+gvdtLMBkhhbXzAcy8YoAfKdaUXsUw03a9/CtOPMZsSVD/v5DsNF4NZ3fSHsGJWUn2tpDIHUoRZ0InD8nqJ4J/0pRxjWHjU0d4IHDDDLEN8XJaFJE+m7+WDW8JnYzA7S7fHx/j80/U2zwawHFEywHexqSO22l8ZWjKVyZRzV2omHwYKkSZ9BagkFUe+gg3E7HcpdeISdAWReQIErmQlEnLE3Gya3iMv/MS3x/cR5+1U+BPK3H7I46Z81p6+k/OxQujxd3ghkVsqaxaVB0Eqe2Bo0RHPwndKqqdMgW+yWwwVQoBK1dpQxeynvRq/Ww/qvWCUKOcPA4uqt8FsKwzcGhHG/cv+IGDt+WgSHf3Qz6O6ZEiKiQSVc/1DYByr/D0OPVkZoKmF1YplUAVonjS3ZVkIXOzSXkN3GX1i1Wpa8SQzShYJWkVT4X1Wi8s8k156nhVUlOv1IE+7VxqF0gm5KVEFwGRr1jSgblKqDMtycnTKCYXHrOdiM4dnS9jaaGDbrvcjVqwjRxENh1ruvMIkC01xZXErCMIKVPGWa5q+fpdEW+J0nJyLYK3HJ8I5YRaSt/2D0vVpO25oMCtbpWYTp/hhNPQ4fpMTgLpVfrvcpV7IimXqvE2jTyVmOOxceSQkPB0bhmtheMq83OcF+SoyEH95HbqrAxcshr22YCsSk2XBm4nc1LryoCnQzabO5ihB3gqbwa8piuA1DCqloniZHymP5yCBLpHYqlBUkoqKQn7HjTpCNjdxe07fWSfU2TmJu213e4mn4673I/U5mPm9PtbHODSyYBObqCU2+EbT1uCm/N0Is9zKXfVflzJ/VhqgzczXLR/W9X4HpZUT9RvCXAlVKcBKZTBr7uJiq5we6MWEjdrAljkEdIemamJtXtmW2vDJkPAx3T0Fl0Vpw1MmZ78sVFiyTQ09raZTldghs97Uqzk5CV+vdIfQqu8SjZytiZPKQ9kzdd3bxICGrPFlXIJ7NZtIA4xUlY2YLQ+RZrKCjWud5bfL3sY1Lb4+KPr1arCPkvI0o5qG36IeFS0zmIDOhFrdRbQTrOLm0hhIijjYbDAa1NQh6U0GB7cEsupEGj+mQY55w9+Wd9TlUdFimbKu92FniAPxAUf7YwyrETqJzdiwHCo2UKJMGOgn5XGvlX3XSfl06Ya+q1A2n4evrulCSMsviLstyolWPZBoZTX7QqHHVB1PleCgYZmazospcEGsqeDFslIY85pm05DrRIyFnGno1zDBQf4M2EjP8cCz5fO9G35m+X8BWNXPBkUtrKqB3J7PO0cKraV+050yoda6jncp7Vdni7LPWl7FADC909ChWqR+FR3BFgpZ54QNW1l4q4dn4hKL85TmR5XLjXyS4zMdt41Wpy82PgBYZ6bLb9vfHZTcbLKXPGSyb/uOsmX1UlbCTN4OIGUUTJNSdIh5nZloE4f6RMkF2c2MEal2HhoIha6TmgMZLBJyYmEyh4L05USswqegGjnklzcTs1p3B44/sHiEA5sL11eZelWmqu5/ZK345orxj76gfeiNyYQHw0aWB34/LK3pXFk3jhEomKck6HehFeUyZpLWIe+431XDKAbZza+gZ1vgm9XI7OzCwzjFi9X9BcDZHWZRRA9mY3f/Q/SuzrIJzQcHOg60gv44MLW+qpMsu4lWxpkWytvX8JTaAUGPVjG/diW3ZKbVBPVn1vo+LbNPwWxiwKdxoOmH22pXJtUzVFpIYrcqmEi9YZgDZco+sSRighsgdtOmQyaOQ1yTFFpaSQZtojqvqJiXgmxjdVXBZHSKz9sJBB8gtka2Q2Uwvz2T50S2qnLWULtwTGtbXTMxmdBbu0QHKMF2KpVKYFjrnLEeIafVTSpF4Vg3tPVEbFaHWkuvhu9SvIKdxgzzh8EsNbxg1MiwyYGwgriUV/7yrfNDh8U56lXS6l+i0i+OORjw6ODgkZDwXARQMqN50WsamYokj26yyxNN0gOBVb26mNaTA6JBFn2b5yBaDUP/vGr2KAAqFxfaiqmFuHnSVgXLGBmnL1AfWhJ1CzqKRk2iEgk5LysXXqjhWnEfYGM2S2aPxWxNp222EYxumoVFNYnmgUlBTQ5X3DinJCazTnGr8Gq1N/bE0hNbUiRo3sdC1cYd6G3zOJrZp/6gUIskLWhL+yV8+V1BquGbFNKuz2xiECdpvawZrNp8qv7coL49WLuDlMtH9daa7WCo3PBijWAHiBUbADuFWUcWoajj04aehda78GHgJNONg2nIoNXQPV+GZtNOO3nJuQykGGL1MS1hcayL9UM0L3uJGmn9tc3DdbNJnKHiVQ2F5E0tXdXmKJAxRoQbD+forirjTcECT8RzefV2Ap9jfOin6UWHdI1Thi98qFolHOoDkCRaeYLZt43RRr4GDS2r1S+pAlU3SDTwizALSYanoUOhlFR/iOHJurTkgcGFgsFBZzCLlkxf3vMUo+tk7KnTCw7fRHfRZXh4JBh8XMP6xEtR1lCS2JM6MBphut86ILg1fQxbQGPAS9tI826Xt6GpmTZpHy2fkyQ2SDt5uawmbx2UnXmenQoGdcjn+dmrpyYKrYy5w6pcCXfVQww+1a2ui4fUzUPyT4KPWJH095+HrX2SpSK+6JWtT5EVDnztyXz1sc9VBvER2N0FiLRYks8NBHQ81MJ2eZVy7EKE0i57o0mUn96sDP9sC9yoRusj0JLOVOA7CFXjerq7/9DDM5Dj4euxZQ+wiuG8xrfxtVjX0ryoFiOTkhZtNvRquxwhapqXAxdafpXSgLrfdlIaptb3sBHrVfwB7GLPBH8+dG3oDlUU8ws0ayhWOcuJD1ak5nwAYaOVAx7puzvi44EYP1mlAo49Dzf2Sd2bmKX4hXOaQ6N1NNa/SD+2ltIol7eoD0VUq3cojT3iQcirajqmdvNdmqZpuJKVtHD7oVWNU8nZAHJ6FZp6JSzW9jW+RNvXSdg1oSUtezC/0lhkRfgSNkWXUiNTzeoaIB5F+UcZViM29AIQpa8yYaBuNva+k08XP0Nwo6OCaA032MWi55CfyBT4fLVzbtLHbHuIh0MYwYC13S+6EbXBtk4BqbyYS0pBs2jEKNC8SblJO2eLmyu+PUZfHo65Ho7IPj8N6EvqeTz7YO74PXB8bPbJ0k5fy6jlJS39TxPf6f4iBGzDU7XZazni+BuN9Nn8fLTU4E0Jg1mmQISj15P7J8iaL+X0B+i53oDVvbstNoXWRZTDcY+ilXl1f/8f/+fQo7uJJS60x2kitEJs7mxw6sUm/dwOglrfart41/stHsKU9Xwdu2q0DBUqlNeZbPcktCFurrN4dBvDISzoVmNqFWD726zc/6KWpn/JF+7lLMd16cA85MS2nrWj5KAd8gM78bg+utLy2fuZ0pI4GhkdLM8y4aG6U5sysSHA+cCWfPVCjiZidQXW+og5xI26nuxESFL6uQcPoDobZ1biN7cManQtFVWg8bu+f74OsL1OQftbskcEp5WdczN23ZMpsFS7anythHMT0X9MNDs616NKqo9Qj4ZbQNZSlPJhr4biDq1blYW3B7D+1+vLEOpAXFwfIdWPcMSGhEQ5ZPSC/bOQ/S5C1YLNTo2/CfFKsw4tdJKkZYf2cr3piOuV3O4dXn43PIsvWpH92ESOAhfdf3My3Ofly/7Q5awjEdgw0MRok9bYCusMulyG7skPCDYDt3ZU6MJA5Z1WNk9p/3Tpd5577eeGKertvkTRih0RK1DUQKeaAoV7UAK7T+m6hgWNFAK/wOunw9ODPOtIqZtTqutaLrm0KNQK8hCeOwtSzUnSIncCtX/rVl/U5TdaE0wcwqm0E0h1+V3AD1OOKNF5lbToEHr8rkiGg58PWO1TuM+LgZKNLiMNWo1+hmBDmm3mXLZ/5sVFmhgKvI6DHRDc66hY84zbRXTephmx6kwvbnViJoQWfxQbcJaVcyYchlN949c8wv9UyIbtBz9ugtg2sKGVtG7/VG15aLcyZHcgBeqN1qAn3jH3t3+o4beiQDzYuAxxQ+i6+U20GKVe5O0fOH5HK379fMAqerehVB/TdPcpXCrhonMbXNIBwRZXrSEXUk6r5WOKgNjR+mDjMMidltFAAeu0IutWGcU14WKbaycCaGvZLAH7I0rH0O0Xk/oLkQmOjR5ud/At/wmeePCg6u7/BPWih+fcVAWHRjN090wJv0k1t92B7Aj/Afgtc2kdfwiauJLmBJsCUbVmi6+G+PEFoXv4Qds/cO9MMPV2CzFarmqtKUMNuDiJ/fgQNUMujWiIVZgeKOyA4MuVkqrvx0Glux1dgtPZ5oqAY0/JDZ0bjksHtWRKsF3j3Zw+p3EL/nT+Be2nAB77yfbHLyz50PXBnbykR4ZNTtPhHdGAco3ioofvO/2/UQwlDrx0BviEXjkBTK/QKcwA5ThmUYYs2U0/nN2hqunZZX4mikDlg+HhOcBy67+/TxPiltA1kNvAgstDUsuiVHRa2V/0fWfQSsIBbKrdYFLBDMLyyR01negw48cDJwJnpIttgBON9RK+WpT5E4Kl40s6f2YtQnGyKPyiM8SvukxHi5LLfVWgilTLW304TAQ1+HT5m7z/sHYHl4Dhw3Audflet1Dt1Ra7UV3/1q0FNhq4XvqPf5hDGDb3AGYdsDUEBEVhSArFaLglKhta9e3pIuWBqtQggjSmSN/sgODQPz8NUC5ceuxKzrZAvfEQ3C0Pzj8K4Iv3+/X6VxK4HgG4RgMGJIOCgRo7DAe7vy3GwIHyMZh/9ZIUCJ1N8ACn6k9eDvJPXIJ/onWSZKqgSSrDqc51wtagNL7ZjFZ5XdOEwmPfv1yHo1ZlzMWg+7x8cBUf8DoOmWZfzrHYuMW3UOCGnWo/1sDTcIYPNesvgK9treVsOAQNEotbttctblhmkoF2lpvqQbEotrry9cEz/dLkNp9nsrsOr/p2bSM7ZdNXPZDREdZJgiG/KGlk/yHwe1lgC6dSEHRDh3/YqddNKmoN8bMaf09yPHw+JAwkBbGd2Mx2WwMuT2N/JlqL+66L6Ni5x2FlwKeLHRA8pnyVtz5RwfCEHHTunuNJV+fGI+ULYjc8GZKd9ZufNdTjsXL2AkKopk/HM+e1a4v8OZHzTxjhrfq27OQb63h4SIFyQ4edKcRXuLOSfCwQT/Q+KnAFwbfqLBGPlHN/+39qLAYoHwYscwjDULKZzOVOkiT2YV1DsFlSs0KLxne7LkVS4MXEgg+OgCbzDc83lyPmg0+kJv6ijgH/ncLJv9C0keXi+vk1x0eLIlOVVqcVqKD59M800nf/4ewOlgRZSWv8LSvwoP/TgmDfTT/EhoHWDVDqFzV+O4JZWxqWpjAwGaqrXyYJ3wy56rozcU3cycSZbx+TinmjaT7zt6dLZRJPK85IX4YPvt5mrfVfoBnBA/X9RB8+wjAOrb/0ic6En/7JLh3ELzovPEDpML28eIC2HrsAcNa39VgDjApU/0AtDb5gdwE1gYeYtUDZafkIcbMFDrBMsIn1JjaUlJdiFJsuLVrStQVY86JfOetpMbSuDS4HOqjhbm+3iZ/KYDX7TsJDV4eSZL3f5p+COn8F0ok9XefX68+hd3AcVfBPq1TzK5rEBwI3nOXtBTpJNe+vJJmjih1ruQk3G/GBChr07A0IzrA5UcmAEc2XlP0G1DZF948pEb9bL0OrXi4jwIFLCnWN6e5EK7/rZbBTDh+6gYaivVNSK/VpFMIvw5gvPSb+Jf3i1+vPu9rngHEn7pleBU2I+W3XWV7JvQNyuf7eTa8kw4e4Z/pheJAev+8UiHWepa5/l5OdwbNNoG7/EON3sqG2GFK5JI9hKNOidq8IgctlAHjksUPB5n3KNKansb9eBmhGyFsAobNBzPI3B1dmgD+hDVeHun69/lWZGZ4Zf8RzrW+zYC9p/a7lA1owOFGJZi/HAp1L63e3pMU5LyBITVOvIUmyXFWpbNYaC7WVAcr/L8AA+dSd3OMf2BsAAAAASUVORK5CYII=) no-repeat;background-size:100%;margin-right:0rem;padding:6rem;text-align:center}.jt-drawing-dialog .el-dialog .el-dialog__headerbtn{height:34rem}.jt-drawing-dialog .el-dialog .el-dialog__body{padding:10rem;color:#fff}.jt-drawing-dialog .el-dialog .el-color-picker__trigger{width:120rem}.jt-drawing-dialog .el-dialog .el-body-foot{position:absolute;bottom:8rem;right:8rem;width:calc(100% - 16rem)}.jt-drawing-dialog .el-dialog .el-body-foot .el-button-group{display:flex}.jt-drawing-dialog .el-dialog .el-body-foot .el-button-group .el-button{border:solid 0rem rgb(255,0,0);flex:1}
  43466. `;
  43467. const _hoisted_1$1 = { class: "jt-drawing-dialog" };
  43468. const _hoisted_2$1 = {
  43469. slot: "title",
  43470. class: "header-title"
  43471. };
  43472. const _hoisted_3$1 = { style: { "line-height": "24rem", "font-size": "16rem", "color": "#fff", "font-family": "'Alimama_ShuHeiTi_Bold'" } };
  43473. const _hoisted_4$1 = { class: "odin-dialog__content" };
  43474. const _hoisted_5$1 = { class: "jt-drawing-row" };
  43475. const _hoisted_6$1 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u989C\u8272", -1);
  43476. const _hoisted_7$1 = { class: "col-main" };
  43477. const _hoisted_8$1 = { class: "el-body-foot" };
  43478. const _sfc_main$1 = {
  43479. __name: "CrEditProperty_MilitaryPlot.ce",
  43480. props: {
  43481. params: {
  43482. id: {
  43483. type: String,
  43484. default: () => void 0
  43485. },
  43486. color: {
  43487. type: String,
  43488. default: () => "255,255,0,0.9"
  43489. },
  43490. outlineWidth: {
  43491. type: Number,
  43492. default: () => 0
  43493. },
  43494. outlineColor: {
  43495. type: String,
  43496. default: () => "255,255,0,0.9"
  43497. }
  43498. },
  43499. showDialog: {
  43500. type: Boolean,
  43501. default: () => false
  43502. }
  43503. },
  43504. emits: ["submit", "update:showDialog", "update:params", "remove"],
  43505. setup(__props, { expose: __expose, emit }) {
  43506. const props = __props;
  43507. const language = ref("zh-cn");
  43508. const locale = computed$1(() => language.value === "zh-cn" ? zhCn : en);
  43509. const {
  43510. proxy
  43511. } = getCurrentInstance();
  43512. const predefineColors = ref([
  43513. "#ff4500",
  43514. "#ff8c00",
  43515. "#ffd700",
  43516. "#90ee90",
  43517. "#00ced1",
  43518. "#1e90ff",
  43519. "#c71585",
  43520. "rgba(255, 69, 0, 0.68)",
  43521. "rgb(255, 120, 0)",
  43522. "hsv(51, 100, 98)",
  43523. "hsva(120, 40, 94, 0.5)",
  43524. "hsl(181, 100%, 37%)",
  43525. "hsla(209, 100%, 56%, 0.73)",
  43526. "#c7158577"
  43527. ]);
  43528. const title = ref("\u5C5E\u6027\u7F16\u8F91");
  43529. const dialogVisible = ref(props.showDialog);
  43530. ref(false);
  43531. const color2 = ref(props.params.color);
  43532. const outlineWidth = ref(0);
  43533. const outlineColor = ref(props.params.outlineColor);
  43534. updateParams(props.params);
  43535. function updateParams(params) {
  43536. proxy._params = params;
  43537. switch (params.id) {
  43538. case "DrawStraightArrow":
  43539. title.value = "\u7ED8\u5236\u76F4\u7EBF\u7BAD\u5934";
  43540. break;
  43541. case "DrawAttackArrow":
  43542. title.value = "\u7ED8\u5236\u653B\u51FB\u7BAD\u5934";
  43543. break;
  43544. case "DrawPincerArrow":
  43545. title.value = "\u7ED8\u5236\u94B3\u51FB\u7BAD\u5934";
  43546. break;
  43547. case "DrawGatheringPlace":
  43548. title.value = "\u7ED8\u5236\u96C6\u7ED3\u5730";
  43549. break;
  43550. case "DrawClosedCurve":
  43551. title.value = "\u7ED8\u5236\u95ED\u5408\u66F2\u9762";
  43552. break;
  43553. case "DrawSector":
  43554. title.value = "\u7ED8\u5236\u6247\u5F62";
  43555. break;
  43556. case "DrawBowLine":
  43557. title.value = "\u7ED8\u5236\u5F13\u5F62\u7EBF";
  43558. break;
  43559. case "DrawLune":
  43560. title.value = "\u7ED8\u5236\u5F13\u5F62\u9762";
  43561. break;
  43562. case "DrawCurve":
  43563. title.value = "\u7ED8\u5236\u66F2\u7EBF";
  43564. break;
  43565. case "DrawCurveFlag":
  43566. title.value = "\u7ED8\u5236\u66F2\u7EBF\u65D7\u5E1C";
  43567. break;
  43568. case "DrawRectFlag":
  43569. title.value = "\u7ED8\u5236\u77E9\u5F62\u76F4\u89D2\u65D7\u5E1C";
  43570. break;
  43571. case "DrawTriangleFlag":
  43572. title.value = "\u7ED8\u5236\u4E09\u89D2\u65D7\u5E1C";
  43573. break;
  43574. }
  43575. color2.value = params.color;
  43576. outlineColor.value = params.outlineColor;
  43577. outlineWidth.value = params.outlineWidth;
  43578. }
  43579. __expose({});
  43580. function submit() {
  43581. let outParam = proxy._params;
  43582. outParam.color = color2.value;
  43583. outParam.outlineColor = outlineColor.value;
  43584. outParam.outlineWidth = outlineWidth.value;
  43585. emit("submit", outParam);
  43586. }
  43587. function close() {
  43588. dialogVisible.value = false;
  43589. }
  43590. function remove2() {
  43591. emit("remove", {});
  43592. dialogVisible.value = false;
  43593. }
  43594. function closeDialog() {
  43595. emit("update:showDialog", false);
  43596. }
  43597. function openDialog() {
  43598. updateParams(props.params);
  43599. }
  43600. return (_ctx, _cache) => {
  43601. return openBlock(), createElementBlock("div", _hoisted_1$1, [
  43602. createVNode(unref(ElDialog), {
  43603. modal: false,
  43604. "destroy-on-close": false,
  43605. modelValue: dialogVisible.value,
  43606. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => dialogVisible.value = $event),
  43607. title: title.value,
  43608. style: normalizeStyle({ left: "10rem", background: "rgb(0 44 126 / 68%)", height: "calc(100% - 175rem)", width: "180rem", top: "125rem" }),
  43609. onClose: closeDialog,
  43610. onOpen: openDialog,
  43611. "show-close": false
  43612. }, {
  43613. header: withCtx(() => [
  43614. createElementVNode("div", _hoisted_2$1, [
  43615. createElementVNode("span", _hoisted_3$1, toDisplayString(title.value), 1)
  43616. ])
  43617. ]),
  43618. default: withCtx(() => [
  43619. createElementVNode("div", _hoisted_4$1, [
  43620. createElementVNode("div", _hoisted_5$1, [
  43621. _hoisted_6$1,
  43622. createElementVNode("div", _hoisted_7$1, [
  43623. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  43624. default: withCtx(() => [
  43625. createVNode(unref(ElColorPicker), {
  43626. modelValue: color2.value,
  43627. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => color2.value = $event),
  43628. "show-alpha": "",
  43629. predefine: predefineColors.value,
  43630. label: "12"
  43631. }, null, 8, ["modelValue", "predefine"])
  43632. ]),
  43633. _: 1
  43634. }, 8, ["locale"])
  43635. ])
  43636. ]),
  43637. createElementVNode("div", _hoisted_8$1, [
  43638. createVNode(unref(ElButtonGroup), null, {
  43639. default: withCtx(() => [
  43640. createVNode(unref(ElButton), {
  43641. type: "primary",
  43642. icon: unref(edit_default),
  43643. onClick: _cache[1] || (_cache[1] = ($event) => submit())
  43644. }, {
  43645. default: withCtx(() => [
  43646. createTextVNode("\u4FEE\u6539")
  43647. ]),
  43648. _: 1
  43649. }, 8, ["icon"]),
  43650. createVNode(unref(ElButton), {
  43651. type: "primary",
  43652. style: { "background-color": "rgb(222, 146, 47)" },
  43653. icon: unref(delete_default),
  43654. onClick: _cache[2] || (_cache[2] = ($event) => remove2())
  43655. }, {
  43656. default: withCtx(() => [
  43657. createTextVNode("\u5220\u9664")
  43658. ]),
  43659. _: 1
  43660. }, 8, ["icon"]),
  43661. createVNode(unref(ElButton), {
  43662. type: "primary",
  43663. style: { "background-color": "rgb(126, 128, 135)" },
  43664. icon: unref(close_default),
  43665. onClick: _cache[3] || (_cache[3] = ($event) => close())
  43666. }, {
  43667. default: withCtx(() => [
  43668. createTextVNode("\u5173\u95ED")
  43669. ]),
  43670. _: 1
  43671. }, 8, ["icon"])
  43672. ]),
  43673. _: 1
  43674. })
  43675. ])
  43676. ])
  43677. ]),
  43678. _: 1
  43679. }, 8, ["modelValue", "title", "style"])
  43680. ]);
  43681. };
  43682. }
  43683. };
  43684. var DialogEditProperty$1 = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["styles", [_style_0$1]]]);
  43685. Cesium.Entity.prototype.setParams = function(params) {
  43686. this._params = params;
  43687. };
  43688. Cesium.Entity.prototype.getParams = function() {
  43689. return this._params;
  43690. };
  43691. Cesium.Entity.prototype.setIsEdit = function(isEdit) {
  43692. this._isEdit = isEdit;
  43693. };
  43694. Cesium.Entity.prototype.getIsEdit = function() {
  43695. return this._isEdit;
  43696. };
  43697. class DrawMilitaryPlot {
  43698. constructor(options2) {
  43699. if (!options2.viewer)
  43700. throw new DeveloperError("no options.viewer object!");
  43701. if (!options2.Cesium)
  43702. throw new DeveloperError("no options.Cesium object!");
  43703. this._viewer = options2.viewer;
  43704. this.cesium = options2.Cesium;
  43705. this.drawArr = [];
  43706. this.Draw = "";
  43707. this.edit = new EntityEdit(this._viewer);
  43708. this.edit.activate();
  43709. this.edit.EditEndEntity.addEventListener((result) => {
  43710. if (result.Type) {
  43711. this.handleFirstPosition(result.Type);
  43712. this.edit.DrawExample = this.Draw;
  43713. }
  43714. this._editEntity = result;
  43715. });
  43716. }
  43717. static initEditPropertyParams() {
  43718. return {
  43719. id: void 0,
  43720. color: "rgba(0,255,0,0.75)",
  43721. outlineWidth: 0,
  43722. outlineColor: "rgba(255,255,255,1)"
  43723. };
  43724. }
  43725. editActivate() {
  43726. return this.edit;
  43727. }
  43728. handleFirstPosition(type2) {
  43729. this._viewer.scene.globe.depthTestAgainstTerrain = true;
  43730. switch (type2) {
  43731. case "DrawStraightArrow":
  43732. this.Draw = new MilitaryPlot.DrawStraightArrow({
  43733. viewer: this._viewer,
  43734. Cesium: this.cesium
  43735. });
  43736. break;
  43737. case "DrawAttackArrow":
  43738. this.Draw = new MilitaryPlot.DrawAttackArrow({
  43739. viewer: this._viewer,
  43740. Cesium: this.cesium
  43741. });
  43742. break;
  43743. case "DrawPincerArrow":
  43744. this.Draw = new MilitaryPlot.DrawPincerArrow({
  43745. viewer: this._viewer,
  43746. Cesium: this.cesium
  43747. });
  43748. break;
  43749. case "DrawGatheringPlace":
  43750. this.Draw = new MilitaryPlot.DrawGatheringPlace({
  43751. viewer: this._viewer,
  43752. Cesium: this.cesium
  43753. });
  43754. break;
  43755. case "DrawClosedCurve":
  43756. this.Draw = new MilitaryPlot.DrawClosedCurve({
  43757. viewer: this._viewer,
  43758. Cesium: this.cesium
  43759. });
  43760. break;
  43761. case "DrawSector":
  43762. this.Draw = new MilitaryPlot.DrawSector({
  43763. viewer: this._viewer,
  43764. Cesium: this.cesium
  43765. });
  43766. break;
  43767. case "DrawBowLine":
  43768. this.Draw = new MilitaryPlot.DrawBowLine({
  43769. viewer: this._viewer,
  43770. Cesium: this.cesium
  43771. });
  43772. break;
  43773. case "DrawBowPlane":
  43774. this.Draw = new MilitaryPlot.DrawBowPlane({
  43775. viewer: this._viewer,
  43776. Cesium: this.cesium
  43777. });
  43778. break;
  43779. case "DrawCurve":
  43780. this.Draw = new MilitaryPlot.DrawCurve({
  43781. viewer: this._viewer,
  43782. Cesium: this.cesium
  43783. });
  43784. break;
  43785. case "DrawCurveFlag":
  43786. this.Draw = new MilitaryPlot.DrawCurveFlag({
  43787. viewer: this._viewer,
  43788. Cesium: this.cesium
  43789. });
  43790. break;
  43791. case "DrawRectFlag":
  43792. this.Draw = new MilitaryPlot.DrawRectFlag({
  43793. viewer: this._viewer,
  43794. Cesium: this.cesium
  43795. });
  43796. break;
  43797. case "DrawTriangleFlag":
  43798. this.Draw = new MilitaryPlot.DrawTriangleFlag({
  43799. viewer: this._viewer,
  43800. Cesium: this.cesium
  43801. });
  43802. break;
  43803. case "DrawPoint":
  43804. this.Draw = new MilitaryPlot.DrawPoint({
  43805. viewer: this._viewer,
  43806. Cesium: this.cesium
  43807. });
  43808. break;
  43809. case "DrawPolyline":
  43810. this.Draw = new MilitaryPlot.DrawPolyline({
  43811. viewer: this._viewer,
  43812. Cesium: this.cesium
  43813. });
  43814. break;
  43815. case "DrawPolygon":
  43816. this.Draw = new MilitaryPlot.DrawPolygon({
  43817. viewer: this._viewer,
  43818. Cesium: this.cesium
  43819. });
  43820. break;
  43821. case "DrawRectangle":
  43822. this.Draw = new MilitaryPlot.DrawRectangle({
  43823. viewer: this._viewer,
  43824. Cesium: this.cesium
  43825. });
  43826. break;
  43827. case "DrawCircle":
  43828. this.Draw = new MilitaryPlot.DrawCircle({
  43829. viewer: this._viewer,
  43830. Cesium: this.cesium
  43831. });
  43832. break;
  43833. }
  43834. }
  43835. addEntity(data) {
  43836. this.handleFirstPosition(data.type);
  43837. if (this.Draw) {
  43838. let entity = this.Draw.addload(data.position);
  43839. entity._id = data.id;
  43840. return entity;
  43841. }
  43842. }
  43843. }
  43844. Object.assign(DrawMilitaryPlot.prototype, {
  43845. _setMousePointerStyle() {
  43846. document.querySelector("body").style.cursor = "crosshair";
  43847. },
  43848. _setMouseDefaultStyle() {
  43849. document.querySelector("body").style.cursor = "default";
  43850. },
  43851. _registerLeftClickEvent(handler, callChange) {
  43852. let _self = this;
  43853. if (!handler)
  43854. return;
  43855. handler.setInputAction(function(event2) {
  43856. _self._lock = true;
  43857. clearTimeout(_self._timer);
  43858. _self._timer = setTimeout(function() {
  43859. if (callChange)
  43860. callChange(event2);
  43861. _self._lock = false;
  43862. }, 200);
  43863. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  43864. },
  43865. _registerMouseMoveEvent(handler, callChange) {
  43866. let _self = this;
  43867. if (!handler)
  43868. return;
  43869. handler.setInputAction(function(event2) {
  43870. if (_self._lock === void 0 || _self._lock === false) {
  43871. if (callChange)
  43872. callChange(event2);
  43873. }
  43874. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  43875. },
  43876. _registerLeftDownEvent(handler, callChange) {
  43877. if (!handler)
  43878. return;
  43879. handler.setInputAction(function(event2) {
  43880. if (callChange)
  43881. callChange(event2);
  43882. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  43883. },
  43884. _registerLeftUpEvent(handler, callChange) {
  43885. if (!handler)
  43886. return;
  43887. handler.setInputAction(function(event2) {
  43888. if (callChange)
  43889. callChange(event2);
  43890. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  43891. },
  43892. _clearEvent(handler) {
  43893. if (!handler)
  43894. return;
  43895. handler.destroy();
  43896. handler = null;
  43897. }
  43898. });
  43899. Object.assign(DrawMilitaryPlot.prototype, {
  43900. _setEntityIsEdit(entity) {
  43901. let _self = this;
  43902. this._closePropertyEditDialog();
  43903. entity.setIsEdit(true);
  43904. this.edit.handlePickEditEntity(entity);
  43905. this._sendShowPropertyDialog(entity);
  43906. let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  43907. this._registerLeftClickEvent(handler, function(event2) {
  43908. _self._closePropertyEditDialog();
  43909. let feature2 = _self._viewer.scene.pick(event2.position);
  43910. if (feature2 !== void 0 && feature2.id instanceof Cesium.Entity) {
  43911. let editEntity = feature2.id;
  43912. if (editEntity.Type == "DrawStraightArrow" || editEntity.Type == "DrawAttackArrow" || editEntity.Type == "DrawPincerArrow" || editEntity.Type == "DrawGatheringPlace" || editEntity.Type == "DrawClosedCurve" || editEntity.Type == "DrawSector" || editEntity.Type == "DrawBowLine" || editEntity.Type == "DrawBowPlane" || editEntity.Type == "DrawCurve" || editEntity.Type == "DrawCurveFlag" || editEntity.Type == "DrawRectFlag" || editEntity.Type == "DrawTriangleFlag" || editEntity.Type == "DrawPoint" || editEntity.Type == "DrawPolyline" || editEntity.Type == "DrawPolygon" || editEntity.Type == "DrawRectangle" || editEntity.Type == "DrawCircle") {
  43913. _self._sendShowPropertyDialog(feature2.id);
  43914. }
  43915. }
  43916. });
  43917. },
  43918. _sendShowPropertyDialog(entity) {
  43919. let _self = this;
  43920. let editEntityType = entity.Type;
  43921. if (entity.getIsEdit() === void 0 || entity.getIsEdit() === false || editEntityType === void 0) {
  43922. return;
  43923. }
  43924. let editProperty = entity.getParams();
  43925. if (editProperty !== void 0 && this.onEditProperty !== void 0) {
  43926. editProperty.id = editEntityType;
  43927. _self._openPropertyEditDialog(
  43928. editProperty,
  43929. function(params) {
  43930. _self.updateEditEntityProperty(params);
  43931. },
  43932. function() {
  43933. _self._viewer.entities.remove(entity);
  43934. _self.edit.clearAllEditVertex();
  43935. }
  43936. );
  43937. }
  43938. },
  43939. updateEditEntityProperty: function(params) {
  43940. if (this._editEntity === void 0)
  43941. return;
  43942. if (this._editEntity.getIsEdit() === void 0 || this._editEntity.getIsEdit() === false)
  43943. return;
  43944. let editEntityType = this._editEntity.Type;
  43945. if (editEntityType === void 0)
  43946. return;
  43947. let material = this._editEntity.polygon.material;
  43948. if (material instanceof Cesium.ColorMaterialProperty) {
  43949. let newMaterial = this._materialColorProperty({
  43950. color: params.color
  43951. });
  43952. this._editEntity.polygon.material = newMaterial;
  43953. }
  43954. if (this._editEntity.polyline !== void 0) {
  43955. let newMaterial = this._materialColorProperty({
  43956. color: params.outlineColor
  43957. });
  43958. this._editEntity.polyline.material = newMaterial;
  43959. this._editEntity.polyline.width = parseFloat(params.outlineWidth);
  43960. }
  43961. this._editEntity.setParams(params);
  43962. },
  43963. _materialColorProperty(options2) {
  43964. let mColor = "rgba(0,255,0,1)";
  43965. if (options2 !== void 0 && options2.color !== void 0)
  43966. mColor = options2.color;
  43967. let colorMaterial = new Cesium.ColorMaterialProperty(Cesium.Color.fromCssColorString(mColor));
  43968. colorMaterial._param = {
  43969. color: mColor
  43970. };
  43971. return colorMaterial;
  43972. }
  43973. });
  43974. Object.assign(DrawMilitaryPlot.prototype, {
  43975. drawActivate(type2) {
  43976. this._setMousePointerStyle();
  43977. this.handleFirstPosition(type2);
  43978. this.Draw.startCreate(type2);
  43979. this.Draw.DrawEndEvent.addEventListener((entity, positions, drawType) => {
  43980. console.log({
  43981. entity,
  43982. positions,
  43983. drawType
  43984. });
  43985. this._setMouseDefaultStyle();
  43986. if (entity) {
  43987. let entityParam = DrawMilitaryPlot.initEditPropertyParams();
  43988. entity.setParams(entityParam);
  43989. this._setEntityIsEdit(entity);
  43990. }
  43991. });
  43992. this.drawArr.push(this.Draw);
  43993. return this.Draw;
  43994. },
  43995. clearOne: function() {
  43996. this.Draw.clear();
  43997. },
  43998. clearAll: function() {
  43999. for (var i2 = 0; i2 < this.drawArr.length; i2++) {
  44000. this.drawArr[i2].clear();
  44001. }
  44002. this.edit.deactivate();
  44003. this._closePropertyEditDialog();
  44004. let buttonDiv = document.getElementById("drawButtonDiv");
  44005. if (buttonDiv) {
  44006. document.body.removeChild(buttonDiv);
  44007. }
  44008. }
  44009. });
  44010. Object.assign(DrawMilitaryPlot.prototype, {
  44011. _openPropertyEditDialog: function(params, callEdit, callRemove) {
  44012. this._editPropertyDialogDomId = "dialog-property-dom-militaryplot";
  44013. this._registerDOMPropertyEdit = "dialog-edit-property-militaryplot";
  44014. let PropertyEditComponent = customElements.get(this._registerDOMPropertyEdit);
  44015. if (PropertyEditComponent === void 0) {
  44016. PropertyEditComponent = defineCustomElement(DialogEditProperty$1);
  44017. customElements.define(this._registerDOMPropertyEdit, PropertyEditComponent);
  44018. }
  44019. this._closePropertyEditDialog();
  44020. let dialogPropertyElement = new PropertyEditComponent({
  44021. params
  44022. });
  44023. dialogPropertyElement.id = this._editPropertyDialogDomId;
  44024. dialogPropertyElement.showDialog = true;
  44025. document.body.appendChild(dialogPropertyElement);
  44026. dialogPropertyElement.addEventListener(
  44027. "submit",
  44028. (e) => {
  44029. if (callEdit)
  44030. callEdit(e.detail[0]);
  44031. },
  44032. false
  44033. );
  44034. dialogPropertyElement.addEventListener(
  44035. "remove",
  44036. (e) => {
  44037. if (callRemove)
  44038. callRemove();
  44039. },
  44040. false
  44041. );
  44042. },
  44043. _closePropertyEditDialog() {
  44044. let dom2 = document.getElementById(this._editPropertyDialogDomId);
  44045. if (dom2 !== null && dom2 !== void 0) {
  44046. document.body.removeChild(dom2);
  44047. }
  44048. }
  44049. });
  44050. var _style_0 = `@charset "UTF-8";:root{--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary-rgb:64,158,255;--el-color-success-rgb:103,194,58;--el-color-warning-rgb:230,162,60;--el-color-danger-rgb:245,108,108;--el-color-error-rgb:245,108,108;--el-color-info-rgb:144,147,153;--el-font-size-extra-large:20px;--el-font-size-large:18px;--el-font-size-medium:16px;--el-font-size-base:14px;--el-font-size-small:13px;--el-font-size-extra-small:12px;--el-font-family:"Helvetica Neue",Helvetica,"PingFang SC","Hiragino Sans GB","Microsoft YaHei","\\5fae\\8f6f\\96c5\\9ed1",Arial,sans-serif;--el-font-weight-primary:500;--el-font-line-height-primary:24px;--el-index-normal:1;--el-index-top:1000;--el-index-popper:2000;--el-border-radius-base:4px;--el-border-radius-small:2px;--el-border-radius-round:20px;--el-border-radius-circle:100%;--el-transition-duration:.3s;--el-transition-duration-fast:.2s;--el-transition-function-ease-in-out-bezier:cubic-bezier(.645, .045, .355, 1);--el-transition-function-fast-bezier:cubic-bezier(.23, 1, .32, 1);--el-transition-all:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);--el-transition-fade:opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-md-fade:transform var(--el-transition-duration) var(--el-transition-function-fast-bezier),opacity var(--el-transition-duration) var(--el-transition-function-fast-bezier);--el-transition-fade-linear:opacity var(--el-transition-duration-fast) linear;--el-transition-border:border-color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-box-shadow:box-shadow var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-transition-color:color var(--el-transition-duration-fast) var(--el-transition-function-ease-in-out-bezier);--el-component-size-large:40px;--el-component-size:32px;--el-component-size-small:24px}:root{color-scheme:light;--el-color-white:#ffffff;--el-color-black:#000000;--el-color-primary:#409eff;--el-color-primary-light-3:#79bbff;--el-color-primary-light-5:#a0cfff;--el-color-primary-light-7:#c6e2ff;--el-color-primary-light-8:#d9ecff;--el-color-primary-light-9:#ecf5ff;--el-color-primary-dark-2:#337ecc;--el-color-success:#67c23a;--el-color-success-light-3:#95d475;--el-color-success-light-5:#b3e19d;--el-color-success-light-7:#d1edc4;--el-color-success-light-8:#e1f3d8;--el-color-success-light-9:#f0f9eb;--el-color-success-dark-2:#529b2e;--el-color-warning:#e6a23c;--el-color-warning-light-3:#eebe77;--el-color-warning-light-5:#f3d19e;--el-color-warning-light-7:#f8e3c5;--el-color-warning-light-8:#faecd8;--el-color-warning-light-9:#fdf6ec;--el-color-warning-dark-2:#b88230;--el-color-danger:#f56c6c;--el-color-danger-light-3:#f89898;--el-color-danger-light-5:#fab6b6;--el-color-danger-light-7:#fcd3d3;--el-color-danger-light-8:#fde2e2;--el-color-danger-light-9:#fef0f0;--el-color-danger-dark-2:#c45656;--el-color-error:#f56c6c;--el-color-error-light-3:#f89898;--el-color-error-light-5:#fab6b6;--el-color-error-light-7:#fcd3d3;--el-color-error-light-8:#fde2e2;--el-color-error-light-9:#fef0f0;--el-color-error-dark-2:#c45656;--el-color-info:#909399;--el-color-info-light-3:#b1b3b8;--el-color-info-light-5:#c8c9cc;--el-color-info-light-7:#dedfe0;--el-color-info-light-8:#e9e9eb;--el-color-info-light-9:#f4f4f5;--el-color-info-dark-2:#73767a;--el-bg-color:#ffffff;--el-bg-color-page:#f2f3f5;--el-bg-color-overlay:#ffffff;--el-text-color-primary:#303133;--el-text-color-regular:#606266;--el-text-color-secondary:#909399;--el-text-color-placeholder:#a8abb2;--el-text-color-disabled:#c0c4cc;--el-border-color:#dcdfe6;--el-border-color-light:#e4e7ed;--el-border-color-lighter:#ebeef5;--el-border-color-extra-light:#f2f6fc;--el-border-color-dark:#d4d7de;--el-border-color-darker:#cdd0d6;--el-fill-color:#f0f2f5;--el-fill-color-light:#f5f7fa;--el-fill-color-lighter:#fafafa;--el-fill-color-extra-light:#fafcff;--el-fill-color-dark:#ebedf0;--el-fill-color-darker:#e6e8eb;--el-fill-color-blank:#ffffff;--el-box-shadow:0px 12px 32px 4px rgba(0, 0, 0, .04),0px 8px 20px rgba(0, 0, 0, .08);--el-box-shadow-light:0px 0px 12px rgba(0, 0, 0, .12);--el-box-shadow-lighter:0px 0px 6px rgba(0, 0, 0, .12);--el-box-shadow-dark:0px 16px 48px 16px rgba(0, 0, 0, .08),0px 12px 32px rgba(0, 0, 0, .12),0px 8px 16px -8px rgba(0, 0, 0, .16);--el-disabled-bg-color:var(--el-fill-color-light);--el-disabled-text-color:var(--el-text-color-placeholder);--el-disabled-border-color:var(--el-border-color-light);--el-overlay-color:rgba(0, 0, 0, .8);--el-overlay-color-light:rgba(0, 0, 0, .7);--el-overlay-color-lighter:rgba(0, 0, 0, .5);--el-mask-color:rgba(255, 255, 255, .9);--el-mask-color-extra-light:rgba(255, 255, 255, .3);--el-border-width:1px;--el-border-style:solid;--el-border-color-hover:var(--el-text-color-disabled);--el-border:var(--el-border-width) var(--el-border-style) var(--el-border-color);--el-svg-monochrome-grey:var(--el-border-color)}.fade-in-linear-enter-active,.fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.fade-in-linear-enter-from,.fade-in-linear-leave-to{opacity:0}.el-fade-in-linear-enter-active,.el-fade-in-linear-leave-active{transition:var(--el-transition-fade-linear)}.el-fade-in-linear-enter-from,.el-fade-in-linear-leave-to{opacity:0}.el-fade-in-enter-active,.el-fade-in-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-fade-in-enter-from,.el-fade-in-leave-active{opacity:0}.el-zoom-in-center-enter-active,.el-zoom-in-center-leave-active{transition:all var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-zoom-in-center-enter-from,.el-zoom-in-center-leave-active{opacity:0;transform:scaleX(0)}.el-zoom-in-top-enter-active,.el-zoom-in-top-leave-active{opacity:1;transform:scaleY(1);transition:var(--el-transition-md-fade);transform-origin:center top}.el-zoom-in-top-enter-active[data-popper-placement^=top],.el-zoom-in-top-leave-active[data-popper-placement^=top]{transform-origin:center bottom}.el-zoom-in-top-enter-from,.el-zoom-in-top-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-bottom-enter-active,.el-zoom-in-bottom-leave-active{opacity:1;transform:scaleY(1);transition:var(--el-transition-md-fade);transform-origin:center bottom}.el-zoom-in-bottom-enter-from,.el-zoom-in-bottom-leave-active{opacity:0;transform:scaleY(0)}.el-zoom-in-left-enter-active,.el-zoom-in-left-leave-active{opacity:1;transform:scale(1);transition:var(--el-transition-md-fade);transform-origin:top left}.el-zoom-in-left-enter-from,.el-zoom-in-left-leave-active{opacity:0;transform:scale(.45)}.collapse-transition{transition:var(--el-transition-duration) height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.el-collapse-transition-enter-active,.el-collapse-transition-leave-active{transition:var(--el-transition-duration) max-height ease-in-out,var(--el-transition-duration) padding-top ease-in-out,var(--el-transition-duration) padding-bottom ease-in-out}.horizontal-collapse-transition{transition:var(--el-transition-duration) width ease-in-out,var(--el-transition-duration) padding-left ease-in-out,var(--el-transition-duration) padding-right ease-in-out}.el-list-enter-active,.el-list-leave-active{transition:all 1s}.el-list-enter-from,.el-list-leave-to{opacity:0;transform:translateY(-30px)}.el-list-leave-active{position:absolute!important}.el-opacity-transition{transition:opacity var(--el-transition-duration) cubic-bezier(.55,0,.1,1)}.el-icon-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon--right{margin-left:5px}.el-icon--left{margin-right:5px}@-webkit-keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes rotating{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.el-icon{--color:inherit;height:1em;width:1em;line-height:1em;display:inline-flex;justify-content:center;align-items:center;position:relative;fill:currentColor;color:var(--color);font-size:inherit}.el-icon.is-loading{-webkit-animation:rotating 2s linear infinite;animation:rotating 2s linear infinite}.el-icon svg{height:1em;width:1em}.el-affix--fixed{position:fixed}.el-alert{--el-alert-padding:8px 16px;--el-alert-border-radius-base:var(--el-border-radius-base);--el-alert-title-font-size:13px;--el-alert-description-font-size:12px;--el-alert-close-font-size:12px;--el-alert-close-customed-font-size:13px;--el-alert-icon-size:16px;--el-alert-icon-large-size:28px;width:100%;padding:var(--el-alert-padding);margin:0;box-sizing:border-box;border-radius:var(--el-alert-border-radius-base);position:relative;background-color:var(--el-color-white);overflow:hidden;opacity:1;display:flex;align-items:center;transition:opacity var(--el-transition-duration-fast)}.el-alert.is-light .el-alert__close-btn{color:var(--el-text-color-placeholder)}.el-alert.is-dark .el-alert__close-btn,.el-alert.is-dark .el-alert__description{color:var(--el-color-white)}.el-alert.is-center{justify-content:center}.el-alert--success{--el-alert-bg-color:var(--el-color-success-light-9)}.el-alert--success.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-success)}.el-alert--success.is-light .el-alert__description{color:var(--el-color-success)}.el-alert--success.is-dark{background-color:var(--el-color-success);color:var(--el-color-white)}.el-alert--info{--el-alert-bg-color:var(--el-color-info-light-9)}.el-alert--info.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-info)}.el-alert--info.is-light .el-alert__description{color:var(--el-color-info)}.el-alert--info.is-dark{background-color:var(--el-color-info);color:var(--el-color-white)}.el-alert--warning{--el-alert-bg-color:var(--el-color-warning-light-9)}.el-alert--warning.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-warning)}.el-alert--warning.is-light .el-alert__description{color:var(--el-color-warning)}.el-alert--warning.is-dark{background-color:var(--el-color-warning);color:var(--el-color-white)}.el-alert--error{--el-alert-bg-color:var(--el-color-error-light-9)}.el-alert--error.is-light{background-color:var(--el-alert-bg-color);color:var(--el-color-error)}.el-alert--error.is-light .el-alert__description{color:var(--el-color-error)}.el-alert--error.is-dark{background-color:var(--el-color-error);color:var(--el-color-white)}.el-alert__content{display:table-cell;padding:0 8px}.el-alert .el-alert__icon{font-size:var(--el-alert-icon-size);width:var(--el-alert-icon-size)}.el-alert .el-alert__icon.is-big{font-size:var(--el-alert-icon-large-size);width:var(--el-alert-icon-large-size)}.el-alert__title{font-size:var(--el-alert-title-font-size);line-height:18px;vertical-align:text-top}.el-alert__title.is-bold{font-weight:700}.el-alert .el-alert__description{font-size:var(--el-alert-description-font-size);margin:5px 0 0}.el-alert .el-alert__close-btn{font-size:var(--el-alert-close-font-size);opacity:1;position:absolute;top:12px;right:15px;cursor:pointer}.el-alert .el-alert__close-btn.is-customed{font-style:normal;font-size:var(--el-alert-close-customed-font-size);top:9px}.el-alert-fade-enter-from,.el-alert-fade-leave-active{opacity:0}.el-aside{overflow:auto;box-sizing:border-box;flex-shrink:0;width:var(--el-aside-width,300px)}.el-autocomplete{position:relative;display:inline-block}.el-autocomplete__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-autocomplete__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-autocomplete__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-autocomplete__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-autocomplete-suggestion{border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-autocomplete-suggestion__wrap{max-height:280px;padding:10px 0;box-sizing:border-box}.el-autocomplete-suggestion__list{margin:0;padding:0}.el-autocomplete-suggestion li{padding:0 20px;margin:0;line-height:34px;cursor:pointer;color:var(--el-text-color-regular);font-size:var(--el-font-size-base);list-style:none;text-align:left;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-autocomplete-suggestion li:hover,.el-autocomplete-suggestion li.highlighted{background-color:var(--el-fill-color-light)}.el-autocomplete-suggestion li.divider{margin-top:6px;border-top:1px solid var(--el-color-black)}.el-autocomplete-suggestion li.divider:last-child{margin-bottom:-6px}.el-autocomplete-suggestion.is-loading li{text-align:center;height:100px;line-height:100px;font-size:20px;color:var(--el-text-color-secondary)}.el-autocomplete-suggestion.is-loading li:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-autocomplete-suggestion.is-loading li:hover{background-color:var(--el-bg-color-overlay)}.el-autocomplete-suggestion.is-loading .el-icon-loading{vertical-align:middle}.el-avatar{--el-avatar-text-color:var(--el-color-white);--el-avatar-bg-color:var(--el-text-color-disabled);--el-avatar-text-size:14px;--el-avatar-icon-size:18px;--el-avatar-border-radius:var(--el-border-radius-base);--el-avatar-size-large:56px;--el-avatar-size-small:24px;--el-avatar-size:40px;display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;text-align:center;overflow:hidden;color:var(--el-avatar-text-color);background:var(--el-avatar-bg-color);width:var(--el-avatar-size);height:var(--el-avatar-size);font-size:var(--el-avatar-text-size)}.el-avatar>img{display:block;height:100%}.el-avatar--circle{border-radius:50%}.el-avatar--square{border-radius:var(--el-avatar-border-radius)}.el-avatar--icon{font-size:var(--el-avatar-icon-size)}.el-avatar--small{--el-avatar-size:24px}.el-avatar--large{--el-avatar-size:56px}.el-backtop{--el-backtop-bg-color:var(--el-bg-color-overlay);--el-backtop-text-color:var(--el-color-primary);--el-backtop-hover-bg-color:var(--el-border-color-extra-light);position:fixed;background-color:var(--el-backtop-bg-color);width:40px;height:40px;border-radius:50%;color:var(--el-backtop-text-color);display:flex;align-items:center;justify-content:center;font-size:20px;box-shadow:var(--el-box-shadow-lighter);cursor:pointer;z-index:5}.el-backtop:hover{background-color:var(--el-backtop-hover-bg-color)}.el-backtop__icon{font-size:20px}.el-badge{--el-badge-bg-color:var(--el-color-danger);--el-badge-radius:10px;--el-badge-font-size:12px;--el-badge-padding:6px;--el-badge-size:18px;position:relative;vertical-align:middle;display:inline-block;width:-webkit-fit-content;width:-moz-fit-content;width:fit-content}.el-badge__content{background-color:var(--el-badge-bg-color);border-radius:var(--el-badge-radius);color:var(--el-color-white);display:inline-flex;justify-content:center;align-items:center;font-size:var(--el-badge-font-size);height:var(--el-badge-size);padding:0 var(--el-badge-padding);white-space:nowrap;border:1px solid var(--el-bg-color)}.el-badge__content.is-fixed{position:absolute;top:0;right:calc(1px + var(--el-badge-size)/ 2);transform:translateY(-50%) translate(100%);z-index:var(--el-index-normal)}.el-badge__content.is-fixed.is-dot{right:5px}.el-badge__content.is-dot{height:8px;width:8px;padding:0;right:0;border-radius:50%}.el-badge__content--primary{background-color:var(--el-color-primary)}.el-badge__content--success{background-color:var(--el-color-success)}.el-badge__content--warning{background-color:var(--el-color-warning)}.el-badge__content--info{background-color:var(--el-color-info)}.el-badge__content--danger{background-color:var(--el-color-danger)}.el-breadcrumb{font-size:14px;line-height:1}.el-breadcrumb:after,.el-breadcrumb:before{display:table;content:""}.el-breadcrumb:after{clear:both}.el-breadcrumb__separator{margin:0 9px;font-weight:700;color:var(--el-text-color-placeholder)}.el-breadcrumb__separator.el-icon{margin:0 6px;font-weight:400}.el-breadcrumb__separator.el-icon svg{vertical-align:middle}.el-breadcrumb__item{float:left;display:inline-flex;align-items:center}.el-breadcrumb__inner{color:var(--el-text-color-regular)}.el-breadcrumb__inner a,.el-breadcrumb__inner.is-link{font-weight:700;text-decoration:none;transition:var(--el-transition-color);color:var(--el-text-color-primary)}.el-breadcrumb__inner a:hover,.el-breadcrumb__inner.is-link:hover{color:var(--el-color-primary);cursor:pointer}.el-breadcrumb__item:last-child .el-breadcrumb__inner,.el-breadcrumb__item:last-child .el-breadcrumb__inner a,.el-breadcrumb__item:last-child .el-breadcrumb__inner a:hover,.el-breadcrumb__item:last-child .el-breadcrumb__inner:hover{font-weight:400;color:var(--el-text-color-regular);cursor:text}.el-breadcrumb__item:last-child .el-breadcrumb__separator{display:none}.el-button-group{display:inline-block;vertical-align:middle}.el-button-group:after,.el-button-group:before{display:table;content:""}.el-button-group:after{clear:both}.el-button-group>.el-button{float:left;position:relative}.el-button-group>.el-button+.el-button{margin-left:0}.el-button-group>.el-button:first-child{border-top-right-radius:0;border-bottom-right-radius:0}.el-button-group>.el-button:last-child{border-top-left-radius:0;border-bottom-left-radius:0}.el-button-group>.el-button:first-child:last-child{border-top-right-radius:var(--el-border-radius-base);border-bottom-right-radius:var(--el-border-radius-base);border-top-left-radius:var(--el-border-radius-base);border-bottom-left-radius:var(--el-border-radius-base)}.el-button-group>.el-button:first-child:last-child.is-round{border-radius:var(--el-border-radius-round)}.el-button-group>.el-button:first-child:last-child.is-circle{border-radius:50%}.el-button-group>.el-button:not(:first-child):not(:last-child){border-radius:0}.el-button-group>.el-button:not(:last-child){margin-right:-1px}.el-button-group>.el-button:active,.el-button-group>.el-button:focus,.el-button-group>.el-button:hover{z-index:1}.el-button-group>.el-button.is-active{z-index:1}.el-button-group>.el-dropdown>.el-button{border-top-left-radius:0;border-bottom-left-radius:0;border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--primary:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--success:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--warning:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--danger:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:first-child{border-right-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:last-child{border-left-color:var(--el-button-divide-border-color)}.el-button-group .el-button--info:not(:first-child):not(:last-child){border-left-color:var(--el-button-divide-border-color);border-right-color:var(--el-button-divide-border-color)}.el-button{--el-button-font-weight:var(--el-font-weight-primary);--el-button-border-color:var(--el-border-color);--el-button-bg-color:var(--el-fill-color-blank);--el-button-text-color:var(--el-text-color-regular);--el-button-disabled-text-color:var(--el-disabled-text-color);--el-button-disabled-bg-color:var(--el-fill-color-blank);--el-button-disabled-border-color:var(--el-border-color-light);--el-button-divide-border-color:rgba(255, 255, 255, .5);--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-color-primary-light-9);--el-button-hover-border-color:var(--el-color-primary-light-7);--el-button-active-text-color:var(--el-button-hover-text-color);--el-button-active-border-color:var(--el-color-primary);--el-button-active-bg-color:var(--el-button-hover-bg-color);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-hover-link-text-color:var(--el-color-info);--el-button-active-color:var(--el-text-color-primary)}.el-button{display:inline-flex;justify-content:center;align-items:center;line-height:1;height:32px;white-space:nowrap;cursor:pointer;color:var(--el-button-text-color);text-align:center;box-sizing:border-box;outline:0;transition:.1s;font-weight:var(--el-button-font-weight);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:middle;-webkit-appearance:none;background-color:var(--el-button-bg-color);border:var(--el-border);border-color:var(--el-button-border-color);padding:8px 15px;font-size:var(--el-font-size-base);border-radius:var(--el-border-radius-base)}.el-button:focus,.el-button:hover{color:var(--el-button-hover-text-color);border-color:var(--el-button-hover-border-color);background-color:var(--el-button-hover-bg-color);outline:0}.el-button:active{color:var(--el-button-active-text-color);border-color:var(--el-button-active-border-color);background-color:var(--el-button-active-bg-color);outline:0}.el-button:focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px}.el-button>span{display:inline-flex;align-items:center}.el-button+.el-button{margin-left:12px}.el-button.is-round{padding:8px 15px}.el-button::-moz-focus-inner{border:0}.el-button [class*=el-icon]+span{margin-left:6px}.el-button [class*=el-icon] svg{vertical-align:bottom}.el-button.is-plain{--el-button-hover-text-color:var(--el-color-primary);--el-button-hover-bg-color:var(--el-fill-color-blank);--el-button-hover-border-color:var(--el-color-primary)}.el-button.is-active{color:var(--el-button-active-text-color);border-color:var(--el-button-active-border-color);background-color:var(--el-button-active-bg-color);outline:0}.el-button.is-disabled,.el-button.is-disabled:focus,.el-button.is-disabled:hover{color:var(--el-button-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color);border-color:var(--el-button-disabled-border-color)}.el-button.is-loading{position:relative;pointer-events:none}.el-button.is-loading:before{z-index:1;pointer-events:none;content:"";position:absolute;left:-1px;top:-1px;right:-1px;bottom:-1px;border-radius:inherit;background-color:var(--el-mask-color-extra-light)}.el-button.is-round{border-radius:var(--el-border-radius-round)}.el-button.is-circle{border-radius:50%;padding:8px}.el-button.is-text{color:var(--el-button-text-color);border:0 solid transparent;background-color:transparent}.el-button.is-text.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important}.el-button.is-text:not(.is-disabled):focus,.el-button.is-text:not(.is-disabled):hover{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled):focus-visible{outline:2px solid var(--el-button-outline-color);outline-offset:1px}.el-button.is-text:not(.is-disabled):active{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg{background-color:var(--el-fill-color-light)}.el-button.is-text:not(.is-disabled).is-has-bg:focus,.el-button.is-text:not(.is-disabled).is-has-bg:hover{background-color:var(--el-fill-color)}.el-button.is-text:not(.is-disabled).is-has-bg:active{background-color:var(--el-fill-color-dark)}.el-button__text--expand{letter-spacing:.3em;margin-right:-.3em}.el-button.is-link{border-color:transparent;color:var(--el-button-text-color);background:0 0;padding:2px;height:auto}.el-button.is-link:focus,.el-button.is-link:hover{color:var(--el-button-hover-link-text-color)}.el-button.is-link.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important;border-color:transparent!important}.el-button.is-link:not(.is-disabled):focus,.el-button.is-link:not(.is-disabled):hover{border-color:transparent;background-color:transparent}.el-button.is-link:not(.is-disabled):active{color:var(--el-button-active-color);border-color:transparent;background-color:transparent}.el-button--text{border-color:transparent;background:0 0;color:var(--el-color-primary);padding-left:0;padding-right:0}.el-button--text.is-disabled{color:var(--el-button-disabled-text-color);background-color:transparent!important;border-color:transparent!important}.el-button--text:not(.is-disabled):focus,.el-button--text:not(.is-disabled):hover{color:var(--el-color-primary-light-3);border-color:transparent;background-color:transparent}.el-button--text:not(.is-disabled):active{color:var(--el-color-primary-dark-2);border-color:transparent;background-color:transparent}.el-button__link--expand{letter-spacing:.3em;margin-right:-.3em}.el-button--primary{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-primary);--el-button-border-color:var(--el-color-primary);--el-button-outline-color:var(--el-color-primary-light-5);--el-button-active-color:var(--el-color-primary-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-primary-light-5);--el-button-hover-bg-color:var(--el-color-primary-light-3);--el-button-hover-border-color:var(--el-color-primary-light-3);--el-button-active-bg-color:var(--el-color-primary-dark-2);--el-button-active-border-color:var(--el-color-primary-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-primary-light-5);--el-button-disabled-border-color:var(--el-color-primary-light-5)}.el-button--primary.is-link,.el-button--primary.is-plain,.el-button--primary.is-text{--el-button-text-color:var(--el-color-primary);--el-button-bg-color:var(--el-color-primary-light-9);--el-button-border-color:var(--el-color-primary-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-primary);--el-button-hover-border-color:var(--el-color-primary);--el-button-active-text-color:var(--el-color-white)}.el-button--primary.is-link.is-disabled,.el-button--primary.is-link.is-disabled:active,.el-button--primary.is-link.is-disabled:focus,.el-button--primary.is-link.is-disabled:hover,.el-button--primary.is-plain.is-disabled,.el-button--primary.is-plain.is-disabled:active,.el-button--primary.is-plain.is-disabled:focus,.el-button--primary.is-plain.is-disabled:hover,.el-button--primary.is-text.is-disabled,.el-button--primary.is-text.is-disabled:active,.el-button--primary.is-text.is-disabled:focus,.el-button--primary.is-text.is-disabled:hover{color:var(--el-color-primary-light-5);background-color:var(--el-color-primary-light-9);border-color:var(--el-color-primary-light-8)}.el-button--success{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-success);--el-button-border-color:var(--el-color-success);--el-button-outline-color:var(--el-color-success-light-5);--el-button-active-color:var(--el-color-success-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-success-light-5);--el-button-hover-bg-color:var(--el-color-success-light-3);--el-button-hover-border-color:var(--el-color-success-light-3);--el-button-active-bg-color:var(--el-color-success-dark-2);--el-button-active-border-color:var(--el-color-success-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-success-light-5);--el-button-disabled-border-color:var(--el-color-success-light-5)}.el-button--success.is-link,.el-button--success.is-plain,.el-button--success.is-text{--el-button-text-color:var(--el-color-success);--el-button-bg-color:var(--el-color-success-light-9);--el-button-border-color:var(--el-color-success-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-success);--el-button-hover-border-color:var(--el-color-success);--el-button-active-text-color:var(--el-color-white)}.el-button--success.is-link.is-disabled,.el-button--success.is-link.is-disabled:active,.el-button--success.is-link.is-disabled:focus,.el-button--success.is-link.is-disabled:hover,.el-button--success.is-plain.is-disabled,.el-button--success.is-plain.is-disabled:active,.el-button--success.is-plain.is-disabled:focus,.el-button--success.is-plain.is-disabled:hover,.el-button--success.is-text.is-disabled,.el-button--success.is-text.is-disabled:active,.el-button--success.is-text.is-disabled:focus,.el-button--success.is-text.is-disabled:hover{color:var(--el-color-success-light-5);background-color:var(--el-color-success-light-9);border-color:var(--el-color-success-light-8)}.el-button--warning{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-warning);--el-button-border-color:var(--el-color-warning);--el-button-outline-color:var(--el-color-warning-light-5);--el-button-active-color:var(--el-color-warning-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-warning-light-5);--el-button-hover-bg-color:var(--el-color-warning-light-3);--el-button-hover-border-color:var(--el-color-warning-light-3);--el-button-active-bg-color:var(--el-color-warning-dark-2);--el-button-active-border-color:var(--el-color-warning-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-warning-light-5);--el-button-disabled-border-color:var(--el-color-warning-light-5)}.el-button--warning.is-link,.el-button--warning.is-plain,.el-button--warning.is-text{--el-button-text-color:var(--el-color-warning);--el-button-bg-color:var(--el-color-warning-light-9);--el-button-border-color:var(--el-color-warning-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-warning);--el-button-hover-border-color:var(--el-color-warning);--el-button-active-text-color:var(--el-color-white)}.el-button--warning.is-link.is-disabled,.el-button--warning.is-link.is-disabled:active,.el-button--warning.is-link.is-disabled:focus,.el-button--warning.is-link.is-disabled:hover,.el-button--warning.is-plain.is-disabled,.el-button--warning.is-plain.is-disabled:active,.el-button--warning.is-plain.is-disabled:focus,.el-button--warning.is-plain.is-disabled:hover,.el-button--warning.is-text.is-disabled,.el-button--warning.is-text.is-disabled:active,.el-button--warning.is-text.is-disabled:focus,.el-button--warning.is-text.is-disabled:hover{color:var(--el-color-warning-light-5);background-color:var(--el-color-warning-light-9);border-color:var(--el-color-warning-light-8)}.el-button--danger{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-danger);--el-button-border-color:var(--el-color-danger);--el-button-outline-color:var(--el-color-danger-light-5);--el-button-active-color:var(--el-color-danger-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-danger-light-5);--el-button-hover-bg-color:var(--el-color-danger-light-3);--el-button-hover-border-color:var(--el-color-danger-light-3);--el-button-active-bg-color:var(--el-color-danger-dark-2);--el-button-active-border-color:var(--el-color-danger-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-danger-light-5);--el-button-disabled-border-color:var(--el-color-danger-light-5)}.el-button--danger.is-link,.el-button--danger.is-plain,.el-button--danger.is-text{--el-button-text-color:var(--el-color-danger);--el-button-bg-color:var(--el-color-danger-light-9);--el-button-border-color:var(--el-color-danger-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-danger);--el-button-hover-border-color:var(--el-color-danger);--el-button-active-text-color:var(--el-color-white)}.el-button--danger.is-link.is-disabled,.el-button--danger.is-link.is-disabled:active,.el-button--danger.is-link.is-disabled:focus,.el-button--danger.is-link.is-disabled:hover,.el-button--danger.is-plain.is-disabled,.el-button--danger.is-plain.is-disabled:active,.el-button--danger.is-plain.is-disabled:focus,.el-button--danger.is-plain.is-disabled:hover,.el-button--danger.is-text.is-disabled,.el-button--danger.is-text.is-disabled:active,.el-button--danger.is-text.is-disabled:focus,.el-button--danger.is-text.is-disabled:hover{color:var(--el-color-danger-light-5);background-color:var(--el-color-danger-light-9);border-color:var(--el-color-danger-light-8)}.el-button--info{--el-button-text-color:var(--el-color-white);--el-button-bg-color:var(--el-color-info);--el-button-border-color:var(--el-color-info);--el-button-outline-color:var(--el-color-info-light-5);--el-button-active-color:var(--el-color-info-dark-2);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-link-text-color:var(--el-color-info-light-5);--el-button-hover-bg-color:var(--el-color-info-light-3);--el-button-hover-border-color:var(--el-color-info-light-3);--el-button-active-bg-color:var(--el-color-info-dark-2);--el-button-active-border-color:var(--el-color-info-dark-2);--el-button-disabled-text-color:var(--el-color-white);--el-button-disabled-bg-color:var(--el-color-info-light-5);--el-button-disabled-border-color:var(--el-color-info-light-5)}.el-button--info.is-link,.el-button--info.is-plain,.el-button--info.is-text{--el-button-text-color:var(--el-color-info);--el-button-bg-color:var(--el-color-info-light-9);--el-button-border-color:var(--el-color-info-light-5);--el-button-hover-text-color:var(--el-color-white);--el-button-hover-bg-color:var(--el-color-info);--el-button-hover-border-color:var(--el-color-info);--el-button-active-text-color:var(--el-color-white)}.el-button--info.is-link.is-disabled,.el-button--info.is-link.is-disabled:active,.el-button--info.is-link.is-disabled:focus,.el-button--info.is-link.is-disabled:hover,.el-button--info.is-plain.is-disabled,.el-button--info.is-plain.is-disabled:active,.el-button--info.is-plain.is-disabled:focus,.el-button--info.is-plain.is-disabled:hover,.el-button--info.is-text.is-disabled,.el-button--info.is-text.is-disabled:active,.el-button--info.is-text.is-disabled:focus,.el-button--info.is-text.is-disabled:hover{color:var(--el-color-info-light-5);background-color:var(--el-color-info-light-9);border-color:var(--el-color-info-light-8)}.el-button--large{--el-button-size:40px;height:var(--el-button-size);padding:12px 19px;font-size:var(--el-font-size-base);border-radius:var(--el-border-radius-base)}.el-button--large [class*=el-icon]+span{margin-left:8px}.el-button--large.is-round{padding:12px 19px}.el-button--large.is-circle{width:var(--el-button-size);padding:12px}.el-button--small{--el-button-size:24px;height:var(--el-button-size);padding:5px 11px;font-size:12px;border-radius:calc(var(--el-border-radius-base) - 1px)}.el-button--small [class*=el-icon]+span{margin-left:4px}.el-button--small.is-round{padding:5px 11px}.el-button--small.is-circle{width:var(--el-button-size);padding:5px}.el-calendar{--el-calendar-border:var(--el-table-border, 1px solid var(--el-border-color-lighter));--el-calendar-header-border-bottom:var(--el-calendar-border);--el-calendar-selected-bg-color:var(--el-color-primary-light-9);--el-calendar-cell-width:85px;background-color:var(--el-fill-color-blank)}.el-calendar__header{display:flex;justify-content:space-between;padding:12px 20px;border-bottom:var(--el-calendar-header-border-bottom)}.el-calendar__title{color:var(--el-text-color);align-self:center}.el-calendar__body{padding:12px 20px 35px}.el-calendar-table{table-layout:fixed;width:100%}.el-calendar-table thead th{padding:12px 0;color:var(--el-text-color-regular);font-weight:400}.el-calendar-table:not(.is-range) td.next,.el-calendar-table:not(.is-range) td.prev{color:var(--el-text-color-placeholder)}.el-calendar-table td{border-bottom:var(--el-calendar-border);border-right:var(--el-calendar-border);vertical-align:top;transition:background-color var(--el-transition-duration-fast) ease}.el-calendar-table td.is-selected{background-color:var(--el-calendar-selected-bg-color)}.el-calendar-table td.is-today{color:var(--el-color-primary)}.el-calendar-table tr:first-child td{border-top:var(--el-calendar-border)}.el-calendar-table tr td:first-child{border-left:var(--el-calendar-border)}.el-calendar-table tr.el-calendar-table__row--hide-border td{border-top:none}.el-calendar-table .el-calendar-day{box-sizing:border-box;padding:8px;height:var(--el-calendar-cell-width)}.el-calendar-table .el-calendar-day:hover{cursor:pointer;background-color:var(--el-calendar-selected-bg-color)}.el-card{--el-card-border-color:var(--el-border-color-light);--el-card-border-radius:4px;--el-card-padding:20px;--el-card-bg-color:var(--el-fill-color-blank)}.el-card{border-radius:var(--el-card-border-radius);border:1px solid var(--el-card-border-color);background-color:var(--el-card-bg-color);overflow:hidden;color:var(--el-text-color-primary);transition:var(--el-transition-duration)}.el-card.is-always-shadow{box-shadow:var(--el-box-shadow-light)}.el-card.is-hover-shadow:focus,.el-card.is-hover-shadow:hover{box-shadow:var(--el-box-shadow-light)}.el-card__header{padding:calc(var(--el-card-padding) - 2px) var(--el-card-padding);border-bottom:1px solid var(--el-card-border-color);box-sizing:border-box}.el-card__body{padding:var(--el-card-padding)}.el-carousel__item{position:absolute;top:0;left:0;width:100%;height:100%;display:inline-block;overflow:hidden;z-index:calc(var(--el-index-normal) - 1)}.el-carousel__item.is-active{z-index:calc(var(--el-index-normal) - 1)}.el-carousel__item.is-animating{transition:transform .4s ease-in-out}.el-carousel__item--card{width:50%;transition:transform .4s ease-in-out}.el-carousel__item--card.is-in-stage{cursor:pointer;z-index:var(--el-index-normal)}.el-carousel__item--card.is-in-stage.is-hover .el-carousel__mask,.el-carousel__item--card.is-in-stage:hover .el-carousel__mask{opacity:.12}.el-carousel__item--card.is-active{z-index:calc(var(--el-index-normal) + 1)}.el-carousel__mask{position:absolute;width:100%;height:100%;top:0;left:0;background-color:var(--el-color-white);opacity:.24;transition:var(--el-transition-duration-fast)}.el-carousel{--el-carousel-arrow-font-size:12px;--el-carousel-arrow-size:36px;--el-carousel-arrow-background:rgba(31, 45, 61, .11);--el-carousel-arrow-hover-background:rgba(31, 45, 61, .23);--el-carousel-indicator-width:30px;--el-carousel-indicator-height:2px;--el-carousel-indicator-padding-horizontal:4px;--el-carousel-indicator-padding-vertical:12px;--el-carousel-indicator-out-color:var(--el-border-color-hover);position:relative}.el-carousel--horizontal{overflow-x:hidden}.el-carousel--vertical{overflow-y:hidden}.el-carousel__container{position:relative;height:300px}.el-carousel__arrow{border:none;outline:0;padding:0;margin:0;height:var(--el-carousel-arrow-size);width:var(--el-carousel-arrow-size);cursor:pointer;transition:var(--el-transition-duration);border-radius:50%;background-color:var(--el-carousel-arrow-background);color:#fff;position:absolute;top:50%;z-index:10;transform:translateY(-50%);text-align:center;font-size:var(--el-carousel-arrow-font-size);display:inline-flex;justify-content:center;align-items:center}.el-carousel__arrow--left{left:16px}.el-carousel__arrow--right{right:16px}.el-carousel__arrow:hover{background-color:var(--el-carousel-arrow-hover-background)}.el-carousel__arrow i{cursor:pointer}.el-carousel__indicators{position:absolute;list-style:none;margin:0;padding:0;z-index:calc(var(--el-index-normal) + 1)}.el-carousel__indicators--horizontal{bottom:0;left:50%;transform:translate(-50%)}.el-carousel__indicators--vertical{right:0;top:50%;transform:translateY(-50%)}.el-carousel__indicators--outside{bottom:calc(var(--el-carousel-indicator-height) + var(--el-carousel-indicator-padding-vertical) * 2);text-align:center;position:static;transform:none}.el-carousel__indicators--outside .el-carousel__indicator:hover button{opacity:.64}.el-carousel__indicators--outside button{background-color:var(--el-carousel-indicator-out-color);opacity:.24}.el-carousel__indicators--labels{left:0;right:0;transform:none;text-align:center}.el-carousel__indicators--labels .el-carousel__button{height:auto;width:auto;padding:2px 18px;font-size:12px;color:#000}.el-carousel__indicators--labels .el-carousel__indicator{padding:6px 4px}.el-carousel__indicator{background-color:transparent;cursor:pointer}.el-carousel__indicator:hover button{opacity:.72}.el-carousel__indicator--horizontal{display:inline-block;padding:var(--el-carousel-indicator-padding-vertical) var(--el-carousel-indicator-padding-horizontal)}.el-carousel__indicator--vertical{padding:var(--el-carousel-indicator-padding-horizontal) var(--el-carousel-indicator-padding-vertical)}.el-carousel__indicator--vertical .el-carousel__button{width:var(--el-carousel-indicator-height);height:calc(var(--el-carousel-indicator-width)/ 2)}.el-carousel__indicator.is-active button{opacity:1}.el-carousel__button{display:block;opacity:.48;width:var(--el-carousel-indicator-width);height:var(--el-carousel-indicator-height);background-color:#fff;border:none;outline:0;padding:0;margin:0;cursor:pointer;transition:var(--el-transition-duration)}.carousel-arrow-left-enter-from,.carousel-arrow-left-leave-active{transform:translateY(-50%) translate(-10px);opacity:0}.carousel-arrow-right-enter-from,.carousel-arrow-right-leave-active{transform:translateY(-50%) translate(10px);opacity:0}.el-cascader-panel{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color)}.el-cascader-panel{display:flex;border-radius:var(--el-cascader-menu-radius);font-size:var(--el-cascader-menu-font-size)}.el-cascader-panel.is-bordered{border:var(--el-cascader-menu-border);border-radius:var(--el-cascader-menu-radius)}.el-cascader-menu{min-width:180px;box-sizing:border-box;color:var(--el-cascader-menu-text-color);border-right:var(--el-cascader-menu-border)}.el-cascader-menu:last-child{border-right:none}.el-cascader-menu:last-child .el-cascader-node{padding-right:20px}.el-cascader-menu__wrap.el-scrollbar__wrap{height:204px}.el-cascader-menu__list{position:relative;min-height:100%;margin:0;padding:6px 0;list-style:none;box-sizing:border-box}.el-cascader-menu__hover-zone{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none}.el-cascader-menu__empty-text{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);display:flex;align-items:center;color:var(--el-cascader-color-empty)}.el-cascader-menu__empty-text .is-loading{margin-right:2px}.el-cascader-node{position:relative;display:flex;align-items:center;padding:0 30px 0 20px;height:34px;line-height:34px;outline:0}.el-cascader-node.is-selectable.in-active-path{color:var(--el-cascader-menu-text-color)}.el-cascader-node.in-active-path,.el-cascader-node.is-active,.el-cascader-node.is-selectable.in-checked-path{color:var(--el-cascader-menu-selected-text-color);font-weight:700}.el-cascader-node:not(.is-disabled){cursor:pointer}.el-cascader-node:not(.is-disabled):focus,.el-cascader-node:not(.is-disabled):hover{background:var(--el-cascader-node-background-hover)}.el-cascader-node.is-disabled{color:var(--el-cascader-node-color-disabled);cursor:not-allowed}.el-cascader-node__prefix{position:absolute;left:10px}.el-cascader-node__postfix{position:absolute;right:10px}.el-cascader-node__label{flex:1;text-align:left;padding:0 8px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.el-cascader-node>.el-checkbox{margin-right:0}.el-cascader-node>.el-radio{margin-right:0}.el-cascader-node>.el-radio .el-radio__label{padding-left:0}.el-cascader{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color);display:inline-block;vertical-align:middle;position:relative;font-size:var(--el-font-size-base);line-height:32px;outline:0}.el-cascader:not(.is-disabled):hover .el-input__wrapper{cursor:pointer;box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-cascader .el-input{display:flex;cursor:pointer}.el-cascader .el-input .el-input__inner{text-overflow:ellipsis;cursor:pointer}.el-cascader .el-input .el-input__suffix-inner .el-icon{height:calc(100% - 2px)}.el-cascader .el-input .el-input__suffix-inner .el-icon svg{vertical-align:middle}.el-cascader .el-input .icon-arrow-down{transition:transform var(--el-transition-duration);font-size:14px}.el-cascader .el-input .icon-arrow-down.is-reverse{transform:rotate(180deg)}.el-cascader .el-input .icon-circle-close:hover{color:var(--el-input-clear-hover-color,var(--el-text-color-secondary))}.el-cascader .el-input.is-focus .el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-focus-border-color,var(--el-color-primary)) inset}.el-cascader--large{font-size:14px;line-height:40px}.el-cascader--small{font-size:12px;line-height:24px}.el-cascader.is-disabled .el-cascader__label{z-index:calc(var(--el-index-normal) + 1);color:var(--el-disabled-text-color)}.el-cascader__dropdown{--el-cascader-menu-text-color:var(--el-text-color-regular);--el-cascader-menu-selected-text-color:var(--el-color-primary);--el-cascader-menu-fill:var(--el-bg-color-overlay);--el-cascader-menu-font-size:var(--el-font-size-base);--el-cascader-menu-radius:var(--el-border-radius-base);--el-cascader-menu-border:solid 1px var(--el-border-color-light);--el-cascader-menu-shadow:var(--el-box-shadow-light);--el-cascader-node-background-hover:var(--el-fill-color-light);--el-cascader-node-color-disabled:var(--el-text-color-placeholder);--el-cascader-color-empty:var(--el-text-color-placeholder);--el-cascader-tag-background:var(--el-fill-color)}.el-cascader__dropdown{font-size:var(--el-cascader-menu-font-size);border-radius:var(--el-cascader-menu-radius)}.el-cascader__dropdown.el-popper{background:var(--el-cascader-menu-fill);border:var(--el-cascader-menu-border);box-shadow:var(--el-cascader-menu-shadow)}.el-cascader__dropdown.el-popper .el-popper__arrow:before{border:var(--el-cascader-menu-border)}.el-cascader__dropdown.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-cascader__dropdown.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-cascader__dropdown.el-popper{box-shadow:var(--el-cascader-menu-shadow)}.el-cascader__tags{position:absolute;left:0;right:30px;top:50%;transform:translateY(-50%);display:flex;flex-wrap:wrap;line-height:normal;text-align:left;box-sizing:border-box}.el-cascader__tags .el-tag{display:inline-flex;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:var(--el-cascader-tag-background)}.el-cascader__tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__tags .el-tag>span{flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__tags .el-tag .el-icon-close{flex:none;background-color:var(--el-text-color-placeholder);color:var(--el-color-white)}.el-cascader__tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-cascader__collapse-tags{white-space:normal;z-index:var(--el-index-normal)}.el-cascader__collapse-tags .el-tag{display:inline-flex;align-items:center;max-width:100%;margin:2px 0 2px 6px;text-overflow:ellipsis;background:var(--el-fill-color)}.el-cascader__collapse-tags .el-tag:not(.is-hit){border-color:transparent}.el-cascader__collapse-tags .el-tag>span{flex:1;overflow:hidden;text-overflow:ellipsis}.el-cascader__collapse-tags .el-tag .el-icon-close{flex:none;background-color:var(--el-text-color-placeholder);color:var(--el-color-white)}.el-cascader__collapse-tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-cascader__suggestion-panel{border-radius:var(--el-cascader-menu-radius)}.el-cascader__suggestion-list{max-height:204px;margin:0;padding:6px 0;font-size:var(--el-font-size-base);color:var(--el-cascader-menu-text-color);text-align:center}.el-cascader__suggestion-item{display:flex;justify-content:space-between;align-items:center;height:34px;padding:0 15px;text-align:left;outline:0;cursor:pointer}.el-cascader__suggestion-item:focus,.el-cascader__suggestion-item:hover{background:var(--el-cascader-node-background-hover)}.el-cascader__suggestion-item.is-checked{color:var(--el-cascader-menu-selected-text-color);font-weight:700}.el-cascader__suggestion-item>span{margin-right:10px}.el-cascader__empty-text{margin:10px 0;color:var(--el-cascader-color-empty)}.el-cascader__search-input{flex:1;height:24px;min-width:60px;margin:2px 0 2px 11px;padding:0;color:var(--el-cascader-menu-text-color);border:none;outline:0;box-sizing:border-box;background:0 0}.el-cascader__search-input::-moz-placeholder{color:transparent}.el-cascader__search-input:-ms-input-placeholder{color:transparent}.el-cascader__search-input::placeholder{color:transparent}.el-check-tag{background-color:var(--el-color-info-light-9);border-radius:var(--el-border-radius-base);color:var(--el-color-info);cursor:pointer;display:inline-block;font-size:var(--el-font-size-base);line-height:var(--el-font-size-base);padding:7px 15px;transition:var(--el-transition-all);font-weight:700}.el-check-tag:hover{background-color:var(--el-color-info-light-7)}.el-check-tag.is-checked{background-color:var(--el-color-primary-light-8);color:var(--el-color-primary)}.el-check-tag.is-checked:hover{background-color:var(--el-color-primary-light-7)}.el-checkbox-button{--el-checkbox-button-checked-bg-color:var(--el-color-primary);--el-checkbox-button-checked-text-color:var(--el-color-white);--el-checkbox-button-checked-border-color:var(--el-color-primary)}.el-checkbox-button{position:relative;display:inline-block}.el-checkbox-button__inner{display:inline-block;line-height:1;font-weight:var(--el-checkbox-font-weight);white-space:nowrap;vertical-align:middle;cursor:pointer;background:var(--el-button-bg-color,var(--el-fill-color-blank));border:var(--el-border);border-left:0;color:var(--el-button-text-color,var(--el-text-color-regular));-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:0;margin:0;position:relative;transition:var(--el-transition-all);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:8px 15px;font-size:var(--el-font-size-base);border-radius:0}.el-checkbox-button__inner.is-round{padding:8px 15px}.el-checkbox-button__inner:hover{color:var(--el-color-primary)}.el-checkbox-button__inner [class*=el-icon-]{line-height:.9}.el-checkbox-button__inner [class*=el-icon-]+span{margin-left:5px}.el-checkbox-button__original{opacity:0;outline:0;position:absolute;margin:0;z-index:-1}.el-checkbox-button.is-checked .el-checkbox-button__inner{color:var(--el-checkbox-button-checked-text-color);background-color:var(--el-checkbox-button-checked-bg-color);border-color:var(--el-checkbox-button-checked-border-color);box-shadow:-1px 0 0 0 var(--el-color-primary-light-7)}.el-checkbox-button.is-checked:first-child .el-checkbox-button__inner{border-left-color:var(--el-checkbox-button-checked-border-color)}.el-checkbox-button.is-disabled .el-checkbox-button__inner{color:var(--el-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color,var(--el-fill-color-blank));border-color:var(--el-button-disabled-border-color,var(--el-border-color-light));box-shadow:none}.el-checkbox-button.is-disabled:first-child .el-checkbox-button__inner{border-left-color:var(--el-button-disabled-border-color,var(--el-border-color-light))}.el-checkbox-button:first-child .el-checkbox-button__inner{border-left:var(--el-border);border-top-left-radius:var(--el-border-radius-base);border-bottom-left-radius:var(--el-border-radius-base);box-shadow:none!important}.el-checkbox-button.is-focus .el-checkbox-button__inner{border-color:var(--el-checkbox-button-checked-border-color)}.el-checkbox-button:last-child .el-checkbox-button__inner{border-top-right-radius:var(--el-border-radius-base);border-bottom-right-radius:var(--el-border-radius-base)}.el-checkbox-button--large .el-checkbox-button__inner{padding:12px 19px;font-size:var(--el-font-size-base);border-radius:0}.el-checkbox-button--large .el-checkbox-button__inner.is-round{padding:12px 19px}.el-checkbox-button--small .el-checkbox-button__inner{padding:5px 11px;font-size:12px;border-radius:0}.el-checkbox-button--small .el-checkbox-button__inner.is-round{padding:5px 11px}.el-checkbox-group{font-size:0;line-height:0}.el-checkbox{--el-checkbox-font-size:14px;--el-checkbox-font-weight:var(--el-font-weight-primary);--el-checkbox-text-color:var(--el-text-color-regular);--el-checkbox-input-height:14px;--el-checkbox-input-width:14px;--el-checkbox-border-radius:var(--el-border-radius-small);--el-checkbox-bg-color:var(--el-fill-color-blank);--el-checkbox-input-border:var(--el-border);--el-checkbox-disabled-border-color:var(--el-border-color);--el-checkbox-disabled-input-fill:var(--el-fill-color-light);--el-checkbox-disabled-icon-color:var(--el-text-color-placeholder);--el-checkbox-disabled-checked-input-fill:var(--el-border-color-extra-light);--el-checkbox-disabled-checked-input-border-color:var(--el-border-color);--el-checkbox-disabled-checked-icon-color:var(--el-text-color-placeholder);--el-checkbox-checked-text-color:var(--el-color-primary);--el-checkbox-checked-input-border-color:var(--el-color-primary);--el-checkbox-checked-bg-color:var(--el-color-primary);--el-checkbox-checked-icon-color:var(--el-color-white);--el-checkbox-input-border-color-hover:var(--el-color-primary)}.el-checkbox{color:var(--el-checkbox-text-color);font-weight:var(--el-checkbox-font-weight);font-size:var(--el-font-size-base);position:relative;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:30px;height:32px}.el-checkbox.is-disabled{cursor:not-allowed}.el-checkbox.is-bordered{padding:0 15px 0 9px;border-radius:var(--el-border-radius-base);border:var(--el-border);box-sizing:border-box}.el-checkbox.is-bordered.is-checked{border-color:var(--el-color-primary)}.el-checkbox.is-bordered.is-disabled{border-color:var(--el-border-color-lighter)}.el-checkbox.is-bordered.el-checkbox--large{padding:0 19px 0 11px;border-radius:var(--el-border-radius-base)}.el-checkbox.is-bordered.el-checkbox--large .el-checkbox__label{font-size:var(--el-font-size-base)}.el-checkbox.is-bordered.el-checkbox--large .el-checkbox__inner{height:14px;width:14px}.el-checkbox.is-bordered.el-checkbox--small{padding:0 11px 0 7px;border-radius:calc(var(--el-border-radius-base) - 1px)}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__label{font-size:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner{height:12px;width:12px}.el-checkbox.is-bordered.el-checkbox--small .el-checkbox__inner:after{height:6px;width:2px}.el-checkbox input:focus-visible+.el-checkbox__inner{outline:2px solid var(--el-checkbox-input-border-color-hover);outline-offset:1px;border-radius:var(--el-checkbox-border-radius)}.el-checkbox__input{white-space:nowrap;cursor:pointer;outline:0;display:inline-flex;position:relative}.el-checkbox__input.is-disabled .el-checkbox__inner{background-color:var(--el-checkbox-disabled-input-fill);border-color:var(--el-checkbox-disabled-border-color);cursor:not-allowed}.el-checkbox__input.is-disabled .el-checkbox__inner:after{cursor:not-allowed;border-color:var(--el-checkbox-disabled-icon-color)}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner{background-color:var(--el-checkbox-disabled-checked-input-fill);border-color:var(--el-checkbox-disabled-checked-input-border-color)}.el-checkbox__input.is-disabled.is-checked .el-checkbox__inner:after{border-color:var(--el-checkbox-disabled-checked-icon-color)}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner{background-color:var(--el-checkbox-disabled-checked-input-fill);border-color:var(--el-checkbox-disabled-checked-input-border-color)}.el-checkbox__input.is-disabled.is-indeterminate .el-checkbox__inner:before{background-color:var(--el-checkbox-disabled-checked-icon-color);border-color:var(--el-checkbox-disabled-checked-icon-color)}.el-checkbox__input.is-disabled+span.el-checkbox__label{color:var(--el-disabled-text-color);cursor:not-allowed}.el-checkbox__input.is-checked .el-checkbox__inner{background-color:var(--el-checkbox-checked-bg-color);border-color:var(--el-checkbox-checked-input-border-color)}.el-checkbox__input.is-checked .el-checkbox__inner:after{transform:rotate(45deg) scaleY(1)}.el-checkbox__input.is-checked+.el-checkbox__label{color:var(--el-checkbox-checked-text-color)}.el-checkbox__input.is-focus:not(.is-checked) .el-checkbox__original:not(:focus-visible){border-color:var(--el-checkbox-input-border-color-hover)}.el-checkbox__input.is-indeterminate .el-checkbox__inner{background-color:var(--el-checkbox-checked-bg-color);border-color:var(--el-checkbox-checked-input-border-color)}.el-checkbox__input.is-indeterminate .el-checkbox__inner:before{content:"";position:absolute;display:block;background-color:var(--el-checkbox-checked-icon-color);height:2px;transform:scale(.5);left:0;right:0;top:5px}.el-checkbox__input.is-indeterminate .el-checkbox__inner:after{display:none}.el-checkbox__inner{display:inline-block;position:relative;border:var(--el-checkbox-input-border);border-radius:var(--el-checkbox-border-radius);box-sizing:border-box;width:var(--el-checkbox-input-width);height:var(--el-checkbox-input-height);background-color:var(--el-checkbox-bg-color);z-index:var(--el-index-normal);transition:border-color .25s cubic-bezier(.71,-.46,.29,1.46),background-color .25s cubic-bezier(.71,-.46,.29,1.46),outline .25s cubic-bezier(.71,-.46,.29,1.46)}.el-checkbox__inner:hover{border-color:var(--el-checkbox-input-border-color-hover)}.el-checkbox__inner:after{box-sizing:content-box;content:"";border:1px solid var(--el-checkbox-checked-icon-color);border-left:0;border-top:0;height:7px;left:4px;position:absolute;top:1px;transform:rotate(45deg) scaleY(0);width:3px;transition:transform .15s ease-in 50ms;transform-origin:center}.el-checkbox__original{opacity:0;outline:0;position:absolute;margin:0;width:0;height:0;z-index:-1}.el-checkbox__label{display:inline-block;padding-left:8px;line-height:1;font-size:var(--el-checkbox-font-size)}.el-checkbox.el-checkbox--large{height:40px}.el-checkbox.el-checkbox--large .el-checkbox__label{font-size:14px}.el-checkbox.el-checkbox--large .el-checkbox__inner{width:14px;height:14px}.el-checkbox.el-checkbox--small{height:24px}.el-checkbox.el-checkbox--small .el-checkbox__label{font-size:12px}.el-checkbox.el-checkbox--small .el-checkbox__inner{width:12px;height:12px}.el-checkbox.el-checkbox--small .el-checkbox__input.is-indeterminate .el-checkbox__inner:before{top:4px}.el-checkbox.el-checkbox--small .el-checkbox__inner:after{width:2px;height:6px}.el-checkbox:last-of-type{margin-right:0}[class*=el-col-]{box-sizing:border-box}[class*=el-col-].is-guttered{display:block;min-height:1px}.el-col-0,.el-col-0.is-guttered{display:none}.el-col-0{max-width:0%;flex:0 0 0%}.el-col-offset-0{margin-left:0}.el-col-pull-0{position:relative;right:0}.el-col-push-0{position:relative;left:0}.el-col-1{max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-offset-1{margin-left:4.1666666667%}.el-col-pull-1{position:relative;right:4.1666666667%}.el-col-push-1{position:relative;left:4.1666666667%}.el-col-2{max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-offset-2{margin-left:8.3333333333%}.el-col-pull-2{position:relative;right:8.3333333333%}.el-col-push-2{position:relative;left:8.3333333333%}.el-col-3{max-width:12.5%;flex:0 0 12.5%}.el-col-offset-3{margin-left:12.5%}.el-col-pull-3{position:relative;right:12.5%}.el-col-push-3{position:relative;left:12.5%}.el-col-4{max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-offset-4{margin-left:16.6666666667%}.el-col-pull-4{position:relative;right:16.6666666667%}.el-col-push-4{position:relative;left:16.6666666667%}.el-col-5{max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-offset-5{margin-left:20.8333333333%}.el-col-pull-5{position:relative;right:20.8333333333%}.el-col-push-5{position:relative;left:20.8333333333%}.el-col-6{max-width:25%;flex:0 0 25%}.el-col-offset-6{margin-left:25%}.el-col-pull-6{position:relative;right:25%}.el-col-push-6{position:relative;left:25%}.el-col-7{max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-offset-7{margin-left:29.1666666667%}.el-col-pull-7{position:relative;right:29.1666666667%}.el-col-push-7{position:relative;left:29.1666666667%}.el-col-8{max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-offset-8{margin-left:33.3333333333%}.el-col-pull-8{position:relative;right:33.3333333333%}.el-col-push-8{position:relative;left:33.3333333333%}.el-col-9{max-width:37.5%;flex:0 0 37.5%}.el-col-offset-9{margin-left:37.5%}.el-col-pull-9{position:relative;right:37.5%}.el-col-push-9{position:relative;left:37.5%}.el-col-10{max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-offset-10{margin-left:41.6666666667%}.el-col-pull-10{position:relative;right:41.6666666667%}.el-col-push-10{position:relative;left:41.6666666667%}.el-col-11{max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-offset-11{margin-left:45.8333333333%}.el-col-pull-11{position:relative;right:45.8333333333%}.el-col-push-11{position:relative;left:45.8333333333%}.el-col-12{max-width:50%;flex:0 0 50%}.el-col-offset-12{margin-left:50%}.el-col-pull-12{position:relative;right:50%}.el-col-push-12{position:relative;left:50%}.el-col-13{max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-offset-13{margin-left:54.1666666667%}.el-col-pull-13{position:relative;right:54.1666666667%}.el-col-push-13{position:relative;left:54.1666666667%}.el-col-14{max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-offset-14{margin-left:58.3333333333%}.el-col-pull-14{position:relative;right:58.3333333333%}.el-col-push-14{position:relative;left:58.3333333333%}.el-col-15{max-width:62.5%;flex:0 0 62.5%}.el-col-offset-15{margin-left:62.5%}.el-col-pull-15{position:relative;right:62.5%}.el-col-push-15{position:relative;left:62.5%}.el-col-16{max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-offset-16{margin-left:66.6666666667%}.el-col-pull-16{position:relative;right:66.6666666667%}.el-col-push-16{position:relative;left:66.6666666667%}.el-col-17{max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-offset-17{margin-left:70.8333333333%}.el-col-pull-17{position:relative;right:70.8333333333%}.el-col-push-17{position:relative;left:70.8333333333%}.el-col-18{max-width:75%;flex:0 0 75%}.el-col-offset-18{margin-left:75%}.el-col-pull-18{position:relative;right:75%}.el-col-push-18{position:relative;left:75%}.el-col-19{max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-offset-19{margin-left:79.1666666667%}.el-col-pull-19{position:relative;right:79.1666666667%}.el-col-push-19{position:relative;left:79.1666666667%}.el-col-20{max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-offset-20{margin-left:83.3333333333%}.el-col-pull-20{position:relative;right:83.3333333333%}.el-col-push-20{position:relative;left:83.3333333333%}.el-col-21{max-width:87.5%;flex:0 0 87.5%}.el-col-offset-21{margin-left:87.5%}.el-col-pull-21{position:relative;right:87.5%}.el-col-push-21{position:relative;left:87.5%}.el-col-22{max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-offset-22{margin-left:91.6666666667%}.el-col-pull-22{position:relative;right:91.6666666667%}.el-col-push-22{position:relative;left:91.6666666667%}.el-col-23{max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-offset-23{margin-left:95.8333333333%}.el-col-pull-23{position:relative;right:95.8333333333%}.el-col-push-23{position:relative;left:95.8333333333%}.el-col-24{max-width:100%;flex:0 0 100%}.el-col-offset-24{margin-left:100%}.el-col-pull-24{position:relative;right:100%}.el-col-push-24{position:relative;left:100%}@media only screen and (max-width:768px){.el-col-xs-0,.el-col-xs-0.is-guttered{display:none}.el-col-xs-0{max-width:0%;flex:0 0 0%}.el-col-xs-offset-0{margin-left:0}.el-col-xs-pull-0{position:relative;right:0}.el-col-xs-push-0{position:relative;left:0}.el-col-xs-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-xs-offset-1{margin-left:4.1666666667%}.el-col-xs-pull-1{position:relative;right:4.1666666667%}.el-col-xs-push-1{position:relative;left:4.1666666667%}.el-col-xs-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-xs-offset-2{margin-left:8.3333333333%}.el-col-xs-pull-2{position:relative;right:8.3333333333%}.el-col-xs-push-2{position:relative;left:8.3333333333%}.el-col-xs-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-xs-offset-3{margin-left:12.5%}.el-col-xs-pull-3{position:relative;right:12.5%}.el-col-xs-push-3{position:relative;left:12.5%}.el-col-xs-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-xs-offset-4{margin-left:16.6666666667%}.el-col-xs-pull-4{position:relative;right:16.6666666667%}.el-col-xs-push-4{position:relative;left:16.6666666667%}.el-col-xs-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-xs-offset-5{margin-left:20.8333333333%}.el-col-xs-pull-5{position:relative;right:20.8333333333%}.el-col-xs-push-5{position:relative;left:20.8333333333%}.el-col-xs-6{display:block;max-width:25%;flex:0 0 25%}.el-col-xs-offset-6{margin-left:25%}.el-col-xs-pull-6{position:relative;right:25%}.el-col-xs-push-6{position:relative;left:25%}.el-col-xs-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-xs-offset-7{margin-left:29.1666666667%}.el-col-xs-pull-7{position:relative;right:29.1666666667%}.el-col-xs-push-7{position:relative;left:29.1666666667%}.el-col-xs-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-xs-offset-8{margin-left:33.3333333333%}.el-col-xs-pull-8{position:relative;right:33.3333333333%}.el-col-xs-push-8{position:relative;left:33.3333333333%}.el-col-xs-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-xs-offset-9{margin-left:37.5%}.el-col-xs-pull-9{position:relative;right:37.5%}.el-col-xs-push-9{position:relative;left:37.5%}.el-col-xs-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-xs-offset-10{margin-left:41.6666666667%}.el-col-xs-pull-10{position:relative;right:41.6666666667%}.el-col-xs-push-10{position:relative;left:41.6666666667%}.el-col-xs-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-xs-offset-11{margin-left:45.8333333333%}.el-col-xs-pull-11{position:relative;right:45.8333333333%}.el-col-xs-push-11{position:relative;left:45.8333333333%}.el-col-xs-12{display:block;max-width:50%;flex:0 0 50%}.el-col-xs-offset-12{margin-left:50%}.el-col-xs-pull-12{position:relative;right:50%}.el-col-xs-push-12{position:relative;left:50%}.el-col-xs-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-xs-offset-13{margin-left:54.1666666667%}.el-col-xs-pull-13{position:relative;right:54.1666666667%}.el-col-xs-push-13{position:relative;left:54.1666666667%}.el-col-xs-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-xs-offset-14{margin-left:58.3333333333%}.el-col-xs-pull-14{position:relative;right:58.3333333333%}.el-col-xs-push-14{position:relative;left:58.3333333333%}.el-col-xs-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-xs-offset-15{margin-left:62.5%}.el-col-xs-pull-15{position:relative;right:62.5%}.el-col-xs-push-15{position:relative;left:62.5%}.el-col-xs-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-xs-offset-16{margin-left:66.6666666667%}.el-col-xs-pull-16{position:relative;right:66.6666666667%}.el-col-xs-push-16{position:relative;left:66.6666666667%}.el-col-xs-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-xs-offset-17{margin-left:70.8333333333%}.el-col-xs-pull-17{position:relative;right:70.8333333333%}.el-col-xs-push-17{position:relative;left:70.8333333333%}.el-col-xs-18{display:block;max-width:75%;flex:0 0 75%}.el-col-xs-offset-18{margin-left:75%}.el-col-xs-pull-18{position:relative;right:75%}.el-col-xs-push-18{position:relative;left:75%}.el-col-xs-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-xs-offset-19{margin-left:79.1666666667%}.el-col-xs-pull-19{position:relative;right:79.1666666667%}.el-col-xs-push-19{position:relative;left:79.1666666667%}.el-col-xs-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-xs-offset-20{margin-left:83.3333333333%}.el-col-xs-pull-20{position:relative;right:83.3333333333%}.el-col-xs-push-20{position:relative;left:83.3333333333%}.el-col-xs-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-xs-offset-21{margin-left:87.5%}.el-col-xs-pull-21{position:relative;right:87.5%}.el-col-xs-push-21{position:relative;left:87.5%}.el-col-xs-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-xs-offset-22{margin-left:91.6666666667%}.el-col-xs-pull-22{position:relative;right:91.6666666667%}.el-col-xs-push-22{position:relative;left:91.6666666667%}.el-col-xs-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-xs-offset-23{margin-left:95.8333333333%}.el-col-xs-pull-23{position:relative;right:95.8333333333%}.el-col-xs-push-23{position:relative;left:95.8333333333%}.el-col-xs-24{display:block;max-width:100%;flex:0 0 100%}.el-col-xs-offset-24{margin-left:100%}.el-col-xs-pull-24{position:relative;right:100%}.el-col-xs-push-24{position:relative;left:100%}}@media only screen and (min-width:768px){.el-col-sm-0,.el-col-sm-0.is-guttered{display:none}.el-col-sm-0{max-width:0%;flex:0 0 0%}.el-col-sm-offset-0{margin-left:0}.el-col-sm-pull-0{position:relative;right:0}.el-col-sm-push-0{position:relative;left:0}.el-col-sm-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-sm-offset-1{margin-left:4.1666666667%}.el-col-sm-pull-1{position:relative;right:4.1666666667%}.el-col-sm-push-1{position:relative;left:4.1666666667%}.el-col-sm-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-sm-offset-2{margin-left:8.3333333333%}.el-col-sm-pull-2{position:relative;right:8.3333333333%}.el-col-sm-push-2{position:relative;left:8.3333333333%}.el-col-sm-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-sm-offset-3{margin-left:12.5%}.el-col-sm-pull-3{position:relative;right:12.5%}.el-col-sm-push-3{position:relative;left:12.5%}.el-col-sm-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-sm-offset-4{margin-left:16.6666666667%}.el-col-sm-pull-4{position:relative;right:16.6666666667%}.el-col-sm-push-4{position:relative;left:16.6666666667%}.el-col-sm-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-sm-offset-5{margin-left:20.8333333333%}.el-col-sm-pull-5{position:relative;right:20.8333333333%}.el-col-sm-push-5{position:relative;left:20.8333333333%}.el-col-sm-6{display:block;max-width:25%;flex:0 0 25%}.el-col-sm-offset-6{margin-left:25%}.el-col-sm-pull-6{position:relative;right:25%}.el-col-sm-push-6{position:relative;left:25%}.el-col-sm-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-sm-offset-7{margin-left:29.1666666667%}.el-col-sm-pull-7{position:relative;right:29.1666666667%}.el-col-sm-push-7{position:relative;left:29.1666666667%}.el-col-sm-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-sm-offset-8{margin-left:33.3333333333%}.el-col-sm-pull-8{position:relative;right:33.3333333333%}.el-col-sm-push-8{position:relative;left:33.3333333333%}.el-col-sm-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-sm-offset-9{margin-left:37.5%}.el-col-sm-pull-9{position:relative;right:37.5%}.el-col-sm-push-9{position:relative;left:37.5%}.el-col-sm-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-sm-offset-10{margin-left:41.6666666667%}.el-col-sm-pull-10{position:relative;right:41.6666666667%}.el-col-sm-push-10{position:relative;left:41.6666666667%}.el-col-sm-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-sm-offset-11{margin-left:45.8333333333%}.el-col-sm-pull-11{position:relative;right:45.8333333333%}.el-col-sm-push-11{position:relative;left:45.8333333333%}.el-col-sm-12{display:block;max-width:50%;flex:0 0 50%}.el-col-sm-offset-12{margin-left:50%}.el-col-sm-pull-12{position:relative;right:50%}.el-col-sm-push-12{position:relative;left:50%}.el-col-sm-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-sm-offset-13{margin-left:54.1666666667%}.el-col-sm-pull-13{position:relative;right:54.1666666667%}.el-col-sm-push-13{position:relative;left:54.1666666667%}.el-col-sm-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-sm-offset-14{margin-left:58.3333333333%}.el-col-sm-pull-14{position:relative;right:58.3333333333%}.el-col-sm-push-14{position:relative;left:58.3333333333%}.el-col-sm-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-sm-offset-15{margin-left:62.5%}.el-col-sm-pull-15{position:relative;right:62.5%}.el-col-sm-push-15{position:relative;left:62.5%}.el-col-sm-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-sm-offset-16{margin-left:66.6666666667%}.el-col-sm-pull-16{position:relative;right:66.6666666667%}.el-col-sm-push-16{position:relative;left:66.6666666667%}.el-col-sm-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-sm-offset-17{margin-left:70.8333333333%}.el-col-sm-pull-17{position:relative;right:70.8333333333%}.el-col-sm-push-17{position:relative;left:70.8333333333%}.el-col-sm-18{display:block;max-width:75%;flex:0 0 75%}.el-col-sm-offset-18{margin-left:75%}.el-col-sm-pull-18{position:relative;right:75%}.el-col-sm-push-18{position:relative;left:75%}.el-col-sm-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-sm-offset-19{margin-left:79.1666666667%}.el-col-sm-pull-19{position:relative;right:79.1666666667%}.el-col-sm-push-19{position:relative;left:79.1666666667%}.el-col-sm-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-sm-offset-20{margin-left:83.3333333333%}.el-col-sm-pull-20{position:relative;right:83.3333333333%}.el-col-sm-push-20{position:relative;left:83.3333333333%}.el-col-sm-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-sm-offset-21{margin-left:87.5%}.el-col-sm-pull-21{position:relative;right:87.5%}.el-col-sm-push-21{position:relative;left:87.5%}.el-col-sm-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-sm-offset-22{margin-left:91.6666666667%}.el-col-sm-pull-22{position:relative;right:91.6666666667%}.el-col-sm-push-22{position:relative;left:91.6666666667%}.el-col-sm-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-sm-offset-23{margin-left:95.8333333333%}.el-col-sm-pull-23{position:relative;right:95.8333333333%}.el-col-sm-push-23{position:relative;left:95.8333333333%}.el-col-sm-24{display:block;max-width:100%;flex:0 0 100%}.el-col-sm-offset-24{margin-left:100%}.el-col-sm-pull-24{position:relative;right:100%}.el-col-sm-push-24{position:relative;left:100%}}@media only screen and (min-width:992px){.el-col-md-0,.el-col-md-0.is-guttered{display:none}.el-col-md-0{max-width:0%;flex:0 0 0%}.el-col-md-offset-0{margin-left:0}.el-col-md-pull-0{position:relative;right:0}.el-col-md-push-0{position:relative;left:0}.el-col-md-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-md-offset-1{margin-left:4.1666666667%}.el-col-md-pull-1{position:relative;right:4.1666666667%}.el-col-md-push-1{position:relative;left:4.1666666667%}.el-col-md-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-md-offset-2{margin-left:8.3333333333%}.el-col-md-pull-2{position:relative;right:8.3333333333%}.el-col-md-push-2{position:relative;left:8.3333333333%}.el-col-md-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-md-offset-3{margin-left:12.5%}.el-col-md-pull-3{position:relative;right:12.5%}.el-col-md-push-3{position:relative;left:12.5%}.el-col-md-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-md-offset-4{margin-left:16.6666666667%}.el-col-md-pull-4{position:relative;right:16.6666666667%}.el-col-md-push-4{position:relative;left:16.6666666667%}.el-col-md-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-md-offset-5{margin-left:20.8333333333%}.el-col-md-pull-5{position:relative;right:20.8333333333%}.el-col-md-push-5{position:relative;left:20.8333333333%}.el-col-md-6{display:block;max-width:25%;flex:0 0 25%}.el-col-md-offset-6{margin-left:25%}.el-col-md-pull-6{position:relative;right:25%}.el-col-md-push-6{position:relative;left:25%}.el-col-md-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-md-offset-7{margin-left:29.1666666667%}.el-col-md-pull-7{position:relative;right:29.1666666667%}.el-col-md-push-7{position:relative;left:29.1666666667%}.el-col-md-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-md-offset-8{margin-left:33.3333333333%}.el-col-md-pull-8{position:relative;right:33.3333333333%}.el-col-md-push-8{position:relative;left:33.3333333333%}.el-col-md-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-md-offset-9{margin-left:37.5%}.el-col-md-pull-9{position:relative;right:37.5%}.el-col-md-push-9{position:relative;left:37.5%}.el-col-md-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-md-offset-10{margin-left:41.6666666667%}.el-col-md-pull-10{position:relative;right:41.6666666667%}.el-col-md-push-10{position:relative;left:41.6666666667%}.el-col-md-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-md-offset-11{margin-left:45.8333333333%}.el-col-md-pull-11{position:relative;right:45.8333333333%}.el-col-md-push-11{position:relative;left:45.8333333333%}.el-col-md-12{display:block;max-width:50%;flex:0 0 50%}.el-col-md-offset-12{margin-left:50%}.el-col-md-pull-12{position:relative;right:50%}.el-col-md-push-12{position:relative;left:50%}.el-col-md-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-md-offset-13{margin-left:54.1666666667%}.el-col-md-pull-13{position:relative;right:54.1666666667%}.el-col-md-push-13{position:relative;left:54.1666666667%}.el-col-md-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-md-offset-14{margin-left:58.3333333333%}.el-col-md-pull-14{position:relative;right:58.3333333333%}.el-col-md-push-14{position:relative;left:58.3333333333%}.el-col-md-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-md-offset-15{margin-left:62.5%}.el-col-md-pull-15{position:relative;right:62.5%}.el-col-md-push-15{position:relative;left:62.5%}.el-col-md-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-md-offset-16{margin-left:66.6666666667%}.el-col-md-pull-16{position:relative;right:66.6666666667%}.el-col-md-push-16{position:relative;left:66.6666666667%}.el-col-md-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-md-offset-17{margin-left:70.8333333333%}.el-col-md-pull-17{position:relative;right:70.8333333333%}.el-col-md-push-17{position:relative;left:70.8333333333%}.el-col-md-18{display:block;max-width:75%;flex:0 0 75%}.el-col-md-offset-18{margin-left:75%}.el-col-md-pull-18{position:relative;right:75%}.el-col-md-push-18{position:relative;left:75%}.el-col-md-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-md-offset-19{margin-left:79.1666666667%}.el-col-md-pull-19{position:relative;right:79.1666666667%}.el-col-md-push-19{position:relative;left:79.1666666667%}.el-col-md-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-md-offset-20{margin-left:83.3333333333%}.el-col-md-pull-20{position:relative;right:83.3333333333%}.el-col-md-push-20{position:relative;left:83.3333333333%}.el-col-md-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-md-offset-21{margin-left:87.5%}.el-col-md-pull-21{position:relative;right:87.5%}.el-col-md-push-21{position:relative;left:87.5%}.el-col-md-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-md-offset-22{margin-left:91.6666666667%}.el-col-md-pull-22{position:relative;right:91.6666666667%}.el-col-md-push-22{position:relative;left:91.6666666667%}.el-col-md-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-md-offset-23{margin-left:95.8333333333%}.el-col-md-pull-23{position:relative;right:95.8333333333%}.el-col-md-push-23{position:relative;left:95.8333333333%}.el-col-md-24{display:block;max-width:100%;flex:0 0 100%}.el-col-md-offset-24{margin-left:100%}.el-col-md-pull-24{position:relative;right:100%}.el-col-md-push-24{position:relative;left:100%}}@media only screen and (min-width:1200px){.el-col-lg-0,.el-col-lg-0.is-guttered{display:none}.el-col-lg-0{max-width:0%;flex:0 0 0%}.el-col-lg-offset-0{margin-left:0}.el-col-lg-pull-0{position:relative;right:0}.el-col-lg-push-0{position:relative;left:0}.el-col-lg-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-lg-offset-1{margin-left:4.1666666667%}.el-col-lg-pull-1{position:relative;right:4.1666666667%}.el-col-lg-push-1{position:relative;left:4.1666666667%}.el-col-lg-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-lg-offset-2{margin-left:8.3333333333%}.el-col-lg-pull-2{position:relative;right:8.3333333333%}.el-col-lg-push-2{position:relative;left:8.3333333333%}.el-col-lg-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-lg-offset-3{margin-left:12.5%}.el-col-lg-pull-3{position:relative;right:12.5%}.el-col-lg-push-3{position:relative;left:12.5%}.el-col-lg-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-lg-offset-4{margin-left:16.6666666667%}.el-col-lg-pull-4{position:relative;right:16.6666666667%}.el-col-lg-push-4{position:relative;left:16.6666666667%}.el-col-lg-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-lg-offset-5{margin-left:20.8333333333%}.el-col-lg-pull-5{position:relative;right:20.8333333333%}.el-col-lg-push-5{position:relative;left:20.8333333333%}.el-col-lg-6{display:block;max-width:25%;flex:0 0 25%}.el-col-lg-offset-6{margin-left:25%}.el-col-lg-pull-6{position:relative;right:25%}.el-col-lg-push-6{position:relative;left:25%}.el-col-lg-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-lg-offset-7{margin-left:29.1666666667%}.el-col-lg-pull-7{position:relative;right:29.1666666667%}.el-col-lg-push-7{position:relative;left:29.1666666667%}.el-col-lg-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-lg-offset-8{margin-left:33.3333333333%}.el-col-lg-pull-8{position:relative;right:33.3333333333%}.el-col-lg-push-8{position:relative;left:33.3333333333%}.el-col-lg-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-lg-offset-9{margin-left:37.5%}.el-col-lg-pull-9{position:relative;right:37.5%}.el-col-lg-push-9{position:relative;left:37.5%}.el-col-lg-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-lg-offset-10{margin-left:41.6666666667%}.el-col-lg-pull-10{position:relative;right:41.6666666667%}.el-col-lg-push-10{position:relative;left:41.6666666667%}.el-col-lg-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-lg-offset-11{margin-left:45.8333333333%}.el-col-lg-pull-11{position:relative;right:45.8333333333%}.el-col-lg-push-11{position:relative;left:45.8333333333%}.el-col-lg-12{display:block;max-width:50%;flex:0 0 50%}.el-col-lg-offset-12{margin-left:50%}.el-col-lg-pull-12{position:relative;right:50%}.el-col-lg-push-12{position:relative;left:50%}.el-col-lg-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-lg-offset-13{margin-left:54.1666666667%}.el-col-lg-pull-13{position:relative;right:54.1666666667%}.el-col-lg-push-13{position:relative;left:54.1666666667%}.el-col-lg-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-lg-offset-14{margin-left:58.3333333333%}.el-col-lg-pull-14{position:relative;right:58.3333333333%}.el-col-lg-push-14{position:relative;left:58.3333333333%}.el-col-lg-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-lg-offset-15{margin-left:62.5%}.el-col-lg-pull-15{position:relative;right:62.5%}.el-col-lg-push-15{position:relative;left:62.5%}.el-col-lg-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-lg-offset-16{margin-left:66.6666666667%}.el-col-lg-pull-16{position:relative;right:66.6666666667%}.el-col-lg-push-16{position:relative;left:66.6666666667%}.el-col-lg-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-lg-offset-17{margin-left:70.8333333333%}.el-col-lg-pull-17{position:relative;right:70.8333333333%}.el-col-lg-push-17{position:relative;left:70.8333333333%}.el-col-lg-18{display:block;max-width:75%;flex:0 0 75%}.el-col-lg-offset-18{margin-left:75%}.el-col-lg-pull-18{position:relative;right:75%}.el-col-lg-push-18{position:relative;left:75%}.el-col-lg-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-lg-offset-19{margin-left:79.1666666667%}.el-col-lg-pull-19{position:relative;right:79.1666666667%}.el-col-lg-push-19{position:relative;left:79.1666666667%}.el-col-lg-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-lg-offset-20{margin-left:83.3333333333%}.el-col-lg-pull-20{position:relative;right:83.3333333333%}.el-col-lg-push-20{position:relative;left:83.3333333333%}.el-col-lg-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-lg-offset-21{margin-left:87.5%}.el-col-lg-pull-21{position:relative;right:87.5%}.el-col-lg-push-21{position:relative;left:87.5%}.el-col-lg-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-lg-offset-22{margin-left:91.6666666667%}.el-col-lg-pull-22{position:relative;right:91.6666666667%}.el-col-lg-push-22{position:relative;left:91.6666666667%}.el-col-lg-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-lg-offset-23{margin-left:95.8333333333%}.el-col-lg-pull-23{position:relative;right:95.8333333333%}.el-col-lg-push-23{position:relative;left:95.8333333333%}.el-col-lg-24{display:block;max-width:100%;flex:0 0 100%}.el-col-lg-offset-24{margin-left:100%}.el-col-lg-pull-24{position:relative;right:100%}.el-col-lg-push-24{position:relative;left:100%}}@media only screen and (min-width:1920px){.el-col-xl-0,.el-col-xl-0.is-guttered{display:none}.el-col-xl-0{max-width:0%;flex:0 0 0%}.el-col-xl-offset-0{margin-left:0}.el-col-xl-pull-0{position:relative;right:0}.el-col-xl-push-0{position:relative;left:0}.el-col-xl-1{display:block;max-width:4.1666666667%;flex:0 0 4.1666666667%}.el-col-xl-offset-1{margin-left:4.1666666667%}.el-col-xl-pull-1{position:relative;right:4.1666666667%}.el-col-xl-push-1{position:relative;left:4.1666666667%}.el-col-xl-2{display:block;max-width:8.3333333333%;flex:0 0 8.3333333333%}.el-col-xl-offset-2{margin-left:8.3333333333%}.el-col-xl-pull-2{position:relative;right:8.3333333333%}.el-col-xl-push-2{position:relative;left:8.3333333333%}.el-col-xl-3{display:block;max-width:12.5%;flex:0 0 12.5%}.el-col-xl-offset-3{margin-left:12.5%}.el-col-xl-pull-3{position:relative;right:12.5%}.el-col-xl-push-3{position:relative;left:12.5%}.el-col-xl-4{display:block;max-width:16.6666666667%;flex:0 0 16.6666666667%}.el-col-xl-offset-4{margin-left:16.6666666667%}.el-col-xl-pull-4{position:relative;right:16.6666666667%}.el-col-xl-push-4{position:relative;left:16.6666666667%}.el-col-xl-5{display:block;max-width:20.8333333333%;flex:0 0 20.8333333333%}.el-col-xl-offset-5{margin-left:20.8333333333%}.el-col-xl-pull-5{position:relative;right:20.8333333333%}.el-col-xl-push-5{position:relative;left:20.8333333333%}.el-col-xl-6{display:block;max-width:25%;flex:0 0 25%}.el-col-xl-offset-6{margin-left:25%}.el-col-xl-pull-6{position:relative;right:25%}.el-col-xl-push-6{position:relative;left:25%}.el-col-xl-7{display:block;max-width:29.1666666667%;flex:0 0 29.1666666667%}.el-col-xl-offset-7{margin-left:29.1666666667%}.el-col-xl-pull-7{position:relative;right:29.1666666667%}.el-col-xl-push-7{position:relative;left:29.1666666667%}.el-col-xl-8{display:block;max-width:33.3333333333%;flex:0 0 33.3333333333%}.el-col-xl-offset-8{margin-left:33.3333333333%}.el-col-xl-pull-8{position:relative;right:33.3333333333%}.el-col-xl-push-8{position:relative;left:33.3333333333%}.el-col-xl-9{display:block;max-width:37.5%;flex:0 0 37.5%}.el-col-xl-offset-9{margin-left:37.5%}.el-col-xl-pull-9{position:relative;right:37.5%}.el-col-xl-push-9{position:relative;left:37.5%}.el-col-xl-10{display:block;max-width:41.6666666667%;flex:0 0 41.6666666667%}.el-col-xl-offset-10{margin-left:41.6666666667%}.el-col-xl-pull-10{position:relative;right:41.6666666667%}.el-col-xl-push-10{position:relative;left:41.6666666667%}.el-col-xl-11{display:block;max-width:45.8333333333%;flex:0 0 45.8333333333%}.el-col-xl-offset-11{margin-left:45.8333333333%}.el-col-xl-pull-11{position:relative;right:45.8333333333%}.el-col-xl-push-11{position:relative;left:45.8333333333%}.el-col-xl-12{display:block;max-width:50%;flex:0 0 50%}.el-col-xl-offset-12{margin-left:50%}.el-col-xl-pull-12{position:relative;right:50%}.el-col-xl-push-12{position:relative;left:50%}.el-col-xl-13{display:block;max-width:54.1666666667%;flex:0 0 54.1666666667%}.el-col-xl-offset-13{margin-left:54.1666666667%}.el-col-xl-pull-13{position:relative;right:54.1666666667%}.el-col-xl-push-13{position:relative;left:54.1666666667%}.el-col-xl-14{display:block;max-width:58.3333333333%;flex:0 0 58.3333333333%}.el-col-xl-offset-14{margin-left:58.3333333333%}.el-col-xl-pull-14{position:relative;right:58.3333333333%}.el-col-xl-push-14{position:relative;left:58.3333333333%}.el-col-xl-15{display:block;max-width:62.5%;flex:0 0 62.5%}.el-col-xl-offset-15{margin-left:62.5%}.el-col-xl-pull-15{position:relative;right:62.5%}.el-col-xl-push-15{position:relative;left:62.5%}.el-col-xl-16{display:block;max-width:66.6666666667%;flex:0 0 66.6666666667%}.el-col-xl-offset-16{margin-left:66.6666666667%}.el-col-xl-pull-16{position:relative;right:66.6666666667%}.el-col-xl-push-16{position:relative;left:66.6666666667%}.el-col-xl-17{display:block;max-width:70.8333333333%;flex:0 0 70.8333333333%}.el-col-xl-offset-17{margin-left:70.8333333333%}.el-col-xl-pull-17{position:relative;right:70.8333333333%}.el-col-xl-push-17{position:relative;left:70.8333333333%}.el-col-xl-18{display:block;max-width:75%;flex:0 0 75%}.el-col-xl-offset-18{margin-left:75%}.el-col-xl-pull-18{position:relative;right:75%}.el-col-xl-push-18{position:relative;left:75%}.el-col-xl-19{display:block;max-width:79.1666666667%;flex:0 0 79.1666666667%}.el-col-xl-offset-19{margin-left:79.1666666667%}.el-col-xl-pull-19{position:relative;right:79.1666666667%}.el-col-xl-push-19{position:relative;left:79.1666666667%}.el-col-xl-20{display:block;max-width:83.3333333333%;flex:0 0 83.3333333333%}.el-col-xl-offset-20{margin-left:83.3333333333%}.el-col-xl-pull-20{position:relative;right:83.3333333333%}.el-col-xl-push-20{position:relative;left:83.3333333333%}.el-col-xl-21{display:block;max-width:87.5%;flex:0 0 87.5%}.el-col-xl-offset-21{margin-left:87.5%}.el-col-xl-pull-21{position:relative;right:87.5%}.el-col-xl-push-21{position:relative;left:87.5%}.el-col-xl-22{display:block;max-width:91.6666666667%;flex:0 0 91.6666666667%}.el-col-xl-offset-22{margin-left:91.6666666667%}.el-col-xl-pull-22{position:relative;right:91.6666666667%}.el-col-xl-push-22{position:relative;left:91.6666666667%}.el-col-xl-23{display:block;max-width:95.8333333333%;flex:0 0 95.8333333333%}.el-col-xl-offset-23{margin-left:95.8333333333%}.el-col-xl-pull-23{position:relative;right:95.8333333333%}.el-col-xl-push-23{position:relative;left:95.8333333333%}.el-col-xl-24{display:block;max-width:100%;flex:0 0 100%}.el-col-xl-offset-24{margin-left:100%}.el-col-xl-pull-24{position:relative;right:100%}.el-col-xl-push-24{position:relative;left:100%}}.el-collapse{--el-collapse-border-color:var(--el-border-color-lighter);--el-collapse-header-height:48px;--el-collapse-header-bg-color:var(--el-fill-color-blank);--el-collapse-header-text-color:var(--el-text-color-primary);--el-collapse-header-font-size:13px;--el-collapse-content-bg-color:var(--el-fill-color-blank);--el-collapse-content-font-size:13px;--el-collapse-content-text-color:var(--el-text-color-primary);border-top:1px solid var(--el-collapse-border-color);border-bottom:1px solid var(--el-collapse-border-color)}.el-collapse-item.is-disabled .el-collapse-item__header{color:var(--el-text-color-disabled);cursor:not-allowed}.el-collapse-item__header{display:flex;align-items:center;height:var(--el-collapse-header-height);line-height:var(--el-collapse-header-height);background-color:var(--el-collapse-header-bg-color);color:var(--el-collapse-header-text-color);cursor:pointer;border-bottom:1px solid var(--el-collapse-border-color);font-size:var(--el-collapse-header-font-size);font-weight:500;transition:border-bottom-color var(--el-transition-duration);outline:0}.el-collapse-item__arrow{margin:0 8px 0 auto;transition:transform var(--el-transition-duration);font-weight:300}.el-collapse-item__arrow.is-active{transform:rotate(90deg)}.el-collapse-item__header.focusing:focus:not(:hover){color:var(--el-color-primary)}.el-collapse-item__header.is-active{border-bottom-color:transparent}.el-collapse-item__wrap{will-change:height;background-color:var(--el-collapse-content-bg-color);overflow:hidden;box-sizing:border-box;border-bottom:1px solid var(--el-collapse-border-color)}.el-collapse-item__content{padding-bottom:25px;font-size:var(--el-collapse-content-font-size);color:var(--el-collapse-content-text-color);line-height:1.7692307692}.el-collapse-item:last-child{margin-bottom:-1px}.el-color-predefine{display:flex;font-size:12px;margin-top:8px;width:280px}.el-color-predefine__colors{display:flex;flex:1;flex-wrap:wrap}.el-color-predefine__color-selector{margin:0 0 8px 8px;width:20px;height:20px;border-radius:4px;cursor:pointer}.el-color-predefine__color-selector:nth-child(10n+1){margin-left:0}.el-color-predefine__color-selector.selected{box-shadow:0 0 3px 2px var(--el-color-primary)}.el-color-predefine__color-selector>div{display:flex;height:100%;border-radius:3px}.el-color-predefine__color-selector.is-alpha{background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAIAAADZF8uwAAAAGUlEQVQYV2M4gwH+YwCGIasIUwhT25BVBADtzYNYrHvv4gAAAABJRU5ErkJggg==)}.el-color-hue-slider{position:relative;box-sizing:border-box;width:280px;height:12px;background-color:red;padding:0 2px;float:right}.el-color-hue-slider__bar{position:relative;background:linear-gradient(to right,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%);height:100%}.el-color-hue-slider__thumb{position:absolute;cursor:pointer;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid var(--el-border-color-lighter);box-shadow:0 0 2px #0009;z-index:1}.el-color-hue-slider.is-vertical{width:12px;height:180px;padding:2px 0}.el-color-hue-slider.is-vertical .el-color-hue-slider__bar{background:linear-gradient(to bottom,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}.el-color-hue-slider.is-vertical .el-color-hue-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-svpanel{position:relative;width:280px;height:180px}.el-color-svpanel__black,.el-color-svpanel__white{position:absolute;top:0;left:0;right:0;bottom:0}.el-color-svpanel__white{background:linear-gradient(to right,#fff,rgba(255,255,255,0))}.el-color-svpanel__black{background:linear-gradient(to top,#000,rgba(0,0,0,0))}.el-color-svpanel__cursor{position:absolute}.el-color-svpanel__cursor>div{cursor:head;width:4px;height:4px;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px #0000004d,0 0 1px 2px #0006;border-radius:50%;transform:translate(-2px,-2px)}.el-color-alpha-slider{position:relative;box-sizing:border-box;width:280px;height:12px;background-image:linear-gradient(45deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(45deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%);background-size:12px 12px;background-position:0 0,6px 0,6px -6px,0 6px}.el-color-alpha-slider__bar{position:relative;background:linear-gradient(to right,rgba(255,255,255,0) 0,var(--el-bg-color) 100%);height:100%}.el-color-alpha-slider__thumb{position:absolute;cursor:pointer;box-sizing:border-box;left:0;top:0;width:4px;height:100%;border-radius:1px;background:#fff;border:1px solid var(--el-border-color-lighter);box-shadow:0 0 2px #0009;z-index:1}.el-color-alpha-slider.is-vertical{width:20px;height:180px}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__bar{background:linear-gradient(to bottom,rgba(255,255,255,0) 0,#fff 100%)}.el-color-alpha-slider.is-vertical .el-color-alpha-slider__thumb{left:0;top:0;width:100%;height:4px}.el-color-dropdown{width:300px}.el-color-dropdown__main-wrapper{margin-bottom:6px}.el-color-dropdown__main-wrapper:after{content:"";display:table;clear:both}.el-color-dropdown__btns{margin-top:12px;text-align:right}.el-color-dropdown__value{float:left;line-height:26px;font-size:12px;color:#000;width:160px}.el-color-picker{display:inline-block;position:relative;line-height:normal;outline:0}.el-color-picker:hover:not(.is-disabled) .el-color-picker__trigger{border:1px solid var(--el-border-color-hover)}.el-color-picker:focus-visible:not(.is-disabled) .el-color-picker__trigger{outline:2px solid var(--el-color-primary);outline-offset:1px}.el-color-picker.is-disabled .el-color-picker__trigger{cursor:not-allowed}.el-color-picker--large{height:40px}.el-color-picker--large .el-color-picker__trigger{height:40px;width:40px}.el-color-picker--large .el-color-picker__mask{height:38px;width:38px}.el-color-picker--small{height:24px}.el-color-picker--small .el-color-picker__trigger{height:24px;width:24px}.el-color-picker--small .el-color-picker__mask{height:22px;width:22px}.el-color-picker--small .el-color-picker__empty,.el-color-picker--small .el-color-picker__icon{transform:scale(.8)}.el-color-picker__mask{height:30px;width:30px;border-radius:4px;position:absolute;top:1px;left:1px;z-index:1;cursor:not-allowed;background-color:#ffffffb3}.el-color-picker__trigger{display:inline-flex;justify-content:center;align-items:center;box-sizing:border-box;height:32px;width:32px;padding:4px;border:1px solid var(--el-border-color);border-radius:4px;font-size:0;position:relative;cursor:pointer}.el-color-picker__color{position:relative;display:block;box-sizing:border-box;border:1px solid var(--el-text-color-secondary);border-radius:var(--el-border-radius-small);width:100%;height:100%;text-align:center}.el-color-picker__color.is-alpha{background-image:linear-gradient(45deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-a) 25%,var(--el-color-picker-alpha-bg-b) 25%),linear-gradient(45deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%),linear-gradient(135deg,var(--el-color-picker-alpha-bg-b) 75%,var(--el-color-picker-alpha-bg-a) 75%);background-size:12px 12px;background-position:0 0,6px 0,6px -6px,0 6px}.el-color-picker__color-inner{display:inline-flex;justify-content:center;align-items:center;width:100%;height:100%}.el-color-picker .el-color-picker__empty{font-size:12px;color:var(--el-text-color-secondary)}.el-color-picker .el-color-picker__icon{display:inline-flex;justify-content:center;align-items:center;color:#fff;font-size:12px}.el-color-picker__panel{position:absolute;z-index:10;padding:6px;box-sizing:content-box;background-color:#fff;border-radius:var(--el-border-radius-base);box-shadow:var(--el-box-shadow-light)}.el-color-picker__panel.el-popper{border:1px solid var(--el-border-color-lighter)}.el-color-picker,.el-color-picker__panel{--el-color-picker-alpha-bg-a:#ccc;--el-color-picker-alpha-bg-b:transparent}.dark .el-color-picker,.dark .el-color-picker__panel{--el-color-picker-alpha-bg-a:#333333}.el-container{display:flex;flex-direction:row;flex:1;flex-basis:auto;box-sizing:border-box;min-width:0}.el-container.is-vertical{flex-direction:column}.el-date-table{font-size:12px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-date-table.is-week-mode .el-date-table__row:hover .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table.is-week-mode .el-date-table__row:hover td.available:hover{color:var(--el-datepicker-text-color)}.el-date-table.is-week-mode .el-date-table__row:hover td:first-child .el-date-table-cell{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table.is-week-mode .el-date-table__row:hover td:last-child .el-date-table-cell{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table.is-week-mode .el-date-table__row.current .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table td{width:32px;height:30px;padding:4px 0;box-sizing:border-box;text-align:center;cursor:pointer;position:relative}.el-date-table td .el-date-table-cell{height:30px;padding:3px 0;box-sizing:border-box}.el-date-table td .el-date-table-cell .el-date-table-cell__text{width:24px;height:24px;display:block;margin:0 auto;line-height:24px;position:absolute;left:50%;transform:translate(-50%);border-radius:50%}.el-date-table td.next-month,.el-date-table td.prev-month{color:var(--el-datepicker-off-text-color)}.el-date-table td.today{position:relative}.el-date-table td.today .el-date-table-cell__text{color:var(--el-color-primary);font-weight:700}.el-date-table td.today.end-date .el-date-table-cell__text,.el-date-table td.today.start-date .el-date-table-cell__text{color:#fff}.el-date-table td.available:hover{color:var(--el-datepicker-hover-text-color)}.el-date-table td.in-range .el-date-table-cell{background-color:var(--el-datepicker-inrange-bg-color)}.el-date-table td.in-range .el-date-table-cell:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-date-table td.current:not(.disabled) .el-date-table-cell__text{color:#fff;background-color:var(--el-datepicker-active-color)}.el-date-table td.current:not(.disabled):focus-visible .el-date-table-cell__text{outline:2px solid var(--el-datepicker-active-color);outline-offset:1px}.el-date-table td.end-date .el-date-table-cell,.el-date-table td.start-date .el-date-table-cell{color:#fff}.el-date-table td.end-date .el-date-table-cell__text,.el-date-table td.start-date .el-date-table-cell__text{background-color:var(--el-datepicker-active-color)}.el-date-table td.start-date .el-date-table-cell{margin-left:5px;border-top-left-radius:15px;border-bottom-left-radius:15px}.el-date-table td.end-date .el-date-table-cell{margin-right:5px;border-top-right-radius:15px;border-bottom-right-radius:15px}.el-date-table td.disabled .el-date-table-cell{background-color:var(--el-fill-color-light);opacity:1;cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-date-table td.selected .el-date-table-cell{margin-left:5px;margin-right:5px;background-color:var(--el-datepicker-inrange-bg-color);border-radius:15px}.el-date-table td.selected .el-date-table-cell:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-date-table td.selected .el-date-table-cell__text{background-color:var(--el-datepicker-active-color);color:#fff;border-radius:15px}.el-date-table td.week{font-size:80%;color:var(--el-datepicker-header-text-color)}.el-date-table td:focus{outline:0}.el-date-table th{padding:5px;color:var(--el-datepicker-header-text-color);font-weight:400;border-bottom:solid 1px var(--el-border-color-lighter)}.el-month-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-month-table td{text-align:center;padding:8px 0;cursor:pointer}.el-month-table td div{height:48px;padding:6px 0;box-sizing:border-box}.el-month-table td.today .cell{color:var(--el-color-primary);font-weight:700}.el-month-table td.today.end-date .cell,.el-month-table td.today.start-date .cell{color:#fff}.el-month-table td.disabled .cell{background-color:var(--el-fill-color-light);cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-month-table td.disabled .cell:hover{color:var(--el-text-color-placeholder)}.el-month-table td .cell{width:60px;height:36px;display:block;line-height:36px;color:var(--el-datepicker-text-color);margin:0 auto;border-radius:18px}.el-month-table td .cell:hover{color:var(--el-datepicker-hover-text-color)}.el-month-table td.in-range div{background-color:var(--el-datepicker-inrange-bg-color)}.el-month-table td.in-range div:hover{background-color:var(--el-datepicker-inrange-hover-bg-color)}.el-month-table td.end-date div,.el-month-table td.start-date div{color:#fff}.el-month-table td.end-date .cell,.el-month-table td.start-date .cell{color:#fff;background-color:var(--el-datepicker-active-color)}.el-month-table td.start-date div{border-top-left-radius:24px;border-bottom-left-radius:24px}.el-month-table td.end-date div{border-top-right-radius:24px;border-bottom-right-radius:24px}.el-month-table td.current:not(.disabled) .cell{color:var(--el-datepicker-active-color)}.el-month-table td:focus-visible{outline:0}.el-month-table td:focus-visible .cell{outline:2px solid var(--el-datepicker-active-color)}.el-year-table{font-size:12px;margin:-1px;border-collapse:collapse}.el-year-table .el-icon{color:var(--el-datepicker-icon-color)}.el-year-table td{text-align:center;padding:20px 3px;cursor:pointer}.el-year-table td.today .cell{color:var(--el-color-primary);font-weight:700}.el-year-table td.disabled .cell{background-color:var(--el-fill-color-light);cursor:not-allowed;color:var(--el-text-color-placeholder)}.el-year-table td.disabled .cell:hover{color:var(--el-text-color-placeholder)}.el-year-table td .cell{width:48px;height:36px;display:block;line-height:36px;color:var(--el-datepicker-text-color);border-radius:18px;margin:0 auto}.el-year-table td .cell:hover{color:var(--el-datepicker-hover-text-color)}.el-year-table td.current:not(.disabled) .cell{color:var(--el-datepicker-active-color)}.el-year-table td:focus-visible{outline:0}.el-year-table td:focus-visible .cell{outline:2px solid var(--el-datepicker-active-color)}.el-time-spinner.has-seconds .el-time-spinner__wrapper{width:33.3%}.el-time-spinner__wrapper{max-height:192px;overflow:auto;display:inline-block;width:50%;vertical-align:top;position:relative}.el-time-spinner__wrapper.el-scrollbar__wrap:not(.el-scrollbar__wrap--hidden-default){padding-bottom:15px}.el-time-spinner__wrapper.is-arrow{box-sizing:border-box;text-align:center;overflow:hidden}.el-time-spinner__wrapper.is-arrow .el-time-spinner__list{transform:translateY(-32px)}.el-time-spinner__wrapper.is-arrow .el-time-spinner__item:hover:not(.is-disabled):not(.is-active){background:var(--el-fill-color-light);cursor:default}.el-time-spinner__arrow{font-size:12px;color:var(--el-text-color-secondary);position:absolute;left:0;width:100%;z-index:var(--el-index-normal);text-align:center;height:30px;line-height:30px;cursor:pointer}.el-time-spinner__arrow:hover{color:var(--el-color-primary)}.el-time-spinner__arrow.arrow-up{top:10px}.el-time-spinner__arrow.arrow-down{bottom:10px}.el-time-spinner__input.el-input{width:70%}.el-time-spinner__input.el-input .el-input__inner{padding:0;text-align:center}.el-time-spinner__list{padding:0;margin:0;list-style:none;text-align:center}.el-time-spinner__list:after,.el-time-spinner__list:before{content:"";display:block;width:100%;height:80px}.el-time-spinner__item{height:32px;line-height:32px;font-size:12px;color:var(--el-text-color-regular)}.el-time-spinner__item:hover:not(.is-disabled):not(.is-active){background:var(--el-fill-color-light);cursor:pointer}.el-time-spinner__item.is-active:not(.is-disabled){color:var(--el-text-color-primary);font-weight:700}.el-time-spinner__item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-picker__popper{--el-datepicker-border-color:var(--el-disabled-border-color)}.el-picker__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-datepicker-border-color);box-shadow:var(--el-box-shadow-light)}.el-picker__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-datepicker-border-color)}.el-picker__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-picker__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-date-editor{--el-date-editor-width:220px;--el-date-editor-monthrange-width:300px;--el-date-editor-daterange-width:350px;--el-date-editor-datetimerange-width:400px;--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary);position:relative;display:inline-block;text-align:left}.el-date-editor.el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset}.el-date-editor.el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-date-editor.el-input,.el-date-editor.el-input__wrapper{width:var(--el-date-editor-width);height:var(--el-input-height,var(--el-component-size))}.el-date-editor--monthrange{--el-date-editor-width:var(--el-date-editor-monthrange-width)}.el-date-editor--daterange,.el-date-editor--timerange{--el-date-editor-width:var(--el-date-editor-daterange-width)}.el-date-editor--datetimerange{--el-date-editor-width:var(--el-date-editor-datetimerange-width)}.el-date-editor--dates .el-input__wrapper{text-overflow:ellipsis;white-space:nowrap}.el-date-editor .close-icon,.el-date-editor .clear-icon{cursor:pointer}.el-date-editor .clear-icon:hover{color:var(--el-text-color-secondary)}.el-date-editor .el-range__icon{height:inherit;font-size:14px;color:var(--el-text-color-placeholder);float:left}.el-date-editor .el-range__icon svg{vertical-align:middle}.el-date-editor .el-range-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;outline:0;display:inline-block;height:30px;line-height:30px;margin:0;padding:0;width:39%;text-align:center;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);background-color:transparent}.el-date-editor .el-range-input::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-input:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-input::placeholder{color:var(--el-text-color-placeholder)}.el-date-editor .el-range-separator{flex:1;display:inline-flex;justify-content:center;align-items:center;height:100%;padding:0 5px;margin:0;font-size:14px;word-break:keep-all;color:var(--el-text-color-primary)}.el-date-editor .el-range__close-icon{font-size:14px;color:var(--el-text-color-placeholder);height:inherit;width:unset;cursor:pointer}.el-date-editor .el-range__close-icon:hover{color:var(--el-text-color-secondary)}.el-date-editor .el-range__close-icon svg{vertical-align:middle}.el-date-editor .el-range__close-icon--hidden{opacity:0;visibility:hidden}.el-range-editor.el-input__wrapper{display:inline-flex;align-items:center;padding:0 10px}.el-range-editor.is-active,.el-range-editor.is-active:hover{box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-range-editor--large{line-height:var(--el-component-size-large)}.el-range-editor--large.el-input__wrapper{height:var(--el-component-size-large)}.el-range-editor--large .el-range-separator{line-height:40px;font-size:14px}.el-range-editor--large .el-range-input{height:38px;line-height:38px;font-size:14px}.el-range-editor--small{line-height:var(--el-component-size-small)}.el-range-editor--small.el-input__wrapper{height:var(--el-component-size-small)}.el-range-editor--small .el-range-separator{line-height:24px;font-size:12px}.el-range-editor--small .el-range-input{height:22px;line-height:22px;font-size:12px}.el-range-editor.is-disabled{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-range-editor.is-disabled:focus,.el-range-editor.is-disabled:hover{border-color:var(--el-disabled-border-color)}.el-range-editor.is-disabled input{background-color:var(--el-disabled-bg-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-range-editor.is-disabled input::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled input:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled input::placeholder{color:var(--el-text-color-placeholder)}.el-range-editor.is-disabled .el-range-separator{color:var(--el-disabled-text-color)}.el-picker-panel{color:var(--el-text-color-regular);background:var(--el-bg-color-overlay);border-radius:var(--el-border-radius-base);line-height:30px}.el-picker-panel .el-time-panel{margin:5px 0;border:solid 1px var(--el-datepicker-border-color);background-color:var(--el-bg-color-overlay);box-shadow:var(--el-box-shadow-light)}.el-picker-panel__body-wrapper:after,.el-picker-panel__body:after{content:"";display:table;clear:both}.el-picker-panel__content{position:relative;margin:15px}.el-picker-panel__footer{border-top:1px solid var(--el-datepicker-inner-border-color);padding:4px 12px;text-align:right;background-color:var(--el-bg-color-overlay);position:relative;font-size:0}.el-picker-panel__shortcut{display:block;width:100%;border:0;background-color:transparent;line-height:28px;font-size:14px;color:var(--el-datepicker-text-color);padding-left:12px;text-align:left;outline:0;cursor:pointer}.el-picker-panel__shortcut:hover{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__shortcut.active{background-color:#e6f1fe;color:var(--el-datepicker-active-color)}.el-picker-panel__btn{border:1px solid var(--el-fill-color-darker);color:var(--el-text-color-primary);line-height:24px;border-radius:2px;padding:0 20px;cursor:pointer;background-color:transparent;outline:0;font-size:12px}.el-picker-panel__btn[disabled]{color:var(--el-text-color-disabled);cursor:not-allowed}.el-picker-panel__icon-btn{font-size:12px;color:var(--el-datepicker-icon-color);border:0;background:0 0;cursor:pointer;outline:0;margin-top:8px}.el-picker-panel__icon-btn:hover{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__icon-btn:focus-visible{color:var(--el-datepicker-hover-text-color)}.el-picker-panel__icon-btn.is-disabled{color:var(--el-text-color-disabled)}.el-picker-panel__icon-btn.is-disabled:hover{cursor:not-allowed}.el-picker-panel__icon-btn .el-icon{cursor:pointer;font-size:inherit}.el-picker-panel__link-btn{vertical-align:middle}.el-picker-panel [slot=sidebar],.el-picker-panel__sidebar{position:absolute;top:0;bottom:0;width:110px;border-right:1px solid var(--el-datepicker-inner-border-color);box-sizing:border-box;padding-top:6px;background-color:var(--el-bg-color-overlay);overflow:auto}.el-picker-panel [slot=sidebar]+.el-picker-panel__body,.el-picker-panel__sidebar+.el-picker-panel__body{margin-left:110px}.el-date-picker{--el-datepicker-text-color:var(--el-text-color-regular);--el-datepicker-off-text-color:var(--el-text-color-placeholder);--el-datepicker-header-text-color:var(--el-text-color-regular);--el-datepicker-icon-color:var(--el-text-color-primary);--el-datepicker-border-color:var(--el-disabled-border-color);--el-datepicker-inner-border-color:var(--el-border-color-light);--el-datepicker-inrange-bg-color:var(--el-border-color-extra-light);--el-datepicker-inrange-hover-bg-color:var(--el-border-color-extra-light);--el-datepicker-active-color:var(--el-color-primary);--el-datepicker-hover-text-color:var(--el-color-primary)}.el-date-picker{width:322px}.el-date-picker.has-sidebar.has-time{width:434px}.el-date-picker.has-sidebar{width:438px}.el-date-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-picker .el-picker-panel__content{width:292px}.el-date-picker table{table-layout:fixed;width:100%}.el-date-picker__editor-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-picker__time-header{position:relative;border-bottom:1px solid var(--el-datepicker-inner-border-color);font-size:12px;padding:8px 5px 5px;display:table;width:100%;box-sizing:border-box}.el-date-picker__header{margin:12px;text-align:center}.el-date-picker__header--bordered{margin-bottom:0;padding-bottom:12px;border-bottom:solid 1px var(--el-border-color-lighter)}.el-date-picker__header--bordered+.el-picker-panel__content{margin-top:0}.el-date-picker__header-label{font-size:16px;font-weight:500;padding:0 5px;line-height:22px;text-align:center;cursor:pointer;color:var(--el-text-color-regular)}.el-date-picker__header-label:hover{color:var(--el-datepicker-hover-text-color)}.el-date-picker__header-label:focus-visible{outline:0;color:var(--el-datepicker-hover-text-color)}.el-date-picker__header-label.active{color:var(--el-datepicker-active-color)}.el-date-picker__prev-btn{float:left}.el-date-picker__next-btn{float:right}.el-date-picker__time-wrap{padding:10px;text-align:center}.el-date-picker__time-label{float:left;cursor:pointer;line-height:30px;margin-left:10px}.el-date-picker .el-time-panel{position:absolute}.el-date-range-picker{--el-datepicker-text-color:var(--el-text-color-regular);--el-datepicker-off-text-color:var(--el-text-color-placeholder);--el-datepicker-header-text-color:var(--el-text-color-regular);--el-datepicker-icon-color:var(--el-text-color-primary);--el-datepicker-border-color:var(--el-disabled-border-color);--el-datepicker-inner-border-color:var(--el-border-color-light);--el-datepicker-inrange-bg-color:var(--el-border-color-extra-light);--el-datepicker-inrange-hover-bg-color:var(--el-border-color-extra-light);--el-datepicker-active-color:var(--el-color-primary);--el-datepicker-hover-text-color:var(--el-color-primary)}.el-date-range-picker{width:646px}.el-date-range-picker.has-sidebar{width:756px}.el-date-range-picker.has-time .el-picker-panel__body-wrapper{position:relative}.el-date-range-picker table{table-layout:fixed;width:100%}.el-date-range-picker .el-picker-panel__body{min-width:513px}.el-date-range-picker .el-picker-panel__content{margin:0}.el-date-range-picker__header{position:relative;text-align:center;height:28px}.el-date-range-picker__header [class*=arrow-left]{float:left}.el-date-range-picker__header [class*=arrow-right]{float:right}.el-date-range-picker__header div{font-size:16px;font-weight:500;margin-right:50px}.el-date-range-picker__content{float:left;width:50%;box-sizing:border-box;margin:0;padding:16px}.el-date-range-picker__content.is-left{border-right:1px solid var(--el-datepicker-inner-border-color)}.el-date-range-picker__content .el-date-range-picker__header div{margin-left:50px;margin-right:50px}.el-date-range-picker__editors-wrap{box-sizing:border-box;display:table-cell}.el-date-range-picker__editors-wrap.is-right{text-align:right}.el-date-range-picker__time-header{position:relative;border-bottom:1px solid var(--el-datepicker-inner-border-color);font-size:12px;padding:8px 5px 5px;display:table;width:100%;box-sizing:border-box}.el-date-range-picker__time-header>.el-icon-arrow-right{font-size:20px;vertical-align:middle;display:table-cell;color:var(--el-datepicker-icon-color)}.el-date-range-picker__time-picker-wrap{position:relative;display:table-cell;padding:0 5px}.el-date-range-picker__time-picker-wrap .el-picker-panel{position:absolute;top:13px;right:0;z-index:1;background:#fff}.el-date-range-picker__time-picker-wrap .el-time-panel{position:absolute}.el-time-range-picker{width:354px;overflow:visible}.el-time-range-picker__content{position:relative;text-align:center;padding:10px;z-index:1}.el-time-range-picker__cell{box-sizing:border-box;margin:0;padding:4px 7px 7px;width:50%;display:inline-block}.el-time-range-picker__header{margin-bottom:5px;text-align:center;font-size:14px}.el-time-range-picker__body{border-radius:2px;border:1px solid var(--el-datepicker-border-color)}.el-time-panel{border-radius:2px;position:relative;width:180px;left:0;z-index:var(--el-index-top);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;box-sizing:content-box}.el-time-panel__content{font-size:0;position:relative;overflow:hidden}.el-time-panel__content:after,.el-time-panel__content:before{content:"";top:50%;position:absolute;margin-top:-16px;height:32px;z-index:-1;left:0;right:0;box-sizing:border-box;padding-top:6px;text-align:left}.el-time-panel__content:after{left:50%;margin-left:12%;margin-right:12%}.el-time-panel__content:before{padding-left:50%;margin-right:12%;margin-left:12%;border-top:1px solid var(--el-border-color-light);border-bottom:1px solid var(--el-border-color-light)}.el-time-panel__content.has-seconds:after{left:66.6666666667%}.el-time-panel__content.has-seconds:before{padding-left:33.3333333333%}.el-time-panel__footer{border-top:1px solid var(--el-timepicker-inner-border-color,var(--el-border-color-light));padding:4px;height:36px;line-height:25px;text-align:right;box-sizing:border-box}.el-time-panel__btn{border:none;line-height:28px;padding:0 5px;margin:0 5px;cursor:pointer;background-color:transparent;outline:0;font-size:12px;color:var(--el-text-color-primary)}.el-time-panel__btn.confirm{font-weight:800;color:var(--el-timepicker-active-color,var(--el-color-primary))}.el-descriptions{--el-descriptions-table-border:1px solid var(--el-border-color-lighter);--el-descriptions-item-bordered-label-background:var(--el-fill-color-light);box-sizing:border-box;font-size:var(--el-font-size-base);color:var(--el-text-color-primary)}.el-descriptions__header{display:flex;justify-content:space-between;align-items:center;margin-bottom:16px}.el-descriptions__title{color:var(--el-text-color-primary);font-size:16px;font-weight:700}.el-descriptions__body{background-color:var(--el-fill-color-blank)}.el-descriptions__body .el-descriptions__table{border-collapse:collapse;width:100%}.el-descriptions__body .el-descriptions__table .el-descriptions__cell{box-sizing:border-box;text-align:left;font-weight:400;line-height:23px;font-size:14px}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-left{text-align:left}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-center{text-align:center}.el-descriptions__body .el-descriptions__table .el-descriptions__cell.is-right{text-align:right}.el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{border:var(--el-descriptions-table-border);padding:8px 11px}.el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:12px}.el-descriptions--large{font-size:14px}.el-descriptions--large .el-descriptions__header{margin-bottom:20px}.el-descriptions--large .el-descriptions__header .el-descriptions__title{font-size:16px}.el-descriptions--large .el-descriptions__body .el-descriptions__table .el-descriptions__cell{font-size:14px}.el-descriptions--large .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{padding:12px 15px}.el-descriptions--large .el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:16px}.el-descriptions--small{font-size:12px}.el-descriptions--small .el-descriptions__header{margin-bottom:12px}.el-descriptions--small .el-descriptions__header .el-descriptions__title{font-size:14px}.el-descriptions--small .el-descriptions__body .el-descriptions__table .el-descriptions__cell{font-size:12px}.el-descriptions--small .el-descriptions__body .el-descriptions__table.is-bordered .el-descriptions__cell{padding:4px 7px}.el-descriptions--small .el-descriptions__body .el-descriptions__table:not(.is-bordered) .el-descriptions__cell{padding-bottom:8px}.el-descriptions__label.el-descriptions__cell.is-bordered-label{font-weight:700;color:var(--el-text-color-regular);background:var(--el-descriptions-item-bordered-label-background)}.el-descriptions__label:not(.is-bordered-label){color:var(--el-text-color-primary);margin-right:16px}.el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:6px}.el-descriptions__content.el-descriptions__cell.is-bordered-content{color:var(--el-text-color-primary)}.el-descriptions__content:not(.is-bordered-label){color:var(--el-text-color-regular)}.el-descriptions--large .el-descriptions__label:not(.is-bordered-label){margin-right:16px}.el-descriptions--large .el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:8px}.el-descriptions--small .el-descriptions__label:not(.is-bordered-label){margin-right:12px}.el-descriptions--small .el-descriptions__label.el-descriptions__cell:not(.is-bordered-label).is-vertical-label{padding-bottom:4px}:root{--el-popup-modal-bg-color:var(--el-color-black);--el-popup-modal-opacity:.5}.v-modal-enter{-webkit-animation:v-modal-in var(--el-transition-duration-fast) ease;animation:v-modal-in var(--el-transition-duration-fast) ease}.v-modal-leave{-webkit-animation:v-modal-out var(--el-transition-duration-fast) ease forwards;animation:v-modal-out var(--el-transition-duration-fast) ease forwards}@-webkit-keyframes v-modal-in{0%{opacity:0}}@keyframes v-modal-in{0%{opacity:0}}@-webkit-keyframes v-modal-out{to{opacity:0}}@keyframes v-modal-out{to{opacity:0}}.v-modal{position:fixed;left:0;top:0;width:100%;height:100%;opacity:var(--el-popup-modal-opacity);background:var(--el-popup-modal-bg-color)}.el-popup-parent--hidden{overflow:hidden}.el-dialog{--el-dialog-width:50%;--el-dialog-margin-top:15vh;--el-dialog-bg-color:var(--el-bg-color);--el-dialog-box-shadow:var(--el-box-shadow);--el-dialog-title-font-size:var(--el-font-size-large);--el-dialog-content-font-size:14px;--el-dialog-font-line-height:var(--el-font-line-height-primary);--el-dialog-padding-primary:20px;--el-dialog-border-radius:var(--el-border-radius-small);position:relative;margin:var(--el-dialog-margin-top,15vh) auto 50px;background:var(--el-dialog-bg-color);border-radius:var(--el-dialog-border-radius);box-shadow:var(--el-dialog-box-shadow);box-sizing:border-box;width:var(--el-dialog-width,50%)}.el-dialog:focus{outline:0!important}.el-dialog.is-align-center{margin:auto}.el-dialog.is-fullscreen{--el-dialog-width:100%;--el-dialog-margin-top:0;margin-bottom:0;height:100%;overflow:auto}.el-dialog__wrapper{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto;margin:0}.el-dialog.is-draggable .el-dialog__header{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-dialog__header{padding:var(--el-dialog-padding-primary);padding-bottom:10px;margin-right:16px}.el-dialog__headerbtn{position:absolute;top:6px;right:0;padding:0;width:54px;height:54px;background:0 0;border:none;outline:0;cursor:pointer;font-size:var(--el-message-close-size,16px)}.el-dialog__headerbtn .el-dialog__close{color:var(--el-color-info);font-size:inherit}.el-dialog__headerbtn:focus .el-dialog__close,.el-dialog__headerbtn:hover .el-dialog__close{color:var(--el-color-primary)}.el-dialog__title{line-height:var(--el-dialog-font-line-height);font-size:var(--el-dialog-title-font-size);color:var(--el-text-color-primary)}.el-dialog__body{padding:calc(var(--el-dialog-padding-primary) + 10px) var(--el-dialog-padding-primary);color:var(--el-text-color-regular);font-size:var(--el-dialog-content-font-size)}.el-dialog__footer{padding:var(--el-dialog-padding-primary);padding-top:10px;text-align:right;box-sizing:border-box}.el-dialog--center{text-align:center}.el-dialog--center .el-dialog__body{text-align:initial;padding:25px calc(var(--el-dialog-padding-primary) + 5px) 30px}.el-dialog--center .el-dialog__footer{text-align:inherit}.el-overlay-dialog{position:fixed;top:0;right:0;bottom:0;left:0;overflow:auto}.dialog-fade-enter-active{-webkit-animation:modal-fade-in var(--el-transition-duration);animation:modal-fade-in var(--el-transition-duration)}.dialog-fade-enter-active .el-overlay-dialog{-webkit-animation:dialog-fade-in var(--el-transition-duration);animation:dialog-fade-in var(--el-transition-duration)}.dialog-fade-leave-active{-webkit-animation:modal-fade-out var(--el-transition-duration);animation:modal-fade-out var(--el-transition-duration)}.dialog-fade-leave-active .el-overlay-dialog{-webkit-animation:dialog-fade-out var(--el-transition-duration);animation:dialog-fade-out var(--el-transition-duration)}@-webkit-keyframes dialog-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes dialog-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes dialog-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes dialog-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@-webkit-keyframes modal-fade-in{0%{opacity:0}to{opacity:1}}@keyframes modal-fade-in{0%{opacity:0}to{opacity:1}}@-webkit-keyframes modal-fade-out{0%{opacity:1}to{opacity:0}}@keyframes modal-fade-out{0%{opacity:1}to{opacity:0}}.el-divider{position:relative}.el-divider--horizontal{display:block;height:1px;width:100%;margin:24px 0;border-top:1px var(--el-border-color) var(--el-border-style)}.el-divider--vertical{display:inline-block;width:1px;height:1em;margin:0 8px;vertical-align:middle;position:relative;border-left:1px var(--el-border-color) var(--el-border-style)}.el-divider__text{position:absolute;background-color:var(--el-bg-color);padding:0 20px;font-weight:500;color:var(--el-text-color-primary);font-size:14px}.el-divider__text.is-left{left:20px;transform:translateY(-50%)}.el-divider__text.is-center{left:50%;transform:translate(-50%) translateY(-50%)}.el-divider__text.is-right{right:20px;transform:translateY(-50%)}.el-drawer{--el-drawer-bg-color:var(--el-dialog-bg-color, var(--el-bg-color));--el-drawer-padding-primary:var(--el-dialog-padding-primary, 20px)}.el-drawer{position:absolute;box-sizing:border-box;background-color:var(--el-drawer-bg-color);display:flex;flex-direction:column;box-shadow:var(--el-box-shadow-dark);overflow:hidden;transition:all var(--el-transition-duration)}.el-drawer .rtl,.el-drawer .ltr,.el-drawer .ttb,.el-drawer .btt{transform:translate(0)}.el-drawer__sr-focus:focus{outline:0!important}.el-drawer__header{align-items:center;color:#72767b;display:flex;margin-bottom:32px;padding:var(--el-drawer-padding-primary);padding-bottom:0}.el-drawer__header>:first-child{flex:1}.el-drawer__title{margin:0;flex:1;line-height:inherit;font-size:1rem}.el-drawer__footer{padding:var(--el-drawer-padding-primary);padding-top:10px;text-align:right}.el-drawer__close-btn{display:inline-flex;border:none;cursor:pointer;font-size:var(--el-font-size-extra-large);color:inherit;background-color:transparent;outline:0}.el-drawer__close-btn:focus i,.el-drawer__close-btn:hover i{color:var(--el-color-primary)}.el-drawer__body{flex:1;padding:var(--el-drawer-padding-primary);overflow:auto}.el-drawer__body>*{box-sizing:border-box}.el-drawer.ltr,.el-drawer.rtl{height:100%;top:0;bottom:0}.el-drawer.btt,.el-drawer.ttb{width:100%;left:0;right:0}.el-drawer.ltr{left:0}.el-drawer.rtl{right:0}.el-drawer.ttb{top:0}.el-drawer.btt{bottom:0}.el-drawer-fade-enter-active,.el-drawer-fade-leave-active{transition:all var(--el-transition-duration)}.el-drawer-fade-enter-active,.el-drawer-fade-enter-from,.el-drawer-fade-enter-to,.el-drawer-fade-leave-active,.el-drawer-fade-leave-from,.el-drawer-fade-leave-to{overflow:hidden!important}.el-drawer-fade-enter-from,.el-drawer-fade-leave-to{opacity:0}.el-drawer-fade-enter-to,.el-drawer-fade-leave-from{opacity:1}.el-drawer-fade-enter-from .rtl,.el-drawer-fade-leave-to .rtl{transform:translate(100%)}.el-drawer-fade-enter-from .ltr,.el-drawer-fade-leave-to .ltr{transform:translate(-100%)}.el-drawer-fade-enter-from .ttb,.el-drawer-fade-leave-to .ttb{transform:translateY(-100%)}.el-drawer-fade-enter-from .btt,.el-drawer-fade-leave-to .btt{transform:translateY(100%)}.el-dropdown{--el-dropdown-menu-box-shadow:var(--el-box-shadow-light);--el-dropdown-menuItem-hover-fill:var(--el-color-primary-light-9);--el-dropdown-menuItem-hover-color:var(--el-color-primary);--el-dropdown-menu-index:10;display:inline-flex;position:relative;color:var(--el-text-color-regular);font-size:var(--el-font-size-base);line-height:1;vertical-align:top}.el-dropdown.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-dropdown__popper{--el-dropdown-menu-box-shadow:var(--el-box-shadow-light);--el-dropdown-menuItem-hover-fill:var(--el-color-primary-light-9);--el-dropdown-menuItem-hover-color:var(--el-color-primary);--el-dropdown-menu-index:10}.el-dropdown__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-dropdown-menu-box-shadow)}.el-dropdown__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-dropdown__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-dropdown__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-dropdown__popper .el-dropdown-menu{border:none}.el-dropdown__popper .el-dropdown__popper-selfdefine{outline:0}.el-dropdown__popper .el-scrollbar__bar{z-index:calc(var(--el-dropdown-menu-index) + 1)}.el-dropdown__popper .el-dropdown__list{list-style:none;padding:0;margin:0;box-sizing:border-box}.el-dropdown .el-dropdown__caret-button{padding-left:0;padding-right:0;display:inline-flex;justify-content:center;align-items:center;width:32px;border-left:none}.el-dropdown .el-dropdown__caret-button>span{display:inline-flex}.el-dropdown .el-dropdown__caret-button:before{content:"";position:absolute;display:block;width:1px;top:-1px;bottom:-1px;left:0;background:var(--el-overlay-color-lighter)}.el-dropdown .el-dropdown__caret-button.el-button:before{background:var(--el-border-color);opacity:.5}.el-dropdown .el-dropdown__caret-button .el-dropdown__icon{font-size:inherit;padding-left:0}.el-dropdown .el-dropdown-selfdefine{outline:0}.el-dropdown--large .el-dropdown__caret-button{width:40px}.el-dropdown--small .el-dropdown__caret-button{width:24px}.el-dropdown-menu{position:relative;top:0;left:0;z-index:var(--el-dropdown-menu-index);padding:5px 0;margin:0;background-color:var(--el-bg-color-overlay);border:none;border-radius:var(--el-border-radius-base);box-shadow:none;list-style:none}.el-dropdown-menu__item{display:flex;align-items:center;white-space:nowrap;list-style:none;line-height:22px;padding:5px 16px;margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);cursor:pointer;outline:0}.el-dropdown-menu__item:not(.is-disabled):focus{background-color:var(--el-dropdown-menuItem-hover-fill);color:var(--el-dropdown-menuItem-hover-color)}.el-dropdown-menu__item i{margin-right:5px}.el-dropdown-menu__item--divided{margin:6px 0;border-top:1px solid var(--el-border-color-lighter)}.el-dropdown-menu__item.is-disabled{cursor:not-allowed;color:var(--el-text-color-disabled)}.el-dropdown-menu--large{padding:7px 0}.el-dropdown-menu--large .el-dropdown-menu__item{padding:7px 20px;line-height:22px;font-size:14px}.el-dropdown-menu--large .el-dropdown-menu__item--divided{margin:8px 0}.el-dropdown-menu--small{padding:3px 0}.el-dropdown-menu--small .el-dropdown-menu__item{padding:2px 12px;line-height:20px;font-size:12px}.el-dropdown-menu--small .el-dropdown-menu__item--divided{margin:4px 0}.el-empty{--el-empty-padding:40px 0;--el-empty-image-width:160px;--el-empty-description-margin-top:20px;--el-empty-bottom-margin-top:20px;--el-empty-fill-color-0:var(--el-color-white);--el-empty-fill-color-1:#fcfcfd;--el-empty-fill-color-2:#f8f9fb;--el-empty-fill-color-3:#f7f8fc;--el-empty-fill-color-4:#eeeff3;--el-empty-fill-color-5:#edeef2;--el-empty-fill-color-6:#e9ebef;--el-empty-fill-color-7:#e5e7e9;--el-empty-fill-color-8:#e0e3e9;--el-empty-fill-color-9:#d5d7de;display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:var(--el-empty-padding)}.el-empty__image{width:var(--el-empty-image-width)}.el-empty__image img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;width:100%;height:100%;vertical-align:top;-o-object-fit:contain;object-fit:contain}.el-empty__image svg{color:var(--el-svg-monochrome-grey);fill:currentColor;width:100%;height:100%;vertical-align:top}.el-empty__description{margin-top:var(--el-empty-description-margin-top)}.el-empty__description p{margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-secondary)}.el-empty__bottom{margin-top:var(--el-empty-bottom-margin-top)}.el-footer{--el-footer-padding:0 20px;--el-footer-height:60px;padding:var(--el-footer-padding);box-sizing:border-box;flex-shrink:0;height:var(--el-footer-height)}.el-form{--el-form-label-font-size:var(--el-font-size-base)}.el-form--label-left .el-form-item__label{justify-content:flex-start}.el-form--label-top .el-form-item{display:block}.el-form--label-top .el-form-item .el-form-item__label{display:block;height:auto;text-align:left;margin-bottom:8px;line-height:22px}.el-form--inline .el-form-item{display:inline-flex;vertical-align:middle;margin-right:32px}.el-form--inline.el-form--label-top{display:flex;flex-wrap:wrap}.el-form--inline.el-form--label-top .el-form-item{display:block}.el-form--large.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:12px;line-height:22px}.el-form--default.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:8px;line-height:22px}.el-form--small.el-form--label-top .el-form-item .el-form-item__label{margin-bottom:4px;line-height:20px}.el-form-item{display:flex;--font-size:14px;margin-bottom:18px}.el-form-item .el-form-item{margin-bottom:0}.el-form-item .el-input__validateIcon{display:none}.el-form-item--large{--font-size:14px;--el-form-label-font-size:var(--font-size);margin-bottom:22px}.el-form-item--large .el-form-item__label{height:40px;line-height:40px}.el-form-item--large .el-form-item__content{line-height:40px}.el-form-item--large .el-form-item__error{padding-top:4px}.el-form-item--default{--font-size:14px;--el-form-label-font-size:var(--font-size);margin-bottom:18px}.el-form-item--default .el-form-item__label{height:32px;line-height:32px}.el-form-item--default .el-form-item__content{line-height:32px}.el-form-item--default .el-form-item__error{padding-top:2px}.el-form-item--small{--font-size:12px;--el-form-label-font-size:var(--font-size);margin-bottom:18px}.el-form-item--small .el-form-item__label{height:24px;line-height:24px}.el-form-item--small .el-form-item__content{line-height:24px}.el-form-item--small .el-form-item__error{padding-top:2px}.el-form-item__label-wrap{display:flex}.el-form-item__label{display:inline-flex;justify-content:flex-end;align-items:flex-start;flex:0 0 auto;font-size:var(--el-form-label-font-size);color:var(--el-text-color-regular);height:32px;line-height:32px;padding:0 12px 0 0;box-sizing:border-box}.el-form-item__content{display:flex;flex-wrap:wrap;align-items:center;flex:1;line-height:32px;position:relative;font-size:var(--font-size);min-width:0}.el-form-item__content .el-input-group{vertical-align:top}.el-form-item__error{color:var(--el-color-danger);font-size:12px;line-height:1;padding-top:2px;position:absolute;top:100%;left:0}.el-form-item__error--inline{position:relative;top:auto;left:auto;display:inline-block;margin-left:10px}.el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label-wrap>.el-form-item__label:before,.el-form-item.is-required:not(.is-no-asterisk).asterisk-left>.el-form-item__label:before{content:"*";color:var(--el-color-danger);margin-right:4px}.el-form-item.is-required:not(.is-no-asterisk).asterisk-right>.el-form-item__label-wrap>.el-form-item__label:after,.el-form-item.is-required:not(.is-no-asterisk).asterisk-right>.el-form-item__label:after{content:"*";color:var(--el-color-danger);margin-left:4px}.el-form-item.is-error .el-select-v2__wrapper,.el-form-item.is-error .el-select-v2__wrapper:focus,.el-form-item.is-error .el-textarea__inner,.el-form-item.is-error .el-textarea__inner:focus{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-form-item.is-error .el-input__wrapper{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-form-item.is-error .el-input-group__append .el-input__wrapper,.el-form-item.is-error .el-input-group__prepend .el-input__wrapper{box-shadow:0 0 0 1px transparent inset}.el-form-item.is-error .el-input__validateIcon{color:var(--el-color-danger)}.el-form-item--feedback .el-input__validateIcon{display:inline-flex}.el-header{--el-header-padding:0 20px;--el-header-height:60px;padding:var(--el-header-padding);box-sizing:border-box;flex-shrink:0;height:var(--el-header-height)}.el-image-viewer__wrapper{position:fixed;top:0;right:0;bottom:0;left:0}.el-image-viewer__btn{position:absolute;z-index:1;display:flex;align-items:center;justify-content:center;border-radius:50%;opacity:.8;cursor:pointer;box-sizing:border-box;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__btn .el-icon{font-size:inherit;cursor:pointer}.el-image-viewer__close{top:40px;right:40px;width:40px;height:40px;font-size:40px}.el-image-viewer__canvas{position:static;width:100%;height:100%;display:flex;justify-content:center;align-items:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-image-viewer__actions{left:50%;bottom:30px;transform:translate(-50%);width:282px;height:44px;padding:0 23px;background-color:var(--el-text-color-regular);border-color:#fff;border-radius:22px}.el-image-viewer__actions__inner{width:100%;height:100%;text-align:justify;cursor:default;font-size:23px;color:#fff;display:flex;align-items:center;justify-content:space-around}.el-image-viewer__prev{top:50%;transform:translateY(-50%);left:40px;width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__next{top:50%;transform:translateY(-50%);right:40px;text-indent:2px;width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__close{width:44px;height:44px;font-size:24px;color:#fff;background-color:var(--el-text-color-regular);border-color:#fff}.el-image-viewer__mask{position:absolute;width:100%;height:100%;top:0;left:0;opacity:.5;background:#000}.viewer-fade-enter-active{-webkit-animation:viewer-fade-in var(--el-transition-duration);animation:viewer-fade-in var(--el-transition-duration)}.viewer-fade-leave-active{-webkit-animation:viewer-fade-out var(--el-transition-duration);animation:viewer-fade-out var(--el-transition-duration)}@-webkit-keyframes viewer-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes viewer-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes viewer-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes viewer-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}.el-image__error,.el-image__inner,.el-image__placeholder,.el-image__wrapper{width:100%;height:100%}.el-image{position:relative;display:inline-block;overflow:hidden}.el-image__inner{vertical-align:top;opacity:1}.el-image__inner.is-loading{opacity:0}.el-image__wrapper{position:absolute;top:0;left:0}.el-image__placeholder{background:var(--el-fill-color-light)}.el-image__error{display:flex;justify-content:center;align-items:center;font-size:14px;background:var(--el-fill-color-light);color:var(--el-text-color-placeholder);vertical-align:middle}.el-image__preview{cursor:pointer}.el-input-number{position:relative;display:inline-flex;width:150px;line-height:30px}.el-input-number .el-input__wrapper{padding-left:42px;padding-right:42px}.el-input-number .el-input__inner{-webkit-appearance:none;-moz-appearance:textfield;text-align:center;line-height:1}.el-input-number .el-input__inner::-webkit-inner-spin-button,.el-input-number .el-input__inner::-webkit-outer-spin-button{margin:0;-webkit-appearance:none}.el-input-number__decrease,.el-input-number__increase{display:flex;justify-content:center;align-items:center;height:auto;position:absolute;z-index:1;top:1px;bottom:1px;width:32px;background:var(--el-fill-color-light);color:var(--el-text-color-regular);cursor:pointer;font-size:13px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-input-number__decrease:hover,.el-input-number__increase:hover{color:var(--el-color-primary)}.el-input-number__decrease:hover~.el-input:not(.is-disabled) .el-input_wrapper,.el-input-number__increase:hover~.el-input:not(.is-disabled) .el-input_wrapper{box-shadow:0 0 0 1px var(--el-input-focus-border-color,var(--el-color-primary)) inset}.el-input-number__decrease.is-disabled,.el-input-number__increase.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-input-number__increase{right:1px;border-radius:0 var(--el-border-radius-base) var(--el-border-radius-base) 0;border-left:var(--el-border)}.el-input-number__decrease{left:1px;border-radius:var(--el-border-radius-base) 0 0 var(--el-border-radius-base);border-right:var(--el-border)}.el-input-number.is-disabled .el-input-number__decrease,.el-input-number.is-disabled .el-input-number__increase{border-color:var(--el-disabled-border-color);color:var(--el-disabled-border-color)}.el-input-number.is-disabled .el-input-number__decrease:hover,.el-input-number.is-disabled .el-input-number__increase:hover{color:var(--el-disabled-border-color);cursor:not-allowed}.el-input-number--large{width:180px;line-height:38px}.el-input-number--large .el-input-number__decrease,.el-input-number--large .el-input-number__increase{width:40px;font-size:14px}.el-input-number--large .el-input__wrapper{padding-left:47px;padding-right:47px}.el-input-number--small{width:120px;line-height:22px}.el-input-number--small .el-input-number__decrease,.el-input-number--small .el-input-number__increase{width:24px;font-size:12px}.el-input-number--small .el-input__wrapper{padding-left:31px;padding-right:31px}.el-input-number--small .el-input-number__decrease [class*=el-icon],.el-input-number--small .el-input-number__increase [class*=el-icon]{transform:scale(.9)}.el-input-number.is-without-controls .el-input__wrapper{padding-left:15px;padding-right:15px}.el-input-number.is-controls-right .el-input__wrapper{padding-left:15px;padding-right:42px}.el-input-number.is-controls-right .el-input-number__decrease,.el-input-number.is-controls-right .el-input-number__increase{--el-input-number-controls-height:15px;height:var(--el-input-number-controls-height);line-height:var(--el-input-number-controls-height)}.el-input-number.is-controls-right .el-input-number__decrease [class*=el-icon],.el-input-number.is-controls-right .el-input-number__increase [class*=el-icon]{transform:scale(.8)}.el-input-number.is-controls-right .el-input-number__increase{bottom:auto;left:auto;border-radius:0 var(--el-border-radius-base) 0 0;border-bottom:var(--el-border)}.el-input-number.is-controls-right .el-input-number__decrease{right:1px;top:auto;left:auto;border-right:none;border-left:var(--el-border);border-radius:0 0 var(--el-border-radius-base) 0}.el-input-number.is-controls-right[class*=large] [class*=decrease],.el-input-number.is-controls-right[class*=large] [class*=increase]{--el-input-number-controls-height:19px}.el-input-number.is-controls-right[class*=small] [class*=decrease],.el-input-number.is-controls-right[class*=small] [class*=increase]{--el-input-number-controls-height:11px}.el-textarea{--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary)}.el-textarea{position:relative;display:inline-block;width:100%;vertical-align:bottom;font-size:var(--el-font-size-base)}.el-textarea__inner{position:relative;display:block;resize:vertical;padding:5px 11px;line-height:1.5;box-sizing:border-box;width:100%;font-size:inherit;font-family:inherit;color:var(--el-input-text-color,var(--el-text-color-regular));background-color:var(--el-input-bg-color,var(--el-fill-color-blank));background-image:none;-webkit-appearance:none;box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset;border-radius:var(--el-input-border-radius,var(--el-border-radius-base));transition:var(--el-transition-box-shadow);border:none}.el-textarea__inner::-moz-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner:-ms-input-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner::placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-textarea__inner:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-textarea__inner:focus{outline:0;box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-textarea .el-input__count{color:var(--el-color-info);background:var(--el-fill-color-blank);position:absolute;font-size:12px;line-height:14px;bottom:5px;right:10px}.el-textarea.is-disabled .el-textarea__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);color:var(--el-disabled-text-color);cursor:not-allowed}.el-textarea.is-disabled .el-textarea__inner::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-disabled .el-textarea__inner:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-disabled .el-textarea__inner::placeholder{color:var(--el-text-color-placeholder)}.el-textarea.is-exceed .el-textarea__inner{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-textarea.is-exceed .el-input__count{color:var(--el-color-danger)}.el-input{--el-input-text-color:var(--el-text-color-regular);--el-input-border:var(--el-border);--el-input-hover-border:var(--el-border-color-hover);--el-input-focus-border:var(--el-color-primary);--el-input-transparent-border:0 0 0 1px transparent inset;--el-input-border-color:var(--el-border-color);--el-input-border-radius:var(--el-border-radius-base);--el-input-bg-color:var(--el-fill-color-blank);--el-input-icon-color:var(--el-text-color-placeholder);--el-input-placeholder-color:var(--el-text-color-placeholder);--el-input-hover-border-color:var(--el-border-color-hover);--el-input-clear-hover-color:var(--el-text-color-secondary);--el-input-focus-border-color:var(--el-color-primary)}.el-input{--el-input-height:var(--el-component-size);position:relative;font-size:var(--el-font-size-base);display:inline-flex;width:100%;line-height:var(--el-input-height);box-sizing:border-box;vertical-align:middle}.el-input::-webkit-scrollbar{z-index:11;width:6px}.el-input::-webkit-scrollbar:horizontal{height:6px}.el-input::-webkit-scrollbar-thumb{border-radius:5px;width:6px;background:var(--el-text-color-disabled)}.el-input::-webkit-scrollbar-corner{background:var(--el-fill-color-blank)}.el-input::-webkit-scrollbar-track{background:var(--el-fill-color-blank)}.el-input::-webkit-scrollbar-track-piece{background:var(--el-fill-color-blank);width:6px}.el-input .el-input__clear,.el-input .el-input__password{color:var(--el-input-icon-color);font-size:14px;cursor:pointer}.el-input .el-input__clear:hover,.el-input .el-input__password:hover{color:var(--el-input-clear-hover-color)}.el-input .el-input__count{height:100%;display:inline-flex;align-items:center;color:var(--el-color-info);font-size:12px}.el-input .el-input__count .el-input__count-inner{background:var(--el-fill-color-blank);line-height:initial;display:inline-block;padding-left:8px}.el-input__wrapper{display:inline-flex;flex-grow:1;align-items:center;justify-content:center;padding:1px 11px;background-color:var(--el-input-bg-color,var(--el-fill-color-blank));background-image:none;border-radius:var(--el-input-border-radius,var(--el-border-radius-base));transition:var(--el-transition-box-shadow);transform:translateZ(0);box-shadow:0 0 0 1px var(--el-input-border-color,var(--el-border-color)) inset}.el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-input-hover-border-color) inset}.el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-input-focus-border-color) inset}.el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 32px) - 2px);width:100%;flex-grow:1;-webkit-appearance:none;color:var(--el-input-text-color,var(--el-text-color-regular));font-size:inherit;height:var(--el-input-inner-height);line-height:var(--el-input-inner-height);padding:0;outline:0;border:none;background:0 0;box-sizing:border-box}.el-input__inner:focus{outline:0}.el-input__inner::-moz-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner:-ms-input-placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner::placeholder{color:var(--el-input-placeholder-color,var(--el-text-color-placeholder))}.el-input__inner[type=password]::-ms-reveal{display:none}.el-input__prefix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--el-input-icon-color,var(--el-text-color-placeholder));transition:all var(--el-transition-duration);pointer-events:none}.el-input__prefix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}.el-input__prefix-inner>:last-child{margin-right:8px}.el-input__prefix-inner>:first-child,.el-input__prefix-inner>:first-child.el-input__icon{margin-left:0}.el-input__suffix{display:inline-flex;white-space:nowrap;flex-shrink:0;flex-wrap:nowrap;height:100%;text-align:center;color:var(--el-input-icon-color,var(--el-text-color-placeholder));transition:all var(--el-transition-duration);pointer-events:none}.el-input__suffix-inner{pointer-events:all;display:inline-flex;align-items:center;justify-content:center}.el-input__suffix-inner>:first-child{margin-left:8px}.el-input .el-input__icon{height:inherit;line-height:inherit;display:flex;justify-content:center;align-items:center;transition:all var(--el-transition-duration);margin-left:8px}.el-input__validateIcon{pointer-events:none}.el-input.is-active .el-input__wrapper{box-shadow:0 0 0 1px var(--el-input-focus-color,) inset}.el-input.is-disabled{cursor:not-allowed}.el-input.is-disabled .el-input__wrapper{background-color:var(--el-disabled-bg-color);box-shadow:0 0 0 1px var(--el-disabled-border-color) inset}.el-input.is-disabled .el-input__inner{color:var(--el-disabled-text-color);-webkit-text-fill-color:var(--el-disabled-text-color);cursor:not-allowed}.el-input.is-disabled .el-input__inner::-moz-placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__inner:-ms-input-placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__inner::placeholder{color:var(--el-text-color-placeholder)}.el-input.is-disabled .el-input__icon{cursor:not-allowed}.el-input.is-exceed .el-input__wrapper{box-shadow:0 0 0 1px var(--el-color-danger) inset}.el-input.is-exceed .el-input__suffix .el-input__count{color:var(--el-color-danger)}.el-input--large{--el-input-height:var(--el-component-size-large);font-size:14px}.el-input--large .el-input__wrapper{padding:1px 15px}.el-input--large .el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 40px) - 2px)}.el-input--small{--el-input-height:var(--el-component-size-small);font-size:12px}.el-input--small .el-input__wrapper{padding:1px 7px}.el-input--small .el-input__inner{--el-input-inner-height:calc(var(--el-input-height, 24px) - 2px)}.el-input-group{display:inline-flex;width:100%;align-items:stretch}.el-input-group__append,.el-input-group__prepend{background-color:var(--el-fill-color-light);color:var(--el-color-info);position:relative;display:inline-flex;align-items:center;justify-content:center;min-height:100%;border-radius:var(--el-input-border-radius);padding:0 20px;white-space:nowrap}.el-input-group__append:focus,.el-input-group__prepend:focus{outline:0}.el-input-group__append .el-button,.el-input-group__append .el-select,.el-input-group__prepend .el-button,.el-input-group__prepend .el-select{display:inline-block;margin:0 -20px}.el-input-group__append button.el-button,.el-input-group__append button.el-button:hover,.el-input-group__append div.el-select .el-input__wrapper,.el-input-group__append div.el-select:hover .el-input__wrapper,.el-input-group__prepend button.el-button,.el-input-group__prepend button.el-button:hover,.el-input-group__prepend div.el-select .el-input__wrapper,.el-input-group__prepend div.el-select:hover .el-input__wrapper{border-color:transparent;background-color:transparent;color:inherit}.el-input-group__append .el-button,.el-input-group__append .el-input,.el-input-group__prepend .el-button,.el-input-group__prepend .el-input{font-size:inherit}.el-input-group__prepend{border-right:0;border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 0 var(--el-input-border-color) inset,0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset}.el-input-group__append{border-left:0;border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset,-1px 0 0 0 var(--el-input-border-color) inset}.el-input-group--prepend>.el-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0}.el-input-group--prepend .el-input-group__prepend .el-select .el-input .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select .el-input .el-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0;box-shadow:1px 0 0 0 var(--el-input-border-color) inset,0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__wrapper{box-shadow:1px 0 0 0 var(--el-input-focus-border-color) inset,1px 0 0 0 var(--el-input-focus-border-color),0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important;z-index:2}.el-input-group--prepend .el-input-group__prepend .el-select .el-input.is-focus .el-input__wrapper:focus{outline:0;z-index:2;box-shadow:1px 0 0 0 var(--el-input-focus-border-color) inset,1px 0 0 0 var(--el-input-focus-border-color),0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important}.el-input-group--prepend .el-input-group__prepend .el-select:hover .el-input__inner{box-shadow:none!important}.el-input-group--prepend .el-input-group__prepend .el-select:hover .el-input__wrapper{z-index:1;box-shadow:1px 0 0 0 var(--el-input-hover-border-color) inset,1px 0 0 0 var(--el-input-hover-border-color),0 1px 0 0 var(--el-input-hover-border-color) inset,0 -1px 0 0 var(--el-input-hover-border-color) inset!important}.el-input-group--append>.el-input__wrapper{border-top-right-radius:0;border-bottom-right-radius:0}.el-input-group--append .el-input-group__append .el-select .el-input .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select .el-input .el-input__wrapper{border-top-left-radius:0;border-bottom-left-radius:0;box-shadow:0 1px 0 0 var(--el-input-border-color) inset,0 -1px 0 0 var(--el-input-border-color) inset,-1px 0 0 0 var(--el-input-border-color) inset}.el-input-group--append .el-input-group__append .el-select .el-input.is-focus .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select .el-input.is-focus .el-input__wrapper{z-index:2;box-shadow:-1px 0 0 0 var(--el-input-focus-border-color),-1px 0 0 0 var(--el-input-focus-border-color) inset,0 1px 0 0 var(--el-input-focus-border-color) inset,0 -1px 0 0 var(--el-input-focus-border-color) inset!important}.el-input-group--append .el-input-group__append .el-select:hover .el-input__inner{box-shadow:none!important}.el-input-group--append .el-input-group__append .el-select:hover .el-input__wrapper{z-index:1;box-shadow:-1px 0 0 0 var(--el-input-hover-border-color),-1px 0 0 0 var(--el-input-hover-border-color) inset,0 1px 0 0 var(--el-input-hover-border-color) inset,0 -1px 0 0 var(--el-input-hover-border-color) inset!important}.el-link{--el-link-font-size:var(--el-font-size-base);--el-link-font-weight:var(--el-font-weight-primary);--el-link-text-color:var(--el-text-color-regular);--el-link-hover-text-color:var(--el-color-primary);--el-link-disabled-text-color:var(--el-text-color-placeholder)}.el-link{display:inline-flex;flex-direction:row;align-items:center;justify-content:center;vertical-align:middle;position:relative;text-decoration:none;outline:0;cursor:pointer;padding:0;font-size:var(--el-link-font-size);font-weight:var(--el-link-font-weight);color:var(--el-link-text-color)}.el-link:hover{color:var(--el-link-hover-text-color)}.el-link.is-underline:hover:after{content:"";position:absolute;left:0;right:0;height:0;bottom:0;border-bottom:1px solid var(--el-link-hover-text-color)}.el-link.is-disabled{color:var(--el-link-disabled-text-color);cursor:not-allowed}.el-link [class*=el-icon-]+span{margin-left:5px}.el-link.el-link--default:after{border-color:var(--el-link-hover-text-color)}.el-link__inner{display:inline-flex;justify-content:center;align-items:center}.el-link.el-link--primary{--el-link-text-color:var(--el-color-primary);--el-link-hover-text-color:var(--el-color-primary-light-3);--el-link-disabled-text-color:var(--el-color-primary-light-5)}.el-link.el-link--primary:after{border-color:var(--el-link-text-color)}.el-link.el-link--primary.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--success{--el-link-text-color:var(--el-color-success);--el-link-hover-text-color:var(--el-color-success-light-3);--el-link-disabled-text-color:var(--el-color-success-light-5)}.el-link.el-link--success:after{border-color:var(--el-link-text-color)}.el-link.el-link--success.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--warning{--el-link-text-color:var(--el-color-warning);--el-link-hover-text-color:var(--el-color-warning-light-3);--el-link-disabled-text-color:var(--el-color-warning-light-5)}.el-link.el-link--warning:after{border-color:var(--el-link-text-color)}.el-link.el-link--warning.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--danger{--el-link-text-color:var(--el-color-danger);--el-link-hover-text-color:var(--el-color-danger-light-3);--el-link-disabled-text-color:var(--el-color-danger-light-5)}.el-link.el-link--danger:after{border-color:var(--el-link-text-color)}.el-link.el-link--danger.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--error{--el-link-text-color:var(--el-color-error);--el-link-hover-text-color:var(--el-color-error-light-3);--el-link-disabled-text-color:var(--el-color-error-light-5)}.el-link.el-link--error:after{border-color:var(--el-link-text-color)}.el-link.el-link--error.is-underline:hover:after{border-color:var(--el-link-text-color)}.el-link.el-link--info{--el-link-text-color:var(--el-color-info);--el-link-hover-text-color:var(--el-color-info-light-3);--el-link-disabled-text-color:var(--el-color-info-light-5)}.el-link.el-link--info:after{border-color:var(--el-link-text-color)}.el-link.el-link--info.is-underline:hover:after{border-color:var(--el-link-text-color)}:root{--el-loading-spinner-size:42px;--el-loading-fullscreen-spinner-size:50px}.el-loading-parent--relative{position:relative!important}.el-loading-parent--hidden{overflow:hidden!important}.el-loading-mask{position:absolute;z-index:2000;background-color:var(--el-mask-color);margin:0;top:0;right:0;bottom:0;left:0;transition:opacity var(--el-transition-duration)}.el-loading-mask.is-fullscreen{position:fixed}.el-loading-mask.is-fullscreen .el-loading-spinner{margin-top:calc((0px - var(--el-loading-fullscreen-spinner-size))/ 2)}.el-loading-mask.is-fullscreen .el-loading-spinner .circular{height:var(--el-loading-fullscreen-spinner-size);width:var(--el-loading-fullscreen-spinner-size)}.el-loading-spinner{top:50%;margin-top:calc((0px - var(--el-loading-spinner-size))/ 2);width:100%;text-align:center;position:absolute}.el-loading-spinner .el-loading-text{color:var(--el-color-primary);margin:3px 0;font-size:14px}.el-loading-spinner .circular{display:inline;height:var(--el-loading-spinner-size);width:var(--el-loading-spinner-size);-webkit-animation:loading-rotate 2s linear infinite;animation:loading-rotate 2s linear infinite}.el-loading-spinner .path{-webkit-animation:loading-dash 1.5s ease-in-out infinite;animation:loading-dash 1.5s ease-in-out infinite;stroke-dasharray:90,150;stroke-dashoffset:0;stroke-width:2;stroke:var(--el-color-primary);stroke-linecap:round}.el-loading-spinner i{color:var(--el-color-primary)}.el-loading-fade-enter-from,.el-loading-fade-leave-to{opacity:0}@-webkit-keyframes loading-rotate{to{transform:rotate(360deg)}}@keyframes loading-rotate{to{transform:rotate(360deg)}}@-webkit-keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}@keyframes loading-dash{0%{stroke-dasharray:1,200;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-40px}to{stroke-dasharray:90,150;stroke-dashoffset:-120px}}.el-main{--el-main-padding:20px;display:block;flex:1;flex-basis:auto;overflow:auto;box-sizing:border-box;padding:var(--el-main-padding)}:root{--el-menu-active-color:var(--el-color-primary);--el-menu-text-color:var(--el-text-color-primary);--el-menu-hover-text-color:var(--el-color-primary);--el-menu-bg-color:var(--el-fill-color-blank);--el-menu-hover-bg-color:var(--el-color-primary-light-9);--el-menu-item-height:56px;--el-menu-sub-item-height:calc(var(--el-menu-item-height) - 6px);--el-menu-horizontal-sub-item-height:36px;--el-menu-item-font-size:var(--el-font-size-base);--el-menu-item-hover-fill:var(--el-color-primary-light-9);--el-menu-border-color:var(--el-border-color);--el-menu-base-level-padding:20px;--el-menu-level-padding:20px;--el-menu-icon-width:24px}.el-menu{border-right:solid 1px var(--el-menu-border-color);list-style:none;position:relative;margin:0;padding-left:0;background-color:var(--el-menu-bg-color);box-sizing:border-box}.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-menu-item,.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-menu-item-group__title,.el-menu--vertical:not(.el-menu--collapse):not(.el-menu--popup-container) .el-sub-menu__title{white-space:nowrap;padding-left:calc(var(--el-menu-base-level-padding) + var(--el-menu-level) * var(--el-menu-level-padding))}.el-menu--horizontal{display:flex;flex-wrap:nowrap;border-bottom:solid 1px var(--el-menu-border-color);border-right:none}.el-menu--horizontal>.el-menu-item{display:inline-flex;justify-content:center;align-items:center;height:100%;margin:0;border-bottom:2px solid transparent;color:var(--el-menu-text-color)}.el-menu--horizontal>.el-menu-item a,.el-menu--horizontal>.el-menu-item a:hover{color:inherit}.el-menu--horizontal>.el-menu-item:not(.is-disabled):focus,.el-menu--horizontal>.el-menu-item:not(.is-disabled):hover{background-color:#fff}.el-menu--horizontal>.el-sub-menu:focus,.el-menu--horizontal>.el-sub-menu:hover{outline:0}.el-menu--horizontal>.el-sub-menu:hover .el-sub-menu__title{color:var(--el-menu-hover-text-color)}.el-menu--horizontal>.el-sub-menu.is-active .el-sub-menu__title{border-bottom:2px solid var(--el-menu-active-color);color:var(--el-menu-active-color)}.el-menu--horizontal>.el-sub-menu .el-sub-menu__title{height:100%;border-bottom:2px solid transparent;color:var(--el-menu-text-color)}.el-menu--horizontal>.el-sub-menu .el-sub-menu__title:hover{background-color:var(--el-bg-color-overlay)}.el-menu--horizontal .el-menu .el-menu-item,.el-menu--horizontal .el-menu .el-sub-menu__title{background-color:var(--el-menu-bg-color);display:flex;align-items:center;height:var(--el-menu-horizontal-sub-item-height);line-height:var(--el-menu-horizontal-sub-item-height);padding:0 10px;color:var(--el-menu-text-color)}.el-menu--horizontal .el-menu .el-sub-menu__title{padding-right:40px}.el-menu--horizontal .el-menu .el-menu-item.is-active,.el-menu--horizontal .el-menu .el-sub-menu.is-active>.el-sub-menu__title{color:var(--el-menu-active-color)}.el-menu--horizontal .el-menu-item:not(.is-disabled):focus,.el-menu--horizontal .el-menu-item:not(.is-disabled):hover{outline:0;color:var(--el-menu-hover-text-color);background-color:var(--el-menu-hover-bg-color)}.el-menu--horizontal>.el-menu-item.is-active{border-bottom:2px solid var(--el-menu-active-color);color:var(--el-menu-active-color)!important}.el-menu--collapse{width:calc(var(--el-menu-icon-width) + var(--el-menu-base-level-padding) * 2)}.el-menu--collapse>.el-menu-item [class^=el-icon],.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title [class^=el-icon],.el-menu--collapse>.el-sub-menu>.el-sub-menu__title [class^=el-icon]{margin:0;vertical-align:middle;width:var(--el-menu-icon-width);text-align:center}.el-menu--collapse>.el-menu-item .el-sub-menu__icon-arrow,.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow,.el-menu--collapse>.el-sub-menu>.el-sub-menu__title .el-sub-menu__icon-arrow{display:none}.el-menu--collapse>.el-menu-item-group>ul>.el-sub-menu>.el-sub-menu__title>span,.el-menu--collapse>.el-menu-item>span,.el-menu--collapse>.el-sub-menu>.el-sub-menu__title>span{height:0;width:0;overflow:hidden;visibility:hidden;display:inline-block}.el-menu--collapse>.el-menu-item.is-active i{color:inherit}.el-menu--collapse .el-menu .el-sub-menu{min-width:200px}.el-menu--popup{z-index:100;min-width:200px;border:none;padding:5px 0;border-radius:var(--el-border-radius-small);box-shadow:var(--el-box-shadow-light)}.el-menu .el-icon{flex-shrink:0}.el-menu-item{display:flex;align-items:center;height:var(--el-menu-item-height);line-height:var(--el-menu-item-height);font-size:var(--el-menu-item-font-size);color:var(--el-menu-text-color);padding:0 var(--el-menu-base-level-padding);list-style:none;cursor:pointer;position:relative;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration),color var(--el-transition-duration);box-sizing:border-box;white-space:nowrap}.el-menu-item *{vertical-align:bottom}.el-menu-item i{color:inherit}.el-menu-item:focus,.el-menu-item:hover{outline:0}.el-menu-item:hover{background-color:var(--el-menu-hover-bg-color)}.el-menu-item.is-disabled{opacity:.25;cursor:not-allowed;background:0 0!important}.el-menu-item [class^=el-icon]{margin-right:5px;width:var(--el-menu-icon-width);text-align:center;font-size:18px;vertical-align:middle}.el-menu-item.is-active{color:var(--el-menu-active-color)}.el-menu-item.is-active i{color:inherit}.el-menu-item .el-menu-tooltip__trigger{position:absolute;left:0;top:0;height:100%;width:100%;display:inline-flex;align-items:center;box-sizing:border-box;padding:0 var(--el-menu-base-level-padding)}.el-sub-menu{list-style:none;margin:0;padding-left:0}.el-sub-menu__title{display:flex;align-items:center;height:var(--el-menu-item-height);line-height:var(--el-menu-item-height);font-size:var(--el-menu-item-font-size);color:var(--el-menu-text-color);padding:0 var(--el-menu-base-level-padding);list-style:none;cursor:pointer;position:relative;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration),color var(--el-transition-duration);box-sizing:border-box;white-space:nowrap;padding-right:calc(var(--el-menu-base-level-padding) + var(--el-menu-icon-width))}.el-sub-menu__title *{vertical-align:bottom}.el-sub-menu__title i{color:inherit}.el-sub-menu__title:focus,.el-sub-menu__title:hover{outline:0}.el-sub-menu__title.is-disabled{opacity:.25;cursor:not-allowed;background:0 0!important}.el-sub-menu__title:hover{background-color:var(--el-menu-hover-bg-color)}.el-sub-menu .el-menu{border:none}.el-sub-menu .el-menu-item{height:var(--el-menu-sub-item-height);line-height:var(--el-menu-sub-item-height)}.el-sub-menu__hide-arrow .el-sub-menu__icon-arrow{display:none!important}.el-sub-menu.is-active .el-sub-menu__title{border-bottom-color:var(--el-menu-active-color)}.el-sub-menu.is-disabled .el-menu-item,.el-sub-menu.is-disabled .el-sub-menu__title{opacity:.25;cursor:not-allowed;background:0 0!important}.el-sub-menu .el-icon{vertical-align:middle;margin-right:5px;width:var(--el-menu-icon-width);text-align:center;font-size:18px}.el-sub-menu .el-icon.el-sub-menu__icon-more{margin-right:0!important}.el-sub-menu .el-sub-menu__icon-arrow{position:absolute;top:50%;right:var(--el-menu-base-level-padding);margin-top:-6px;transition:transform var(--el-transition-duration);font-size:12px;margin-right:0;width:inherit}.el-menu-item-group>ul{padding:0}.el-menu-item-group__title{padding:7px 0 7px var(--el-menu-base-level-padding);line-height:normal;font-size:12px;color:var(--el-text-color-secondary)}.horizontal-collapse-transition .el-sub-menu__title .el-sub-menu__icon-arrow{transition:var(--el-transition-duration-fast);opacity:0}.el-message-box{--el-messagebox-title-color:var(--el-text-color-primary);--el-messagebox-width:420px;--el-messagebox-border-radius:4px;--el-messagebox-font-size:var(--el-font-size-large);--el-messagebox-content-font-size:var(--el-font-size-base);--el-messagebox-content-color:var(--el-text-color-regular);--el-messagebox-error-font-size:12px;--el-messagebox-padding-primary:15px}.el-message-box{display:inline-block;max-width:var(--el-messagebox-width);width:100%;padding-bottom:10px;vertical-align:middle;background-color:var(--el-bg-color);border-radius:var(--el-messagebox-border-radius);border:1px solid var(--el-border-color-lighter);font-size:var(--el-messagebox-font-size);box-shadow:var(--el-box-shadow-light);text-align:left;overflow:hidden;-webkit-backface-visibility:hidden;backface-visibility:hidden;box-sizing:border-box}.el-message-box:focus{outline:0!important}.el-overlay.is-message-box .el-overlay-message-box{text-align:center;position:fixed;top:0;right:0;bottom:0;left:0;padding:16px;overflow:auto}.el-overlay.is-message-box .el-overlay-message-box:after{content:"";display:inline-block;height:100%;width:0;vertical-align:middle}.el-message-box.is-draggable .el-message-box__header{cursor:move;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-message-box__header{position:relative;padding:var(--el-messagebox-padding-primary);padding-bottom:10px}.el-message-box__title{padding-left:0;margin-bottom:0;font-size:var(--el-messagebox-font-size);line-height:1;color:var(--el-messagebox-title-color)}.el-message-box__headerbtn{position:absolute;top:var(--el-messagebox-padding-primary);right:var(--el-messagebox-padding-primary);padding:0;border:none;outline:0;background:0 0;font-size:var(--el-message-close-size,16px);cursor:pointer}.el-message-box__headerbtn .el-message-box__close{color:var(--el-color-info);font-size:inherit}.el-message-box__headerbtn:focus .el-message-box__close,.el-message-box__headerbtn:hover .el-message-box__close{color:var(--el-color-primary)}.el-message-box__content{padding:10px var(--el-messagebox-padding-primary);color:var(--el-messagebox-content-color);font-size:var(--el-messagebox-content-font-size)}.el-message-box__container{position:relative}.el-message-box__input{padding-top:15px}.el-message-box__input div.invalid>input{border-color:var(--el-color-error)}.el-message-box__input div.invalid>input:focus{border-color:var(--el-color-error)}.el-message-box__status{position:absolute;top:50%;transform:translateY(-50%);font-size:24px!important}.el-message-box__status:before{padding-left:1px}.el-message-box__status.el-icon{position:absolute}.el-message-box__status+.el-message-box__message{padding-left:36px;padding-right:12px;word-break:break-word}.el-message-box__status.el-message-box-icon--success{--el-messagebox-color:var(--el-color-success);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--info{--el-messagebox-color:var(--el-color-info);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--warning{--el-messagebox-color:var(--el-color-warning);color:var(--el-messagebox-color)}.el-message-box__status.el-message-box-icon--error{--el-messagebox-color:var(--el-color-error);color:var(--el-messagebox-color)}.el-message-box__message{margin:0}.el-message-box__message p{margin:0;line-height:24px}.el-message-box__errormsg{color:var(--el-color-error);font-size:var(--el-messagebox-error-font-size);min-height:18px;margin-top:2px}.el-message-box__btns{padding:5px 15px 0;display:flex;flex-wrap:wrap;justify-content:flex-end;align-items:center}.el-message-box__btns button:nth-child(2){margin-left:10px}.el-message-box__btns-reverse{flex-direction:row-reverse}.el-message-box--center .el-message-box__title{position:relative;display:flex;align-items:center;justify-content:center}.el-message-box--center .el-message-box__status{position:relative;top:auto;padding-right:5px;text-align:center;transform:translateY(-1px)}.el-message-box--center .el-message-box__message{margin-left:0}.el-message-box--center .el-message-box__btns{justify-content:center}.el-message-box--center .el-message-box__content{padding-left:calc(var(--el-messagebox-padding-primary) + 12px);padding-right:calc(var(--el-messagebox-padding-primary) + 12px);text-align:center}.fade-in-linear-enter-active .el-overlay-message-box{-webkit-animation:msgbox-fade-in var(--el-transition-duration);animation:msgbox-fade-in var(--el-transition-duration)}.fade-in-linear-leave-active .el-overlay-message-box{animation:msgbox-fade-in var(--el-transition-duration) reverse}@-webkit-keyframes msgbox-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@keyframes msgbox-fade-in{0%{transform:translate3d(0,-20px,0);opacity:0}to{transform:translateZ(0);opacity:1}}@-webkit-keyframes msgbox-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}@keyframes msgbox-fade-out{0%{transform:translateZ(0);opacity:1}to{transform:translate3d(0,-20px,0);opacity:0}}.el-message{--el-message-bg-color:var(--el-color-info-light-9);--el-message-border-color:var(--el-border-color-lighter);--el-message-padding:15px 19px;--el-message-close-size:16px;--el-message-close-icon-color:var(--el-text-color-placeholder);--el-message-close-hover-color:var(--el-text-color-secondary)}.el-message{width:-webkit-fit-content;width:-moz-fit-content;width:fit-content;max-width:calc(100% - 32px);box-sizing:border-box;border-radius:var(--el-border-radius-base);border-width:var(--el-border-width);border-style:var(--el-border-style);border-color:var(--el-message-border-color);position:fixed;left:50%;top:20px;transform:translate(-50%);background-color:var(--el-message-bg-color);transition:opacity var(--el-transition-duration),transform .4s,top .4s;padding:var(--el-message-padding);display:flex;align-items:center}.el-message.is-center{justify-content:center}.el-message.is-closable .el-message__content{padding-right:31px}.el-message p{margin:0}.el-message--success{--el-message-bg-color:var(--el-color-success-light-9);--el-message-border-color:var(--el-color-success-light-8);--el-message-text-color:var(--el-color-success)}.el-message--success .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--success{color:var(--el-message-text-color)}.el-message--info{--el-message-bg-color:var(--el-color-info-light-9);--el-message-border-color:var(--el-color-info-light-8);--el-message-text-color:var(--el-color-info)}.el-message--info .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--info{color:var(--el-message-text-color)}.el-message--warning{--el-message-bg-color:var(--el-color-warning-light-9);--el-message-border-color:var(--el-color-warning-light-8);--el-message-text-color:var(--el-color-warning)}.el-message--warning .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--warning{color:var(--el-message-text-color)}.el-message--error{--el-message-bg-color:var(--el-color-error-light-9);--el-message-border-color:var(--el-color-error-light-8);--el-message-text-color:var(--el-color-error)}.el-message--error .el-message__content{color:var(--el-message-text-color);overflow-wrap:anywhere}.el-message .el-message-icon--error{color:var(--el-message-text-color)}.el-message__icon{margin-right:10px}.el-message .el-message__badge{position:absolute;top:-8px;right:-8px}.el-message__content{padding:0;font-size:14px;line-height:1}.el-message__content:focus{outline-width:0}.el-message .el-message__closeBtn{position:absolute;top:50%;right:19px;transform:translateY(-50%);cursor:pointer;color:var(--el-message-close-icon-color);font-size:var(--el-message-close-size)}.el-message .el-message__closeBtn:focus{outline-width:0}.el-message .el-message__closeBtn:hover{color:var(--el-message-close-hover-color)}.el-message-fade-enter-from,.el-message-fade-leave-to{opacity:0;transform:translate(-50%,-100%)}.el-notification{--el-notification-width:330px;--el-notification-padding:14px 26px 14px 13px;--el-notification-radius:8px;--el-notification-shadow:var(--el-box-shadow-light);--el-notification-border-color:var(--el-border-color-lighter);--el-notification-icon-size:24px;--el-notification-close-font-size:var(--el-message-close-size, 16px);--el-notification-group-margin-left:13px;--el-notification-group-margin-right:8px;--el-notification-content-font-size:var(--el-font-size-base);--el-notification-content-color:var(--el-text-color-regular);--el-notification-title-font-size:16px;--el-notification-title-color:var(--el-text-color-primary);--el-notification-close-color:var(--el-text-color-secondary);--el-notification-close-hover-color:var(--el-text-color-regular)}.el-notification{display:flex;width:var(--el-notification-width);padding:var(--el-notification-padding);border-radius:var(--el-notification-radius);box-sizing:border-box;border:1px solid var(--el-notification-border-color);position:fixed;background-color:var(--el-bg-color-overlay);box-shadow:var(--el-notification-shadow);transition:opacity var(--el-transition-duration),transform var(--el-transition-duration),left var(--el-transition-duration),right var(--el-transition-duration),top .4s,bottom var(--el-transition-duration);overflow-wrap:anywhere;overflow:hidden;z-index:9999}.el-notification.right{right:16px}.el-notification.left{left:16px}.el-notification__group{margin-left:var(--el-notification-group-margin-left);margin-right:var(--el-notification-group-margin-right)}.el-notification__title{font-weight:700;font-size:var(--el-notification-title-font-size);line-height:var(--el-notification-icon-size);color:var(--el-notification-title-color);margin:0}.el-notification__content{font-size:var(--el-notification-content-font-size);line-height:24px;margin:6px 0 0;color:var(--el-notification-content-color);text-align:justify}.el-notification__content p{margin:0}.el-notification .el-notification__icon{height:var(--el-notification-icon-size);width:var(--el-notification-icon-size);font-size:var(--el-notification-icon-size)}.el-notification .el-notification__closeBtn{position:absolute;top:18px;right:15px;cursor:pointer;color:var(--el-notification-close-color);font-size:var(--el-notification-close-font-size)}.el-notification .el-notification__closeBtn:hover{color:var(--el-notification-close-hover-color)}.el-notification .el-notification--success{--el-notification-icon-color:var(--el-color-success);color:var(--el-notification-icon-color)}.el-notification .el-notification--info{--el-notification-icon-color:var(--el-color-info);color:var(--el-notification-icon-color)}.el-notification .el-notification--warning{--el-notification-icon-color:var(--el-color-warning);color:var(--el-notification-icon-color)}.el-notification .el-notification--error{--el-notification-icon-color:var(--el-color-error);color:var(--el-notification-icon-color)}.el-notification-fade-enter-from.right{right:0;transform:translate(100%)}.el-notification-fade-enter-from.left{left:0;transform:translate(-100%)}.el-notification-fade-leave-to{opacity:0}.el-overlay{position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;height:100%;background-color:var(--el-overlay-color-lighter);overflow:auto}.el-overlay .el-overlay-root{height:0}.el-page-header.is-contentful .el-page-header__main{border-top:1px solid var(--el-border-color-light);margin-top:16px}.el-page-header__header{display:flex;align-items:center;justify-content:space-between;line-height:24px}.el-page-header__left{display:flex;align-items:center;margin-right:40px;position:relative}.el-page-header__back{display:flex;align-items:center;cursor:pointer}.el-page-header__left .el-divider--vertical{margin:0 16px}.el-page-header__icon{font-size:16px;margin-right:10px;display:flex;align-items:center}.el-page-header__icon .el-icon{font-size:inherit}.el-page-header__title{font-size:14px;font-weight:500}.el-page-header__content{font-size:18px;color:var(--el-text-color-primary)}.el-page-header__breadcrumb{margin-bottom:16px}.el-pagination{--el-pagination-font-size:14px;--el-pagination-bg-color:var(--el-fill-color-blank);--el-pagination-text-color:var(--el-text-color-primary);--el-pagination-border-radius:2px;--el-pagination-button-color:var(--el-text-color-primary);--el-pagination-button-width:32px;--el-pagination-button-height:32px;--el-pagination-button-disabled-color:var(--el-text-color-placeholder);--el-pagination-button-disabled-bg-color:var(--el-fill-color-blank);--el-pagination-button-bg-color:var(--el-fill-color);--el-pagination-hover-color:var(--el-color-primary);--el-pagination-font-size-small:12px;--el-pagination-button-width-small:24px;--el-pagination-button-height-small:24px;--el-pagination-item-gap:16px;white-space:nowrap;color:var(--el-pagination-text-color);font-size:var(--el-pagination-font-size);font-weight:400;display:flex;align-items:center}.el-pagination .el-input__inner{text-align:center;-moz-appearance:textfield}.el-pagination .el-select .el-input{width:128px}.el-pagination button{display:flex;justify-content:center;align-items:center;font-size:var(--el-pagination-font-size);min-width:var(--el-pagination-button-width);height:var(--el-pagination-button-height);line-height:var(--el-pagination-button-height);color:var(--el-pagination-button-color);background:var(--el-pagination-bg-color);padding:0 4px;border:none;border-radius:var(--el-pagination-border-radius);cursor:pointer;text-align:center;box-sizing:border-box}.el-pagination button *{pointer-events:none}.el-pagination button:focus{outline:0}.el-pagination button:hover{color:var(--el-pagination-hover-color)}.el-pagination button.is-active{color:var(--el-pagination-hover-color);cursor:default;font-weight:700}.el-pagination button.is-active.is-disabled{font-weight:700;color:var(--el-text-color-secondary)}.el-pagination button.is-disabled,.el-pagination button:disabled{color:var(--el-pagination-button-disabled-color);background-color:var(--el-pagination-button-disabled-bg-color);cursor:not-allowed}.el-pagination button:focus-visible{outline:1px solid var(--el-pagination-hover-color);outline-offset:-1px}.el-pagination .btn-next .el-icon,.el-pagination .btn-prev .el-icon{display:block;font-size:12px;font-weight:700;width:inherit}.el-pagination>.is-first{margin-left:0!important}.el-pagination>.is-last{margin-right:0!important}.el-pagination .btn-prev{margin-left:var(--el-pagination-item-gap)}.el-pagination__sizes,.el-pagination__total{margin-left:var(--el-pagination-item-gap);font-weight:400;color:var(--el-text-color-regular)}.el-pagination__total[disabled=true]{color:var(--el-text-color-placeholder)}.el-pagination__jump{display:flex;align-items:center;margin-left:var(--el-pagination-item-gap);font-weight:400;color:var(--el-text-color-regular)}.el-pagination__jump[disabled=true]{color:var(--el-text-color-placeholder)}.el-pagination__goto{margin-right:8px}.el-pagination__editor{text-align:center;box-sizing:border-box}.el-pagination__editor.el-input{width:56px}.el-pagination__editor .el-input__inner::-webkit-inner-spin-button,.el-pagination__editor .el-input__inner::-webkit-outer-spin-button{-webkit-appearance:none;margin:0}.el-pagination__classifier{margin-left:8px}.el-pagination__rightwrapper{flex:1;display:flex;align-items:center;justify-content:flex-end}.el-pagination.is-background .btn-next,.el-pagination.is-background .btn-prev,.el-pagination.is-background .el-pager li{margin:0 4px;background-color:var(--el-pagination-button-bg-color)}.el-pagination.is-background .btn-next.is-active,.el-pagination.is-background .btn-prev.is-active,.el-pagination.is-background .el-pager li.is-active{background-color:var(--el-color-primary);color:var(--el-color-white)}.el-pagination.is-background .btn-next.is-disabled,.el-pagination.is-background .btn-next:disabled,.el-pagination.is-background .btn-prev.is-disabled,.el-pagination.is-background .btn-prev:disabled,.el-pagination.is-background .el-pager li.is-disabled,.el-pagination.is-background .el-pager li:disabled{color:var(--el-text-color-placeholder);background-color:var(--el-disabled-bg-color)}.el-pagination.is-background .btn-next.is-disabled.is-active,.el-pagination.is-background .btn-next:disabled.is-active,.el-pagination.is-background .btn-prev.is-disabled.is-active,.el-pagination.is-background .btn-prev:disabled.is-active,.el-pagination.is-background .el-pager li.is-disabled.is-active,.el-pagination.is-background .el-pager li:disabled.is-active{color:var(--el-text-color-secondary);background-color:var(--el-fill-color-dark)}.el-pagination.is-background .btn-prev{margin-left:var(--el-pagination-item-gap)}.el-pagination--small .btn-next,.el-pagination--small .btn-prev,.el-pagination--small .el-pager li{height:var(--el-pagination-button-height-small);line-height:var(--el-pagination-button-height-small);font-size:var(--el-pagination-font-size-small);min-width:var(--el-pagination-button-width-small)}.el-pagination--small button,.el-pagination--small span:not([class*=suffix]){font-size:var(--el-pagination-font-size-small)}.el-pagination--small .el-select .el-input{width:100px}.el-pager{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;font-size:0;padding:0;margin:0;display:flex;align-items:center}.el-pager li{display:flex;justify-content:center;align-items:center;font-size:var(--el-pagination-font-size);min-width:var(--el-pagination-button-width);height:var(--el-pagination-button-height);line-height:var(--el-pagination-button-height);color:var(--el-pagination-button-color);background:var(--el-pagination-bg-color);padding:0 4px;border:none;border-radius:var(--el-pagination-border-radius);cursor:pointer;text-align:center;box-sizing:border-box}.el-pager li *{pointer-events:none}.el-pager li:focus{outline:0}.el-pager li:hover{color:var(--el-pagination-hover-color)}.el-pager li.is-active{color:var(--el-pagination-hover-color);cursor:default;font-weight:700}.el-pager li.is-active.is-disabled{font-weight:700;color:var(--el-text-color-secondary)}.el-pager li.is-disabled,.el-pager li:disabled{color:var(--el-pagination-button-disabled-color);background-color:var(--el-pagination-button-disabled-bg-color);cursor:not-allowed}.el-pager li:focus-visible{outline:1px solid var(--el-pagination-hover-color);outline-offset:-1px}.el-popconfirm__main{display:flex;align-items:center}.el-popconfirm__icon{margin-right:5px}.el-popconfirm__action{text-align:right;margin-top:8px}.el-popover{--el-popover-bg-color:var(--el-bg-color-overlay);--el-popover-font-size:var(--el-font-size-base);--el-popover-border-color:var(--el-border-color-lighter);--el-popover-padding:12px;--el-popover-padding-large:18px 20px;--el-popover-title-font-size:16px;--el-popover-title-text-color:var(--el-text-color-primary);--el-popover-border-radius:4px}.el-popover.el-popper{background:var(--el-popover-bg-color);min-width:150px;border-radius:var(--el-popover-border-radius);border:1px solid var(--el-popover-border-color);padding:var(--el-popover-padding);z-index:var(--el-index-popper);color:var(--el-text-color-regular);line-height:1.4;text-align:justify;font-size:var(--el-popover-font-size);box-shadow:var(--el-box-shadow-light);word-break:break-all;box-sizing:border-box}.el-popover.el-popper--plain{padding:var(--el-popover-padding-large)}.el-popover__title{color:var(--el-popover-title-text-color);font-size:var(--el-popover-title-font-size);line-height:1;margin-bottom:12px}.el-popover__reference:focus:hover,.el-popover__reference:focus:not(.focusing){outline-width:0}.el-popover.el-popper.is-dark{--el-popover-bg-color:var(--el-text-color-primary);--el-popover-border-color:var(--el-text-color-primary);--el-popover-title-text-color:var(--el-bg-color);color:var(--el-bg-color)}.el-popover.el-popper:focus,.el-popover.el-popper:focus:active{outline-width:0}.el-progress{position:relative;line-height:1;display:flex;align-items:center}.el-progress__text{font-size:14px;color:var(--el-text-color-regular);margin-left:5px;min-width:50px;line-height:1}.el-progress__text i{vertical-align:middle;display:block}.el-progress--circle,.el-progress--dashboard{display:inline-block}.el-progress--circle .el-progress__text,.el-progress--dashboard .el-progress__text{position:absolute;top:50%;left:0;width:100%;text-align:center;margin:0;transform:translateY(-50%)}.el-progress--circle .el-progress__text i,.el-progress--dashboard .el-progress__text i{vertical-align:middle;display:inline-block}.el-progress--without-text .el-progress__text{display:none}.el-progress--without-text .el-progress-bar{padding-right:0;margin-right:0;display:block}.el-progress--text-inside .el-progress-bar{padding-right:0;margin-right:0}.el-progress.is-success .el-progress-bar__inner{background-color:var(--el-color-success)}.el-progress.is-success .el-progress__text{color:var(--el-color-success)}.el-progress.is-warning .el-progress-bar__inner{background-color:var(--el-color-warning)}.el-progress.is-warning .el-progress__text{color:var(--el-color-warning)}.el-progress.is-exception .el-progress-bar__inner{background-color:var(--el-color-danger)}.el-progress.is-exception .el-progress__text{color:var(--el-color-danger)}.el-progress-bar{flex-grow:1;box-sizing:border-box}.el-progress-bar__outer{height:6px;border-radius:100px;background-color:var(--el-border-color-lighter);overflow:hidden;position:relative;vertical-align:middle}.el-progress-bar__inner{position:absolute;left:0;top:0;height:100%;background-color:var(--el-color-primary);text-align:right;border-radius:100px;line-height:1;white-space:nowrap;transition:width .6s ease}.el-progress-bar__inner:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-progress-bar__inner--indeterminate{transform:translateZ(0);-webkit-animation:indeterminate 3s infinite;animation:indeterminate 3s infinite}.el-progress-bar__inner--striped{background-image:linear-gradient(45deg,rgba(0,0,0,.1) 25%,transparent 25%,transparent 50%,rgba(0,0,0,.1) 50%,rgba(0,0,0,.1) 75%,transparent 75%,transparent);background-size:1.25em 1.25em}.el-progress-bar__inner--striped.el-progress-bar__inner--striped-flow{-webkit-animation:striped-flow 3s linear infinite;animation:striped-flow 3s linear infinite}.el-progress-bar__innerText{display:inline-block;vertical-align:middle;color:#fff;font-size:12px;margin:0 5px}@-webkit-keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}@keyframes progress{0%{background-position:0 0}to{background-position:32px 0}}@-webkit-keyframes indeterminate{0%{left:-100%}to{left:100%}}@keyframes indeterminate{0%{left:-100%}to{left:100%}}@-webkit-keyframes striped-flow{0%{background-position:-100%}to{background-position:100%}}@keyframes striped-flow{0%{background-position:-100%}to{background-position:100%}}.el-radio-button{--el-radio-button-checked-bg-color:var(--el-color-primary);--el-radio-button-checked-text-color:var(--el-color-white);--el-radio-button-checked-border-color:var(--el-color-primary);--el-radio-button-disabled-checked-fill:var(--el-border-color-extra-light)}.el-radio-button{position:relative;display:inline-block;outline:0}.el-radio-button__inner{display:inline-block;line-height:1;white-space:nowrap;vertical-align:middle;background:var(--el-button-bg-color,var(--el-fill-color-blank));border:var(--el-border);font-weight:var(--el-button-font-weight,var(--el-font-weight-primary));border-left:0;color:var(--el-button-text-color,var(--el-text-color-regular));-webkit-appearance:none;text-align:center;box-sizing:border-box;outline:0;margin:0;position:relative;cursor:pointer;transition:var(--el-transition-all);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;padding:8px 15px;font-size:var(--el-font-size-base);border-radius:0}.el-radio-button__inner.is-round{padding:8px 15px}.el-radio-button__inner:hover{color:var(--el-color-primary)}.el-radio-button__inner [class*=el-icon-]{line-height:.9}.el-radio-button__inner [class*=el-icon-]+span{margin-left:5px}.el-radio-button:first-child .el-radio-button__inner{border-left:var(--el-border);border-radius:var(--el-border-radius-base) 0 0 var(--el-border-radius-base);box-shadow:none!important}.el-radio-button__original-radio{opacity:0;outline:0;position:absolute;z-index:-1}.el-radio-button__original-radio:checked+.el-radio-button__inner{color:var(--el-radio-button-checked-text-color,var(--el-color-white));background-color:var(--el-radio-button-checked-bg-color,var(--el-color-primary));border-color:var(--el-radio-button-checked-border-color,var(--el-color-primary));box-shadow:-1px 0 0 0 var(--el-radio-button-checked-border-color,var(--el-color-primary))}.el-radio-button__original-radio:focus-visible+.el-radio-button__inner{border-left:var(--el-border);border-left-color:var(--el-radio-button-checked-border-color,var(--el-color-primary));outline:2px solid var(--el-radio-button-checked-border-color);outline-offset:1px;z-index:2;border-radius:var(--el-border-radius-base);box-shadow:none}.el-radio-button__original-radio:disabled+.el-radio-button__inner{color:var(--el-disabled-text-color);cursor:not-allowed;background-image:none;background-color:var(--el-button-disabled-bg-color,var(--el-fill-color-blank));border-color:var(--el-button-disabled-border-color,var(--el-border-color-light));box-shadow:none}.el-radio-button__original-radio:disabled:checked+.el-radio-button__inner{background-color:var(--el-radio-button-disabled-checked-fill)}.el-radio-button:last-child .el-radio-button__inner{border-radius:0 var(--el-border-radius-base) var(--el-border-radius-base) 0}.el-radio-button:first-child:last-child .el-radio-button__inner{border-radius:var(--el-border-radius-base)}.el-radio-button--large .el-radio-button__inner{padding:12px 19px;font-size:var(--el-font-size-base);border-radius:0}.el-radio-button--large .el-radio-button__inner.is-round{padding:12px 19px}.el-radio-button--small .el-radio-button__inner{padding:5px 11px;font-size:12px;border-radius:0}.el-radio-button--small .el-radio-button__inner.is-round{padding:5px 11px}.el-radio-group{display:inline-flex;align-items:center;flex-wrap:wrap;font-size:0}.el-radio{--el-radio-font-size:var(--el-font-size-base);--el-radio-text-color:var(--el-text-color-regular);--el-radio-font-weight:var(--el-font-weight-primary);--el-radio-input-height:14px;--el-radio-input-width:14px;--el-radio-input-border-radius:var(--el-border-radius-circle);--el-radio-input-bg-color:var(--el-fill-color-blank);--el-radio-input-border:var(--el-border);--el-radio-input-border-color:var(--el-border-color);--el-radio-input-border-color-hover:var(--el-color-primary)}.el-radio{color:var(--el-radio-text-color);font-weight:var(--el-radio-font-weight);position:relative;cursor:pointer;display:inline-flex;align-items:center;white-space:nowrap;outline:0;font-size:var(--el-font-size-base);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;margin-right:32px;height:32px}.el-radio.el-radio--large{height:40px}.el-radio.el-radio--small{height:24px}.el-radio.is-bordered{padding:0 15px 0 9px;border-radius:var(--el-border-radius-base);border:var(--el-border);box-sizing:border-box}.el-radio.is-bordered.is-checked{border-color:var(--el-color-primary)}.el-radio.is-bordered.is-disabled{cursor:not-allowed;border-color:var(--el-border-color-lighter)}.el-radio.is-bordered.el-radio--large{padding:0 19px 0 11px;border-radius:var(--el-border-radius-base)}.el-radio.is-bordered.el-radio--large .el-radio__label{font-size:var(--el-font-size-base)}.el-radio.is-bordered.el-radio--large .el-radio__inner{height:14px;width:14px}.el-radio.is-bordered.el-radio--small{padding:0 11px 0 7px;border-radius:var(--el-border-radius-base)}.el-radio.is-bordered.el-radio--small .el-radio__label{font-size:12px}.el-radio.is-bordered.el-radio--small .el-radio__inner{height:12px;width:12px}.el-radio:last-child{margin-right:0}.el-radio__input{white-space:nowrap;cursor:pointer;outline:0;display:inline-flex;position:relative;vertical-align:middle}.el-radio__input.is-disabled .el-radio__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color);cursor:not-allowed}.el-radio__input.is-disabled .el-radio__inner:after{cursor:not-allowed;background-color:var(--el-disabled-bg-color)}.el-radio__input.is-disabled .el-radio__inner+.el-radio__label{cursor:not-allowed}.el-radio__input.is-disabled.is-checked .el-radio__inner{background-color:var(--el-disabled-bg-color);border-color:var(--el-disabled-border-color)}.el-radio__input.is-disabled.is-checked .el-radio__inner:after{background-color:var(--el-text-color-placeholder)}.el-radio__input.is-disabled+span.el-radio__label{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-radio__input.is-checked .el-radio__inner{border-color:var(--el-color-primary);background:var(--el-color-primary)}.el-radio__input.is-checked .el-radio__inner:after{transform:translate(-50%,-50%) scale(1)}.el-radio__input.is-checked+.el-radio__label{color:var(--el-color-primary)}.el-radio__input.is-focus .el-radio__inner{border-color:var(--el-radio-input-border-color-hover)}.el-radio__inner{border:var(--el-radio-input-border);border-radius:var(--el-radio-input-border-radius);width:var(--el-radio-input-width);height:var(--el-radio-input-height);background-color:var(--el-radio-input-bg-color);position:relative;cursor:pointer;display:inline-block;box-sizing:border-box}.el-radio__inner:hover{border-color:var(--el-radio-input-border-color-hover)}.el-radio__inner:after{width:4px;height:4px;border-radius:var(--el-radio-input-border-radius);background-color:var(--el-color-white);content:"";position:absolute;left:50%;top:50%;transform:translate(-50%,-50%) scale(0);transition:transform .15s ease-in}.el-radio__original{opacity:0;outline:0;position:absolute;z-index:-1;top:0;left:0;right:0;bottom:0;margin:0}.el-radio__original:focus-visible+.el-radio__inner{outline:2px solid var(--el-radio-input-border-color-hover);outline-offset:1px;border-radius:var(--el-radio-input-border-radius)}.el-radio:focus:not(:focus-visible):not(.is-focus):not(:active):not(.is-disabled) .el-radio__inner{box-shadow:0 0 2px 2px var(--el-radio-input-border-color-hover)}.el-radio__label{font-size:var(--el-radio-font-size);padding-left:8px}.el-radio.el-radio--large .el-radio__label{font-size:14px}.el-radio.el-radio--large .el-radio__inner{width:14px;height:14px}.el-radio.el-radio--small .el-radio__label{font-size:12px}.el-radio.el-radio--small .el-radio__inner{width:12px;height:12px}.el-rate{--el-rate-height:20px;--el-rate-font-size:var(--el-font-size-base);--el-rate-icon-size:18px;--el-rate-icon-margin:6px;--el-rate-void-color:var(--el-border-color-darker);--el-rate-fill-color:#f7ba2a;--el-rate-disabled-void-color:var(--el-fill-color);--el-rate-text-color:var(--el-text-color-primary)}.el-rate{display:inline-flex;align-items:center;height:32px}.el-rate:active,.el-rate:focus{outline:0}.el-rate__item{cursor:pointer;display:inline-block;position:relative;font-size:0;vertical-align:middle;color:var(--el-rate-void-color);line-height:normal}.el-rate .el-rate__icon{position:relative;display:inline-block;font-size:var(--el-rate-icon-size);margin-right:var(--el-rate-icon-margin);transition:var(--el-transition-duration)}.el-rate .el-rate__icon.hover{transform:scale(1.15)}.el-rate .el-rate__icon .path2{position:absolute;left:0;top:0}.el-rate .el-rate__icon.is-active{color:var(--el-rate-fill-color)}.el-rate__decimal{position:absolute;top:0;left:0;display:inline-block;overflow:hidden;color:var(--el-rate-fill-color)}.el-rate__text{font-size:var(--el-rate-font-size);vertical-align:middle;color:var(--el-rate-text-color)}.el-rate--large{height:40px}.el-rate--small{height:24px}.el-rate--small .el-rate__icon{font-size:14px}.el-rate.is-disabled .el-rate__item{cursor:auto;color:var(--el-rate-disabled-void-color)}.el-result{--el-result-padding:40px 30px;--el-result-icon-font-size:64px;--el-result-title-font-size:20px;--el-result-title-margin-top:20px;--el-result-subtitle-margin-top:10px;--el-result-extra-margin-top:30px}.el-result{display:flex;justify-content:center;align-items:center;flex-direction:column;text-align:center;box-sizing:border-box;padding:var(--el-result-padding)}.el-result__icon svg{width:var(--el-result-icon-font-size);height:var(--el-result-icon-font-size)}.el-result__title{margin-top:var(--el-result-title-margin-top)}.el-result__title p{margin:0;font-size:var(--el-result-title-font-size);color:var(--el-text-color-primary);line-height:1.3}.el-result__subtitle{margin-top:var(--el-result-subtitle-margin-top)}.el-result__subtitle p{margin:0;font-size:var(--el-font-size-base);color:var(--el-text-color-regular);line-height:1.3}.el-result__extra{margin-top:var(--el-result-extra-margin-top)}.el-result .icon-primary{--el-result-color:var(--el-color-primary);color:var(--el-result-color)}.el-result .icon-success{--el-result-color:var(--el-color-success);color:var(--el-result-color)}.el-result .icon-warning{--el-result-color:var(--el-color-warning);color:var(--el-result-color)}.el-result .icon-danger{--el-result-color:var(--el-color-danger);color:var(--el-result-color)}.el-result .icon-error{--el-result-color:var(--el-color-error);color:var(--el-result-color)}.el-result .icon-info{--el-result-color:var(--el-color-info);color:var(--el-result-color)}.el-row{display:flex;flex-wrap:wrap;position:relative;box-sizing:border-box}.el-row.is-justify-center{justify-content:center}.el-row.is-justify-end{justify-content:flex-end}.el-row.is-justify-space-between{justify-content:space-between}.el-row.is-justify-space-around{justify-content:space-around}.el-row.is-justify-space-evenly{justify-content:space-evenly}.el-row.is-align-middle{align-items:center}.el-row.is-align-bottom{align-items:flex-end}.el-scrollbar{--el-scrollbar-opacity:.3;--el-scrollbar-bg-color:var(--el-text-color-secondary);--el-scrollbar-hover-opacity:.5;--el-scrollbar-hover-bg-color:var(--el-text-color-secondary)}.el-scrollbar{overflow:hidden;position:relative;height:100%}.el-scrollbar__wrap{overflow:auto;height:100%}.el-scrollbar__wrap--hidden-default{scrollbar-width:none}.el-scrollbar__wrap--hidden-default::-webkit-scrollbar{display:none}.el-scrollbar__thumb{position:relative;display:block;width:0;height:0;cursor:pointer;border-radius:inherit;background-color:var(--el-scrollbar-bg-color,var(--el-text-color-secondary));transition:var(--el-transition-duration) background-color;opacity:var(--el-scrollbar-opacity,.3)}.el-scrollbar__thumb:hover{background-color:var(--el-scrollbar-hover-bg-color,var(--el-text-color-secondary));opacity:var(--el-scrollbar-hover-opacity,.5)}.el-scrollbar__bar{position:absolute;right:2px;bottom:2px;z-index:1;border-radius:4px}.el-scrollbar__bar.is-vertical{width:6px;top:2px}.el-scrollbar__bar.is-vertical>div{width:100%}.el-scrollbar__bar.is-horizontal{height:6px;left:2px}.el-scrollbar__bar.is-horizontal>div{height:100%}.el-scrollbar-fade-enter-active{transition:opacity .34s ease-out}.el-scrollbar-fade-leave-active{transition:opacity .12s ease-out}.el-scrollbar-fade-enter-from,.el-scrollbar-fade-leave-active{opacity:0}.el-select-dropdown{z-index:calc(var(--el-index-top) + 1);border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown__option-item.is-selected:not(.is-multiple).is-disabled{color:var(--el-text-color-disabled)}.el-select-dropdown__option-item.is-selected:not(.is-multiple).is-disabled:after{background-color:var(--el-text-color-disabled)}.el-select-dropdown__option-item:hover:not(.hover){background-color:transparent}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-disabled.is-selected{color:var(--el-text-color-disabled)}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:var(--el-select-font-size)}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;margin:6px 0!important;padding:0!important;box-sizing:border-box}.el-select-dropdown__option-item{font-size:var(--el-select-font-size);padding:0 32px 0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--el-text-color-regular);height:34px;line-height:34px;box-sizing:border-box;cursor:pointer}.el-select-dropdown__option-item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-select-dropdown__option-item.is-disabled:hover{background-color:var(--el-bg-color)}.el-select-dropdown__option-item.is-selected{background-color:var(--el-fill-color-light);font-weight:700}.el-select-dropdown__option-item.is-selected:not(.is-multiple){color:var(--el-color-primary)}.el-select-dropdown__option-item.hover{background-color:var(--el-fill-color-light)!important}.el-select-dropdown__option-item:hover{background-color:var(--el-fill-color-light)}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay)}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected .el-icon{position:absolute;right:20px;top:0;height:inherit;font-size:12px}.el-select-dropdown.is-multiple .el-select-dropdown__option-item.is-selected .el-icon svg{height:inherit;vertical-align:middle}.el-select-group{margin:0;padding:0}.el-select-group__wrap{position:relative;list-style:none;margin:0;padding:0}.el-select-group__wrap:not(:last-of-type){padding-bottom:24px}.el-select-group__wrap:not(:last-of-type):after{content:"";position:absolute;display:block;left:20px;right:20px;bottom:12px;height:1px;background:var(--el-border-color-light)}.el-select-group__split-dash{position:absolute;left:20px;right:20px;height:1px;background:var(--el-border-color-light)}.el-select-group__title{padding-left:20px;font-size:12px;color:var(--el-color-info);line-height:30px}.el-select-group .el-select-dropdown__item{padding-left:20px}.el-select-v2{--el-select-border-color-hover:var(--el-border-color-hover);--el-select-disabled-border:var(--el-disabled-border-color);--el-select-font-size:var(--el-font-size-base);--el-select-close-hover-color:var(--el-text-color-secondary);--el-select-input-color:var(--el-text-color-placeholder);--el-select-multiple-input-color:var(--el-text-color-regular);--el-select-input-focus-border-color:var(--el-color-primary);--el-select-input-font-size:14px}.el-select-v2{display:inline-block;position:relative;vertical-align:middle;font-size:14px}.el-select-v2__wrapper{display:flex;align-items:center;flex-wrap:wrap;position:relative;box-sizing:border-box;cursor:pointer;padding:1px 30px 1px 0;border:1px solid var(--el-border-color);border-radius:var(--el-border-radius-base);background-color:var(--el-fill-color-blank);transition:var(--el-transition-duration)}.el-select-v2__wrapper:hover{border-color:var(--el-text-color-placeholder)}.el-select-v2__wrapper.is-filterable{cursor:text}.el-select-v2__wrapper.is-focused{border-color:var(--el-color-primary)}.el-select-v2__wrapper.is-hovering:not(.is-focused){border-color:var(--el-border-color-hover)}.el-select-v2__wrapper.is-disabled{cursor:not-allowed;background-color:var(--el-fill-color-light);color:var(--el-text-color-placeholder);border-color:var(--el-select-disabled-border)}.el-select-v2__wrapper.is-disabled:hover{border-color:var(--el-select-disabled-border)}.el-select-v2__wrapper.is-disabled.is-focus{border-color:var(--el-input-focus-border-color)}.el-select-v2__wrapper.is-disabled .is-transparent{opacity:1;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-select-v2__wrapper.is-disabled .el-select-v2__caret,.el-select-v2__wrapper.is-disabled .el-select-v2__combobox-input{cursor:not-allowed}.el-select-v2__wrapper .el-select-v2__input-wrapper{box-sizing:border-box;position:relative;-webkit-margin-start:12px;margin-inline-start:12px;max-width:100%;overflow:hidden}.el-select-v2__wrapper,.el-select-v2__wrapper .el-select-v2__input-wrapper{line-height:32px}.el-select-v2__wrapper .el-select-v2__input-wrapper input{--el-input-inner-height:calc(var(--el-component-size, 32px) - 8px);height:var(--el-input-inner-height);line-height:var(--el-input-inner-height);min-width:4px;width:100%;background-color:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none;background:0 0;border:none;margin:2px 0;outline:0;padding:0}.el-select-v2 .el-select-v2__tags-text{display:inline-block;line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-select-v2__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:14px}.el-select-v2__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-select-v2__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-select-v2__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-select-v2__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-select-v2--large .el-select-v2__wrapper .el-select-v2__combobox-input{height:32px}.el-select-v2--large .el-select-v2__caret,.el-select-v2--large .el-select-v2__suffix{height:40px}.el-select-v2--large .el-select-v2__placeholder{font-size:14px;line-height:40px}.el-select-v2--small .el-select-v2__wrapper .el-select-v2__combobox-input{height:16px}.el-select-v2--small .el-select-v2__caret,.el-select-v2--small .el-select-v2__suffix{height:24px}.el-select-v2--small .el-select-v2__placeholder{font-size:12px;line-height:24px}.el-select-v2 .el-select-v2__selection>span{display:inline-block}.el-select-v2:hover .el-select-v2__combobox-input{border-color:var(--el-select-border-color-hover)}.el-select-v2 .el-select__selection-text{text-overflow:ellipsis;display:inline-block;overflow-x:hidden;vertical-align:bottom}.el-select-v2 .el-select-v2__combobox-input{padding-right:35px;display:block;color:var(--el-text-color-regular)}.el-select-v2 .el-select-v2__combobox-input:focus{border-color:var(--el-select-input-focus-border-color)}.el-select-v2__input{border:none;outline:0;padding:0;margin-left:15px;color:var(--el-select-multiple-input-color);font-size:var(--el-select-font-size);-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px}.el-select-v2__input.is-small{height:14px}.el-select-v2__close{cursor:pointer;position:absolute;top:8px;z-index:var(--el-index-top);right:25px;color:var(--el-select-input-color);line-height:18px;font-size:var(--el-select-input-font-size)}.el-select-v2__close:hover{color:var(--el-select-close-hover-color)}.el-select-v2__suffix{display:inline-flex;position:absolute;right:12px;height:32px;top:50%;transform:translateY(-50%);color:var(--el-input-icon-color,var(--el-text-color-placeholder))}.el-select-v2__suffix .el-input__icon{height:inherit}.el-select-v2__suffix .el-input__icon:not(:first-child){margin-left:8px}.el-select-v2__caret{color:var(--el-select-input-color);font-size:var(--el-select-input-font-size);transition:var(--el-transition-duration);transform:rotate(180deg);cursor:pointer}.el-select-v2__caret.is-reverse{transform:rotate(0)}.el-select-v2__caret.is-show-close{font-size:var(--el-select-font-size);text-align:center;transform:rotate(180deg);border-radius:var(--el-border-radius-circle);color:var(--el-select-input-color);transition:var(--el-transition-color)}.el-select-v2__caret.is-show-close:hover{color:var(--el-select-close-hover-color)}.el-select-v2__caret.el-icon{height:inherit}.el-select-v2__caret.el-icon svg{vertical-align:middle}.el-select-v2__selection{white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;width:100%}.el-select-v2__input-calculator{left:0;position:absolute;top:0;visibility:hidden;white-space:pre;z-index:999}.el-select-v2__selected-item{line-height:inherit;height:inherit;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;display:flex;flex-wrap:wrap}.el-select-v2__placeholder{position:absolute;top:50%;transform:translateY(-50%);-webkit-margin-start:12px;margin-inline-start:12px;width:calc(100% - 52px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--el-input-text-color,var(--el-text-color-regular))}.el-select-v2__placeholder.is-transparent{color:var(--el-text-color-placeholder)}.el-select-v2 .el-select-v2__selection .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 0 2px 6px;background-color:var(--el-fill-color)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;color:var(--el-color-white)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select-v2 .el-select-v2__selection .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select-v2.el-select-v2--small .el-select-v2__selection .el-tag{margin:1px 0 1px 6px;height:18px}.el-select-dropdown{z-index:calc(var(--el-index-top) + 1);border-radius:var(--el-border-radius-base);box-sizing:border-box}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay)}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.hover{background-color:var(--el-fill-color-light)}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected:after{content:"";position:absolute;top:50%;right:20px;border-top:none;border-right:none;background-repeat:no-repeat;background-position:center;background-color:var(--el-color-primary);-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask-size:100% 100%;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;-webkit-mask-size:100% 100%;transform:translateY(-50%);width:12px;height:12px}.el-select-dropdown.is-multiple .el-select-dropdown__item.selected.is-disabled:after{background-color:var(--el-text-color-disabled)}.el-select-dropdown .el-select-dropdown__option-item.is-selected:after{content:"";position:absolute;top:50%;right:20px;border-top:none;border-right:none;background-repeat:no-repeat;background-position:center;background-color:var(--el-color-primary);-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;mask-size:100% 100%;-webkit-mask:url("data:image/svg+xml;utf8,%3Csvg class='icon' width='200' height='200' viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath fill='currentColor' d='M406.656 706.944L195.84 496.256a32 32 0 10-45.248 45.248l256 256 512-512a32 32 0 00-45.248-45.248L406.592 706.944z'%3E%3C/path%3E%3C/svg%3E") no-repeat;-webkit-mask-size:100% 100%;transform:translateY(-50%);width:12px;height:12px}.el-select-dropdown .el-scrollbar.is-empty .el-select-dropdown__list{padding:0}.el-select-dropdown .el-select-dropdown__item.is-disabled:hover{background-color:unset}.el-select-dropdown .el-select-dropdown__item.is-disabled.selected{color:var(--el-text-color-disabled)}.el-select-dropdown__empty{padding:10px 0;margin:0;text-align:center;color:var(--el-text-color-secondary);font-size:var(--el-select-font-size)}.el-select-dropdown__wrap{max-height:274px}.el-select-dropdown__list{list-style:none;padding:6px 0;margin:0;box-sizing:border-box}.el-select{--el-select-border-color-hover:var(--el-border-color-hover);--el-select-disabled-border:var(--el-disabled-border-color);--el-select-font-size:var(--el-font-size-base);--el-select-close-hover-color:var(--el-text-color-secondary);--el-select-input-color:var(--el-text-color-placeholder);--el-select-multiple-input-color:var(--el-text-color-regular);--el-select-input-focus-border-color:var(--el-color-primary);--el-select-input-font-size:14px}.el-select{display:inline-block;position:relative;vertical-align:middle;line-height:32px}.el-select__popper.el-popper{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light);box-shadow:var(--el-box-shadow-light)}.el-select__popper.el-popper .el-popper__arrow:before{border:1px solid var(--el-border-color-light)}.el-select__popper.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent;border-left-color:transparent}.el-select__popper.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent;border-right-color:transparent}.el-select__popper.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent;border-bottom-color:transparent}.el-select__popper.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent;border-top-color:transparent}.el-select .el-select-tags-wrapper.has-prefix{margin-left:6px}.el-select--large{line-height:40px}.el-select--large .el-select-tags-wrapper.has-prefix{margin-left:8px}.el-select--small{line-height:24px}.el-select--small .el-select-tags-wrapper.has-prefix{margin-left:4px}.el-select .el-select__tags>span{display:inline-block}.el-select:hover:not(.el-select--disabled) .el-input__wrapper{box-shadow:0 0 0 1px var(--el-select-border-color-hover) inset}.el-select .el-select__tags-text{display:inline-block;line-height:normal;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-select .el-input__wrapper{cursor:pointer}.el-select .el-input__wrapper.is-focus{box-shadow:0 0 0 1px var(--el-select-input-focus-border-color) inset!important}.el-select .el-input__inner{cursor:pointer}.el-select .el-input{display:flex}.el-select .el-input .el-select__caret{color:var(--el-select-input-color);font-size:var(--el-select-input-font-size);transition:transform var(--el-transition-duration);transform:rotate(0);cursor:pointer}.el-select .el-input .el-select__caret.is-reverse{transform:rotate(-180deg)}.el-select .el-input .el-select__caret.is-show-close{font-size:var(--el-select-font-size);text-align:center;transform:rotate(0);border-radius:var(--el-border-radius-circle);color:var(--el-select-input-color);transition:var(--el-transition-color)}.el-select .el-input .el-select__caret.is-show-close:hover{color:var(--el-select-close-hover-color)}.el-select .el-input .el-select__caret.el-icon{position:relative;height:inherit;z-index:2}.el-select .el-input.is-disabled .el-input__wrapper{cursor:not-allowed}.el-select .el-input.is-disabled .el-input__wrapper:hover{box-shadow:0 0 0 1px var(--el-select-disabled-border) inset}.el-select .el-input.is-disabled .el-input__inner,.el-select .el-input.is-disabled .el-select__caret{cursor:not-allowed}.el-select .el-input.is-focus .el-input__wrapper{box-shadow:0 0 0 1px var(--el-select-input-focus-border-color) inset!important}.el-select__input{border:none;outline:0;padding:0;margin-left:15px;color:var(--el-select-multiple-input-color);font-size:var(--el-select-font-size);-webkit-appearance:none;-moz-appearance:none;appearance:none;height:28px;background-color:transparent}.el-select__input.is-disabled{cursor:not-allowed}.el-select__input--iOS{position:absolute;left:0;top:0;z-index:6}.el-select__input.is-small{height:14px}.el-select__close{cursor:pointer;position:absolute;top:8px;z-index:var(--el-index-top);right:25px;color:var(--el-select-input-color);line-height:18px;font-size:var(--el-select-input-font-size)}.el-select__close:hover{color:var(--el-select-close-hover-color)}.el-select__tags{position:absolute;line-height:normal;top:50%;transform:translateY(-50%);white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;cursor:pointer}.el-select__tags .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 6px 2px 0}.el-select__tags .el-tag:last-child{margin-right:0}.el-select__tags .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;top:0;color:#fff}.el-select__tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select__tags .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select__tags .el-tag--info{background-color:var(--el-fill-color)}.el-select__tags.is-disabled{cursor:not-allowed}.el-select__collapse-tags{white-space:normal;z-index:var(--el-index-normal);display:flex;align-items:center;flex-wrap:wrap;cursor:pointer}.el-select__collapse-tags .el-tag{box-sizing:border-box;border-color:transparent;margin:2px 6px 2px 0}.el-select__collapse-tags .el-tag:last-child{margin-right:0}.el-select__collapse-tags .el-tag .el-icon-close{background-color:var(--el-text-color-placeholder);right:-7px;top:0;color:#fff}.el-select__collapse-tags .el-tag .el-icon-close:hover{background-color:var(--el-text-color-secondary)}.el-select__collapse-tags .el-tag .el-icon-close:before{display:block;transform:translateY(.5px)}.el-select__collapse-tags .el-tag--info{background-color:var(--el-fill-color)}.el-select__collapse-tag{line-height:inherit;height:inherit;display:flex}.el-skeleton{--el-skeleton-circle-size:var(--el-avatar-size)}.el-skeleton__item{background:var(--el-skeleton-color);display:inline-block;height:16px;border-radius:var(--el-border-radius-base);width:100%}.el-skeleton__circle{border-radius:50%;width:var(--el-skeleton-circle-size);height:var(--el-skeleton-circle-size);line-height:var(--el-skeleton-circle-size)}.el-skeleton__button{height:40px;width:64px;border-radius:4px}.el-skeleton__p{width:100%}.el-skeleton__p.is-last{width:61%}.el-skeleton__p.is-first{width:33%}.el-skeleton__text{width:100%;height:var(--el-font-size-small)}.el-skeleton__caption{height:var(--el-font-size-extra-small)}.el-skeleton__h1{height:var(--el-font-size-extra-large)}.el-skeleton__h3{height:var(--el-font-size-large)}.el-skeleton__h5{height:var(--el-font-size-medium)}.el-skeleton__image{width:unset;display:flex;align-items:center;justify-content:center;border-radius:0}.el-skeleton__image svg{color:var(--el-svg-monochrome-grey);fill:currentColor;width:22%;height:22%}.el-skeleton{--el-skeleton-color:var(--el-fill-color);--el-skeleton-to-color:var(--el-fill-color-darker)}@-webkit-keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}@keyframes el-skeleton-loading{0%{background-position:100% 50%}to{background-position:0 50%}}.el-skeleton{width:100%}.el-skeleton__first-line,.el-skeleton__paragraph{height:16px;margin-top:16px;background:var(--el-skeleton-color)}.el-skeleton.is-animated .el-skeleton__item{background:linear-gradient(90deg,var(--el-skeleton-color) 25%,var(--el-skeleton-to-color) 37%,var(--el-skeleton-color) 63%);background-size:400% 100%;-webkit-animation:el-skeleton-loading 1.4s ease infinite;animation:el-skeleton-loading 1.4s ease infinite}.el-slider{--el-slider-main-bg-color:var(--el-color-primary);--el-slider-runway-bg-color:var(--el-border-color-light);--el-slider-stop-bg-color:var(--el-color-white);--el-slider-disabled-color:var(--el-text-color-placeholder);--el-slider-border-radius:3px;--el-slider-height:6px;--el-slider-button-size:20px;--el-slider-button-wrapper-size:36px;--el-slider-button-wrapper-offset:-15px}.el-slider{width:100%;height:32px;display:flex;align-items:center}.el-slider__runway{flex:1;height:var(--el-slider-height);background-color:var(--el-slider-runway-bg-color);border-radius:var(--el-slider-border-radius);position:relative;cursor:pointer}.el-slider__runway.show-input{margin-right:30px;width:auto}.el-slider__runway.is-disabled{cursor:default}.el-slider__runway.is-disabled .el-slider__bar{background-color:var(--el-slider-disabled-color)}.el-slider__runway.is-disabled .el-slider__button{border-color:var(--el-slider-disabled-color)}.el-slider__runway.is-disabled .el-slider__button-wrapper.hover,.el-slider__runway.is-disabled .el-slider__button-wrapper:hover,.el-slider__runway.is-disabled .el-slider__button-wrapper.dragging{cursor:not-allowed}.el-slider__runway.is-disabled .el-slider__button.dragging,.el-slider__runway.is-disabled .el-slider__button.hover,.el-slider__runway.is-disabled .el-slider__button:hover{transform:scale(1)}.el-slider__runway.is-disabled .el-slider__button.hover,.el-slider__runway.is-disabled .el-slider__button:hover,.el-slider__runway.is-disabled .el-slider__button.dragging{cursor:not-allowed}.el-slider__input{flex-shrink:0;width:130px}.el-slider__bar{height:var(--el-slider-height);background-color:var(--el-slider-main-bg-color);border-top-left-radius:var(--el-slider-border-radius);border-bottom-left-radius:var(--el-slider-border-radius);position:absolute}.el-slider__button-wrapper{height:var(--el-slider-button-wrapper-size);width:var(--el-slider-button-wrapper-size);position:absolute;z-index:1;top:var(--el-slider-button-wrapper-offset);transform:translate(-50%);background-color:transparent;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;line-height:normal;outline:0}.el-slider__button-wrapper:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-slider__button-wrapper.hover,.el-slider__button-wrapper:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button-wrapper.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__button{display:inline-block;width:var(--el-slider-button-size);height:var(--el-slider-button-size);vertical-align:middle;border:solid 2px var(--el-slider-main-bg-color);background-color:var(--el-color-white);border-radius:50%;box-sizing:border-box;transition:var(--el-transition-duration-fast);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-slider__button.dragging,.el-slider__button.hover,.el-slider__button:hover{transform:scale(1.2)}.el-slider__button.hover,.el-slider__button:hover{cursor:-webkit-grab;cursor:grab}.el-slider__button.dragging{cursor:-webkit-grabbing;cursor:grabbing}.el-slider__stop{position:absolute;height:var(--el-slider-height);width:var(--el-slider-height);border-radius:var(--el-border-radius-circle);background-color:var(--el-slider-stop-bg-color);transform:translate(-50%)}.el-slider__marks{top:0;left:12px;width:18px;height:100%}.el-slider__marks-text{position:absolute;transform:translate(-50%);font-size:14px;color:var(--el-color-info);margin-top:15px;white-space:pre}.el-slider.is-vertical{position:relative;display:inline-flex;width:auto;height:100%;flex:0}.el-slider.is-vertical .el-slider__runway{width:var(--el-slider-height);height:100%;margin:0 16px}.el-slider.is-vertical .el-slider__bar{width:var(--el-slider-height);height:auto;border-radius:0 0 3px 3px}.el-slider.is-vertical .el-slider__button-wrapper{top:auto;left:var(--el-slider-button-wrapper-offset);transform:translateY(50%)}.el-slider.is-vertical .el-slider__stop{transform:translateY(50%)}.el-slider.is-vertical .el-slider__marks-text{margin-top:0;left:15px;transform:translateY(50%)}.el-slider--large{height:40px}.el-slider--small{height:24px}.el-space{display:inline-flex;vertical-align:top}.el-space__item{display:flex;flex-wrap:wrap}.el-space__item>*{flex:1}.el-space--vertical{flex-direction:column}.el-time-spinner{width:100%;white-space:nowrap}.el-spinner{display:inline-block;vertical-align:middle}.el-spinner-inner{-webkit-animation:rotate 2s linear infinite;animation:rotate 2s linear infinite;width:50px;height:50px}.el-spinner-inner .path{stroke:var(--el-border-color-lighter);stroke-linecap:round;-webkit-animation:dash 1.5s ease-in-out infinite;animation:dash 1.5s ease-in-out infinite}@-webkit-keyframes rotate{to{transform:rotate(360deg)}}@keyframes rotate{to{transform:rotate(360deg)}}@-webkit-keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}to{stroke-dasharray:90,150;stroke-dashoffset:-124}}.el-step{position:relative;flex-shrink:1}.el-step:last-of-type .el-step__line{display:none}.el-step:last-of-type.is-flex{flex-basis:auto!important;flex-shrink:0;flex-grow:0}.el-step:last-of-type .el-step__description,.el-step:last-of-type .el-step__main{padding-right:0}.el-step__head{position:relative;width:100%}.el-step__head.is-process{color:var(--el-text-color-primary);border-color:var(--el-text-color-primary)}.el-step__head.is-wait{color:var(--el-text-color-placeholder);border-color:var(--el-text-color-placeholder)}.el-step__head.is-success{color:var(--el-color-success);border-color:var(--el-color-success)}.el-step__head.is-error{color:var(--el-color-danger);border-color:var(--el-color-danger)}.el-step__head.is-finish{color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-step__icon{position:relative;z-index:1;display:inline-flex;justify-content:center;align-items:center;width:24px;height:24px;font-size:14px;box-sizing:border-box;background:var(--el-bg-color);transition:.15s ease-out}.el-step__icon.is-text{border-radius:50%;border:2px solid;border-color:inherit}.el-step__icon.is-icon{width:40px}.el-step__icon-inner{display:inline-block;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;text-align:center;font-weight:700;line-height:1;color:inherit}.el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:25px;font-weight:400}.el-step__icon-inner.is-status{transform:translateY(1px)}.el-step__line{position:absolute;border-color:inherit;background-color:var(--el-text-color-placeholder)}.el-step__line-inner{display:block;border-width:1px;border-style:solid;border-color:inherit;transition:.15s ease-out;box-sizing:border-box;width:0;height:0}.el-step__main{white-space:normal;text-align:left}.el-step__title{font-size:16px;line-height:38px}.el-step__title.is-process{font-weight:700;color:var(--el-text-color-primary)}.el-step__title.is-wait{color:var(--el-text-color-placeholder)}.el-step__title.is-success{color:var(--el-color-success)}.el-step__title.is-error{color:var(--el-color-danger)}.el-step__title.is-finish{color:var(--el-color-primary)}.el-step__description{padding-right:10%;margin-top:-5px;font-size:12px;line-height:20px;font-weight:400}.el-step__description.is-process{color:var(--el-text-color-primary)}.el-step__description.is-wait{color:var(--el-text-color-placeholder)}.el-step__description.is-success{color:var(--el-color-success)}.el-step__description.is-error{color:var(--el-color-danger)}.el-step__description.is-finish{color:var(--el-color-primary)}.el-step.is-horizontal{display:inline-block}.el-step.is-horizontal .el-step__line{height:2px;top:11px;left:0;right:0}.el-step.is-vertical{display:flex}.el-step.is-vertical .el-step__head{flex-grow:0;width:24px}.el-step.is-vertical .el-step__main{padding-left:10px;flex-grow:1}.el-step.is-vertical .el-step__title{line-height:24px;padding-bottom:8px}.el-step.is-vertical .el-step__line{width:2px;top:0;bottom:0;left:11px}.el-step.is-vertical .el-step__icon.is-icon{width:24px}.el-step.is-center .el-step__head,.el-step.is-center .el-step__main{text-align:center}.el-step.is-center .el-step__description{padding-left:20%;padding-right:20%}.el-step.is-center .el-step__line{left:50%;right:-50%}.el-step.is-simple{display:flex;align-items:center}.el-step.is-simple .el-step__head{width:auto;font-size:0;padding-right:10px}.el-step.is-simple .el-step__icon{background:0 0;width:16px;height:16px;font-size:12px}.el-step.is-simple .el-step__icon-inner[class*=el-icon]:not(.is-status){font-size:18px}.el-step.is-simple .el-step__icon-inner.is-status{transform:scale(.8) translateY(1px)}.el-step.is-simple .el-step__main{position:relative;display:flex;align-items:stretch;flex-grow:1}.el-step.is-simple .el-step__title{font-size:16px;line-height:20px}.el-step.is-simple:not(:last-of-type) .el-step__title{max-width:50%;word-break:break-all}.el-step.is-simple .el-step__arrow{flex-grow:1;display:flex;align-items:center;justify-content:center}.el-step.is-simple .el-step__arrow:after,.el-step.is-simple .el-step__arrow:before{content:"";display:inline-block;position:absolute;height:15px;width:1px;background:var(--el-text-color-placeholder)}.el-step.is-simple .el-step__arrow:before{transform:rotate(-45deg) translateY(-4px);transform-origin:0 0}.el-step.is-simple .el-step__arrow:after{transform:rotate(45deg) translateY(4px);transform-origin:100% 100%}.el-step.is-simple:last-of-type .el-step__arrow{display:none}.el-steps{display:flex}.el-steps--simple{padding:13px 8%;border-radius:4px;background:var(--el-fill-color-light)}.el-steps--horizontal{white-space:nowrap}.el-steps--vertical{height:100%;flex-flow:column}.el-switch{--el-switch-on-color:var(--el-color-primary);--el-switch-off-color:var(--el-border-color)}.el-switch{display:inline-flex;align-items:center;position:relative;font-size:14px;line-height:20px;height:32px;vertical-align:middle}.el-switch.is-disabled .el-switch__core,.el-switch.is-disabled .el-switch__label{cursor:not-allowed}.el-switch__label{transition:var(--el-transition-duration-fast);height:20px;display:inline-block;font-size:14px;font-weight:500;cursor:pointer;vertical-align:middle;color:var(--el-text-color-primary)}.el-switch__label.is-active{color:var(--el-color-primary)}.el-switch__label--left{margin-right:10px}.el-switch__label--right{margin-left:10px}.el-switch__label *{line-height:1;font-size:14px;display:inline-block}.el-switch__label .el-icon{height:inherit}.el-switch__label .el-icon svg{vertical-align:middle}.el-switch__input{position:absolute;width:0;height:0;opacity:0;margin:0}.el-switch__input:focus-visible~.el-switch__core{outline:2px solid var(--el-switch-on-color);outline-offset:1px}.el-switch__core{display:inline-flex;position:relative;align-items:center;min-width:40px;height:20px;border:1px solid var(--el-switch-border-color,var(--el-switch-off-color));outline:0;border-radius:10px;box-sizing:border-box;background:var(--el-switch-off-color);cursor:pointer;transition:border-color var(--el-transition-duration),background-color var(--el-transition-duration)}.el-switch__core .el-switch__inner{width:100%;transition:all var(--el-transition-duration);height:16px;display:flex;justify-content:center;align-items:center;overflow:hidden;padding:0 4px 0 18px}.el-switch__core .el-switch__inner .is-icon,.el-switch__core .el-switch__inner .is-text{font-size:12px;color:var(--el-color-white);-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-switch__core .el-switch__action{position:absolute;left:1px;border-radius:var(--el-border-radius-circle);transition:all var(--el-transition-duration);width:16px;height:16px;background-color:var(--el-color-white);display:flex;justify-content:center;align-items:center;color:var(--el-switch-off-color)}.el-switch.is-checked .el-switch__core{border-color:var(--el-switch-border-color,var(--el-switch-on-color));background-color:var(--el-switch-on-color)}.el-switch.is-checked .el-switch__core .el-switch__action{left:calc(100% - 17px);color:var(--el-switch-on-color)}.el-switch.is-checked .el-switch__core .el-switch__inner{padding:0 18px 0 4px}.el-switch.is-disabled{opacity:.6}.el-switch--wide .el-switch__label.el-switch__label--left span{left:10px}.el-switch--wide .el-switch__label.el-switch__label--right span{right:10px}.el-switch .label-fade-enter-from,.el-switch .label-fade-leave-active{opacity:0}.el-switch--large{font-size:14px;line-height:24px;height:40px}.el-switch--large .el-switch__label{height:24px;font-size:14px}.el-switch--large .el-switch__label *{font-size:14px}.el-switch--large .el-switch__core{min-width:50px;height:24px;border-radius:12px}.el-switch--large .el-switch__core .el-switch__inner{height:20px;padding:0 6px 0 22px}.el-switch--large .el-switch__core .el-switch__action{width:20px;height:20px}.el-switch--large.is-checked .el-switch__core .el-switch__action{left:calc(100% - 21px)}.el-switch--large.is-checked .el-switch__core .el-switch__inner{padding:0 22px 0 6px}.el-switch--small{font-size:12px;line-height:16px;height:24px}.el-switch--small .el-switch__label{height:16px;font-size:12px}.el-switch--small .el-switch__label *{font-size:12px}.el-switch--small .el-switch__core{min-width:30px;height:16px;border-radius:8px}.el-switch--small .el-switch__core .el-switch__inner{height:12px;padding:0 2px 0 14px}.el-switch--small .el-switch__core .el-switch__action{width:12px;height:12px}.el-switch--small.is-checked .el-switch__core .el-switch__action{left:calc(100% - 13px)}.el-switch--small.is-checked .el-switch__core .el-switch__inner{padding:0 14px 0 2px}.el-table-column--selection .cell{padding-left:14px;padding-right:14px}.el-table-filter{border:solid 1px var(--el-border-color-lighter);border-radius:2px;background-color:#fff;box-shadow:var(--el-box-shadow-light);box-sizing:border-box}.el-table-filter__list{padding:5px 0;margin:0;list-style:none;min-width:100px}.el-table-filter__list-item{line-height:36px;padding:0 10px;cursor:pointer;font-size:var(--el-font-size-base)}.el-table-filter__list-item:hover{background-color:var(--el-color-primary-light-9);color:var(--el-color-primary)}.el-table-filter__list-item.is-active{background-color:var(--el-color-primary);color:#fff}.el-table-filter__content{min-width:100px}.el-table-filter__bottom{border-top:1px solid var(--el-border-color-lighter);padding:8px}.el-table-filter__bottom button{background:0 0;border:none;color:var(--el-text-color-regular);cursor:pointer;font-size:var(--el-font-size-small);padding:0 3px}.el-table-filter__bottom button:hover{color:var(--el-color-primary)}.el-table-filter__bottom button:focus{outline:0}.el-table-filter__bottom button.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-table-filter__wrap{max-height:280px}.el-table-filter__checkbox-group{padding:10px}.el-table-filter__checkbox-group label.el-checkbox{display:flex;align-items:center;margin-right:5px;margin-bottom:12px;margin-left:5px;height:unset}.el-table-filter__checkbox-group .el-checkbox:last-child{margin-bottom:0}.el-table{--el-table-border-color:var(--el-border-color-lighter);--el-table-border:1px solid var(--el-table-border-color);--el-table-text-color:var(--el-text-color-regular);--el-table-header-text-color:var(--el-text-color-secondary);--el-table-row-hover-bg-color:var(--el-fill-color-light);--el-table-current-row-bg-color:var(--el-color-primary-light-9);--el-table-header-bg-color:var(--el-bg-color);--el-table-fixed-box-shadow:var(--el-box-shadow-light);--el-table-bg-color:var(--el-fill-color-blank);--el-table-tr-bg-color:var(--el-fill-color-blank);--el-table-expanded-cell-bg-color:var(--el-fill-color-blank);--el-table-fixed-left-column:inset 10px 0 10px -10px rgba(0, 0, 0, .15);--el-table-fixed-right-column:inset -10px 0 10px -10px rgba(0, 0, 0, .15)}.el-table{position:relative;overflow:hidden;box-sizing:border-box;height:-webkit-fit-content;height:-moz-fit-content;height:fit-content;width:100%;max-width:100%;background-color:var(--el-table-bg-color);font-size:14px;color:var(--el-table-text-color)}.el-table__inner-wrapper{position:relative;display:flex;flex-direction:column;height:100%}.el-table__inner-wrapper:before{left:0;bottom:0;width:100%;height:1px}.el-table.has-footer.el-table--fluid-height tr:last-child td.el-table__cell,.el-table.has-footer.el-table--scrollable-y tr:last-child td.el-table__cell{border-bottom-color:transparent}.el-table__empty-block{position:-webkit-sticky;position:sticky;left:0;min-height:60px;text-align:center;width:100%;display:flex;justify-content:center;align-items:center}.el-table__empty-text{line-height:60px;width:50%;color:var(--el-text-color-secondary)}.el-table__expand-column .cell{padding:0;text-align:center;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-table__expand-icon{position:relative;cursor:pointer;color:var(--el-text-color-regular);font-size:12px;transition:transform var(--el-transition-duration-fast) ease-in-out;height:20px}.el-table__expand-icon--expanded{transform:rotate(90deg)}.el-table__expand-icon>.el-icon{font-size:12px}.el-table__expanded-cell{background-color:var(--el-table-expanded-cell-bg-color)}.el-table__expanded-cell[class*=cell]{padding:20px 50px}.el-table__expanded-cell:hover{background-color:transparent!important}.el-table__placeholder{display:inline-block;width:20px}.el-table__append-wrapper{overflow:hidden}.el-table--fit{border-right:0;border-bottom:0}.el-table--fit .el-table__cell.gutter{border-right-width:1px}.el-table thead{color:var(--el-table-header-text-color);font-weight:500}.el-table thead.is-group th.el-table__cell{background:var(--el-fill-color-light)}.el-table .el-table__cell{padding:8px 0;min-width:0;box-sizing:border-box;text-overflow:ellipsis;vertical-align:middle;position:relative;text-align:left;z-index:1}.el-table .el-table__cell.is-center{text-align:center}.el-table .el-table__cell.is-right{text-align:right}.el-table .el-table__cell.gutter{width:15px;border-right-width:0;border-bottom-width:0;padding:0}.el-table .el-table__cell.is-hidden>*{visibility:hidden}.el-table .cell{box-sizing:border-box;overflow:hidden;text-overflow:ellipsis;white-space:normal;word-break:break-all;line-height:23px;padding:0 12px}.el-table .cell.el-tooltip{white-space:nowrap;min-width:50px}.el-table--large{font-size:var(--el-font-size-base)}.el-table--large .el-table__cell{padding:12px 0}.el-table--large .cell{padding:0 16px}.el-table--default{font-size:14px}.el-table--default .el-table__cell{padding:8px 0}.el-table--default .cell{padding:0 12px}.el-table--small{font-size:12px}.el-table--small .el-table__cell{padding:4px 0}.el-table--small .cell{padding:0 8px}.el-table tr{background-color:var(--el-table-tr-bg-color)}.el-table tr input[type=checkbox]{margin:0}.el-table td.el-table__cell,.el-table th.el-table__cell.is-leaf{border-bottom:var(--el-table-border)}.el-table th.el-table__cell.is-sortable{cursor:pointer}.el-table th.el-table__cell{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:var(--el-table-header-bg-color)}.el-table th.el-table__cell>.cell.highlight{color:var(--el-color-primary)}.el-table th.el-table__cell.required>div:before{display:inline-block;content:"";width:8px;height:8px;border-radius:50%;background:#ff4d51;margin-right:5px;vertical-align:middle}.el-table td.el-table__cell div{box-sizing:border-box}.el-table td.el-table__cell.gutter{width:0}.el-table__footer-wrapper{border-top:var(--el-table-border)}.el-table--border .el-table__inner-wrapper:after,.el-table--border:after,.el-table--border:before,.el-table__inner-wrapper:before{content:"";position:absolute;background-color:var(--el-table-border-color);z-index:3}.el-table--border .el-table__inner-wrapper:after{left:0;top:0;width:100%;height:1px}.el-table--border:before{top:-1px;left:0;width:1px;height:100%}.el-table--border:after{top:-1px;right:0;width:1px;height:100%}.el-table--border .el-table__inner-wrapper{border-right:none;border-bottom:none}.el-table--border .el-table__footer-wrapper{position:relative;flex-shrink:0}.el-table--border .el-table__cell{border-right:var(--el-table-border)}.el-table--border th.el-table__cell.gutter:last-of-type{border-bottom:var(--el-table-border);border-bottom-width:1px}.el-table--border th.el-table__cell{border-bottom:var(--el-table-border)}.el-table--hidden{visibility:hidden}.el-table__body-wrapper,.el-table__footer-wrapper,.el-table__header-wrapper{width:100%}.el-table__body-wrapper tr td.el-table-fixed-column--left,.el-table__body-wrapper tr td.el-table-fixed-column--right,.el-table__body-wrapper tr th.el-table-fixed-column--left,.el-table__body-wrapper tr th.el-table-fixed-column--right,.el-table__footer-wrapper tr td.el-table-fixed-column--left,.el-table__footer-wrapper tr td.el-table-fixed-column--right,.el-table__footer-wrapper tr th.el-table-fixed-column--left,.el-table__footer-wrapper tr th.el-table-fixed-column--right,.el-table__header-wrapper tr td.el-table-fixed-column--left,.el-table__header-wrapper tr td.el-table-fixed-column--right,.el-table__header-wrapper tr th.el-table-fixed-column--left,.el-table__header-wrapper tr th.el-table-fixed-column--right{position:-webkit-sticky!important;position:sticky!important;z-index:2;background:var(--el-bg-color)}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-last-column:before{content:"";position:absolute;top:0;width:10px;bottom:-1px;overflow-x:hidden;overflow-y:hidden;box-shadow:none;touch-action:none;pointer-events:none}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-first-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-first-column:before{left:-10px}.el-table__body-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__body-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__footer-wrapper tr th.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr td.el-table-fixed-column--right.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--left.is-last-column:before,.el-table__header-wrapper tr th.el-table-fixed-column--right.is-last-column:before{right:-10px;box-shadow:none}.el-table__body-wrapper tr td.el-table__fixed-right-patch,.el-table__body-wrapper tr th.el-table__fixed-right-patch,.el-table__footer-wrapper tr td.el-table__fixed-right-patch,.el-table__footer-wrapper tr th.el-table__fixed-right-patch,.el-table__header-wrapper tr td.el-table__fixed-right-patch,.el-table__header-wrapper tr th.el-table__fixed-right-patch{position:-webkit-sticky!important;position:sticky!important;z-index:2;background:#fff;right:0}.el-table__header-wrapper{flex-shrink:0}.el-table__header-wrapper tr th.el-table-fixed-column--left,.el-table__header-wrapper tr th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table__body,.el-table__footer,.el-table__header{table-layout:fixed;border-collapse:separate}.el-table__footer-wrapper,.el-table__header-wrapper{overflow:hidden}.el-table__footer-wrapper tbody td.el-table__cell,.el-table__header-wrapper tbody td.el-table__cell{background-color:var(--el-table-row-hover-bg-color);color:var(--el-table-text-color)}.el-table__body-wrapper .el-table-column--selection>.cell,.el-table__header-wrapper .el-table-column--selection>.cell{display:inline-flex;align-items:center;height:23px}.el-table__body-wrapper .el-table-column--selection .el-checkbox,.el-table__header-wrapper .el-table-column--selection .el-checkbox{height:unset}.el-table.is-scrolling-left .el-table-fixed-column--right.is-first-column:before{box-shadow:var(--el-table-fixed-right-column)}.el-table.is-scrolling-left.el-table--border .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:var(--el-table-border)}.el-table.is-scrolling-left th.el-table-fixed-column--left{background-color:var(--el-table-header-bg-color)}.el-table.is-scrolling-right .el-table-fixed-column--left.is-last-column:before{box-shadow:var(--el-table-fixed-left-column)}.el-table.is-scrolling-right .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:none}.el-table.is-scrolling-right th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table.is-scrolling-middle .el-table-fixed-column--left.is-last-column.el-table__cell{border-right:none}.el-table.is-scrolling-middle .el-table-fixed-column--right.is-first-column:before{box-shadow:var(--el-table-fixed-right-column)}.el-table.is-scrolling-middle .el-table-fixed-column--left.is-last-column:before{box-shadow:var(--el-table-fixed-left-column)}.el-table.is-scrolling-none .el-table-fixed-column--left.is-first-column:before,.el-table.is-scrolling-none .el-table-fixed-column--left.is-last-column:before,.el-table.is-scrolling-none .el-table-fixed-column--right.is-first-column:before,.el-table.is-scrolling-none .el-table-fixed-column--right.is-last-column:before{box-shadow:none}.el-table.is-scrolling-none th.el-table-fixed-column--left,.el-table.is-scrolling-none th.el-table-fixed-column--right{background-color:var(--el-table-header-bg-color)}.el-table__body-wrapper{overflow:hidden;position:relative;flex:1}.el-table__body-wrapper .el-scrollbar__bar{z-index:2}.el-table .caret-wrapper{display:inline-flex;flex-direction:column;align-items:center;height:14px;width:24px;vertical-align:middle;cursor:pointer;overflow:initial;position:relative}.el-table .sort-caret{width:0;height:0;border:solid 5px transparent;position:absolute;left:7px}.el-table .sort-caret.ascending{border-bottom-color:var(--el-text-color-placeholder);top:-5px}.el-table .sort-caret.descending{border-top-color:var(--el-text-color-placeholder);bottom:-3px}.el-table .ascending .sort-caret.ascending{border-bottom-color:var(--el-color-primary)}.el-table .descending .sort-caret.descending{border-top-color:var(--el-color-primary)}.el-table .hidden-columns{visibility:hidden;position:absolute;z-index:-1}.el-table--striped .el-table__body tr.el-table__row--striped td.el-table__cell{background:var(--el-fill-color-lighter)}.el-table--striped .el-table__body tr.el-table__row--striped.current-row td.el-table__cell{background-color:var(--el-table-current-row-bg-color)}.el-table__body tr.hover-row.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped.current-row>td.el-table__cell,.el-table__body tr.hover-row.el-table__row--striped>td.el-table__cell,.el-table__body tr.hover-row>td.el-table__cell{background-color:var(--el-table-row-hover-bg-color)}.el-table__body tr.current-row>td.el-table__cell{background-color:var(--el-table-current-row-bg-color)}.el-table__column-resize-proxy{position:absolute;left:200px;top:0;bottom:0;width:0;border-left:var(--el-table-border);z-index:10}.el-table__column-filter-trigger{display:inline-block;cursor:pointer}.el-table__column-filter-trigger i{color:var(--el-color-info);font-size:14px;vertical-align:middle}.el-table__border-left-patch{top:0;left:0;width:1px;height:100%;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table__border-bottom-patch{left:0;height:1px;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table__border-right-patch{top:0;height:100%;width:1px;z-index:3;position:absolute;background-color:var(--el-table-border-color)}.el-table--enable-row-transition .el-table__body td.el-table__cell{transition:background-color .25s ease}.el-table--enable-row-hover .el-table__body tr:hover>td.el-table__cell{background-color:var(--el-table-row-hover-bg-color)}.el-table [class*=el-table__row--level] .el-table__expand-icon{display:inline-block;width:12px;line-height:12px;height:12px;text-align:center;margin-right:8px}.el-table .el-table.el-table--border .el-table__cell{border-right:var(--el-table-border)}.el-table:not(.el-table--border) .el-table__cell{border-right:none}.el-table:not(.el-table--border)>.el-table__inner-wrapper:after{content:none}.el-table-v2{--el-table-border-color:var(--el-border-color-lighter);--el-table-border:1px solid var(--el-table-border-color);--el-table-text-color:var(--el-text-color-regular);--el-table-header-text-color:var(--el-text-color-secondary);--el-table-row-hover-bg-color:var(--el-fill-color-light);--el-table-current-row-bg-color:var(--el-color-primary-light-9);--el-table-header-bg-color:var(--el-bg-color);--el-table-fixed-box-shadow:var(--el-box-shadow-light);--el-table-bg-color:var(--el-fill-color-blank);--el-table-tr-bg-color:var(--el-fill-color-blank);--el-table-expanded-cell-bg-color:var(--el-fill-color-blank);--el-table-fixed-left-column:inset 10px 0 10px -10px rgba(0, 0, 0, .15);--el-table-fixed-right-column:inset -10px 0 10px -10px rgba(0, 0, 0, .15)}.el-table-v2{font-size:14px}.el-table-v2 *{box-sizing:border-box}.el-table-v2__root{position:relative}.el-table-v2__root:hover .el-table-v2__main .el-virtual-scrollbar{opacity:1}.el-table-v2__main{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);left:0}.el-table-v2__main .el-vl__horizontal,.el-table-v2__main .el-vl__vertical{z-index:2}.el-table-v2__left{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);left:0;box-shadow:2px 0 4px #0000000f}.el-table-v2__left .el-virtual-scrollbar{opacity:0}.el-table-v2__left .el-vl__horizontal,.el-table-v2__left .el-vl__vertical{z-index:-1}.el-table-v2__right{display:flex;flex-direction:column-reverse;position:absolute;overflow:hidden;top:0;background-color:var(--el-bg-color);right:0;box-shadow:-2px 0 4px #0000000f}.el-table-v2__right .el-virtual-scrollbar{opacity:0}.el-table-v2__right .el-vl__horizontal,.el-table-v2__right .el-vl__vertical{z-index:-1}.el-table-v2__header-row,.el-table-v2__row{-webkit-padding-end:var(--el-table-scrollbar-size);padding-inline-end:var(--el-table-scrollbar-size)}.el-table-v2__header-wrapper{overflow:hidden}.el-table-v2__header{position:relative;overflow:hidden}.el-table-v2__footer{position:absolute;left:0;right:0;bottom:0;overflow:hidden}.el-table-v2__empty{position:absolute;left:0}.el-table-v2__overlay{position:absolute;left:0;right:0;top:0;bottom:0;z-index:9999}.el-table-v2__header-row{display:flex;border-bottom:var(--el-table-border)}.el-table-v2__header-cell{display:flex;align-items:center;padding:0 8px;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;overflow:hidden;background-color:var(--el-table-header-bg-color);color:var(--el-table-header-text-color);font-weight:700}.el-table-v2__header-cell.is-align-center{justify-content:center;text-align:center}.el-table-v2__header-cell.is-align-right{justify-content:flex-end;text-align:right}.el-table-v2__header-cell.is-sortable{cursor:pointer}.el-table-v2__header-cell:hover .el-icon{display:block}.el-table-v2__sort-icon{transition:opacity,display var(--el-transition-duration);opacity:.6;display:none}.el-table-v2__sort-icon.is-sorting{display:block;opacity:1}.el-table-v2__row{border-bottom:var(--el-table-border);display:flex;align-items:center;transition:background-color var(--el-transition-duration)}.el-table-v2__row.is-hovered,.el-table-v2__row:hover{background-color:var(--el-table-row-hover-bg-color)}.el-table-v2__row-cell{height:100%;overflow:hidden;display:flex;align-items:center;padding:0 8px}.el-table-v2__row-cell.is-align-center{justify-content:center;text-align:center}.el-table-v2__row-cell.is-align-right{justify-content:flex-end;text-align:right}.el-table-v2__expand-icon{margin:0 4px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.el-table-v2__expand-icon svg{transition:transform var(--el-transition-duration)}.el-table-v2__expand-icon.is-expanded svg{transform:rotate(90deg)}.el-table-v2:not(.is-dynamic) .el-table-v2__cell-text{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-table-v2.is-dynamic .el-table-v2__row{overflow:hidden;align-items:stretch}.el-table-v2.is-dynamic .el-table-v2__row .el-table-v2__row-cell{word-break:break-all}.el-tabs{--el-tabs-header-height:40px}.el-tabs__header{padding:0;position:relative;margin:0 0 15px}.el-tabs__active-bar{position:absolute;bottom:0;left:0;height:2px;background-color:var(--el-color-primary);z-index:1;transition:width var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier),transform var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);list-style:none}.el-tabs__new-tab{display:flex;align-items:center;justify-content:center;float:right;border:1px solid var(--el-border-color);height:20px;width:20px;line-height:20px;margin:10px 0 10px 10px;border-radius:3px;text-align:center;font-size:12px;color:var(--el-text-color-primary);cursor:pointer;transition:all .15s}.el-tabs__new-tab .is-icon-plus{height:inherit;width:inherit;transform:scale(.8)}.el-tabs__new-tab .is-icon-plus svg{vertical-align:middle}.el-tabs__new-tab:hover{color:var(--el-color-primary)}.el-tabs__nav-wrap{overflow:hidden;margin-bottom:-1px;position:relative}.el-tabs__nav-wrap:after{content:"";position:absolute;left:0;bottom:0;width:100%;height:2px;background-color:var(--el-border-color-light);z-index:var(--el-index-normal)}.el-tabs__nav-wrap.is-scrollable{padding:0 20px;box-sizing:border-box}.el-tabs__nav-scroll{overflow:hidden}.el-tabs__nav-next,.el-tabs__nav-prev{position:absolute;cursor:pointer;line-height:44px;font-size:12px;color:var(--el-text-color-secondary);width:20px;text-align:center}.el-tabs__nav-next{right:0}.el-tabs__nav-prev{left:0}.el-tabs__nav{display:flex;white-space:nowrap;position:relative;transition:transform var(--el-transition-duration);float:left;z-index:calc(var(--el-index-normal) + 1)}.el-tabs__nav.is-stretch{min-width:100%;display:flex}.el-tabs__nav.is-stretch>*{flex:1;text-align:center}.el-tabs__item{padding:0 20px;height:var(--el-tabs-header-height);box-sizing:border-box;display:flex;align-items:center;justify-content:center;list-style:none;font-size:var(--el-font-size-base);font-weight:500;color:var(--el-text-color-primary);position:relative}.el-tabs__item:focus,.el-tabs__item:focus:active{outline:0}.el-tabs__item:focus-visible{box-shadow:0 0 2px 2px var(--el-color-primary) inset;border-radius:3px}.el-tabs__item .is-icon-close{border-radius:50%;text-align:center;transition:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);margin-left:5px}.el-tabs__item .is-icon-close:before{transform:scale(.9);display:inline-block}.el-tabs__item .is-icon-close:hover{background-color:var(--el-text-color-placeholder);color:#fff}.el-tabs__item.is-active{color:var(--el-color-primary)}.el-tabs__item:hover{color:var(--el-color-primary);cursor:pointer}.el-tabs__item.is-disabled{color:var(--el-disabled-text-color);cursor:not-allowed}.el-tabs__content{overflow:hidden;position:relative}.el-tabs--card>.el-tabs__header{border-bottom:1px solid var(--el-border-color-light);height:var(--el-tabs-header-height)}.el-tabs--card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--card>.el-tabs__header .el-tabs__nav{border:1px solid var(--el-border-color-light);border-bottom:none;border-radius:4px 4px 0 0;box-sizing:border-box}.el-tabs--card>.el-tabs__header .el-tabs__active-bar{display:none}.el-tabs--card>.el-tabs__header .el-tabs__item .is-icon-close{position:relative;font-size:12px;width:0;height:14px;overflow:hidden;right:-2px;transform-origin:100% 50%}.el-tabs--card>.el-tabs__header .el-tabs__item{border-bottom:1px solid transparent;border-left:1px solid var(--el-border-color-light);transition:color var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier),padding var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier)}.el-tabs--card>.el-tabs__header .el-tabs__item:first-child{border-left:none}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover{padding-left:13px;padding-right:13px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-closable:hover .is-icon-close{width:14px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active{border-bottom-color:var(--el-bg-color)}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable{padding-left:20px;padding-right:20px}.el-tabs--card>.el-tabs__header .el-tabs__item.is-active.is-closable .is-icon-close{width:14px}.el-tabs--border-card{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color)}.el-tabs--border-card>.el-tabs__content{padding:15px}.el-tabs--border-card>.el-tabs__header{background-color:var(--el-fill-color-light);border-bottom:1px solid var(--el-border-color-light);margin:0}.el-tabs--border-card>.el-tabs__header .el-tabs__nav-wrap:after{content:none}.el-tabs--border-card>.el-tabs__header .el-tabs__item{transition:all var(--el-transition-duration) var(--el-transition-function-ease-in-out-bezier);border:1px solid transparent;margin-top:-1px;color:var(--el-text-color-secondary)}.el-tabs--border-card>.el-tabs__header .el-tabs__item:first-child{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item+.el-tabs__item{margin-left:-1px}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-active{color:var(--el-color-primary);background-color:var(--el-bg-color-overlay);border-right-color:var(--el-border-color);border-left-color:var(--el-border-color)}.el-tabs--border-card>.el-tabs__header .el-tabs__item:not(.is-disabled):hover{color:var(--el-color-primary)}.el-tabs--border-card>.el-tabs__header .el-tabs__item.is-disabled{color:var(--el-disabled-text-color)}.el-tabs--border-card>.el-tabs__header .is-scrollable .el-tabs__item:first-child{margin-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:nth-child(2),.el-tabs--bottom .el-tabs__item.is-top:nth-child(2),.el-tabs--top .el-tabs__item.is-bottom:nth-child(2),.el-tabs--top .el-tabs__item.is-top:nth-child(2){padding-left:0}.el-tabs--bottom .el-tabs__item.is-bottom:last-child,.el-tabs--bottom .el-tabs__item.is-top:last-child,.el-tabs--top .el-tabs__item.is-bottom:last-child,.el-tabs--top .el-tabs__item.is-top:last-child{padding-right:0}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2),.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2){padding-left:20px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:nth-child(2):not(.is-active).is-closable:hover{padding-left:13px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child{padding-right:20px}.el-tabs--bottom .el-tabs--left>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom .el-tabs--right>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--bottom.el-tabs--card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--left>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top .el-tabs--right>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--border-card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover,.el-tabs--top.el-tabs--card>.el-tabs__header .el-tabs__item:last-child:not(.is-active).is-closable:hover{padding-right:13px}.el-tabs--bottom .el-tabs__header.is-bottom{margin-bottom:0;margin-top:10px}.el-tabs--bottom.el-tabs--border-card .el-tabs__header.is-bottom{border-bottom:0;border-top:1px solid var(--el-border-color)}.el-tabs--bottom.el-tabs--border-card .el-tabs__nav-wrap.is-bottom{margin-top:-1px;margin-bottom:0}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom:not(.is-active){border:1px solid transparent}.el-tabs--bottom.el-tabs--border-card .el-tabs__item.is-bottom{margin:0 -1px -1px}.el-tabs--left,.el-tabs--right{overflow:hidden}.el-tabs--left .el-tabs__header.is-left,.el-tabs--left .el-tabs__header.is-right,.el-tabs--left .el-tabs__nav-scroll,.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__header.is-left,.el-tabs--right .el-tabs__header.is-right,.el-tabs--right .el-tabs__nav-scroll,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{height:100%}.el-tabs--left .el-tabs__active-bar.is-left,.el-tabs--left .el-tabs__active-bar.is-right,.el-tabs--right .el-tabs__active-bar.is-left,.el-tabs--right .el-tabs__active-bar.is-right{top:0;bottom:auto;width:2px;height:auto}.el-tabs--left .el-tabs__nav-wrap.is-left,.el-tabs--left .el-tabs__nav-wrap.is-right,.el-tabs--right .el-tabs__nav-wrap.is-left,.el-tabs--right .el-tabs__nav-wrap.is-right{margin-bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{height:30px;line-height:30px;width:100%;text-align:center;cursor:pointer}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next i,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev i{transform:rotate(90deg)}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-prev,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-prev{left:auto;top:0}.el-tabs--left .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--left .el-tabs__nav-wrap.is-right>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-left>.el-tabs__nav-next,.el-tabs--right .el-tabs__nav-wrap.is-right>.el-tabs__nav-next{right:auto;bottom:0}.el-tabs--left .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--left .el-tabs__nav-wrap.is-right.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-left.is-scrollable,.el-tabs--right .el-tabs__nav-wrap.is-right.is-scrollable{padding:30px 0}.el-tabs--left .el-tabs__nav-wrap.is-left:after,.el-tabs--left .el-tabs__nav-wrap.is-right:after,.el-tabs--right .el-tabs__nav-wrap.is-left:after,.el-tabs--right .el-tabs__nav-wrap.is-right:after{height:100%;width:2px;bottom:auto;top:0}.el-tabs--left .el-tabs__nav.is-left,.el-tabs--left .el-tabs__nav.is-right,.el-tabs--right .el-tabs__nav.is-left,.el-tabs--right .el-tabs__nav.is-right{flex-direction:column}.el-tabs--left .el-tabs__item.is-left,.el-tabs--right .el-tabs__item.is-left{justify-content:flex-end}.el-tabs--left .el-tabs__item.is-right,.el-tabs--right .el-tabs__item.is-right{justify-content:flex-start}.el-tabs--left .el-tabs__header.is-left{float:left;margin-bottom:0;margin-right:10px}.el-tabs--left .el-tabs__nav-wrap.is-left{margin-right:-1px}.el-tabs--left .el-tabs__nav-wrap.is-left:after{left:auto;right:0}.el-tabs--left .el-tabs__active-bar.is-left{right:0;left:auto}.el-tabs--left .el-tabs__item.is-left{text-align:right}.el-tabs--left.el-tabs--card .el-tabs__active-bar.is-left{display:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left{border-left:none;border-right:1px solid var(--el-border-color-light);border-bottom:none;border-top:1px solid var(--el-border-color-light);text-align:left}.el-tabs--left.el-tabs--card .el-tabs__item.is-left:first-child{border-right:1px solid var(--el-border-color-light);border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active{border:1px solid var(--el-border-color-light);border-right-color:#fff;border-left:none;border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:first-child{border-top:none}.el-tabs--left.el-tabs--card .el-tabs__item.is-left.is-active:last-child{border-bottom:none}.el-tabs--left.el-tabs--card .el-tabs__nav{border-radius:4px 0 0 4px;border-bottom:1px solid var(--el-border-color-light);border-right:none}.el-tabs--left.el-tabs--card .el-tabs__new-tab{float:none}.el-tabs--left.el-tabs--border-card .el-tabs__header.is-left{border-right:1px solid var(--el-border-color)}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left{border:1px solid transparent;margin:-1px 0 -1px -1px}.el-tabs--left.el-tabs--border-card .el-tabs__item.is-left.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.el-tabs--right .el-tabs__header.is-right{float:right;margin-bottom:0;margin-left:10px}.el-tabs--right .el-tabs__nav-wrap.is-right{margin-left:-1px}.el-tabs--right .el-tabs__nav-wrap.is-right:after{left:0;right:auto}.el-tabs--right .el-tabs__active-bar.is-right{left:0}.el-tabs--right.el-tabs--card .el-tabs__active-bar.is-right{display:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right{border-bottom:none;border-top:1px solid var(--el-border-color-light)}.el-tabs--right.el-tabs--card .el-tabs__item.is-right:first-child{border-left:1px solid var(--el-border-color-light);border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active{border:1px solid var(--el-border-color-light);border-left-color:#fff;border-right:none;border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:first-child{border-top:none}.el-tabs--right.el-tabs--card .el-tabs__item.is-right.is-active:last-child{border-bottom:none}.el-tabs--right.el-tabs--card .el-tabs__nav{border-radius:0 4px 4px 0;border-bottom:1px solid var(--el-border-color-light);border-left:none}.el-tabs--right.el-tabs--border-card .el-tabs__header.is-right{border-left:1px solid var(--el-border-color)}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right{border:1px solid transparent;margin:-1px -1px -1px 0}.el-tabs--right.el-tabs--border-card .el-tabs__item.is-right.is-active{border-color:transparent;border-top-color:#d1dbe5;border-bottom-color:#d1dbe5}.slideInLeft-transition,.slideInRight-transition{display:inline-block}.slideInRight-enter{-webkit-animation:slideInRight-enter var(--el-transition-duration);animation:slideInRight-enter var(--el-transition-duration)}.slideInRight-leave{position:absolute;left:0;right:0;-webkit-animation:slideInRight-leave var(--el-transition-duration);animation:slideInRight-leave var(--el-transition-duration)}.slideInLeft-enter{-webkit-animation:slideInLeft-enter var(--el-transition-duration);animation:slideInLeft-enter var(--el-transition-duration)}.slideInLeft-leave{position:absolute;left:0;right:0;-webkit-animation:slideInLeft-leave var(--el-transition-duration);animation:slideInLeft-leave var(--el-transition-duration)}@-webkit-keyframes slideInRight-enter{0%{opacity:0;transform-origin:0 0;transform:translate(100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@keyframes slideInRight-enter{0%{opacity:0;transform-origin:0 0;transform:translate(100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@-webkit-keyframes slideInRight-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(100%);opacity:0}}@keyframes slideInRight-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(100%);opacity:0}}@-webkit-keyframes slideInLeft-enter{0%{opacity:0;transform-origin:0 0;transform:translate(-100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@keyframes slideInLeft-enter{0%{opacity:0;transform-origin:0 0;transform:translate(-100%)}to{opacity:1;transform-origin:0 0;transform:translate(0)}}@-webkit-keyframes slideInLeft-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(-100%);opacity:0}}@keyframes slideInLeft-leave{0%{transform-origin:0 0;transform:translate(0);opacity:1}to{transform-origin:0 0;transform:translate(-100%);opacity:0}}.el-tag{--el-tag-font-size:12px;--el-tag-border-radius:4px;--el-tag-border-radius-rounded:9999px}.el-tag{--el-tag-bg-color:var(--el-color-primary-light-9);--el-tag-border-color:var(--el-color-primary-light-8);--el-tag-hover-color:var(--el-color-primary);--el-tag-text-color:var(--el-color-primary);background-color:var(--el-tag-bg-color);border-color:var(--el-tag-border-color);color:var(--el-tag-text-color);display:inline-flex;justify-content:center;align-items:center;height:24px;padding:0 9px;font-size:var(--el-tag-font-size);line-height:1;border-width:1px;border-style:solid;border-radius:var(--el-tag-border-radius);box-sizing:border-box;white-space:nowrap;--el-icon-size:14px}.el-tag.el-tag--primary{--el-tag-bg-color:var(--el-color-primary-light-9);--el-tag-border-color:var(--el-color-primary-light-8);--el-tag-hover-color:var(--el-color-primary)}.el-tag.el-tag--success{--el-tag-bg-color:var(--el-color-success-light-9);--el-tag-border-color:var(--el-color-success-light-8);--el-tag-hover-color:var(--el-color-success)}.el-tag.el-tag--warning{--el-tag-bg-color:var(--el-color-warning-light-9);--el-tag-border-color:var(--el-color-warning-light-8);--el-tag-hover-color:var(--el-color-warning)}.el-tag.el-tag--danger{--el-tag-bg-color:var(--el-color-danger-light-9);--el-tag-border-color:var(--el-color-danger-light-8);--el-tag-hover-color:var(--el-color-danger)}.el-tag.el-tag--error{--el-tag-bg-color:var(--el-color-error-light-9);--el-tag-border-color:var(--el-color-error-light-8);--el-tag-hover-color:var(--el-color-error)}.el-tag.el-tag--info{--el-tag-bg-color:var(--el-color-info-light-9);--el-tag-border-color:var(--el-color-info-light-8);--el-tag-hover-color:var(--el-color-info)}.el-tag.el-tag--primary{--el-tag-text-color:var(--el-color-primary)}.el-tag.el-tag--success{--el-tag-text-color:var(--el-color-success)}.el-tag.el-tag--warning{--el-tag-text-color:var(--el-color-warning)}.el-tag.el-tag--danger{--el-tag-text-color:var(--el-color-danger)}.el-tag.el-tag--error{--el-tag-text-color:var(--el-color-error)}.el-tag.el-tag--info{--el-tag-text-color:var(--el-color-info)}.el-tag.is-hit{border-color:var(--el-color-primary)}.el-tag.is-round{border-radius:var(--el-tag-border-radius-rounded)}.el-tag .el-tag__close{color:var(--el-tag-text-color)}.el-tag .el-tag__close:hover{color:var(--el-color-white);background-color:var(--el-tag-hover-color)}.el-tag .el-icon{border-radius:50%;cursor:pointer;font-size:calc(var(--el-icon-size) - 2px);height:var(--el-icon-size);width:var(--el-icon-size)}.el-tag .el-tag__close{margin-left:6px}.el-tag--dark{--el-tag-bg-color:var(--el-color-primary);--el-tag-border-color:var(--el-color-primary);--el-tag-hover-color:var(--el-color-primary-light-3);--el-tag-text-color:var(--el-color-white)}.el-tag--dark.el-tag--primary{--el-tag-bg-color:var(--el-color-primary);--el-tag-border-color:var(--el-color-primary);--el-tag-hover-color:var(--el-color-primary-light-3)}.el-tag--dark.el-tag--success{--el-tag-bg-color:var(--el-color-success);--el-tag-border-color:var(--el-color-success);--el-tag-hover-color:var(--el-color-success-light-3)}.el-tag--dark.el-tag--warning{--el-tag-bg-color:var(--el-color-warning);--el-tag-border-color:var(--el-color-warning);--el-tag-hover-color:var(--el-color-warning-light-3)}.el-tag--dark.el-tag--danger{--el-tag-bg-color:var(--el-color-danger);--el-tag-border-color:var(--el-color-danger);--el-tag-hover-color:var(--el-color-danger-light-3)}.el-tag--dark.el-tag--error{--el-tag-bg-color:var(--el-color-error);--el-tag-border-color:var(--el-color-error);--el-tag-hover-color:var(--el-color-error-light-3)}.el-tag--dark.el-tag--info{--el-tag-bg-color:var(--el-color-info);--el-tag-border-color:var(--el-color-info);--el-tag-hover-color:var(--el-color-info-light-3)}.el-tag--dark.el-tag--primary,.el-tag--dark.el-tag--success,.el-tag--dark.el-tag--warning,.el-tag--dark.el-tag--danger,.el-tag--dark.el-tag--error,.el-tag--dark.el-tag--info{--el-tag-text-color:var(--el-color-white)}.el-tag--plain{--el-tag-border-color:var(--el-color-primary-light-5);--el-tag-hover-color:var(--el-color-primary);--el-tag-bg-color:var(--el-fill-color-blank)}.el-tag--plain.el-tag--primary{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-primary-light-5);--el-tag-hover-color:var(--el-color-primary)}.el-tag--plain.el-tag--success{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-success-light-5);--el-tag-hover-color:var(--el-color-success)}.el-tag--plain.el-tag--warning{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-warning-light-5);--el-tag-hover-color:var(--el-color-warning)}.el-tag--plain.el-tag--danger{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-danger-light-5);--el-tag-hover-color:var(--el-color-danger)}.el-tag--plain.el-tag--error{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-error-light-5);--el-tag-hover-color:var(--el-color-error)}.el-tag--plain.el-tag--info{--el-tag-bg-color:var(--el-fill-color-blank);--el-tag-border-color:var(--el-color-info-light-5);--el-tag-hover-color:var(--el-color-info)}.el-tag.is-closable{padding-right:5px}.el-tag--large{padding:0 11px;height:32px;--el-icon-size:16px}.el-tag--large .el-tag__close{margin-left:8px}.el-tag--large.is-closable{padding-right:7px}.el-tag--small{padding:0 7px;height:20px;--el-icon-size:12px}.el-tag--small .el-tag__close{margin-left:4px}.el-tag--small.is-closable{padding-right:3px}.el-tag--small .el-icon-close{transform:scale(.8)}.el-tag.el-tag--primary.is-hit{border-color:var(--el-color-primary)}.el-tag.el-tag--success.is-hit{border-color:var(--el-color-success)}.el-tag.el-tag--warning.is-hit{border-color:var(--el-color-warning)}.el-tag.el-tag--danger.is-hit{border-color:var(--el-color-danger)}.el-tag.el-tag--error.is-hit{border-color:var(--el-color-error)}.el-tag.el-tag--info.is-hit{border-color:var(--el-color-info)}.el-text{--el-text-font-size:var(--el-font-size-base);--el-text-color:var(--el-text-color-regular)}.el-text{align-self:center;margin:0;padding:0;font-size:var(--el-text-font-size);color:var(--el-text-color);word-break:break-all}.el-text.is-truncated{display:inline-block;max-width:100%;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.el-text--large{--el-text-font-size:var(--el-font-size-medium)}.el-text--default{--el-text-font-size:var(--el-font-size-base)}.el-text--small{--el-text-font-size:var(--el-font-size-extra-small)}.el-text.el-text--primary{--el-text-color:var(--el-color-primary)}.el-text.el-text--success{--el-text-color:var(--el-color-success)}.el-text.el-text--warning{--el-text-color:var(--el-color-warning)}.el-text.el-text--danger{--el-text-color:var(--el-color-danger)}.el-text.el-text--error{--el-text-color:var(--el-color-error)}.el-text.el-text--info{--el-text-color:var(--el-color-info)}.el-text>.el-icon{vertical-align:-2px}.time-select{margin:5px 0;min-width:0}.time-select .el-picker-panel__content{max-height:200px;margin:0}.time-select-item{padding:8px 10px;font-size:14px;line-height:20px}.time-select-item.disabled{color:var(--el-datepicker-border-color);cursor:not-allowed}.time-select-item:hover{background-color:var(--el-fill-color-light);font-weight:700;cursor:pointer}.time-select .time-select-item.selected:not(.disabled){color:var(--el-color-primary);font-weight:700}.el-timeline-item{position:relative;padding-bottom:20px}.el-timeline-item__wrapper{position:relative;padding-left:28px;top:-3px}.el-timeline-item__tail{position:absolute;left:4px;height:100%;border-left:2px solid var(--el-timeline-node-color)}.el-timeline-item .el-timeline-item__icon{color:var(--el-color-white);font-size:var(--el-font-size-small)}.el-timeline-item__node{position:absolute;background-color:var(--el-timeline-node-color);border-color:var(--el-timeline-node-color);border-radius:50%;box-sizing:border-box;display:flex;justify-content:center;align-items:center}.el-timeline-item__node--normal{left:-1px;width:var(--el-timeline-node-size-normal);height:var(--el-timeline-node-size-normal)}.el-timeline-item__node--large{left:-2px;width:var(--el-timeline-node-size-large);height:var(--el-timeline-node-size-large)}.el-timeline-item__node.is-hollow{background:var(--el-color-white);border-style:solid;border-width:2px}.el-timeline-item__node--primary{background-color:var(--el-color-primary);border-color:var(--el-color-primary)}.el-timeline-item__node--success{background-color:var(--el-color-success);border-color:var(--el-color-success)}.el-timeline-item__node--warning{background-color:var(--el-color-warning);border-color:var(--el-color-warning)}.el-timeline-item__node--danger{background-color:var(--el-color-danger);border-color:var(--el-color-danger)}.el-timeline-item__node--info{background-color:var(--el-color-info);border-color:var(--el-color-info)}.el-timeline-item__dot{position:absolute;display:flex;justify-content:center;align-items:center}.el-timeline-item__content{color:var(--el-text-color-primary)}.el-timeline-item__timestamp{color:var(--el-text-color-secondary);line-height:1;font-size:var(--el-font-size-small)}.el-timeline-item__timestamp.is-top{margin-bottom:8px;padding-top:4px}.el-timeline-item__timestamp.is-bottom{margin-top:8px}.el-timeline{--el-timeline-node-size-normal:12px;--el-timeline-node-size-large:14px;--el-timeline-node-color:var(--el-border-color-light)}.el-timeline{margin:0;font-size:var(--el-font-size-base);list-style:none}.el-timeline .el-timeline-item:last-child .el-timeline-item__tail{display:none}.el-timeline .el-timeline-item__center{display:flex;align-items:center}.el-timeline .el-timeline-item__center .el-timeline-item__wrapper{width:100%}.el-timeline .el-timeline-item__center .el-timeline-item__tail{top:0}.el-timeline .el-timeline-item__center:first-child .el-timeline-item__tail{height:calc(50% + 10px);top:calc(50% - 10px)}.el-timeline .el-timeline-item__center:last-child .el-timeline-item__tail{display:block;height:calc(50% - 10px)}.el-tooltip-v2__content{--el-tooltip-v2-padding:5px 10px;--el-tooltip-v2-border-radius:4px;--el-tooltip-v2-border-color:var(--el-border-color);border-radius:var(--el-tooltip-v2-border-radius);color:var(--el-color-black);background-color:var(--el-color-white);padding:var(--el-tooltip-v2-padding);border:1px solid var(--el-border-color)}.el-tooltip-v2__arrow{position:absolute;color:var(--el-color-white);width:var(--el-tooltip-v2-arrow-width);height:var(--el-tooltip-v2-arrow-height);pointer-events:none;left:var(--el-tooltip-v2-arrow-x);top:var(--el-tooltip-v2-arrow-y)}.el-tooltip-v2__arrow:before{content:"";width:0;height:0;border:var(--el-tooltip-v2-arrow-border-width) solid transparent;position:absolute}.el-tooltip-v2__arrow:after{content:"";width:0;height:0;border:var(--el-tooltip-v2-arrow-border-width) solid transparent;position:absolute}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow{bottom:0}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow:before{border-top-color:var(--el-color-white);border-top-width:var(--el-tooltip-v2-arrow-border-width);border-bottom:0;top:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=top] .el-tooltip-v2__arrow:after{border-top-color:var(--el-border-color);border-top-width:var(--el-tooltip-v2-arrow-border-width);border-bottom:0;top:100%;z-index:-1}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow{top:0}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow:before{border-bottom-color:var(--el-color-white);border-bottom-width:var(--el-tooltip-v2-arrow-border-width);border-top:0;bottom:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=bottom] .el-tooltip-v2__arrow:after{border-bottom-color:var(--el-border-color);border-bottom-width:var(--el-tooltip-v2-arrow-border-width);border-top:0;bottom:100%;z-index:-1}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow{right:0}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow:before{border-left-color:var(--el-color-white);border-left-width:var(--el-tooltip-v2-arrow-border-width);border-right:0;left:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=left] .el-tooltip-v2__arrow:after{border-left-color:var(--el-border-color);border-left-width:var(--el-tooltip-v2-arrow-border-width);border-right:0;left:100%;z-index:-1}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow{left:0}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow:before{border-right-color:var(--el-color-white);border-right-width:var(--el-tooltip-v2-arrow-border-width);border-left:0;right:calc(100% - 1px)}.el-tooltip-v2__content[data-side^=right] .el-tooltip-v2__arrow:after{border-right-color:var(--el-border-color);border-right-width:var(--el-tooltip-v2-arrow-border-width);border-left:0;right:100%;z-index:-1}.el-tooltip-v2__content.is-dark{--el-tooltip-v2-border-color:transparent;background-color:var(--el-color-black);color:var(--el-color-white);border-color:transparent}.el-tooltip-v2__content.is-dark .el-tooltip-v2__arrow{background-color:var(--el-color-black);border-color:transparent}.el-transfer{--el-transfer-border-color:var(--el-border-color-lighter);--el-transfer-border-radius:var(--el-border-radius-base);--el-transfer-panel-width:200px;--el-transfer-panel-header-height:40px;--el-transfer-panel-header-bg-color:var(--el-fill-color-light);--el-transfer-panel-footer-height:40px;--el-transfer-panel-body-height:278px;--el-transfer-item-height:30px;--el-transfer-filter-height:32px}.el-transfer{font-size:var(--el-font-size-base)}.el-transfer__buttons{display:inline-block;vertical-align:middle;padding:0 30px}.el-transfer__button{vertical-align:top}.el-transfer__button:nth-child(2){margin:0 0 0 10px}.el-transfer__button i,.el-transfer__button span{font-size:14px}.el-transfer__button .el-icon+span{margin-left:0}.el-transfer-panel{overflow:hidden;background:var(--el-bg-color-overlay);display:inline-block;text-align:left;vertical-align:middle;width:var(--el-transfer-panel-width);max-height:100%;box-sizing:border-box;position:relative}.el-transfer-panel__body{height:var(--el-transfer-panel-body-height);border-left:1px solid var(--el-transfer-border-color);border-right:1px solid var(--el-transfer-border-color);border-bottom:1px solid var(--el-transfer-border-color);border-bottom-left-radius:var(--el-transfer-border-radius);border-bottom-right-radius:var(--el-transfer-border-radius);overflow:hidden}.el-transfer-panel__body.is-with-footer{border-bottom:none;border-bottom-left-radius:0;border-bottom-right-radius:0}.el-transfer-panel__list{margin:0;padding:6px 0;list-style:none;height:var(--el-transfer-panel-body-height);overflow:auto;box-sizing:border-box}.el-transfer-panel__list.is-filterable{height:calc(100% - var(--el-transfer-filter-height) - 30px);padding-top:0}.el-transfer-panel__item{height:var(--el-transfer-item-height);line-height:var(--el-transfer-item-height);padding-left:15px;display:block!important}.el-transfer-panel__item+.el-transfer-panel__item{margin-left:0}.el-transfer-panel__item.el-checkbox{color:var(--el-text-color-regular)}.el-transfer-panel__item:hover{color:var(--el-color-primary)}.el-transfer-panel__item.el-checkbox .el-checkbox__label{width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;display:block;box-sizing:border-box;padding-left:22px;line-height:var(--el-transfer-item-height)}.el-transfer-panel__item .el-checkbox__input{position:absolute;top:8px}.el-transfer-panel__filter{text-align:center;padding:15px;box-sizing:border-box}.el-transfer-panel__filter .el-input__inner{height:var(--el-transfer-filter-height);width:100%;font-size:12px;display:inline-block;box-sizing:border-box;border-radius:calc(var(--el-transfer-filter-height)/ 2)}.el-transfer-panel__filter .el-icon-circle-close{cursor:pointer}.el-transfer-panel .el-transfer-panel__header{display:flex;align-items:center;height:var(--el-transfer-panel-header-height);background:var(--el-transfer-panel-header-bg-color);margin:0;padding-left:15px;border:1px solid var(--el-transfer-border-color);border-top-left-radius:var(--el-transfer-border-radius);border-top-right-radius:var(--el-transfer-border-radius);box-sizing:border-box;color:var(--el-color-black)}.el-transfer-panel .el-transfer-panel__header .el-checkbox{position:relative;display:flex;width:100%;align-items:center}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label{font-size:16px;color:var(--el-text-color-primary);font-weight:400}.el-transfer-panel .el-transfer-panel__header .el-checkbox .el-checkbox__label span{position:absolute;right:15px;top:50%;transform:translate3d(0,-50%,0);color:var(--el-text-color-secondary);font-size:12px;font-weight:400}.el-transfer-panel .el-transfer-panel__footer{height:var(--el-transfer-panel-footer-height);background:var(--el-bg-color-overlay);margin:0;padding:0;border:1px solid var(--el-transfer-border-color);border-bottom-left-radius:var(--el-transfer-border-radius);border-bottom-right-radius:var(--el-transfer-border-radius)}.el-transfer-panel .el-transfer-panel__footer:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-transfer-panel .el-transfer-panel__footer .el-checkbox{padding-left:20px;color:var(--el-text-color-regular)}.el-transfer-panel .el-transfer-panel__empty{margin:0;height:var(--el-transfer-item-height);line-height:var(--el-transfer-item-height);padding:6px 15px 0;color:var(--el-text-color-secondary);text-align:center}.el-transfer-panel .el-checkbox__label{padding-left:8px}.el-transfer-panel .el-checkbox__inner{height:14px;width:14px;border-radius:3px}.el-transfer-panel .el-checkbox__inner:after{height:6px;width:3px;left:4px}.el-tree{--el-tree-node-hover-bg-color:var(--el-fill-color-light);--el-tree-text-color:var(--el-text-color-regular);--el-tree-expand-icon-color:var(--el-text-color-placeholder)}.el-tree{position:relative;cursor:default;background:var(--el-fill-color-blank);color:var(--el-tree-text-color);font-size:var(--el-font-size-base)}.el-tree__empty-block{position:relative;min-height:60px;text-align:center;width:100%;height:100%}.el-tree__empty-text{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);color:var(--el-text-color-secondary);font-size:var(--el-font-size-base)}.el-tree__drop-indicator{position:absolute;left:0;right:0;height:1px;background-color:var(--el-color-primary)}.el-tree-node{white-space:nowrap;outline:0}.el-tree-node:focus>.el-tree-node__content{background-color:var(--el-tree-node-hover-bg-color)}.el-tree-node.is-drop-inner>.el-tree-node__content .el-tree-node__label{background-color:var(--el-color-primary);color:#fff}.el-tree-node__content{display:flex;align-items:center;height:26px;cursor:pointer}.el-tree-node__content>.el-tree-node__expand-icon{padding:6px;box-sizing:content-box}.el-tree-node__content>label.el-checkbox{margin-right:8px}.el-tree-node__content:hover{background-color:var(--el-tree-node-hover-bg-color)}.el-tree.is-dragging .el-tree-node__content{cursor:move}.el-tree.is-dragging .el-tree-node__content *{pointer-events:none}.el-tree.is-dragging.is-drop-not-allow .el-tree-node__content{cursor:not-allowed}.el-tree-node__expand-icon{cursor:pointer;color:var(--el-tree-expand-icon-color);font-size:12px;transform:rotate(0);transition:transform var(--el-transition-duration) ease-in-out}.el-tree-node__expand-icon.expanded{transform:rotate(90deg)}.el-tree-node__expand-icon.is-leaf{color:transparent;cursor:default}.el-tree-node__expand-icon.is-hidden{visibility:hidden}.el-tree-node__loading-icon{margin-right:8px;font-size:var(--el-font-size-base);color:var(--el-tree-expand-icon-color)}.el-tree-node>.el-tree-node__children{overflow:hidden;background-color:transparent}.el-tree-node.is-expanded>.el-tree-node__children{display:block}.el-tree--highlight-current .el-tree-node.is-current>.el-tree-node__content{background-color:var(--el-color-primary-light-9)}.el-tree-select{--el-tree-node-hover-bg-color:var(--el-fill-color-light);--el-tree-text-color:var(--el-text-color-regular);--el-tree-expand-icon-color:var(--el-text-color-placeholder)}.el-tree-select__popper .el-tree-node__expand-icon{margin-left:8px}.el-tree-select__popper .el-tree-node.is-checked>.el-tree-node__content .el-select-dropdown__item.selected:after{content:none}.el-tree-select__popper .el-select-dropdown__item{flex:1;background:0 0!important;padding-left:0;height:20px;line-height:20px}.el-upload{--el-upload-dragger-padding-horizontal:40px;--el-upload-dragger-padding-vertical:10px}.el-upload{display:inline-flex;justify-content:center;align-items:center;cursor:pointer;outline:0}.el-upload__input{display:none}.el-upload__tip{font-size:12px;color:var(--el-text-color-regular);margin-top:7px}.el-upload iframe{position:absolute;z-index:-1;top:0;left:0;opacity:0}.el-upload--picture-card{--el-upload-picture-card-size:148px;background-color:var(--el-fill-color-lighter);border:1px dashed var(--el-border-color-darker);border-radius:6px;box-sizing:border-box;width:var(--el-upload-picture-card-size);height:var(--el-upload-picture-card-size);cursor:pointer;vertical-align:top;display:inline-flex;justify-content:center;align-items:center}.el-upload--picture-card i{font-size:28px;color:var(--el-text-color-secondary)}.el-upload--picture-card:hover{border-color:var(--el-color-primary);color:var(--el-color-primary)}.el-upload.is-drag{display:block}.el-upload:focus{border-color:var(--el-color-primary);color:var(--el-color-primary)}.el-upload:focus .el-upload-dragger{border-color:var(--el-color-primary)}.el-upload-dragger{padding:var(--el-upload-dragger-padding-horizontal) var(--el-upload-dragger-padding-vertical);background-color:var(--el-fill-color-blank);border:1px dashed var(--el-border-color);border-radius:6px;box-sizing:border-box;text-align:center;cursor:pointer;position:relative;overflow:hidden}.el-upload-dragger .el-icon--upload{font-size:67px;color:var(--el-text-color-placeholder);margin-bottom:16px;line-height:50px}.el-upload-dragger+.el-upload__tip{text-align:center}.el-upload-dragger~.el-upload__files{border-top:var(--el-border);margin-top:7px;padding-top:5px}.el-upload-dragger .el-upload__text{color:var(--el-text-color-regular);font-size:14px;text-align:center}.el-upload-dragger .el-upload__text em{color:var(--el-color-primary);font-style:normal}.el-upload-dragger:hover{border-color:var(--el-color-primary)}.el-upload-dragger.is-dragover{padding:calc(var(--el-upload-dragger-padding-horizontal) - 1px) calc(var(--el-upload-dragger-padding-vertical) - 1px);background-color:var(--el-color-primary-light-9);border:2px dashed var(--el-color-primary)}.el-upload-list{margin:10px 0 0;padding:0;list-style:none;position:relative}.el-upload-list__item{transition:all .5s cubic-bezier(.55,0,.1,1);font-size:14px;color:var(--el-text-color-regular);margin-bottom:5px;position:relative;box-sizing:border-box;border-radius:4px;width:100%}.el-upload-list__item .el-progress{position:absolute;top:20px;width:100%}.el-upload-list__item .el-progress__text{position:absolute;right:0;top:-13px}.el-upload-list__item .el-progress-bar{margin-right:0;padding-right:0}.el-upload-list__item .el-icon--upload-success{color:var(--el-color-success)}.el-upload-list__item .el-icon--close{display:none;position:absolute;right:5px;top:50%;cursor:pointer;opacity:.75;color:var(--el-text-color-regular);transition:opacity var(--el-transition-duration);transform:translateY(-50%)}.el-upload-list__item .el-icon--close:hover{opacity:1;color:var(--el-color-primary)}.el-upload-list__item .el-icon--close-tip{display:none;position:absolute;top:1px;right:5px;font-size:12px;cursor:pointer;opacity:1;color:var(--el-color-primary);font-style:normal}.el-upload-list__item:hover{background-color:var(--el-fill-color-light)}.el-upload-list__item:hover .el-icon--close{display:inline-flex}.el-upload-list__item:hover .el-progress__text{display:none}.el-upload-list__item .el-upload-list__item-info{display:inline-flex;justify-content:center;flex-direction:column;width:calc(100% - 30px);margin-left:4px}.el-upload-list__item.is-success .el-upload-list__item-status-label{display:inline-flex}.el-upload-list__item.is-success .el-upload-list__item-name:focus,.el-upload-list__item.is-success .el-upload-list__item-name:hover{color:var(--el-color-primary);cursor:pointer}.el-upload-list__item.is-success:focus:not(:hover) .el-icon--close-tip{display:inline-block}.el-upload-list__item.is-success:active,.el-upload-list__item.is-success:not(.focusing):focus{outline-width:0}.el-upload-list__item.is-success:active .el-icon--close-tip,.el-upload-list__item.is-success:not(.focusing):focus .el-icon--close-tip{display:none}.el-upload-list__item.is-success:focus .el-upload-list__item-status-label,.el-upload-list__item.is-success:hover .el-upload-list__item-status-label{display:none;opacity:0}.el-upload-list__item-name{color:var(--el-text-color-regular);display:inline-flex;text-align:center;align-items:center;padding:0 4px;transition:color var(--el-transition-duration);font-size:var(--el-font-size-base)}.el-upload-list__item-name .el-icon{margin-right:6px;color:var(--el-text-color-secondary)}.el-upload-list__item-file-name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.el-upload-list__item-status-label{position:absolute;right:5px;top:0;line-height:inherit;display:none;height:100%;justify-content:center;align-items:center;transition:opacity var(--el-transition-duration)}.el-upload-list__item-delete{position:absolute;right:10px;top:0;font-size:12px;color:var(--el-text-color-regular);display:none}.el-upload-list__item-delete:hover{color:var(--el-color-primary)}.el-upload-list--picture-card{--el-upload-list-picture-card-size:148px;display:inline-flex;flex-wrap:wrap;margin:0}.el-upload-list--picture-card .el-upload-list__item{overflow:hidden;background-color:var(--el-fill-color-blank);border:1px solid var(--el-border-color);border-radius:6px;box-sizing:border-box;width:var(--el-upload-list-picture-card-size);height:var(--el-upload-list-picture-card-size);margin:0 8px 8px 0;padding:0;display:inline-flex}.el-upload-list--picture-card .el-upload-list__item .el-icon--check,.el-upload-list--picture-card .el-upload-list__item .el-icon--circle-check{color:#fff}.el-upload-list--picture-card .el-upload-list__item .el-icon--close{display:none}.el-upload-list--picture-card .el-upload-list__item:hover .el-upload-list__item-status-label{opacity:0;display:block}.el-upload-list--picture-card .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture-card .el-upload-list__item .el-upload-list__item-name{display:none}.el-upload-list--picture-card .el-upload-list__item-thumbnail{width:100%;height:100%;-o-object-fit:contain;object-fit:contain}.el-upload-list--picture-card .el-upload-list__item-status-label{right:-15px;top:-6px;width:40px;height:24px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-list--picture-card .el-upload-list__item-status-label i{font-size:12px;margin-top:11px;transform:rotate(-45deg)}.el-upload-list--picture-card .el-upload-list__item-actions{position:absolute;width:100%;height:100%;left:0;top:0;cursor:default;display:inline-flex;justify-content:center;align-items:center;color:#fff;opacity:0;font-size:20px;background-color:var(--el-overlay-color-lighter);transition:opacity var(--el-transition-duration)}.el-upload-list--picture-card .el-upload-list__item-actions span{display:none;cursor:pointer}.el-upload-list--picture-card .el-upload-list__item-actions span+span{margin-left:1rem}.el-upload-list--picture-card .el-upload-list__item-actions .el-upload-list__item-delete{position:static;font-size:inherit;color:inherit}.el-upload-list--picture-card .el-upload-list__item-actions:hover{opacity:1}.el-upload-list--picture-card .el-upload-list__item-actions:hover span{display:inline-flex}.el-upload-list--picture-card .el-progress{top:50%;left:50%;transform:translate(-50%,-50%);bottom:auto;width:126px}.el-upload-list--picture-card .el-progress .el-progress__text{top:50%}.el-upload-list--picture .el-upload-list__item{overflow:hidden;z-index:0;background-color:var(--el-fill-color-blank);border:1px solid var(--el-border-color);border-radius:6px;box-sizing:border-box;margin-top:10px;padding:10px;display:flex;align-items:center}.el-upload-list--picture .el-upload-list__item .el-icon--check,.el-upload-list--picture .el-upload-list__item .el-icon--circle-check{color:#fff}.el-upload-list--picture .el-upload-list__item:hover .el-upload-list__item-status-label{opacity:0;display:inline-flex}.el-upload-list--picture .el-upload-list__item:hover .el-progress__text{display:block}.el-upload-list--picture .el-upload-list__item.is-success .el-upload-list__item-name i{display:none}.el-upload-list--picture .el-upload-list__item .el-icon--close{top:5px;transform:translateY(0)}.el-upload-list--picture .el-upload-list__item-thumbnail{display:inline-flex;justify-content:center;align-items:center;width:70px;height:70px;-o-object-fit:contain;object-fit:contain;position:relative;z-index:1;background-color:var(--el-color-white)}.el-upload-list--picture .el-upload-list__item-status-label{position:absolute;right:-17px;top:-7px;width:46px;height:26px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-list--picture .el-upload-list__item-status-label i{font-size:12px;margin-top:12px;transform:rotate(-45deg)}.el-upload-list--picture .el-progress{position:relative;top:-7px}.el-upload-cover{position:absolute;left:0;top:0;width:100%;height:100%;overflow:hidden;z-index:10;cursor:default}.el-upload-cover:after{display:inline-block;content:"";height:100%;vertical-align:middle}.el-upload-cover img{display:block;width:100%;height:100%}.el-upload-cover__label{right:-15px;top:-6px;width:40px;height:24px;background:var(--el-color-success);text-align:center;transform:rotate(45deg)}.el-upload-cover__label i{font-size:12px;margin-top:11px;transform:rotate(-45deg);color:#fff}.el-upload-cover__progress{display:inline-block;vertical-align:middle;position:static;width:243px}.el-upload-cover__progress+.el-upload__inner{opacity:0}.el-upload-cover__content{position:absolute;top:0;left:0;width:100%;height:100%}.el-upload-cover__interact{position:absolute;bottom:0;left:0;width:100%;height:100%;background-color:var(--el-overlay-color-light);text-align:center}.el-upload-cover__interact .btn{display:inline-block;color:#fff;font-size:14px;cursor:pointer;vertical-align:middle;transition:var(--el-transition-md-fade);margin-top:60px}.el-upload-cover__interact .btn i{margin-top:0}.el-upload-cover__interact .btn span{opacity:0;transition:opacity .15s linear}.el-upload-cover__interact .btn:not(:first-child){margin-left:35px}.el-upload-cover__interact .btn:hover{transform:translateY(-13px)}.el-upload-cover__interact .btn:hover span{opacity:1}.el-upload-cover__interact .btn i{color:#fff;display:block;font-size:24px;line-height:inherit;margin:0 auto 5px}.el-upload-cover__title{position:absolute;bottom:0;left:0;background-color:#fff;height:36px;width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-weight:400;text-align:left;padding:0 10px;margin:0;line-height:36px;font-size:14px;color:var(--el-text-color-primary)}.el-upload-cover+.el-upload__inner{opacity:0;position:relative;z-index:1}.el-vl__wrapper{position:relative}.el-vl__wrapper:hover .el-virtual-scrollbar,.el-vl__wrapper.always-on .el-virtual-scrollbar{opacity:1}.el-vl__window{scrollbar-width:none}.el-vl__window::-webkit-scrollbar{display:none}.el-virtual-scrollbar{opacity:0;transition:opacity .34s ease-out}.el-virtual-scrollbar.always-on{opacity:1}.el-vg__wrapper{position:relative}.el-popper{--el-popper-border-radius:var(--el-popover-border-radius, 4px)}.el-popper{position:absolute;border-radius:var(--el-popper-border-radius);padding:5px 11px;z-index:2000;font-size:12px;line-height:20px;min-width:10px;word-wrap:break-word;visibility:visible}.el-popper.is-dark{color:var(--el-bg-color);background:var(--el-text-color-primary);border:1px solid var(--el-text-color-primary)}.el-popper.is-dark .el-popper__arrow:before{border:1px solid var(--el-text-color-primary);background:var(--el-text-color-primary);right:0}.el-popper.is-light{background:var(--el-bg-color-overlay);border:1px solid var(--el-border-color-light)}.el-popper.is-light .el-popper__arrow:before{border:1px solid var(--el-border-color-light);background:var(--el-bg-color-overlay);right:0}.el-popper.is-pure{padding:0}.el-popper__arrow{position:absolute;width:10px;height:10px;z-index:-1}.el-popper__arrow:before{position:absolute;width:10px;height:10px;z-index:-1;content:" ";transform:rotate(45deg);background:var(--el-text-color-primary);box-sizing:border-box}.el-popper[data-popper-placement^=top]>.el-popper__arrow{bottom:-5px}.el-popper[data-popper-placement^=top]>.el-popper__arrow:before{border-bottom-right-radius:2px}.el-popper[data-popper-placement^=bottom]>.el-popper__arrow{top:-5px}.el-popper[data-popper-placement^=bottom]>.el-popper__arrow:before{border-top-left-radius:2px}.el-popper[data-popper-placement^=left]>.el-popper__arrow{right:-5px}.el-popper[data-popper-placement^=left]>.el-popper__arrow:before{border-top-right-radius:2px}.el-popper[data-popper-placement^=right]>.el-popper__arrow{left:-5px}.el-popper[data-popper-placement^=right]>.el-popper__arrow:before{border-bottom-left-radius:2px}.el-popper[data-popper-placement^=top] .el-popper__arrow:before{border-top-color:transparent!important;border-left-color:transparent!important}.el-popper[data-popper-placement^=bottom] .el-popper__arrow:before{border-bottom-color:transparent!important;border-right-color:transparent!important}.el-popper[data-popper-placement^=left] .el-popper__arrow:before{border-left-color:transparent!important;border-bottom-color:transparent!important}.el-popper[data-popper-placement^=right] .el-popper__arrow:before{border-right-color:transparent!important;border-top-color:transparent!important}.el-select-dropdown__item{font-size:var(--el-font-size-base);padding:0 32px 0 20px;position:relative;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;color:var(--el-text-color-regular);height:34px;line-height:34px;box-sizing:border-box;cursor:pointer}.el-select-dropdown__item.is-disabled{color:var(--el-text-color-placeholder);cursor:not-allowed}.el-select-dropdown__item.hover,.el-select-dropdown__item:hover{background-color:var(--el-fill-color-light)}.el-select-dropdown__item.selected{color:var(--el-color-primary);font-weight:700}.el-statistic{--el-statistic-title-font-weight:400;--el-statistic-title-font-size:var(--el-font-size-extra-small);--el-statistic-title-color:var(--el-text-color-regular);--el-statistic-content-font-weight:400;--el-statistic-content-font-size:var(--el-font-size-extra-large);--el-statistic-content-color:var(--el-text-color-primary)}.el-statistic__head{font-weight:var(--el-statistic-title-font-weight);font-size:var(--el-statistic-title-font-size);color:var(--el-statistic-title-color);line-height:20px;margin-bottom:4px}.el-statistic__content{font-weight:var(--el-statistic-content-font-weight);font-size:var(--el-statistic-content-font-size);color:var(--el-statistic-content-color)}.el-statistic__value{display:inline-block}.el-statistic__prefix{margin-right:4px;display:inline-block}.el-statistic__suffix{margin-left:4px;display:inline-block}.el-button{height:32rem!important;padding:8rem 15rem!important;font-size:14rem!important}.el-input__wrapper{padding:1rem 11rem!important}.el-input{height:32rem!important;font-size:14rem!important}.el-input-number{line-height:30rem!important;width:150rem}.el-input-number__decrease,.el-input-number__increase{top:1rem!important;bottom:1rem!important;width:32rem!important;font-size:13rem!important;background-color:#409eff}.jt-drawing-row .col-left{font-size:14rem!important}.el-color-picker__trigger{height:32rem!important;padding:4rem!important}.el-radio-button__inner{padding:8rem 15rem!important;font-size:14rem}.el-textarea__inner{padding:5rem 11rem!important;font-size:14rem}.el-input__inner{height:32rem!important;font-size:14rem!important}.el-scrollbar{color:#fff!important;background-color:#052d73!important;overflow:visible!important}.jt-drawing-row{display:flex;flex-direction:row;height:40rem;align-items:center}.jt-drawing-row .col-left{display:flex;align-items:center;justify-content:right;width:60rem;font-family:Alimama_ShuHeiTi_Bold;font-weight:700;margin-right:8rem}.jt-drawing-row .col-main{flex:1;display:flex;flex-direction:row}.jt-drawing-row .col-main .el-input--suffix{background-color:#fff0}.jt-drawing-row .col-main .el-input--suffix *{background-color:#fff0;color:#fff}.jt-drawing-row .col-main .el-input-number__decrease,.jt-drawing-row .col-main .el-input-number__increase{background-color:#409eff;color:#fff}.jt-drawing-dialog{pointer-events:none}.jt-drawing-dialog .el-dialog{pointer-events:auto;position:absolute!important;background:rgba(5,45,155,.7);min-width:280rem;overflow:hidden;left:10rem;background:rgba(0,44,126,.68);height:calc(100% - 175rem);width:180rem;top:125rem;margin-top:0rem}.jt-drawing-dialog .el-dialog .el-dialog__header{background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAAyCAIAAAD9fhrKAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA3ZpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuNi1jMTQ1IDc5LjE2MzQ5OSwgMjAxOC8wOC8xMy0xNjo0MDoyMiAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wTU09Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9tbS8iIHhtbG5zOnN0UmVmPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvc1R5cGUvUmVzb3VyY2VSZWYjIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtcE1NOk9yaWdpbmFsRG9jdW1lbnRJRD0ieG1wLmRpZDo4NTc1YTY2Yi1hY2U5LTUyNDctODM5MS01MGJjMjM4MDkxMDkiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6RDY4MTUxMzk2RDM1MTFFRDkzM0JDNEQ5N0IwQTIxRjYiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6RDY4MTUxMzg2RDM1MTFFRDkzM0JDNEQ5N0IwQTIxRjYiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENDIDIwMTkgKFdpbmRvd3MpIj4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6YjZlNTUzODYtMzRjZC02NDQyLWI4OTktODY4YTdiYTNkMzgyIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjg1NzVhNjZiLWFjZTktNTI0Ny04MzkxLTUwYmMyMzgwOTEwOSIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Po+VQtwAACdUSURBVHja7H1bluM4kiUMfEjuHpFZtY4+/TGLmQ3MmTMbnf1MdUX6QyIJ2MAAAjC8+JB7ZHZXh7LKQ6IoECSBy2sXFwb4/X/+X2FfEqDv5dh35mXeC+k2CzD/+XfxL72BeVbv04KI7uP6ByD7pZTy6ToMnUTwv3f7rgWG/cNXrhz7AcVtUfOiwP/kOg6mLGRVoq1JUewjsAoLWJQ2RdlTg7CD+y+eJW3MziVU1dfK/wV2LIhXJpQJ/nQhOUFWWxDJRYjnwnfItkB2Z8w/yC7sr9fnXpj8Y/9d27hw/2D4zm/0/4V92EcRtq+bMP9J+AX98UdadxN8oy/D/tXdBeWAvsBQM7/FvwklxzemJ0xyfrflu6JG1T+Hc1mrhKEA/wfTQ9BfAD119x9Ca2R1ZjuEqwdq/Kb7C9vO3oQzZJ9AKdAzqDuoGVC5r3r3j8Gp62XoJaT9g3WBDK3crwwIdfB+mxUmyJP0HXNGAj/uM1zNQWTs8MChMOvJEQYMuDxdepBAQGM7810t2MHIioItnEqwbOx66GBadMSXHHQiCgBHFmDV8h+rJcQPEUaLk+WIFi5YDnyQXPoUs0R+oyTfEWvdkKFaskPYju0t1RLCDrxM/luoHejIm+0qbZ9g6+P2/snOBWDRQVPAggLOgMEBFRh7PoY+DPaJvUIYIvjeb3eG9b39tH6zFoL0Q9eHzVt6A1qOKMdYE7cD+lsBDCtdya7B2QINBEj1YZqMxSAwIKL7J3DVdI0WHbWgY4HdyIp2Z7d+lvreTa+hfHep/M/ZhZS9Gr7pbthqXsmtsdXpepS9MHXTi5xf5XIzX3XXf/tfBkmer2MHkPKdGr0SOckyXGzoO60IYIGBUcEdYFZKSuikFMBLT7pxQprYwXrifAZwtfto3pi9bVEcXVKSVcKtPYT5lSnMlOAaQMKKUobEv2UXF9a7kx4vbkRWnGsxAKxnAIRnrPAtg9FFYM8l93Pg/YA9A31zZCeJfOOBv3znykOv2KG6W/YVpu+xtlHUjlvWXGzu3Dqd6rflx/ZRkH+0vEFofssYCXAbtSNB7O6gxylGfNhRGFFJOdT6jbbFR4jEcHa4EqKrlkOsD2LKs2J9AlGKdVtucv4I9TdQpftrrH88BUSO3QVHI7RaboRWiJW7zy+zoW/jd4Ie0b472y+Q2F+AwHXuXv79f39/GiHr3pCgXQpSxaMeYOx7cxYGBHIKkHIKQhxJ6MOimxQI25jVdWBCy0Up941DSE4JAfKQtUURDcqawrT21YUUnVHkUVoJfByheE0DCGLysIiwkiEX6zwZctkHb3JHofU0ivee7aJx/QoxOTT6b2OVMCmE/0RU0SctOfsqnOz6rS9KszI5Umh2dJHWNjsFXSsw+7nIcCEtKuys2VfILxcWwIf8TdGrI3wxQpQHU/zi5JEjD8HWclhMxX4ecMHgi4ZesOgyBGsZWokCrWD5kPM9otXwbOLK9OphesYiOWvWFA3qddNbivHFc81iq7r8ZrrvJ2Jz/zjuRqnuvQm46rtmsFO0Yaql4w7U4fH5YuJD+JiWsB3Dj9HRYdp0J81LGE7nySMmPZfxflbAemw6wGW42RLMj+bZHEtcL1145NmiPEMWGKmNAwOMkYchZyaenRYiWmgpLx0xcGfXrjwXdMw5xSG/3ZJ/5LKXa0D++I4+R9gKVwwtuVrpNzj6HS7syt/Fuj+E5ghJAAblHeFxG2rhzyWNfgRrZ2HPNDDCVjQm2P4ltPk9kZUfRRmssXRMgzGIhftL7zdCpBuClYxYi02LC7KWwK+JSH4Yj5tEhZiyjLwfBaiq4lSKGonKgzUBK5xdQr5C9wfT/5HCfx5vJhcRkQtYKVrN77BMnjtJPT5pGHK4LCCKHSBidDe/rzQt2S+7CEINL4bBsX7XiNURcTdot5/18NIPXVfiFK8GNB/tGZYhiWBSvt/n8gnN7+9kEccCJSSH4Ai4fsG+stU3BzDI+OEPMS/K7GXgz0foAf6wgVkiYIkJMk2F7/NimBayADDClrZIJDCHLUQBGTdCcKAsPXcKWqODsqABuJPFJApGpx+sskHE20jmINK6KFuAbxvgmR2cCoTE3le5KAoeODNymG7ZKP/IcbdjNrEZTmzVfzMaySEojcE3QeokTnEoYVCFCSxGAT4e3uCU7i/oxMokDCzQKq8MFeTRyv1OquEZoU/pURFgisp1oFhnfiWaxgYCkkEGH8SZMJDi1kBadlvEEcol+x6q4tQ2TwMGw8ClHzF2snu6vN0nFx4mwOUAyILQNNPY4tN1WKUeKDAr/Cj/Cg3QPBnMmhxm4bKoD1PUSML8SmcCZmCmC+dUCwizumlWobYFbEWUs3o8psoXijTeElqsCBeCVE+4wFcEIQsVg9IZNC3hyZhgI7AY1LUVv9KWFJhM/SZioY23iHN1O6bsJGd2lS1VZra/AzY0/HatTsQXG6Vl75MOhoySNjhIHlCzvq6xxMEmVCXH4sSms9wKMmLFeA0bHMxEK9Nl5jehZrEerTM8BUHmaIU5WvHzCvWW06u0NC2pJSZohXJQw3eUXfOZggX1wYMwhn1xU2EfqjZfHYhv1/F9MhGbZjw9xIkrAM0GJG6zoUs5ZhUHRR+PhWCKMGscDDlaNPUUgzcf9+V6IUVLJFSLUSp+ahC3m/9f+v6+UHDoQ9EYCAewWu81rILXyrY4cYMkdHfEyjNNYONMPOLDVd3L1MqVeWGmSqVgiyJ1j2AYptSYtACA2Haz94jN1gOprhSLFbEThhIAErkEIO7TIkOhwPA3+6EQ9cNhUUnEdAvW+0A4SnYdmCiZGhdwHfZCkTMpjlDZD9t8KtlFp+4ATNSuyJjcc1T2KC/rOGQmtIs04uc7uC+0MtxK6GVFFei14VY0QFiEfZipdpiVCajl/RXU1Azi7DaS2HoCRNzlVOmFzTt949XvwlMlKqzoWYnqZIDjZRxvcrkZJiWYkuUwa90NDUi836fn67h2X4dZWHKi+JMANJIMWf1tMphlbj4obTFr7GjokGNSEo95LMIUtgAvfTct2haFERQgYAF6FuMxCDzaoR+rDvQOfIQc+6Af0XaCFPjWYDvV+pEPVmCizfvxv3DqfqgA07sb9sRjARdgfVS/UoLHR31svBBwn/aHa8WPlf8Q07rh1pM6KZBHytXSMB1cx1z+YnQoFYOygQjMhB6RGaZ4ed6jkIRgmuNUihYrWg0erdoxYM7+AlotFAnqZQUxOej+2QNfDa0QK5aOiFZ/gKVp6eGTM9Xjt5UJihpdrYfsFbjKHxWHAAtqStYeyUKv0Zj+dB36DoCcpVHAQd+DV2xaFnz7mEyIZ5AmpeWV2DCQHS8rCcOzDGaZkI7uDmEW6Vl2FBIjI8mU+IxFetgiRZ94n2LUA1Cu5peAm8IjUgA17nnx7qqIXLGXeG0fU9sHYm5eozMNJg9kmldiOsn516qC4TGjS/JgwEQWxYY0iqWqDbVYK2tnpddKJPeCl4O1nbG0TImKmSyOdWJxUuXZ8aFMVp9Ej6/7G3MWUIv4ivFELH7H+UsyIBf0b3qZzt8NmPC1TaiKLlZBZkuDVqjWAcFuxP4pRSseyWJlWNAfjmxQ0ysQTcvFdX6t1OW3fMyxQZ8OhO/YstLtM6xtLEuCAshgEkcDWXbo0KBJMnDDBHIb0M3Xceh7mQwacg0+CEAx1lsDNYN1Xn2nb2/3ZRz70WEWRHaUR4jZaVgY6SU5/KdZRRjSvDH7wUR/wyCQJe/bWI9WQ66oka8RIUMAiD67YDFksV6ira3UD6E+BhLHBDBvIomCE4Ij1vigaFbY3hh/y0+zRLBsH5Ect8nUjo0MZKcTY3NMj4gN8QsTXplrzFgPUhKvQC42p0JVWVobpxjbWiFNWrOVzmkIYhEAZo4EZw1dPhC1R6sLmv8hVAc9c90qPTUTA8r5DbQSVZP/GjF1epXYGSVtaZen4WsHsA4oVbgl0kc6Zv8MUkrrRZiUghSzwqGUJiv8FXuac4NxxKuCWVl4aPe72LlE93mxCIP3aca+uww976xHYMsAUkeeMhMeLkyLYtw1nUyUMAQdmVGIFpPBO0g4R2YchsTXtQ5HYsmngY0JZJxLeDK4WiYgC+fdxvVvwTggMW/7UNmF6aLYjuxYfh+Moj/E5p55rzBy8Ky1MLkwfw85ugh+UrGqaRzBL0V5IhBHNzBUOF6ZFmxhJU5JFHRRM3ChyKV0kUlOLFa0rZogBvpV6joCVWzqDCw3WO4GrcRqtnrScvScvDaMkGIU307AZ2mawIo1awW6/qJ6O+aYjH4WV6+lTNQC9w0w6wvqdHjcBWqerHwECq0MDzS9ZobJYgp3ZoEnSuZBcrPB42iBJlItZM5xfmUhkhZYA7r+Ns3OFzUtNPPIY9YGbHE6sApMvZ1UeafpRrhq2SH049okePiARMLw4lIAL2+CwGAYxSihQxwKTQbbgJ011EZTEmoAcVQxzo7wY4eiFo1gHtIhYh7YAVblTxRYcehAnYwgYJPwM+kzfx/tEsmbvLbpr4oZfuifDeysoer+wvwnDfE3g5u8f2Y6OvPclsyljPKCkkWRoOhyt0DFXZXSGdcXlg+DVqFwsi/IIYw9J7/dGBB0bUfdOppvqEVuTGWiVfesB6ptKwKsq1e1GL3p0jrAsKLWzW9wLmPhASeE35nG9WiqItzmmd/LBLNMQDfRCRPQ+EaZ+rASfYYNLNJbwiwraaEdXnHOCRNpMmBKzYIJT0oIlzWoyvuiHacOdxWCuB4mzMTJW4nOFWLGCF7pYBRzKXD+hWGnAsICPEM6oue9W7w34THCvTHf5SxZx5PbDz5Rsb3bkXrioYd2qz6lnbIYjShoVKmgi9b0acyIp30nSbSGrjL8V8BNIue75mDYkJoCoBDxkSNW5nLvo5UkT/yHcEpO6hwL2K/6b6K/rA6JClDhgYaHVVfABnj1BzlU3XNQkqzcDRBVGYrdCFTgY55pvJYZHSJh0po8oQ5ooPSOlkJLgAp6axDxeumtFZ5uyETWCXwaRyjHgJyzPM4ByglXJ+DSy7stAeIMU4xhIvg5oOEmQp6IghEBhBBCCREjx/wWOgTiJ4pMiq8RaEgTNZz1JW37m6pTnOEMhMGmEWx746PGmkdk2WzAZ2e0HUuUryBUVfAqQS3wF9nbSLDjc4MqlIr7DxjsyOkN1OIIEUppw7Qh82okgSd/yKVfyflNqpufv5Wq7KsPVSJNZh7Z3Kl8TAL3BpMfe/WfuvEbnsAc19ZJ3yOZ4ccPa9bkGBSAyZIjUtBX/3qCSpXRw2yH3lK526Jc+cus3jWNQoJzfmKpH6/IVRAuh1n95CxagkndGI0O6wgiJBHOqnuDV6OK0EzkdlAGupzeBh7lpHRZPLggxqxRAn+AFlV9KgcF8W0sOGhiP96yP9no8djVEJsUoKQPmDHcAqRSllZKQuQ5IPtCJ1JOk5ujcs+XC9A0KU1q9o/VTnWJqFSyqhaxstbQN7ncc6s741ZU1eEbTWbG2nAg7t2kDXp1GrCSYReoh4TbjyYW9jByxNUW4kHP43BfFhqP416H4KhEpOk7Gp+crbROtZpsy7C4a9/d7Pij2dcAzjtSUVIyACiTiTCsCFFXZxX9SSwmvgRgNIrxRwZegXn5CxbAy2teXCjn/IsBNwsMRRxQDUOWaazPGJmom+MqTKe1s6i5FHaHXDAxdjSfZAefbdtjO9sqRHV/qPgudmgjxqmKUNGxMm6CdUcRZrQMc5BiGKENBHQOrbASVWFuSk06vFYWrRYvufc2Euwy2wH3WGEWikZzAxVl0UpkM28i3HVXbcvPoRMrcWc9Kj/+9Dnnwzry5IQ2Zomq+LXyF8KUwZAheZ/mKOMB8PDQORWeiJJBMhWw9D2kwz8UgUthMOtu0MoG4d450TtbaUKpMoWLcS53LHPwsTO332b+g6hkIRTBMpefgcdqq8GCtTsoc/ghcNMApn6FypjgCvIC6mmudjnLKennBCU5ecQjT1k8+ZOW4HWcNmI+Oo9lbFUFstT/WTHxYq4cYTcSt0KZKWIlXytN8zZRFFlDPfe5rBK4LghdVgBmDIuK6pwEJnJraMA7pMnMV+2n9TTQCnG/gT3Ok0+EhFsToUVNzCoHiZidU4LBLJK0bjQrMEkesMIWwEqOKAuqDIbPQoxnT1X2OLVW+O4+WS+ozWxDVvih7zvws5UxyWNTm0kQQjea9oNioudYbpVKfVJ8XF9wR3Uy5TKQMiZrMU9DRClg4335nYYGSgFUmkU546r8Nkxtyaa5ZGUC7Nz96v6t7aIyKbV+lPIn6cDpVgnVw7X2wdzqpetDXylyYdkVOWyl7CiOsl3IyM5mHdVxKnMMrKN4s1wMWik/zc9wn6sFvtKBgQW3S6bjmKI6MlstCUtMJHZJLvZ+jLkLt9Fq+/nBc5N8FrCwkavveGBYbC80+FWutvP4ZCfHt/uEGvPgyB5LUeIr7CqD+QXbKgY3zR+DiQagboasadPs1IfWhmcNfZdoWJlchKkRwu9mqJ6JESfL+9bWHow/btoKBPk+72+BOsYLBd51EHP9CZ6lETMuloBYDIErwyDVprDdPrI5vVgkOWq9P/IIPVjO9semovRogYjtjRW2VSFVWCN+WAwL5mN03BNwNWhFG3RuW03izAwf3SieJoeUWHO6CdU/CWlzOeRDmY0AUGS2We2Cyhx2HHEzR7v8roNoVUrseKxl7KpX+ABgcR4koFQNEsxqznfnuVFCT8x+yNKzZVZk5hd9smb5vDLMLs/dAbnt3v4ldjarkAQFsOEVcbmrWrTL/mS0ye7vk4rPniwNRGqPggihMXrlwI18HDAHKEhd2lAMswtRptvHhgiFNcnpSBIF3EztUOYthk0hbEM/2tCnWukcoK277Ra7e5VEKyVKYbMSMQNaBZ5SM0FoDXp4sjmOM3cw1jTskrqhz4bqDi0RHPepCVVZYIiVM6P8CuPzmuU9y7EVjG8t/MdCad/RCo6hFZ4OCc8PIO8NG5eYdZvUnXIuhPAoWpjJDHXpx76LFwViGJVJrPlIov/e8CE7P9qlVKYg0TCudlDJ8CZNehXwC8Is1liLkGwP02uHmIOsiIlmipCk9HGJIidpYV/AChAkOUiTjIgs711mCYN0lLNIQ1oLlwW3rSTWxNp2URwUoTEqB7VsL1D0lXTkBCE95W37FbsgmOUmbJAsgaK0QebyFFZOByu2hyhKlOGeaKf6ZMRHw4D9C9lEcTE8S06vujcIOKSzeEoZqyqHU0NE+YSDpDmD2WIZ1K5VN/3Q3RNl46tEvXhC2dyXT/FhDasJPznuiE2exakWwywT6H3cab5OktvXN8K+k7Q6Tj4jmvdkyJNGBsnMZz2YFj3Ns7K4YOK5y2BFdxS5vsZM862Hc8gX6JKUQvZcTrCWJXthaQCAz5CJxApZsIciW0YIc7isdKZKVFjLebCT/a6aL6GWGXd3GgXUdJzyPWw0zloNoWa5Fzmgi329t9WxzgUplVwCmOdbqIANf5Dod+gvdtLMBkhhbXzAcy8YoAfKdaUXsUw03a9/CtOPMZsSVD/v5DsNF4NZ3fSHsGJWUn2tpDIHUoRZ0InD8nqJ4J/0pRxjWHjU0d4IHDDDLEN8XJaFJE+m7+WDW8JnYzA7S7fHx/j80/U2zwawHFEywHexqSO22l8ZWjKVyZRzV2omHwYKkSZ9BagkFUe+gg3E7HcpdeISdAWReQIErmQlEnLE3Gya3iMv/MS3x/cR5+1U+BPK3H7I46Z81p6+k/OxQujxd3ghkVsqaxaVB0Eqe2Bo0RHPwndKqqdMgW+yWwwVQoBK1dpQxeynvRq/Ww/qvWCUKOcPA4uqt8FsKwzcGhHG/cv+IGDt+WgSHf3Qz6O6ZEiKiQSVc/1DYByr/D0OPVkZoKmF1YplUAVonjS3ZVkIXOzSXkN3GX1i1Wpa8SQzShYJWkVT4X1Wi8s8k156nhVUlOv1IE+7VxqF0gm5KVEFwGRr1jSgblKqDMtycnTKCYXHrOdiM4dnS9jaaGDbrvcjVqwjRxENh1ruvMIkC01xZXErCMIKVPGWa5q+fpdEW+J0nJyLYK3HJ8I5YRaSt/2D0vVpO25oMCtbpWYTp/hhNPQ4fpMTgLpVfrvcpV7IimXqvE2jTyVmOOxceSQkPB0bhmtheMq83OcF+SoyEH95HbqrAxcshr22YCsSk2XBm4nc1LryoCnQzabO5ihB3gqbwa8piuA1DCqloniZHymP5yCBLpHYqlBUkoqKQn7HjTpCNjdxe07fWSfU2TmJu213e4mn4673I/U5mPm9PtbHODSyYBObqCU2+EbT1uCm/N0Is9zKXfVflzJ/VhqgzczXLR/W9X4HpZUT9RvCXAlVKcBKZTBr7uJiq5we6MWEjdrAljkEdIemamJtXtmW2vDJkPAx3T0Fl0Vpw1MmZ78sVFiyTQ09raZTldghs97Uqzk5CV+vdIfQqu8SjZytiZPKQ9kzdd3bxICGrPFlXIJ7NZtIA4xUlY2YLQ+RZrKCjWud5bfL3sY1Lb4+KPr1arCPkvI0o5qG36IeFS0zmIDOhFrdRbQTrOLm0hhIijjYbDAa1NQh6U0GB7cEsupEGj+mQY55w9+Wd9TlUdFimbKu92FniAPxAUf7YwyrETqJzdiwHCo2UKJMGOgn5XGvlX3XSfl06Ya+q1A2n4evrulCSMsviLstyolWPZBoZTX7QqHHVB1PleCgYZmazospcEGsqeDFslIY85pm05DrRIyFnGno1zDBQf4M2EjP8cCz5fO9G35m+X8BWNXPBkUtrKqB3J7PO0cKraV+050yoda6jncp7Vdni7LPWl7FADC909ChWqR+FR3BFgpZ54QNW1l4q4dn4hKL85TmR5XLjXyS4zMdt41Wpy82PgBYZ6bLb9vfHZTcbLKXPGSyb/uOsmX1UlbCTN4OIGUUTJNSdIh5nZloE4f6RMkF2c2MEal2HhoIha6TmgMZLBJyYmEyh4L05USswqegGjnklzcTs1p3B44/sHiEA5sL11eZelWmqu5/ZK345orxj76gfeiNyYQHw0aWB34/LK3pXFk3jhEomKck6HehFeUyZpLWIe+431XDKAbZza+gZ1vgm9XI7OzCwzjFi9X9BcDZHWZRRA9mY3f/Q/SuzrIJzQcHOg60gv44MLW+qpMsu4lWxpkWytvX8JTaAUGPVjG/diW3ZKbVBPVn1vo+LbNPwWxiwKdxoOmH22pXJtUzVFpIYrcqmEi9YZgDZco+sSRighsgdtOmQyaOQ1yTFFpaSQZtojqvqJiXgmxjdVXBZHSKz9sJBB8gtka2Q2Uwvz2T50S2qnLWULtwTGtbXTMxmdBbu0QHKMF2KpVKYFjrnLEeIafVTSpF4Vg3tPVEbFaHWkuvhu9SvIKdxgzzh8EsNbxg1MiwyYGwgriUV/7yrfNDh8U56lXS6l+i0i+OORjw6ODgkZDwXARQMqN50WsamYokj26yyxNN0gOBVb26mNaTA6JBFn2b5yBaDUP/vGr2KAAqFxfaiqmFuHnSVgXLGBmnL1AfWhJ1CzqKRk2iEgk5LysXXqjhWnEfYGM2S2aPxWxNp222EYxumoVFNYnmgUlBTQ5X3DinJCazTnGr8Gq1N/bE0hNbUiRo3sdC1cYd6G3zOJrZp/6gUIskLWhL+yV8+V1BquGbFNKuz2xiECdpvawZrNp8qv7coL49WLuDlMtH9daa7WCo3PBijWAHiBUbADuFWUcWoajj04aehda78GHgJNONg2nIoNXQPV+GZtNOO3nJuQykGGL1MS1hcayL9UM0L3uJGmn9tc3DdbNJnKHiVQ2F5E0tXdXmKJAxRoQbD+forirjTcECT8RzefV2Ap9jfOin6UWHdI1Thi98qFolHOoDkCRaeYLZt43RRr4GDS2r1S+pAlU3SDTwizALSYanoUOhlFR/iOHJurTkgcGFgsFBZzCLlkxf3vMUo+tk7KnTCw7fRHfRZXh4JBh8XMP6xEtR1lCS2JM6MBphut86ILg1fQxbQGPAS9tI826Xt6GpmTZpHy2fkyQ2SDt5uawmbx2UnXmenQoGdcjn+dmrpyYKrYy5w6pcCXfVQww+1a2ui4fUzUPyT4KPWJH095+HrX2SpSK+6JWtT5EVDnztyXz1sc9VBvER2N0FiLRYks8NBHQ81MJ2eZVy7EKE0i57o0mUn96sDP9sC9yoRusj0JLOVOA7CFXjerq7/9DDM5Dj4euxZQ+wiuG8xrfxtVjX0ryoFiOTkhZtNvRquxwhapqXAxdafpXSgLrfdlIaptb3sBHrVfwB7GLPBH8+dG3oDlUU8ws0ayhWOcuJD1ak5nwAYaOVAx7puzvi44EYP1mlAo49Dzf2Sd2bmKX4hXOaQ6N1NNa/SD+2ltIol7eoD0VUq3cojT3iQcirajqmdvNdmqZpuJKVtHD7oVWNU8nZAHJ6FZp6JSzW9jW+RNvXSdg1oSUtezC/0lhkRfgSNkWXUiNTzeoaIB5F+UcZViM29AIQpa8yYaBuNva+k08XP0Nwo6OCaA032MWi55CfyBT4fLVzbtLHbHuIh0MYwYC13S+6EbXBtk4BqbyYS0pBs2jEKNC8SblJO2eLmyu+PUZfHo65Ho7IPj8N6EvqeTz7YO74PXB8bPbJ0k5fy6jlJS39TxPf6f4iBGzDU7XZazni+BuN9Nn8fLTU4E0Jg1mmQISj15P7J8iaL+X0B+i53oDVvbstNoXWRZTDcY+ilXl1f/8f/+fQo7uJJS60x2kitEJs7mxw6sUm/dwOglrfart41/stHsKU9Xwdu2q0DBUqlNeZbPcktCFurrN4dBvDISzoVmNqFWD726zc/6KWpn/JF+7lLMd16cA85MS2nrWj5KAd8gM78bg+utLy2fuZ0pI4GhkdLM8y4aG6U5sysSHA+cCWfPVCjiZidQXW+og5xI26nuxESFL6uQcPoDobZ1biN7cManQtFVWg8bu+f74OsL1OQftbskcEp5WdczN23ZMpsFS7anythHMT0X9MNDs616NKqo9Qj4ZbQNZSlPJhr4biDq1blYW3B7D+1+vLEOpAXFwfIdWPcMSGhEQ5ZPSC/bOQ/S5C1YLNTo2/CfFKsw4tdJKkZYf2cr3piOuV3O4dXn43PIsvWpH92ESOAhfdf3My3Ofly/7Q5awjEdgw0MRok9bYCusMulyG7skPCDYDt3ZU6MJA5Z1WNk9p/3Tpd5577eeGKertvkTRih0RK1DUQKeaAoV7UAK7T+m6hgWNFAK/wOunw9ODPOtIqZtTqutaLrm0KNQK8hCeOwtSzUnSIncCtX/rVl/U5TdaE0wcwqm0E0h1+V3AD1OOKNF5lbToEHr8rkiGg58PWO1TuM+LgZKNLiMNWo1+hmBDmm3mXLZ/5sVFmhgKvI6DHRDc66hY84zbRXTephmx6kwvbnViJoQWfxQbcJaVcyYchlN949c8wv9UyIbtBz9ugtg2sKGVtG7/VG15aLcyZHcgBeqN1qAn3jH3t3+o4beiQDzYuAxxQ+i6+U20GKVe5O0fOH5HK379fMAqerehVB/TdPcpXCrhonMbXNIBwRZXrSEXUk6r5WOKgNjR+mDjMMidltFAAeu0IutWGcU14WKbaycCaGvZLAH7I0rH0O0Xk/oLkQmOjR5ud/At/wmeePCg6u7/BPWih+fcVAWHRjN090wJv0k1t92B7Aj/Afgtc2kdfwiauJLmBJsCUbVmi6+G+PEFoXv4Qds/cO9MMPV2CzFarmqtKUMNuDiJ/fgQNUMujWiIVZgeKOyA4MuVkqrvx0Glux1dgtPZ5oqAY0/JDZ0bjksHtWRKsF3j3Zw+p3EL/nT+Be2nAB77yfbHLyz50PXBnbykR4ZNTtPhHdGAco3ioofvO/2/UQwlDrx0BviEXjkBTK/QKcwA5ThmUYYs2U0/nN2hqunZZX4mikDlg+HhOcBy67+/TxPiltA1kNvAgstDUsuiVHRa2V/0fWfQSsIBbKrdYFLBDMLyyR01negw48cDJwJnpIttgBON9RK+WpT5E4Kl40s6f2YtQnGyKPyiM8SvukxHi5LLfVWgilTLW304TAQ1+HT5m7z/sHYHl4Dhw3Audflet1Dt1Ra7UV3/1q0FNhq4XvqPf5hDGDb3AGYdsDUEBEVhSArFaLglKhta9e3pIuWBqtQggjSmSN/sgODQPz8NUC5ceuxKzrZAvfEQ3C0Pzj8K4Iv3+/X6VxK4HgG4RgMGJIOCgRo7DAe7vy3GwIHyMZh/9ZIUCJ1N8ACn6k9eDvJPXIJ/onWSZKqgSSrDqc51wtagNL7ZjFZ5XdOEwmPfv1yHo1ZlzMWg+7x8cBUf8DoOmWZfzrHYuMW3UOCGnWo/1sDTcIYPNesvgK9treVsOAQNEotbttctblhmkoF2lpvqQbEotrry9cEz/dLkNp9nsrsOr/p2bSM7ZdNXPZDREdZJgiG/KGlk/yHwe1lgC6dSEHRDh3/YqddNKmoN8bMaf09yPHw+JAwkBbGd2Mx2WwMuT2N/JlqL+66L6Ni5x2FlwKeLHRA8pnyVtz5RwfCEHHTunuNJV+fGI+ULYjc8GZKd9ZufNdTjsXL2AkKopk/HM+e1a4v8OZHzTxjhrfq27OQb63h4SIFyQ4edKcRXuLOSfCwQT/Q+KnAFwbfqLBGPlHN/+39qLAYoHwYscwjDULKZzOVOkiT2YV1DsFlSs0KLxne7LkVS4MXEgg+OgCbzDc83lyPmg0+kJv6ijgH/ncLJv9C0keXi+vk1x0eLIlOVVqcVqKD59M800nf/4ewOlgRZSWv8LSvwoP/TgmDfTT/EhoHWDVDqFzV+O4JZWxqWpjAwGaqrXyYJ3wy56rozcU3cycSZbx+TinmjaT7zt6dLZRJPK85IX4YPvt5mrfVfoBnBA/X9RB8+wjAOrb/0ic6En/7JLh3ELzovPEDpML28eIC2HrsAcNa39VgDjApU/0AtDb5gdwE1gYeYtUDZafkIcbMFDrBMsIn1JjaUlJdiFJsuLVrStQVY86JfOetpMbSuDS4HOqjhbm+3iZ/KYDX7TsJDV4eSZL3f5p+COn8F0ok9XefX68+hd3AcVfBPq1TzK5rEBwI3nOXtBTpJNe+vJJmjih1ruQk3G/GBChr07A0IzrA5UcmAEc2XlP0G1DZF948pEb9bL0OrXi4jwIFLCnWN6e5EK7/rZbBTDh+6gYaivVNSK/VpFMIvw5gvPSb+Jf3i1+vPu9rngHEn7pleBU2I+W3XWV7JvQNyuf7eTa8kw4e4Z/pheJAev+8UiHWepa5/l5OdwbNNoG7/EON3sqG2GFK5JI9hKNOidq8IgctlAHjksUPB5n3KNKansb9eBmhGyFsAobNBzPI3B1dmgD+hDVeHun69/lWZGZ4Zf8RzrW+zYC9p/a7lA1owOFGJZi/HAp1L63e3pMU5LyBITVOvIUmyXFWpbNYaC7WVAcr/L8AA+dSd3OMf2BsAAAAASUVORK5CYII=) no-repeat;background-size:100%;margin-right:0rem;padding:6rem;text-align:center}.jt-drawing-dialog .el-dialog .el-dialog__headerbtn{height:34rem}.jt-drawing-dialog .el-dialog .content{height:calc(100% - 120rem);width:92%;overflow-y:auto;padding:5rem 0 0;position:absolute}.jt-drawing-dialog .el-dialog .el-collapse{--el-collapse-border-color: rgb(0 44 126 / 0%);--el-collapse-header-text-color: #ffffff;--el-collapse-header-font-size: 13rem;--el-collapse-content-bg-color: rgb(0 44 126 / 0%);--el-collapse-content-font-size: 13rem;--el-collapse-content-text-color: rgb(216 240 255);--el-collapse-header-height: 40rem;--el-collapse-header-bg-color: rgb(30 130 255)}.jt-drawing-dialog .el-dialog .el-collapse .el-collapse-item__header{background-color:#409eff;border-bottom:2px solid rgb(22,90,190)}.jt-drawing-dialog .el-dialog .el-collapse .el-collapse-item__content{padding:10rem}.jt-drawing-dialog .el-dialog .el-dialog__body{padding:10rem;color:#fff}.jt-drawing-dialog .el-dialog .el-color-picker__trigger{width:120rem}.jt-drawing-dialog .el-dialog .el-body-foot{position:absolute;bottom:8rem;right:8rem;width:calc(100% - 16rem)}.jt-drawing-dialog .el-dialog .el-body-foot .el-button-group{display:flex}.jt-drawing-dialog .el-dialog .el-body-foot .el-button-group .el-button{border:solid 0rem rgb(255,0,0);flex:1}
  44051. `;
  44052. const _hoisted_1 = { class: "jt-drawing-dialog" };
  44053. const _hoisted_2 = {
  44054. slot: "title",
  44055. class: "header-title"
  44056. };
  44057. const _hoisted_3 = { style: { "line-height": "24rem", "font-size": "16rem", "color": "#fff", "font-family": "'Alimama_ShuHeiTi_Bold'" } };
  44058. const _hoisted_4 = { class: "content" };
  44059. const _hoisted_5 = {
  44060. class: "jt-drawing-row",
  44061. style: { "height": "60rem" }
  44062. };
  44063. const _hoisted_6 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5185\u5BB9", -1);
  44064. const _hoisted_7 = { class: "col-main" };
  44065. const _hoisted_8 = { class: "jt-drawing-row" };
  44066. const _hoisted_9 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5B57\u4F53", -1);
  44067. const _hoisted_10 = { class: "col-main" };
  44068. const _hoisted_11 = { class: "jt-drawing-row" };
  44069. const _hoisted_12 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5B57\u4F53\u5927\u5C0F", -1);
  44070. const _hoisted_13 = { class: "col-main" };
  44071. const _hoisted_14 = { class: "jt-drawing-row" };
  44072. const _hoisted_15 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u52A0\u7C97", -1);
  44073. const _hoisted_16 = { class: "col-main" };
  44074. const _hoisted_17 = { class: "jt-drawing-row" };
  44075. const _hoisted_18 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u659C\u4F53", -1);
  44076. const _hoisted_19 = { class: "col-main" };
  44077. const _hoisted_20 = { class: "jt-drawing-row" };
  44078. const _hoisted_21 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u989C\u8272", -1);
  44079. const _hoisted_22 = { class: "col-main" };
  44080. const _hoisted_23 = { class: "jt-drawing-row" };
  44081. const _hoisted_24 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u8FB9\u6846", -1);
  44082. const _hoisted_25 = { class: "col-main" };
  44083. const _hoisted_26 = { class: "jt-drawing-row" };
  44084. const _hoisted_27 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u989C\u8272", -1);
  44085. const _hoisted_28 = { class: "col-main" };
  44086. const _hoisted_29 = { class: "jt-drawing-row" };
  44087. const _hoisted_30 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u5BBD\u5EA6", -1);
  44088. const _hoisted_31 = { class: "col-main" };
  44089. const _hoisted_32 = { class: "jt-drawing-row" };
  44090. const _hoisted_33 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u80CC\u666F", -1);
  44091. const _hoisted_34 = { class: "col-main" };
  44092. const _hoisted_35 = { class: "jt-drawing-row" };
  44093. const _hoisted_36 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u80CC\u666F\u989C\u8272", -1);
  44094. const _hoisted_37 = { class: "col-main" };
  44095. const _hoisted_38 = { class: "jt-drawing-row" };
  44096. const _hoisted_39 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u80CC\u666F\u5185\u8FB9\u8DDD", -1);
  44097. const _hoisted_40 = { class: "col-main" };
  44098. const _hoisted_41 = { class: "jt-drawing-row" };
  44099. const _hoisted_42 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6A2A\u5411\u504F\u79FB\u50CF\u7D20", -1);
  44100. const _hoisted_43 = { class: "col-main" };
  44101. const _hoisted_44 = { class: "jt-drawing-row" };
  44102. const _hoisted_45 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u7EB5\u5411\u504F\u79FB\u50CF\u7D20", -1);
  44103. const _hoisted_46 = { class: "col-main" };
  44104. const _hoisted_47 = { class: "jt-drawing-row" };
  44105. const _hoisted_48 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u50CF\u7D20\u5927\u5C0F", -1);
  44106. const _hoisted_49 = { class: "col-main" };
  44107. const _hoisted_50 = { class: "jt-drawing-row" };
  44108. const _hoisted_51 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u989C\u8272", -1);
  44109. const _hoisted_52 = { class: "col-main" };
  44110. const _hoisted_53 = { class: "jt-drawing-row" };
  44111. const _hoisted_54 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u8FB9\u6846", -1);
  44112. const _hoisted_55 = { class: "col-main" };
  44113. const _hoisted_56 = { class: "jt-drawing-row" };
  44114. const _hoisted_57 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u989C\u8272", -1);
  44115. const _hoisted_58 = { class: "col-main" };
  44116. const _hoisted_59 = { class: "jt-drawing-row" };
  44117. const _hoisted_60 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u5BBD\u5EA6", -1);
  44118. const _hoisted_61 = { class: "col-main" };
  44119. const _hoisted_62 = {
  44120. class: "jt-drawing-row",
  44121. style: { "height": "60rem" }
  44122. };
  44123. const _hoisted_63 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u56FE\u6807", -1);
  44124. const _hoisted_64 = { class: "col-main" };
  44125. const _hoisted_65 = { class: "jt-drawing-row" };
  44126. const _hoisted_66 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u5927\u5C0F\u6BD4\u4F8B", -1);
  44127. const _hoisted_67 = { class: "col-main" };
  44128. const _hoisted_68 = {
  44129. class: "jt-drawing-row",
  44130. style: { "height": "60rem" }
  44131. };
  44132. const _hoisted_69 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6A21\u578B\u8DEF\u5F84", -1);
  44133. const _hoisted_70 = { class: "col-main" };
  44134. const _hoisted_71 = { class: "jt-drawing-row" };
  44135. const _hoisted_72 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u900F\u660E\u5EA6", -1);
  44136. const _hoisted_73 = { class: "col-main" };
  44137. const _hoisted_74 = { class: "jt-drawing-row" };
  44138. const _hoisted_75 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u6700\u5C0F\u50CF\u7D20\u5927\u5C0F", -1);
  44139. const _hoisted_76 = { class: "col-main" };
  44140. const _hoisted_77 = { class: "jt-drawing-row" };
  44141. const _hoisted_78 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u662F\u5426\u8FB9\u6846", -1);
  44142. const _hoisted_79 = { class: "col-main" };
  44143. const _hoisted_80 = { class: "jt-drawing-row" };
  44144. const _hoisted_81 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u989C\u8272", -1);
  44145. const _hoisted_82 = { class: "col-main" };
  44146. const _hoisted_83 = { class: "jt-drawing-row" };
  44147. const _hoisted_84 = /* @__PURE__ */ createElementVNode("div", { class: "col-left" }, "\u8FB9\u6846\u5BBD\u5EA6", -1);
  44148. const _hoisted_85 = { class: "col-main" };
  44149. const _hoisted_86 = { class: "el-body-foot" };
  44150. const _sfc_main = {
  44151. __name: "CrEditProperty_Point.ce",
  44152. props: {
  44153. params: {
  44154. id: {
  44155. type: String,
  44156. default: () => void 0
  44157. },
  44158. text: {
  44159. type: String,
  44160. default: () => ""
  44161. },
  44162. font: {
  44163. type: String,
  44164. default: () => ""
  44165. },
  44166. fontSize: {
  44167. type: Number,
  44168. default: () => 24
  44169. },
  44170. color: {
  44171. type: String,
  44172. default: () => "255,255,0,0.9"
  44173. }
  44174. },
  44175. showDialog: {
  44176. type: Boolean,
  44177. default: () => false
  44178. }
  44179. },
  44180. emits: ["submit", "update:showDialog", "update:params", "remove"],
  44181. setup(__props, { emit }) {
  44182. const props = __props;
  44183. const language = ref("zh-cn");
  44184. const locale = computed$1(() => language.value === "zh-cn" ? zhCn : en);
  44185. const {
  44186. proxy
  44187. } = getCurrentInstance();
  44188. const predefineColors = ref([
  44189. "#ff4500",
  44190. "#ff8c00",
  44191. "#ffd700",
  44192. "#90ee90",
  44193. "#00ced1",
  44194. "#1e90ff",
  44195. "#c71585",
  44196. "rgba(255, 69, 0, 0.68)",
  44197. "rgb(255, 120, 0)",
  44198. "hsv(51, 100, 98)",
  44199. "hsva(120, 40, 94, 0.5)",
  44200. "hsl(181, 100%, 37%)",
  44201. "hsla(209, 100%, 56%, 0.73)",
  44202. "#c7158577"
  44203. ]);
  44204. const selectOptionsFont = [
  44205. {
  44206. value: "Helvetica",
  44207. label: "\u9ED8\u8BA4\u5B57\u4F53"
  44208. },
  44209. {
  44210. value: "Microsoft YaHei",
  44211. label: "\u5FAE\u8F6F\u96C5\u9ED1"
  44212. },
  44213. {
  44214. value: "\u5B8B\u4F53",
  44215. label: "\u5B8B\u4F53"
  44216. },
  44217. {
  44218. value: "\u6977\u4F53",
  44219. label: "\u6977\u4F53"
  44220. },
  44221. {
  44222. value: "\u96B6\u4E66",
  44223. label: "\u96B6\u4E66"
  44224. },
  44225. {
  44226. value: "\u9ED1\u4F53",
  44227. label: "\u9ED1\u4F53"
  44228. }
  44229. ];
  44230. const activeNames = ref(["1"]);
  44231. const title = ref("\u5C5E\u6027\u7F16\u8F91");
  44232. const dialogVisible = ref(props.showDialog);
  44233. const isShowLabelStyle = ref(false);
  44234. const isShowPointStyle = ref(false);
  44235. const isShowBillboardStyle = ref(false);
  44236. const isShowModelStyle = ref(false);
  44237. const label = ref({
  44238. content: "",
  44239. font: "",
  44240. fontSize: 0,
  44241. bolder: false,
  44242. italic: false,
  44243. fillColor: "",
  44244. showOutline: false,
  44245. outlineColor: "",
  44246. outlineWidth: 0,
  44247. showBackground: false,
  44248. backgroundColor: "",
  44249. backgroundPadding: 0,
  44250. pixelOffsetX: 0,
  44251. pixelOffsetY: 0
  44252. });
  44253. const point2 = ref({
  44254. color: "",
  44255. pixelSize: 10,
  44256. showOutline: false,
  44257. outlineColor: "",
  44258. outlineWidth: 0
  44259. });
  44260. const billboard = ref({
  44261. imgUrl: "",
  44262. alpha: 1,
  44263. scale: 1
  44264. });
  44265. const model = ref({
  44266. url: "",
  44267. alpha: 1,
  44268. showSilhouette: false,
  44269. silhouetteSize: 0,
  44270. silhouetteColor: "rgba(255,255,255,1)",
  44271. minimumPixelSize: 1,
  44272. maximumScale: 1,
  44273. heading: 0,
  44274. pitch: 0,
  44275. roll: 0
  44276. });
  44277. updateParams(props.params);
  44278. function updateParams(params) {
  44279. proxy._params = params;
  44280. _setShowControls(false);
  44281. if (params.id === DrawPoint.DrawType.Label) {
  44282. title.value = "\u6587\u5B57\u7F16\u8F91";
  44283. activeNames.value = ["\u6807\u6CE8\u6837\u5F0F"];
  44284. isShowLabelStyle.value = true;
  44285. label.value.content = params.label.text;
  44286. label.value.font = params.label.font;
  44287. label.value.fontSize = params.label.fontSize;
  44288. label.value.fillColor = params.label.fillColor;
  44289. label.value.showOutline = params.label.showOutline;
  44290. label.value.outlineColor = params.label.outlineColor;
  44291. label.value.outlineWidth = params.label.outlineWidth;
  44292. label.value.showBackground = params.label.showBackground;
  44293. label.value.backgroundColor = params.label.backgroundColor;
  44294. label.value.backgroundPadding = params.label.backgroundPadding;
  44295. label.value.pixelOffsetX = params.label.pixelOffsetX;
  44296. label.value.pixelOffsetY = params.label.pixelOffsetY;
  44297. } else if (params.id === DrawPoint.DrawType.Point) {
  44298. title.value = "\u70B9\u7F16\u8F91";
  44299. activeNames.value = ["\u70B9\u6837\u5F0F"];
  44300. isShowPointStyle.value = true;
  44301. point2.value.color = params.point.color;
  44302. point2.value.pixelSize = params.point.pixelSize;
  44303. point2.value.showOutline = params.point.showOutline;
  44304. point2.value.outlineColor = params.point.outlineColor;
  44305. point2.value.outlineWidth = params.point.outlineWidth;
  44306. } else if (params.id === DrawPoint.DrawType.Point2Label) {
  44307. title.value = "\u70B9\u53CA\u6587\u5B57\u7F16\u8F91";
  44308. activeNames.value = ["\u70B9\u6837\u5F0F", "\u6807\u6CE8\u6837\u5F0F"];
  44309. isShowPointStyle.value = true;
  44310. isShowLabelStyle.value = true;
  44311. point2.value.color = params.point.color;
  44312. point2.value.pixelSize = params.point.pixelSize;
  44313. point2.value.showOutline = params.point.showOutline;
  44314. point2.value.outlineColor = params.point.outlineColor;
  44315. point2.value.outlineWidth = params.point.outlineWidth;
  44316. label.value.content = params.label.text;
  44317. label.value.font = params.label.font;
  44318. label.value.fontSize = params.label.fontSize;
  44319. label.value.fillColor = params.label.fillColor;
  44320. label.value.showOutline = params.label.showOutline;
  44321. label.value.outlineColor = params.label.outlineColor;
  44322. label.value.outlineWidth = params.label.outlineWidth;
  44323. label.value.showBackground = params.label.showBackground;
  44324. label.value.backgroundColor = params.label.backgroundColor;
  44325. label.value.backgroundPadding = params.label.backgroundPadding;
  44326. label.value.pixelOffsetX = params.label.pixelOffsetX;
  44327. label.value.pixelOffsetY = params.label.pixelOffsetY;
  44328. } else if (params.id === DrawPoint.DrawType.Billboard) {
  44329. title.value = "\u5E7F\u544A\u724C\u7F16\u8F91";
  44330. activeNames.value = ["\u56FE\u7247\u6837\u5F0F"];
  44331. isShowBillboardStyle.value = true;
  44332. billboard.value.imgUrl = params.billboard.imgUrl;
  44333. billboard.value.alpha = params.billboard.alpha;
  44334. billboard.value.scale = params.billboard.scale;
  44335. } else if (params.id === DrawPoint.DrawType.Billboard2Label) {
  44336. title.value = "\u5E7F\u544A\u724C\u53CA\u6587\u5B57\u5706\u7F16\u8F91";
  44337. activeNames.value = ["\u56FE\u7247\u6837\u5F0F", "\u6807\u6CE8\u6837\u5F0F"];
  44338. isShowBillboardStyle.value = true;
  44339. isShowLabelStyle.value = true;
  44340. billboard.value.imgUrl = params.billboard.imgUrl;
  44341. billboard.value.alpha = params.billboard.alpha;
  44342. billboard.value.scale = params.billboard.scale;
  44343. label.value.content = params.label.text;
  44344. label.value.font = params.label.font;
  44345. label.value.fontSize = params.label.fontSize;
  44346. label.value.fillColor = params.label.fillColor;
  44347. label.value.showOutline = params.label.showOutline;
  44348. label.value.outlineColor = params.label.outlineColor;
  44349. label.value.outlineWidth = params.label.outlineWidth;
  44350. label.value.showBackground = params.label.showBackground;
  44351. label.value.backgroundColor = params.label.backgroundColor;
  44352. label.value.backgroundPadding = params.label.backgroundPadding;
  44353. label.value.pixelOffsetX = params.label.pixelOffsetX;
  44354. label.value.pixelOffsetY = params.label.pixelOffsetY;
  44355. } else if (params.id === DrawPoint.DrawType.Model) {
  44356. title.value = "\u5C0F\u6A21\u578B\u7F16\u8F91";
  44357. activeNames.value = ["\u5C0F\u6A21\u578B\u6837\u5F0F"];
  44358. isShowModelStyle.value = true;
  44359. model.value.url = params.model.url;
  44360. model.value.alpha = params.model.alpha;
  44361. model.value.showSilhouette = params.model.showSilhouette;
  44362. model.value.silhouetteColor = params.model.silhouetteColor;
  44363. model.value.silhouetteSize = params.model.silhouetteSize;
  44364. model.value.minimumPixelSize = params.model.minimumPixelSize;
  44365. model.value.maximumScale = params.model.maximumScale;
  44366. model.value.heading = params.model.heading;
  44367. model.value.pitch = params.model.pitch;
  44368. model.value.roll = params.model.roll;
  44369. }
  44370. }
  44371. function _setShowControls(isShow) {
  44372. isShowLabelStyle.value = isShow;
  44373. isShowPointStyle.value = isShow;
  44374. isShowBillboardStyle.value = isShow;
  44375. isShowModelStyle.value = isShow;
  44376. }
  44377. function submit() {
  44378. let outParam = proxy._params;
  44379. outParam = {
  44380. id: outParam.id,
  44381. label: {
  44382. text: label.value.content,
  44383. font: label.value.font,
  44384. fontSize: label.value.fontSize,
  44385. bolder: label.value.bolder,
  44386. italic: label.value.italic,
  44387. fillColor: label.value.fillColor,
  44388. showOutline: label.value.showOutline,
  44389. outlineWidth: label.value.outlineWidth,
  44390. outlineColor: label.value.outlineColor,
  44391. showBackground: label.value.showBackground,
  44392. backgroundColor: label.value.backgroundColor,
  44393. backgroundPadding: label.value.backgroundPadding,
  44394. pixelOffsetX: label.value.pixelOffsetX,
  44395. pixelOffsetY: label.value.pixelOffsetY
  44396. },
  44397. point: {
  44398. color: point2.value.color,
  44399. pixelSize: point2.value.pixelSize,
  44400. showOutline: point2.value.showOutline,
  44401. outlineWidth: point2.value.outlineWidth,
  44402. outlineColor: point2.value.outlineColor
  44403. },
  44404. billboard: {
  44405. imgUrl: billboard.value.imgUrl,
  44406. alpha: billboard.value.alpha,
  44407. scale: billboard.value.scale
  44408. },
  44409. model: {
  44410. url: model.value.url,
  44411. alpha: model.value.alpha,
  44412. showSilhouette: model.value.showSilhouette,
  44413. silhouetteColor: model.value.silhouetteColor,
  44414. silhouetteSize: model.value.silhouetteSize,
  44415. minimumPixelSize: model.value.minimumPixelSize,
  44416. maximumScale: model.value.maximumScale,
  44417. heading: model.value.heading,
  44418. pitch: model.value.pitch,
  44419. roll: model.value.roll
  44420. }
  44421. };
  44422. emit("submit", outParam);
  44423. }
  44424. function close() {
  44425. dialogVisible.value = false;
  44426. }
  44427. function remove2() {
  44428. emit("remove", {});
  44429. dialogVisible.value = false;
  44430. }
  44431. function closeDialog() {
  44432. emit("update:showDialog", false);
  44433. }
  44434. function openDialog() {
  44435. updateParams(props.params);
  44436. }
  44437. return (_ctx, _cache) => {
  44438. const _component_el_scrollbar = resolveComponent("el-scrollbar");
  44439. return openBlock(), createElementBlock("div", _hoisted_1, [
  44440. createVNode(unref(ElDialog), {
  44441. modal: false,
  44442. "destroy-on-close": false,
  44443. modelValue: dialogVisible.value,
  44444. "onUpdate:modelValue": _cache[31] || (_cache[31] = ($event) => dialogVisible.value = $event),
  44445. title: title.value,
  44446. onClose: closeDialog,
  44447. onOpen: openDialog,
  44448. "show-close": false
  44449. }, {
  44450. header: withCtx(() => [
  44451. createElementVNode("div", _hoisted_2, [
  44452. createElementVNode("span", _hoisted_3, toDisplayString(title.value), 1)
  44453. ])
  44454. ]),
  44455. default: withCtx(() => [
  44456. createVNode(_component_el_scrollbar, null, {
  44457. default: withCtx(() => [
  44458. createElementVNode("div", _hoisted_4, [
  44459. createVNode(unref(ElCollapse), {
  44460. modelValue: activeNames.value,
  44461. "onUpdate:modelValue": _cache[27] || (_cache[27] = ($event) => activeNames.value = $event)
  44462. }, {
  44463. default: withCtx(() => [
  44464. withDirectives(createVNode(unref(ElCollapseItem), { name: "\u6807\u6CE8\u6837\u5F0F" }, {
  44465. title: withCtx(() => [
  44466. createVNode(unref(ElIcon), { style: { "padding": "10rem" } }, {
  44467. default: withCtx(() => [
  44468. createVNode(unref(setting_default))
  44469. ]),
  44470. _: 1
  44471. }),
  44472. createTextVNode("\u6807\u6CE8\u6837\u5F0F ")
  44473. ]),
  44474. default: withCtx(() => [
  44475. createElementVNode("div", _hoisted_5, [
  44476. _hoisted_6,
  44477. createElementVNode("div", _hoisted_7, [
  44478. createVNode(unref(ElInput), {
  44479. modelValue: label.value.content,
  44480. "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => label.value.content = $event),
  44481. placeholder: "\u8F93\u5165\u663E\u793A\u7684\u6587\u5B57\u5185\u5BB9",
  44482. clearable: "",
  44483. type: "textarea",
  44484. rows: 2
  44485. }, null, 8, ["modelValue"])
  44486. ])
  44487. ]),
  44488. createElementVNode("div", _hoisted_8, [
  44489. _hoisted_9,
  44490. createElementVNode("div", _hoisted_10, [
  44491. createVNode(unref(ElSelect), {
  44492. modelValue: label.value.font,
  44493. "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => label.value.font = $event),
  44494. placeholder: "\u8BF7\u9009\u62E9"
  44495. }, {
  44496. default: withCtx(() => [
  44497. (openBlock(), createElementBlock(Fragment, null, renderList(selectOptionsFont, (item) => {
  44498. return createVNode(unref(ElOption), {
  44499. key: item.value,
  44500. label: item.label,
  44501. value: item.value
  44502. }, null, 8, ["label", "value"]);
  44503. }), 64))
  44504. ]),
  44505. _: 1
  44506. }, 8, ["modelValue"])
  44507. ])
  44508. ]),
  44509. createElementVNode("div", _hoisted_11, [
  44510. _hoisted_12,
  44511. createElementVNode("div", _hoisted_13, [
  44512. createVNode(unref(ElInputNumber), {
  44513. modelValue: label.value.fontSize,
  44514. "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => label.value.fontSize = $event),
  44515. min: 0,
  44516. max: 100
  44517. }, null, 8, ["modelValue"])
  44518. ])
  44519. ]),
  44520. createElementVNode("div", _hoisted_14, [
  44521. _hoisted_15,
  44522. createElementVNode("div", _hoisted_16, [
  44523. createVNode(unref(ElSwitch), {
  44524. modelValue: label.value.bolder,
  44525. "onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => label.value.bolder = $event)
  44526. }, null, 8, ["modelValue"])
  44527. ])
  44528. ]),
  44529. createElementVNode("div", _hoisted_17, [
  44530. _hoisted_18,
  44531. createElementVNode("div", _hoisted_19, [
  44532. createVNode(unref(ElSwitch), {
  44533. modelValue: label.value.italic,
  44534. "onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => label.value.italic = $event)
  44535. }, null, 8, ["modelValue"])
  44536. ])
  44537. ]),
  44538. createElementVNode("div", _hoisted_20, [
  44539. _hoisted_21,
  44540. createElementVNode("div", _hoisted_22, [
  44541. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44542. default: withCtx(() => [
  44543. createVNode(unref(ElColorPicker), {
  44544. modelValue: label.value.fillColor,
  44545. "onUpdate:modelValue": _cache[5] || (_cache[5] = ($event) => label.value.fillColor = $event),
  44546. "show-alpha": "",
  44547. predefine: predefineColors.value,
  44548. label: "12"
  44549. }, null, 8, ["modelValue", "predefine"])
  44550. ]),
  44551. _: 1
  44552. }, 8, ["locale"])
  44553. ])
  44554. ]),
  44555. createElementVNode("div", _hoisted_23, [
  44556. _hoisted_24,
  44557. createElementVNode("div", _hoisted_25, [
  44558. createVNode(unref(ElSwitch), {
  44559. modelValue: label.value.showOutline,
  44560. "onUpdate:modelValue": _cache[6] || (_cache[6] = ($event) => label.value.showOutline = $event)
  44561. }, null, 8, ["modelValue"])
  44562. ])
  44563. ]),
  44564. withDirectives(createElementVNode("div", _hoisted_26, [
  44565. _hoisted_27,
  44566. createElementVNode("div", _hoisted_28, [
  44567. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44568. default: withCtx(() => [
  44569. createVNode(unref(ElColorPicker), {
  44570. modelValue: label.value.outlineColor,
  44571. "onUpdate:modelValue": _cache[7] || (_cache[7] = ($event) => label.value.outlineColor = $event),
  44572. "show-alpha": "",
  44573. predefine: predefineColors.value,
  44574. label: "12"
  44575. }, null, 8, ["modelValue", "predefine"])
  44576. ]),
  44577. _: 1
  44578. }, 8, ["locale"])
  44579. ])
  44580. ], 512), [
  44581. [vShow, label.value.showOutline]
  44582. ]),
  44583. withDirectives(createElementVNode("div", _hoisted_29, [
  44584. _hoisted_30,
  44585. createElementVNode("div", _hoisted_31, [
  44586. createVNode(unref(ElInputNumber), {
  44587. modelValue: label.value.outlineWidth,
  44588. "onUpdate:modelValue": _cache[8] || (_cache[8] = ($event) => label.value.outlineWidth = $event),
  44589. min: 0,
  44590. max: 100
  44591. }, null, 8, ["modelValue"])
  44592. ])
  44593. ], 512), [
  44594. [vShow, label.value.showOutline]
  44595. ]),
  44596. createElementVNode("div", _hoisted_32, [
  44597. _hoisted_33,
  44598. createElementVNode("div", _hoisted_34, [
  44599. createVNode(unref(ElSwitch), {
  44600. modelValue: label.value.showBackground,
  44601. "onUpdate:modelValue": _cache[9] || (_cache[9] = ($event) => label.value.showBackground = $event)
  44602. }, null, 8, ["modelValue"])
  44603. ])
  44604. ]),
  44605. withDirectives(createElementVNode("div", _hoisted_35, [
  44606. _hoisted_36,
  44607. createElementVNode("div", _hoisted_37, [
  44608. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44609. default: withCtx(() => [
  44610. createVNode(unref(ElColorPicker), {
  44611. modelValue: label.value.backgroundColor,
  44612. "onUpdate:modelValue": _cache[10] || (_cache[10] = ($event) => label.value.backgroundColor = $event),
  44613. "show-alpha": "",
  44614. predefine: predefineColors.value,
  44615. label: "12"
  44616. }, null, 8, ["modelValue", "predefine"])
  44617. ]),
  44618. _: 1
  44619. }, 8, ["locale"])
  44620. ])
  44621. ], 512), [
  44622. [vShow, label.value.showBackground]
  44623. ]),
  44624. withDirectives(createElementVNode("div", _hoisted_38, [
  44625. _hoisted_39,
  44626. createElementVNode("div", _hoisted_40, [
  44627. createVNode(unref(ElInputNumber), {
  44628. modelValue: label.value.backgroundPadding,
  44629. "onUpdate:modelValue": _cache[11] || (_cache[11] = ($event) => label.value.backgroundPadding = $event),
  44630. min: -100,
  44631. max: 100
  44632. }, null, 8, ["modelValue"])
  44633. ])
  44634. ], 512), [
  44635. [vShow, label.value.showBackground]
  44636. ]),
  44637. createElementVNode("div", _hoisted_41, [
  44638. _hoisted_42,
  44639. createElementVNode("div", _hoisted_43, [
  44640. createVNode(unref(ElInputNumber), {
  44641. modelValue: label.value.pixelOffsetX,
  44642. "onUpdate:modelValue": _cache[12] || (_cache[12] = ($event) => label.value.pixelOffsetX = $event),
  44643. min: -100,
  44644. max: 100
  44645. }, null, 8, ["modelValue"])
  44646. ])
  44647. ]),
  44648. createElementVNode("div", _hoisted_44, [
  44649. _hoisted_45,
  44650. createElementVNode("div", _hoisted_46, [
  44651. createVNode(unref(ElInputNumber), {
  44652. modelValue: label.value.pixelOffsetY,
  44653. "onUpdate:modelValue": _cache[13] || (_cache[13] = ($event) => label.value.pixelOffsetY = $event),
  44654. min: -100,
  44655. max: 100
  44656. }, null, 8, ["modelValue"])
  44657. ])
  44658. ])
  44659. ]),
  44660. _: 1
  44661. }, 512), [
  44662. [vShow, isShowLabelStyle.value]
  44663. ]),
  44664. withDirectives(createVNode(unref(ElCollapseItem), { name: "\u70B9\u6837\u5F0F" }, {
  44665. title: withCtx(() => [
  44666. createVNode(unref(ElIcon), { style: { "padding": "10rem" } }, {
  44667. default: withCtx(() => [
  44668. createVNode(unref(setting_default))
  44669. ]),
  44670. _: 1
  44671. }),
  44672. createTextVNode("\u70B9\u6837\u5F0F ")
  44673. ]),
  44674. default: withCtx(() => [
  44675. createElementVNode("div", _hoisted_47, [
  44676. _hoisted_48,
  44677. createElementVNode("div", _hoisted_49, [
  44678. createVNode(unref(ElInputNumber), {
  44679. modelValue: point2.value.pixelSize,
  44680. "onUpdate:modelValue": _cache[14] || (_cache[14] = ($event) => point2.value.pixelSize = $event),
  44681. min: 0,
  44682. max: 100
  44683. }, null, 8, ["modelValue"])
  44684. ])
  44685. ]),
  44686. createElementVNode("div", _hoisted_50, [
  44687. _hoisted_51,
  44688. createElementVNode("div", _hoisted_52, [
  44689. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44690. default: withCtx(() => [
  44691. createVNode(unref(ElColorPicker), {
  44692. modelValue: point2.value.color,
  44693. "onUpdate:modelValue": _cache[15] || (_cache[15] = ($event) => point2.value.color = $event),
  44694. "show-alpha": "",
  44695. predefine: predefineColors.value,
  44696. label: "12"
  44697. }, null, 8, ["modelValue", "predefine"])
  44698. ]),
  44699. _: 1
  44700. }, 8, ["locale"])
  44701. ])
  44702. ]),
  44703. createElementVNode("div", _hoisted_53, [
  44704. _hoisted_54,
  44705. createElementVNode("div", _hoisted_55, [
  44706. createVNode(unref(ElSwitch), {
  44707. modelValue: point2.value.showOutline,
  44708. "onUpdate:modelValue": _cache[16] || (_cache[16] = ($event) => point2.value.showOutline = $event)
  44709. }, null, 8, ["modelValue"])
  44710. ])
  44711. ]),
  44712. withDirectives(createElementVNode("div", _hoisted_56, [
  44713. _hoisted_57,
  44714. createElementVNode("div", _hoisted_58, [
  44715. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44716. default: withCtx(() => [
  44717. createVNode(unref(ElColorPicker), {
  44718. modelValue: point2.value.outlineColor,
  44719. "onUpdate:modelValue": _cache[17] || (_cache[17] = ($event) => point2.value.outlineColor = $event),
  44720. "show-alpha": "",
  44721. predefine: predefineColors.value,
  44722. label: "12"
  44723. }, null, 8, ["modelValue", "predefine"])
  44724. ]),
  44725. _: 1
  44726. }, 8, ["locale"])
  44727. ])
  44728. ], 512), [
  44729. [vShow, point2.value.showOutline]
  44730. ]),
  44731. withDirectives(createElementVNode("div", _hoisted_59, [
  44732. _hoisted_60,
  44733. createElementVNode("div", _hoisted_61, [
  44734. createVNode(unref(ElInputNumber), {
  44735. modelValue: point2.value.outlineWidth,
  44736. "onUpdate:modelValue": _cache[18] || (_cache[18] = ($event) => point2.value.outlineWidth = $event),
  44737. min: 0,
  44738. max: 100
  44739. }, null, 8, ["modelValue"])
  44740. ])
  44741. ], 512), [
  44742. [vShow, point2.value.showOutline]
  44743. ])
  44744. ]),
  44745. _: 1
  44746. }, 512), [
  44747. [vShow, isShowPointStyle.value]
  44748. ]),
  44749. withDirectives(createVNode(unref(ElCollapseItem), { name: "\u56FE\u7247\u6837\u5F0F" }, {
  44750. title: withCtx(() => [
  44751. createVNode(unref(ElIcon), { style: { "padding": "10rem" } }, {
  44752. default: withCtx(() => [
  44753. createVNode(unref(setting_default))
  44754. ]),
  44755. _: 1
  44756. }),
  44757. createTextVNode("\u56FE\u7247\u6837\u5F0F ")
  44758. ]),
  44759. default: withCtx(() => [
  44760. createElementVNode("div", _hoisted_62, [
  44761. _hoisted_63,
  44762. createElementVNode("div", _hoisted_64, [
  44763. createVNode(unref(ElInput), {
  44764. modelValue: billboard.value.imgUrl,
  44765. "onUpdate:modelValue": _cache[19] || (_cache[19] = ($event) => billboard.value.imgUrl = $event),
  44766. placeholder: "\u8F93\u5165\u56FE\u6807\u8DEF\u5F84",
  44767. clearable: "",
  44768. type: "textarea",
  44769. rows: 2
  44770. }, null, 8, ["modelValue"])
  44771. ])
  44772. ]),
  44773. createElementVNode("div", _hoisted_65, [
  44774. _hoisted_66,
  44775. createElementVNode("div", _hoisted_67, [
  44776. createVNode(unref(ElInputNumber), {
  44777. modelValue: billboard.value.scale,
  44778. "onUpdate:modelValue": _cache[20] || (_cache[20] = ($event) => billboard.value.scale = $event),
  44779. min: 1,
  44780. max: 100
  44781. }, null, 8, ["modelValue"])
  44782. ])
  44783. ])
  44784. ]),
  44785. _: 1
  44786. }, 512), [
  44787. [vShow, isShowBillboardStyle.value]
  44788. ]),
  44789. withDirectives(createVNode(unref(ElCollapseItem), { name: "\u5C0F\u6A21\u578B\u6837\u5F0F" }, {
  44790. title: withCtx(() => [
  44791. createVNode(unref(ElIcon), { style: { "padding": "10rem" } }, {
  44792. default: withCtx(() => [
  44793. createVNode(unref(setting_default))
  44794. ]),
  44795. _: 1
  44796. }),
  44797. createTextVNode("\u5C0F\u6A21\u578B\u6837\u5F0F ")
  44798. ]),
  44799. default: withCtx(() => [
  44800. createElementVNode("div", _hoisted_68, [
  44801. _hoisted_69,
  44802. createElementVNode("div", _hoisted_70, [
  44803. createVNode(unref(ElInput), {
  44804. modelValue: model.value.url,
  44805. "onUpdate:modelValue": _cache[21] || (_cache[21] = ($event) => model.value.url = $event),
  44806. placeholder: "\u8F93\u5165\u6A21\u578B\u8DEF\u5F84",
  44807. clearable: "",
  44808. type: "textarea",
  44809. rows: 2
  44810. }, null, 8, ["modelValue"])
  44811. ])
  44812. ]),
  44813. createElementVNode("div", _hoisted_71, [
  44814. _hoisted_72,
  44815. createElementVNode("div", _hoisted_73, [
  44816. createVNode(unref(ElInputNumber), {
  44817. modelValue: model.value.alpha,
  44818. "onUpdate:modelValue": _cache[22] || (_cache[22] = ($event) => model.value.alpha = $event),
  44819. step: 0.1,
  44820. min: 0,
  44821. max: 1
  44822. }, null, 8, ["modelValue"])
  44823. ])
  44824. ]),
  44825. createElementVNode("div", _hoisted_74, [
  44826. _hoisted_75,
  44827. createElementVNode("div", _hoisted_76, [
  44828. createVNode(unref(ElInputNumber), {
  44829. modelValue: model.value.minimumPixelSize,
  44830. "onUpdate:modelValue": _cache[23] || (_cache[23] = ($event) => model.value.minimumPixelSize = $event),
  44831. step: 1,
  44832. min: 0,
  44833. max: 2e4
  44834. }, null, 8, ["modelValue"])
  44835. ])
  44836. ]),
  44837. createElementVNode("div", _hoisted_77, [
  44838. _hoisted_78,
  44839. createElementVNode("div", _hoisted_79, [
  44840. createVNode(unref(ElSwitch), {
  44841. modelValue: model.value.showSilhouette,
  44842. "onUpdate:modelValue": _cache[24] || (_cache[24] = ($event) => model.value.showSilhouette = $event)
  44843. }, null, 8, ["modelValue"])
  44844. ])
  44845. ]),
  44846. withDirectives(createElementVNode("div", _hoisted_80, [
  44847. _hoisted_81,
  44848. createElementVNode("div", _hoisted_82, [
  44849. createVNode(unref(ElConfigProvider), { locale: locale.value }, {
  44850. default: withCtx(() => [
  44851. createVNode(unref(ElColorPicker), {
  44852. modelValue: model.value.silhouetteColor,
  44853. "onUpdate:modelValue": _cache[25] || (_cache[25] = ($event) => model.value.silhouetteColor = $event),
  44854. "show-alpha": "",
  44855. predefine: predefineColors.value,
  44856. label: "12"
  44857. }, null, 8, ["modelValue", "predefine"])
  44858. ]),
  44859. _: 1
  44860. }, 8, ["locale"])
  44861. ])
  44862. ], 512), [
  44863. [vShow, model.value.showSilhouette]
  44864. ]),
  44865. withDirectives(createElementVNode("div", _hoisted_83, [
  44866. _hoisted_84,
  44867. createElementVNode("div", _hoisted_85, [
  44868. createVNode(unref(ElInputNumber), {
  44869. modelValue: model.value.silhouetteSize,
  44870. "onUpdate:modelValue": _cache[26] || (_cache[26] = ($event) => model.value.silhouetteSize = $event),
  44871. step: 1,
  44872. min: 0,
  44873. max: 100
  44874. }, null, 8, ["modelValue"])
  44875. ])
  44876. ], 512), [
  44877. [vShow, model.value.showSilhouette]
  44878. ])
  44879. ]),
  44880. _: 1
  44881. }, 512), [
  44882. [vShow, isShowModelStyle.value]
  44883. ])
  44884. ]),
  44885. _: 1
  44886. }, 8, ["modelValue"])
  44887. ]),
  44888. createElementVNode("div", _hoisted_86, [
  44889. createVNode(unref(ElButtonGroup), null, {
  44890. default: withCtx(() => [
  44891. createVNode(unref(ElButton), {
  44892. type: "primary",
  44893. icon: unref(edit_default),
  44894. onClick: _cache[28] || (_cache[28] = ($event) => submit())
  44895. }, {
  44896. default: withCtx(() => [
  44897. createTextVNode("\u4FEE\u6539")
  44898. ]),
  44899. _: 1
  44900. }, 8, ["icon"]),
  44901. createVNode(unref(ElButton), {
  44902. type: "primary",
  44903. style: { "background-color": "rgb(222, 146, 47)" },
  44904. icon: unref(delete_default),
  44905. onClick: _cache[29] || (_cache[29] = ($event) => remove2())
  44906. }, {
  44907. default: withCtx(() => [
  44908. createTextVNode("\u5220\u9664")
  44909. ]),
  44910. _: 1
  44911. }, 8, ["icon"]),
  44912. createVNode(unref(ElButton), {
  44913. type: "primary",
  44914. style: { "background-color": "rgb(126, 128, 135)" },
  44915. icon: unref(close_default),
  44916. onClick: _cache[30] || (_cache[30] = ($event) => close())
  44917. }, {
  44918. default: withCtx(() => [
  44919. createTextVNode("\u5173\u95ED")
  44920. ]),
  44921. _: 1
  44922. }, 8, ["icon"])
  44923. ]),
  44924. _: 1
  44925. })
  44926. ])
  44927. ]),
  44928. _: 1
  44929. })
  44930. ]),
  44931. _: 1
  44932. }, 8, ["modelValue", "title"])
  44933. ]);
  44934. };
  44935. }
  44936. };
  44937. var DialogEditProperty = /* @__PURE__ */ _export_sfc(_sfc_main, [["styles", [_style_0]]]);
  44938. Cesium.Entity.prototype.setParams = function(params) {
  44939. this._params = params;
  44940. };
  44941. Cesium.Entity.prototype.getParams = function() {
  44942. return this._params;
  44943. };
  44944. Cesium.Entity.prototype.setEntityType = function(entityType) {
  44945. this._entityType = entityType;
  44946. };
  44947. Cesium.Entity.prototype.getEntityType = function(entityType) {
  44948. return this._entityType;
  44949. };
  44950. Cesium.Entity.prototype.setIsEdit = function(isEdit) {
  44951. this._isEdit = isEdit;
  44952. };
  44953. Cesium.Entity.prototype.getIsEdit = function() {
  44954. return this._isEdit;
  44955. };
  44956. class DrawPoint {
  44957. constructor(viewer2) {
  44958. if (!viewer2)
  44959. throw new Cesium.DeveloperError("no viewer object!");
  44960. this._viewer = viewer2;
  44961. this._viewer.scene.globe.depthTestAgainstTerrain = true;
  44962. this._viewer.cesiumWidget.screenSpaceEventHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOUBLE_CLICK);
  44963. this._entities = [];
  44964. this._pointObject = new PointObject(viewer2);
  44965. }
  44966. static initEditPropertyParams() {
  44967. return {
  44968. id: void 0,
  44969. label: {
  44970. text: "\u91D1\u7530CIM\u4E09\u7EF4\u57FA\u7840\u5E73\u53F0",
  44971. font: "Helvetica",
  44972. fontSize: 24,
  44973. bolder: false,
  44974. italic: false,
  44975. fillColor: "rgba(0,255,0,0.75)",
  44976. showOutline: false,
  44977. outlineWidth: 0,
  44978. outlineColor: "rgba(255,255,255,1)",
  44979. showBackground: false,
  44980. backgroundPadding: 0,
  44981. backgroundColor: "rgba(255,255,255,1)",
  44982. pixelOffsetX: 0,
  44983. pixelOffsetY: 0
  44984. },
  44985. point: {
  44986. color: "rgba(0,255,0,0.75)",
  44987. pixelSize: 10,
  44988. showOutline: false,
  44989. outlineWidth: 0,
  44990. outlineColor: "rgba(255,255,255,1)"
  44991. },
  44992. billboard: {
  44993. imgUrl: "jt3dSDK/imgs/point/point3.png",
  44994. alpha: 1,
  44995. scale: 1
  44996. },
  44997. model: {
  44998. url: "jt3dSDK/gltf/pyramid.glb",
  44999. alpha: 1,
  45000. showSilhouette: false,
  45001. silhouetteColor: "rgba(255,255,255,1)",
  45002. silhouetteSize: 0,
  45003. minimumPixelSize: 128,
  45004. maximumScale: 2e4,
  45005. heading: 0,
  45006. pitch: 0,
  45007. roll: 0
  45008. }
  45009. };
  45010. }
  45011. _cartesian3ToGeo(position2) {
  45012. let g = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  45013. return {
  45014. longitude: Cesium.Math.toDegrees(g.longitude),
  45015. latitude: Cesium.Math.toDegrees(g.latitude),
  45016. height: g.height
  45017. };
  45018. }
  45019. _arcToDegree(arc) {
  45020. return arc / Math.PI * 180;
  45021. }
  45022. _getScreenClickPositionAndHeight(screenPoint) {
  45023. var lng = void 0, lat = void 0, height2 = void 0;
  45024. var ray = this._viewer.scene.camera.getPickRay(screenPoint);
  45025. var position2 = this._viewer.scene.globe.pick(ray, this._viewer.scene);
  45026. var cartographic = Cesium.Ellipsoid.WGS84.cartesianToCartographic(position2);
  45027. var feature2 = this._viewer.scene.pick(screenPoint);
  45028. if (feature2 == void 0) {
  45029. lng = this._arcToDegree(cartographic.longitude);
  45030. lat = this._arcToDegree(cartographic.latitude);
  45031. height2 = cartographic.height;
  45032. } else {
  45033. var cartesian = this._viewer.scene.pickPosition(screenPoint);
  45034. if (Cesium.defined(cartesian)) {
  45035. var cartographic = Cesium.Cartographic.fromCartesian(cartesian);
  45036. lng = this._arcToDegree(cartographic.longitude);
  45037. lat = this._arcToDegree(cartographic.latitude);
  45038. height2 = cartographic.height;
  45039. }
  45040. }
  45041. return {
  45042. lng,
  45043. lat,
  45044. height: height2
  45045. };
  45046. }
  45047. _transfromFromScreenPoint(screenPosition) {
  45048. let location = this._getScreenClickPositionAndHeight(screenPosition);
  45049. var cartesian = Cesium.Cartesian3.fromDegrees(location.lng, location.lat, location.height);
  45050. return {
  45051. gLocation: location,
  45052. sLocation: cartesian
  45053. };
  45054. }
  45055. }
  45056. Object.assign(DrawPoint.prototype, {
  45057. _setMousePointerStyle() {
  45058. document.querySelector("body").style.cursor = "crosshair";
  45059. },
  45060. _setMouseDefaultStyle() {
  45061. document.querySelector("body").style.cursor = "default";
  45062. },
  45063. _registerLeftClickEvent(handler, callChange) {
  45064. let _self = this;
  45065. if (!handler)
  45066. return;
  45067. handler.setInputAction(function(event2) {
  45068. _self._lock = true;
  45069. clearTimeout(_self._timer);
  45070. _self._timer = setTimeout(function() {
  45071. if (callChange)
  45072. callChange(event2);
  45073. _self._lock = false;
  45074. }, 200);
  45075. }, Cesium.ScreenSpaceEventType.LEFT_CLICK);
  45076. },
  45077. _registerMouseMoveEvent(handler, callChange) {
  45078. let _self = this;
  45079. if (!handler)
  45080. return;
  45081. handler.setInputAction(function(event2) {
  45082. if (_self._lock === void 0 || _self._lock === false) {
  45083. if (callChange)
  45084. callChange(event2);
  45085. }
  45086. }, Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  45087. },
  45088. _registerLeftDownEvent(handler, callChange) {
  45089. if (!handler)
  45090. return;
  45091. handler.setInputAction(function(event2) {
  45092. if (callChange)
  45093. callChange(event2);
  45094. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  45095. },
  45096. _registerLeftUpEvent(handler, callChange) {
  45097. if (!handler)
  45098. return;
  45099. handler.setInputAction(function(event2) {
  45100. if (callChange)
  45101. callChange(event2);
  45102. }, Cesium.ScreenSpaceEventType.LEFT_UP);
  45103. },
  45104. _clearEvent(handler) {
  45105. if (!handler)
  45106. return;
  45107. handler.destroy();
  45108. handler = null;
  45109. }
  45110. });
  45111. Object.assign(DrawPoint.prototype, {
  45112. draw: function(type2, options2) {
  45113. let _self = this;
  45114. _self._unActivateEdit();
  45115. this._drawEventHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  45116. this._drawType = type2;
  45117. switch (type2) {
  45118. case DrawPoint.DrawType.Model:
  45119. _self._sketchDrawModel(_self._drawEventHandler, options2);
  45120. break;
  45121. case DrawPoint.DrawType.Label:
  45122. _self._sketchDrawLabel(_self._drawEventHandler, options2);
  45123. break;
  45124. case DrawPoint.DrawType.Point:
  45125. _self._sketchDrawPoint(_self._drawEventHandler, options2);
  45126. break;
  45127. case DrawPoint.DrawType.Point2Label:
  45128. _self._sketchDrawPoint2Label(_self._drawEventHandler, options2);
  45129. break;
  45130. case DrawPoint.DrawType.Billboard:
  45131. _self._sketchDrawBillboard(_self._drawEventHandler, options2);
  45132. break;
  45133. case DrawPoint.DrawType.Billboard2Label:
  45134. _self._sketchDrawBillboard2Label(_self._drawEventHandler, options2);
  45135. break;
  45136. }
  45137. },
  45138. clearAll() {
  45139. for (var i2 = 0; i2 < this._entities.length; i2++) {
  45140. var getById = viewer.entities.getById(this._entities[i2]);
  45141. if (getById) {
  45142. this._viewer.entities.remove(getById);
  45143. }
  45144. }
  45145. this._closePropertyEditDialog();
  45146. },
  45147. _sketchDrawLabel(handler, options2) {
  45148. let _self = this;
  45149. this._registerLeftClickEvent(handler, function(event2) {
  45150. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45151. if (!Cesium.defined(loc2.sLocation))
  45152. return;
  45153. let entityParam = DrawPoint.initEditPropertyParams();
  45154. entityParam.label.font = entityParam.label.fontSize + "px " + entityParam.label.font;
  45155. entityParam.label.pixelOffset = {
  45156. x: entityParam.label.pixelOffsetX,
  45157. y: entityParam.label.pixelOffsetY
  45158. };
  45159. _self._pointObject.addLabel(loc2.sLocation, {
  45160. label: entityParam.label
  45161. }).then((entity) => {
  45162. _self._entities.push(entity.id);
  45163. entityParam = DrawPoint.initEditPropertyParams();
  45164. _self._drawEntity = entity;
  45165. _self._drawEntity.setParams(entityParam);
  45166. _self._drawEntity.setEntityType(DrawPoint.DrawType.Label);
  45167. _self._setEntityIsEdit(_self._drawEntity);
  45168. _self._clearEvent(handler);
  45169. if (options2.onComplete)
  45170. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45171. });
  45172. });
  45173. },
  45174. _sketchDrawPoint(handler, options2) {
  45175. let _self = this;
  45176. this._registerLeftClickEvent(handler, function(event2) {
  45177. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45178. if (!Cesium.defined(loc2.sLocation))
  45179. return;
  45180. let entityParam = DrawPoint.initEditPropertyParams();
  45181. _self._pointObject.addPoint(loc2.sLocation, {
  45182. point: entityParam.point
  45183. }).then((entity) => {
  45184. _self._entities.push(entity.id);
  45185. entityParam = DrawPoint.initEditPropertyParams();
  45186. _self._drawEntity = entity;
  45187. _self._drawEntity.setParams(entityParam);
  45188. _self._drawEntity.setEntityType(DrawPoint.DrawType.Point);
  45189. _self._setEntityIsEdit(_self._drawEntity);
  45190. _self._clearEvent(handler);
  45191. if (options2.onComplete)
  45192. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45193. });
  45194. });
  45195. },
  45196. _sketchDrawPoint2Label(handler, options2) {
  45197. let _self = this;
  45198. this._registerLeftClickEvent(handler, function(event2) {
  45199. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45200. if (!Cesium.defined(loc2.sLocation))
  45201. return;
  45202. let entityParam = DrawPoint.initEditPropertyParams();
  45203. entityParam.label.font = entityParam.label.fontSize + "px " + entityParam.label.font;
  45204. entityParam.label.pixelOffset = {
  45205. x: entityParam.label.pixelOffsetX,
  45206. y: entityParam.label.pixelOffsetY - 10
  45207. };
  45208. _self._pointObject.addPoint(loc2.sLocation, {
  45209. point: entityParam.point,
  45210. label: entityParam.label
  45211. }).then((entity) => {
  45212. _self._entities.push(entity.id);
  45213. entityParam = DrawPoint.initEditPropertyParams();
  45214. entityParam.label.pixelOffsetY = -10;
  45215. _self._drawEntity = entity;
  45216. _self._drawEntity.setParams(entityParam);
  45217. _self._drawEntity.setEntityType(DrawPoint.DrawType.Point2Label);
  45218. _self._setEntityIsEdit(_self._drawEntity);
  45219. _self._clearEvent(handler);
  45220. if (options2.onComplete)
  45221. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45222. });
  45223. });
  45224. },
  45225. _sketchDrawBillboard(handler, options2) {
  45226. let _self = this;
  45227. this._registerLeftClickEvent(handler, function(event2) {
  45228. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45229. if (!Cesium.defined(loc2.sLocation))
  45230. return;
  45231. let entityParam = DrawPoint.initEditPropertyParams();
  45232. _self._pointObject.addBillboard(loc2.sLocation, {
  45233. billboard: entityParam.billboard
  45234. }).then((entity) => {
  45235. _self._entities.push(entity.id);
  45236. entityParam = DrawPoint.initEditPropertyParams();
  45237. entityParam.label.pixelOffsetY = -50;
  45238. _self._drawEntity = entity;
  45239. _self._drawEntity.setParams(entityParam);
  45240. _self._drawEntity.setEntityType(DrawPoint.DrawType.Billboard);
  45241. _self._setEntityIsEdit(_self._drawEntity);
  45242. _self._clearEvent(handler);
  45243. if (options2.onComplete)
  45244. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45245. });
  45246. });
  45247. },
  45248. _sketchDrawBillboard2Label(handler, options2) {
  45249. let _self = this;
  45250. this._registerLeftClickEvent(handler, function(event2) {
  45251. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45252. if (!Cesium.defined(loc2.sLocation))
  45253. return;
  45254. let entityParam = DrawPoint.initEditPropertyParams();
  45255. entityParam.label.font = entityParam.label.fontSize + "px " + entityParam.label.font;
  45256. entityParam.label.pixelOffset = {
  45257. x: entityParam.label.pixelOffsetX,
  45258. y: entityParam.label.pixelOffsetY - 50
  45259. };
  45260. _self._pointObject.addBillboard(loc2.sLocation, {
  45261. billboard: entityParam.billboard,
  45262. label: entityParam.label
  45263. }).then((entity) => {
  45264. _self._entities.push(entity.id);
  45265. entityParam = DrawPoint.initEditPropertyParams();
  45266. entityParam.label.pixelOffsetY = -50;
  45267. _self._drawEntity = entity;
  45268. _self._drawEntity.setParams(entityParam);
  45269. _self._drawEntity.setEntityType(DrawPoint.DrawType.Billboard2Label);
  45270. _self._setEntityIsEdit(_self._drawEntity);
  45271. _self._clearEvent(handler);
  45272. if (options2.onComplete)
  45273. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45274. });
  45275. });
  45276. },
  45277. _sketchDrawModel(handler, options2) {
  45278. let _self = this;
  45279. this._registerLeftClickEvent(handler, function(event2) {
  45280. let loc2 = _self._transfromFromScreenPoint(event2.position);
  45281. if (!Cesium.defined(loc2.sLocation))
  45282. return;
  45283. let entityParam = DrawPoint.initEditPropertyParams();
  45284. _self._pointObject.addModel(loc2.sLocation, {
  45285. model: entityParam.model
  45286. }).then((entity) => {
  45287. _self._entities.push(entity.id);
  45288. entityParam = DrawPoint.initEditPropertyParams();
  45289. _self._drawEntity = entity;
  45290. _self._drawEntity.setParams(entityParam);
  45291. _self._drawEntity.setEntityType(DrawPoint.DrawType.Model);
  45292. _self._setEntityIsEdit(_self._drawEntity);
  45293. _self._clearEvent(handler);
  45294. if (options2.onComplete)
  45295. options2.onComplete(loc2.sLocation, loc2.gLocation);
  45296. });
  45297. });
  45298. },
  45299. updateEditEntityProperty: function(params) {
  45300. if (this._editEntity === void 0)
  45301. return;
  45302. if (this._editEntity.getIsEdit() === void 0 || this._editEntity.getIsEdit() === false)
  45303. return;
  45304. let editEntityType = this._editEntity.getEntityType();
  45305. if (editEntityType === void 0)
  45306. return;
  45307. if (editEntityType === DrawPoint.DrawType.Label) {
  45308. this._updateLabelProperty(params);
  45309. } else if (editEntityType === DrawPoint.DrawType.Point) {
  45310. this._updatePointProperty(params);
  45311. } else if (editEntityType === DrawPoint.DrawType.Point2Label) {
  45312. this._updatePoint2LabelProperty(params);
  45313. } else if (editEntityType === DrawPoint.DrawType.Billboard) {
  45314. this._updateBillboardProperty(params);
  45315. } else if (editEntityType === DrawPoint.DrawType.Billboard2Label) {
  45316. this._updateBillboard2LabelProperty(params);
  45317. } else if (editEntityType === DrawPoint.DrawType.Model) {
  45318. this._updateModelProperty(params);
  45319. }
  45320. },
  45321. _updateLabelProperty(params) {
  45322. let label = params.label;
  45323. this._editEntity.label.text = label.text;
  45324. let font = "";
  45325. if (label.italic) {
  45326. font += "italic ";
  45327. }
  45328. if (label.bolder) {
  45329. font += " bolder ";
  45330. }
  45331. font += label.fontSize + "px " + label.font;
  45332. this._editEntity.label.font = font;
  45333. this._editEntity.label.fillColor = Cesium.Color.fromCssColorString(label.fillColor);
  45334. this._editEntity.label.outlineColor = Cesium.Color.fromCssColorString(label.outlineColor);
  45335. this._editEntity.label.outlineWidth = parseFloat(label.outlineWidth);
  45336. this._editEntity.label.showBackground = label.showBackground;
  45337. this._editEntity.label.backgroundColor = Cesium.Color.fromCssColorString(label.backgroundColor);
  45338. this._editEntity.label.backgroundPadding = new Cesium.Cartesian2(parseFloat(label.backgroundPadding), parseFloat(label.backgroundPadding));
  45339. this._editEntity.label.pixelOffset = new Cesium.Cartesian2(parseFloat(label.pixelOffsetX), parseFloat(label.pixelOffsetY));
  45340. this._editEntity.setParams(params);
  45341. },
  45342. _updatePointProperty(params) {
  45343. let point2 = params.point;
  45344. this._editEntity.point.color = Cesium.Color.fromCssColorString(point2.color);
  45345. this._editEntity.point.pixelSize = parseFloat(point2.pixelSize);
  45346. this._editEntity.point.outlineColor = Cesium.Color.fromCssColorString(point2.outlineColor);
  45347. this._editEntity.point.outlineWidth = parseFloat(point2.outlineWidth);
  45348. this._editEntity.setParams(params);
  45349. },
  45350. _updatePoint2LabelProperty(params) {
  45351. let label = params.label;
  45352. this._editEntity.label.text = label.text;
  45353. let font = "";
  45354. if (label.italic) {
  45355. font += "italic ";
  45356. }
  45357. if (label.bolder) {
  45358. font += " bolder ";
  45359. }
  45360. font += label.fontSize + "px " + label.font;
  45361. this._editEntity.label.font = font;
  45362. this._editEntity.label.fillColor = Cesium.Color.fromCssColorString(label.fillColor);
  45363. this._editEntity.label.outlineColor = Cesium.Color.fromCssColorString(label.outlineColor);
  45364. this._editEntity.label.outlineWidth = parseFloat(label.outlineWidth);
  45365. this._editEntity.label.showBackground = label.showBackground;
  45366. this._editEntity.label.backgroundColor = Cesium.Color.fromCssColorString(label.backgroundColor);
  45367. this._editEntity.label.backgroundPadding = new Cesium.Cartesian2(parseFloat(label.backgroundPadding), parseFloat(label.backgroundPadding));
  45368. let point2 = params.point;
  45369. this._editEntity.point.color = Cesium.Color.fromCssColorString(point2.color);
  45370. this._editEntity.point.pixelSize = parseFloat(point2.pixelSize);
  45371. this._editEntity.point.outlineColor = Cesium.Color.fromCssColorString(point2.outlineColor);
  45372. this._editEntity.point.outlineWidth = parseFloat(point2.outlineWidth);
  45373. this._editEntity.setParams(params);
  45374. },
  45375. _updateBillboardProperty(params) {
  45376. let billboard = params.billboard;
  45377. this._editEntity.billboard.image = billboard.imgUrl;
  45378. this._editEntity.billboard.scale = billboard.scale;
  45379. this._editEntity.setParams(params);
  45380. },
  45381. _updateBillboard2LabelProperty(params) {
  45382. let label = params.label;
  45383. this._editEntity.label.text = label.text;
  45384. let font = "";
  45385. if (label.italic) {
  45386. font += "italic ";
  45387. }
  45388. if (label.bolder) {
  45389. font += " bolder ";
  45390. }
  45391. font += label.fontSize + "px " + label.font;
  45392. this._editEntity.label.font = font;
  45393. this._editEntity.label.fillColor = Cesium.Color.fromCssColorString(label.fillColor);
  45394. this._editEntity.label.outlineColor = Cesium.Color.fromCssColorString(label.outlineColor);
  45395. this._editEntity.label.outlineWidth = parseFloat(label.outlineWidth);
  45396. this._editEntity.label.showBackground = label.showBackground;
  45397. this._editEntity.label.backgroundColor = Cesium.Color.fromCssColorString(label.backgroundColor);
  45398. this._editEntity.label.backgroundPadding = new Cesium.Cartesian2(parseFloat(label.backgroundPadding), parseFloat(label.backgroundPadding));
  45399. this._editEntity.label.pixelOffset = new Cesium.Cartesian2(parseFloat(label.pixelOffsetX), parseFloat(label.pixelOffsetY));
  45400. let billboard = params.billboard;
  45401. this._editEntity.billboard.image = billboard.imgUrl;
  45402. this._editEntity.billboard.scale = billboard.scale;
  45403. this._editEntity.setParams(params);
  45404. }
  45405. });
  45406. Object.assign(DrawPoint.prototype, {
  45407. _setEntityIsEdit(entity) {
  45408. let _self = this;
  45409. this._unActivateEdit();
  45410. entity.setIsEdit(true);
  45411. this._sendShowPropertyDialog(entity);
  45412. let handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  45413. this._registerLeftClickEvent(handler, function(event2) {
  45414. _self._unActivateEdit();
  45415. let feature2 = _self._viewer.scene.pick(event2.position);
  45416. if (feature2 !== void 0 && feature2.id instanceof Cesium.Entity) {
  45417. let editEntityType = feature2.id.getEntityType();
  45418. if (editEntityType === DrawPoint.DrawType.Label || editEntityType === DrawPoint.DrawType.Point || editEntityType === DrawPoint.DrawType.Point2Label || editEntityType === DrawPoint.DrawType.Billboard || editEntityType === DrawPoint.DrawType.Billboard2Label || editEntityType === DrawPoint.DrawType.Model) {
  45419. feature2.id.setIsEdit(true);
  45420. _self._sendShowPropertyDialog(feature2.id);
  45421. }
  45422. }
  45423. });
  45424. this._registerMouseMoveEvent(handler, function(event2) {
  45425. let toolTip = "\u5355\u51FB\u4FEE\u6539\u5C5E\u6027\uFF0C\u5355\u51FB\u62D6\u52A8\u4FEE\u6539\u4F4D\u7F6E";
  45426. let feature2 = _self._viewer.scene.pick(event2.endPosition);
  45427. if (feature2 !== void 0 && feature2.id instanceof Cesium.Entity) {
  45428. let editEntityType = feature2.id.getEntityType();
  45429. if (editEntityType === DrawPoint.DrawType.Label || editEntityType === DrawPoint.DrawType.Point || editEntityType === DrawPoint.DrawType.Point2Label || editEntityType === DrawPoint.DrawType.Billboard || editEntityType === DrawPoint.DrawType.Billboard2Label || editEntityType === DrawPoint.DrawType.Model) {
  45430. if (feature2.id.getIsEdit()) {
  45431. toolTip = "\u5355\u51FB\u4FEE\u6539\u5C5E\u6027\uFF0C\u5355\u51FB\u62D6\u52A8\u4FEE\u6539\u4F4D\u7F6E";
  45432. CreateRemindertip(toolTip, event2.endPosition, true);
  45433. } else {
  45434. toolTip = "\u5355\u51FB\u4FEE\u6539\u5C5E\u6027";
  45435. CreateRemindertip(toolTip, event2.endPosition, true);
  45436. }
  45437. }
  45438. } else {
  45439. CreateRemindertip(toolTip, event2.endPosition, false);
  45440. }
  45441. });
  45442. },
  45443. _unActivateEdit: function() {
  45444. if (this._sketchEditHandler != void 0) {
  45445. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_DOWN);
  45446. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP);
  45447. this._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  45448. }
  45449. this._editEntity = void 0;
  45450. for (var i2 = 0; i2 < this._entities.length; i2++) {
  45451. var getById = this._viewer.entities.getById(this._entities[i2]);
  45452. if (getById) {
  45453. getById.setIsEdit(false);
  45454. }
  45455. }
  45456. this._closePropertyEditDialog();
  45457. },
  45458. _sendShowPropertyDialog(entity) {
  45459. let _self = this;
  45460. let editEntityType = entity.getEntityType();
  45461. if (entity.getIsEdit() === void 0 || entity.getIsEdit() === false || editEntityType === void 0) {
  45462. this._unActivateEdit();
  45463. return;
  45464. }
  45465. let editProperty = entity.getParams();
  45466. if (editProperty !== void 0 && this.onEditProperty !== void 0) {
  45467. editProperty.id = editEntityType;
  45468. _self._openPropertyEditDialog(
  45469. editProperty,
  45470. function(params) {
  45471. _self.updateEditEntityProperty(params);
  45472. },
  45473. function() {
  45474. _self._viewer.entities.remove(entity);
  45475. _self._editEntity = void 0;
  45476. }
  45477. );
  45478. }
  45479. this._activeteNormalEdit(entity);
  45480. },
  45481. _activeteNormalEdit: function(editEntity) {
  45482. let _self = this;
  45483. editEntity.getEntityType();
  45484. this._editEntity = editEntity;
  45485. if (this._sketchEditHandler === void 0) {
  45486. this._sketchEditHandler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  45487. }
  45488. this._registerLeftDownEvent(this._sketchEditHandler, function(event2) {
  45489. const pickInfo = _self._viewer.scene.pick(event2.position);
  45490. console.log(pickInfo);
  45491. if (!pickInfo) {
  45492. return;
  45493. }
  45494. console.log("\u6309\u4E0B");
  45495. _self._viewer.scene.screenSpaceCameraController.enableRotate = false;
  45496. _self._registerMouseMoveEvent(_self._sketchEditHandler, function(event3) {
  45497. console.log("\u79FB\u52A8");
  45498. const position2 = event3.endPosition;
  45499. const cartesian = _self._viewer.scene.globe.pick(_self._viewer.camera.getPickRay(position2), _self._viewer.scene);
  45500. const selectedEntity = _self._editEntity;
  45501. if (!selectedEntity) {
  45502. return false;
  45503. }
  45504. selectedEntity.position = cartesian;
  45505. });
  45506. _self._registerLeftUpEvent(_self._sketchEditHandler, function(event3) {
  45507. _self._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.MOUSE_MOVE);
  45508. _self._sketchEditHandler.removeInputAction(Cesium.ScreenSpaceEventType.LEFT_UP);
  45509. _self._viewer.scene.screenSpaceCameraController.enableRotate = true;
  45510. console.log("\u62AC\u8D77");
  45511. });
  45512. });
  45513. },
  45514. _updateModelProperty(params) {
  45515. let model = params.model;
  45516. this._editEntity.model.uri = model.url;
  45517. this._editEntity.model.color = Cesium.Color.WHITE.withAlpha(model.alpha);
  45518. this._editEntity.model.minimumPixelSize = model.minimumPixelSize;
  45519. this._editEntity.model.maximumScale = model.maximumScale;
  45520. this._editEntity.model.silhouetteSize = model.silhouetteSize;
  45521. this._editEntity.model.silhouetteColor = new Cesium.Color.fromCssColorString(model.silhouetteColor);
  45522. var heading = Cesium.Math.toRadians(model.heading);
  45523. var pitch = model.pitch;
  45524. var roll = model.roll;
  45525. new Cesium.HeadingPitchRoll(heading, pitch, roll);
  45526. this._editEntity.setParams(params);
  45527. }
  45528. });
  45529. Object.assign(DrawPoint.prototype, {
  45530. _openPropertyEditDialog: function(params, callEdit, callRemove) {
  45531. this._editPropertyDialogDomId = "dialog-property-dom-point";
  45532. this._registerDOMPropertyEdit = "dialog-edit-property-point";
  45533. let PropertyEditComponent = customElements.get(this._registerDOMPropertyEdit);
  45534. if (PropertyEditComponent === void 0) {
  45535. PropertyEditComponent = defineCustomElement(DialogEditProperty);
  45536. customElements.define(this._registerDOMPropertyEdit, PropertyEditComponent);
  45537. }
  45538. this._closePropertyEditDialog();
  45539. let dialogPropertyElement = new PropertyEditComponent({
  45540. params
  45541. });
  45542. dialogPropertyElement.id = this._editPropertyDialogDomId;
  45543. dialogPropertyElement.showDialog = true;
  45544. document.body.appendChild(dialogPropertyElement);
  45545. dialogPropertyElement.addEventListener(
  45546. "submit",
  45547. (e) => {
  45548. if (callEdit)
  45549. callEdit(e.detail[0]);
  45550. },
  45551. false
  45552. );
  45553. dialogPropertyElement.addEventListener(
  45554. "remove",
  45555. (e) => {
  45556. if (callRemove)
  45557. callRemove();
  45558. },
  45559. false
  45560. );
  45561. },
  45562. _closePropertyEditDialog() {
  45563. let dom2 = document.getElementById(this._editPropertyDialogDomId);
  45564. if (dom2 !== null && dom2 !== void 0) {
  45565. document.body.removeChild(dom2);
  45566. }
  45567. }
  45568. });
  45569. DrawPoint.DrawType = Object.freeze({
  45570. Model: "model",
  45571. Label: "label",
  45572. Point: "point",
  45573. Point2Label: "point2Label",
  45574. Billboard: "billboard",
  45575. Billboard2Label: "billboard2Label"
  45576. });
  45577. var MultiFieldAdaptWindow$1 = "";
  45578. class MultiFieldAdaptWindow {
  45579. constructor(viewer2, position2, title, properties, offsetHeight) {
  45580. if (!viewer2)
  45581. throw new Cesium.DeveloperError("no viewer object!");
  45582. if (!position2)
  45583. throw new Cesium.DeveloperError("no position object!");
  45584. this.viewer = viewer2;
  45585. this.position = position2;
  45586. this.offsetHeight = offsetHeight;
  45587. if (position2 instanceof Cesium.Cartesian3) {
  45588. this.position = position2;
  45589. } else {
  45590. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  45591. }
  45592. if (document.getElementsByClassName("MultiField-popup").length > 0) {
  45593. document.getElementsByClassName("MultiField-popup")[0].remove();
  45594. viewer2.entities.remove(viewer2.entities.getById("MultiFieldPopupPoint"));
  45595. }
  45596. this.id = "popup_" + getGuid();
  45597. this.popupDiv = document.createElement("div");
  45598. this.popupDiv.classList.add("MultiField-popup");
  45599. this.popupDiv.id = this.id;
  45600. this.viewer.container.append(this.popupDiv);
  45601. this.popupDiv.innerHTML = this._createHtml(title, properties);
  45602. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  45603. this.initPoint();
  45604. document.getElementsByClassName("leaflet-popup-close-button")[0].onclick = () => {
  45605. this.close();
  45606. };
  45607. }
  45608. postRender() {
  45609. this.viewer.scene.canvas.height;
  45610. const windowPosition = new Cesium.Cartesian2();
  45611. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  45612. this.viewer.scene,
  45613. this.position,
  45614. windowPosition
  45615. );
  45616. let elWidth = this.popupDiv.offsetWidth;
  45617. let elHeight = this.popupDiv.offsetHeight;
  45618. if (!!this.offsetHeight) {
  45619. elHeight += this.offsetHeight;
  45620. }
  45621. this.popupDiv.style.left = windowPosition.x - elWidth / 2 + "px";
  45622. this.popupDiv.style.top = windowPosition.y - elHeight + "px";
  45623. const camerPosition = this.viewer.camera.position;
  45624. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  45625. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  45626. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  45627. this.popupDiv.style.display = "block";
  45628. } else {
  45629. this.popupDiv.style.display = "none";
  45630. }
  45631. }
  45632. _createHtml(header, content) {
  45633. let html = `
  45634. <div class="MultiField-popup-header">
  45635. ` + header + `
  45636. <span class="leaflet-popup-close-button">\xD7</span>
  45637. </div>
  45638. <div class="MultiField-popup-content">
  45639. ` + this._createTable(content) + `
  45640. </div>
  45641. <div class="MultiField-popup-tip">
  45642. </div>
  45643. `;
  45644. return html;
  45645. }
  45646. _createTable(content) {
  45647. let html = '<table class="table-popup">';
  45648. for (let key in content) {
  45649. html += `<tr><td class="title-popup">${key}</td>
  45650. <td class="value-popup">${content[key]}</td></tr>`;
  45651. }
  45652. html += "</table>";
  45653. return html;
  45654. }
  45655. initPoint() {
  45656. this.billboard = new Cesium.Entity({
  45657. id: "MultiFieldPopupPoint",
  45658. name: "popupPoint",
  45659. position: this.position,
  45660. billboard: {
  45661. image: "jt3dSDK/imgs/point/point.png",
  45662. horizontalOrigin: Cesium.HorizontalOrigin.center,
  45663. verticalOrigin: Cesium.VerticalOrigin.bottom,
  45664. scale: 1,
  45665. pixelOffset: new Cesium.Cartesian2(0, 0),
  45666. disableDepthTestDistance: Number.POSITIVE_INFINITY
  45667. }
  45668. });
  45669. this.viewer.entities.add(this.billboard);
  45670. }
  45671. }
  45672. Object.assign(MultiFieldAdaptWindow.prototype, {
  45673. close() {
  45674. this.popupDiv.remove();
  45675. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  45676. this.viewer.entities.remove(this.billboard);
  45677. }
  45678. });
  45679. var win;
  45680. if (typeof window !== "undefined") {
  45681. win = window;
  45682. } else if (typeof commonjsGlobal !== "undefined") {
  45683. win = commonjsGlobal;
  45684. } else if (typeof self !== "undefined") {
  45685. win = self;
  45686. } else {
  45687. win = {};
  45688. }
  45689. var window_1 = win;
  45690. var __viteBrowserExternal = {};
  45691. var __viteBrowserExternal$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  45692. __proto__: null,
  45693. "default": __viteBrowserExternal
  45694. }, Symbol.toStringTag, { value: "Module" }));
  45695. var require$$0 = /* @__PURE__ */ getAugmentedNamespace(__viteBrowserExternal$1);
  45696. var topLevel = typeof commonjsGlobal !== "undefined" ? commonjsGlobal : typeof window !== "undefined" ? window : {};
  45697. var minDoc = require$$0;
  45698. var doccy;
  45699. if (typeof document !== "undefined") {
  45700. doccy = document;
  45701. } else {
  45702. doccy = topLevel["__GLOBAL_DOCUMENT_CACHE@4"];
  45703. if (!doccy) {
  45704. doccy = topLevel["__GLOBAL_DOCUMENT_CACHE@4"] = minDoc;
  45705. }
  45706. }
  45707. var document_1 = doccy;
  45708. var keycode$1 = { exports: {} };
  45709. (function(module2, exports2) {
  45710. function keyCode(searchInput) {
  45711. if (searchInput && "object" === typeof searchInput) {
  45712. var hasKeyCode = searchInput.which || searchInput.keyCode || searchInput.charCode;
  45713. if (hasKeyCode)
  45714. searchInput = hasKeyCode;
  45715. }
  45716. if ("number" === typeof searchInput)
  45717. return names2[searchInput];
  45718. var search = String(searchInput);
  45719. var foundNamedKey = codes[search.toLowerCase()];
  45720. if (foundNamedKey)
  45721. return foundNamedKey;
  45722. var foundNamedKey = aliases[search.toLowerCase()];
  45723. if (foundNamedKey)
  45724. return foundNamedKey;
  45725. if (search.length === 1)
  45726. return search.charCodeAt(0);
  45727. return void 0;
  45728. }
  45729. keyCode.isEventKey = function isEventKey(event2, nameOrCode) {
  45730. if (event2 && "object" === typeof event2) {
  45731. var keyCode2 = event2.which || event2.keyCode || event2.charCode;
  45732. if (keyCode2 === null || keyCode2 === void 0) {
  45733. return false;
  45734. }
  45735. if (typeof nameOrCode === "string") {
  45736. var foundNamedKey = codes[nameOrCode.toLowerCase()];
  45737. if (foundNamedKey) {
  45738. return foundNamedKey === keyCode2;
  45739. }
  45740. var foundNamedKey = aliases[nameOrCode.toLowerCase()];
  45741. if (foundNamedKey) {
  45742. return foundNamedKey === keyCode2;
  45743. }
  45744. } else if (typeof nameOrCode === "number") {
  45745. return nameOrCode === keyCode2;
  45746. }
  45747. return false;
  45748. }
  45749. };
  45750. exports2 = module2.exports = keyCode;
  45751. var codes = exports2.code = exports2.codes = {
  45752. "backspace": 8,
  45753. "tab": 9,
  45754. "enter": 13,
  45755. "shift": 16,
  45756. "ctrl": 17,
  45757. "alt": 18,
  45758. "pause/break": 19,
  45759. "caps lock": 20,
  45760. "esc": 27,
  45761. "space": 32,
  45762. "page up": 33,
  45763. "page down": 34,
  45764. "end": 35,
  45765. "home": 36,
  45766. "left": 37,
  45767. "up": 38,
  45768. "right": 39,
  45769. "down": 40,
  45770. "insert": 45,
  45771. "delete": 46,
  45772. "command": 91,
  45773. "left command": 91,
  45774. "right command": 93,
  45775. "numpad *": 106,
  45776. "numpad +": 107,
  45777. "numpad -": 109,
  45778. "numpad .": 110,
  45779. "numpad /": 111,
  45780. "num lock": 144,
  45781. "scroll lock": 145,
  45782. "my computer": 182,
  45783. "my calculator": 183,
  45784. ";": 186,
  45785. "=": 187,
  45786. ",": 188,
  45787. "-": 189,
  45788. ".": 190,
  45789. "/": 191,
  45790. "`": 192,
  45791. "[": 219,
  45792. "\\": 220,
  45793. "]": 221,
  45794. "'": 222
  45795. };
  45796. var aliases = exports2.aliases = {
  45797. "windows": 91,
  45798. "\u21E7": 16,
  45799. "\u2325": 18,
  45800. "\u2303": 17,
  45801. "\u2318": 91,
  45802. "ctl": 17,
  45803. "control": 17,
  45804. "option": 18,
  45805. "pause": 19,
  45806. "break": 19,
  45807. "caps": 20,
  45808. "return": 13,
  45809. "escape": 27,
  45810. "spc": 32,
  45811. "spacebar": 32,
  45812. "pgup": 33,
  45813. "pgdn": 34,
  45814. "ins": 45,
  45815. "del": 46,
  45816. "cmd": 91
  45817. };
  45818. /*!
  45819. * Programatically add the following
  45820. */
  45821. for (i2 = 97; i2 < 123; i2++)
  45822. codes[String.fromCharCode(i2)] = i2 - 32;
  45823. for (var i2 = 48; i2 < 58; i2++)
  45824. codes[i2 - 48] = i2;
  45825. for (i2 = 1; i2 < 13; i2++)
  45826. codes["f" + i2] = i2 + 111;
  45827. for (i2 = 0; i2 < 10; i2++)
  45828. codes["numpad " + i2] = i2 + 96;
  45829. var names2 = exports2.names = exports2.title = {};
  45830. for (i2 in codes)
  45831. names2[codes[i2]] = i2;
  45832. for (var alias in aliases) {
  45833. codes[alias] = aliases[alias];
  45834. }
  45835. })(keycode$1, keycode$1.exports);
  45836. var keycode = keycode$1.exports;
  45837. var tuple = SafeParseTuple;
  45838. function SafeParseTuple(obj, reviver) {
  45839. var json;
  45840. var error = null;
  45841. try {
  45842. json = JSON.parse(obj, reviver);
  45843. } catch (err) {
  45844. error = err;
  45845. }
  45846. return [error, json];
  45847. }
  45848. var lib = { exports: {} };
  45849. function _extends$2() {
  45850. _extends$2 = Object.assign ? Object.assign.bind() : function(target) {
  45851. for (var i2 = 1; i2 < arguments.length; i2++) {
  45852. var source = arguments[i2];
  45853. for (var key in source) {
  45854. if (Object.prototype.hasOwnProperty.call(source, key)) {
  45855. target[key] = source[key];
  45856. }
  45857. }
  45858. }
  45859. return target;
  45860. };
  45861. return _extends$2.apply(this, arguments);
  45862. }
  45863. var _extends$3 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
  45864. __proto__: null,
  45865. "default": _extends$2
  45866. }, Symbol.toStringTag, { value: "Module" }));
  45867. var require$$1 = /* @__PURE__ */ getAugmentedNamespace(_extends$3);
  45868. var isFunction_1 = isFunction$1;
  45869. var toString$2 = Object.prototype.toString;
  45870. function isFunction$1(fn2) {
  45871. if (!fn2) {
  45872. return false;
  45873. }
  45874. var string = toString$2.call(fn2);
  45875. return string === "[object Function]" || typeof fn2 === "function" && string !== "[object RegExp]" || typeof window !== "undefined" && (fn2 === window.setTimeout || fn2 === window.alert || fn2 === window.confirm || fn2 === window.prompt);
  45876. }
  45877. var window$3 = window_1;
  45878. var httpResponseHandler = function httpResponseHandler2(callback2, decodeResponseBody) {
  45879. if (decodeResponseBody === void 0) {
  45880. decodeResponseBody = false;
  45881. }
  45882. return function(err, response, responseBody) {
  45883. if (err) {
  45884. callback2(err);
  45885. return;
  45886. }
  45887. if (response.statusCode >= 400 && response.statusCode <= 599) {
  45888. var cause = responseBody;
  45889. if (decodeResponseBody) {
  45890. if (window$3.TextDecoder) {
  45891. var charset = getCharset(response.headers && response.headers["content-type"]);
  45892. try {
  45893. cause = new TextDecoder(charset).decode(responseBody);
  45894. } catch (e) {
  45895. }
  45896. } else {
  45897. cause = String.fromCharCode.apply(null, new Uint8Array(responseBody));
  45898. }
  45899. }
  45900. callback2({
  45901. cause
  45902. });
  45903. return;
  45904. }
  45905. callback2(null, responseBody);
  45906. };
  45907. };
  45908. function getCharset(contentTypeHeader) {
  45909. if (contentTypeHeader === void 0) {
  45910. contentTypeHeader = "";
  45911. }
  45912. return contentTypeHeader.toLowerCase().split(";").reduce(function(charset, contentType) {
  45913. var _contentType$split = contentType.split("="), type2 = _contentType$split[0], value = _contentType$split[1];
  45914. if (type2.trim() === "charset") {
  45915. return value.trim();
  45916. }
  45917. return charset;
  45918. }, "utf-8");
  45919. }
  45920. var httpHandler = httpResponseHandler;
  45921. var window$2 = window_1;
  45922. var _extends$1 = require$$1;
  45923. var isFunction = isFunction_1;
  45924. createXHR.httpHandler = httpHandler;
  45925. /**
  45926. * @license
  45927. * slighly modified parse-headers 2.0.2 <https://github.com/kesla/parse-headers/>
  45928. * Copyright (c) 2014 David Björklund
  45929. * Available under the MIT license
  45930. * <https://github.com/kesla/parse-headers/blob/master/LICENCE>
  45931. */
  45932. var parseHeaders = function parseHeaders2(headers) {
  45933. var result = {};
  45934. if (!headers) {
  45935. return result;
  45936. }
  45937. headers.trim().split("\n").forEach(function(row) {
  45938. var index2 = row.indexOf(":");
  45939. var key = row.slice(0, index2).trim().toLowerCase();
  45940. var value = row.slice(index2 + 1).trim();
  45941. if (typeof result[key] === "undefined") {
  45942. result[key] = value;
  45943. } else if (Array.isArray(result[key])) {
  45944. result[key].push(value);
  45945. } else {
  45946. result[key] = [result[key], value];
  45947. }
  45948. });
  45949. return result;
  45950. };
  45951. lib.exports = createXHR;
  45952. lib.exports.default = createXHR;
  45953. createXHR.XMLHttpRequest = window$2.XMLHttpRequest || noop$2;
  45954. createXHR.XDomainRequest = "withCredentials" in new createXHR.XMLHttpRequest() ? createXHR.XMLHttpRequest : window$2.XDomainRequest;
  45955. forEachArray(["get", "put", "post", "patch", "head", "delete"], function(method) {
  45956. createXHR[method === "delete" ? "del" : method] = function(uri, options2, callback2) {
  45957. options2 = initParams(uri, options2, callback2);
  45958. options2.method = method.toUpperCase();
  45959. return _createXHR(options2);
  45960. };
  45961. });
  45962. function forEachArray(array, iterator) {
  45963. for (var i2 = 0; i2 < array.length; i2++) {
  45964. iterator(array[i2]);
  45965. }
  45966. }
  45967. function isEmpty(obj) {
  45968. for (var i2 in obj) {
  45969. if (obj.hasOwnProperty(i2))
  45970. return false;
  45971. }
  45972. return true;
  45973. }
  45974. function initParams(uri, options2, callback2) {
  45975. var params = uri;
  45976. if (isFunction(options2)) {
  45977. callback2 = options2;
  45978. if (typeof uri === "string") {
  45979. params = {
  45980. uri
  45981. };
  45982. }
  45983. } else {
  45984. params = _extends$1({}, options2, {
  45985. uri
  45986. });
  45987. }
  45988. params.callback = callback2;
  45989. return params;
  45990. }
  45991. function createXHR(uri, options2, callback2) {
  45992. options2 = initParams(uri, options2, callback2);
  45993. return _createXHR(options2);
  45994. }
  45995. function _createXHR(options2) {
  45996. if (typeof options2.callback === "undefined") {
  45997. throw new Error("callback argument missing");
  45998. }
  45999. var called = false;
  46000. var callback2 = function cbOnce(err, response, body2) {
  46001. if (!called) {
  46002. called = true;
  46003. options2.callback(err, response, body2);
  46004. }
  46005. };
  46006. function readystatechange() {
  46007. if (xhr.readyState === 4) {
  46008. setTimeout(loadFunc, 0);
  46009. }
  46010. }
  46011. function getBody() {
  46012. var body2 = void 0;
  46013. if (xhr.response) {
  46014. body2 = xhr.response;
  46015. } else {
  46016. body2 = xhr.responseText || getXml(xhr);
  46017. }
  46018. if (isJson) {
  46019. try {
  46020. body2 = JSON.parse(body2);
  46021. } catch (e) {
  46022. }
  46023. }
  46024. return body2;
  46025. }
  46026. function errorFunc(evt) {
  46027. clearTimeout(timeoutTimer);
  46028. if (!(evt instanceof Error)) {
  46029. evt = new Error("" + (evt || "Unknown XMLHttpRequest Error"));
  46030. }
  46031. evt.statusCode = 0;
  46032. return callback2(evt, failureResponse);
  46033. }
  46034. function loadFunc() {
  46035. if (aborted)
  46036. return;
  46037. var status;
  46038. clearTimeout(timeoutTimer);
  46039. if (options2.useXDR && xhr.status === void 0) {
  46040. status = 200;
  46041. } else {
  46042. status = xhr.status === 1223 ? 204 : xhr.status;
  46043. }
  46044. var response = failureResponse;
  46045. var err = null;
  46046. if (status !== 0) {
  46047. response = {
  46048. body: getBody(),
  46049. statusCode: status,
  46050. method,
  46051. headers: {},
  46052. url: uri,
  46053. rawRequest: xhr
  46054. };
  46055. if (xhr.getAllResponseHeaders) {
  46056. response.headers = parseHeaders(xhr.getAllResponseHeaders());
  46057. }
  46058. } else {
  46059. err = new Error("Internal XMLHttpRequest Error");
  46060. }
  46061. return callback2(err, response, response.body);
  46062. }
  46063. var xhr = options2.xhr || null;
  46064. if (!xhr) {
  46065. if (options2.cors || options2.useXDR) {
  46066. xhr = new createXHR.XDomainRequest();
  46067. } else {
  46068. xhr = new createXHR.XMLHttpRequest();
  46069. }
  46070. }
  46071. var key;
  46072. var aborted;
  46073. var uri = xhr.url = options2.uri || options2.url;
  46074. var method = xhr.method = options2.method || "GET";
  46075. var body = options2.body || options2.data;
  46076. var headers = xhr.headers = options2.headers || {};
  46077. var sync = !!options2.sync;
  46078. var isJson = false;
  46079. var timeoutTimer;
  46080. var failureResponse = {
  46081. body: void 0,
  46082. headers: {},
  46083. statusCode: 0,
  46084. method,
  46085. url: uri,
  46086. rawRequest: xhr
  46087. };
  46088. if ("json" in options2 && options2.json !== false) {
  46089. isJson = true;
  46090. headers["accept"] || headers["Accept"] || (headers["Accept"] = "application/json");
  46091. if (method !== "GET" && method !== "HEAD") {
  46092. headers["content-type"] || headers["Content-Type"] || (headers["Content-Type"] = "application/json");
  46093. body = JSON.stringify(options2.json === true ? body : options2.json);
  46094. }
  46095. }
  46096. xhr.onreadystatechange = readystatechange;
  46097. xhr.onload = loadFunc;
  46098. xhr.onerror = errorFunc;
  46099. xhr.onprogress = function() {
  46100. };
  46101. xhr.onabort = function() {
  46102. aborted = true;
  46103. };
  46104. xhr.ontimeout = errorFunc;
  46105. xhr.open(method, uri, !sync, options2.username, options2.password);
  46106. if (!sync) {
  46107. xhr.withCredentials = !!options2.withCredentials;
  46108. }
  46109. if (!sync && options2.timeout > 0) {
  46110. timeoutTimer = setTimeout(function() {
  46111. if (aborted)
  46112. return;
  46113. aborted = true;
  46114. xhr.abort("timeout");
  46115. var e = new Error("XMLHttpRequest timeout");
  46116. e.code = "ETIMEDOUT";
  46117. errorFunc(e);
  46118. }, options2.timeout);
  46119. }
  46120. if (xhr.setRequestHeader) {
  46121. for (key in headers) {
  46122. if (headers.hasOwnProperty(key)) {
  46123. xhr.setRequestHeader(key, headers[key]);
  46124. }
  46125. }
  46126. } else if (options2.headers && !isEmpty(options2.headers)) {
  46127. throw new Error("Headers cannot be set on an XDomainRequest object");
  46128. }
  46129. if ("responseType" in options2) {
  46130. xhr.responseType = options2.responseType;
  46131. }
  46132. if ("beforeSend" in options2 && typeof options2.beforeSend === "function") {
  46133. options2.beforeSend(xhr);
  46134. }
  46135. xhr.send(body || null);
  46136. return xhr;
  46137. }
  46138. function getXml(xhr) {
  46139. try {
  46140. if (xhr.responseType === "document") {
  46141. return xhr.responseXML;
  46142. }
  46143. var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === "parsererror";
  46144. if (xhr.responseType === "" && !firefoxBugTakenEffect) {
  46145. return xhr.responseXML;
  46146. }
  46147. } catch (e) {
  46148. }
  46149. return null;
  46150. }
  46151. function noop$2() {
  46152. }
  46153. var XHR = lib.exports;
  46154. var browserIndex = { exports: {} };
  46155. var document$1 = document_1;
  46156. var _objCreate = Object.create || function() {
  46157. function F() {
  46158. }
  46159. return function(o) {
  46160. if (arguments.length !== 1) {
  46161. throw new Error("Object.create shim only accepts one parameter.");
  46162. }
  46163. F.prototype = o;
  46164. return new F();
  46165. };
  46166. }();
  46167. function ParsingError(errorData, message) {
  46168. this.name = "ParsingError";
  46169. this.code = errorData.code;
  46170. this.message = message || errorData.message;
  46171. }
  46172. ParsingError.prototype = _objCreate(Error.prototype);
  46173. ParsingError.prototype.constructor = ParsingError;
  46174. ParsingError.Errors = {
  46175. BadSignature: {
  46176. code: 0,
  46177. message: "Malformed WebVTT signature."
  46178. },
  46179. BadTimeStamp: {
  46180. code: 1,
  46181. message: "Malformed time stamp."
  46182. }
  46183. };
  46184. function parseTimeStamp(input) {
  46185. function computeSeconds(h2, m2, s, f) {
  46186. return (h2 | 0) * 3600 + (m2 | 0) * 60 + (s | 0) + (f | 0) / 1e3;
  46187. }
  46188. var m = input.match(/^(\d+):(\d{1,2})(:\d{1,2})?\.(\d{3})/);
  46189. if (!m) {
  46190. return null;
  46191. }
  46192. if (m[3]) {
  46193. return computeSeconds(m[1], m[2], m[3].replace(":", ""), m[4]);
  46194. } else if (m[1] > 59) {
  46195. return computeSeconds(m[1], m[2], 0, m[4]);
  46196. } else {
  46197. return computeSeconds(0, m[1], m[2], m[4]);
  46198. }
  46199. }
  46200. function Settings() {
  46201. this.values = _objCreate(null);
  46202. }
  46203. Settings.prototype = {
  46204. set: function(k, v) {
  46205. if (!this.get(k) && v !== "") {
  46206. this.values[k] = v;
  46207. }
  46208. },
  46209. get: function(k, dflt, defaultKey) {
  46210. if (defaultKey) {
  46211. return this.has(k) ? this.values[k] : dflt[defaultKey];
  46212. }
  46213. return this.has(k) ? this.values[k] : dflt;
  46214. },
  46215. has: function(k) {
  46216. return k in this.values;
  46217. },
  46218. alt: function(k, v, a) {
  46219. for (var n = 0; n < a.length; ++n) {
  46220. if (v === a[n]) {
  46221. this.set(k, v);
  46222. break;
  46223. }
  46224. }
  46225. },
  46226. integer: function(k, v) {
  46227. if (/^-?\d+$/.test(v)) {
  46228. this.set(k, parseInt(v, 10));
  46229. }
  46230. },
  46231. percent: function(k, v) {
  46232. if (v.match(/^([\d]{1,3})(\.[\d]*)?%$/)) {
  46233. v = parseFloat(v);
  46234. if (v >= 0 && v <= 100) {
  46235. this.set(k, v);
  46236. return true;
  46237. }
  46238. }
  46239. return false;
  46240. }
  46241. };
  46242. function parseOptions(input, callback2, keyValueDelim, groupDelim) {
  46243. var groups = groupDelim ? input.split(groupDelim) : [input];
  46244. for (var i2 in groups) {
  46245. if (typeof groups[i2] !== "string") {
  46246. continue;
  46247. }
  46248. var kv = groups[i2].split(keyValueDelim);
  46249. if (kv.length !== 2) {
  46250. continue;
  46251. }
  46252. var k = kv[0].trim();
  46253. var v = kv[1].trim();
  46254. callback2(k, v);
  46255. }
  46256. }
  46257. function parseCue(input, cue, regionList) {
  46258. var oInput = input;
  46259. function consumeTimeStamp() {
  46260. var ts3 = parseTimeStamp(input);
  46261. if (ts3 === null) {
  46262. throw new ParsingError(
  46263. ParsingError.Errors.BadTimeStamp,
  46264. "Malformed timestamp: " + oInput
  46265. );
  46266. }
  46267. input = input.replace(/^[^\sa-zA-Z-]+/, "");
  46268. return ts3;
  46269. }
  46270. function consumeCueSettings(input2, cue2) {
  46271. var settings = new Settings();
  46272. parseOptions(input2, function(k, v) {
  46273. switch (k) {
  46274. case "region":
  46275. for (var i2 = regionList.length - 1; i2 >= 0; i2--) {
  46276. if (regionList[i2].id === v) {
  46277. settings.set(k, regionList[i2].region);
  46278. break;
  46279. }
  46280. }
  46281. break;
  46282. case "vertical":
  46283. settings.alt(k, v, ["rl", "lr"]);
  46284. break;
  46285. case "line":
  46286. var vals = v.split(","), vals0 = vals[0];
  46287. settings.integer(k, vals0);
  46288. settings.percent(k, vals0) ? settings.set("snapToLines", false) : null;
  46289. settings.alt(k, vals0, ["auto"]);
  46290. if (vals.length === 2) {
  46291. settings.alt("lineAlign", vals[1], ["start", "center", "end"]);
  46292. }
  46293. break;
  46294. case "position":
  46295. vals = v.split(",");
  46296. settings.percent(k, vals[0]);
  46297. if (vals.length === 2) {
  46298. settings.alt("positionAlign", vals[1], ["start", "center", "end"]);
  46299. }
  46300. break;
  46301. case "size":
  46302. settings.percent(k, v);
  46303. break;
  46304. case "align":
  46305. settings.alt(k, v, ["start", "center", "end", "left", "right"]);
  46306. break;
  46307. }
  46308. }, /:/, /\s/);
  46309. cue2.region = settings.get("region", null);
  46310. cue2.vertical = settings.get("vertical", "");
  46311. try {
  46312. cue2.line = settings.get("line", "auto");
  46313. } catch (e) {
  46314. }
  46315. cue2.lineAlign = settings.get("lineAlign", "start");
  46316. cue2.snapToLines = settings.get("snapToLines", true);
  46317. cue2.size = settings.get("size", 100);
  46318. try {
  46319. cue2.align = settings.get("align", "center");
  46320. } catch (e) {
  46321. cue2.align = settings.get("align", "middle");
  46322. }
  46323. try {
  46324. cue2.position = settings.get("position", "auto");
  46325. } catch (e) {
  46326. cue2.position = settings.get("position", {
  46327. start: 0,
  46328. left: 0,
  46329. center: 50,
  46330. middle: 50,
  46331. end: 100,
  46332. right: 100
  46333. }, cue2.align);
  46334. }
  46335. cue2.positionAlign = settings.get("positionAlign", {
  46336. start: "start",
  46337. left: "start",
  46338. center: "center",
  46339. middle: "center",
  46340. end: "end",
  46341. right: "end"
  46342. }, cue2.align);
  46343. }
  46344. function skipWhitespace() {
  46345. input = input.replace(/^\s+/, "");
  46346. }
  46347. skipWhitespace();
  46348. cue.startTime = consumeTimeStamp();
  46349. skipWhitespace();
  46350. if (input.substr(0, 3) !== "-->") {
  46351. throw new ParsingError(
  46352. ParsingError.Errors.BadTimeStamp,
  46353. "Malformed time stamp (time stamps must be separated by '-->'): " + oInput
  46354. );
  46355. }
  46356. input = input.substr(3);
  46357. skipWhitespace();
  46358. cue.endTime = consumeTimeStamp();
  46359. skipWhitespace();
  46360. consumeCueSettings(input, cue);
  46361. }
  46362. var TEXTAREA_ELEMENT = document$1.createElement && document$1.createElement("textarea");
  46363. var TAG_NAME = {
  46364. c: "span",
  46365. i: "i",
  46366. b: "b",
  46367. u: "u",
  46368. ruby: "ruby",
  46369. rt: "rt",
  46370. v: "span",
  46371. lang: "span"
  46372. };
  46373. var DEFAULT_COLOR_CLASS = {
  46374. white: "rgba(255,255,255,1)",
  46375. lime: "rgba(0,255,0,1)",
  46376. cyan: "rgba(0,255,255,1)",
  46377. red: "rgba(255,0,0,1)",
  46378. yellow: "rgba(255,255,0,1)",
  46379. magenta: "rgba(255,0,255,1)",
  46380. blue: "rgba(0,0,255,1)",
  46381. black: "rgba(0,0,0,1)"
  46382. };
  46383. var TAG_ANNOTATION = {
  46384. v: "title",
  46385. lang: "lang"
  46386. };
  46387. var NEEDS_PARENT = {
  46388. rt: "ruby"
  46389. };
  46390. function parseContent(window2, input) {
  46391. function nextToken() {
  46392. if (!input) {
  46393. return null;
  46394. }
  46395. function consume(result) {
  46396. input = input.substr(result.length);
  46397. return result;
  46398. }
  46399. var m2 = input.match(/^([^<]*)(<[^>]*>?)?/);
  46400. return consume(m2[1] ? m2[1] : m2[2]);
  46401. }
  46402. function unescape2(s) {
  46403. TEXTAREA_ELEMENT.innerHTML = s;
  46404. s = TEXTAREA_ELEMENT.textContent;
  46405. TEXTAREA_ELEMENT.textContent = "";
  46406. return s;
  46407. }
  46408. function shouldAdd(current2, element) {
  46409. return !NEEDS_PARENT[element.localName] || NEEDS_PARENT[element.localName] === current2.localName;
  46410. }
  46411. function createElement(type2, annotation) {
  46412. var tagName = TAG_NAME[type2];
  46413. if (!tagName) {
  46414. return null;
  46415. }
  46416. var element = window2.document.createElement(tagName);
  46417. var name = TAG_ANNOTATION[type2];
  46418. if (name && annotation) {
  46419. element[name] = annotation.trim();
  46420. }
  46421. return element;
  46422. }
  46423. var rootDiv = window2.document.createElement("div"), current = rootDiv, t2, tagStack = [];
  46424. while ((t2 = nextToken()) !== null) {
  46425. if (t2[0] === "<") {
  46426. if (t2[1] === "/") {
  46427. if (tagStack.length && tagStack[tagStack.length - 1] === t2.substr(2).replace(">", "")) {
  46428. tagStack.pop();
  46429. current = current.parentNode;
  46430. }
  46431. continue;
  46432. }
  46433. var ts3 = parseTimeStamp(t2.substr(1, t2.length - 2));
  46434. var node;
  46435. if (ts3) {
  46436. node = window2.document.createProcessingInstruction("timestamp", ts3);
  46437. current.appendChild(node);
  46438. continue;
  46439. }
  46440. var m = t2.match(/^<([^.\s/0-9>]+)(\.[^\s\\>]+)?([^>\\]+)?(\\?)>?$/);
  46441. if (!m) {
  46442. continue;
  46443. }
  46444. node = createElement(m[1], m[3]);
  46445. if (!node) {
  46446. continue;
  46447. }
  46448. if (!shouldAdd(current, node)) {
  46449. continue;
  46450. }
  46451. if (m[2]) {
  46452. var classes = m[2].split(".");
  46453. classes.forEach(function(cl) {
  46454. var bgColor = /^bg_/.test(cl);
  46455. var colorName = bgColor ? cl.slice(3) : cl;
  46456. if (DEFAULT_COLOR_CLASS.hasOwnProperty(colorName)) {
  46457. var propName = bgColor ? "background-color" : "color";
  46458. var propValue = DEFAULT_COLOR_CLASS[colorName];
  46459. node.style[propName] = propValue;
  46460. }
  46461. });
  46462. node.className = classes.join(" ");
  46463. }
  46464. tagStack.push(m[1]);
  46465. current.appendChild(node);
  46466. current = node;
  46467. continue;
  46468. }
  46469. current.appendChild(window2.document.createTextNode(unescape2(t2)));
  46470. }
  46471. return rootDiv;
  46472. }
  46473. var strongRTLRanges = [
  46474. [1470, 1470],
  46475. [1472, 1472],
  46476. [1475, 1475],
  46477. [1478, 1478],
  46478. [1488, 1514],
  46479. [1520, 1524],
  46480. [1544, 1544],
  46481. [1547, 1547],
  46482. [1549, 1549],
  46483. [1563, 1563],
  46484. [1566, 1610],
  46485. [1645, 1647],
  46486. [1649, 1749],
  46487. [1765, 1766],
  46488. [1774, 1775],
  46489. [1786, 1805],
  46490. [1807, 1808],
  46491. [1810, 1839],
  46492. [1869, 1957],
  46493. [1969, 1969],
  46494. [1984, 2026],
  46495. [2036, 2037],
  46496. [2042, 2042],
  46497. [2048, 2069],
  46498. [2074, 2074],
  46499. [2084, 2084],
  46500. [2088, 2088],
  46501. [2096, 2110],
  46502. [2112, 2136],
  46503. [2142, 2142],
  46504. [2208, 2208],
  46505. [2210, 2220],
  46506. [8207, 8207],
  46507. [64285, 64285],
  46508. [64287, 64296],
  46509. [64298, 64310],
  46510. [64312, 64316],
  46511. [64318, 64318],
  46512. [64320, 64321],
  46513. [64323, 64324],
  46514. [64326, 64449],
  46515. [64467, 64829],
  46516. [64848, 64911],
  46517. [64914, 64967],
  46518. [65008, 65020],
  46519. [65136, 65140],
  46520. [65142, 65276],
  46521. [67584, 67589],
  46522. [67592, 67592],
  46523. [67594, 67637],
  46524. [67639, 67640],
  46525. [67644, 67644],
  46526. [67647, 67669],
  46527. [67671, 67679],
  46528. [67840, 67867],
  46529. [67872, 67897],
  46530. [67903, 67903],
  46531. [67968, 68023],
  46532. [68030, 68031],
  46533. [68096, 68096],
  46534. [68112, 68115],
  46535. [68117, 68119],
  46536. [68121, 68147],
  46537. [68160, 68167],
  46538. [68176, 68184],
  46539. [68192, 68223],
  46540. [68352, 68405],
  46541. [68416, 68437],
  46542. [68440, 68466],
  46543. [68472, 68479],
  46544. [68608, 68680],
  46545. [126464, 126467],
  46546. [126469, 126495],
  46547. [126497, 126498],
  46548. [126500, 126500],
  46549. [126503, 126503],
  46550. [126505, 126514],
  46551. [126516, 126519],
  46552. [126521, 126521],
  46553. [126523, 126523],
  46554. [126530, 126530],
  46555. [126535, 126535],
  46556. [126537, 126537],
  46557. [126539, 126539],
  46558. [126541, 126543],
  46559. [126545, 126546],
  46560. [126548, 126548],
  46561. [126551, 126551],
  46562. [126553, 126553],
  46563. [126555, 126555],
  46564. [126557, 126557],
  46565. [126559, 126559],
  46566. [126561, 126562],
  46567. [126564, 126564],
  46568. [126567, 126570],
  46569. [126572, 126578],
  46570. [126580, 126583],
  46571. [126585, 126588],
  46572. [126590, 126590],
  46573. [126592, 126601],
  46574. [126603, 126619],
  46575. [126625, 126627],
  46576. [126629, 126633],
  46577. [126635, 126651],
  46578. [1114109, 1114109]
  46579. ];
  46580. function isStrongRTLChar(charCode) {
  46581. for (var i2 = 0; i2 < strongRTLRanges.length; i2++) {
  46582. var currentRange = strongRTLRanges[i2];
  46583. if (charCode >= currentRange[0] && charCode <= currentRange[1]) {
  46584. return true;
  46585. }
  46586. }
  46587. return false;
  46588. }
  46589. function determineBidi(cueDiv) {
  46590. var nodeStack = [], text = "", charCode;
  46591. if (!cueDiv || !cueDiv.childNodes) {
  46592. return "ltr";
  46593. }
  46594. function pushNodes(nodeStack2, node) {
  46595. for (var i3 = node.childNodes.length - 1; i3 >= 0; i3--) {
  46596. nodeStack2.push(node.childNodes[i3]);
  46597. }
  46598. }
  46599. function nextTextNode(nodeStack2) {
  46600. if (!nodeStack2 || !nodeStack2.length) {
  46601. return null;
  46602. }
  46603. var node = nodeStack2.pop(), text2 = node.textContent || node.innerText;
  46604. if (text2) {
  46605. var m = text2.match(/^.*(\n|\r)/);
  46606. if (m) {
  46607. nodeStack2.length = 0;
  46608. return m[0];
  46609. }
  46610. return text2;
  46611. }
  46612. if (node.tagName === "ruby") {
  46613. return nextTextNode(nodeStack2);
  46614. }
  46615. if (node.childNodes) {
  46616. pushNodes(nodeStack2, node);
  46617. return nextTextNode(nodeStack2);
  46618. }
  46619. }
  46620. pushNodes(nodeStack, cueDiv);
  46621. while (text = nextTextNode(nodeStack)) {
  46622. for (var i2 = 0; i2 < text.length; i2++) {
  46623. charCode = text.charCodeAt(i2);
  46624. if (isStrongRTLChar(charCode)) {
  46625. return "rtl";
  46626. }
  46627. }
  46628. }
  46629. return "ltr";
  46630. }
  46631. function computeLinePos(cue) {
  46632. if (typeof cue.line === "number" && (cue.snapToLines || cue.line >= 0 && cue.line <= 100)) {
  46633. return cue.line;
  46634. }
  46635. if (!cue.track || !cue.track.textTrackList || !cue.track.textTrackList.mediaElement) {
  46636. return -1;
  46637. }
  46638. var track = cue.track, trackList = track.textTrackList, count = 0;
  46639. for (var i2 = 0; i2 < trackList.length && trackList[i2] !== track; i2++) {
  46640. if (trackList[i2].mode === "showing") {
  46641. count++;
  46642. }
  46643. }
  46644. return ++count * -1;
  46645. }
  46646. function StyleBox() {
  46647. }
  46648. StyleBox.prototype.applyStyles = function(styles, div) {
  46649. div = div || this.div;
  46650. for (var prop in styles) {
  46651. if (styles.hasOwnProperty(prop)) {
  46652. div.style[prop] = styles[prop];
  46653. }
  46654. }
  46655. };
  46656. StyleBox.prototype.formatStyle = function(val, unit) {
  46657. return val === 0 ? 0 : val + unit;
  46658. };
  46659. function CueStyleBox(window2, cue, styleOptions) {
  46660. StyleBox.call(this);
  46661. this.cue = cue;
  46662. this.cueDiv = parseContent(window2, cue.text);
  46663. var styles = {
  46664. color: "rgba(255, 255, 255, 1)",
  46665. backgroundColor: "rgba(0, 0, 0, 0.8)",
  46666. position: "relative",
  46667. left: 0,
  46668. right: 0,
  46669. top: 0,
  46670. bottom: 0,
  46671. display: "inline",
  46672. writingMode: cue.vertical === "" ? "horizontal-tb" : cue.vertical === "lr" ? "vertical-lr" : "vertical-rl",
  46673. unicodeBidi: "plaintext"
  46674. };
  46675. this.applyStyles(styles, this.cueDiv);
  46676. this.div = window2.document.createElement("div");
  46677. styles = {
  46678. direction: determineBidi(this.cueDiv),
  46679. writingMode: cue.vertical === "" ? "horizontal-tb" : cue.vertical === "lr" ? "vertical-lr" : "vertical-rl",
  46680. unicodeBidi: "plaintext",
  46681. textAlign: cue.align === "middle" ? "center" : cue.align,
  46682. font: styleOptions.font,
  46683. whiteSpace: "pre-line",
  46684. position: "absolute"
  46685. };
  46686. this.applyStyles(styles);
  46687. this.div.appendChild(this.cueDiv);
  46688. var textPos = 0;
  46689. switch (cue.positionAlign) {
  46690. case "start":
  46691. textPos = cue.position;
  46692. break;
  46693. case "center":
  46694. textPos = cue.position - cue.size / 2;
  46695. break;
  46696. case "end":
  46697. textPos = cue.position - cue.size;
  46698. break;
  46699. }
  46700. if (cue.vertical === "") {
  46701. this.applyStyles({
  46702. left: this.formatStyle(textPos, "%"),
  46703. width: this.formatStyle(cue.size, "%")
  46704. });
  46705. } else {
  46706. this.applyStyles({
  46707. top: this.formatStyle(textPos, "%"),
  46708. height: this.formatStyle(cue.size, "%")
  46709. });
  46710. }
  46711. this.move = function(box) {
  46712. this.applyStyles({
  46713. top: this.formatStyle(box.top, "px"),
  46714. bottom: this.formatStyle(box.bottom, "px"),
  46715. left: this.formatStyle(box.left, "px"),
  46716. right: this.formatStyle(box.right, "px"),
  46717. height: this.formatStyle(box.height, "px"),
  46718. width: this.formatStyle(box.width, "px")
  46719. });
  46720. };
  46721. }
  46722. CueStyleBox.prototype = _objCreate(StyleBox.prototype);
  46723. CueStyleBox.prototype.constructor = CueStyleBox;
  46724. function BoxPosition(obj) {
  46725. var lh, height2, width2, top;
  46726. if (obj.div) {
  46727. height2 = obj.div.offsetHeight;
  46728. width2 = obj.div.offsetWidth;
  46729. top = obj.div.offsetTop;
  46730. var rects = (rects = obj.div.childNodes) && (rects = rects[0]) && rects.getClientRects && rects.getClientRects();
  46731. obj = obj.div.getBoundingClientRect();
  46732. lh = rects ? Math.max(rects[0] && rects[0].height || 0, obj.height / rects.length) : 0;
  46733. }
  46734. this.left = obj.left;
  46735. this.right = obj.right;
  46736. this.top = obj.top || top;
  46737. this.height = obj.height || height2;
  46738. this.bottom = obj.bottom || top + (obj.height || height2);
  46739. this.width = obj.width || width2;
  46740. this.lineHeight = lh !== void 0 ? lh : obj.lineHeight;
  46741. }
  46742. BoxPosition.prototype.move = function(axis, toMove) {
  46743. toMove = toMove !== void 0 ? toMove : this.lineHeight;
  46744. switch (axis) {
  46745. case "+x":
  46746. this.left += toMove;
  46747. this.right += toMove;
  46748. break;
  46749. case "-x":
  46750. this.left -= toMove;
  46751. this.right -= toMove;
  46752. break;
  46753. case "+y":
  46754. this.top += toMove;
  46755. this.bottom += toMove;
  46756. break;
  46757. case "-y":
  46758. this.top -= toMove;
  46759. this.bottom -= toMove;
  46760. break;
  46761. }
  46762. };
  46763. BoxPosition.prototype.overlaps = function(b2) {
  46764. return this.left < b2.right && this.right > b2.left && this.top < b2.bottom && this.bottom > b2.top;
  46765. };
  46766. BoxPosition.prototype.overlapsAny = function(boxes) {
  46767. for (var i2 = 0; i2 < boxes.length; i2++) {
  46768. if (this.overlaps(boxes[i2])) {
  46769. return true;
  46770. }
  46771. }
  46772. return false;
  46773. };
  46774. BoxPosition.prototype.within = function(container) {
  46775. return this.top >= container.top && this.bottom <= container.bottom && this.left >= container.left && this.right <= container.right;
  46776. };
  46777. BoxPosition.prototype.overlapsOppositeAxis = function(container, axis) {
  46778. switch (axis) {
  46779. case "+x":
  46780. return this.left < container.left;
  46781. case "-x":
  46782. return this.right > container.right;
  46783. case "+y":
  46784. return this.top < container.top;
  46785. case "-y":
  46786. return this.bottom > container.bottom;
  46787. }
  46788. };
  46789. BoxPosition.prototype.intersectPercentage = function(b2) {
  46790. var x = Math.max(0, Math.min(this.right, b2.right) - Math.max(this.left, b2.left)), y = Math.max(0, Math.min(this.bottom, b2.bottom) - Math.max(this.top, b2.top)), intersectArea = x * y;
  46791. return intersectArea / (this.height * this.width);
  46792. };
  46793. BoxPosition.prototype.toCSSCompatValues = function(reference) {
  46794. return {
  46795. top: this.top - reference.top,
  46796. bottom: reference.bottom - this.bottom,
  46797. left: this.left - reference.left,
  46798. right: reference.right - this.right,
  46799. height: this.height,
  46800. width: this.width
  46801. };
  46802. };
  46803. BoxPosition.getSimpleBoxPosition = function(obj) {
  46804. var height2 = obj.div ? obj.div.offsetHeight : obj.tagName ? obj.offsetHeight : 0;
  46805. var width2 = obj.div ? obj.div.offsetWidth : obj.tagName ? obj.offsetWidth : 0;
  46806. var top = obj.div ? obj.div.offsetTop : obj.tagName ? obj.offsetTop : 0;
  46807. obj = obj.div ? obj.div.getBoundingClientRect() : obj.tagName ? obj.getBoundingClientRect() : obj;
  46808. var ret = {
  46809. left: obj.left,
  46810. right: obj.right,
  46811. top: obj.top || top,
  46812. height: obj.height || height2,
  46813. bottom: obj.bottom || top + (obj.height || height2),
  46814. width: obj.width || width2
  46815. };
  46816. return ret;
  46817. };
  46818. function moveBoxToLinePosition(window2, styleBox, containerBox, boxPositions) {
  46819. function findBestPosition(b, axis2) {
  46820. var bestPosition2, specifiedPosition = new BoxPosition(b), percentage = 1;
  46821. for (var i2 = 0; i2 < axis2.length; i2++) {
  46822. while (b.overlapsOppositeAxis(containerBox, axis2[i2]) || b.within(containerBox) && b.overlapsAny(boxPositions)) {
  46823. b.move(axis2[i2]);
  46824. }
  46825. if (b.within(containerBox)) {
  46826. return b;
  46827. }
  46828. var p = b.intersectPercentage(containerBox);
  46829. if (percentage > p) {
  46830. bestPosition2 = new BoxPosition(b);
  46831. percentage = p;
  46832. }
  46833. b = new BoxPosition(specifiedPosition);
  46834. }
  46835. return bestPosition2 || specifiedPosition;
  46836. }
  46837. var boxPosition = new BoxPosition(styleBox), cue = styleBox.cue, linePos = computeLinePos(cue), axis = [];
  46838. if (cue.snapToLines) {
  46839. var size;
  46840. switch (cue.vertical) {
  46841. case "":
  46842. axis = ["+y", "-y"];
  46843. size = "height";
  46844. break;
  46845. case "rl":
  46846. axis = ["+x", "-x"];
  46847. size = "width";
  46848. break;
  46849. case "lr":
  46850. axis = ["-x", "+x"];
  46851. size = "width";
  46852. break;
  46853. }
  46854. var step = boxPosition.lineHeight, position2 = step * Math.round(linePos), maxPosition = containerBox[size] + step, initialAxis = axis[0];
  46855. if (Math.abs(position2) > maxPosition) {
  46856. position2 = position2 < 0 ? -1 : 1;
  46857. position2 *= Math.ceil(maxPosition / step) * step;
  46858. }
  46859. if (linePos < 0) {
  46860. position2 += cue.vertical === "" ? containerBox.height : containerBox.width;
  46861. axis = axis.reverse();
  46862. }
  46863. boxPosition.move(initialAxis, position2);
  46864. } else {
  46865. var calculatedPercentage = boxPosition.lineHeight / containerBox.height * 100;
  46866. switch (cue.lineAlign) {
  46867. case "center":
  46868. linePos -= calculatedPercentage / 2;
  46869. break;
  46870. case "end":
  46871. linePos -= calculatedPercentage;
  46872. break;
  46873. }
  46874. switch (cue.vertical) {
  46875. case "":
  46876. styleBox.applyStyles({
  46877. top: styleBox.formatStyle(linePos, "%")
  46878. });
  46879. break;
  46880. case "rl":
  46881. styleBox.applyStyles({
  46882. left: styleBox.formatStyle(linePos, "%")
  46883. });
  46884. break;
  46885. case "lr":
  46886. styleBox.applyStyles({
  46887. right: styleBox.formatStyle(linePos, "%")
  46888. });
  46889. break;
  46890. }
  46891. axis = ["+y", "-x", "+x", "-y"];
  46892. boxPosition = new BoxPosition(styleBox);
  46893. }
  46894. var bestPosition = findBestPosition(boxPosition, axis);
  46895. styleBox.move(bestPosition.toCSSCompatValues(containerBox));
  46896. }
  46897. function WebVTT$1() {
  46898. }
  46899. WebVTT$1.StringDecoder = function() {
  46900. return {
  46901. decode: function(data) {
  46902. if (!data) {
  46903. return "";
  46904. }
  46905. if (typeof data !== "string") {
  46906. throw new Error("Error - expected string data.");
  46907. }
  46908. return decodeURIComponent(encodeURIComponent(data));
  46909. }
  46910. };
  46911. };
  46912. WebVTT$1.convertCueToDOMTree = function(window2, cuetext) {
  46913. if (!window2 || !cuetext) {
  46914. return null;
  46915. }
  46916. return parseContent(window2, cuetext);
  46917. };
  46918. var FONT_SIZE_PERCENT = 0.05;
  46919. var FONT_STYLE = "sans-serif";
  46920. var CUE_BACKGROUND_PADDING = "1.5%";
  46921. WebVTT$1.processCues = function(window2, cues, overlay) {
  46922. if (!window2 || !cues || !overlay) {
  46923. return null;
  46924. }
  46925. while (overlay.firstChild) {
  46926. overlay.removeChild(overlay.firstChild);
  46927. }
  46928. var paddedOverlay = window2.document.createElement("div");
  46929. paddedOverlay.style.position = "absolute";
  46930. paddedOverlay.style.left = "0";
  46931. paddedOverlay.style.right = "0";
  46932. paddedOverlay.style.top = "0";
  46933. paddedOverlay.style.bottom = "0";
  46934. paddedOverlay.style.margin = CUE_BACKGROUND_PADDING;
  46935. overlay.appendChild(paddedOverlay);
  46936. function shouldCompute(cues2) {
  46937. for (var i3 = 0; i3 < cues2.length; i3++) {
  46938. if (cues2[i3].hasBeenReset || !cues2[i3].displayState) {
  46939. return true;
  46940. }
  46941. }
  46942. return false;
  46943. }
  46944. if (!shouldCompute(cues)) {
  46945. for (var i2 = 0; i2 < cues.length; i2++) {
  46946. paddedOverlay.appendChild(cues[i2].displayState);
  46947. }
  46948. return;
  46949. }
  46950. var boxPositions = [], containerBox = BoxPosition.getSimpleBoxPosition(paddedOverlay), fontSize = Math.round(containerBox.height * FONT_SIZE_PERCENT * 100) / 100;
  46951. var styleOptions = {
  46952. font: fontSize + "px " + FONT_STYLE
  46953. };
  46954. (function() {
  46955. var styleBox, cue;
  46956. for (var i3 = 0; i3 < cues.length; i3++) {
  46957. cue = cues[i3];
  46958. styleBox = new CueStyleBox(window2, cue, styleOptions);
  46959. paddedOverlay.appendChild(styleBox.div);
  46960. moveBoxToLinePosition(window2, styleBox, containerBox, boxPositions);
  46961. cue.displayState = styleBox.div;
  46962. boxPositions.push(BoxPosition.getSimpleBoxPosition(styleBox));
  46963. }
  46964. })();
  46965. };
  46966. WebVTT$1.Parser = function(window2, vttjs2, decoder) {
  46967. if (!decoder) {
  46968. decoder = vttjs2;
  46969. vttjs2 = {};
  46970. }
  46971. if (!vttjs2) {
  46972. vttjs2 = {};
  46973. }
  46974. this.window = window2;
  46975. this.vttjs = vttjs2;
  46976. this.state = "INITIAL";
  46977. this.buffer = "";
  46978. this.decoder = decoder || new TextDecoder("utf8");
  46979. this.regionList = [];
  46980. };
  46981. WebVTT$1.Parser.prototype = {
  46982. reportOrThrowError: function(e) {
  46983. if (e instanceof ParsingError) {
  46984. this.onparsingerror && this.onparsingerror(e);
  46985. } else {
  46986. throw e;
  46987. }
  46988. },
  46989. parse: function(data) {
  46990. var self2 = this;
  46991. if (data) {
  46992. self2.buffer += self2.decoder.decode(data, { stream: true });
  46993. }
  46994. function collectNextLine() {
  46995. var buffer = self2.buffer;
  46996. var pos = 0;
  46997. while (pos < buffer.length && buffer[pos] !== "\r" && buffer[pos] !== "\n") {
  46998. ++pos;
  46999. }
  47000. var line2 = buffer.substr(0, pos);
  47001. if (buffer[pos] === "\r") {
  47002. ++pos;
  47003. }
  47004. if (buffer[pos] === "\n") {
  47005. ++pos;
  47006. }
  47007. self2.buffer = buffer.substr(pos);
  47008. return line2;
  47009. }
  47010. function parseRegion(input) {
  47011. var settings = new Settings();
  47012. parseOptions(input, function(k, v) {
  47013. switch (k) {
  47014. case "id":
  47015. settings.set(k, v);
  47016. break;
  47017. case "width":
  47018. settings.percent(k, v);
  47019. break;
  47020. case "lines":
  47021. settings.integer(k, v);
  47022. break;
  47023. case "regionanchor":
  47024. case "viewportanchor":
  47025. var xy = v.split(",");
  47026. if (xy.length !== 2) {
  47027. break;
  47028. }
  47029. var anchor = new Settings();
  47030. anchor.percent("x", xy[0]);
  47031. anchor.percent("y", xy[1]);
  47032. if (!anchor.has("x") || !anchor.has("y")) {
  47033. break;
  47034. }
  47035. settings.set(k + "X", anchor.get("x"));
  47036. settings.set(k + "Y", anchor.get("y"));
  47037. break;
  47038. case "scroll":
  47039. settings.alt(k, v, ["up"]);
  47040. break;
  47041. }
  47042. }, /=/, /\s/);
  47043. if (settings.has("id")) {
  47044. var region = new (self2.vttjs.VTTRegion || self2.window.VTTRegion)();
  47045. region.width = settings.get("width", 100);
  47046. region.lines = settings.get("lines", 3);
  47047. region.regionAnchorX = settings.get("regionanchorX", 0);
  47048. region.regionAnchorY = settings.get("regionanchorY", 100);
  47049. region.viewportAnchorX = settings.get("viewportanchorX", 0);
  47050. region.viewportAnchorY = settings.get("viewportanchorY", 100);
  47051. region.scroll = settings.get("scroll", "");
  47052. self2.onregion && self2.onregion(region);
  47053. self2.regionList.push({
  47054. id: settings.get("id"),
  47055. region
  47056. });
  47057. }
  47058. }
  47059. function parseTimestampMap(input) {
  47060. var settings = new Settings();
  47061. parseOptions(input, function(k, v) {
  47062. switch (k) {
  47063. case "MPEGT":
  47064. settings.integer(k + "S", v);
  47065. break;
  47066. case "LOCA":
  47067. settings.set(k + "L", parseTimeStamp(v));
  47068. break;
  47069. }
  47070. }, /[^\d]:/, /,/);
  47071. self2.ontimestampmap && self2.ontimestampmap({
  47072. "MPEGTS": settings.get("MPEGTS"),
  47073. "LOCAL": settings.get("LOCAL")
  47074. });
  47075. }
  47076. function parseHeader(input) {
  47077. if (input.match(/X-TIMESTAMP-MAP/)) {
  47078. parseOptions(input, function(k, v) {
  47079. switch (k) {
  47080. case "X-TIMESTAMP-MAP":
  47081. parseTimestampMap(v);
  47082. break;
  47083. }
  47084. }, /=/);
  47085. } else {
  47086. parseOptions(input, function(k, v) {
  47087. switch (k) {
  47088. case "Region":
  47089. parseRegion(v);
  47090. break;
  47091. }
  47092. }, /:/);
  47093. }
  47094. }
  47095. try {
  47096. var line;
  47097. if (self2.state === "INITIAL") {
  47098. if (!/\r\n|\n/.test(self2.buffer)) {
  47099. return this;
  47100. }
  47101. line = collectNextLine();
  47102. var m = line.match(/^WEBVTT([ \t].*)?$/);
  47103. if (!m || !m[0]) {
  47104. throw new ParsingError(ParsingError.Errors.BadSignature);
  47105. }
  47106. self2.state = "HEADER";
  47107. }
  47108. var alreadyCollectedLine = false;
  47109. while (self2.buffer) {
  47110. if (!/\r\n|\n/.test(self2.buffer)) {
  47111. return this;
  47112. }
  47113. if (!alreadyCollectedLine) {
  47114. line = collectNextLine();
  47115. } else {
  47116. alreadyCollectedLine = false;
  47117. }
  47118. switch (self2.state) {
  47119. case "HEADER":
  47120. if (/:/.test(line)) {
  47121. parseHeader(line);
  47122. } else if (!line) {
  47123. self2.state = "ID";
  47124. }
  47125. continue;
  47126. case "NOTE":
  47127. if (!line) {
  47128. self2.state = "ID";
  47129. }
  47130. continue;
  47131. case "ID":
  47132. if (/^NOTE($|[ \t])/.test(line)) {
  47133. self2.state = "NOTE";
  47134. break;
  47135. }
  47136. if (!line) {
  47137. continue;
  47138. }
  47139. self2.cue = new (self2.vttjs.VTTCue || self2.window.VTTCue)(0, 0, "");
  47140. try {
  47141. self2.cue.align = "center";
  47142. } catch (e) {
  47143. self2.cue.align = "middle";
  47144. }
  47145. self2.state = "CUE";
  47146. if (line.indexOf("-->") === -1) {
  47147. self2.cue.id = line;
  47148. continue;
  47149. }
  47150. case "CUE":
  47151. try {
  47152. parseCue(line, self2.cue, self2.regionList);
  47153. } catch (e) {
  47154. self2.reportOrThrowError(e);
  47155. self2.cue = null;
  47156. self2.state = "BADCUE";
  47157. continue;
  47158. }
  47159. self2.state = "CUETEXT";
  47160. continue;
  47161. case "CUETEXT":
  47162. var hasSubstring = line.indexOf("-->") !== -1;
  47163. if (!line || hasSubstring && (alreadyCollectedLine = true)) {
  47164. self2.oncue && self2.oncue(self2.cue);
  47165. self2.cue = null;
  47166. self2.state = "ID";
  47167. continue;
  47168. }
  47169. if (self2.cue.text) {
  47170. self2.cue.text += "\n";
  47171. }
  47172. self2.cue.text += line.replace(/\u2028/g, "\n").replace(/u2029/g, "\n");
  47173. continue;
  47174. case "BADCUE":
  47175. if (!line) {
  47176. self2.state = "ID";
  47177. }
  47178. continue;
  47179. }
  47180. }
  47181. } catch (e) {
  47182. self2.reportOrThrowError(e);
  47183. if (self2.state === "CUETEXT" && self2.cue && self2.oncue) {
  47184. self2.oncue(self2.cue);
  47185. }
  47186. self2.cue = null;
  47187. self2.state = self2.state === "INITIAL" ? "BADWEBVTT" : "BADCUE";
  47188. }
  47189. return this;
  47190. },
  47191. flush: function() {
  47192. var self2 = this;
  47193. try {
  47194. self2.buffer += self2.decoder.decode();
  47195. if (self2.cue || self2.state === "HEADER") {
  47196. self2.buffer += "\n\n";
  47197. self2.parse();
  47198. }
  47199. if (self2.state === "INITIAL") {
  47200. throw new ParsingError(ParsingError.Errors.BadSignature);
  47201. }
  47202. } catch (e) {
  47203. self2.reportOrThrowError(e);
  47204. }
  47205. self2.onflush && self2.onflush();
  47206. return this;
  47207. }
  47208. };
  47209. var vtt$1 = WebVTT$1;
  47210. var autoKeyword = "auto";
  47211. var directionSetting = {
  47212. "": 1,
  47213. "lr": 1,
  47214. "rl": 1
  47215. };
  47216. var alignSetting = {
  47217. "start": 1,
  47218. "center": 1,
  47219. "end": 1,
  47220. "left": 1,
  47221. "right": 1,
  47222. "auto": 1,
  47223. "line-left": 1,
  47224. "line-right": 1
  47225. };
  47226. function findDirectionSetting(value) {
  47227. if (typeof value !== "string") {
  47228. return false;
  47229. }
  47230. var dir = directionSetting[value.toLowerCase()];
  47231. return dir ? value.toLowerCase() : false;
  47232. }
  47233. function findAlignSetting(value) {
  47234. if (typeof value !== "string") {
  47235. return false;
  47236. }
  47237. var align = alignSetting[value.toLowerCase()];
  47238. return align ? value.toLowerCase() : false;
  47239. }
  47240. function VTTCue(startTime, endTime, text) {
  47241. this.hasBeenReset = false;
  47242. var _id = "";
  47243. var _pauseOnExit = false;
  47244. var _startTime = startTime;
  47245. var _endTime = endTime;
  47246. var _text = text;
  47247. var _region = null;
  47248. var _vertical = "";
  47249. var _snapToLines = true;
  47250. var _line = "auto";
  47251. var _lineAlign = "start";
  47252. var _position = "auto";
  47253. var _positionAlign = "auto";
  47254. var _size = 100;
  47255. var _align = "center";
  47256. Object.defineProperties(this, {
  47257. "id": {
  47258. enumerable: true,
  47259. get: function() {
  47260. return _id;
  47261. },
  47262. set: function(value) {
  47263. _id = "" + value;
  47264. }
  47265. },
  47266. "pauseOnExit": {
  47267. enumerable: true,
  47268. get: function() {
  47269. return _pauseOnExit;
  47270. },
  47271. set: function(value) {
  47272. _pauseOnExit = !!value;
  47273. }
  47274. },
  47275. "startTime": {
  47276. enumerable: true,
  47277. get: function() {
  47278. return _startTime;
  47279. },
  47280. set: function(value) {
  47281. if (typeof value !== "number") {
  47282. throw new TypeError("Start time must be set to a number.");
  47283. }
  47284. _startTime = value;
  47285. this.hasBeenReset = true;
  47286. }
  47287. },
  47288. "endTime": {
  47289. enumerable: true,
  47290. get: function() {
  47291. return _endTime;
  47292. },
  47293. set: function(value) {
  47294. if (typeof value !== "number") {
  47295. throw new TypeError("End time must be set to a number.");
  47296. }
  47297. _endTime = value;
  47298. this.hasBeenReset = true;
  47299. }
  47300. },
  47301. "text": {
  47302. enumerable: true,
  47303. get: function() {
  47304. return _text;
  47305. },
  47306. set: function(value) {
  47307. _text = "" + value;
  47308. this.hasBeenReset = true;
  47309. }
  47310. },
  47311. "region": {
  47312. enumerable: true,
  47313. get: function() {
  47314. return _region;
  47315. },
  47316. set: function(value) {
  47317. _region = value;
  47318. this.hasBeenReset = true;
  47319. }
  47320. },
  47321. "vertical": {
  47322. enumerable: true,
  47323. get: function() {
  47324. return _vertical;
  47325. },
  47326. set: function(value) {
  47327. var setting = findDirectionSetting(value);
  47328. if (setting === false) {
  47329. throw new SyntaxError("Vertical: an invalid or illegal direction string was specified.");
  47330. }
  47331. _vertical = setting;
  47332. this.hasBeenReset = true;
  47333. }
  47334. },
  47335. "snapToLines": {
  47336. enumerable: true,
  47337. get: function() {
  47338. return _snapToLines;
  47339. },
  47340. set: function(value) {
  47341. _snapToLines = !!value;
  47342. this.hasBeenReset = true;
  47343. }
  47344. },
  47345. "line": {
  47346. enumerable: true,
  47347. get: function() {
  47348. return _line;
  47349. },
  47350. set: function(value) {
  47351. if (typeof value !== "number" && value !== autoKeyword) {
  47352. throw new SyntaxError("Line: an invalid number or illegal string was specified.");
  47353. }
  47354. _line = value;
  47355. this.hasBeenReset = true;
  47356. }
  47357. },
  47358. "lineAlign": {
  47359. enumerable: true,
  47360. get: function() {
  47361. return _lineAlign;
  47362. },
  47363. set: function(value) {
  47364. var setting = findAlignSetting(value);
  47365. if (!setting) {
  47366. console.warn("lineAlign: an invalid or illegal string was specified.");
  47367. } else {
  47368. _lineAlign = setting;
  47369. this.hasBeenReset = true;
  47370. }
  47371. }
  47372. },
  47373. "position": {
  47374. enumerable: true,
  47375. get: function() {
  47376. return _position;
  47377. },
  47378. set: function(value) {
  47379. if (value < 0 || value > 100) {
  47380. throw new Error("Position must be between 0 and 100.");
  47381. }
  47382. _position = value;
  47383. this.hasBeenReset = true;
  47384. }
  47385. },
  47386. "positionAlign": {
  47387. enumerable: true,
  47388. get: function() {
  47389. return _positionAlign;
  47390. },
  47391. set: function(value) {
  47392. var setting = findAlignSetting(value);
  47393. if (!setting) {
  47394. console.warn("positionAlign: an invalid or illegal string was specified.");
  47395. } else {
  47396. _positionAlign = setting;
  47397. this.hasBeenReset = true;
  47398. }
  47399. }
  47400. },
  47401. "size": {
  47402. enumerable: true,
  47403. get: function() {
  47404. return _size;
  47405. },
  47406. set: function(value) {
  47407. if (value < 0 || value > 100) {
  47408. throw new Error("Size must be between 0 and 100.");
  47409. }
  47410. _size = value;
  47411. this.hasBeenReset = true;
  47412. }
  47413. },
  47414. "align": {
  47415. enumerable: true,
  47416. get: function() {
  47417. return _align;
  47418. },
  47419. set: function(value) {
  47420. var setting = findAlignSetting(value);
  47421. if (!setting) {
  47422. throw new SyntaxError("align: an invalid or illegal alignment string was specified.");
  47423. }
  47424. _align = setting;
  47425. this.hasBeenReset = true;
  47426. }
  47427. }
  47428. });
  47429. this.displayState = void 0;
  47430. }
  47431. VTTCue.prototype.getCueAsHTML = function() {
  47432. return WebVTT.convertCueToDOMTree(window, this.text);
  47433. };
  47434. var vttcue = VTTCue;
  47435. var scrollSetting = {
  47436. "": true,
  47437. "up": true
  47438. };
  47439. function findScrollSetting(value) {
  47440. if (typeof value !== "string") {
  47441. return false;
  47442. }
  47443. var scroll = scrollSetting[value.toLowerCase()];
  47444. return scroll ? value.toLowerCase() : false;
  47445. }
  47446. function isValidPercentValue(value) {
  47447. return typeof value === "number" && (value >= 0 && value <= 100);
  47448. }
  47449. function VTTRegion() {
  47450. var _width = 100;
  47451. var _lines = 3;
  47452. var _regionAnchorX = 0;
  47453. var _regionAnchorY = 100;
  47454. var _viewportAnchorX = 0;
  47455. var _viewportAnchorY = 100;
  47456. var _scroll = "";
  47457. Object.defineProperties(this, {
  47458. "width": {
  47459. enumerable: true,
  47460. get: function() {
  47461. return _width;
  47462. },
  47463. set: function(value) {
  47464. if (!isValidPercentValue(value)) {
  47465. throw new Error("Width must be between 0 and 100.");
  47466. }
  47467. _width = value;
  47468. }
  47469. },
  47470. "lines": {
  47471. enumerable: true,
  47472. get: function() {
  47473. return _lines;
  47474. },
  47475. set: function(value) {
  47476. if (typeof value !== "number") {
  47477. throw new TypeError("Lines must be set to a number.");
  47478. }
  47479. _lines = value;
  47480. }
  47481. },
  47482. "regionAnchorY": {
  47483. enumerable: true,
  47484. get: function() {
  47485. return _regionAnchorY;
  47486. },
  47487. set: function(value) {
  47488. if (!isValidPercentValue(value)) {
  47489. throw new Error("RegionAnchorX must be between 0 and 100.");
  47490. }
  47491. _regionAnchorY = value;
  47492. }
  47493. },
  47494. "regionAnchorX": {
  47495. enumerable: true,
  47496. get: function() {
  47497. return _regionAnchorX;
  47498. },
  47499. set: function(value) {
  47500. if (!isValidPercentValue(value)) {
  47501. throw new Error("RegionAnchorY must be between 0 and 100.");
  47502. }
  47503. _regionAnchorX = value;
  47504. }
  47505. },
  47506. "viewportAnchorY": {
  47507. enumerable: true,
  47508. get: function() {
  47509. return _viewportAnchorY;
  47510. },
  47511. set: function(value) {
  47512. if (!isValidPercentValue(value)) {
  47513. throw new Error("ViewportAnchorY must be between 0 and 100.");
  47514. }
  47515. _viewportAnchorY = value;
  47516. }
  47517. },
  47518. "viewportAnchorX": {
  47519. enumerable: true,
  47520. get: function() {
  47521. return _viewportAnchorX;
  47522. },
  47523. set: function(value) {
  47524. if (!isValidPercentValue(value)) {
  47525. throw new Error("ViewportAnchorX must be between 0 and 100.");
  47526. }
  47527. _viewportAnchorX = value;
  47528. }
  47529. },
  47530. "scroll": {
  47531. enumerable: true,
  47532. get: function() {
  47533. return _scroll;
  47534. },
  47535. set: function(value) {
  47536. var setting = findScrollSetting(value);
  47537. if (setting === false) {
  47538. console.warn("Scroll: an invalid or illegal string was specified.");
  47539. } else {
  47540. _scroll = setting;
  47541. }
  47542. }
  47543. }
  47544. });
  47545. }
  47546. var vttregion = VTTRegion;
  47547. var window$1 = window_1;
  47548. var vttjs = browserIndex.exports = {
  47549. WebVTT: vtt$1,
  47550. VTTCue: vttcue,
  47551. VTTRegion: vttregion
  47552. };
  47553. window$1.vttjs = vttjs;
  47554. window$1.WebVTT = vttjs.WebVTT;
  47555. var cueShim = vttjs.VTTCue;
  47556. var regionShim = vttjs.VTTRegion;
  47557. var nativeVTTCue = window$1.VTTCue;
  47558. var nativeVTTRegion = window$1.VTTRegion;
  47559. vttjs.shim = function() {
  47560. window$1.VTTCue = cueShim;
  47561. window$1.VTTRegion = regionShim;
  47562. };
  47563. vttjs.restore = function() {
  47564. window$1.VTTCue = nativeVTTCue;
  47565. window$1.VTTRegion = nativeVTTRegion;
  47566. };
  47567. if (!window$1.VTTCue) {
  47568. vttjs.shim();
  47569. }
  47570. var vtt = browserIndex.exports;
  47571. var urlToolkit = { exports: {} };
  47572. (function(module2, exports2) {
  47573. (function(root2) {
  47574. var URL_REGEX = /^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/;
  47575. var FIRST_SEGMENT_REGEX = /^(?=([^\/?#]*))\1([^]*)$/;
  47576. var SLASH_DOT_REGEX = /(?:\/|^)\.(?=\/)/g;
  47577. var SLASH_DOT_DOT_REGEX = /(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g;
  47578. var URLToolkit2 = {
  47579. buildAbsoluteURL: function(baseURL, relativeURL, opts) {
  47580. opts = opts || {};
  47581. baseURL = baseURL.trim();
  47582. relativeURL = relativeURL.trim();
  47583. if (!relativeURL) {
  47584. if (!opts.alwaysNormalize) {
  47585. return baseURL;
  47586. }
  47587. var basePartsForNormalise = URLToolkit2.parseURL(baseURL);
  47588. if (!basePartsForNormalise) {
  47589. throw new Error("Error trying to parse base URL.");
  47590. }
  47591. basePartsForNormalise.path = URLToolkit2.normalizePath(
  47592. basePartsForNormalise.path
  47593. );
  47594. return URLToolkit2.buildURLFromParts(basePartsForNormalise);
  47595. }
  47596. var relativeParts = URLToolkit2.parseURL(relativeURL);
  47597. if (!relativeParts) {
  47598. throw new Error("Error trying to parse relative URL.");
  47599. }
  47600. if (relativeParts.scheme) {
  47601. if (!opts.alwaysNormalize) {
  47602. return relativeURL;
  47603. }
  47604. relativeParts.path = URLToolkit2.normalizePath(relativeParts.path);
  47605. return URLToolkit2.buildURLFromParts(relativeParts);
  47606. }
  47607. var baseParts = URLToolkit2.parseURL(baseURL);
  47608. if (!baseParts) {
  47609. throw new Error("Error trying to parse base URL.");
  47610. }
  47611. if (!baseParts.netLoc && baseParts.path && baseParts.path[0] !== "/") {
  47612. var pathParts = FIRST_SEGMENT_REGEX.exec(baseParts.path);
  47613. baseParts.netLoc = pathParts[1];
  47614. baseParts.path = pathParts[2];
  47615. }
  47616. if (baseParts.netLoc && !baseParts.path) {
  47617. baseParts.path = "/";
  47618. }
  47619. var builtParts = {
  47620. scheme: baseParts.scheme,
  47621. netLoc: relativeParts.netLoc,
  47622. path: null,
  47623. params: relativeParts.params,
  47624. query: relativeParts.query,
  47625. fragment: relativeParts.fragment
  47626. };
  47627. if (!relativeParts.netLoc) {
  47628. builtParts.netLoc = baseParts.netLoc;
  47629. if (relativeParts.path[0] !== "/") {
  47630. if (!relativeParts.path) {
  47631. builtParts.path = baseParts.path;
  47632. if (!relativeParts.params) {
  47633. builtParts.params = baseParts.params;
  47634. if (!relativeParts.query) {
  47635. builtParts.query = baseParts.query;
  47636. }
  47637. }
  47638. } else {
  47639. var baseURLPath = baseParts.path;
  47640. var newPath = baseURLPath.substring(0, baseURLPath.lastIndexOf("/") + 1) + relativeParts.path;
  47641. builtParts.path = URLToolkit2.normalizePath(newPath);
  47642. }
  47643. }
  47644. }
  47645. if (builtParts.path === null) {
  47646. builtParts.path = opts.alwaysNormalize ? URLToolkit2.normalizePath(relativeParts.path) : relativeParts.path;
  47647. }
  47648. return URLToolkit2.buildURLFromParts(builtParts);
  47649. },
  47650. parseURL: function(url) {
  47651. var parts = URL_REGEX.exec(url);
  47652. if (!parts) {
  47653. return null;
  47654. }
  47655. return {
  47656. scheme: parts[1] || "",
  47657. netLoc: parts[2] || "",
  47658. path: parts[3] || "",
  47659. params: parts[4] || "",
  47660. query: parts[5] || "",
  47661. fragment: parts[6] || ""
  47662. };
  47663. },
  47664. normalizePath: function(path) {
  47665. path = path.split("").reverse().join("").replace(SLASH_DOT_REGEX, "");
  47666. while (path.length !== (path = path.replace(SLASH_DOT_DOT_REGEX, "")).length) {
  47667. }
  47668. return path.split("").reverse().join("");
  47669. },
  47670. buildURLFromParts: function(parts) {
  47671. return parts.scheme + parts.netLoc + parts.path + parts.params + parts.query + parts.fragment;
  47672. }
  47673. };
  47674. module2.exports = URLToolkit2;
  47675. })();
  47676. })(urlToolkit);
  47677. var URLToolkit = urlToolkit.exports;
  47678. var DEFAULT_LOCATION$2 = "http://example.com";
  47679. var resolveUrl$4 = function resolveUrl(baseUrl, relativeUrl) {
  47680. if (/^[a-z]+:/i.test(relativeUrl)) {
  47681. return relativeUrl;
  47682. }
  47683. if (/^data:/.test(baseUrl)) {
  47684. baseUrl = window_1.location && window_1.location.href || "";
  47685. }
  47686. var nativeURL = typeof window_1.URL === "function";
  47687. var protocolLess = /^\/\//.test(baseUrl);
  47688. var removeLocation = !window_1.location && !/\/\//i.test(baseUrl);
  47689. if (nativeURL) {
  47690. baseUrl = new window_1.URL(baseUrl, window_1.location || DEFAULT_LOCATION$2);
  47691. } else if (!/\/\//i.test(baseUrl)) {
  47692. baseUrl = URLToolkit.buildAbsoluteURL(window_1.location && window_1.location.href || "", baseUrl);
  47693. }
  47694. if (nativeURL) {
  47695. var newUrl = new URL(relativeUrl, baseUrl);
  47696. if (removeLocation) {
  47697. return newUrl.href.slice(DEFAULT_LOCATION$2.length);
  47698. } else if (protocolLess) {
  47699. return newUrl.href.slice(newUrl.protocol.length);
  47700. }
  47701. return newUrl.href;
  47702. }
  47703. return URLToolkit.buildAbsoluteURL(baseUrl, relativeUrl);
  47704. };
  47705. var Stream$1 = /* @__PURE__ */ function() {
  47706. function Stream2() {
  47707. this.listeners = {};
  47708. }
  47709. var _proto = Stream2.prototype;
  47710. _proto.on = function on3(type2, listener) {
  47711. if (!this.listeners[type2]) {
  47712. this.listeners[type2] = [];
  47713. }
  47714. this.listeners[type2].push(listener);
  47715. };
  47716. _proto.off = function off2(type2, listener) {
  47717. if (!this.listeners[type2]) {
  47718. return false;
  47719. }
  47720. var index2 = this.listeners[type2].indexOf(listener);
  47721. this.listeners[type2] = this.listeners[type2].slice(0);
  47722. this.listeners[type2].splice(index2, 1);
  47723. return index2 > -1;
  47724. };
  47725. _proto.trigger = function trigger2(type2) {
  47726. var callbacks = this.listeners[type2];
  47727. if (!callbacks) {
  47728. return;
  47729. }
  47730. if (arguments.length === 2) {
  47731. var length = callbacks.length;
  47732. for (var i2 = 0; i2 < length; ++i2) {
  47733. callbacks[i2].call(this, arguments[1]);
  47734. }
  47735. } else {
  47736. var args = Array.prototype.slice.call(arguments, 1);
  47737. var _length = callbacks.length;
  47738. for (var _i = 0; _i < _length; ++_i) {
  47739. callbacks[_i].apply(this, args);
  47740. }
  47741. }
  47742. };
  47743. _proto.dispose = function dispose() {
  47744. this.listeners = {};
  47745. };
  47746. _proto.pipe = function pipe(destination2) {
  47747. this.on("data", function(data) {
  47748. destination2.push(data);
  47749. });
  47750. };
  47751. return Stream2;
  47752. }();
  47753. var atob$2 = function atob(s) {
  47754. return window_1.atob ? window_1.atob(s) : Buffer.from(s, "base64").toString("binary");
  47755. };
  47756. function decodeB64ToUint8Array$2(b64Text) {
  47757. var decodedString = atob$2(b64Text);
  47758. var array = new Uint8Array(decodedString.length);
  47759. for (var i2 = 0; i2 < decodedString.length; i2++) {
  47760. array[i2] = decodedString.charCodeAt(i2);
  47761. }
  47762. return array;
  47763. }
  47764. /*! @name m3u8-parser @version 6.1.0 @license Apache-2.0 */
  47765. class LineStream$1 extends Stream$1 {
  47766. constructor() {
  47767. super();
  47768. this.buffer = "";
  47769. }
  47770. push(data) {
  47771. let nextNewline;
  47772. this.buffer += data;
  47773. nextNewline = this.buffer.indexOf("\n");
  47774. for (; nextNewline > -1; nextNewline = this.buffer.indexOf("\n")) {
  47775. this.trigger("data", this.buffer.substring(0, nextNewline));
  47776. this.buffer = this.buffer.substring(nextNewline + 1);
  47777. }
  47778. }
  47779. }
  47780. const TAB$1 = String.fromCharCode(9);
  47781. const parseByterange$1 = function(byterangeString) {
  47782. const match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || "");
  47783. const result = {};
  47784. if (match[1]) {
  47785. result.length = parseInt(match[1], 10);
  47786. }
  47787. if (match[2]) {
  47788. result.offset = parseInt(match[2], 10);
  47789. }
  47790. return result;
  47791. };
  47792. const attributeSeparator$1 = function() {
  47793. const key = "[^=]*";
  47794. const value = '"[^"]*"|[^,]*';
  47795. const keyvalue = "(?:" + key + ")=(?:" + value + ")";
  47796. return new RegExp("(?:^|,)(" + keyvalue + ")");
  47797. };
  47798. const parseAttributes$3 = function(attributes) {
  47799. const result = {};
  47800. if (!attributes) {
  47801. return result;
  47802. }
  47803. const attrs = attributes.split(attributeSeparator$1());
  47804. let i2 = attrs.length;
  47805. let attr;
  47806. while (i2--) {
  47807. if (attrs[i2] === "") {
  47808. continue;
  47809. }
  47810. attr = /([^=]*)=(.*)/.exec(attrs[i2]).slice(1);
  47811. attr[0] = attr[0].replace(/^\s+|\s+$/g, "");
  47812. attr[1] = attr[1].replace(/^\s+|\s+$/g, "");
  47813. attr[1] = attr[1].replace(/^['"](.*)['"]$/g, "$1");
  47814. result[attr[0]] = attr[1];
  47815. }
  47816. return result;
  47817. };
  47818. class ParseStream$1 extends Stream$1 {
  47819. constructor() {
  47820. super();
  47821. this.customParsers = [];
  47822. this.tagMappers = [];
  47823. }
  47824. push(line) {
  47825. let match;
  47826. let event2;
  47827. line = line.trim();
  47828. if (line.length === 0) {
  47829. return;
  47830. }
  47831. if (line[0] !== "#") {
  47832. this.trigger("data", {
  47833. type: "uri",
  47834. uri: line
  47835. });
  47836. return;
  47837. }
  47838. const newLines = this.tagMappers.reduce((acc, mapper) => {
  47839. const mappedLine = mapper(line);
  47840. if (mappedLine === line) {
  47841. return acc;
  47842. }
  47843. return acc.concat([mappedLine]);
  47844. }, [line]);
  47845. newLines.forEach((newLine) => {
  47846. for (let i2 = 0; i2 < this.customParsers.length; i2++) {
  47847. if (this.customParsers[i2].call(this, newLine)) {
  47848. return;
  47849. }
  47850. }
  47851. if (newLine.indexOf("#EXT") !== 0) {
  47852. this.trigger("data", {
  47853. type: "comment",
  47854. text: newLine.slice(1)
  47855. });
  47856. return;
  47857. }
  47858. newLine = newLine.replace("\r", "");
  47859. match = /^#EXTM3U/.exec(newLine);
  47860. if (match) {
  47861. this.trigger("data", {
  47862. type: "tag",
  47863. tagType: "m3u"
  47864. });
  47865. return;
  47866. }
  47867. match = /^#EXTINF:([0-9\.]*)?,?(.*)?$/.exec(newLine);
  47868. if (match) {
  47869. event2 = {
  47870. type: "tag",
  47871. tagType: "inf"
  47872. };
  47873. if (match[1]) {
  47874. event2.duration = parseFloat(match[1]);
  47875. }
  47876. if (match[2]) {
  47877. event2.title = match[2];
  47878. }
  47879. this.trigger("data", event2);
  47880. return;
  47881. }
  47882. match = /^#EXT-X-TARGETDURATION:([0-9.]*)?/.exec(newLine);
  47883. if (match) {
  47884. event2 = {
  47885. type: "tag",
  47886. tagType: "targetduration"
  47887. };
  47888. if (match[1]) {
  47889. event2.duration = parseInt(match[1], 10);
  47890. }
  47891. this.trigger("data", event2);
  47892. return;
  47893. }
  47894. match = /^#EXT-X-VERSION:([0-9.]*)?/.exec(newLine);
  47895. if (match) {
  47896. event2 = {
  47897. type: "tag",
  47898. tagType: "version"
  47899. };
  47900. if (match[1]) {
  47901. event2.version = parseInt(match[1], 10);
  47902. }
  47903. this.trigger("data", event2);
  47904. return;
  47905. }
  47906. match = /^#EXT-X-MEDIA-SEQUENCE:(\-?[0-9.]*)?/.exec(newLine);
  47907. if (match) {
  47908. event2 = {
  47909. type: "tag",
  47910. tagType: "media-sequence"
  47911. };
  47912. if (match[1]) {
  47913. event2.number = parseInt(match[1], 10);
  47914. }
  47915. this.trigger("data", event2);
  47916. return;
  47917. }
  47918. match = /^#EXT-X-DISCONTINUITY-SEQUENCE:(\-?[0-9.]*)?/.exec(newLine);
  47919. if (match) {
  47920. event2 = {
  47921. type: "tag",
  47922. tagType: "discontinuity-sequence"
  47923. };
  47924. if (match[1]) {
  47925. event2.number = parseInt(match[1], 10);
  47926. }
  47927. this.trigger("data", event2);
  47928. return;
  47929. }
  47930. match = /^#EXT-X-PLAYLIST-TYPE:(.*)?$/.exec(newLine);
  47931. if (match) {
  47932. event2 = {
  47933. type: "tag",
  47934. tagType: "playlist-type"
  47935. };
  47936. if (match[1]) {
  47937. event2.playlistType = match[1];
  47938. }
  47939. this.trigger("data", event2);
  47940. return;
  47941. }
  47942. match = /^#EXT-X-BYTERANGE:(.*)?$/.exec(newLine);
  47943. if (match) {
  47944. event2 = _extends$2(parseByterange$1(match[1]), {
  47945. type: "tag",
  47946. tagType: "byterange"
  47947. });
  47948. this.trigger("data", event2);
  47949. return;
  47950. }
  47951. match = /^#EXT-X-ALLOW-CACHE:(YES|NO)?/.exec(newLine);
  47952. if (match) {
  47953. event2 = {
  47954. type: "tag",
  47955. tagType: "allow-cache"
  47956. };
  47957. if (match[1]) {
  47958. event2.allowed = !/NO/.test(match[1]);
  47959. }
  47960. this.trigger("data", event2);
  47961. return;
  47962. }
  47963. match = /^#EXT-X-MAP:(.*)$/.exec(newLine);
  47964. if (match) {
  47965. event2 = {
  47966. type: "tag",
  47967. tagType: "map"
  47968. };
  47969. if (match[1]) {
  47970. const attributes = parseAttributes$3(match[1]);
  47971. if (attributes.URI) {
  47972. event2.uri = attributes.URI;
  47973. }
  47974. if (attributes.BYTERANGE) {
  47975. event2.byterange = parseByterange$1(attributes.BYTERANGE);
  47976. }
  47977. }
  47978. this.trigger("data", event2);
  47979. return;
  47980. }
  47981. match = /^#EXT-X-STREAM-INF:(.*)$/.exec(newLine);
  47982. if (match) {
  47983. event2 = {
  47984. type: "tag",
  47985. tagType: "stream-inf"
  47986. };
  47987. if (match[1]) {
  47988. event2.attributes = parseAttributes$3(match[1]);
  47989. if (event2.attributes.RESOLUTION) {
  47990. const split2 = event2.attributes.RESOLUTION.split("x");
  47991. const resolution = {};
  47992. if (split2[0]) {
  47993. resolution.width = parseInt(split2[0], 10);
  47994. }
  47995. if (split2[1]) {
  47996. resolution.height = parseInt(split2[1], 10);
  47997. }
  47998. event2.attributes.RESOLUTION = resolution;
  47999. }
  48000. if (event2.attributes.BANDWIDTH) {
  48001. event2.attributes.BANDWIDTH = parseInt(event2.attributes.BANDWIDTH, 10);
  48002. }
  48003. if (event2.attributes["FRAME-RATE"]) {
  48004. event2.attributes["FRAME-RATE"] = parseFloat(event2.attributes["FRAME-RATE"]);
  48005. }
  48006. if (event2.attributes["PROGRAM-ID"]) {
  48007. event2.attributes["PROGRAM-ID"] = parseInt(event2.attributes["PROGRAM-ID"], 10);
  48008. }
  48009. }
  48010. this.trigger("data", event2);
  48011. return;
  48012. }
  48013. match = /^#EXT-X-MEDIA:(.*)$/.exec(newLine);
  48014. if (match) {
  48015. event2 = {
  48016. type: "tag",
  48017. tagType: "media"
  48018. };
  48019. if (match[1]) {
  48020. event2.attributes = parseAttributes$3(match[1]);
  48021. }
  48022. this.trigger("data", event2);
  48023. return;
  48024. }
  48025. match = /^#EXT-X-ENDLIST/.exec(newLine);
  48026. if (match) {
  48027. this.trigger("data", {
  48028. type: "tag",
  48029. tagType: "endlist"
  48030. });
  48031. return;
  48032. }
  48033. match = /^#EXT-X-DISCONTINUITY/.exec(newLine);
  48034. if (match) {
  48035. this.trigger("data", {
  48036. type: "tag",
  48037. tagType: "discontinuity"
  48038. });
  48039. return;
  48040. }
  48041. match = /^#EXT-X-PROGRAM-DATE-TIME:(.*)$/.exec(newLine);
  48042. if (match) {
  48043. event2 = {
  48044. type: "tag",
  48045. tagType: "program-date-time"
  48046. };
  48047. if (match[1]) {
  48048. event2.dateTimeString = match[1];
  48049. event2.dateTimeObject = new Date(match[1]);
  48050. }
  48051. this.trigger("data", event2);
  48052. return;
  48053. }
  48054. match = /^#EXT-X-KEY:(.*)$/.exec(newLine);
  48055. if (match) {
  48056. event2 = {
  48057. type: "tag",
  48058. tagType: "key"
  48059. };
  48060. if (match[1]) {
  48061. event2.attributes = parseAttributes$3(match[1]);
  48062. if (event2.attributes.IV) {
  48063. if (event2.attributes.IV.substring(0, 2).toLowerCase() === "0x") {
  48064. event2.attributes.IV = event2.attributes.IV.substring(2);
  48065. }
  48066. event2.attributes.IV = event2.attributes.IV.match(/.{8}/g);
  48067. event2.attributes.IV[0] = parseInt(event2.attributes.IV[0], 16);
  48068. event2.attributes.IV[1] = parseInt(event2.attributes.IV[1], 16);
  48069. event2.attributes.IV[2] = parseInt(event2.attributes.IV[2], 16);
  48070. event2.attributes.IV[3] = parseInt(event2.attributes.IV[3], 16);
  48071. event2.attributes.IV = new Uint32Array(event2.attributes.IV);
  48072. }
  48073. }
  48074. this.trigger("data", event2);
  48075. return;
  48076. }
  48077. match = /^#EXT-X-START:(.*)$/.exec(newLine);
  48078. if (match) {
  48079. event2 = {
  48080. type: "tag",
  48081. tagType: "start"
  48082. };
  48083. if (match[1]) {
  48084. event2.attributes = parseAttributes$3(match[1]);
  48085. event2.attributes["TIME-OFFSET"] = parseFloat(event2.attributes["TIME-OFFSET"]);
  48086. event2.attributes.PRECISE = /YES/.test(event2.attributes.PRECISE);
  48087. }
  48088. this.trigger("data", event2);
  48089. return;
  48090. }
  48091. match = /^#EXT-X-CUE-OUT-CONT:(.*)?$/.exec(newLine);
  48092. if (match) {
  48093. event2 = {
  48094. type: "tag",
  48095. tagType: "cue-out-cont"
  48096. };
  48097. if (match[1]) {
  48098. event2.data = match[1];
  48099. } else {
  48100. event2.data = "";
  48101. }
  48102. this.trigger("data", event2);
  48103. return;
  48104. }
  48105. match = /^#EXT-X-CUE-OUT:(.*)?$/.exec(newLine);
  48106. if (match) {
  48107. event2 = {
  48108. type: "tag",
  48109. tagType: "cue-out"
  48110. };
  48111. if (match[1]) {
  48112. event2.data = match[1];
  48113. } else {
  48114. event2.data = "";
  48115. }
  48116. this.trigger("data", event2);
  48117. return;
  48118. }
  48119. match = /^#EXT-X-CUE-IN:(.*)?$/.exec(newLine);
  48120. if (match) {
  48121. event2 = {
  48122. type: "tag",
  48123. tagType: "cue-in"
  48124. };
  48125. if (match[1]) {
  48126. event2.data = match[1];
  48127. } else {
  48128. event2.data = "";
  48129. }
  48130. this.trigger("data", event2);
  48131. return;
  48132. }
  48133. match = /^#EXT-X-SKIP:(.*)$/.exec(newLine);
  48134. if (match && match[1]) {
  48135. event2 = {
  48136. type: "tag",
  48137. tagType: "skip"
  48138. };
  48139. event2.attributes = parseAttributes$3(match[1]);
  48140. if (event2.attributes.hasOwnProperty("SKIPPED-SEGMENTS")) {
  48141. event2.attributes["SKIPPED-SEGMENTS"] = parseInt(event2.attributes["SKIPPED-SEGMENTS"], 10);
  48142. }
  48143. if (event2.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")) {
  48144. event2.attributes["RECENTLY-REMOVED-DATERANGES"] = event2.attributes["RECENTLY-REMOVED-DATERANGES"].split(TAB$1);
  48145. }
  48146. this.trigger("data", event2);
  48147. return;
  48148. }
  48149. match = /^#EXT-X-PART:(.*)$/.exec(newLine);
  48150. if (match && match[1]) {
  48151. event2 = {
  48152. type: "tag",
  48153. tagType: "part"
  48154. };
  48155. event2.attributes = parseAttributes$3(match[1]);
  48156. ["DURATION"].forEach(function(key) {
  48157. if (event2.attributes.hasOwnProperty(key)) {
  48158. event2.attributes[key] = parseFloat(event2.attributes[key]);
  48159. }
  48160. });
  48161. ["INDEPENDENT", "GAP"].forEach(function(key) {
  48162. if (event2.attributes.hasOwnProperty(key)) {
  48163. event2.attributes[key] = /YES/.test(event2.attributes[key]);
  48164. }
  48165. });
  48166. if (event2.attributes.hasOwnProperty("BYTERANGE")) {
  48167. event2.attributes.byterange = parseByterange$1(event2.attributes.BYTERANGE);
  48168. }
  48169. this.trigger("data", event2);
  48170. return;
  48171. }
  48172. match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine);
  48173. if (match && match[1]) {
  48174. event2 = {
  48175. type: "tag",
  48176. tagType: "server-control"
  48177. };
  48178. event2.attributes = parseAttributes$3(match[1]);
  48179. ["CAN-SKIP-UNTIL", "PART-HOLD-BACK", "HOLD-BACK"].forEach(function(key) {
  48180. if (event2.attributes.hasOwnProperty(key)) {
  48181. event2.attributes[key] = parseFloat(event2.attributes[key]);
  48182. }
  48183. });
  48184. ["CAN-SKIP-DATERANGES", "CAN-BLOCK-RELOAD"].forEach(function(key) {
  48185. if (event2.attributes.hasOwnProperty(key)) {
  48186. event2.attributes[key] = /YES/.test(event2.attributes[key]);
  48187. }
  48188. });
  48189. this.trigger("data", event2);
  48190. return;
  48191. }
  48192. match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine);
  48193. if (match && match[1]) {
  48194. event2 = {
  48195. type: "tag",
  48196. tagType: "part-inf"
  48197. };
  48198. event2.attributes = parseAttributes$3(match[1]);
  48199. ["PART-TARGET"].forEach(function(key) {
  48200. if (event2.attributes.hasOwnProperty(key)) {
  48201. event2.attributes[key] = parseFloat(event2.attributes[key]);
  48202. }
  48203. });
  48204. this.trigger("data", event2);
  48205. return;
  48206. }
  48207. match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine);
  48208. if (match && match[1]) {
  48209. event2 = {
  48210. type: "tag",
  48211. tagType: "preload-hint"
  48212. };
  48213. event2.attributes = parseAttributes$3(match[1]);
  48214. ["BYTERANGE-START", "BYTERANGE-LENGTH"].forEach(function(key) {
  48215. if (event2.attributes.hasOwnProperty(key)) {
  48216. event2.attributes[key] = parseInt(event2.attributes[key], 10);
  48217. const subkey = key === "BYTERANGE-LENGTH" ? "length" : "offset";
  48218. event2.attributes.byterange = event2.attributes.byterange || {};
  48219. event2.attributes.byterange[subkey] = event2.attributes[key];
  48220. delete event2.attributes[key];
  48221. }
  48222. });
  48223. this.trigger("data", event2);
  48224. return;
  48225. }
  48226. match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine);
  48227. if (match && match[1]) {
  48228. event2 = {
  48229. type: "tag",
  48230. tagType: "rendition-report"
  48231. };
  48232. event2.attributes = parseAttributes$3(match[1]);
  48233. ["LAST-MSN", "LAST-PART"].forEach(function(key) {
  48234. if (event2.attributes.hasOwnProperty(key)) {
  48235. event2.attributes[key] = parseInt(event2.attributes[key], 10);
  48236. }
  48237. });
  48238. this.trigger("data", event2);
  48239. return;
  48240. }
  48241. match = /^#EXT-X-DATERANGE:(.*)$/.exec(newLine);
  48242. if (match && match[1]) {
  48243. event2 = {
  48244. type: "tag",
  48245. tagType: "daterange"
  48246. };
  48247. event2.attributes = parseAttributes$3(match[1]);
  48248. ["ID", "CLASS"].forEach(function(key) {
  48249. if (event2.attributes.hasOwnProperty(key)) {
  48250. event2.attributes[key] = String(event2.attributes[key]);
  48251. }
  48252. });
  48253. ["START-DATE", "END-DATE"].forEach(function(key) {
  48254. if (event2.attributes.hasOwnProperty(key)) {
  48255. event2.attributes[key] = new Date(event2.attributes[key]);
  48256. }
  48257. });
  48258. ["DURATION", "PLANNED-DURATION"].forEach(function(key) {
  48259. if (event2.attributes.hasOwnProperty(key)) {
  48260. event2.attributes[key] = parseFloat(event2.attributes[key]);
  48261. }
  48262. });
  48263. ["END-ON-NEXT"].forEach(function(key) {
  48264. if (event2.attributes.hasOwnProperty(key)) {
  48265. event2.attributes[key] = /YES/i.test(event2.attributes[key]);
  48266. }
  48267. });
  48268. ["SCTE35-CMD", " SCTE35-OUT", "SCTE35-IN"].forEach(function(key) {
  48269. if (event2.attributes.hasOwnProperty(key)) {
  48270. event2.attributes[key] = event2.attributes[key].toString(16);
  48271. }
  48272. });
  48273. const clientAttributePattern = /^X-([A-Z]+-)+[A-Z]+$/;
  48274. for (const key in event2.attributes) {
  48275. if (!clientAttributePattern.test(key)) {
  48276. continue;
  48277. }
  48278. const isHexaDecimal = /[0-9A-Fa-f]{6}/g.test(event2.attributes[key]);
  48279. const isDecimalFloating = /^\d+(\.\d+)?$/.test(event2.attributes[key]);
  48280. event2.attributes[key] = isHexaDecimal ? event2.attributes[key].toString(16) : isDecimalFloating ? parseFloat(event2.attributes[key]) : String(event2.attributes[key]);
  48281. }
  48282. this.trigger("data", event2);
  48283. return;
  48284. }
  48285. this.trigger("data", {
  48286. type: "tag",
  48287. data: newLine.slice(4)
  48288. });
  48289. });
  48290. }
  48291. addParser({
  48292. expression,
  48293. customType,
  48294. dataParser,
  48295. segment
  48296. }) {
  48297. if (typeof dataParser !== "function") {
  48298. dataParser = (line) => line;
  48299. }
  48300. this.customParsers.push((line) => {
  48301. const match = expression.exec(line);
  48302. if (match) {
  48303. this.trigger("data", {
  48304. type: "custom",
  48305. data: dataParser(line),
  48306. customType,
  48307. segment
  48308. });
  48309. return true;
  48310. }
  48311. });
  48312. }
  48313. addTagMapper({
  48314. expression,
  48315. map
  48316. }) {
  48317. const mapFn = (line) => {
  48318. if (expression.test(line)) {
  48319. return map(line);
  48320. }
  48321. return line;
  48322. };
  48323. this.tagMappers.push(mapFn);
  48324. }
  48325. }
  48326. const camelCase$1 = (str) => str.toLowerCase().replace(/-(\w)/g, (a) => a[1].toUpperCase());
  48327. const camelCaseKeys$1 = function(attributes) {
  48328. const result = {};
  48329. Object.keys(attributes).forEach(function(key) {
  48330. result[camelCase$1(key)] = attributes[key];
  48331. });
  48332. return result;
  48333. };
  48334. const setHoldBack$1 = function(manifest) {
  48335. const {
  48336. serverControl,
  48337. targetDuration,
  48338. partTargetDuration
  48339. } = manifest;
  48340. if (!serverControl) {
  48341. return;
  48342. }
  48343. const tag = "#EXT-X-SERVER-CONTROL";
  48344. const hb = "holdBack";
  48345. const phb = "partHoldBack";
  48346. const minTargetDuration = targetDuration && targetDuration * 3;
  48347. const minPartDuration = partTargetDuration && partTargetDuration * 2;
  48348. if (targetDuration && !serverControl.hasOwnProperty(hb)) {
  48349. serverControl[hb] = minTargetDuration;
  48350. this.trigger("info", {
  48351. message: `${tag} defaulting HOLD-BACK to targetDuration * 3 (${minTargetDuration}).`
  48352. });
  48353. }
  48354. if (minTargetDuration && serverControl[hb] < minTargetDuration) {
  48355. this.trigger("warn", {
  48356. message: `${tag} clamping HOLD-BACK (${serverControl[hb]}) to targetDuration * 3 (${minTargetDuration})`
  48357. });
  48358. serverControl[hb] = minTargetDuration;
  48359. }
  48360. if (partTargetDuration && !serverControl.hasOwnProperty(phb)) {
  48361. serverControl[phb] = partTargetDuration * 3;
  48362. this.trigger("info", {
  48363. message: `${tag} defaulting PART-HOLD-BACK to partTargetDuration * 3 (${serverControl[phb]}).`
  48364. });
  48365. }
  48366. if (partTargetDuration && serverControl[phb] < minPartDuration) {
  48367. this.trigger("warn", {
  48368. message: `${tag} clamping PART-HOLD-BACK (${serverControl[phb]}) to partTargetDuration * 2 (${minPartDuration}).`
  48369. });
  48370. serverControl[phb] = minPartDuration;
  48371. }
  48372. };
  48373. class Parser$1 extends Stream$1 {
  48374. constructor() {
  48375. super();
  48376. this.lineStream = new LineStream$1();
  48377. this.parseStream = new ParseStream$1();
  48378. this.lineStream.pipe(this.parseStream);
  48379. const self2 = this;
  48380. const uris = [];
  48381. let currentUri = {};
  48382. let currentMap;
  48383. let key;
  48384. let hasParts = false;
  48385. const noop2 = function() {
  48386. };
  48387. const defaultMediaGroups = {
  48388. "AUDIO": {},
  48389. "VIDEO": {},
  48390. "CLOSED-CAPTIONS": {},
  48391. "SUBTITLES": {}
  48392. };
  48393. const widevineUuid = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";
  48394. let currentTimeline = 0;
  48395. this.manifest = {
  48396. allowCache: true,
  48397. discontinuityStarts: [],
  48398. segments: []
  48399. };
  48400. let lastByterangeEnd = 0;
  48401. let lastPartByterangeEnd = 0;
  48402. const daterangeTags = {};
  48403. this.on("end", () => {
  48404. if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) {
  48405. return;
  48406. }
  48407. if (!currentUri.map && currentMap) {
  48408. currentUri.map = currentMap;
  48409. }
  48410. if (!currentUri.key && key) {
  48411. currentUri.key = key;
  48412. }
  48413. if (!currentUri.timeline && typeof currentTimeline === "number") {
  48414. currentUri.timeline = currentTimeline;
  48415. }
  48416. this.manifest.preloadSegment = currentUri;
  48417. });
  48418. this.parseStream.on("data", function(entry) {
  48419. let mediaGroup;
  48420. let rendition;
  48421. ({
  48422. tag() {
  48423. ({
  48424. version() {
  48425. if (entry.version) {
  48426. this.manifest.version = entry.version;
  48427. }
  48428. },
  48429. "allow-cache"() {
  48430. this.manifest.allowCache = entry.allowed;
  48431. if (!("allowed" in entry)) {
  48432. this.trigger("info", {
  48433. message: "defaulting allowCache to YES"
  48434. });
  48435. this.manifest.allowCache = true;
  48436. }
  48437. },
  48438. byterange() {
  48439. const byterange = {};
  48440. if ("length" in entry) {
  48441. currentUri.byterange = byterange;
  48442. byterange.length = entry.length;
  48443. if (!("offset" in entry)) {
  48444. entry.offset = lastByterangeEnd;
  48445. }
  48446. }
  48447. if ("offset" in entry) {
  48448. currentUri.byterange = byterange;
  48449. byterange.offset = entry.offset;
  48450. }
  48451. lastByterangeEnd = byterange.offset + byterange.length;
  48452. },
  48453. endlist() {
  48454. this.manifest.endList = true;
  48455. },
  48456. inf() {
  48457. if (!("mediaSequence" in this.manifest)) {
  48458. this.manifest.mediaSequence = 0;
  48459. this.trigger("info", {
  48460. message: "defaulting media sequence to zero"
  48461. });
  48462. }
  48463. if (!("discontinuitySequence" in this.manifest)) {
  48464. this.manifest.discontinuitySequence = 0;
  48465. this.trigger("info", {
  48466. message: "defaulting discontinuity sequence to zero"
  48467. });
  48468. }
  48469. if (entry.duration > 0) {
  48470. currentUri.duration = entry.duration;
  48471. }
  48472. if (entry.duration === 0) {
  48473. currentUri.duration = 0.01;
  48474. this.trigger("info", {
  48475. message: "updating zero segment duration to a small value"
  48476. });
  48477. }
  48478. this.manifest.segments = uris;
  48479. },
  48480. key() {
  48481. if (!entry.attributes) {
  48482. this.trigger("warn", {
  48483. message: "ignoring key declaration without attribute list"
  48484. });
  48485. return;
  48486. }
  48487. if (entry.attributes.METHOD === "NONE") {
  48488. key = null;
  48489. return;
  48490. }
  48491. if (!entry.attributes.URI) {
  48492. this.trigger("warn", {
  48493. message: "ignoring key declaration without URI"
  48494. });
  48495. return;
  48496. }
  48497. if (entry.attributes.KEYFORMAT === "com.apple.streamingkeydelivery") {
  48498. this.manifest.contentProtection = this.manifest.contentProtection || {};
  48499. this.manifest.contentProtection["com.apple.fps.1_0"] = {
  48500. attributes: entry.attributes
  48501. };
  48502. return;
  48503. }
  48504. if (entry.attributes.KEYFORMAT === "com.microsoft.playready") {
  48505. this.manifest.contentProtection = this.manifest.contentProtection || {};
  48506. this.manifest.contentProtection["com.microsoft.playready"] = {
  48507. uri: entry.attributes.URI
  48508. };
  48509. return;
  48510. }
  48511. if (entry.attributes.KEYFORMAT === widevineUuid) {
  48512. const VALID_METHODS = ["SAMPLE-AES", "SAMPLE-AES-CTR", "SAMPLE-AES-CENC"];
  48513. if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) {
  48514. this.trigger("warn", {
  48515. message: "invalid key method provided for Widevine"
  48516. });
  48517. return;
  48518. }
  48519. if (entry.attributes.METHOD === "SAMPLE-AES-CENC") {
  48520. this.trigger("warn", {
  48521. message: "SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"
  48522. });
  48523. }
  48524. if (entry.attributes.URI.substring(0, 23) !== "data:text/plain;base64,") {
  48525. this.trigger("warn", {
  48526. message: "invalid key URI provided for Widevine"
  48527. });
  48528. return;
  48529. }
  48530. if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === "0x")) {
  48531. this.trigger("warn", {
  48532. message: "invalid key ID provided for Widevine"
  48533. });
  48534. return;
  48535. }
  48536. this.manifest.contentProtection = this.manifest.contentProtection || {};
  48537. this.manifest.contentProtection["com.widevine.alpha"] = {
  48538. attributes: {
  48539. schemeIdUri: entry.attributes.KEYFORMAT,
  48540. keyId: entry.attributes.KEYID.substring(2)
  48541. },
  48542. pssh: decodeB64ToUint8Array$2(entry.attributes.URI.split(",")[1])
  48543. };
  48544. return;
  48545. }
  48546. if (!entry.attributes.METHOD) {
  48547. this.trigger("warn", {
  48548. message: "defaulting key method to AES-128"
  48549. });
  48550. }
  48551. key = {
  48552. method: entry.attributes.METHOD || "AES-128",
  48553. uri: entry.attributes.URI
  48554. };
  48555. if (typeof entry.attributes.IV !== "undefined") {
  48556. key.iv = entry.attributes.IV;
  48557. }
  48558. },
  48559. "media-sequence"() {
  48560. if (!isFinite(entry.number)) {
  48561. this.trigger("warn", {
  48562. message: "ignoring invalid media sequence: " + entry.number
  48563. });
  48564. return;
  48565. }
  48566. this.manifest.mediaSequence = entry.number;
  48567. },
  48568. "discontinuity-sequence"() {
  48569. if (!isFinite(entry.number)) {
  48570. this.trigger("warn", {
  48571. message: "ignoring invalid discontinuity sequence: " + entry.number
  48572. });
  48573. return;
  48574. }
  48575. this.manifest.discontinuitySequence = entry.number;
  48576. currentTimeline = entry.number;
  48577. },
  48578. "playlist-type"() {
  48579. if (!/VOD|EVENT/.test(entry.playlistType)) {
  48580. this.trigger("warn", {
  48581. message: "ignoring unknown playlist type: " + entry.playlist
  48582. });
  48583. return;
  48584. }
  48585. this.manifest.playlistType = entry.playlistType;
  48586. },
  48587. map() {
  48588. currentMap = {};
  48589. if (entry.uri) {
  48590. currentMap.uri = entry.uri;
  48591. }
  48592. if (entry.byterange) {
  48593. currentMap.byterange = entry.byterange;
  48594. }
  48595. if (key) {
  48596. currentMap.key = key;
  48597. }
  48598. },
  48599. "stream-inf"() {
  48600. this.manifest.playlists = uris;
  48601. this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;
  48602. if (!entry.attributes) {
  48603. this.trigger("warn", {
  48604. message: "ignoring empty stream-inf attributes"
  48605. });
  48606. return;
  48607. }
  48608. if (!currentUri.attributes) {
  48609. currentUri.attributes = {};
  48610. }
  48611. _extends$2(currentUri.attributes, entry.attributes);
  48612. },
  48613. media() {
  48614. this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;
  48615. if (!(entry.attributes && entry.attributes.TYPE && entry.attributes["GROUP-ID"] && entry.attributes.NAME)) {
  48616. this.trigger("warn", {
  48617. message: "ignoring incomplete or missing media group"
  48618. });
  48619. return;
  48620. }
  48621. const mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE];
  48622. mediaGroupType[entry.attributes["GROUP-ID"]] = mediaGroupType[entry.attributes["GROUP-ID"]] || {};
  48623. mediaGroup = mediaGroupType[entry.attributes["GROUP-ID"]];
  48624. rendition = {
  48625. default: /yes/i.test(entry.attributes.DEFAULT)
  48626. };
  48627. if (rendition.default) {
  48628. rendition.autoselect = true;
  48629. } else {
  48630. rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT);
  48631. }
  48632. if (entry.attributes.LANGUAGE) {
  48633. rendition.language = entry.attributes.LANGUAGE;
  48634. }
  48635. if (entry.attributes.URI) {
  48636. rendition.uri = entry.attributes.URI;
  48637. }
  48638. if (entry.attributes["INSTREAM-ID"]) {
  48639. rendition.instreamId = entry.attributes["INSTREAM-ID"];
  48640. }
  48641. if (entry.attributes.CHARACTERISTICS) {
  48642. rendition.characteristics = entry.attributes.CHARACTERISTICS;
  48643. }
  48644. if (entry.attributes.FORCED) {
  48645. rendition.forced = /yes/i.test(entry.attributes.FORCED);
  48646. }
  48647. mediaGroup[entry.attributes.NAME] = rendition;
  48648. },
  48649. discontinuity() {
  48650. currentTimeline += 1;
  48651. currentUri.discontinuity = true;
  48652. this.manifest.discontinuityStarts.push(uris.length);
  48653. },
  48654. "program-date-time"() {
  48655. if (typeof this.manifest.dateTimeString === "undefined") {
  48656. this.manifest.dateTimeString = entry.dateTimeString;
  48657. this.manifest.dateTimeObject = entry.dateTimeObject;
  48658. }
  48659. currentUri.dateTimeString = entry.dateTimeString;
  48660. currentUri.dateTimeObject = entry.dateTimeObject;
  48661. },
  48662. targetduration() {
  48663. if (!isFinite(entry.duration) || entry.duration < 0) {
  48664. this.trigger("warn", {
  48665. message: "ignoring invalid target duration: " + entry.duration
  48666. });
  48667. return;
  48668. }
  48669. this.manifest.targetDuration = entry.duration;
  48670. setHoldBack$1.call(this, this.manifest);
  48671. },
  48672. start() {
  48673. if (!entry.attributes || isNaN(entry.attributes["TIME-OFFSET"])) {
  48674. this.trigger("warn", {
  48675. message: "ignoring start declaration without appropriate attribute list"
  48676. });
  48677. return;
  48678. }
  48679. this.manifest.start = {
  48680. timeOffset: entry.attributes["TIME-OFFSET"],
  48681. precise: entry.attributes.PRECISE
  48682. };
  48683. },
  48684. "cue-out"() {
  48685. currentUri.cueOut = entry.data;
  48686. },
  48687. "cue-out-cont"() {
  48688. currentUri.cueOutCont = entry.data;
  48689. },
  48690. "cue-in"() {
  48691. currentUri.cueIn = entry.data;
  48692. },
  48693. "skip"() {
  48694. this.manifest.skip = camelCaseKeys$1(entry.attributes);
  48695. this.warnOnMissingAttributes_("#EXT-X-SKIP", entry.attributes, ["SKIPPED-SEGMENTS"]);
  48696. },
  48697. "part"() {
  48698. hasParts = true;
  48699. const segmentIndex = this.manifest.segments.length;
  48700. const part = camelCaseKeys$1(entry.attributes);
  48701. currentUri.parts = currentUri.parts || [];
  48702. currentUri.parts.push(part);
  48703. if (part.byterange) {
  48704. if (!part.byterange.hasOwnProperty("offset")) {
  48705. part.byterange.offset = lastPartByterangeEnd;
  48706. }
  48707. lastPartByterangeEnd = part.byterange.offset + part.byterange.length;
  48708. }
  48709. const partIndex = currentUri.parts.length - 1;
  48710. this.warnOnMissingAttributes_(`#EXT-X-PART #${partIndex} for segment #${segmentIndex}`, entry.attributes, ["URI", "DURATION"]);
  48711. if (this.manifest.renditionReports) {
  48712. this.manifest.renditionReports.forEach((r2, i2) => {
  48713. if (!r2.hasOwnProperty("lastPart")) {
  48714. this.trigger("warn", {
  48715. message: `#EXT-X-RENDITION-REPORT #${i2} lacks required attribute(s): LAST-PART`
  48716. });
  48717. }
  48718. });
  48719. }
  48720. },
  48721. "server-control"() {
  48722. const attrs = this.manifest.serverControl = camelCaseKeys$1(entry.attributes);
  48723. if (!attrs.hasOwnProperty("canBlockReload")) {
  48724. attrs.canBlockReload = false;
  48725. this.trigger("info", {
  48726. message: "#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"
  48727. });
  48728. }
  48729. setHoldBack$1.call(this, this.manifest);
  48730. if (attrs.canSkipDateranges && !attrs.hasOwnProperty("canSkipUntil")) {
  48731. this.trigger("warn", {
  48732. message: "#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"
  48733. });
  48734. }
  48735. },
  48736. "preload-hint"() {
  48737. const segmentIndex = this.manifest.segments.length;
  48738. const hint = camelCaseKeys$1(entry.attributes);
  48739. const isPart = hint.type && hint.type === "PART";
  48740. currentUri.preloadHints = currentUri.preloadHints || [];
  48741. currentUri.preloadHints.push(hint);
  48742. if (hint.byterange) {
  48743. if (!hint.byterange.hasOwnProperty("offset")) {
  48744. hint.byterange.offset = isPart ? lastPartByterangeEnd : 0;
  48745. if (isPart) {
  48746. lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length;
  48747. }
  48748. }
  48749. }
  48750. const index2 = currentUri.preloadHints.length - 1;
  48751. this.warnOnMissingAttributes_(`#EXT-X-PRELOAD-HINT #${index2} for segment #${segmentIndex}`, entry.attributes, ["TYPE", "URI"]);
  48752. if (!hint.type) {
  48753. return;
  48754. }
  48755. for (let i2 = 0; i2 < currentUri.preloadHints.length - 1; i2++) {
  48756. const otherHint = currentUri.preloadHints[i2];
  48757. if (!otherHint.type) {
  48758. continue;
  48759. }
  48760. if (otherHint.type === hint.type) {
  48761. this.trigger("warn", {
  48762. message: `#EXT-X-PRELOAD-HINT #${index2} for segment #${segmentIndex} has the same TYPE ${hint.type} as preload hint #${i2}`
  48763. });
  48764. }
  48765. }
  48766. },
  48767. "rendition-report"() {
  48768. const report = camelCaseKeys$1(entry.attributes);
  48769. this.manifest.renditionReports = this.manifest.renditionReports || [];
  48770. this.manifest.renditionReports.push(report);
  48771. const index2 = this.manifest.renditionReports.length - 1;
  48772. const required = ["LAST-MSN", "URI"];
  48773. if (hasParts) {
  48774. required.push("LAST-PART");
  48775. }
  48776. this.warnOnMissingAttributes_(`#EXT-X-RENDITION-REPORT #${index2}`, entry.attributes, required);
  48777. },
  48778. "part-inf"() {
  48779. this.manifest.partInf = camelCaseKeys$1(entry.attributes);
  48780. this.warnOnMissingAttributes_("#EXT-X-PART-INF", entry.attributes, ["PART-TARGET"]);
  48781. if (this.manifest.partInf.partTarget) {
  48782. this.manifest.partTargetDuration = this.manifest.partInf.partTarget;
  48783. }
  48784. setHoldBack$1.call(this, this.manifest);
  48785. },
  48786. "daterange"() {
  48787. this.manifest.daterange = this.manifest.daterange || [];
  48788. this.manifest.daterange.push(camelCaseKeys$1(entry.attributes));
  48789. const index2 = this.manifest.daterange.length - 1;
  48790. this.warnOnMissingAttributes_(`#EXT-X-DATERANGE #${index2}`, entry.attributes, ["ID", "START-DATE"]);
  48791. const daterange = this.manifest.daterange[index2];
  48792. if (daterange.endDate && daterange.startDate && new Date(daterange.endDate) < new Date(daterange.startDate)) {
  48793. this.trigger("warn", {
  48794. message: "EXT-X-DATERANGE END-DATE must be equal to or later than the value of the START-DATE"
  48795. });
  48796. }
  48797. if (daterange.duration && daterange.duration < 0) {
  48798. this.trigger("warn", {
  48799. message: "EXT-X-DATERANGE DURATION must not be negative"
  48800. });
  48801. }
  48802. if (daterange.plannedDuration && daterange.plannedDuration < 0) {
  48803. this.trigger("warn", {
  48804. message: "EXT-X-DATERANGE PLANNED-DURATION must not be negative"
  48805. });
  48806. }
  48807. const endOnNextYes = !!daterange.endOnNext;
  48808. if (endOnNextYes && !daterange.class) {
  48809. this.trigger("warn", {
  48810. message: "EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must have a CLASS attribute"
  48811. });
  48812. }
  48813. if (endOnNextYes && (daterange.duration || daterange.endDate)) {
  48814. this.trigger("warn", {
  48815. message: "EXT-X-DATERANGE with an END-ON-NEXT=YES attribute must not contain DURATION or END-DATE attributes"
  48816. });
  48817. }
  48818. if (daterange.duration && daterange.endDate) {
  48819. const startDate = daterange.startDate;
  48820. const newDateInSeconds = startDate.setSeconds(startDate.getSeconds() + daterange.duration);
  48821. this.manifest.daterange[index2].endDate = new Date(newDateInSeconds);
  48822. }
  48823. if (daterange && !this.manifest.dateTimeString) {
  48824. this.trigger("warn", {
  48825. message: "A playlist with EXT-X-DATERANGE tag must contain atleast one EXT-X-PROGRAM-DATE-TIME tag"
  48826. });
  48827. }
  48828. if (!daterangeTags[daterange.id]) {
  48829. daterangeTags[daterange.id] = daterange;
  48830. } else {
  48831. for (const attribute in daterangeTags[daterange.id]) {
  48832. if (daterangeTags[daterange.id][attribute] !== daterange[attribute]) {
  48833. this.trigger("warn", {
  48834. message: "EXT-X-DATERANGE tags with the same ID in a playlist must have the same attributes and same attribute values"
  48835. });
  48836. break;
  48837. }
  48838. }
  48839. }
  48840. }
  48841. }[entry.tagType] || noop2).call(self2);
  48842. },
  48843. uri() {
  48844. currentUri.uri = entry.uri;
  48845. uris.push(currentUri);
  48846. if (this.manifest.targetDuration && !("duration" in currentUri)) {
  48847. this.trigger("warn", {
  48848. message: "defaulting segment duration to the target duration"
  48849. });
  48850. currentUri.duration = this.manifest.targetDuration;
  48851. }
  48852. if (key) {
  48853. currentUri.key = key;
  48854. }
  48855. currentUri.timeline = currentTimeline;
  48856. if (currentMap) {
  48857. currentUri.map = currentMap;
  48858. }
  48859. lastPartByterangeEnd = 0;
  48860. currentUri = {};
  48861. },
  48862. comment() {
  48863. },
  48864. custom() {
  48865. if (entry.segment) {
  48866. currentUri.custom = currentUri.custom || {};
  48867. currentUri.custom[entry.customType] = entry.data;
  48868. } else {
  48869. this.manifest.custom = this.manifest.custom || {};
  48870. this.manifest.custom[entry.customType] = entry.data;
  48871. }
  48872. }
  48873. })[entry.type].call(self2);
  48874. });
  48875. }
  48876. warnOnMissingAttributes_(identifier, attributes, required) {
  48877. const missing = [];
  48878. required.forEach(function(key) {
  48879. if (!attributes.hasOwnProperty(key)) {
  48880. missing.push(key);
  48881. }
  48882. });
  48883. if (missing.length) {
  48884. this.trigger("warn", {
  48885. message: `${identifier} lacks required attribute(s): ${missing.join(", ")}`
  48886. });
  48887. }
  48888. }
  48889. push(chunk) {
  48890. this.lineStream.push(chunk);
  48891. }
  48892. end() {
  48893. this.lineStream.push("\n");
  48894. this.trigger("end");
  48895. }
  48896. addParser(options2) {
  48897. this.parseStream.addParser(options2);
  48898. }
  48899. addTagMapper(options2) {
  48900. this.parseStream.addTagMapper(options2);
  48901. }
  48902. }
  48903. var regexs$1 = {
  48904. mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,
  48905. webm: /^(vp0?[89]|av0?1|opus|vorbis)/,
  48906. ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/,
  48907. video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,
  48908. audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,
  48909. text: /^(stpp.ttml.im1t)/,
  48910. muxerVideo: /^(avc0?1)/,
  48911. muxerAudio: /^(mp4a)/,
  48912. muxerText: /a^/
  48913. };
  48914. var mediaTypes$1 = ["video", "audio", "text"];
  48915. var upperMediaTypes$1 = ["Video", "Audio", "Text"];
  48916. var translateLegacyCodec$1 = function translateLegacyCodec(codec) {
  48917. if (!codec) {
  48918. return codec;
  48919. }
  48920. return codec.replace(/avc1\.(\d+)\.(\d+)/i, function(orig, profile, avcLevel) {
  48921. var profileHex = ("00" + Number(profile).toString(16)).slice(-2);
  48922. var avcLevelHex = ("00" + Number(avcLevel).toString(16)).slice(-2);
  48923. return "avc1." + profileHex + "00" + avcLevelHex;
  48924. });
  48925. };
  48926. var parseCodecs$1 = function parseCodecs(codecString) {
  48927. if (codecString === void 0) {
  48928. codecString = "";
  48929. }
  48930. var codecs = codecString.split(",");
  48931. var result = [];
  48932. codecs.forEach(function(codec) {
  48933. codec = codec.trim();
  48934. var codecType;
  48935. mediaTypes$1.forEach(function(name) {
  48936. var match = regexs$1[name].exec(codec.toLowerCase());
  48937. if (!match || match.length <= 1) {
  48938. return;
  48939. }
  48940. codecType = name;
  48941. var type2 = codec.substring(0, match[1].length);
  48942. var details = codec.replace(type2, "");
  48943. result.push({
  48944. type: type2,
  48945. details,
  48946. mediaType: name
  48947. });
  48948. });
  48949. if (!codecType) {
  48950. result.push({
  48951. type: codec,
  48952. details: "",
  48953. mediaType: "unknown"
  48954. });
  48955. }
  48956. });
  48957. return result;
  48958. };
  48959. var codecsFromDefault$1 = function codecsFromDefault(master, audioGroupId) {
  48960. if (!master.mediaGroups.AUDIO || !audioGroupId) {
  48961. return null;
  48962. }
  48963. var audioGroup = master.mediaGroups.AUDIO[audioGroupId];
  48964. if (!audioGroup) {
  48965. return null;
  48966. }
  48967. for (var name in audioGroup) {
  48968. var audioType = audioGroup[name];
  48969. if (audioType.default && audioType.playlists) {
  48970. return parseCodecs$1(audioType.playlists[0].attributes.CODECS);
  48971. }
  48972. }
  48973. return null;
  48974. };
  48975. var isAudioCodec$1 = function isAudioCodec(codec) {
  48976. if (codec === void 0) {
  48977. codec = "";
  48978. }
  48979. return regexs$1.audio.test(codec.trim().toLowerCase());
  48980. };
  48981. var isTextCodec$1 = function isTextCodec(codec) {
  48982. if (codec === void 0) {
  48983. codec = "";
  48984. }
  48985. return regexs$1.text.test(codec.trim().toLowerCase());
  48986. };
  48987. var getMimeForCodec$1 = function getMimeForCodec(codecString) {
  48988. if (!codecString || typeof codecString !== "string") {
  48989. return;
  48990. }
  48991. var codecs = codecString.toLowerCase().split(",").map(function(c) {
  48992. return translateLegacyCodec$1(c.trim());
  48993. });
  48994. var type2 = "video";
  48995. if (codecs.length === 1 && isAudioCodec$1(codecs[0])) {
  48996. type2 = "audio";
  48997. } else if (codecs.length === 1 && isTextCodec$1(codecs[0])) {
  48998. type2 = "application";
  48999. }
  49000. var container = "mp4";
  49001. if (codecs.every(function(c) {
  49002. return regexs$1.mp4.test(c);
  49003. })) {
  49004. container = "mp4";
  49005. } else if (codecs.every(function(c) {
  49006. return regexs$1.webm.test(c);
  49007. })) {
  49008. container = "webm";
  49009. } else if (codecs.every(function(c) {
  49010. return regexs$1.ogg.test(c);
  49011. })) {
  49012. container = "ogg";
  49013. }
  49014. return type2 + "/" + container + ';codecs="' + codecString + '"';
  49015. };
  49016. var browserSupportsCodec$1 = function browserSupportsCodec(codecString) {
  49017. if (codecString === void 0) {
  49018. codecString = "";
  49019. }
  49020. return window_1.MediaSource && window_1.MediaSource.isTypeSupported && window_1.MediaSource.isTypeSupported(getMimeForCodec$1(codecString)) || false;
  49021. };
  49022. var muxerSupportsCodec$1 = function muxerSupportsCodec(codecString) {
  49023. if (codecString === void 0) {
  49024. codecString = "";
  49025. }
  49026. return codecString.toLowerCase().split(",").every(function(codec) {
  49027. codec = codec.trim();
  49028. for (var i2 = 0; i2 < upperMediaTypes$1.length; i2++) {
  49029. var type2 = upperMediaTypes$1[i2];
  49030. if (regexs$1["muxer" + type2].test(codec)) {
  49031. return true;
  49032. }
  49033. }
  49034. return false;
  49035. });
  49036. };
  49037. var DEFAULT_AUDIO_CODEC$1 = "mp4a.40.2";
  49038. var DEFAULT_VIDEO_CODEC$1 = "avc1.4d400d";
  49039. var MPEGURL_REGEX$1 = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;
  49040. var DASH_REGEX$1 = /^application\/dash\+xml/i;
  49041. var simpleTypeFromSourceType$1 = function simpleTypeFromSourceType(type2) {
  49042. if (MPEGURL_REGEX$1.test(type2)) {
  49043. return "hls";
  49044. }
  49045. if (DASH_REGEX$1.test(type2)) {
  49046. return "dash";
  49047. }
  49048. if (type2 === "application/vnd.videojs.vhs+json") {
  49049. return "vhs-json";
  49050. }
  49051. return null;
  49052. };
  49053. var countBits$1 = function countBits(x) {
  49054. return x.toString(2).length;
  49055. };
  49056. var countBytes$1 = function countBytes(x) {
  49057. return Math.ceil(countBits$1(x) / 8);
  49058. };
  49059. var isArrayBufferView$1 = function isArrayBufferView(obj) {
  49060. if (ArrayBuffer.isView === "function") {
  49061. return ArrayBuffer.isView(obj);
  49062. }
  49063. return obj && obj.buffer instanceof ArrayBuffer;
  49064. };
  49065. var isTypedArray$1 = function isTypedArray(obj) {
  49066. return isArrayBufferView$1(obj);
  49067. };
  49068. var toUint8$1 = function toUint8(bytes) {
  49069. if (bytes instanceof Uint8Array) {
  49070. return bytes;
  49071. }
  49072. if (!Array.isArray(bytes) && !isTypedArray$1(bytes) && !(bytes instanceof ArrayBuffer)) {
  49073. if (typeof bytes !== "number" || typeof bytes === "number" && bytes !== bytes) {
  49074. bytes = 0;
  49075. } else {
  49076. bytes = [bytes];
  49077. }
  49078. }
  49079. return new Uint8Array(bytes && bytes.buffer || bytes, bytes && bytes.byteOffset || 0, bytes && bytes.byteLength || 0);
  49080. };
  49081. var BigInt$1 = window_1.BigInt || Number;
  49082. var BYTE_TABLE$1 = [BigInt$1("0x1"), BigInt$1("0x100"), BigInt$1("0x10000"), BigInt$1("0x1000000"), BigInt$1("0x100000000"), BigInt$1("0x10000000000"), BigInt$1("0x1000000000000"), BigInt$1("0x100000000000000"), BigInt$1("0x10000000000000000")];
  49083. (function() {
  49084. var a = new Uint16Array([65484]);
  49085. var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
  49086. if (b[0] === 255) {
  49087. return "big";
  49088. }
  49089. if (b[0] === 204) {
  49090. return "little";
  49091. }
  49092. return "unknown";
  49093. })();
  49094. var bytesToNumber$1 = function bytesToNumber(bytes, _temp) {
  49095. var _ref = _temp === void 0 ? {} : _temp, _ref$signed = _ref.signed, signed = _ref$signed === void 0 ? false : _ref$signed, _ref$le = _ref.le, le = _ref$le === void 0 ? false : _ref$le;
  49096. bytes = toUint8$1(bytes);
  49097. var fn2 = le ? "reduce" : "reduceRight";
  49098. var obj = bytes[fn2] ? bytes[fn2] : Array.prototype[fn2];
  49099. var number = obj.call(bytes, function(total, byte, i2) {
  49100. var exponent = le ? i2 : Math.abs(i2 + 1 - bytes.length);
  49101. return total + BigInt$1(byte) * BYTE_TABLE$1[exponent];
  49102. }, BigInt$1(0));
  49103. if (signed) {
  49104. var max2 = BYTE_TABLE$1[bytes.length] / BigInt$1(2) - BigInt$1(1);
  49105. number = BigInt$1(number);
  49106. if (number > max2) {
  49107. number -= max2;
  49108. number -= max2;
  49109. number -= BigInt$1(2);
  49110. }
  49111. }
  49112. return Number(number);
  49113. };
  49114. var numberToBytes$1 = function numberToBytes(number, _temp2) {
  49115. var _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$le = _ref2.le, le = _ref2$le === void 0 ? false : _ref2$le;
  49116. if (typeof number !== "bigint" && typeof number !== "number" || typeof number === "number" && number !== number) {
  49117. number = 0;
  49118. }
  49119. number = BigInt$1(number);
  49120. var byteCount = countBytes$1(number);
  49121. var bytes = new Uint8Array(new ArrayBuffer(byteCount));
  49122. for (var i2 = 0; i2 < byteCount; i2++) {
  49123. var byteIndex = le ? i2 : Math.abs(i2 + 1 - bytes.length);
  49124. bytes[byteIndex] = Number(number / BYTE_TABLE$1[i2] & BigInt$1(255));
  49125. if (number < 0) {
  49126. bytes[byteIndex] = Math.abs(~bytes[byteIndex]);
  49127. bytes[byteIndex] -= i2 === 0 ? 1 : 2;
  49128. }
  49129. }
  49130. return bytes;
  49131. };
  49132. var stringToBytes$1 = function stringToBytes(string, stringIsBytes) {
  49133. if (typeof string !== "string" && string && typeof string.toString === "function") {
  49134. string = string.toString();
  49135. }
  49136. if (typeof string !== "string") {
  49137. return new Uint8Array();
  49138. }
  49139. if (!stringIsBytes) {
  49140. string = unescape(encodeURIComponent(string));
  49141. }
  49142. var view = new Uint8Array(string.length);
  49143. for (var i2 = 0; i2 < string.length; i2++) {
  49144. view[i2] = string.charCodeAt(i2);
  49145. }
  49146. return view;
  49147. };
  49148. var concatTypedArrays$1 = function concatTypedArrays() {
  49149. for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) {
  49150. buffers[_key] = arguments[_key];
  49151. }
  49152. buffers = buffers.filter(function(b) {
  49153. return b && (b.byteLength || b.length) && typeof b !== "string";
  49154. });
  49155. if (buffers.length <= 1) {
  49156. return toUint8$1(buffers[0]);
  49157. }
  49158. var totalLen = buffers.reduce(function(total, buf, i2) {
  49159. return total + (buf.byteLength || buf.length);
  49160. }, 0);
  49161. var tempBuffer = new Uint8Array(totalLen);
  49162. var offset = 0;
  49163. buffers.forEach(function(buf) {
  49164. buf = toUint8$1(buf);
  49165. tempBuffer.set(buf, offset);
  49166. offset += buf.byteLength;
  49167. });
  49168. return tempBuffer;
  49169. };
  49170. var bytesMatch$1 = function bytesMatch(a, b, _temp3) {
  49171. var _ref3 = _temp3 === void 0 ? {} : _temp3, _ref3$offset = _ref3.offset, offset = _ref3$offset === void 0 ? 0 : _ref3$offset, _ref3$mask = _ref3.mask, mask = _ref3$mask === void 0 ? [] : _ref3$mask;
  49172. a = toUint8$1(a);
  49173. b = toUint8$1(b);
  49174. var fn2 = b.every ? b.every : Array.prototype.every;
  49175. return b.length && a.length - offset >= b.length && fn2.call(b, function(bByte, i2) {
  49176. var aByte = mask[i2] ? mask[i2] & a[offset + i2] : a[offset + i2];
  49177. return bByte === aByte;
  49178. });
  49179. };
  49180. var DEFAULT_LOCATION$1 = "http://example.com";
  49181. var resolveUrl$3 = function resolveUrl2(baseUrl, relativeUrl) {
  49182. if (/^[a-z]+:/i.test(relativeUrl)) {
  49183. return relativeUrl;
  49184. }
  49185. if (/^data:/.test(baseUrl)) {
  49186. baseUrl = window_1.location && window_1.location.href || "";
  49187. }
  49188. var nativeURL = typeof window_1.URL === "function";
  49189. var protocolLess = /^\/\//.test(baseUrl);
  49190. var removeLocation = !window_1.location && !/\/\//i.test(baseUrl);
  49191. if (nativeURL) {
  49192. baseUrl = new window_1.URL(baseUrl, window_1.location || DEFAULT_LOCATION$1);
  49193. } else if (!/\/\//i.test(baseUrl)) {
  49194. baseUrl = URLToolkit.buildAbsoluteURL(window_1.location && window_1.location.href || "", baseUrl);
  49195. }
  49196. if (nativeURL) {
  49197. var newUrl = new URL(relativeUrl, baseUrl);
  49198. if (removeLocation) {
  49199. return newUrl.href.slice(DEFAULT_LOCATION$1.length);
  49200. } else if (protocolLess) {
  49201. return newUrl.href.slice(newUrl.protocol.length);
  49202. }
  49203. return newUrl.href;
  49204. }
  49205. return URLToolkit.buildAbsoluteURL(baseUrl, relativeUrl);
  49206. };
  49207. var forEachMediaGroup$3 = function forEachMediaGroup(master, groups, callback2) {
  49208. groups.forEach(function(mediaType) {
  49209. for (var groupKey in master.mediaGroups[mediaType]) {
  49210. for (var labelKey in master.mediaGroups[mediaType][groupKey]) {
  49211. var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];
  49212. callback2(mediaProperties, mediaType, groupKey, labelKey);
  49213. }
  49214. }
  49215. });
  49216. };
  49217. var atob$1 = function atob2(s) {
  49218. return window_1.atob ? window_1.atob(s) : Buffer.from(s, "base64").toString("binary");
  49219. };
  49220. function decodeB64ToUint8Array$1(b64Text) {
  49221. var decodedString = atob$1(b64Text);
  49222. var array = new Uint8Array(decodedString.length);
  49223. for (var i2 = 0; i2 < decodedString.length; i2++) {
  49224. array[i2] = decodedString.charCodeAt(i2);
  49225. }
  49226. return array;
  49227. }
  49228. var dom$1 = {};
  49229. var conventions$2 = {};
  49230. function find$1(list, predicate, ac) {
  49231. if (ac === void 0) {
  49232. ac = Array.prototype;
  49233. }
  49234. if (list && typeof ac.find === "function") {
  49235. return ac.find.call(list, predicate);
  49236. }
  49237. for (var i2 = 0; i2 < list.length; i2++) {
  49238. if (Object.prototype.hasOwnProperty.call(list, i2)) {
  49239. var item = list[i2];
  49240. if (predicate.call(void 0, item, i2, list)) {
  49241. return item;
  49242. }
  49243. }
  49244. }
  49245. }
  49246. function freeze(object, oc) {
  49247. if (oc === void 0) {
  49248. oc = Object;
  49249. }
  49250. return oc && typeof oc.freeze === "function" ? oc.freeze(object) : object;
  49251. }
  49252. function assign$1(target, source) {
  49253. if (target === null || typeof target !== "object") {
  49254. throw new TypeError("target is not an object");
  49255. }
  49256. for (var key in source) {
  49257. if (Object.prototype.hasOwnProperty.call(source, key)) {
  49258. target[key] = source[key];
  49259. }
  49260. }
  49261. return target;
  49262. }
  49263. var MIME_TYPE = freeze({
  49264. HTML: "text/html",
  49265. isHTML: function(value) {
  49266. return value === MIME_TYPE.HTML;
  49267. },
  49268. XML_APPLICATION: "application/xml",
  49269. XML_TEXT: "text/xml",
  49270. XML_XHTML_APPLICATION: "application/xhtml+xml",
  49271. XML_SVG_IMAGE: "image/svg+xml"
  49272. });
  49273. var NAMESPACE$3 = freeze({
  49274. HTML: "http://www.w3.org/1999/xhtml",
  49275. isHTML: function(uri) {
  49276. return uri === NAMESPACE$3.HTML;
  49277. },
  49278. SVG: "http://www.w3.org/2000/svg",
  49279. XML: "http://www.w3.org/XML/1998/namespace",
  49280. XMLNS: "http://www.w3.org/2000/xmlns/"
  49281. });
  49282. conventions$2.assign = assign$1;
  49283. conventions$2.find = find$1;
  49284. conventions$2.freeze = freeze;
  49285. conventions$2.MIME_TYPE = MIME_TYPE;
  49286. conventions$2.NAMESPACE = NAMESPACE$3;
  49287. var conventions$1 = conventions$2;
  49288. var find = conventions$1.find;
  49289. var NAMESPACE$2 = conventions$1.NAMESPACE;
  49290. function notEmptyString(input) {
  49291. return input !== "";
  49292. }
  49293. function splitOnASCIIWhitespace(input) {
  49294. return input ? input.split(/[\t\n\f\r ]+/).filter(notEmptyString) : [];
  49295. }
  49296. function orderedSetReducer(current, element) {
  49297. if (!current.hasOwnProperty(element)) {
  49298. current[element] = true;
  49299. }
  49300. return current;
  49301. }
  49302. function toOrderedSet(input) {
  49303. if (!input)
  49304. return [];
  49305. var list = splitOnASCIIWhitespace(input);
  49306. return Object.keys(list.reduce(orderedSetReducer, {}));
  49307. }
  49308. function arrayIncludes(list) {
  49309. return function(element) {
  49310. return list && list.indexOf(element) !== -1;
  49311. };
  49312. }
  49313. function copy(src, dest) {
  49314. for (var p in src) {
  49315. if (Object.prototype.hasOwnProperty.call(src, p)) {
  49316. dest[p] = src[p];
  49317. }
  49318. }
  49319. }
  49320. function _extends(Class, Super) {
  49321. var pt2 = Class.prototype;
  49322. if (!(pt2 instanceof Super)) {
  49323. let t2 = function() {
  49324. };
  49325. t2.prototype = Super.prototype;
  49326. t2 = new t2();
  49327. copy(pt2, t2);
  49328. Class.prototype = pt2 = t2;
  49329. }
  49330. if (pt2.constructor != Class) {
  49331. if (typeof Class != "function") {
  49332. console.error("unknown Class:" + Class);
  49333. }
  49334. pt2.constructor = Class;
  49335. }
  49336. }
  49337. var NodeType = {};
  49338. var ELEMENT_NODE = NodeType.ELEMENT_NODE = 1;
  49339. var ATTRIBUTE_NODE = NodeType.ATTRIBUTE_NODE = 2;
  49340. var TEXT_NODE = NodeType.TEXT_NODE = 3;
  49341. var CDATA_SECTION_NODE = NodeType.CDATA_SECTION_NODE = 4;
  49342. var ENTITY_REFERENCE_NODE = NodeType.ENTITY_REFERENCE_NODE = 5;
  49343. var ENTITY_NODE = NodeType.ENTITY_NODE = 6;
  49344. var PROCESSING_INSTRUCTION_NODE = NodeType.PROCESSING_INSTRUCTION_NODE = 7;
  49345. var COMMENT_NODE = NodeType.COMMENT_NODE = 8;
  49346. var DOCUMENT_NODE = NodeType.DOCUMENT_NODE = 9;
  49347. var DOCUMENT_TYPE_NODE = NodeType.DOCUMENT_TYPE_NODE = 10;
  49348. var DOCUMENT_FRAGMENT_NODE = NodeType.DOCUMENT_FRAGMENT_NODE = 11;
  49349. var NOTATION_NODE = NodeType.NOTATION_NODE = 12;
  49350. var ExceptionCode = {};
  49351. var ExceptionMessage = {};
  49352. ExceptionCode.INDEX_SIZE_ERR = (ExceptionMessage[1] = "Index size error", 1);
  49353. ExceptionCode.DOMSTRING_SIZE_ERR = (ExceptionMessage[2] = "DOMString size error", 2);
  49354. var HIERARCHY_REQUEST_ERR = ExceptionCode.HIERARCHY_REQUEST_ERR = (ExceptionMessage[3] = "Hierarchy request error", 3);
  49355. ExceptionCode.WRONG_DOCUMENT_ERR = (ExceptionMessage[4] = "Wrong document", 4);
  49356. ExceptionCode.INVALID_CHARACTER_ERR = (ExceptionMessage[5] = "Invalid character", 5);
  49357. ExceptionCode.NO_DATA_ALLOWED_ERR = (ExceptionMessage[6] = "No data allowed", 6);
  49358. ExceptionCode.NO_MODIFICATION_ALLOWED_ERR = (ExceptionMessage[7] = "No modification allowed", 7);
  49359. var NOT_FOUND_ERR = ExceptionCode.NOT_FOUND_ERR = (ExceptionMessage[8] = "Not found", 8);
  49360. ExceptionCode.NOT_SUPPORTED_ERR = (ExceptionMessage[9] = "Not supported", 9);
  49361. var INUSE_ATTRIBUTE_ERR = ExceptionCode.INUSE_ATTRIBUTE_ERR = (ExceptionMessage[10] = "Attribute in use", 10);
  49362. ExceptionCode.INVALID_STATE_ERR = (ExceptionMessage[11] = "Invalid state", 11);
  49363. ExceptionCode.SYNTAX_ERR = (ExceptionMessage[12] = "Syntax error", 12);
  49364. ExceptionCode.INVALID_MODIFICATION_ERR = (ExceptionMessage[13] = "Invalid modification", 13);
  49365. ExceptionCode.NAMESPACE_ERR = (ExceptionMessage[14] = "Invalid namespace", 14);
  49366. ExceptionCode.INVALID_ACCESS_ERR = (ExceptionMessage[15] = "Invalid access", 15);
  49367. function DOMException(code, message) {
  49368. if (message instanceof Error) {
  49369. var error = message;
  49370. } else {
  49371. error = this;
  49372. Error.call(this, ExceptionMessage[code]);
  49373. this.message = ExceptionMessage[code];
  49374. if (Error.captureStackTrace)
  49375. Error.captureStackTrace(this, DOMException);
  49376. }
  49377. error.code = code;
  49378. if (message)
  49379. this.message = this.message + ": " + message;
  49380. return error;
  49381. }
  49382. DOMException.prototype = Error.prototype;
  49383. copy(ExceptionCode, DOMException);
  49384. function NodeList() {
  49385. }
  49386. NodeList.prototype = {
  49387. length: 0,
  49388. item: function(index2) {
  49389. return this[index2] || null;
  49390. },
  49391. toString: function(isHTML, nodeFilter) {
  49392. for (var buf = [], i2 = 0; i2 < this.length; i2++) {
  49393. serializeToString(this[i2], buf, isHTML, nodeFilter);
  49394. }
  49395. return buf.join("");
  49396. },
  49397. filter: function(predicate) {
  49398. return Array.prototype.filter.call(this, predicate);
  49399. },
  49400. indexOf: function(item) {
  49401. return Array.prototype.indexOf.call(this, item);
  49402. }
  49403. };
  49404. function LiveNodeList(node, refresh) {
  49405. this._node = node;
  49406. this._refresh = refresh;
  49407. _updateLiveList(this);
  49408. }
  49409. function _updateLiveList(list) {
  49410. var inc = list._node._inc || list._node.ownerDocument._inc;
  49411. if (list._inc != inc) {
  49412. var ls = list._refresh(list._node);
  49413. __set__(list, "length", ls.length);
  49414. copy(ls, list);
  49415. list._inc = inc;
  49416. }
  49417. }
  49418. LiveNodeList.prototype.item = function(i2) {
  49419. _updateLiveList(this);
  49420. return this[i2];
  49421. };
  49422. _extends(LiveNodeList, NodeList);
  49423. function NamedNodeMap() {
  49424. }
  49425. function _findNodeIndex(list, node) {
  49426. var i2 = list.length;
  49427. while (i2--) {
  49428. if (list[i2] === node) {
  49429. return i2;
  49430. }
  49431. }
  49432. }
  49433. function _addNamedNode(el, list, newAttr, oldAttr) {
  49434. if (oldAttr) {
  49435. list[_findNodeIndex(list, oldAttr)] = newAttr;
  49436. } else {
  49437. list[list.length++] = newAttr;
  49438. }
  49439. if (el) {
  49440. newAttr.ownerElement = el;
  49441. var doc = el.ownerDocument;
  49442. if (doc) {
  49443. oldAttr && _onRemoveAttribute(doc, el, oldAttr);
  49444. _onAddAttribute(doc, el, newAttr);
  49445. }
  49446. }
  49447. }
  49448. function _removeNamedNode(el, list, attr) {
  49449. var i2 = _findNodeIndex(list, attr);
  49450. if (i2 >= 0) {
  49451. var lastIndex = list.length - 1;
  49452. while (i2 < lastIndex) {
  49453. list[i2] = list[++i2];
  49454. }
  49455. list.length = lastIndex;
  49456. if (el) {
  49457. var doc = el.ownerDocument;
  49458. if (doc) {
  49459. _onRemoveAttribute(doc, el, attr);
  49460. attr.ownerElement = null;
  49461. }
  49462. }
  49463. } else {
  49464. throw new DOMException(NOT_FOUND_ERR, new Error(el.tagName + "@" + attr));
  49465. }
  49466. }
  49467. NamedNodeMap.prototype = {
  49468. length: 0,
  49469. item: NodeList.prototype.item,
  49470. getNamedItem: function(key) {
  49471. var i2 = this.length;
  49472. while (i2--) {
  49473. var attr = this[i2];
  49474. if (attr.nodeName == key) {
  49475. return attr;
  49476. }
  49477. }
  49478. },
  49479. setNamedItem: function(attr) {
  49480. var el = attr.ownerElement;
  49481. if (el && el != this._ownerElement) {
  49482. throw new DOMException(INUSE_ATTRIBUTE_ERR);
  49483. }
  49484. var oldAttr = this.getNamedItem(attr.nodeName);
  49485. _addNamedNode(this._ownerElement, this, attr, oldAttr);
  49486. return oldAttr;
  49487. },
  49488. setNamedItemNS: function(attr) {
  49489. var el = attr.ownerElement, oldAttr;
  49490. if (el && el != this._ownerElement) {
  49491. throw new DOMException(INUSE_ATTRIBUTE_ERR);
  49492. }
  49493. oldAttr = this.getNamedItemNS(attr.namespaceURI, attr.localName);
  49494. _addNamedNode(this._ownerElement, this, attr, oldAttr);
  49495. return oldAttr;
  49496. },
  49497. removeNamedItem: function(key) {
  49498. var attr = this.getNamedItem(key);
  49499. _removeNamedNode(this._ownerElement, this, attr);
  49500. return attr;
  49501. },
  49502. removeNamedItemNS: function(namespaceURI, localName) {
  49503. var attr = this.getNamedItemNS(namespaceURI, localName);
  49504. _removeNamedNode(this._ownerElement, this, attr);
  49505. return attr;
  49506. },
  49507. getNamedItemNS: function(namespaceURI, localName) {
  49508. var i2 = this.length;
  49509. while (i2--) {
  49510. var node = this[i2];
  49511. if (node.localName == localName && node.namespaceURI == namespaceURI) {
  49512. return node;
  49513. }
  49514. }
  49515. return null;
  49516. }
  49517. };
  49518. function DOMImplementation$1() {
  49519. }
  49520. DOMImplementation$1.prototype = {
  49521. hasFeature: function(feature2, version2) {
  49522. return true;
  49523. },
  49524. createDocument: function(namespaceURI, qualifiedName, doctype) {
  49525. var doc = new Document();
  49526. doc.implementation = this;
  49527. doc.childNodes = new NodeList();
  49528. doc.doctype = doctype || null;
  49529. if (doctype) {
  49530. doc.appendChild(doctype);
  49531. }
  49532. if (qualifiedName) {
  49533. var root2 = doc.createElementNS(namespaceURI, qualifiedName);
  49534. doc.appendChild(root2);
  49535. }
  49536. return doc;
  49537. },
  49538. createDocumentType: function(qualifiedName, publicId, systemId) {
  49539. var node = new DocumentType();
  49540. node.name = qualifiedName;
  49541. node.nodeName = qualifiedName;
  49542. node.publicId = publicId || "";
  49543. node.systemId = systemId || "";
  49544. return node;
  49545. }
  49546. };
  49547. function Node() {
  49548. }
  49549. Node.prototype = {
  49550. firstChild: null,
  49551. lastChild: null,
  49552. previousSibling: null,
  49553. nextSibling: null,
  49554. attributes: null,
  49555. parentNode: null,
  49556. childNodes: null,
  49557. ownerDocument: null,
  49558. nodeValue: null,
  49559. namespaceURI: null,
  49560. prefix: null,
  49561. localName: null,
  49562. insertBefore: function(newChild, refChild) {
  49563. return _insertBefore(this, newChild, refChild);
  49564. },
  49565. replaceChild: function(newChild, oldChild) {
  49566. _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
  49567. if (oldChild) {
  49568. this.removeChild(oldChild);
  49569. }
  49570. },
  49571. removeChild: function(oldChild) {
  49572. return _removeChild(this, oldChild);
  49573. },
  49574. appendChild: function(newChild) {
  49575. return this.insertBefore(newChild, null);
  49576. },
  49577. hasChildNodes: function() {
  49578. return this.firstChild != null;
  49579. },
  49580. cloneNode: function(deep) {
  49581. return cloneNode(this.ownerDocument || this, this, deep);
  49582. },
  49583. normalize: function() {
  49584. var child = this.firstChild;
  49585. while (child) {
  49586. var next = child.nextSibling;
  49587. if (next && next.nodeType == TEXT_NODE && child.nodeType == TEXT_NODE) {
  49588. this.removeChild(next);
  49589. child.appendData(next.data);
  49590. } else {
  49591. child.normalize();
  49592. child = next;
  49593. }
  49594. }
  49595. },
  49596. isSupported: function(feature2, version2) {
  49597. return this.ownerDocument.implementation.hasFeature(feature2, version2);
  49598. },
  49599. hasAttributes: function() {
  49600. return this.attributes.length > 0;
  49601. },
  49602. lookupPrefix: function(namespaceURI) {
  49603. var el = this;
  49604. while (el) {
  49605. var map = el._nsMap;
  49606. if (map) {
  49607. for (var n in map) {
  49608. if (Object.prototype.hasOwnProperty.call(map, n) && map[n] === namespaceURI) {
  49609. return n;
  49610. }
  49611. }
  49612. }
  49613. el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
  49614. }
  49615. return null;
  49616. },
  49617. lookupNamespaceURI: function(prefix) {
  49618. var el = this;
  49619. while (el) {
  49620. var map = el._nsMap;
  49621. if (map) {
  49622. if (Object.prototype.hasOwnProperty.call(map, prefix)) {
  49623. return map[prefix];
  49624. }
  49625. }
  49626. el = el.nodeType == ATTRIBUTE_NODE ? el.ownerDocument : el.parentNode;
  49627. }
  49628. return null;
  49629. },
  49630. isDefaultNamespace: function(namespaceURI) {
  49631. var prefix = this.lookupPrefix(namespaceURI);
  49632. return prefix == null;
  49633. }
  49634. };
  49635. function _xmlEncoder(c) {
  49636. return c == "<" && "&lt;" || c == ">" && "&gt;" || c == "&" && "&amp;" || c == '"' && "&quot;" || "&#" + c.charCodeAt() + ";";
  49637. }
  49638. copy(NodeType, Node);
  49639. copy(NodeType, Node.prototype);
  49640. function _visitNode(node, callback2) {
  49641. if (callback2(node)) {
  49642. return true;
  49643. }
  49644. if (node = node.firstChild) {
  49645. do {
  49646. if (_visitNode(node, callback2)) {
  49647. return true;
  49648. }
  49649. } while (node = node.nextSibling);
  49650. }
  49651. }
  49652. function Document() {
  49653. this.ownerDocument = this;
  49654. }
  49655. function _onAddAttribute(doc, el, newAttr) {
  49656. doc && doc._inc++;
  49657. var ns = newAttr.namespaceURI;
  49658. if (ns === NAMESPACE$2.XMLNS) {
  49659. el._nsMap[newAttr.prefix ? newAttr.localName : ""] = newAttr.value;
  49660. }
  49661. }
  49662. function _onRemoveAttribute(doc, el, newAttr, remove2) {
  49663. doc && doc._inc++;
  49664. var ns = newAttr.namespaceURI;
  49665. if (ns === NAMESPACE$2.XMLNS) {
  49666. delete el._nsMap[newAttr.prefix ? newAttr.localName : ""];
  49667. }
  49668. }
  49669. function _onUpdateChild(doc, el, newChild) {
  49670. if (doc && doc._inc) {
  49671. doc._inc++;
  49672. var cs = el.childNodes;
  49673. if (newChild) {
  49674. cs[cs.length++] = newChild;
  49675. } else {
  49676. var child = el.firstChild;
  49677. var i2 = 0;
  49678. while (child) {
  49679. cs[i2++] = child;
  49680. child = child.nextSibling;
  49681. }
  49682. cs.length = i2;
  49683. delete cs[cs.length];
  49684. }
  49685. }
  49686. }
  49687. function _removeChild(parentNode, child) {
  49688. var previous = child.previousSibling;
  49689. var next = child.nextSibling;
  49690. if (previous) {
  49691. previous.nextSibling = next;
  49692. } else {
  49693. parentNode.firstChild = next;
  49694. }
  49695. if (next) {
  49696. next.previousSibling = previous;
  49697. } else {
  49698. parentNode.lastChild = previous;
  49699. }
  49700. child.parentNode = null;
  49701. child.previousSibling = null;
  49702. child.nextSibling = null;
  49703. _onUpdateChild(parentNode.ownerDocument, parentNode);
  49704. return child;
  49705. }
  49706. function hasValidParentNodeType(node) {
  49707. return node && (node.nodeType === Node.DOCUMENT_NODE || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.ELEMENT_NODE);
  49708. }
  49709. function hasInsertableNodeType(node) {
  49710. return node && (isElementNode(node) || isTextNode$2(node) || isDocTypeNode(node) || node.nodeType === Node.DOCUMENT_FRAGMENT_NODE || node.nodeType === Node.COMMENT_NODE || node.nodeType === Node.PROCESSING_INSTRUCTION_NODE);
  49711. }
  49712. function isDocTypeNode(node) {
  49713. return node && node.nodeType === Node.DOCUMENT_TYPE_NODE;
  49714. }
  49715. function isElementNode(node) {
  49716. return node && node.nodeType === Node.ELEMENT_NODE;
  49717. }
  49718. function isTextNode$2(node) {
  49719. return node && node.nodeType === Node.TEXT_NODE;
  49720. }
  49721. function isElementInsertionPossible(doc, child) {
  49722. var parentChildNodes = doc.childNodes || [];
  49723. if (find(parentChildNodes, isElementNode) || isDocTypeNode(child)) {
  49724. return false;
  49725. }
  49726. var docTypeNode = find(parentChildNodes, isDocTypeNode);
  49727. return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
  49728. }
  49729. function isElementReplacementPossible(doc, child) {
  49730. var parentChildNodes = doc.childNodes || [];
  49731. function hasElementChildThatIsNotChild(node) {
  49732. return isElementNode(node) && node !== child;
  49733. }
  49734. if (find(parentChildNodes, hasElementChildThatIsNotChild)) {
  49735. return false;
  49736. }
  49737. var docTypeNode = find(parentChildNodes, isDocTypeNode);
  49738. return !(child && docTypeNode && parentChildNodes.indexOf(docTypeNode) > parentChildNodes.indexOf(child));
  49739. }
  49740. function assertPreInsertionValidity1to5(parent, node, child) {
  49741. if (!hasValidParentNodeType(parent)) {
  49742. throw new DOMException(HIERARCHY_REQUEST_ERR, "Unexpected parent node type " + parent.nodeType);
  49743. }
  49744. if (child && child.parentNode !== parent) {
  49745. throw new DOMException(NOT_FOUND_ERR, "child not in parent");
  49746. }
  49747. if (!hasInsertableNodeType(node) || isDocTypeNode(node) && parent.nodeType !== Node.DOCUMENT_NODE) {
  49748. throw new DOMException(
  49749. HIERARCHY_REQUEST_ERR,
  49750. "Unexpected node type " + node.nodeType + " for parent node type " + parent.nodeType
  49751. );
  49752. }
  49753. }
  49754. function assertPreInsertionValidityInDocument(parent, node, child) {
  49755. var parentChildNodes = parent.childNodes || [];
  49756. var nodeChildNodes = node.childNodes || [];
  49757. if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
  49758. var nodeChildElements = nodeChildNodes.filter(isElementNode);
  49759. if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode$2)) {
  49760. throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
  49761. }
  49762. if (nodeChildElements.length === 1 && !isElementInsertionPossible(parent, child)) {
  49763. throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
  49764. }
  49765. }
  49766. if (isElementNode(node)) {
  49767. if (!isElementInsertionPossible(parent, child)) {
  49768. throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
  49769. }
  49770. }
  49771. if (isDocTypeNode(node)) {
  49772. if (find(parentChildNodes, isDocTypeNode)) {
  49773. throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
  49774. }
  49775. var parentElementChild = find(parentChildNodes, isElementNode);
  49776. if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
  49777. throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
  49778. }
  49779. if (!child && parentElementChild) {
  49780. throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can not be appended since element is present");
  49781. }
  49782. }
  49783. }
  49784. function assertPreReplacementValidityInDocument(parent, node, child) {
  49785. var parentChildNodes = parent.childNodes || [];
  49786. var nodeChildNodes = node.childNodes || [];
  49787. if (node.nodeType === Node.DOCUMENT_FRAGMENT_NODE) {
  49788. var nodeChildElements = nodeChildNodes.filter(isElementNode);
  49789. if (nodeChildElements.length > 1 || find(nodeChildNodes, isTextNode$2)) {
  49790. throw new DOMException(HIERARCHY_REQUEST_ERR, "More than one element or text in fragment");
  49791. }
  49792. if (nodeChildElements.length === 1 && !isElementReplacementPossible(parent, child)) {
  49793. throw new DOMException(HIERARCHY_REQUEST_ERR, "Element in fragment can not be inserted before doctype");
  49794. }
  49795. }
  49796. if (isElementNode(node)) {
  49797. if (!isElementReplacementPossible(parent, child)) {
  49798. throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one element can be added and only after doctype");
  49799. }
  49800. }
  49801. if (isDocTypeNode(node)) {
  49802. let hasDoctypeChildThatIsNotChild = function(node2) {
  49803. return isDocTypeNode(node2) && node2 !== child;
  49804. };
  49805. if (find(parentChildNodes, hasDoctypeChildThatIsNotChild)) {
  49806. throw new DOMException(HIERARCHY_REQUEST_ERR, "Only one doctype is allowed");
  49807. }
  49808. var parentElementChild = find(parentChildNodes, isElementNode);
  49809. if (child && parentChildNodes.indexOf(parentElementChild) < parentChildNodes.indexOf(child)) {
  49810. throw new DOMException(HIERARCHY_REQUEST_ERR, "Doctype can only be inserted before an element");
  49811. }
  49812. }
  49813. }
  49814. function _insertBefore(parent, node, child, _inDocumentAssertion) {
  49815. assertPreInsertionValidity1to5(parent, node, child);
  49816. if (parent.nodeType === Node.DOCUMENT_NODE) {
  49817. (_inDocumentAssertion || assertPreInsertionValidityInDocument)(parent, node, child);
  49818. }
  49819. var cp = node.parentNode;
  49820. if (cp) {
  49821. cp.removeChild(node);
  49822. }
  49823. if (node.nodeType === DOCUMENT_FRAGMENT_NODE) {
  49824. var newFirst = node.firstChild;
  49825. if (newFirst == null) {
  49826. return node;
  49827. }
  49828. var newLast = node.lastChild;
  49829. } else {
  49830. newFirst = newLast = node;
  49831. }
  49832. var pre = child ? child.previousSibling : parent.lastChild;
  49833. newFirst.previousSibling = pre;
  49834. newLast.nextSibling = child;
  49835. if (pre) {
  49836. pre.nextSibling = newFirst;
  49837. } else {
  49838. parent.firstChild = newFirst;
  49839. }
  49840. if (child == null) {
  49841. parent.lastChild = newLast;
  49842. } else {
  49843. child.previousSibling = newLast;
  49844. }
  49845. do {
  49846. newFirst.parentNode = parent;
  49847. } while (newFirst !== newLast && (newFirst = newFirst.nextSibling));
  49848. _onUpdateChild(parent.ownerDocument || parent, parent);
  49849. if (node.nodeType == DOCUMENT_FRAGMENT_NODE) {
  49850. node.firstChild = node.lastChild = null;
  49851. }
  49852. return node;
  49853. }
  49854. function _appendSingleChild(parentNode, newChild) {
  49855. if (newChild.parentNode) {
  49856. newChild.parentNode.removeChild(newChild);
  49857. }
  49858. newChild.parentNode = parentNode;
  49859. newChild.previousSibling = parentNode.lastChild;
  49860. newChild.nextSibling = null;
  49861. if (newChild.previousSibling) {
  49862. newChild.previousSibling.nextSibling = newChild;
  49863. } else {
  49864. parentNode.firstChild = newChild;
  49865. }
  49866. parentNode.lastChild = newChild;
  49867. _onUpdateChild(parentNode.ownerDocument, parentNode, newChild);
  49868. return newChild;
  49869. }
  49870. Document.prototype = {
  49871. nodeName: "#document",
  49872. nodeType: DOCUMENT_NODE,
  49873. doctype: null,
  49874. documentElement: null,
  49875. _inc: 1,
  49876. insertBefore: function(newChild, refChild) {
  49877. if (newChild.nodeType == DOCUMENT_FRAGMENT_NODE) {
  49878. var child = newChild.firstChild;
  49879. while (child) {
  49880. var next = child.nextSibling;
  49881. this.insertBefore(child, refChild);
  49882. child = next;
  49883. }
  49884. return newChild;
  49885. }
  49886. _insertBefore(this, newChild, refChild);
  49887. newChild.ownerDocument = this;
  49888. if (this.documentElement === null && newChild.nodeType === ELEMENT_NODE) {
  49889. this.documentElement = newChild;
  49890. }
  49891. return newChild;
  49892. },
  49893. removeChild: function(oldChild) {
  49894. if (this.documentElement == oldChild) {
  49895. this.documentElement = null;
  49896. }
  49897. return _removeChild(this, oldChild);
  49898. },
  49899. replaceChild: function(newChild, oldChild) {
  49900. _insertBefore(this, newChild, oldChild, assertPreReplacementValidityInDocument);
  49901. newChild.ownerDocument = this;
  49902. if (oldChild) {
  49903. this.removeChild(oldChild);
  49904. }
  49905. if (isElementNode(newChild)) {
  49906. this.documentElement = newChild;
  49907. }
  49908. },
  49909. importNode: function(importedNode, deep) {
  49910. return importNode(this, importedNode, deep);
  49911. },
  49912. getElementById: function(id) {
  49913. var rtv = null;
  49914. _visitNode(this.documentElement, function(node) {
  49915. if (node.nodeType == ELEMENT_NODE) {
  49916. if (node.getAttribute("id") == id) {
  49917. rtv = node;
  49918. return true;
  49919. }
  49920. }
  49921. });
  49922. return rtv;
  49923. },
  49924. getElementsByClassName: function(classNames) {
  49925. var classNamesSet = toOrderedSet(classNames);
  49926. return new LiveNodeList(this, function(base2) {
  49927. var ls = [];
  49928. if (classNamesSet.length > 0) {
  49929. _visitNode(base2.documentElement, function(node) {
  49930. if (node !== base2 && node.nodeType === ELEMENT_NODE) {
  49931. var nodeClassNames = node.getAttribute("class");
  49932. if (nodeClassNames) {
  49933. var matches = classNames === nodeClassNames;
  49934. if (!matches) {
  49935. var nodeClassNamesSet = toOrderedSet(nodeClassNames);
  49936. matches = classNamesSet.every(arrayIncludes(nodeClassNamesSet));
  49937. }
  49938. if (matches) {
  49939. ls.push(node);
  49940. }
  49941. }
  49942. }
  49943. });
  49944. }
  49945. return ls;
  49946. });
  49947. },
  49948. createElement: function(tagName) {
  49949. var node = new Element$1();
  49950. node.ownerDocument = this;
  49951. node.nodeName = tagName;
  49952. node.tagName = tagName;
  49953. node.localName = tagName;
  49954. node.childNodes = new NodeList();
  49955. var attrs = node.attributes = new NamedNodeMap();
  49956. attrs._ownerElement = node;
  49957. return node;
  49958. },
  49959. createDocumentFragment: function() {
  49960. var node = new DocumentFragment();
  49961. node.ownerDocument = this;
  49962. node.childNodes = new NodeList();
  49963. return node;
  49964. },
  49965. createTextNode: function(data) {
  49966. var node = new Text();
  49967. node.ownerDocument = this;
  49968. node.appendData(data);
  49969. return node;
  49970. },
  49971. createComment: function(data) {
  49972. var node = new Comment();
  49973. node.ownerDocument = this;
  49974. node.appendData(data);
  49975. return node;
  49976. },
  49977. createCDATASection: function(data) {
  49978. var node = new CDATASection();
  49979. node.ownerDocument = this;
  49980. node.appendData(data);
  49981. return node;
  49982. },
  49983. createProcessingInstruction: function(target, data) {
  49984. var node = new ProcessingInstruction();
  49985. node.ownerDocument = this;
  49986. node.tagName = node.target = target;
  49987. node.nodeValue = node.data = data;
  49988. return node;
  49989. },
  49990. createAttribute: function(name) {
  49991. var node = new Attr();
  49992. node.ownerDocument = this;
  49993. node.name = name;
  49994. node.nodeName = name;
  49995. node.localName = name;
  49996. node.specified = true;
  49997. return node;
  49998. },
  49999. createEntityReference: function(name) {
  50000. var node = new EntityReference();
  50001. node.ownerDocument = this;
  50002. node.nodeName = name;
  50003. return node;
  50004. },
  50005. createElementNS: function(namespaceURI, qualifiedName) {
  50006. var node = new Element$1();
  50007. var pl = qualifiedName.split(":");
  50008. var attrs = node.attributes = new NamedNodeMap();
  50009. node.childNodes = new NodeList();
  50010. node.ownerDocument = this;
  50011. node.nodeName = qualifiedName;
  50012. node.tagName = qualifiedName;
  50013. node.namespaceURI = namespaceURI;
  50014. if (pl.length == 2) {
  50015. node.prefix = pl[0];
  50016. node.localName = pl[1];
  50017. } else {
  50018. node.localName = qualifiedName;
  50019. }
  50020. attrs._ownerElement = node;
  50021. return node;
  50022. },
  50023. createAttributeNS: function(namespaceURI, qualifiedName) {
  50024. var node = new Attr();
  50025. var pl = qualifiedName.split(":");
  50026. node.ownerDocument = this;
  50027. node.nodeName = qualifiedName;
  50028. node.name = qualifiedName;
  50029. node.namespaceURI = namespaceURI;
  50030. node.specified = true;
  50031. if (pl.length == 2) {
  50032. node.prefix = pl[0];
  50033. node.localName = pl[1];
  50034. } else {
  50035. node.localName = qualifiedName;
  50036. }
  50037. return node;
  50038. }
  50039. };
  50040. _extends(Document, Node);
  50041. function Element$1() {
  50042. this._nsMap = {};
  50043. }
  50044. Element$1.prototype = {
  50045. nodeType: ELEMENT_NODE,
  50046. hasAttribute: function(name) {
  50047. return this.getAttributeNode(name) != null;
  50048. },
  50049. getAttribute: function(name) {
  50050. var attr = this.getAttributeNode(name);
  50051. return attr && attr.value || "";
  50052. },
  50053. getAttributeNode: function(name) {
  50054. return this.attributes.getNamedItem(name);
  50055. },
  50056. setAttribute: function(name, value) {
  50057. var attr = this.ownerDocument.createAttribute(name);
  50058. attr.value = attr.nodeValue = "" + value;
  50059. this.setAttributeNode(attr);
  50060. },
  50061. removeAttribute: function(name) {
  50062. var attr = this.getAttributeNode(name);
  50063. attr && this.removeAttributeNode(attr);
  50064. },
  50065. appendChild: function(newChild) {
  50066. if (newChild.nodeType === DOCUMENT_FRAGMENT_NODE) {
  50067. return this.insertBefore(newChild, null);
  50068. } else {
  50069. return _appendSingleChild(this, newChild);
  50070. }
  50071. },
  50072. setAttributeNode: function(newAttr) {
  50073. return this.attributes.setNamedItem(newAttr);
  50074. },
  50075. setAttributeNodeNS: function(newAttr) {
  50076. return this.attributes.setNamedItemNS(newAttr);
  50077. },
  50078. removeAttributeNode: function(oldAttr) {
  50079. return this.attributes.removeNamedItem(oldAttr.nodeName);
  50080. },
  50081. removeAttributeNS: function(namespaceURI, localName) {
  50082. var old = this.getAttributeNodeNS(namespaceURI, localName);
  50083. old && this.removeAttributeNode(old);
  50084. },
  50085. hasAttributeNS: function(namespaceURI, localName) {
  50086. return this.getAttributeNodeNS(namespaceURI, localName) != null;
  50087. },
  50088. getAttributeNS: function(namespaceURI, localName) {
  50089. var attr = this.getAttributeNodeNS(namespaceURI, localName);
  50090. return attr && attr.value || "";
  50091. },
  50092. setAttributeNS: function(namespaceURI, qualifiedName, value) {
  50093. var attr = this.ownerDocument.createAttributeNS(namespaceURI, qualifiedName);
  50094. attr.value = attr.nodeValue = "" + value;
  50095. this.setAttributeNode(attr);
  50096. },
  50097. getAttributeNodeNS: function(namespaceURI, localName) {
  50098. return this.attributes.getNamedItemNS(namespaceURI, localName);
  50099. },
  50100. getElementsByTagName: function(tagName) {
  50101. return new LiveNodeList(this, function(base2) {
  50102. var ls = [];
  50103. _visitNode(base2, function(node) {
  50104. if (node !== base2 && node.nodeType == ELEMENT_NODE && (tagName === "*" || node.tagName == tagName)) {
  50105. ls.push(node);
  50106. }
  50107. });
  50108. return ls;
  50109. });
  50110. },
  50111. getElementsByTagNameNS: function(namespaceURI, localName) {
  50112. return new LiveNodeList(this, function(base2) {
  50113. var ls = [];
  50114. _visitNode(base2, function(node) {
  50115. if (node !== base2 && node.nodeType === ELEMENT_NODE && (namespaceURI === "*" || node.namespaceURI === namespaceURI) && (localName === "*" || node.localName == localName)) {
  50116. ls.push(node);
  50117. }
  50118. });
  50119. return ls;
  50120. });
  50121. }
  50122. };
  50123. Document.prototype.getElementsByTagName = Element$1.prototype.getElementsByTagName;
  50124. Document.prototype.getElementsByTagNameNS = Element$1.prototype.getElementsByTagNameNS;
  50125. _extends(Element$1, Node);
  50126. function Attr() {
  50127. }
  50128. Attr.prototype.nodeType = ATTRIBUTE_NODE;
  50129. _extends(Attr, Node);
  50130. function CharacterData() {
  50131. }
  50132. CharacterData.prototype = {
  50133. data: "",
  50134. substringData: function(offset, count) {
  50135. return this.data.substring(offset, offset + count);
  50136. },
  50137. appendData: function(text) {
  50138. text = this.data + text;
  50139. this.nodeValue = this.data = text;
  50140. this.length = text.length;
  50141. },
  50142. insertData: function(offset, text) {
  50143. this.replaceData(offset, 0, text);
  50144. },
  50145. appendChild: function(newChild) {
  50146. throw new Error(ExceptionMessage[HIERARCHY_REQUEST_ERR]);
  50147. },
  50148. deleteData: function(offset, count) {
  50149. this.replaceData(offset, count, "");
  50150. },
  50151. replaceData: function(offset, count, text) {
  50152. var start2 = this.data.substring(0, offset);
  50153. var end = this.data.substring(offset + count);
  50154. text = start2 + text + end;
  50155. this.nodeValue = this.data = text;
  50156. this.length = text.length;
  50157. }
  50158. };
  50159. _extends(CharacterData, Node);
  50160. function Text() {
  50161. }
  50162. Text.prototype = {
  50163. nodeName: "#text",
  50164. nodeType: TEXT_NODE,
  50165. splitText: function(offset) {
  50166. var text = this.data;
  50167. var newText = text.substring(offset);
  50168. text = text.substring(0, offset);
  50169. this.data = this.nodeValue = text;
  50170. this.length = text.length;
  50171. var newNode = this.ownerDocument.createTextNode(newText);
  50172. if (this.parentNode) {
  50173. this.parentNode.insertBefore(newNode, this.nextSibling);
  50174. }
  50175. return newNode;
  50176. }
  50177. };
  50178. _extends(Text, CharacterData);
  50179. function Comment() {
  50180. }
  50181. Comment.prototype = {
  50182. nodeName: "#comment",
  50183. nodeType: COMMENT_NODE
  50184. };
  50185. _extends(Comment, CharacterData);
  50186. function CDATASection() {
  50187. }
  50188. CDATASection.prototype = {
  50189. nodeName: "#cdata-section",
  50190. nodeType: CDATA_SECTION_NODE
  50191. };
  50192. _extends(CDATASection, CharacterData);
  50193. function DocumentType() {
  50194. }
  50195. DocumentType.prototype.nodeType = DOCUMENT_TYPE_NODE;
  50196. _extends(DocumentType, Node);
  50197. function Notation() {
  50198. }
  50199. Notation.prototype.nodeType = NOTATION_NODE;
  50200. _extends(Notation, Node);
  50201. function Entity() {
  50202. }
  50203. Entity.prototype.nodeType = ENTITY_NODE;
  50204. _extends(Entity, Node);
  50205. function EntityReference() {
  50206. }
  50207. EntityReference.prototype.nodeType = ENTITY_REFERENCE_NODE;
  50208. _extends(EntityReference, Node);
  50209. function DocumentFragment() {
  50210. }
  50211. DocumentFragment.prototype.nodeName = "#document-fragment";
  50212. DocumentFragment.prototype.nodeType = DOCUMENT_FRAGMENT_NODE;
  50213. _extends(DocumentFragment, Node);
  50214. function ProcessingInstruction() {
  50215. }
  50216. ProcessingInstruction.prototype.nodeType = PROCESSING_INSTRUCTION_NODE;
  50217. _extends(ProcessingInstruction, Node);
  50218. function XMLSerializer() {
  50219. }
  50220. XMLSerializer.prototype.serializeToString = function(node, isHtml, nodeFilter) {
  50221. return nodeSerializeToString.call(node, isHtml, nodeFilter);
  50222. };
  50223. Node.prototype.toString = nodeSerializeToString;
  50224. function nodeSerializeToString(isHtml, nodeFilter) {
  50225. var buf = [];
  50226. var refNode = this.nodeType == 9 && this.documentElement || this;
  50227. var prefix = refNode.prefix;
  50228. var uri = refNode.namespaceURI;
  50229. if (uri && prefix == null) {
  50230. var prefix = refNode.lookupPrefix(uri);
  50231. if (prefix == null) {
  50232. var visibleNamespaces = [
  50233. { namespace: uri, prefix: null }
  50234. ];
  50235. }
  50236. }
  50237. serializeToString(this, buf, isHtml, nodeFilter, visibleNamespaces);
  50238. return buf.join("");
  50239. }
  50240. function needNamespaceDefine(node, isHTML, visibleNamespaces) {
  50241. var prefix = node.prefix || "";
  50242. var uri = node.namespaceURI;
  50243. if (!uri) {
  50244. return false;
  50245. }
  50246. if (prefix === "xml" && uri === NAMESPACE$2.XML || uri === NAMESPACE$2.XMLNS) {
  50247. return false;
  50248. }
  50249. var i2 = visibleNamespaces.length;
  50250. while (i2--) {
  50251. var ns = visibleNamespaces[i2];
  50252. if (ns.prefix === prefix) {
  50253. return ns.namespace !== uri;
  50254. }
  50255. }
  50256. return true;
  50257. }
  50258. function addSerializedAttribute(buf, qualifiedName, value) {
  50259. buf.push(" ", qualifiedName, '="', value.replace(/[<>&"\t\n\r]/g, _xmlEncoder), '"');
  50260. }
  50261. function serializeToString(node, buf, isHTML, nodeFilter, visibleNamespaces) {
  50262. if (!visibleNamespaces) {
  50263. visibleNamespaces = [];
  50264. }
  50265. if (nodeFilter) {
  50266. node = nodeFilter(node);
  50267. if (node) {
  50268. if (typeof node == "string") {
  50269. buf.push(node);
  50270. return;
  50271. }
  50272. } else {
  50273. return;
  50274. }
  50275. }
  50276. switch (node.nodeType) {
  50277. case ELEMENT_NODE:
  50278. var attrs = node.attributes;
  50279. var len = attrs.length;
  50280. var child = node.firstChild;
  50281. var nodeName = node.tagName;
  50282. isHTML = NAMESPACE$2.isHTML(node.namespaceURI) || isHTML;
  50283. var prefixedNodeName = nodeName;
  50284. if (!isHTML && !node.prefix && node.namespaceURI) {
  50285. var defaultNS;
  50286. for (var ai = 0; ai < attrs.length; ai++) {
  50287. if (attrs.item(ai).name === "xmlns") {
  50288. defaultNS = attrs.item(ai).value;
  50289. break;
  50290. }
  50291. }
  50292. if (!defaultNS) {
  50293. for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
  50294. var namespace = visibleNamespaces[nsi];
  50295. if (namespace.prefix === "" && namespace.namespace === node.namespaceURI) {
  50296. defaultNS = namespace.namespace;
  50297. break;
  50298. }
  50299. }
  50300. }
  50301. if (defaultNS !== node.namespaceURI) {
  50302. for (var nsi = visibleNamespaces.length - 1; nsi >= 0; nsi--) {
  50303. var namespace = visibleNamespaces[nsi];
  50304. if (namespace.namespace === node.namespaceURI) {
  50305. if (namespace.prefix) {
  50306. prefixedNodeName = namespace.prefix + ":" + nodeName;
  50307. }
  50308. break;
  50309. }
  50310. }
  50311. }
  50312. }
  50313. buf.push("<", prefixedNodeName);
  50314. for (var i2 = 0; i2 < len; i2++) {
  50315. var attr = attrs.item(i2);
  50316. if (attr.prefix == "xmlns") {
  50317. visibleNamespaces.push({ prefix: attr.localName, namespace: attr.value });
  50318. } else if (attr.nodeName == "xmlns") {
  50319. visibleNamespaces.push({ prefix: "", namespace: attr.value });
  50320. }
  50321. }
  50322. for (var i2 = 0; i2 < len; i2++) {
  50323. var attr = attrs.item(i2);
  50324. if (needNamespaceDefine(attr, isHTML, visibleNamespaces)) {
  50325. var prefix = attr.prefix || "";
  50326. var uri = attr.namespaceURI;
  50327. addSerializedAttribute(buf, prefix ? "xmlns:" + prefix : "xmlns", uri);
  50328. visibleNamespaces.push({ prefix, namespace: uri });
  50329. }
  50330. serializeToString(attr, buf, isHTML, nodeFilter, visibleNamespaces);
  50331. }
  50332. if (nodeName === prefixedNodeName && needNamespaceDefine(node, isHTML, visibleNamespaces)) {
  50333. var prefix = node.prefix || "";
  50334. var uri = node.namespaceURI;
  50335. addSerializedAttribute(buf, prefix ? "xmlns:" + prefix : "xmlns", uri);
  50336. visibleNamespaces.push({ prefix, namespace: uri });
  50337. }
  50338. if (child || isHTML && !/^(?:meta|link|img|br|hr|input)$/i.test(nodeName)) {
  50339. buf.push(">");
  50340. if (isHTML && /^script$/i.test(nodeName)) {
  50341. while (child) {
  50342. if (child.data) {
  50343. buf.push(child.data);
  50344. } else {
  50345. serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
  50346. }
  50347. child = child.nextSibling;
  50348. }
  50349. } else {
  50350. while (child) {
  50351. serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
  50352. child = child.nextSibling;
  50353. }
  50354. }
  50355. buf.push("</", prefixedNodeName, ">");
  50356. } else {
  50357. buf.push("/>");
  50358. }
  50359. return;
  50360. case DOCUMENT_NODE:
  50361. case DOCUMENT_FRAGMENT_NODE:
  50362. var child = node.firstChild;
  50363. while (child) {
  50364. serializeToString(child, buf, isHTML, nodeFilter, visibleNamespaces.slice());
  50365. child = child.nextSibling;
  50366. }
  50367. return;
  50368. case ATTRIBUTE_NODE:
  50369. return addSerializedAttribute(buf, node.name, node.value);
  50370. case TEXT_NODE:
  50371. return buf.push(
  50372. node.data.replace(/[<&>]/g, _xmlEncoder)
  50373. );
  50374. case CDATA_SECTION_NODE:
  50375. return buf.push("<![CDATA[", node.data, "]]>");
  50376. case COMMENT_NODE:
  50377. return buf.push("<!--", node.data, "-->");
  50378. case DOCUMENT_TYPE_NODE:
  50379. var pubid = node.publicId;
  50380. var sysid = node.systemId;
  50381. buf.push("<!DOCTYPE ", node.name);
  50382. if (pubid) {
  50383. buf.push(" PUBLIC ", pubid);
  50384. if (sysid && sysid != ".") {
  50385. buf.push(" ", sysid);
  50386. }
  50387. buf.push(">");
  50388. } else if (sysid && sysid != ".") {
  50389. buf.push(" SYSTEM ", sysid, ">");
  50390. } else {
  50391. var sub = node.internalSubset;
  50392. if (sub) {
  50393. buf.push(" [", sub, "]");
  50394. }
  50395. buf.push(">");
  50396. }
  50397. return;
  50398. case PROCESSING_INSTRUCTION_NODE:
  50399. return buf.push("<?", node.target, " ", node.data, "?>");
  50400. case ENTITY_REFERENCE_NODE:
  50401. return buf.push("&", node.nodeName, ";");
  50402. default:
  50403. buf.push("??", node.nodeName);
  50404. }
  50405. }
  50406. function importNode(doc, node, deep) {
  50407. var node2;
  50408. switch (node.nodeType) {
  50409. case ELEMENT_NODE:
  50410. node2 = node.cloneNode(false);
  50411. node2.ownerDocument = doc;
  50412. case DOCUMENT_FRAGMENT_NODE:
  50413. break;
  50414. case ATTRIBUTE_NODE:
  50415. deep = true;
  50416. break;
  50417. }
  50418. if (!node2) {
  50419. node2 = node.cloneNode(false);
  50420. }
  50421. node2.ownerDocument = doc;
  50422. node2.parentNode = null;
  50423. if (deep) {
  50424. var child = node.firstChild;
  50425. while (child) {
  50426. node2.appendChild(importNode(doc, child, deep));
  50427. child = child.nextSibling;
  50428. }
  50429. }
  50430. return node2;
  50431. }
  50432. function cloneNode(doc, node, deep) {
  50433. var node2 = new node.constructor();
  50434. for (var n in node) {
  50435. if (Object.prototype.hasOwnProperty.call(node, n)) {
  50436. var v = node[n];
  50437. if (typeof v != "object") {
  50438. if (v != node2[n]) {
  50439. node2[n] = v;
  50440. }
  50441. }
  50442. }
  50443. }
  50444. if (node.childNodes) {
  50445. node2.childNodes = new NodeList();
  50446. }
  50447. node2.ownerDocument = doc;
  50448. switch (node2.nodeType) {
  50449. case ELEMENT_NODE:
  50450. var attrs = node.attributes;
  50451. var attrs2 = node2.attributes = new NamedNodeMap();
  50452. var len = attrs.length;
  50453. attrs2._ownerElement = node2;
  50454. for (var i2 = 0; i2 < len; i2++) {
  50455. node2.setAttributeNode(cloneNode(doc, attrs.item(i2), true));
  50456. }
  50457. break;
  50458. case ATTRIBUTE_NODE:
  50459. deep = true;
  50460. }
  50461. if (deep) {
  50462. var child = node.firstChild;
  50463. while (child) {
  50464. node2.appendChild(cloneNode(doc, child, deep));
  50465. child = child.nextSibling;
  50466. }
  50467. }
  50468. return node2;
  50469. }
  50470. function __set__(object, key, value) {
  50471. object[key] = value;
  50472. }
  50473. try {
  50474. if (Object.defineProperty) {
  50475. let getTextContent = function(node) {
  50476. switch (node.nodeType) {
  50477. case ELEMENT_NODE:
  50478. case DOCUMENT_FRAGMENT_NODE:
  50479. var buf = [];
  50480. node = node.firstChild;
  50481. while (node) {
  50482. if (node.nodeType !== 7 && node.nodeType !== 8) {
  50483. buf.push(getTextContent(node));
  50484. }
  50485. node = node.nextSibling;
  50486. }
  50487. return buf.join("");
  50488. default:
  50489. return node.nodeValue;
  50490. }
  50491. };
  50492. Object.defineProperty(LiveNodeList.prototype, "length", {
  50493. get: function() {
  50494. _updateLiveList(this);
  50495. return this.$$length;
  50496. }
  50497. });
  50498. Object.defineProperty(Node.prototype, "textContent", {
  50499. get: function() {
  50500. return getTextContent(this);
  50501. },
  50502. set: function(data) {
  50503. switch (this.nodeType) {
  50504. case ELEMENT_NODE:
  50505. case DOCUMENT_FRAGMENT_NODE:
  50506. while (this.firstChild) {
  50507. this.removeChild(this.firstChild);
  50508. }
  50509. if (data || String(data)) {
  50510. this.appendChild(this.ownerDocument.createTextNode(data));
  50511. }
  50512. break;
  50513. default:
  50514. this.data = data;
  50515. this.value = data;
  50516. this.nodeValue = data;
  50517. }
  50518. }
  50519. });
  50520. __set__ = function(object, key, value) {
  50521. object["$$" + key] = value;
  50522. };
  50523. }
  50524. } catch (e) {
  50525. }
  50526. dom$1.DocumentType = DocumentType;
  50527. dom$1.DOMException = DOMException;
  50528. dom$1.DOMImplementation = DOMImplementation$1;
  50529. dom$1.Element = Element$1;
  50530. dom$1.Node = Node;
  50531. dom$1.NodeList = NodeList;
  50532. dom$1.XMLSerializer = XMLSerializer;
  50533. var domParser = {};
  50534. var entities$1 = {};
  50535. (function(exports2) {
  50536. var freeze2 = conventions$2.freeze;
  50537. exports2.XML_ENTITIES = freeze2({ amp: "&", apos: "'", gt: ">", lt: "<", quot: '"' });
  50538. exports2.HTML_ENTITIES = freeze2({
  50539. lt: "<",
  50540. gt: ">",
  50541. amp: "&",
  50542. quot: '"',
  50543. apos: "'",
  50544. Agrave: "\xC0",
  50545. Aacute: "\xC1",
  50546. Acirc: "\xC2",
  50547. Atilde: "\xC3",
  50548. Auml: "\xC4",
  50549. Aring: "\xC5",
  50550. AElig: "\xC6",
  50551. Ccedil: "\xC7",
  50552. Egrave: "\xC8",
  50553. Eacute: "\xC9",
  50554. Ecirc: "\xCA",
  50555. Euml: "\xCB",
  50556. Igrave: "\xCC",
  50557. Iacute: "\xCD",
  50558. Icirc: "\xCE",
  50559. Iuml: "\xCF",
  50560. ETH: "\xD0",
  50561. Ntilde: "\xD1",
  50562. Ograve: "\xD2",
  50563. Oacute: "\xD3",
  50564. Ocirc: "\xD4",
  50565. Otilde: "\xD5",
  50566. Ouml: "\xD6",
  50567. Oslash: "\xD8",
  50568. Ugrave: "\xD9",
  50569. Uacute: "\xDA",
  50570. Ucirc: "\xDB",
  50571. Uuml: "\xDC",
  50572. Yacute: "\xDD",
  50573. THORN: "\xDE",
  50574. szlig: "\xDF",
  50575. agrave: "\xE0",
  50576. aacute: "\xE1",
  50577. acirc: "\xE2",
  50578. atilde: "\xE3",
  50579. auml: "\xE4",
  50580. aring: "\xE5",
  50581. aelig: "\xE6",
  50582. ccedil: "\xE7",
  50583. egrave: "\xE8",
  50584. eacute: "\xE9",
  50585. ecirc: "\xEA",
  50586. euml: "\xEB",
  50587. igrave: "\xEC",
  50588. iacute: "\xED",
  50589. icirc: "\xEE",
  50590. iuml: "\xEF",
  50591. eth: "\xF0",
  50592. ntilde: "\xF1",
  50593. ograve: "\xF2",
  50594. oacute: "\xF3",
  50595. ocirc: "\xF4",
  50596. otilde: "\xF5",
  50597. ouml: "\xF6",
  50598. oslash: "\xF8",
  50599. ugrave: "\xF9",
  50600. uacute: "\xFA",
  50601. ucirc: "\xFB",
  50602. uuml: "\xFC",
  50603. yacute: "\xFD",
  50604. thorn: "\xFE",
  50605. yuml: "\xFF",
  50606. nbsp: "\xA0",
  50607. iexcl: "\xA1",
  50608. cent: "\xA2",
  50609. pound: "\xA3",
  50610. curren: "\xA4",
  50611. yen: "\xA5",
  50612. brvbar: "\xA6",
  50613. sect: "\xA7",
  50614. uml: "\xA8",
  50615. copy: "\xA9",
  50616. ordf: "\xAA",
  50617. laquo: "\xAB",
  50618. not: "\xAC",
  50619. shy: "\xAD\xAD",
  50620. reg: "\xAE",
  50621. macr: "\xAF",
  50622. deg: "\xB0",
  50623. plusmn: "\xB1",
  50624. sup2: "\xB2",
  50625. sup3: "\xB3",
  50626. acute: "\xB4",
  50627. micro: "\xB5",
  50628. para: "\xB6",
  50629. middot: "\xB7",
  50630. cedil: "\xB8",
  50631. sup1: "\xB9",
  50632. ordm: "\xBA",
  50633. raquo: "\xBB",
  50634. frac14: "\xBC",
  50635. frac12: "\xBD",
  50636. frac34: "\xBE",
  50637. iquest: "\xBF",
  50638. times: "\xD7",
  50639. divide: "\xF7",
  50640. forall: "\u2200",
  50641. part: "\u2202",
  50642. exist: "\u2203",
  50643. empty: "\u2205",
  50644. nabla: "\u2207",
  50645. isin: "\u2208",
  50646. notin: "\u2209",
  50647. ni: "\u220B",
  50648. prod: "\u220F",
  50649. sum: "\u2211",
  50650. minus: "\u2212",
  50651. lowast: "\u2217",
  50652. radic: "\u221A",
  50653. prop: "\u221D",
  50654. infin: "\u221E",
  50655. ang: "\u2220",
  50656. and: "\u2227",
  50657. or: "\u2228",
  50658. cap: "\u2229",
  50659. cup: "\u222A",
  50660. "int": "\u222B",
  50661. there4: "\u2234",
  50662. sim: "\u223C",
  50663. cong: "\u2245",
  50664. asymp: "\u2248",
  50665. ne: "\u2260",
  50666. equiv: "\u2261",
  50667. le: "\u2264",
  50668. ge: "\u2265",
  50669. sub: "\u2282",
  50670. sup: "\u2283",
  50671. nsub: "\u2284",
  50672. sube: "\u2286",
  50673. supe: "\u2287",
  50674. oplus: "\u2295",
  50675. otimes: "\u2297",
  50676. perp: "\u22A5",
  50677. sdot: "\u22C5",
  50678. Alpha: "\u0391",
  50679. Beta: "\u0392",
  50680. Gamma: "\u0393",
  50681. Delta: "\u0394",
  50682. Epsilon: "\u0395",
  50683. Zeta: "\u0396",
  50684. Eta: "\u0397",
  50685. Theta: "\u0398",
  50686. Iota: "\u0399",
  50687. Kappa: "\u039A",
  50688. Lambda: "\u039B",
  50689. Mu: "\u039C",
  50690. Nu: "\u039D",
  50691. Xi: "\u039E",
  50692. Omicron: "\u039F",
  50693. Pi: "\u03A0",
  50694. Rho: "\u03A1",
  50695. Sigma: "\u03A3",
  50696. Tau: "\u03A4",
  50697. Upsilon: "\u03A5",
  50698. Phi: "\u03A6",
  50699. Chi: "\u03A7",
  50700. Psi: "\u03A8",
  50701. Omega: "\u03A9",
  50702. alpha: "\u03B1",
  50703. beta: "\u03B2",
  50704. gamma: "\u03B3",
  50705. delta: "\u03B4",
  50706. epsilon: "\u03B5",
  50707. zeta: "\u03B6",
  50708. eta: "\u03B7",
  50709. theta: "\u03B8",
  50710. iota: "\u03B9",
  50711. kappa: "\u03BA",
  50712. lambda: "\u03BB",
  50713. mu: "\u03BC",
  50714. nu: "\u03BD",
  50715. xi: "\u03BE",
  50716. omicron: "\u03BF",
  50717. pi: "\u03C0",
  50718. rho: "\u03C1",
  50719. sigmaf: "\u03C2",
  50720. sigma: "\u03C3",
  50721. tau: "\u03C4",
  50722. upsilon: "\u03C5",
  50723. phi: "\u03C6",
  50724. chi: "\u03C7",
  50725. psi: "\u03C8",
  50726. omega: "\u03C9",
  50727. thetasym: "\u03D1",
  50728. upsih: "\u03D2",
  50729. piv: "\u03D6",
  50730. OElig: "\u0152",
  50731. oelig: "\u0153",
  50732. Scaron: "\u0160",
  50733. scaron: "\u0161",
  50734. Yuml: "\u0178",
  50735. fnof: "\u0192",
  50736. circ: "\u02C6",
  50737. tilde: "\u02DC",
  50738. ensp: "\u2002",
  50739. emsp: "\u2003",
  50740. thinsp: "\u2009",
  50741. zwnj: "\u200C",
  50742. zwj: "\u200D",
  50743. lrm: "\u200E",
  50744. rlm: "\u200F",
  50745. ndash: "\u2013",
  50746. mdash: "\u2014",
  50747. lsquo: "\u2018",
  50748. rsquo: "\u2019",
  50749. sbquo: "\u201A",
  50750. ldquo: "\u201C",
  50751. rdquo: "\u201D",
  50752. bdquo: "\u201E",
  50753. dagger: "\u2020",
  50754. Dagger: "\u2021",
  50755. bull: "\u2022",
  50756. hellip: "\u2026",
  50757. permil: "\u2030",
  50758. prime: "\u2032",
  50759. Prime: "\u2033",
  50760. lsaquo: "\u2039",
  50761. rsaquo: "\u203A",
  50762. oline: "\u203E",
  50763. euro: "\u20AC",
  50764. trade: "\u2122",
  50765. larr: "\u2190",
  50766. uarr: "\u2191",
  50767. rarr: "\u2192",
  50768. darr: "\u2193",
  50769. harr: "\u2194",
  50770. crarr: "\u21B5",
  50771. lceil: "\u2308",
  50772. rceil: "\u2309",
  50773. lfloor: "\u230A",
  50774. rfloor: "\u230B",
  50775. loz: "\u25CA",
  50776. spades: "\u2660",
  50777. clubs: "\u2663",
  50778. hearts: "\u2665",
  50779. diams: "\u2666"
  50780. });
  50781. exports2.entityMap = exports2.HTML_ENTITIES;
  50782. })(entities$1);
  50783. var sax$1 = {};
  50784. var NAMESPACE$1 = conventions$2.NAMESPACE;
  50785. var nameStartChar = /[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/;
  50786. var nameChar = new RegExp("[\\-\\.0-9" + nameStartChar.source.slice(1, -1) + "\\u00B7\\u0300-\\u036F\\u203F-\\u2040]");
  50787. var tagNamePattern = new RegExp("^" + nameStartChar.source + nameChar.source + "*(?::" + nameStartChar.source + nameChar.source + "*)?$");
  50788. var S_TAG = 0;
  50789. var S_ATTR = 1;
  50790. var S_ATTR_SPACE = 2;
  50791. var S_EQ = 3;
  50792. var S_ATTR_NOQUOT_VALUE = 4;
  50793. var S_ATTR_END = 5;
  50794. var S_TAG_SPACE = 6;
  50795. var S_TAG_CLOSE = 7;
  50796. function ParseError$1(message, locator) {
  50797. this.message = message;
  50798. this.locator = locator;
  50799. if (Error.captureStackTrace)
  50800. Error.captureStackTrace(this, ParseError$1);
  50801. }
  50802. ParseError$1.prototype = new Error();
  50803. ParseError$1.prototype.name = ParseError$1.name;
  50804. function XMLReader$1() {
  50805. }
  50806. XMLReader$1.prototype = {
  50807. parse: function(source, defaultNSMap, entityMap) {
  50808. var domBuilder = this.domBuilder;
  50809. domBuilder.startDocument();
  50810. _copy(defaultNSMap, defaultNSMap = {});
  50811. parse$2(
  50812. source,
  50813. defaultNSMap,
  50814. entityMap,
  50815. domBuilder,
  50816. this.errorHandler
  50817. );
  50818. domBuilder.endDocument();
  50819. }
  50820. };
  50821. function parse$2(source, defaultNSMapCopy, entityMap, domBuilder, errorHandler) {
  50822. function fixedFromCharCode(code) {
  50823. if (code > 65535) {
  50824. code -= 65536;
  50825. var surrogate1 = 55296 + (code >> 10), surrogate2 = 56320 + (code & 1023);
  50826. return String.fromCharCode(surrogate1, surrogate2);
  50827. } else {
  50828. return String.fromCharCode(code);
  50829. }
  50830. }
  50831. function entityReplacer(a2) {
  50832. var k = a2.slice(1, -1);
  50833. if (Object.hasOwnProperty.call(entityMap, k)) {
  50834. return entityMap[k];
  50835. } else if (k.charAt(0) === "#") {
  50836. return fixedFromCharCode(parseInt(k.substr(1).replace("x", "0x")));
  50837. } else {
  50838. errorHandler.error("entity not found:" + a2);
  50839. return a2;
  50840. }
  50841. }
  50842. function appendText(end2) {
  50843. if (end2 > start2) {
  50844. var xt2 = source.substring(start2, end2).replace(/&#?\w+;/g, entityReplacer);
  50845. locator && position2(start2);
  50846. domBuilder.characters(xt2, 0, end2 - start2);
  50847. start2 = end2;
  50848. }
  50849. }
  50850. function position2(p, m) {
  50851. while (p >= lineEnd && (m = linePattern.exec(source))) {
  50852. lineStart = m.index;
  50853. lineEnd = lineStart + m[0].length;
  50854. locator.lineNumber++;
  50855. }
  50856. locator.columnNumber = p - lineStart + 1;
  50857. }
  50858. var lineStart = 0;
  50859. var lineEnd = 0;
  50860. var linePattern = /.*(?:\r\n?|\n)|.*$/g;
  50861. var locator = domBuilder.locator;
  50862. var parseStack = [{ currentNSMap: defaultNSMapCopy }];
  50863. var closeMap = {};
  50864. var start2 = 0;
  50865. while (true) {
  50866. try {
  50867. var tagStart = source.indexOf("<", start2);
  50868. if (tagStart < 0) {
  50869. if (!source.substr(start2).match(/^\s*$/)) {
  50870. var doc = domBuilder.doc;
  50871. var text = doc.createTextNode(source.substr(start2));
  50872. doc.appendChild(text);
  50873. domBuilder.currentElement = text;
  50874. }
  50875. return;
  50876. }
  50877. if (tagStart > start2) {
  50878. appendText(tagStart);
  50879. }
  50880. switch (source.charAt(tagStart + 1)) {
  50881. case "/":
  50882. var end = source.indexOf(">", tagStart + 3);
  50883. var tagName = source.substring(tagStart + 2, end).replace(/[ \t\n\r]+$/g, "");
  50884. var config = parseStack.pop();
  50885. if (end < 0) {
  50886. tagName = source.substring(tagStart + 2).replace(/[\s<].*/, "");
  50887. errorHandler.error("end tag name: " + tagName + " is not complete:" + config.tagName);
  50888. end = tagStart + 1 + tagName.length;
  50889. } else if (tagName.match(/\s</)) {
  50890. tagName = tagName.replace(/[\s<].*/, "");
  50891. errorHandler.error("end tag name: " + tagName + " maybe not complete");
  50892. end = tagStart + 1 + tagName.length;
  50893. }
  50894. var localNSMap = config.localNSMap;
  50895. var endMatch = config.tagName == tagName;
  50896. var endIgnoreCaseMach = endMatch || config.tagName && config.tagName.toLowerCase() == tagName.toLowerCase();
  50897. if (endIgnoreCaseMach) {
  50898. domBuilder.endElement(config.uri, config.localName, tagName);
  50899. if (localNSMap) {
  50900. for (var prefix in localNSMap) {
  50901. if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
  50902. domBuilder.endPrefixMapping(prefix);
  50903. }
  50904. }
  50905. }
  50906. if (!endMatch) {
  50907. errorHandler.fatalError("end tag name: " + tagName + " is not match the current start tagName:" + config.tagName);
  50908. }
  50909. } else {
  50910. parseStack.push(config);
  50911. }
  50912. end++;
  50913. break;
  50914. case "?":
  50915. locator && position2(tagStart);
  50916. end = parseInstruction(source, tagStart, domBuilder);
  50917. break;
  50918. case "!":
  50919. locator && position2(tagStart);
  50920. end = parseDCC(source, tagStart, domBuilder, errorHandler);
  50921. break;
  50922. default:
  50923. locator && position2(tagStart);
  50924. var el = new ElementAttributes();
  50925. var currentNSMap = parseStack[parseStack.length - 1].currentNSMap;
  50926. var end = parseElementStartPart(source, tagStart, el, currentNSMap, entityReplacer, errorHandler);
  50927. var len = el.length;
  50928. if (!el.closed && fixSelfClosed(source, end, el.tagName, closeMap)) {
  50929. el.closed = true;
  50930. if (!entityMap.nbsp) {
  50931. errorHandler.warning("unclosed xml attribute");
  50932. }
  50933. }
  50934. if (locator && len) {
  50935. var locator2 = copyLocator(locator, {});
  50936. for (var i2 = 0; i2 < len; i2++) {
  50937. var a = el[i2];
  50938. position2(a.offset);
  50939. a.locator = copyLocator(locator, {});
  50940. }
  50941. domBuilder.locator = locator2;
  50942. if (appendElement$1(el, domBuilder, currentNSMap)) {
  50943. parseStack.push(el);
  50944. }
  50945. domBuilder.locator = locator;
  50946. } else {
  50947. if (appendElement$1(el, domBuilder, currentNSMap)) {
  50948. parseStack.push(el);
  50949. }
  50950. }
  50951. if (NAMESPACE$1.isHTML(el.uri) && !el.closed) {
  50952. end = parseHtmlSpecialContent(source, end, el.tagName, entityReplacer, domBuilder);
  50953. } else {
  50954. end++;
  50955. }
  50956. }
  50957. } catch (e) {
  50958. if (e instanceof ParseError$1) {
  50959. throw e;
  50960. }
  50961. errorHandler.error("element parse error: " + e);
  50962. end = -1;
  50963. }
  50964. if (end > start2) {
  50965. start2 = end;
  50966. } else {
  50967. appendText(Math.max(tagStart, start2) + 1);
  50968. }
  50969. }
  50970. }
  50971. function copyLocator(f, t2) {
  50972. t2.lineNumber = f.lineNumber;
  50973. t2.columnNumber = f.columnNumber;
  50974. return t2;
  50975. }
  50976. function parseElementStartPart(source, start2, el, currentNSMap, entityReplacer, errorHandler) {
  50977. function addAttribute(qname, value2, startIndex) {
  50978. if (el.attributeNames.hasOwnProperty(qname)) {
  50979. errorHandler.fatalError("Attribute " + qname + " redefined");
  50980. }
  50981. el.addValue(
  50982. qname,
  50983. value2.replace(/[\t\n\r]/g, " ").replace(/&#?\w+;/g, entityReplacer),
  50984. startIndex
  50985. );
  50986. }
  50987. var attrName;
  50988. var value;
  50989. var p = ++start2;
  50990. var s = S_TAG;
  50991. while (true) {
  50992. var c = source.charAt(p);
  50993. switch (c) {
  50994. case "=":
  50995. if (s === S_ATTR) {
  50996. attrName = source.slice(start2, p);
  50997. s = S_EQ;
  50998. } else if (s === S_ATTR_SPACE) {
  50999. s = S_EQ;
  51000. } else {
  51001. throw new Error("attribute equal must after attrName");
  51002. }
  51003. break;
  51004. case "'":
  51005. case '"':
  51006. if (s === S_EQ || s === S_ATTR) {
  51007. if (s === S_ATTR) {
  51008. errorHandler.warning('attribute value must after "="');
  51009. attrName = source.slice(start2, p);
  51010. }
  51011. start2 = p + 1;
  51012. p = source.indexOf(c, start2);
  51013. if (p > 0) {
  51014. value = source.slice(start2, p);
  51015. addAttribute(attrName, value, start2 - 1);
  51016. s = S_ATTR_END;
  51017. } else {
  51018. throw new Error("attribute value no end '" + c + "' match");
  51019. }
  51020. } else if (s == S_ATTR_NOQUOT_VALUE) {
  51021. value = source.slice(start2, p);
  51022. addAttribute(attrName, value, start2);
  51023. errorHandler.warning('attribute "' + attrName + '" missed start quot(' + c + ")!!");
  51024. start2 = p + 1;
  51025. s = S_ATTR_END;
  51026. } else {
  51027. throw new Error('attribute value must after "="');
  51028. }
  51029. break;
  51030. case "/":
  51031. switch (s) {
  51032. case S_TAG:
  51033. el.setTagName(source.slice(start2, p));
  51034. case S_ATTR_END:
  51035. case S_TAG_SPACE:
  51036. case S_TAG_CLOSE:
  51037. s = S_TAG_CLOSE;
  51038. el.closed = true;
  51039. case S_ATTR_NOQUOT_VALUE:
  51040. case S_ATTR:
  51041. break;
  51042. case S_ATTR_SPACE:
  51043. el.closed = true;
  51044. break;
  51045. default:
  51046. throw new Error("attribute invalid close char('/')");
  51047. }
  51048. break;
  51049. case "":
  51050. errorHandler.error("unexpected end of input");
  51051. if (s == S_TAG) {
  51052. el.setTagName(source.slice(start2, p));
  51053. }
  51054. return p;
  51055. case ">":
  51056. switch (s) {
  51057. case S_TAG:
  51058. el.setTagName(source.slice(start2, p));
  51059. case S_ATTR_END:
  51060. case S_TAG_SPACE:
  51061. case S_TAG_CLOSE:
  51062. break;
  51063. case S_ATTR_NOQUOT_VALUE:
  51064. case S_ATTR:
  51065. value = source.slice(start2, p);
  51066. if (value.slice(-1) === "/") {
  51067. el.closed = true;
  51068. value = value.slice(0, -1);
  51069. }
  51070. case S_ATTR_SPACE:
  51071. if (s === S_ATTR_SPACE) {
  51072. value = attrName;
  51073. }
  51074. if (s == S_ATTR_NOQUOT_VALUE) {
  51075. errorHandler.warning('attribute "' + value + '" missed quot(")!');
  51076. addAttribute(attrName, value, start2);
  51077. } else {
  51078. if (!NAMESPACE$1.isHTML(currentNSMap[""]) || !value.match(/^(?:disabled|checked|selected)$/i)) {
  51079. errorHandler.warning('attribute "' + value + '" missed value!! "' + value + '" instead!!');
  51080. }
  51081. addAttribute(value, value, start2);
  51082. }
  51083. break;
  51084. case S_EQ:
  51085. throw new Error("attribute value missed!!");
  51086. }
  51087. return p;
  51088. case "\x80":
  51089. c = " ";
  51090. default:
  51091. if (c <= " ") {
  51092. switch (s) {
  51093. case S_TAG:
  51094. el.setTagName(source.slice(start2, p));
  51095. s = S_TAG_SPACE;
  51096. break;
  51097. case S_ATTR:
  51098. attrName = source.slice(start2, p);
  51099. s = S_ATTR_SPACE;
  51100. break;
  51101. case S_ATTR_NOQUOT_VALUE:
  51102. var value = source.slice(start2, p);
  51103. errorHandler.warning('attribute "' + value + '" missed quot(")!!');
  51104. addAttribute(attrName, value, start2);
  51105. case S_ATTR_END:
  51106. s = S_TAG_SPACE;
  51107. break;
  51108. }
  51109. } else {
  51110. switch (s) {
  51111. case S_ATTR_SPACE:
  51112. el.tagName;
  51113. if (!NAMESPACE$1.isHTML(currentNSMap[""]) || !attrName.match(/^(?:disabled|checked|selected)$/i)) {
  51114. errorHandler.warning('attribute "' + attrName + '" missed value!! "' + attrName + '" instead2!!');
  51115. }
  51116. addAttribute(attrName, attrName, start2);
  51117. start2 = p;
  51118. s = S_ATTR;
  51119. break;
  51120. case S_ATTR_END:
  51121. errorHandler.warning('attribute space is required"' + attrName + '"!!');
  51122. case S_TAG_SPACE:
  51123. s = S_ATTR;
  51124. start2 = p;
  51125. break;
  51126. case S_EQ:
  51127. s = S_ATTR_NOQUOT_VALUE;
  51128. start2 = p;
  51129. break;
  51130. case S_TAG_CLOSE:
  51131. throw new Error("elements closed character '/' and '>' must be connected to");
  51132. }
  51133. }
  51134. }
  51135. p++;
  51136. }
  51137. }
  51138. function appendElement$1(el, domBuilder, currentNSMap) {
  51139. var tagName = el.tagName;
  51140. var localNSMap = null;
  51141. var i2 = el.length;
  51142. while (i2--) {
  51143. var a = el[i2];
  51144. var qName = a.qName;
  51145. var value = a.value;
  51146. var nsp = qName.indexOf(":");
  51147. if (nsp > 0) {
  51148. var prefix = a.prefix = qName.slice(0, nsp);
  51149. var localName = qName.slice(nsp + 1);
  51150. var nsPrefix = prefix === "xmlns" && localName;
  51151. } else {
  51152. localName = qName;
  51153. prefix = null;
  51154. nsPrefix = qName === "xmlns" && "";
  51155. }
  51156. a.localName = localName;
  51157. if (nsPrefix !== false) {
  51158. if (localNSMap == null) {
  51159. localNSMap = {};
  51160. _copy(currentNSMap, currentNSMap = {});
  51161. }
  51162. currentNSMap[nsPrefix] = localNSMap[nsPrefix] = value;
  51163. a.uri = NAMESPACE$1.XMLNS;
  51164. domBuilder.startPrefixMapping(nsPrefix, value);
  51165. }
  51166. }
  51167. var i2 = el.length;
  51168. while (i2--) {
  51169. a = el[i2];
  51170. var prefix = a.prefix;
  51171. if (prefix) {
  51172. if (prefix === "xml") {
  51173. a.uri = NAMESPACE$1.XML;
  51174. }
  51175. if (prefix !== "xmlns") {
  51176. a.uri = currentNSMap[prefix || ""];
  51177. }
  51178. }
  51179. }
  51180. var nsp = tagName.indexOf(":");
  51181. if (nsp > 0) {
  51182. prefix = el.prefix = tagName.slice(0, nsp);
  51183. localName = el.localName = tagName.slice(nsp + 1);
  51184. } else {
  51185. prefix = null;
  51186. localName = el.localName = tagName;
  51187. }
  51188. var ns = el.uri = currentNSMap[prefix || ""];
  51189. domBuilder.startElement(ns, localName, tagName, el);
  51190. if (el.closed) {
  51191. domBuilder.endElement(ns, localName, tagName);
  51192. if (localNSMap) {
  51193. for (prefix in localNSMap) {
  51194. if (Object.prototype.hasOwnProperty.call(localNSMap, prefix)) {
  51195. domBuilder.endPrefixMapping(prefix);
  51196. }
  51197. }
  51198. }
  51199. } else {
  51200. el.currentNSMap = currentNSMap;
  51201. el.localNSMap = localNSMap;
  51202. return true;
  51203. }
  51204. }
  51205. function parseHtmlSpecialContent(source, elStartEnd, tagName, entityReplacer, domBuilder) {
  51206. if (/^(?:script|textarea)$/i.test(tagName)) {
  51207. var elEndStart = source.indexOf("</" + tagName + ">", elStartEnd);
  51208. var text = source.substring(elStartEnd + 1, elEndStart);
  51209. if (/[&<]/.test(text)) {
  51210. if (/^script$/i.test(tagName)) {
  51211. domBuilder.characters(text, 0, text.length);
  51212. return elEndStart;
  51213. }
  51214. text = text.replace(/&#?\w+;/g, entityReplacer);
  51215. domBuilder.characters(text, 0, text.length);
  51216. return elEndStart;
  51217. }
  51218. }
  51219. return elStartEnd + 1;
  51220. }
  51221. function fixSelfClosed(source, elStartEnd, tagName, closeMap) {
  51222. var pos = closeMap[tagName];
  51223. if (pos == null) {
  51224. pos = source.lastIndexOf("</" + tagName + ">");
  51225. if (pos < elStartEnd) {
  51226. pos = source.lastIndexOf("</" + tagName);
  51227. }
  51228. closeMap[tagName] = pos;
  51229. }
  51230. return pos < elStartEnd;
  51231. }
  51232. function _copy(source, target) {
  51233. for (var n in source) {
  51234. if (Object.prototype.hasOwnProperty.call(source, n)) {
  51235. target[n] = source[n];
  51236. }
  51237. }
  51238. }
  51239. function parseDCC(source, start2, domBuilder, errorHandler) {
  51240. var next = source.charAt(start2 + 2);
  51241. switch (next) {
  51242. case "-":
  51243. if (source.charAt(start2 + 3) === "-") {
  51244. var end = source.indexOf("-->", start2 + 4);
  51245. if (end > start2) {
  51246. domBuilder.comment(source, start2 + 4, end - start2 - 4);
  51247. return end + 3;
  51248. } else {
  51249. errorHandler.error("Unclosed comment");
  51250. return -1;
  51251. }
  51252. } else {
  51253. return -1;
  51254. }
  51255. default:
  51256. if (source.substr(start2 + 3, 6) == "CDATA[") {
  51257. var end = source.indexOf("]]>", start2 + 9);
  51258. domBuilder.startCDATA();
  51259. domBuilder.characters(source, start2 + 9, end - start2 - 9);
  51260. domBuilder.endCDATA();
  51261. return end + 3;
  51262. }
  51263. var matchs = split(source, start2);
  51264. var len = matchs.length;
  51265. if (len > 1 && /!doctype/i.test(matchs[0][0])) {
  51266. var name = matchs[1][0];
  51267. var pubid = false;
  51268. var sysid = false;
  51269. if (len > 3) {
  51270. if (/^public$/i.test(matchs[2][0])) {
  51271. pubid = matchs[3][0];
  51272. sysid = len > 4 && matchs[4][0];
  51273. } else if (/^system$/i.test(matchs[2][0])) {
  51274. sysid = matchs[3][0];
  51275. }
  51276. }
  51277. var lastMatch = matchs[len - 1];
  51278. domBuilder.startDTD(name, pubid, sysid);
  51279. domBuilder.endDTD();
  51280. return lastMatch.index + lastMatch[0].length;
  51281. }
  51282. }
  51283. return -1;
  51284. }
  51285. function parseInstruction(source, start2, domBuilder) {
  51286. var end = source.indexOf("?>", start2);
  51287. if (end) {
  51288. var match = source.substring(start2, end).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);
  51289. if (match) {
  51290. match[0].length;
  51291. domBuilder.processingInstruction(match[1], match[2]);
  51292. return end + 2;
  51293. } else {
  51294. return -1;
  51295. }
  51296. }
  51297. return -1;
  51298. }
  51299. function ElementAttributes() {
  51300. this.attributeNames = {};
  51301. }
  51302. ElementAttributes.prototype = {
  51303. setTagName: function(tagName) {
  51304. if (!tagNamePattern.test(tagName)) {
  51305. throw new Error("invalid tagName:" + tagName);
  51306. }
  51307. this.tagName = tagName;
  51308. },
  51309. addValue: function(qName, value, offset) {
  51310. if (!tagNamePattern.test(qName)) {
  51311. throw new Error("invalid attribute:" + qName);
  51312. }
  51313. this.attributeNames[qName] = this.length;
  51314. this[this.length++] = { qName, value, offset };
  51315. },
  51316. length: 0,
  51317. getLocalName: function(i2) {
  51318. return this[i2].localName;
  51319. },
  51320. getLocator: function(i2) {
  51321. return this[i2].locator;
  51322. },
  51323. getQName: function(i2) {
  51324. return this[i2].qName;
  51325. },
  51326. getURI: function(i2) {
  51327. return this[i2].uri;
  51328. },
  51329. getValue: function(i2) {
  51330. return this[i2].value;
  51331. }
  51332. };
  51333. function split(source, start2) {
  51334. var match;
  51335. var buf = [];
  51336. var reg = /'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;
  51337. reg.lastIndex = start2;
  51338. reg.exec(source);
  51339. while (match = reg.exec(source)) {
  51340. buf.push(match);
  51341. if (match[1])
  51342. return buf;
  51343. }
  51344. }
  51345. sax$1.XMLReader = XMLReader$1;
  51346. sax$1.ParseError = ParseError$1;
  51347. var conventions = conventions$2;
  51348. var dom = dom$1;
  51349. var entities = entities$1;
  51350. var sax = sax$1;
  51351. var DOMImplementation = dom.DOMImplementation;
  51352. var NAMESPACE = conventions.NAMESPACE;
  51353. var ParseError = sax.ParseError;
  51354. var XMLReader = sax.XMLReader;
  51355. function normalizeLineEndings(input) {
  51356. return input.replace(/\r[\n\u0085]/g, "\n").replace(/[\r\u0085\u2028]/g, "\n");
  51357. }
  51358. function DOMParser$1(options2) {
  51359. this.options = options2 || { locator: {} };
  51360. }
  51361. DOMParser$1.prototype.parseFromString = function(source, mimeType) {
  51362. var options2 = this.options;
  51363. var sax2 = new XMLReader();
  51364. var domBuilder = options2.domBuilder || new DOMHandler();
  51365. var errorHandler = options2.errorHandler;
  51366. var locator = options2.locator;
  51367. var defaultNSMap = options2.xmlns || {};
  51368. var isHTML = /\/x?html?$/.test(mimeType);
  51369. var entityMap = isHTML ? entities.HTML_ENTITIES : entities.XML_ENTITIES;
  51370. if (locator) {
  51371. domBuilder.setDocumentLocator(locator);
  51372. }
  51373. sax2.errorHandler = buildErrorHandler(errorHandler, domBuilder, locator);
  51374. sax2.domBuilder = options2.domBuilder || domBuilder;
  51375. if (isHTML) {
  51376. defaultNSMap[""] = NAMESPACE.HTML;
  51377. }
  51378. defaultNSMap.xml = defaultNSMap.xml || NAMESPACE.XML;
  51379. var normalize = options2.normalizeLineEndings || normalizeLineEndings;
  51380. if (source && typeof source === "string") {
  51381. sax2.parse(
  51382. normalize(source),
  51383. defaultNSMap,
  51384. entityMap
  51385. );
  51386. } else {
  51387. sax2.errorHandler.error("invalid doc source");
  51388. }
  51389. return domBuilder.doc;
  51390. };
  51391. function buildErrorHandler(errorImpl, domBuilder, locator) {
  51392. if (!errorImpl) {
  51393. if (domBuilder instanceof DOMHandler) {
  51394. return domBuilder;
  51395. }
  51396. errorImpl = domBuilder;
  51397. }
  51398. var errorHandler = {};
  51399. var isCallback = errorImpl instanceof Function;
  51400. locator = locator || {};
  51401. function build(key) {
  51402. var fn2 = errorImpl[key];
  51403. if (!fn2 && isCallback) {
  51404. fn2 = errorImpl.length == 2 ? function(msg) {
  51405. errorImpl(key, msg);
  51406. } : errorImpl;
  51407. }
  51408. errorHandler[key] = fn2 && function(msg) {
  51409. fn2("[xmldom " + key + "] " + msg + _locator(locator));
  51410. } || function() {
  51411. };
  51412. }
  51413. build("warning");
  51414. build("error");
  51415. build("fatalError");
  51416. return errorHandler;
  51417. }
  51418. function DOMHandler() {
  51419. this.cdata = false;
  51420. }
  51421. function position(locator, node) {
  51422. node.lineNumber = locator.lineNumber;
  51423. node.columnNumber = locator.columnNumber;
  51424. }
  51425. DOMHandler.prototype = {
  51426. startDocument: function() {
  51427. this.doc = new DOMImplementation().createDocument(null, null, null);
  51428. if (this.locator) {
  51429. this.doc.documentURI = this.locator.systemId;
  51430. }
  51431. },
  51432. startElement: function(namespaceURI, localName, qName, attrs) {
  51433. var doc = this.doc;
  51434. var el = doc.createElementNS(namespaceURI, qName || localName);
  51435. var len = attrs.length;
  51436. appendElement(this, el);
  51437. this.currentElement = el;
  51438. this.locator && position(this.locator, el);
  51439. for (var i2 = 0; i2 < len; i2++) {
  51440. var namespaceURI = attrs.getURI(i2);
  51441. var value = attrs.getValue(i2);
  51442. var qName = attrs.getQName(i2);
  51443. var attr = doc.createAttributeNS(namespaceURI, qName);
  51444. this.locator && position(attrs.getLocator(i2), attr);
  51445. attr.value = attr.nodeValue = value;
  51446. el.setAttributeNode(attr);
  51447. }
  51448. },
  51449. endElement: function(namespaceURI, localName, qName) {
  51450. var current = this.currentElement;
  51451. current.tagName;
  51452. this.currentElement = current.parentNode;
  51453. },
  51454. startPrefixMapping: function(prefix, uri) {
  51455. },
  51456. endPrefixMapping: function(prefix) {
  51457. },
  51458. processingInstruction: function(target, data) {
  51459. var ins = this.doc.createProcessingInstruction(target, data);
  51460. this.locator && position(this.locator, ins);
  51461. appendElement(this, ins);
  51462. },
  51463. ignorableWhitespace: function(ch, start2, length) {
  51464. },
  51465. characters: function(chars, start2, length) {
  51466. chars = _toString.apply(this, arguments);
  51467. if (chars) {
  51468. if (this.cdata) {
  51469. var charNode = this.doc.createCDATASection(chars);
  51470. } else {
  51471. var charNode = this.doc.createTextNode(chars);
  51472. }
  51473. if (this.currentElement) {
  51474. this.currentElement.appendChild(charNode);
  51475. } else if (/^\s*$/.test(chars)) {
  51476. this.doc.appendChild(charNode);
  51477. }
  51478. this.locator && position(this.locator, charNode);
  51479. }
  51480. },
  51481. skippedEntity: function(name) {
  51482. },
  51483. endDocument: function() {
  51484. this.doc.normalize();
  51485. },
  51486. setDocumentLocator: function(locator) {
  51487. if (this.locator = locator) {
  51488. locator.lineNumber = 0;
  51489. }
  51490. },
  51491. comment: function(chars, start2, length) {
  51492. chars = _toString.apply(this, arguments);
  51493. var comm = this.doc.createComment(chars);
  51494. this.locator && position(this.locator, comm);
  51495. appendElement(this, comm);
  51496. },
  51497. startCDATA: function() {
  51498. this.cdata = true;
  51499. },
  51500. endCDATA: function() {
  51501. this.cdata = false;
  51502. },
  51503. startDTD: function(name, publicId, systemId) {
  51504. var impl = this.doc.implementation;
  51505. if (impl && impl.createDocumentType) {
  51506. var dt2 = impl.createDocumentType(name, publicId, systemId);
  51507. this.locator && position(this.locator, dt2);
  51508. appendElement(this, dt2);
  51509. this.doc.doctype = dt2;
  51510. }
  51511. },
  51512. warning: function(error) {
  51513. console.warn("[xmldom warning] " + error, _locator(this.locator));
  51514. },
  51515. error: function(error) {
  51516. console.error("[xmldom error] " + error, _locator(this.locator));
  51517. },
  51518. fatalError: function(error) {
  51519. throw new ParseError(error, this.locator);
  51520. }
  51521. };
  51522. function _locator(l) {
  51523. if (l) {
  51524. return "\n@" + (l.systemId || "") + "#[line:" + l.lineNumber + ",col:" + l.columnNumber + "]";
  51525. }
  51526. }
  51527. function _toString(chars, start2, length) {
  51528. if (typeof chars == "string") {
  51529. return chars.substr(start2, length);
  51530. } else {
  51531. if (chars.length >= start2 + length || start2) {
  51532. return new java.lang.String(chars, start2, length) + "";
  51533. }
  51534. return chars;
  51535. }
  51536. }
  51537. "endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g, function(key) {
  51538. DOMHandler.prototype[key] = function() {
  51539. return null;
  51540. };
  51541. });
  51542. function appendElement(hander, node) {
  51543. if (!hander.currentElement) {
  51544. hander.doc.appendChild(node);
  51545. } else {
  51546. hander.currentElement.appendChild(node);
  51547. }
  51548. }
  51549. domParser.__DOMHandler = DOMHandler;
  51550. domParser.normalizeLineEndings = normalizeLineEndings;
  51551. domParser.DOMParser = DOMParser$1;
  51552. var DOMParser = domParser.DOMParser;
  51553. /*! @name mpd-parser @version 1.1.1 @license Apache-2.0 */
  51554. const isObject$3 = (obj) => {
  51555. return !!obj && typeof obj === "object";
  51556. };
  51557. const merge$3 = (...objects) => {
  51558. return objects.reduce((result, source) => {
  51559. if (typeof source !== "object") {
  51560. return result;
  51561. }
  51562. Object.keys(source).forEach((key) => {
  51563. if (Array.isArray(result[key]) && Array.isArray(source[key])) {
  51564. result[key] = result[key].concat(source[key]);
  51565. } else if (isObject$3(result[key]) && isObject$3(source[key])) {
  51566. result[key] = merge$3(result[key], source[key]);
  51567. } else {
  51568. result[key] = source[key];
  51569. }
  51570. });
  51571. return result;
  51572. }, {});
  51573. };
  51574. const values$1 = (o) => Object.keys(o).map((k) => o[k]);
  51575. const range$1 = (start2, end) => {
  51576. const result = [];
  51577. for (let i2 = start2; i2 < end; i2++) {
  51578. result.push(i2);
  51579. }
  51580. return result;
  51581. };
  51582. const flatten$1 = (lists) => lists.reduce((x, y) => x.concat(y), []);
  51583. const from$1 = (list) => {
  51584. if (!list.length) {
  51585. return [];
  51586. }
  51587. const result = [];
  51588. for (let i2 = 0; i2 < list.length; i2++) {
  51589. result.push(list[i2]);
  51590. }
  51591. return result;
  51592. };
  51593. const findIndexes$1 = (l, key) => l.reduce((a, e, i2) => {
  51594. if (e[key]) {
  51595. a.push(i2);
  51596. }
  51597. return a;
  51598. }, []);
  51599. const union$1 = (lists, keyFunction) => {
  51600. return values$1(lists.reduce((acc, list) => {
  51601. list.forEach((el) => {
  51602. acc[keyFunction(el)] = el;
  51603. });
  51604. return acc;
  51605. }, {}));
  51606. };
  51607. var errors$1 = {
  51608. INVALID_NUMBER_OF_PERIOD: "INVALID_NUMBER_OF_PERIOD",
  51609. DASH_EMPTY_MANIFEST: "DASH_EMPTY_MANIFEST",
  51610. DASH_INVALID_XML: "DASH_INVALID_XML",
  51611. NO_BASE_URL: "NO_BASE_URL",
  51612. MISSING_SEGMENT_INFORMATION: "MISSING_SEGMENT_INFORMATION",
  51613. SEGMENT_TIME_UNSPECIFIED: "SEGMENT_TIME_UNSPECIFIED",
  51614. UNSUPPORTED_UTC_TIMING_SCHEME: "UNSUPPORTED_UTC_TIMING_SCHEME"
  51615. };
  51616. const urlTypeToSegment$1 = ({
  51617. baseUrl = "",
  51618. source = "",
  51619. range: range3 = "",
  51620. indexRange = ""
  51621. }) => {
  51622. const segment = {
  51623. uri: source,
  51624. resolvedUri: resolveUrl$3(baseUrl || "", source)
  51625. };
  51626. if (range3 || indexRange) {
  51627. const rangeStr = range3 ? range3 : indexRange;
  51628. const ranges = rangeStr.split("-");
  51629. let startRange = window_1.BigInt ? window_1.BigInt(ranges[0]) : parseInt(ranges[0], 10);
  51630. let endRange = window_1.BigInt ? window_1.BigInt(ranges[1]) : parseInt(ranges[1], 10);
  51631. if (startRange < Number.MAX_SAFE_INTEGER && typeof startRange === "bigint") {
  51632. startRange = Number(startRange);
  51633. }
  51634. if (endRange < Number.MAX_SAFE_INTEGER && typeof endRange === "bigint") {
  51635. endRange = Number(endRange);
  51636. }
  51637. let length;
  51638. if (typeof endRange === "bigint" || typeof startRange === "bigint") {
  51639. length = window_1.BigInt(endRange) - window_1.BigInt(startRange) + window_1.BigInt(1);
  51640. } else {
  51641. length = endRange - startRange + 1;
  51642. }
  51643. if (typeof length === "bigint" && length < Number.MAX_SAFE_INTEGER) {
  51644. length = Number(length);
  51645. }
  51646. segment.byterange = {
  51647. length,
  51648. offset: startRange
  51649. };
  51650. }
  51651. return segment;
  51652. };
  51653. const byteRangeToString$1 = (byterange) => {
  51654. let endRange;
  51655. if (typeof byterange.offset === "bigint" || typeof byterange.length === "bigint") {
  51656. endRange = window_1.BigInt(byterange.offset) + window_1.BigInt(byterange.length) - window_1.BigInt(1);
  51657. } else {
  51658. endRange = byterange.offset + byterange.length - 1;
  51659. }
  51660. return `${byterange.offset}-${endRange}`;
  51661. };
  51662. const parseEndNumber$1 = (endNumber) => {
  51663. if (endNumber && typeof endNumber !== "number") {
  51664. endNumber = parseInt(endNumber, 10);
  51665. }
  51666. if (isNaN(endNumber)) {
  51667. return null;
  51668. }
  51669. return endNumber;
  51670. };
  51671. const segmentRange$1 = {
  51672. static(attributes) {
  51673. const {
  51674. duration: duration5,
  51675. timescale: timescale2 = 1,
  51676. sourceDuration,
  51677. periodDuration
  51678. } = attributes;
  51679. const endNumber = parseEndNumber$1(attributes.endNumber);
  51680. const segmentDuration = duration5 / timescale2;
  51681. if (typeof endNumber === "number") {
  51682. return {
  51683. start: 0,
  51684. end: endNumber
  51685. };
  51686. }
  51687. if (typeof periodDuration === "number") {
  51688. return {
  51689. start: 0,
  51690. end: periodDuration / segmentDuration
  51691. };
  51692. }
  51693. return {
  51694. start: 0,
  51695. end: sourceDuration / segmentDuration
  51696. };
  51697. },
  51698. dynamic(attributes) {
  51699. const {
  51700. NOW,
  51701. clientOffset,
  51702. availabilityStartTime: availabilityStartTime2,
  51703. timescale: timescale2 = 1,
  51704. duration: duration5,
  51705. periodStart = 0,
  51706. minimumUpdatePeriod: minimumUpdatePeriod2 = 0,
  51707. timeShiftBufferDepth: timeShiftBufferDepth2 = Infinity
  51708. } = attributes;
  51709. const endNumber = parseEndNumber$1(attributes.endNumber);
  51710. const now2 = (NOW + clientOffset) / 1e3;
  51711. const periodStartWC = availabilityStartTime2 + periodStart;
  51712. const periodEndWC = now2 + minimumUpdatePeriod2;
  51713. const periodDuration = periodEndWC - periodStartWC;
  51714. const segmentCount = Math.ceil(periodDuration * timescale2 / duration5);
  51715. const availableStart = Math.floor((now2 - periodStartWC - timeShiftBufferDepth2) * timescale2 / duration5);
  51716. const availableEnd = Math.floor((now2 - periodStartWC) * timescale2 / duration5);
  51717. return {
  51718. start: Math.max(0, availableStart),
  51719. end: typeof endNumber === "number" ? endNumber : Math.min(segmentCount, availableEnd)
  51720. };
  51721. }
  51722. };
  51723. const toSegments$1 = (attributes) => (number) => {
  51724. const {
  51725. duration: duration5,
  51726. timescale: timescale2 = 1,
  51727. periodStart,
  51728. startNumber: startNumber2 = 1
  51729. } = attributes;
  51730. return {
  51731. number: startNumber2 + number,
  51732. duration: duration5 / timescale2,
  51733. timeline: periodStart,
  51734. time: number * duration5
  51735. };
  51736. };
  51737. const parseByDuration$1 = (attributes) => {
  51738. const {
  51739. type: type2,
  51740. duration: duration5,
  51741. timescale: timescale2 = 1,
  51742. periodDuration,
  51743. sourceDuration
  51744. } = attributes;
  51745. const {
  51746. start: start2,
  51747. end
  51748. } = segmentRange$1[type2](attributes);
  51749. const segments = range$1(start2, end).map(toSegments$1(attributes));
  51750. if (type2 === "static") {
  51751. const index2 = segments.length - 1;
  51752. const sectionDuration = typeof periodDuration === "number" ? periodDuration : sourceDuration;
  51753. segments[index2].duration = sectionDuration - duration5 / timescale2 * index2;
  51754. }
  51755. return segments;
  51756. };
  51757. const segmentsFromBase$1 = (attributes) => {
  51758. const {
  51759. baseUrl,
  51760. initialization = {},
  51761. sourceDuration,
  51762. indexRange = "",
  51763. periodStart,
  51764. presentationTime,
  51765. number = 0,
  51766. duration: duration5
  51767. } = attributes;
  51768. if (!baseUrl) {
  51769. throw new Error(errors$1.NO_BASE_URL);
  51770. }
  51771. const initSegment = urlTypeToSegment$1({
  51772. baseUrl,
  51773. source: initialization.sourceURL,
  51774. range: initialization.range
  51775. });
  51776. const segment = urlTypeToSegment$1({
  51777. baseUrl,
  51778. source: baseUrl,
  51779. indexRange
  51780. });
  51781. segment.map = initSegment;
  51782. if (duration5) {
  51783. const segmentTimeInfo = parseByDuration$1(attributes);
  51784. if (segmentTimeInfo.length) {
  51785. segment.duration = segmentTimeInfo[0].duration;
  51786. segment.timeline = segmentTimeInfo[0].timeline;
  51787. }
  51788. } else if (sourceDuration) {
  51789. segment.duration = sourceDuration;
  51790. segment.timeline = periodStart;
  51791. }
  51792. segment.presentationTime = presentationTime || periodStart;
  51793. segment.number = number;
  51794. return [segment];
  51795. };
  51796. const addSidxSegmentsToPlaylist$1$1 = (playlist, sidx, baseUrl) => {
  51797. const initSegment = playlist.sidx.map ? playlist.sidx.map : null;
  51798. const sourceDuration = playlist.sidx.duration;
  51799. const timeline = playlist.timeline || 0;
  51800. const sidxByteRange = playlist.sidx.byterange;
  51801. const sidxEnd = sidxByteRange.offset + sidxByteRange.length;
  51802. const timescale2 = sidx.timescale;
  51803. const mediaReferences = sidx.references.filter((r2) => r2.referenceType !== 1);
  51804. const segments = [];
  51805. const type2 = playlist.endList ? "static" : "dynamic";
  51806. const periodStart = playlist.sidx.timeline;
  51807. let presentationTime = periodStart;
  51808. let number = playlist.mediaSequence || 0;
  51809. let startIndex;
  51810. if (typeof sidx.firstOffset === "bigint") {
  51811. startIndex = window_1.BigInt(sidxEnd) + sidx.firstOffset;
  51812. } else {
  51813. startIndex = sidxEnd + sidx.firstOffset;
  51814. }
  51815. for (let i2 = 0; i2 < mediaReferences.length; i2++) {
  51816. const reference = sidx.references[i2];
  51817. const size = reference.referencedSize;
  51818. const duration5 = reference.subsegmentDuration;
  51819. let endIndex;
  51820. if (typeof startIndex === "bigint") {
  51821. endIndex = startIndex + window_1.BigInt(size) - window_1.BigInt(1);
  51822. } else {
  51823. endIndex = startIndex + size - 1;
  51824. }
  51825. const indexRange = `${startIndex}-${endIndex}`;
  51826. const attributes = {
  51827. baseUrl,
  51828. timescale: timescale2,
  51829. timeline,
  51830. periodStart,
  51831. presentationTime,
  51832. number,
  51833. duration: duration5,
  51834. sourceDuration,
  51835. indexRange,
  51836. type: type2
  51837. };
  51838. const segment = segmentsFromBase$1(attributes)[0];
  51839. if (initSegment) {
  51840. segment.map = initSegment;
  51841. }
  51842. segments.push(segment);
  51843. if (typeof startIndex === "bigint") {
  51844. startIndex += window_1.BigInt(size);
  51845. } else {
  51846. startIndex += size;
  51847. }
  51848. presentationTime += duration5 / timescale2;
  51849. number++;
  51850. }
  51851. playlist.segments = segments;
  51852. return playlist;
  51853. };
  51854. const SUPPORTED_MEDIA_TYPES$1 = ["AUDIO", "SUBTITLES"];
  51855. const TIME_FUDGE$1 = 1 / 60;
  51856. const getUniqueTimelineStarts$1 = (timelineStarts) => {
  51857. return union$1(timelineStarts, ({
  51858. timeline
  51859. }) => timeline).sort((a, b) => a.timeline > b.timeline ? 1 : -1);
  51860. };
  51861. const findPlaylistWithName$1 = (playlists, name) => {
  51862. for (let i2 = 0; i2 < playlists.length; i2++) {
  51863. if (playlists[i2].attributes.NAME === name) {
  51864. return playlists[i2];
  51865. }
  51866. }
  51867. return null;
  51868. };
  51869. const getMediaGroupPlaylists$1 = (manifest) => {
  51870. let mediaGroupPlaylists = [];
  51871. forEachMediaGroup$3(manifest, SUPPORTED_MEDIA_TYPES$1, (properties, type2, group, label) => {
  51872. mediaGroupPlaylists = mediaGroupPlaylists.concat(properties.playlists || []);
  51873. });
  51874. return mediaGroupPlaylists;
  51875. };
  51876. const updateMediaSequenceForPlaylist$1 = ({
  51877. playlist,
  51878. mediaSequence
  51879. }) => {
  51880. playlist.mediaSequence = mediaSequence;
  51881. playlist.segments.forEach((segment, index2) => {
  51882. segment.number = playlist.mediaSequence + index2;
  51883. });
  51884. };
  51885. const updateSequenceNumbers$1 = ({
  51886. oldPlaylists,
  51887. newPlaylists,
  51888. timelineStarts
  51889. }) => {
  51890. newPlaylists.forEach((playlist) => {
  51891. playlist.discontinuitySequence = timelineStarts.findIndex(function({
  51892. timeline
  51893. }) {
  51894. return timeline === playlist.timeline;
  51895. });
  51896. const oldPlaylist = findPlaylistWithName$1(oldPlaylists, playlist.attributes.NAME);
  51897. if (!oldPlaylist) {
  51898. return;
  51899. }
  51900. if (playlist.sidx) {
  51901. return;
  51902. }
  51903. const firstNewSegment = playlist.segments[0];
  51904. const oldMatchingSegmentIndex = oldPlaylist.segments.findIndex(function(oldSegment) {
  51905. return Math.abs(oldSegment.presentationTime - firstNewSegment.presentationTime) < TIME_FUDGE$1;
  51906. });
  51907. if (oldMatchingSegmentIndex === -1) {
  51908. updateMediaSequenceForPlaylist$1({
  51909. playlist,
  51910. mediaSequence: oldPlaylist.mediaSequence + oldPlaylist.segments.length
  51911. });
  51912. playlist.segments[0].discontinuity = true;
  51913. playlist.discontinuityStarts.unshift(0);
  51914. if (!oldPlaylist.segments.length && playlist.timeline > oldPlaylist.timeline || oldPlaylist.segments.length && playlist.timeline > oldPlaylist.segments[oldPlaylist.segments.length - 1].timeline) {
  51915. playlist.discontinuitySequence--;
  51916. }
  51917. return;
  51918. }
  51919. const oldMatchingSegment = oldPlaylist.segments[oldMatchingSegmentIndex];
  51920. if (oldMatchingSegment.discontinuity && !firstNewSegment.discontinuity) {
  51921. firstNewSegment.discontinuity = true;
  51922. playlist.discontinuityStarts.unshift(0);
  51923. playlist.discontinuitySequence--;
  51924. }
  51925. updateMediaSequenceForPlaylist$1({
  51926. playlist,
  51927. mediaSequence: oldPlaylist.segments[oldMatchingSegmentIndex].number
  51928. });
  51929. });
  51930. };
  51931. const positionManifestOnTimeline$1 = ({
  51932. oldManifest,
  51933. newManifest
  51934. }) => {
  51935. const oldPlaylists = oldManifest.playlists.concat(getMediaGroupPlaylists$1(oldManifest));
  51936. const newPlaylists = newManifest.playlists.concat(getMediaGroupPlaylists$1(newManifest));
  51937. newManifest.timelineStarts = getUniqueTimelineStarts$1([oldManifest.timelineStarts, newManifest.timelineStarts]);
  51938. updateSequenceNumbers$1({
  51939. oldPlaylists,
  51940. newPlaylists,
  51941. timelineStarts: newManifest.timelineStarts
  51942. });
  51943. return newManifest;
  51944. };
  51945. const generateSidxKey$1 = (sidx) => sidx && sidx.uri + "-" + byteRangeToString$1(sidx.byterange);
  51946. const mergeDiscontiguousPlaylists$1 = (playlists) => {
  51947. const mergedPlaylists = values$1(playlists.reduce((acc, playlist) => {
  51948. const name = playlist.attributes.id + (playlist.attributes.lang || "");
  51949. if (!acc[name]) {
  51950. acc[name] = playlist;
  51951. acc[name].attributes.timelineStarts = [];
  51952. } else {
  51953. if (playlist.segments) {
  51954. if (playlist.segments[0]) {
  51955. playlist.segments[0].discontinuity = true;
  51956. }
  51957. acc[name].segments.push(...playlist.segments);
  51958. }
  51959. if (playlist.attributes.contentProtection) {
  51960. acc[name].attributes.contentProtection = playlist.attributes.contentProtection;
  51961. }
  51962. }
  51963. acc[name].attributes.timelineStarts.push({
  51964. start: playlist.attributes.periodStart,
  51965. timeline: playlist.attributes.periodStart
  51966. });
  51967. return acc;
  51968. }, {}));
  51969. return mergedPlaylists.map((playlist) => {
  51970. playlist.discontinuityStarts = findIndexes$1(playlist.segments || [], "discontinuity");
  51971. return playlist;
  51972. });
  51973. };
  51974. const addSidxSegmentsToPlaylist$2 = (playlist, sidxMapping) => {
  51975. const sidxKey = generateSidxKey$1(playlist.sidx);
  51976. const sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx;
  51977. if (sidxMatch) {
  51978. addSidxSegmentsToPlaylist$1$1(playlist, sidxMatch, playlist.sidx.resolvedUri);
  51979. }
  51980. return playlist;
  51981. };
  51982. const addSidxSegmentsToPlaylists$1 = (playlists, sidxMapping = {}) => {
  51983. if (!Object.keys(sidxMapping).length) {
  51984. return playlists;
  51985. }
  51986. for (const i2 in playlists) {
  51987. playlists[i2] = addSidxSegmentsToPlaylist$2(playlists[i2], sidxMapping);
  51988. }
  51989. return playlists;
  51990. };
  51991. const formatAudioPlaylist$1 = ({
  51992. attributes,
  51993. segments,
  51994. sidx,
  51995. mediaSequence,
  51996. discontinuitySequence,
  51997. discontinuityStarts
  51998. }, isAudioOnly3) => {
  51999. const playlist = {
  52000. attributes: {
  52001. NAME: attributes.id,
  52002. BANDWIDTH: attributes.bandwidth,
  52003. CODECS: attributes.codecs,
  52004. ["PROGRAM-ID"]: 1
  52005. },
  52006. uri: "",
  52007. endList: attributes.type === "static",
  52008. timeline: attributes.periodStart,
  52009. resolvedUri: "",
  52010. targetDuration: attributes.duration,
  52011. discontinuitySequence,
  52012. discontinuityStarts,
  52013. timelineStarts: attributes.timelineStarts,
  52014. mediaSequence,
  52015. segments
  52016. };
  52017. if (attributes.contentProtection) {
  52018. playlist.contentProtection = attributes.contentProtection;
  52019. }
  52020. if (sidx) {
  52021. playlist.sidx = sidx;
  52022. }
  52023. if (isAudioOnly3) {
  52024. playlist.attributes.AUDIO = "audio";
  52025. playlist.attributes.SUBTITLES = "subs";
  52026. }
  52027. return playlist;
  52028. };
  52029. const formatVttPlaylist$1 = ({
  52030. attributes,
  52031. segments,
  52032. mediaSequence,
  52033. discontinuityStarts,
  52034. discontinuitySequence
  52035. }) => {
  52036. if (typeof segments === "undefined") {
  52037. segments = [{
  52038. uri: attributes.baseUrl,
  52039. timeline: attributes.periodStart,
  52040. resolvedUri: attributes.baseUrl || "",
  52041. duration: attributes.sourceDuration,
  52042. number: 0
  52043. }];
  52044. attributes.duration = attributes.sourceDuration;
  52045. }
  52046. const m3u8Attributes = {
  52047. NAME: attributes.id,
  52048. BANDWIDTH: attributes.bandwidth,
  52049. ["PROGRAM-ID"]: 1
  52050. };
  52051. if (attributes.codecs) {
  52052. m3u8Attributes.CODECS = attributes.codecs;
  52053. }
  52054. return {
  52055. attributes: m3u8Attributes,
  52056. uri: "",
  52057. endList: attributes.type === "static",
  52058. timeline: attributes.periodStart,
  52059. resolvedUri: attributes.baseUrl || "",
  52060. targetDuration: attributes.duration,
  52061. timelineStarts: attributes.timelineStarts,
  52062. discontinuityStarts,
  52063. discontinuitySequence,
  52064. mediaSequence,
  52065. segments
  52066. };
  52067. };
  52068. const organizeAudioPlaylists$1 = (playlists, sidxMapping = {}, isAudioOnly3 = false) => {
  52069. let mainPlaylist;
  52070. const formattedPlaylists = playlists.reduce((a, playlist) => {
  52071. const role = playlist.attributes.role && playlist.attributes.role.value || "";
  52072. const language = playlist.attributes.lang || "";
  52073. let label = playlist.attributes.label || "main";
  52074. if (language && !playlist.attributes.label) {
  52075. const roleLabel = role ? ` (${role})` : "";
  52076. label = `${playlist.attributes.lang}${roleLabel}`;
  52077. }
  52078. if (!a[label]) {
  52079. a[label] = {
  52080. language,
  52081. autoselect: true,
  52082. default: role === "main",
  52083. playlists: [],
  52084. uri: ""
  52085. };
  52086. }
  52087. const formatted = addSidxSegmentsToPlaylist$2(formatAudioPlaylist$1(playlist, isAudioOnly3), sidxMapping);
  52088. a[label].playlists.push(formatted);
  52089. if (typeof mainPlaylist === "undefined" && role === "main") {
  52090. mainPlaylist = playlist;
  52091. mainPlaylist.default = true;
  52092. }
  52093. return a;
  52094. }, {});
  52095. if (!mainPlaylist) {
  52096. const firstLabel = Object.keys(formattedPlaylists)[0];
  52097. formattedPlaylists[firstLabel].default = true;
  52098. }
  52099. return formattedPlaylists;
  52100. };
  52101. const organizeVttPlaylists$1 = (playlists, sidxMapping = {}) => {
  52102. return playlists.reduce((a, playlist) => {
  52103. const label = playlist.attributes.label || playlist.attributes.lang || "text";
  52104. if (!a[label]) {
  52105. a[label] = {
  52106. language: label,
  52107. default: false,
  52108. autoselect: false,
  52109. playlists: [],
  52110. uri: ""
  52111. };
  52112. }
  52113. a[label].playlists.push(addSidxSegmentsToPlaylist$2(formatVttPlaylist$1(playlist), sidxMapping));
  52114. return a;
  52115. }, {});
  52116. };
  52117. const organizeCaptionServices$1 = (captionServices) => captionServices.reduce((svcObj, svc) => {
  52118. if (!svc) {
  52119. return svcObj;
  52120. }
  52121. svc.forEach((service) => {
  52122. const {
  52123. channel,
  52124. language
  52125. } = service;
  52126. svcObj[language] = {
  52127. autoselect: false,
  52128. default: false,
  52129. instreamId: channel,
  52130. language
  52131. };
  52132. if (service.hasOwnProperty("aspectRatio")) {
  52133. svcObj[language].aspectRatio = service.aspectRatio;
  52134. }
  52135. if (service.hasOwnProperty("easyReader")) {
  52136. svcObj[language].easyReader = service.easyReader;
  52137. }
  52138. if (service.hasOwnProperty("3D")) {
  52139. svcObj[language]["3D"] = service["3D"];
  52140. }
  52141. });
  52142. return svcObj;
  52143. }, {});
  52144. const formatVideoPlaylist$1 = ({
  52145. attributes,
  52146. segments,
  52147. sidx,
  52148. discontinuityStarts
  52149. }) => {
  52150. const playlist = {
  52151. attributes: {
  52152. NAME: attributes.id,
  52153. AUDIO: "audio",
  52154. SUBTITLES: "subs",
  52155. RESOLUTION: {
  52156. width: attributes.width,
  52157. height: attributes.height
  52158. },
  52159. CODECS: attributes.codecs,
  52160. BANDWIDTH: attributes.bandwidth,
  52161. ["PROGRAM-ID"]: 1
  52162. },
  52163. uri: "",
  52164. endList: attributes.type === "static",
  52165. timeline: attributes.periodStart,
  52166. resolvedUri: "",
  52167. targetDuration: attributes.duration,
  52168. discontinuityStarts,
  52169. timelineStarts: attributes.timelineStarts,
  52170. segments
  52171. };
  52172. if (attributes.frameRate) {
  52173. playlist.attributes["FRAME-RATE"] = attributes.frameRate;
  52174. }
  52175. if (attributes.contentProtection) {
  52176. playlist.contentProtection = attributes.contentProtection;
  52177. }
  52178. if (sidx) {
  52179. playlist.sidx = sidx;
  52180. }
  52181. return playlist;
  52182. };
  52183. const videoOnly$1 = ({
  52184. attributes
  52185. }) => attributes.mimeType === "video/mp4" || attributes.mimeType === "video/webm" || attributes.contentType === "video";
  52186. const audioOnly$1 = ({
  52187. attributes
  52188. }) => attributes.mimeType === "audio/mp4" || attributes.mimeType === "audio/webm" || attributes.contentType === "audio";
  52189. const vttOnly$1 = ({
  52190. attributes
  52191. }) => attributes.mimeType === "text/vtt" || attributes.contentType === "text";
  52192. const addMediaSequenceValues$1 = (playlists, timelineStarts) => {
  52193. playlists.forEach((playlist) => {
  52194. playlist.mediaSequence = 0;
  52195. playlist.discontinuitySequence = timelineStarts.findIndex(function({
  52196. timeline
  52197. }) {
  52198. return timeline === playlist.timeline;
  52199. });
  52200. if (!playlist.segments) {
  52201. return;
  52202. }
  52203. playlist.segments.forEach((segment, index2) => {
  52204. segment.number = index2;
  52205. });
  52206. });
  52207. };
  52208. const flattenMediaGroupPlaylists$1 = (mediaGroupObject) => {
  52209. if (!mediaGroupObject) {
  52210. return [];
  52211. }
  52212. return Object.keys(mediaGroupObject).reduce((acc, label) => {
  52213. const labelContents = mediaGroupObject[label];
  52214. return acc.concat(labelContents.playlists);
  52215. }, []);
  52216. };
  52217. const toM3u8$1 = ({
  52218. dashPlaylists,
  52219. locations,
  52220. sidxMapping = {},
  52221. previousManifest,
  52222. eventStream
  52223. }) => {
  52224. if (!dashPlaylists.length) {
  52225. return {};
  52226. }
  52227. const {
  52228. sourceDuration: duration5,
  52229. type: type2,
  52230. suggestedPresentationDelay: suggestedPresentationDelay2,
  52231. minimumUpdatePeriod: minimumUpdatePeriod2
  52232. } = dashPlaylists[0].attributes;
  52233. const videoPlaylists = mergeDiscontiguousPlaylists$1(dashPlaylists.filter(videoOnly$1)).map(formatVideoPlaylist$1);
  52234. const audioPlaylists = mergeDiscontiguousPlaylists$1(dashPlaylists.filter(audioOnly$1));
  52235. const vttPlaylists = mergeDiscontiguousPlaylists$1(dashPlaylists.filter(vttOnly$1));
  52236. const captions = dashPlaylists.map((playlist) => playlist.attributes.captionServices).filter(Boolean);
  52237. const manifest = {
  52238. allowCache: true,
  52239. discontinuityStarts: [],
  52240. segments: [],
  52241. endList: true,
  52242. mediaGroups: {
  52243. AUDIO: {},
  52244. VIDEO: {},
  52245. ["CLOSED-CAPTIONS"]: {},
  52246. SUBTITLES: {}
  52247. },
  52248. uri: "",
  52249. duration: duration5,
  52250. playlists: addSidxSegmentsToPlaylists$1(videoPlaylists, sidxMapping)
  52251. };
  52252. if (minimumUpdatePeriod2 >= 0) {
  52253. manifest.minimumUpdatePeriod = minimumUpdatePeriod2 * 1e3;
  52254. }
  52255. if (locations) {
  52256. manifest.locations = locations;
  52257. }
  52258. if (type2 === "dynamic") {
  52259. manifest.suggestedPresentationDelay = suggestedPresentationDelay2;
  52260. }
  52261. if (eventStream && eventStream.length > 0) {
  52262. manifest.eventStream = eventStream;
  52263. }
  52264. const isAudioOnly3 = manifest.playlists.length === 0;
  52265. const organizedAudioGroup = audioPlaylists.length ? organizeAudioPlaylists$1(audioPlaylists, sidxMapping, isAudioOnly3) : null;
  52266. const organizedVttGroup = vttPlaylists.length ? organizeVttPlaylists$1(vttPlaylists, sidxMapping) : null;
  52267. const formattedPlaylists = videoPlaylists.concat(flattenMediaGroupPlaylists$1(organizedAudioGroup), flattenMediaGroupPlaylists$1(organizedVttGroup));
  52268. const playlistTimelineStarts = formattedPlaylists.map(({
  52269. timelineStarts
  52270. }) => timelineStarts);
  52271. manifest.timelineStarts = getUniqueTimelineStarts$1(playlistTimelineStarts);
  52272. addMediaSequenceValues$1(formattedPlaylists, manifest.timelineStarts);
  52273. if (organizedAudioGroup) {
  52274. manifest.mediaGroups.AUDIO.audio = organizedAudioGroup;
  52275. }
  52276. if (organizedVttGroup) {
  52277. manifest.mediaGroups.SUBTITLES.subs = organizedVttGroup;
  52278. }
  52279. if (captions.length) {
  52280. manifest.mediaGroups["CLOSED-CAPTIONS"].cc = organizeCaptionServices$1(captions);
  52281. }
  52282. if (previousManifest) {
  52283. return positionManifestOnTimeline$1({
  52284. oldManifest: previousManifest,
  52285. newManifest: manifest
  52286. });
  52287. }
  52288. return manifest;
  52289. };
  52290. const getLiveRValue$1 = (attributes, time, duration5) => {
  52291. const {
  52292. NOW,
  52293. clientOffset,
  52294. availabilityStartTime: availabilityStartTime2,
  52295. timescale: timescale2 = 1,
  52296. periodStart = 0,
  52297. minimumUpdatePeriod: minimumUpdatePeriod2 = 0
  52298. } = attributes;
  52299. const now2 = (NOW + clientOffset) / 1e3;
  52300. const periodStartWC = availabilityStartTime2 + periodStart;
  52301. const periodEndWC = now2 + minimumUpdatePeriod2;
  52302. const periodDuration = periodEndWC - periodStartWC;
  52303. return Math.ceil((periodDuration * timescale2 - time) / duration5);
  52304. };
  52305. const parseByTimeline$1 = (attributes, segmentTimeline) => {
  52306. const {
  52307. type: type2,
  52308. minimumUpdatePeriod: minimumUpdatePeriod2 = 0,
  52309. media = "",
  52310. sourceDuration,
  52311. timescale: timescale2 = 1,
  52312. startNumber: startNumber2 = 1,
  52313. periodStart: timeline
  52314. } = attributes;
  52315. const segments = [];
  52316. let time = -1;
  52317. for (let sIndex = 0; sIndex < segmentTimeline.length; sIndex++) {
  52318. const S = segmentTimeline[sIndex];
  52319. const duration5 = S.d;
  52320. const repeat = S.r || 0;
  52321. const segmentTime = S.t || 0;
  52322. if (time < 0) {
  52323. time = segmentTime;
  52324. }
  52325. if (segmentTime && segmentTime > time) {
  52326. time = segmentTime;
  52327. }
  52328. let count;
  52329. if (repeat < 0) {
  52330. const nextS = sIndex + 1;
  52331. if (nextS === segmentTimeline.length) {
  52332. if (type2 === "dynamic" && minimumUpdatePeriod2 > 0 && media.indexOf("$Number$") > 0) {
  52333. count = getLiveRValue$1(attributes, time, duration5);
  52334. } else {
  52335. count = (sourceDuration * timescale2 - time) / duration5;
  52336. }
  52337. } else {
  52338. count = (segmentTimeline[nextS].t - time) / duration5;
  52339. }
  52340. } else {
  52341. count = repeat + 1;
  52342. }
  52343. const end = startNumber2 + segments.length + count;
  52344. let number = startNumber2 + segments.length;
  52345. while (number < end) {
  52346. segments.push({
  52347. number,
  52348. duration: duration5 / timescale2,
  52349. time,
  52350. timeline
  52351. });
  52352. time += duration5;
  52353. number++;
  52354. }
  52355. }
  52356. return segments;
  52357. };
  52358. const identifierPattern$1 = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g;
  52359. const identifierReplacement$1 = (values3) => (match, identifier, format, width2) => {
  52360. if (match === "$$") {
  52361. return "$";
  52362. }
  52363. if (typeof values3[identifier] === "undefined") {
  52364. return match;
  52365. }
  52366. const value = "" + values3[identifier];
  52367. if (identifier === "RepresentationID") {
  52368. return value;
  52369. }
  52370. if (!format) {
  52371. width2 = 1;
  52372. } else {
  52373. width2 = parseInt(width2, 10);
  52374. }
  52375. if (value.length >= width2) {
  52376. return value;
  52377. }
  52378. return `${new Array(width2 - value.length + 1).join("0")}${value}`;
  52379. };
  52380. const constructTemplateUrl$1 = (url, values3) => url.replace(identifierPattern$1, identifierReplacement$1(values3));
  52381. const parseTemplateInfo$1 = (attributes, segmentTimeline) => {
  52382. if (!attributes.duration && !segmentTimeline) {
  52383. return [{
  52384. number: attributes.startNumber || 1,
  52385. duration: attributes.sourceDuration,
  52386. time: 0,
  52387. timeline: attributes.periodStart
  52388. }];
  52389. }
  52390. if (attributes.duration) {
  52391. return parseByDuration$1(attributes);
  52392. }
  52393. return parseByTimeline$1(attributes, segmentTimeline);
  52394. };
  52395. const segmentsFromTemplate$1 = (attributes, segmentTimeline) => {
  52396. const templateValues = {
  52397. RepresentationID: attributes.id,
  52398. Bandwidth: attributes.bandwidth || 0
  52399. };
  52400. const {
  52401. initialization = {
  52402. sourceURL: "",
  52403. range: ""
  52404. }
  52405. } = attributes;
  52406. const mapSegment = urlTypeToSegment$1({
  52407. baseUrl: attributes.baseUrl,
  52408. source: constructTemplateUrl$1(initialization.sourceURL, templateValues),
  52409. range: initialization.range
  52410. });
  52411. const segments = parseTemplateInfo$1(attributes, segmentTimeline);
  52412. return segments.map((segment) => {
  52413. templateValues.Number = segment.number;
  52414. templateValues.Time = segment.time;
  52415. const uri = constructTemplateUrl$1(attributes.media || "", templateValues);
  52416. const timescale2 = attributes.timescale || 1;
  52417. const presentationTimeOffset2 = attributes.presentationTimeOffset || 0;
  52418. const presentationTime = attributes.periodStart + (segment.time - presentationTimeOffset2) / timescale2;
  52419. const map = {
  52420. uri,
  52421. timeline: segment.timeline,
  52422. duration: segment.duration,
  52423. resolvedUri: resolveUrl$3(attributes.baseUrl || "", uri),
  52424. map: mapSegment,
  52425. number: segment.number,
  52426. presentationTime
  52427. };
  52428. return map;
  52429. });
  52430. };
  52431. const SegmentURLToSegmentObject$1 = (attributes, segmentUrl) => {
  52432. const {
  52433. baseUrl,
  52434. initialization = {}
  52435. } = attributes;
  52436. const initSegment = urlTypeToSegment$1({
  52437. baseUrl,
  52438. source: initialization.sourceURL,
  52439. range: initialization.range
  52440. });
  52441. const segment = urlTypeToSegment$1({
  52442. baseUrl,
  52443. source: segmentUrl.media,
  52444. range: segmentUrl.mediaRange
  52445. });
  52446. segment.map = initSegment;
  52447. return segment;
  52448. };
  52449. const segmentsFromList$1 = (attributes, segmentTimeline) => {
  52450. const {
  52451. duration: duration5,
  52452. segmentUrls = [],
  52453. periodStart
  52454. } = attributes;
  52455. if (!duration5 && !segmentTimeline || duration5 && segmentTimeline) {
  52456. throw new Error(errors$1.SEGMENT_TIME_UNSPECIFIED);
  52457. }
  52458. const segmentUrlMap = segmentUrls.map((segmentUrlObject) => SegmentURLToSegmentObject$1(attributes, segmentUrlObject));
  52459. let segmentTimeInfo;
  52460. if (duration5) {
  52461. segmentTimeInfo = parseByDuration$1(attributes);
  52462. }
  52463. if (segmentTimeline) {
  52464. segmentTimeInfo = parseByTimeline$1(attributes, segmentTimeline);
  52465. }
  52466. const segments = segmentTimeInfo.map((segmentTime, index2) => {
  52467. if (segmentUrlMap[index2]) {
  52468. const segment = segmentUrlMap[index2];
  52469. const timescale2 = attributes.timescale || 1;
  52470. const presentationTimeOffset2 = attributes.presentationTimeOffset || 0;
  52471. segment.timeline = segmentTime.timeline;
  52472. segment.duration = segmentTime.duration;
  52473. segment.number = segmentTime.number;
  52474. segment.presentationTime = periodStart + (segmentTime.time - presentationTimeOffset2) / timescale2;
  52475. return segment;
  52476. }
  52477. }).filter((segment) => segment);
  52478. return segments;
  52479. };
  52480. const generateSegments$1 = ({
  52481. attributes,
  52482. segmentInfo
  52483. }) => {
  52484. let segmentAttributes;
  52485. let segmentsFn;
  52486. if (segmentInfo.template) {
  52487. segmentsFn = segmentsFromTemplate$1;
  52488. segmentAttributes = merge$3(attributes, segmentInfo.template);
  52489. } else if (segmentInfo.base) {
  52490. segmentsFn = segmentsFromBase$1;
  52491. segmentAttributes = merge$3(attributes, segmentInfo.base);
  52492. } else if (segmentInfo.list) {
  52493. segmentsFn = segmentsFromList$1;
  52494. segmentAttributes = merge$3(attributes, segmentInfo.list);
  52495. }
  52496. const segmentsInfo = {
  52497. attributes
  52498. };
  52499. if (!segmentsFn) {
  52500. return segmentsInfo;
  52501. }
  52502. const segments = segmentsFn(segmentAttributes, segmentInfo.segmentTimeline);
  52503. if (segmentAttributes.duration) {
  52504. const {
  52505. duration: duration5,
  52506. timescale: timescale2 = 1
  52507. } = segmentAttributes;
  52508. segmentAttributes.duration = duration5 / timescale2;
  52509. } else if (segments.length) {
  52510. segmentAttributes.duration = segments.reduce((max2, segment) => {
  52511. return Math.max(max2, Math.ceil(segment.duration));
  52512. }, 0);
  52513. } else {
  52514. segmentAttributes.duration = 0;
  52515. }
  52516. segmentsInfo.attributes = segmentAttributes;
  52517. segmentsInfo.segments = segments;
  52518. if (segmentInfo.base && segmentAttributes.indexRange) {
  52519. segmentsInfo.sidx = segments[0];
  52520. segmentsInfo.segments = [];
  52521. }
  52522. return segmentsInfo;
  52523. };
  52524. const toPlaylists$1 = (representations) => representations.map(generateSegments$1);
  52525. const findChildren$1 = (element, name) => from$1(element.childNodes).filter(({
  52526. tagName
  52527. }) => tagName === name);
  52528. const getContent$1 = (element) => element.textContent.trim();
  52529. const parseDivisionValue$1 = (value) => {
  52530. return parseFloat(value.split("/").reduce((prev, current) => prev / current));
  52531. };
  52532. const parseDuration$1 = (str) => {
  52533. const SECONDS_IN_YEAR = 365 * 24 * 60 * 60;
  52534. const SECONDS_IN_MONTH = 30 * 24 * 60 * 60;
  52535. const SECONDS_IN_DAY = 24 * 60 * 60;
  52536. const SECONDS_IN_HOUR = 60 * 60;
  52537. const SECONDS_IN_MIN = 60;
  52538. const durationRegex = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/;
  52539. const match = durationRegex.exec(str);
  52540. if (!match) {
  52541. return 0;
  52542. }
  52543. const [year, month, day, hour, minute, second] = match.slice(1);
  52544. return parseFloat(year || 0) * SECONDS_IN_YEAR + parseFloat(month || 0) * SECONDS_IN_MONTH + parseFloat(day || 0) * SECONDS_IN_DAY + parseFloat(hour || 0) * SECONDS_IN_HOUR + parseFloat(minute || 0) * SECONDS_IN_MIN + parseFloat(second || 0);
  52545. };
  52546. const parseDate$1 = (str) => {
  52547. const dateRegex = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/;
  52548. if (dateRegex.test(str)) {
  52549. str += "Z";
  52550. }
  52551. return Date.parse(str);
  52552. };
  52553. const parsers$1 = {
  52554. mediaPresentationDuration(value) {
  52555. return parseDuration$1(value);
  52556. },
  52557. availabilityStartTime(value) {
  52558. return parseDate$1(value) / 1e3;
  52559. },
  52560. minimumUpdatePeriod(value) {
  52561. return parseDuration$1(value);
  52562. },
  52563. suggestedPresentationDelay(value) {
  52564. return parseDuration$1(value);
  52565. },
  52566. type(value) {
  52567. return value;
  52568. },
  52569. timeShiftBufferDepth(value) {
  52570. return parseDuration$1(value);
  52571. },
  52572. start(value) {
  52573. return parseDuration$1(value);
  52574. },
  52575. width(value) {
  52576. return parseInt(value, 10);
  52577. },
  52578. height(value) {
  52579. return parseInt(value, 10);
  52580. },
  52581. bandwidth(value) {
  52582. return parseInt(value, 10);
  52583. },
  52584. frameRate(value) {
  52585. return parseDivisionValue$1(value);
  52586. },
  52587. startNumber(value) {
  52588. return parseInt(value, 10);
  52589. },
  52590. timescale(value) {
  52591. return parseInt(value, 10);
  52592. },
  52593. presentationTimeOffset(value) {
  52594. return parseInt(value, 10);
  52595. },
  52596. duration(value) {
  52597. const parsedValue = parseInt(value, 10);
  52598. if (isNaN(parsedValue)) {
  52599. return parseDuration$1(value);
  52600. }
  52601. return parsedValue;
  52602. },
  52603. d(value) {
  52604. return parseInt(value, 10);
  52605. },
  52606. t(value) {
  52607. return parseInt(value, 10);
  52608. },
  52609. r(value) {
  52610. return parseInt(value, 10);
  52611. },
  52612. presentationTime(value) {
  52613. return parseInt(value, 10);
  52614. },
  52615. DEFAULT(value) {
  52616. return value;
  52617. }
  52618. };
  52619. const parseAttributes$2 = (el) => {
  52620. if (!(el && el.attributes)) {
  52621. return {};
  52622. }
  52623. return from$1(el.attributes).reduce((a, e) => {
  52624. const parseFn = parsers$1[e.name] || parsers$1.DEFAULT;
  52625. a[e.name] = parseFn(e.value);
  52626. return a;
  52627. }, {});
  52628. };
  52629. const keySystemsMap$1 = {
  52630. "urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b": "org.w3.clearkey",
  52631. "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": "com.widevine.alpha",
  52632. "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95": "com.microsoft.playready",
  52633. "urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb": "com.adobe.primetime"
  52634. };
  52635. const buildBaseUrls$1 = (referenceUrls, baseUrlElements) => {
  52636. if (!baseUrlElements.length) {
  52637. return referenceUrls;
  52638. }
  52639. return flatten$1(referenceUrls.map(function(reference) {
  52640. return baseUrlElements.map(function(baseUrlElement) {
  52641. return resolveUrl$3(reference, getContent$1(baseUrlElement));
  52642. });
  52643. }));
  52644. };
  52645. const getSegmentInformation$1 = (adaptationSet) => {
  52646. const segmentTemplate = findChildren$1(adaptationSet, "SegmentTemplate")[0];
  52647. const segmentList = findChildren$1(adaptationSet, "SegmentList")[0];
  52648. const segmentUrls = segmentList && findChildren$1(segmentList, "SegmentURL").map((s) => merge$3({
  52649. tag: "SegmentURL"
  52650. }, parseAttributes$2(s)));
  52651. const segmentBase = findChildren$1(adaptationSet, "SegmentBase")[0];
  52652. const segmentTimelineParentNode = segmentList || segmentTemplate;
  52653. const segmentTimeline = segmentTimelineParentNode && findChildren$1(segmentTimelineParentNode, "SegmentTimeline")[0];
  52654. const segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate;
  52655. const segmentInitialization = segmentInitializationParentNode && findChildren$1(segmentInitializationParentNode, "Initialization")[0];
  52656. const template = segmentTemplate && parseAttributes$2(segmentTemplate);
  52657. if (template && segmentInitialization) {
  52658. template.initialization = segmentInitialization && parseAttributes$2(segmentInitialization);
  52659. } else if (template && template.initialization) {
  52660. template.initialization = {
  52661. sourceURL: template.initialization
  52662. };
  52663. }
  52664. const segmentInfo = {
  52665. template,
  52666. segmentTimeline: segmentTimeline && findChildren$1(segmentTimeline, "S").map((s) => parseAttributes$2(s)),
  52667. list: segmentList && merge$3(parseAttributes$2(segmentList), {
  52668. segmentUrls,
  52669. initialization: parseAttributes$2(segmentInitialization)
  52670. }),
  52671. base: segmentBase && merge$3(parseAttributes$2(segmentBase), {
  52672. initialization: parseAttributes$2(segmentInitialization)
  52673. })
  52674. };
  52675. Object.keys(segmentInfo).forEach((key) => {
  52676. if (!segmentInfo[key]) {
  52677. delete segmentInfo[key];
  52678. }
  52679. });
  52680. return segmentInfo;
  52681. };
  52682. const inheritBaseUrls$1 = (adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) => (representation) => {
  52683. const repBaseUrlElements = findChildren$1(representation, "BaseURL");
  52684. const repBaseUrls = buildBaseUrls$1(adaptationSetBaseUrls, repBaseUrlElements);
  52685. const attributes = merge$3(adaptationSetAttributes, parseAttributes$2(representation));
  52686. const representationSegmentInfo = getSegmentInformation$1(representation);
  52687. return repBaseUrls.map((baseUrl) => {
  52688. return {
  52689. segmentInfo: merge$3(adaptationSetSegmentInfo, representationSegmentInfo),
  52690. attributes: merge$3(attributes, {
  52691. baseUrl
  52692. })
  52693. };
  52694. });
  52695. };
  52696. const generateKeySystemInformation$1 = (contentProtectionNodes) => {
  52697. return contentProtectionNodes.reduce((acc, node) => {
  52698. const attributes = parseAttributes$2(node);
  52699. if (attributes.schemeIdUri) {
  52700. attributes.schemeIdUri = attributes.schemeIdUri.toLowerCase();
  52701. }
  52702. const keySystem = keySystemsMap$1[attributes.schemeIdUri];
  52703. if (keySystem) {
  52704. acc[keySystem] = {
  52705. attributes
  52706. };
  52707. const psshNode = findChildren$1(node, "cenc:pssh")[0];
  52708. if (psshNode) {
  52709. const pssh = getContent$1(psshNode);
  52710. acc[keySystem].pssh = pssh && decodeB64ToUint8Array$1(pssh);
  52711. }
  52712. }
  52713. return acc;
  52714. }, {});
  52715. };
  52716. const parseCaptionServiceMetadata$1 = (service) => {
  52717. if (service.schemeIdUri === "urn:scte:dash:cc:cea-608:2015") {
  52718. const values3 = typeof service.value !== "string" ? [] : service.value.split(";");
  52719. return values3.map((value) => {
  52720. let channel;
  52721. let language;
  52722. language = value;
  52723. if (/^CC\d=/.test(value)) {
  52724. [channel, language] = value.split("=");
  52725. } else if (/^CC\d$/.test(value)) {
  52726. channel = value;
  52727. }
  52728. return {
  52729. channel,
  52730. language
  52731. };
  52732. });
  52733. } else if (service.schemeIdUri === "urn:scte:dash:cc:cea-708:2015") {
  52734. const values3 = typeof service.value !== "string" ? [] : service.value.split(";");
  52735. return values3.map((value) => {
  52736. const flags = {
  52737. "channel": void 0,
  52738. "language": void 0,
  52739. "aspectRatio": 1,
  52740. "easyReader": 0,
  52741. "3D": 0
  52742. };
  52743. if (/=/.test(value)) {
  52744. const [channel, opts = ""] = value.split("=");
  52745. flags.channel = channel;
  52746. flags.language = value;
  52747. opts.split(",").forEach((opt) => {
  52748. const [name, val] = opt.split(":");
  52749. if (name === "lang") {
  52750. flags.language = val;
  52751. } else if (name === "er") {
  52752. flags.easyReader = Number(val);
  52753. } else if (name === "war") {
  52754. flags.aspectRatio = Number(val);
  52755. } else if (name === "3D") {
  52756. flags["3D"] = Number(val);
  52757. }
  52758. });
  52759. } else {
  52760. flags.language = value;
  52761. }
  52762. if (flags.channel) {
  52763. flags.channel = "SERVICE" + flags.channel;
  52764. }
  52765. return flags;
  52766. });
  52767. }
  52768. };
  52769. const toEventStream = (period) => {
  52770. return flatten$1(findChildren$1(period.node, "EventStream").map((eventStream) => {
  52771. const eventStreamAttributes = parseAttributes$2(eventStream);
  52772. const schemeIdUri = eventStreamAttributes.schemeIdUri;
  52773. return findChildren$1(eventStream, "Event").map((event2) => {
  52774. const eventAttributes = parseAttributes$2(event2);
  52775. const presentationTime = eventAttributes.presentationTime || 0;
  52776. const timescale2 = eventStreamAttributes.timescale || 1;
  52777. const duration5 = eventAttributes.duration || 0;
  52778. const start2 = presentationTime / timescale2 + period.attributes.start;
  52779. return {
  52780. schemeIdUri,
  52781. value: eventStreamAttributes.value,
  52782. id: eventAttributes.id,
  52783. start: start2,
  52784. end: start2 + duration5 / timescale2,
  52785. messageData: getContent$1(event2) || eventAttributes.messageData,
  52786. contentEncoding: eventStreamAttributes.contentEncoding,
  52787. presentationTimeOffset: eventStreamAttributes.presentationTimeOffset || 0
  52788. };
  52789. });
  52790. }));
  52791. };
  52792. const toRepresentations$1 = (periodAttributes, periodBaseUrls, periodSegmentInfo) => (adaptationSet) => {
  52793. const adaptationSetAttributes = parseAttributes$2(adaptationSet);
  52794. const adaptationSetBaseUrls = buildBaseUrls$1(periodBaseUrls, findChildren$1(adaptationSet, "BaseURL"));
  52795. const role = findChildren$1(adaptationSet, "Role")[0];
  52796. const roleAttributes = {
  52797. role: parseAttributes$2(role)
  52798. };
  52799. let attrs = merge$3(periodAttributes, adaptationSetAttributes, roleAttributes);
  52800. const accessibility = findChildren$1(adaptationSet, "Accessibility")[0];
  52801. const captionServices = parseCaptionServiceMetadata$1(parseAttributes$2(accessibility));
  52802. if (captionServices) {
  52803. attrs = merge$3(attrs, {
  52804. captionServices
  52805. });
  52806. }
  52807. const label = findChildren$1(adaptationSet, "Label")[0];
  52808. if (label && label.childNodes.length) {
  52809. const labelVal = label.childNodes[0].nodeValue.trim();
  52810. attrs = merge$3(attrs, {
  52811. label: labelVal
  52812. });
  52813. }
  52814. const contentProtection = generateKeySystemInformation$1(findChildren$1(adaptationSet, "ContentProtection"));
  52815. if (Object.keys(contentProtection).length) {
  52816. attrs = merge$3(attrs, {
  52817. contentProtection
  52818. });
  52819. }
  52820. const segmentInfo = getSegmentInformation$1(adaptationSet);
  52821. const representations = findChildren$1(adaptationSet, "Representation");
  52822. const adaptationSetSegmentInfo = merge$3(periodSegmentInfo, segmentInfo);
  52823. return flatten$1(representations.map(inheritBaseUrls$1(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo)));
  52824. };
  52825. const toAdaptationSets$1 = (mpdAttributes, mpdBaseUrls) => (period, index2) => {
  52826. const periodBaseUrls = buildBaseUrls$1(mpdBaseUrls, findChildren$1(period.node, "BaseURL"));
  52827. const periodAttributes = merge$3(mpdAttributes, {
  52828. periodStart: period.attributes.start
  52829. });
  52830. if (typeof period.attributes.duration === "number") {
  52831. periodAttributes.periodDuration = period.attributes.duration;
  52832. }
  52833. const adaptationSets = findChildren$1(period.node, "AdaptationSet");
  52834. const periodSegmentInfo = getSegmentInformation$1(period.node);
  52835. return flatten$1(adaptationSets.map(toRepresentations$1(periodAttributes, periodBaseUrls, periodSegmentInfo)));
  52836. };
  52837. const getPeriodStart$1 = ({
  52838. attributes,
  52839. priorPeriodAttributes,
  52840. mpdType
  52841. }) => {
  52842. if (typeof attributes.start === "number") {
  52843. return attributes.start;
  52844. }
  52845. if (priorPeriodAttributes && typeof priorPeriodAttributes.start === "number" && typeof priorPeriodAttributes.duration === "number") {
  52846. return priorPeriodAttributes.start + priorPeriodAttributes.duration;
  52847. }
  52848. if (!priorPeriodAttributes && mpdType === "static") {
  52849. return 0;
  52850. }
  52851. return null;
  52852. };
  52853. const inheritAttributes$1 = (mpd, options2 = {}) => {
  52854. const {
  52855. manifestUri = "",
  52856. NOW = Date.now(),
  52857. clientOffset = 0
  52858. } = options2;
  52859. const periodNodes = findChildren$1(mpd, "Period");
  52860. if (!periodNodes.length) {
  52861. throw new Error(errors$1.INVALID_NUMBER_OF_PERIOD);
  52862. }
  52863. const locations = findChildren$1(mpd, "Location");
  52864. const mpdAttributes = parseAttributes$2(mpd);
  52865. const mpdBaseUrls = buildBaseUrls$1([manifestUri], findChildren$1(mpd, "BaseURL"));
  52866. mpdAttributes.type = mpdAttributes.type || "static";
  52867. mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0;
  52868. mpdAttributes.NOW = NOW;
  52869. mpdAttributes.clientOffset = clientOffset;
  52870. if (locations.length) {
  52871. mpdAttributes.locations = locations.map(getContent$1);
  52872. }
  52873. const periods = [];
  52874. periodNodes.forEach((node, index2) => {
  52875. const attributes = parseAttributes$2(node);
  52876. const priorPeriod = periods[index2 - 1];
  52877. attributes.start = getPeriodStart$1({
  52878. attributes,
  52879. priorPeriodAttributes: priorPeriod ? priorPeriod.attributes : null,
  52880. mpdType: mpdAttributes.type
  52881. });
  52882. periods.push({
  52883. node,
  52884. attributes
  52885. });
  52886. });
  52887. return {
  52888. locations: mpdAttributes.locations,
  52889. representationInfo: flatten$1(periods.map(toAdaptationSets$1(mpdAttributes, mpdBaseUrls))),
  52890. eventStream: flatten$1(periods.map(toEventStream))
  52891. };
  52892. };
  52893. const stringToMpdXml$1 = (manifestString) => {
  52894. if (manifestString === "") {
  52895. throw new Error(errors$1.DASH_EMPTY_MANIFEST);
  52896. }
  52897. const parser2 = new DOMParser();
  52898. let xml;
  52899. let mpd;
  52900. try {
  52901. xml = parser2.parseFromString(manifestString, "application/xml");
  52902. mpd = xml && xml.documentElement.tagName === "MPD" ? xml.documentElement : null;
  52903. } catch (e) {
  52904. }
  52905. if (!mpd || mpd && mpd.getElementsByTagName("parsererror").length > 0) {
  52906. throw new Error(errors$1.DASH_INVALID_XML);
  52907. }
  52908. return mpd;
  52909. };
  52910. const parseUTCTimingScheme$1 = (mpd) => {
  52911. const UTCTimingNode = findChildren$1(mpd, "UTCTiming")[0];
  52912. if (!UTCTimingNode) {
  52913. return null;
  52914. }
  52915. const attributes = parseAttributes$2(UTCTimingNode);
  52916. switch (attributes.schemeIdUri) {
  52917. case "urn:mpeg:dash:utc:http-head:2014":
  52918. case "urn:mpeg:dash:utc:http-head:2012":
  52919. attributes.method = "HEAD";
  52920. break;
  52921. case "urn:mpeg:dash:utc:http-xsdate:2014":
  52922. case "urn:mpeg:dash:utc:http-iso:2014":
  52923. case "urn:mpeg:dash:utc:http-xsdate:2012":
  52924. case "urn:mpeg:dash:utc:http-iso:2012":
  52925. attributes.method = "GET";
  52926. break;
  52927. case "urn:mpeg:dash:utc:direct:2014":
  52928. case "urn:mpeg:dash:utc:direct:2012":
  52929. attributes.method = "DIRECT";
  52930. attributes.value = Date.parse(attributes.value);
  52931. break;
  52932. case "urn:mpeg:dash:utc:http-ntp:2014":
  52933. case "urn:mpeg:dash:utc:ntp:2014":
  52934. case "urn:mpeg:dash:utc:sntp:2014":
  52935. default:
  52936. throw new Error(errors$1.UNSUPPORTED_UTC_TIMING_SCHEME);
  52937. }
  52938. return attributes;
  52939. };
  52940. const parse$1 = (manifestString, options2 = {}) => {
  52941. const parsedManifestInfo = inheritAttributes$1(stringToMpdXml$1(manifestString), options2);
  52942. const playlists = toPlaylists$1(parsedManifestInfo.representationInfo);
  52943. return toM3u8$1({
  52944. dashPlaylists: playlists,
  52945. locations: parsedManifestInfo.locations,
  52946. sidxMapping: options2.sidxMapping,
  52947. previousManifest: options2.previousManifest,
  52948. eventStream: parsedManifestInfo.eventStream
  52949. });
  52950. };
  52951. const parseUTCTiming$1 = (manifestString) => parseUTCTimingScheme$1(stringToMpdXml$1(manifestString));
  52952. var MAX_UINT32$1 = Math.pow(2, 32);
  52953. var getUint64$3 = function(uint8) {
  52954. var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
  52955. var value;
  52956. if (dv.getBigUint64) {
  52957. value = dv.getBigUint64(0);
  52958. if (value < Number.MAX_SAFE_INTEGER) {
  52959. return Number(value);
  52960. }
  52961. return value;
  52962. }
  52963. return dv.getUint32(0) * MAX_UINT32$1 + dv.getUint32(4);
  52964. };
  52965. var numbers$1 = {
  52966. getUint64: getUint64$3,
  52967. MAX_UINT32: MAX_UINT32$1
  52968. };
  52969. var getUint64$2 = numbers$1.getUint64;
  52970. var parseSidx$1 = function(data) {
  52971. var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = {
  52972. version: data[0],
  52973. flags: new Uint8Array(data.subarray(1, 4)),
  52974. references: [],
  52975. referenceId: view.getUint32(4),
  52976. timescale: view.getUint32(8)
  52977. }, i2 = 12;
  52978. if (result.version === 0) {
  52979. result.earliestPresentationTime = view.getUint32(i2);
  52980. result.firstOffset = view.getUint32(i2 + 4);
  52981. i2 += 8;
  52982. } else {
  52983. result.earliestPresentationTime = getUint64$2(data.subarray(i2));
  52984. result.firstOffset = getUint64$2(data.subarray(i2 + 8));
  52985. i2 += 16;
  52986. }
  52987. i2 += 2;
  52988. var referenceCount = view.getUint16(i2);
  52989. i2 += 2;
  52990. for (; referenceCount > 0; i2 += 12, referenceCount--) {
  52991. result.references.push({
  52992. referenceType: (data[i2] & 128) >>> 7,
  52993. referencedSize: view.getUint32(i2) & 2147483647,
  52994. subsegmentDuration: view.getUint32(i2 + 4),
  52995. startsWithSap: !!(data[i2 + 8] & 128),
  52996. sapType: (data[i2 + 8] & 112) >>> 4,
  52997. sapDeltaTime: view.getUint32(i2 + 8) & 268435455
  52998. });
  52999. }
  53000. return result;
  53001. };
  53002. var parseSidx_1$1 = parseSidx$1;
  53003. var ID3$1 = toUint8$1([73, 68, 51]);
  53004. var getId3Size$1 = function getId3Size(bytes, offset) {
  53005. if (offset === void 0) {
  53006. offset = 0;
  53007. }
  53008. bytes = toUint8$1(bytes);
  53009. var flags = bytes[offset + 5];
  53010. var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9];
  53011. var footerPresent = (flags & 16) >> 4;
  53012. if (footerPresent) {
  53013. return returnSize + 20;
  53014. }
  53015. return returnSize + 10;
  53016. };
  53017. var getId3Offset$1 = function getId3Offset(bytes, offset) {
  53018. if (offset === void 0) {
  53019. offset = 0;
  53020. }
  53021. bytes = toUint8$1(bytes);
  53022. if (bytes.length - offset < 10 || !bytesMatch$1(bytes, ID3$1, {
  53023. offset
  53024. })) {
  53025. return offset;
  53026. }
  53027. offset += getId3Size$1(bytes, offset);
  53028. return getId3Offset(bytes, offset);
  53029. };
  53030. var normalizePath$3 = function normalizePath(path) {
  53031. if (typeof path === "string") {
  53032. return stringToBytes$1(path);
  53033. }
  53034. if (typeof path === "number") {
  53035. return path;
  53036. }
  53037. return path;
  53038. };
  53039. var normalizePaths$3 = function normalizePaths(paths) {
  53040. if (!Array.isArray(paths)) {
  53041. return [normalizePath$3(paths)];
  53042. }
  53043. return paths.map(function(p) {
  53044. return normalizePath$3(p);
  53045. });
  53046. };
  53047. var findBox$1 = function findBox(bytes, paths, complete) {
  53048. if (complete === void 0) {
  53049. complete = false;
  53050. }
  53051. paths = normalizePaths$3(paths);
  53052. bytes = toUint8$1(bytes);
  53053. var results = [];
  53054. if (!paths.length) {
  53055. return results;
  53056. }
  53057. var i2 = 0;
  53058. while (i2 < bytes.length) {
  53059. var size = (bytes[i2] << 24 | bytes[i2 + 1] << 16 | bytes[i2 + 2] << 8 | bytes[i2 + 3]) >>> 0;
  53060. var type2 = bytes.subarray(i2 + 4, i2 + 8);
  53061. if (size === 0) {
  53062. break;
  53063. }
  53064. var end = i2 + size;
  53065. if (end > bytes.length) {
  53066. if (complete) {
  53067. break;
  53068. }
  53069. end = bytes.length;
  53070. }
  53071. var data = bytes.subarray(i2 + 8, end);
  53072. if (bytesMatch$1(type2, paths[0])) {
  53073. if (paths.length === 1) {
  53074. results.push(data);
  53075. } else {
  53076. results.push.apply(results, findBox(data, paths.slice(1), complete));
  53077. }
  53078. }
  53079. i2 = end;
  53080. }
  53081. return results;
  53082. };
  53083. var EBML_TAGS$1 = {
  53084. EBML: toUint8$1([26, 69, 223, 163]),
  53085. DocType: toUint8$1([66, 130]),
  53086. Segment: toUint8$1([24, 83, 128, 103]),
  53087. SegmentInfo: toUint8$1([21, 73, 169, 102]),
  53088. Tracks: toUint8$1([22, 84, 174, 107]),
  53089. Track: toUint8$1([174]),
  53090. TrackNumber: toUint8$1([215]),
  53091. DefaultDuration: toUint8$1([35, 227, 131]),
  53092. TrackEntry: toUint8$1([174]),
  53093. TrackType: toUint8$1([131]),
  53094. FlagDefault: toUint8$1([136]),
  53095. CodecID: toUint8$1([134]),
  53096. CodecPrivate: toUint8$1([99, 162]),
  53097. VideoTrack: toUint8$1([224]),
  53098. AudioTrack: toUint8$1([225]),
  53099. Cluster: toUint8$1([31, 67, 182, 117]),
  53100. Timestamp: toUint8$1([231]),
  53101. TimestampScale: toUint8$1([42, 215, 177]),
  53102. BlockGroup: toUint8$1([160]),
  53103. BlockDuration: toUint8$1([155]),
  53104. Block: toUint8$1([161]),
  53105. SimpleBlock: toUint8$1([163])
  53106. };
  53107. var LENGTH_TABLE$1 = [128, 64, 32, 16, 8, 4, 2, 1];
  53108. var getLength$1 = function getLength(byte) {
  53109. var len = 1;
  53110. for (var i2 = 0; i2 < LENGTH_TABLE$1.length; i2++) {
  53111. if (byte & LENGTH_TABLE$1[i2]) {
  53112. break;
  53113. }
  53114. len++;
  53115. }
  53116. return len;
  53117. };
  53118. var getvint$1 = function getvint(bytes, offset, removeLength, signed) {
  53119. if (removeLength === void 0) {
  53120. removeLength = true;
  53121. }
  53122. if (signed === void 0) {
  53123. signed = false;
  53124. }
  53125. var length = getLength$1(bytes[offset]);
  53126. var valueBytes = bytes.subarray(offset, offset + length);
  53127. if (removeLength) {
  53128. valueBytes = Array.prototype.slice.call(bytes, offset, offset + length);
  53129. valueBytes[0] ^= LENGTH_TABLE$1[length - 1];
  53130. }
  53131. return {
  53132. length,
  53133. value: bytesToNumber$1(valueBytes, {
  53134. signed
  53135. }),
  53136. bytes: valueBytes
  53137. };
  53138. };
  53139. var normalizePath$2 = function normalizePath2(path) {
  53140. if (typeof path === "string") {
  53141. return path.match(/.{1,2}/g).map(function(p) {
  53142. return normalizePath2(p);
  53143. });
  53144. }
  53145. if (typeof path === "number") {
  53146. return numberToBytes$1(path);
  53147. }
  53148. return path;
  53149. };
  53150. var normalizePaths$2 = function normalizePaths2(paths) {
  53151. if (!Array.isArray(paths)) {
  53152. return [normalizePath$2(paths)];
  53153. }
  53154. return paths.map(function(p) {
  53155. return normalizePath$2(p);
  53156. });
  53157. };
  53158. var getInfinityDataSize$1 = function getInfinityDataSize(id, bytes, offset) {
  53159. if (offset >= bytes.length) {
  53160. return bytes.length;
  53161. }
  53162. var innerid = getvint$1(bytes, offset, false);
  53163. if (bytesMatch$1(id.bytes, innerid.bytes)) {
  53164. return offset;
  53165. }
  53166. var dataHeader = getvint$1(bytes, offset + innerid.length);
  53167. return getInfinityDataSize(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length);
  53168. };
  53169. var findEbml$1 = function findEbml(bytes, paths) {
  53170. paths = normalizePaths$2(paths);
  53171. bytes = toUint8$1(bytes);
  53172. var results = [];
  53173. if (!paths.length) {
  53174. return results;
  53175. }
  53176. var i2 = 0;
  53177. while (i2 < bytes.length) {
  53178. var id = getvint$1(bytes, i2, false);
  53179. var dataHeader = getvint$1(bytes, i2 + id.length);
  53180. var dataStart = i2 + id.length + dataHeader.length;
  53181. if (dataHeader.value === 127) {
  53182. dataHeader.value = getInfinityDataSize$1(id, bytes, dataStart);
  53183. if (dataHeader.value !== bytes.length) {
  53184. dataHeader.value -= dataStart;
  53185. }
  53186. }
  53187. var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value;
  53188. var data = bytes.subarray(dataStart, dataEnd);
  53189. if (bytesMatch$1(paths[0], id.bytes)) {
  53190. if (paths.length === 1) {
  53191. results.push(data);
  53192. } else {
  53193. results = results.concat(findEbml(data, paths.slice(1)));
  53194. }
  53195. }
  53196. var totalLength = id.length + dataHeader.length + data.length;
  53197. i2 += totalLength;
  53198. }
  53199. return results;
  53200. };
  53201. var NAL_TYPE_ONE$1 = toUint8$1([0, 0, 0, 1]);
  53202. var NAL_TYPE_TWO$1 = toUint8$1([0, 0, 1]);
  53203. var EMULATION_PREVENTION$1 = toUint8$1([0, 0, 3]);
  53204. var discardEmulationPreventionBytes$1 = function discardEmulationPreventionBytes(bytes) {
  53205. var positions = [];
  53206. var i2 = 1;
  53207. while (i2 < bytes.length - 2) {
  53208. if (bytesMatch$1(bytes.subarray(i2, i2 + 3), EMULATION_PREVENTION$1)) {
  53209. positions.push(i2 + 2);
  53210. i2++;
  53211. }
  53212. i2++;
  53213. }
  53214. if (positions.length === 0) {
  53215. return bytes;
  53216. }
  53217. var newLength = bytes.length - positions.length;
  53218. var newData = new Uint8Array(newLength);
  53219. var sourceIndex = 0;
  53220. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  53221. if (sourceIndex === positions[0]) {
  53222. sourceIndex++;
  53223. positions.shift();
  53224. }
  53225. newData[i2] = bytes[sourceIndex];
  53226. }
  53227. return newData;
  53228. };
  53229. var findNal$1 = function findNal(bytes, dataType, types, nalLimit) {
  53230. if (nalLimit === void 0) {
  53231. nalLimit = Infinity;
  53232. }
  53233. bytes = toUint8$1(bytes);
  53234. types = [].concat(types);
  53235. var i2 = 0;
  53236. var nalStart;
  53237. var nalsFound = 0;
  53238. while (i2 < bytes.length && (nalsFound < nalLimit || nalStart)) {
  53239. var nalOffset = void 0;
  53240. if (bytesMatch$1(bytes.subarray(i2), NAL_TYPE_ONE$1)) {
  53241. nalOffset = 4;
  53242. } else if (bytesMatch$1(bytes.subarray(i2), NAL_TYPE_TWO$1)) {
  53243. nalOffset = 3;
  53244. }
  53245. if (!nalOffset) {
  53246. i2++;
  53247. continue;
  53248. }
  53249. nalsFound++;
  53250. if (nalStart) {
  53251. return discardEmulationPreventionBytes$1(bytes.subarray(nalStart, i2));
  53252. }
  53253. var nalType = void 0;
  53254. if (dataType === "h264") {
  53255. nalType = bytes[i2 + nalOffset] & 31;
  53256. } else if (dataType === "h265") {
  53257. nalType = bytes[i2 + nalOffset] >> 1 & 63;
  53258. }
  53259. if (types.indexOf(nalType) !== -1) {
  53260. nalStart = i2 + nalOffset;
  53261. }
  53262. i2 += nalOffset + (dataType === "h264" ? 1 : 2);
  53263. }
  53264. return bytes.subarray(0, 0);
  53265. };
  53266. var findH264Nal$1 = function findH264Nal(bytes, type2, nalLimit) {
  53267. return findNal$1(bytes, "h264", type2, nalLimit);
  53268. };
  53269. var findH265Nal$1 = function findH265Nal(bytes, type2, nalLimit) {
  53270. return findNal$1(bytes, "h265", type2, nalLimit);
  53271. };
  53272. var CONSTANTS$1 = {
  53273. "webm": toUint8$1([119, 101, 98, 109]),
  53274. "matroska": toUint8$1([109, 97, 116, 114, 111, 115, 107, 97]),
  53275. "flac": toUint8$1([102, 76, 97, 67]),
  53276. "ogg": toUint8$1([79, 103, 103, 83]),
  53277. "ac3": toUint8$1([11, 119]),
  53278. "riff": toUint8$1([82, 73, 70, 70]),
  53279. "avi": toUint8$1([65, 86, 73]),
  53280. "wav": toUint8$1([87, 65, 86, 69]),
  53281. "3gp": toUint8$1([102, 116, 121, 112, 51, 103]),
  53282. "mp4": toUint8$1([102, 116, 121, 112]),
  53283. "fmp4": toUint8$1([115, 116, 121, 112]),
  53284. "mov": toUint8$1([102, 116, 121, 112, 113, 116]),
  53285. "moov": toUint8$1([109, 111, 111, 118]),
  53286. "moof": toUint8$1([109, 111, 111, 102])
  53287. };
  53288. var _isLikely$1 = {
  53289. aac: function aac(bytes) {
  53290. var offset = getId3Offset$1(bytes);
  53291. return bytesMatch$1(bytes, [255, 16], {
  53292. offset,
  53293. mask: [255, 22]
  53294. });
  53295. },
  53296. mp3: function mp3(bytes) {
  53297. var offset = getId3Offset$1(bytes);
  53298. return bytesMatch$1(bytes, [255, 2], {
  53299. offset,
  53300. mask: [255, 6]
  53301. });
  53302. },
  53303. webm: function webm(bytes) {
  53304. var docType = findEbml$1(bytes, [EBML_TAGS$1.EBML, EBML_TAGS$1.DocType])[0];
  53305. return bytesMatch$1(docType, CONSTANTS$1.webm);
  53306. },
  53307. mkv: function mkv(bytes) {
  53308. var docType = findEbml$1(bytes, [EBML_TAGS$1.EBML, EBML_TAGS$1.DocType])[0];
  53309. return bytesMatch$1(docType, CONSTANTS$1.matroska);
  53310. },
  53311. mp4: function mp4(bytes) {
  53312. if (_isLikely$1["3gp"](bytes) || _isLikely$1.mov(bytes)) {
  53313. return false;
  53314. }
  53315. if (bytesMatch$1(bytes, CONSTANTS$1.mp4, {
  53316. offset: 4
  53317. }) || bytesMatch$1(bytes, CONSTANTS$1.fmp4, {
  53318. offset: 4
  53319. })) {
  53320. return true;
  53321. }
  53322. if (bytesMatch$1(bytes, CONSTANTS$1.moof, {
  53323. offset: 4
  53324. }) || bytesMatch$1(bytes, CONSTANTS$1.moov, {
  53325. offset: 4
  53326. })) {
  53327. return true;
  53328. }
  53329. },
  53330. mov: function mov(bytes) {
  53331. return bytesMatch$1(bytes, CONSTANTS$1.mov, {
  53332. offset: 4
  53333. });
  53334. },
  53335. "3gp": function gp(bytes) {
  53336. return bytesMatch$1(bytes, CONSTANTS$1["3gp"], {
  53337. offset: 4
  53338. });
  53339. },
  53340. ac3: function ac3(bytes) {
  53341. var offset = getId3Offset$1(bytes);
  53342. return bytesMatch$1(bytes, CONSTANTS$1.ac3, {
  53343. offset
  53344. });
  53345. },
  53346. ts: function ts(bytes) {
  53347. if (bytes.length < 189 && bytes.length >= 1) {
  53348. return bytes[0] === 71;
  53349. }
  53350. var i2 = 0;
  53351. while (i2 + 188 < bytes.length && i2 < 188) {
  53352. if (bytes[i2] === 71 && bytes[i2 + 188] === 71) {
  53353. return true;
  53354. }
  53355. i2 += 1;
  53356. }
  53357. return false;
  53358. },
  53359. flac: function flac(bytes) {
  53360. var offset = getId3Offset$1(bytes);
  53361. return bytesMatch$1(bytes, CONSTANTS$1.flac, {
  53362. offset
  53363. });
  53364. },
  53365. ogg: function ogg(bytes) {
  53366. return bytesMatch$1(bytes, CONSTANTS$1.ogg);
  53367. },
  53368. avi: function avi(bytes) {
  53369. return bytesMatch$1(bytes, CONSTANTS$1.riff) && bytesMatch$1(bytes, CONSTANTS$1.avi, {
  53370. offset: 8
  53371. });
  53372. },
  53373. wav: function wav(bytes) {
  53374. return bytesMatch$1(bytes, CONSTANTS$1.riff) && bytesMatch$1(bytes, CONSTANTS$1.wav, {
  53375. offset: 8
  53376. });
  53377. },
  53378. "h264": function h264(bytes) {
  53379. return findH264Nal$1(bytes, 7, 3).length;
  53380. },
  53381. "h265": function h265(bytes) {
  53382. return findH265Nal$1(bytes, [32, 33], 3).length;
  53383. }
  53384. };
  53385. var isLikelyTypes$1 = Object.keys(_isLikely$1).filter(function(t2) {
  53386. return t2 !== "ts" && t2 !== "h264" && t2 !== "h265";
  53387. }).concat(["ts", "h264", "h265"]);
  53388. isLikelyTypes$1.forEach(function(type2) {
  53389. var isLikelyFn = _isLikely$1[type2];
  53390. _isLikely$1[type2] = function(bytes) {
  53391. return isLikelyFn(toUint8$1(bytes));
  53392. };
  53393. });
  53394. var isLikely$1 = _isLikely$1;
  53395. var detectContainerForBytes$1 = function detectContainerForBytes(bytes) {
  53396. bytes = toUint8$1(bytes);
  53397. for (var i2 = 0; i2 < isLikelyTypes$1.length; i2++) {
  53398. var type2 = isLikelyTypes$1[i2];
  53399. if (isLikely$1[type2](bytes)) {
  53400. return type2;
  53401. }
  53402. }
  53403. return "";
  53404. };
  53405. var isLikelyFmp4MediaSegment$1 = function isLikelyFmp4MediaSegment(bytes) {
  53406. return findBox$1(bytes, ["moof"]).length > 0;
  53407. };
  53408. var ONE_SECOND_IN_TS$1 = 9e4, secondsToVideoTs$1, secondsToAudioTs$1, videoTsToSeconds$1, audioTsToSeconds$1, audioTsToVideoTs$1, videoTsToAudioTs$1, metadataTsToSeconds$1;
  53409. secondsToVideoTs$1 = function(seconds) {
  53410. return seconds * ONE_SECOND_IN_TS$1;
  53411. };
  53412. secondsToAudioTs$1 = function(seconds, sampleRate) {
  53413. return seconds * sampleRate;
  53414. };
  53415. videoTsToSeconds$1 = function(timestamp) {
  53416. return timestamp / ONE_SECOND_IN_TS$1;
  53417. };
  53418. audioTsToSeconds$1 = function(timestamp, sampleRate) {
  53419. return timestamp / sampleRate;
  53420. };
  53421. audioTsToVideoTs$1 = function(timestamp, sampleRate) {
  53422. return secondsToVideoTs$1(audioTsToSeconds$1(timestamp, sampleRate));
  53423. };
  53424. videoTsToAudioTs$1 = function(timestamp, sampleRate) {
  53425. return secondsToAudioTs$1(videoTsToSeconds$1(timestamp), sampleRate);
  53426. };
  53427. metadataTsToSeconds$1 = function(timestamp, timelineStartPts, keepOriginalTimestamps) {
  53428. return videoTsToSeconds$1(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);
  53429. };
  53430. var clock$1 = {
  53431. ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$1,
  53432. secondsToVideoTs: secondsToVideoTs$1,
  53433. secondsToAudioTs: secondsToAudioTs$1,
  53434. videoTsToSeconds: videoTsToSeconds$1,
  53435. audioTsToSeconds: audioTsToSeconds$1,
  53436. audioTsToVideoTs: audioTsToVideoTs$1,
  53437. videoTsToAudioTs: videoTsToAudioTs$1,
  53438. metadataTsToSeconds: metadataTsToSeconds$1
  53439. };
  53440. /**
  53441. * @license
  53442. * Video.js 8.3.0 <http://videojs.com/>
  53443. * Copyright Brightcove, Inc. <https://www.brightcove.com/>
  53444. * Available under Apache License Version 2.0
  53445. * <https://github.com/videojs/video.js/blob/main/LICENSE>
  53446. *
  53447. * Includes vtt.js <https://github.com/mozilla/vtt.js>
  53448. * Available under Apache License Version 2.0
  53449. * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
  53450. */
  53451. var version$6$1 = "8.3.0";
  53452. const hooks_$1 = {};
  53453. const hooks$1 = function(type2, fn2) {
  53454. hooks_$1[type2] = hooks_$1[type2] || [];
  53455. if (fn2) {
  53456. hooks_$1[type2] = hooks_$1[type2].concat(fn2);
  53457. }
  53458. return hooks_$1[type2];
  53459. };
  53460. const hook$1 = function(type2, fn2) {
  53461. hooks$1(type2, fn2);
  53462. };
  53463. const removeHook$1 = function(type2, fn2) {
  53464. const index2 = hooks$1(type2).indexOf(fn2);
  53465. if (index2 <= -1) {
  53466. return false;
  53467. }
  53468. hooks_$1[type2] = hooks_$1[type2].slice();
  53469. hooks_$1[type2].splice(index2, 1);
  53470. return true;
  53471. };
  53472. const hookOnce$1 = function(type2, fn2) {
  53473. hooks$1(type2, [].concat(fn2).map((original) => {
  53474. const wrapper = (...args) => {
  53475. removeHook$1(type2, wrapper);
  53476. return original(...args);
  53477. };
  53478. return wrapper;
  53479. }));
  53480. };
  53481. const FullscreenApi$1 = {
  53482. prefixed: true
  53483. };
  53484. const apiMap$1 = [
  53485. ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror", "fullscreen"],
  53486. ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror", "-webkit-full-screen"],
  53487. ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror", "-moz-full-screen"],
  53488. ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError", "-ms-fullscreen"]
  53489. ];
  53490. const specApi$1 = apiMap$1[0];
  53491. let browserApi$1;
  53492. for (let i2 = 0; i2 < apiMap$1.length; i2++) {
  53493. if (apiMap$1[i2][1] in document_1) {
  53494. browserApi$1 = apiMap$1[i2];
  53495. break;
  53496. }
  53497. }
  53498. if (browserApi$1) {
  53499. for (let i2 = 0; i2 < browserApi$1.length; i2++) {
  53500. FullscreenApi$1[specApi$1[i2]] = browserApi$1[i2];
  53501. }
  53502. FullscreenApi$1.prefixed = browserApi$1[0] !== specApi$1[0];
  53503. }
  53504. let history$1 = [];
  53505. const LogByTypeFactory$1 = (name, log2) => (type2, level, args) => {
  53506. const lvl = log2.levels[level];
  53507. const lvlRegExp = new RegExp(`^(${lvl})$`);
  53508. if (type2 !== "log") {
  53509. args.unshift(type2.toUpperCase() + ":");
  53510. }
  53511. args.unshift(name + ":");
  53512. if (history$1) {
  53513. history$1.push([].concat(args));
  53514. const splice2 = history$1.length - 1e3;
  53515. history$1.splice(0, splice2 > 0 ? splice2 : 0);
  53516. }
  53517. if (!window_1.console) {
  53518. return;
  53519. }
  53520. let fn2 = window_1.console[type2];
  53521. if (!fn2 && type2 === "debug") {
  53522. fn2 = window_1.console.info || window_1.console.log;
  53523. }
  53524. if (!fn2 || !lvl || !lvlRegExp.test(type2)) {
  53525. return;
  53526. }
  53527. fn2[Array.isArray(args) ? "apply" : "call"](window_1.console, args);
  53528. };
  53529. function createLogger$1$1(name) {
  53530. let level = "info";
  53531. let logByType;
  53532. const log2 = function(...args) {
  53533. logByType("log", level, args);
  53534. };
  53535. logByType = LogByTypeFactory$1(name, log2);
  53536. log2.createLogger = (subname) => createLogger$1$1(name + ": " + subname);
  53537. log2.levels = {
  53538. all: "debug|log|warn|error",
  53539. off: "",
  53540. debug: "debug|log|warn|error",
  53541. info: "log|warn|error",
  53542. warn: "warn|error",
  53543. error: "error",
  53544. DEFAULT: level
  53545. };
  53546. log2.level = (lvl) => {
  53547. if (typeof lvl === "string") {
  53548. if (!log2.levels.hasOwnProperty(lvl)) {
  53549. throw new Error(`"${lvl}" in not a valid log level`);
  53550. }
  53551. level = lvl;
  53552. }
  53553. return level;
  53554. };
  53555. log2.history = () => history$1 ? [].concat(history$1) : [];
  53556. log2.history.filter = (fname) => {
  53557. return (history$1 || []).filter((historyItem) => {
  53558. return new RegExp(`.*${fname}.*`).test(historyItem[0]);
  53559. });
  53560. };
  53561. log2.history.clear = () => {
  53562. if (history$1) {
  53563. history$1.length = 0;
  53564. }
  53565. };
  53566. log2.history.disable = () => {
  53567. if (history$1 !== null) {
  53568. history$1.length = 0;
  53569. history$1 = null;
  53570. }
  53571. };
  53572. log2.history.enable = () => {
  53573. if (history$1 === null) {
  53574. history$1 = [];
  53575. }
  53576. };
  53577. log2.error = (...args) => logByType("error", level, args);
  53578. log2.warn = (...args) => logByType("warn", level, args);
  53579. log2.debug = (...args) => logByType("debug", level, args);
  53580. return log2;
  53581. }
  53582. const log$1$1 = createLogger$1$1("VIDEOJS");
  53583. const createLogger$2 = log$1$1.createLogger;
  53584. const toString$1 = Object.prototype.toString;
  53585. const keys$1 = function(object) {
  53586. return isObject$2(object) ? Object.keys(object) : [];
  53587. };
  53588. function each$1(object, fn2) {
  53589. keys$1(object).forEach((key) => fn2(object[key], key));
  53590. }
  53591. function reduce$1(object, fn2, initial = 0) {
  53592. return keys$1(object).reduce((accum, key) => fn2(accum, object[key], key), initial);
  53593. }
  53594. function isObject$2(value) {
  53595. return !!value && typeof value === "object";
  53596. }
  53597. function isPlain$1(value) {
  53598. return isObject$2(value) && toString$1.call(value) === "[object Object]" && value.constructor === Object;
  53599. }
  53600. function merge$1(...sources) {
  53601. const result = {};
  53602. sources.forEach((source) => {
  53603. if (!source) {
  53604. return;
  53605. }
  53606. each$1(source, (value, key) => {
  53607. if (!isPlain$1(value)) {
  53608. result[key] = value;
  53609. return;
  53610. }
  53611. if (!isPlain$1(result[key])) {
  53612. result[key] = {};
  53613. }
  53614. result[key] = merge$1(result[key], value);
  53615. });
  53616. });
  53617. return result;
  53618. }
  53619. function defineLazyProperty$1(obj, key, getValue2, setter = true) {
  53620. const set4 = (value) => Object.defineProperty(obj, key, {
  53621. value,
  53622. enumerable: true,
  53623. writable: true
  53624. });
  53625. const options2 = {
  53626. configurable: true,
  53627. enumerable: true,
  53628. get() {
  53629. const value = getValue2();
  53630. set4(value);
  53631. return value;
  53632. }
  53633. };
  53634. if (setter) {
  53635. options2.set = set4;
  53636. }
  53637. return Object.defineProperty(obj, key, options2);
  53638. }
  53639. var Obj = /* @__PURE__ */ Object.freeze({
  53640. __proto__: null,
  53641. each: each$1,
  53642. reduce: reduce$1,
  53643. isObject: isObject$2,
  53644. isPlain: isPlain$1,
  53645. merge: merge$1,
  53646. defineLazyProperty: defineLazyProperty$1
  53647. });
  53648. let IS_IPOD$1 = false;
  53649. let IOS_VERSION$1 = null;
  53650. let IS_ANDROID$1 = false;
  53651. let ANDROID_VERSION$1;
  53652. let IS_FIREFOX$1 = false;
  53653. let IS_EDGE$1 = false;
  53654. let IS_CHROMIUM = false;
  53655. let IS_CHROME$1 = false;
  53656. let CHROMIUM_VERSION = null;
  53657. let CHROME_VERSION$1 = null;
  53658. let IE_VERSION$1 = null;
  53659. let IS_SAFARI$1 = false;
  53660. let IS_WINDOWS$1 = false;
  53661. let IS_IPAD$1 = false;
  53662. let IS_IPHONE$1 = false;
  53663. const TOUCH_ENABLED$1 = Boolean(isReal$1() && ("ontouchstart" in window_1 || window_1.navigator.maxTouchPoints || window_1.DocumentTouch && window_1.document instanceof window_1.DocumentTouch));
  53664. const UAD = window_1.navigator && window_1.navigator.userAgentData;
  53665. if (UAD) {
  53666. IS_ANDROID$1 = UAD.platform === "Android";
  53667. IS_EDGE$1 = Boolean(UAD.brands.find((b) => b.brand === "Microsoft Edge"));
  53668. IS_CHROMIUM = Boolean(UAD.brands.find((b) => b.brand === "Chromium"));
  53669. IS_CHROME$1 = !IS_EDGE$1 && IS_CHROMIUM;
  53670. CHROMIUM_VERSION = CHROME_VERSION$1 = (UAD.brands.find((b) => b.brand === "Chromium") || {}).version || null;
  53671. IS_WINDOWS$1 = UAD.platform === "Windows";
  53672. }
  53673. if (!IS_CHROMIUM) {
  53674. const USER_AGENT2 = window_1.navigator && window_1.navigator.userAgent || "";
  53675. IS_IPOD$1 = /iPod/i.test(USER_AGENT2);
  53676. IOS_VERSION$1 = function() {
  53677. const match = USER_AGENT2.match(/OS (\d+)_/i);
  53678. if (match && match[1]) {
  53679. return match[1];
  53680. }
  53681. return null;
  53682. }();
  53683. IS_ANDROID$1 = /Android/i.test(USER_AGENT2);
  53684. ANDROID_VERSION$1 = function() {
  53685. const match = USER_AGENT2.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
  53686. if (!match) {
  53687. return null;
  53688. }
  53689. const major = match[1] && parseFloat(match[1]);
  53690. const minor = match[2] && parseFloat(match[2]);
  53691. if (major && minor) {
  53692. return parseFloat(match[1] + "." + match[2]);
  53693. } else if (major) {
  53694. return major;
  53695. }
  53696. return null;
  53697. }();
  53698. IS_FIREFOX$1 = /Firefox/i.test(USER_AGENT2);
  53699. IS_EDGE$1 = /Edg/i.test(USER_AGENT2);
  53700. IS_CHROMIUM = /Chrome/i.test(USER_AGENT2) || /CriOS/i.test(USER_AGENT2);
  53701. IS_CHROME$1 = !IS_EDGE$1 && IS_CHROMIUM;
  53702. CHROMIUM_VERSION = CHROME_VERSION$1 = function() {
  53703. const match = USER_AGENT2.match(/(Chrome|CriOS)\/(\d+)/);
  53704. if (match && match[2]) {
  53705. return parseFloat(match[2]);
  53706. }
  53707. return null;
  53708. }();
  53709. IE_VERSION$1 = function() {
  53710. const result = /MSIE\s(\d+)\.\d/.exec(USER_AGENT2);
  53711. let version2 = result && parseFloat(result[1]);
  53712. if (!version2 && /Trident\/7.0/i.test(USER_AGENT2) && /rv:11.0/.test(USER_AGENT2)) {
  53713. version2 = 11;
  53714. }
  53715. return version2;
  53716. }();
  53717. IS_SAFARI$1 = /Safari/i.test(USER_AGENT2) && !IS_CHROME$1 && !IS_ANDROID$1 && !IS_EDGE$1;
  53718. IS_WINDOWS$1 = /Windows/i.test(USER_AGENT2);
  53719. IS_IPAD$1 = /iPad/i.test(USER_AGENT2) || IS_SAFARI$1 && TOUCH_ENABLED$1 && !/iPhone/i.test(USER_AGENT2);
  53720. IS_IPHONE$1 = /iPhone/i.test(USER_AGENT2) && !IS_IPAD$1;
  53721. }
  53722. const IS_IOS$1 = IS_IPHONE$1 || IS_IPAD$1 || IS_IPOD$1;
  53723. const IS_ANY_SAFARI$1 = (IS_SAFARI$1 || IS_IOS$1) && !IS_CHROME$1;
  53724. var browser$1 = /* @__PURE__ */ Object.freeze({
  53725. __proto__: null,
  53726. get IS_IPOD() {
  53727. return IS_IPOD$1;
  53728. },
  53729. get IOS_VERSION() {
  53730. return IOS_VERSION$1;
  53731. },
  53732. get IS_ANDROID() {
  53733. return IS_ANDROID$1;
  53734. },
  53735. get ANDROID_VERSION() {
  53736. return ANDROID_VERSION$1;
  53737. },
  53738. get IS_FIREFOX() {
  53739. return IS_FIREFOX$1;
  53740. },
  53741. get IS_EDGE() {
  53742. return IS_EDGE$1;
  53743. },
  53744. get IS_CHROMIUM() {
  53745. return IS_CHROMIUM;
  53746. },
  53747. get IS_CHROME() {
  53748. return IS_CHROME$1;
  53749. },
  53750. get CHROMIUM_VERSION() {
  53751. return CHROMIUM_VERSION;
  53752. },
  53753. get CHROME_VERSION() {
  53754. return CHROME_VERSION$1;
  53755. },
  53756. get IE_VERSION() {
  53757. return IE_VERSION$1;
  53758. },
  53759. get IS_SAFARI() {
  53760. return IS_SAFARI$1;
  53761. },
  53762. get IS_WINDOWS() {
  53763. return IS_WINDOWS$1;
  53764. },
  53765. get IS_IPAD() {
  53766. return IS_IPAD$1;
  53767. },
  53768. get IS_IPHONE() {
  53769. return IS_IPHONE$1;
  53770. },
  53771. TOUCH_ENABLED: TOUCH_ENABLED$1,
  53772. IS_IOS: IS_IOS$1,
  53773. IS_ANY_SAFARI: IS_ANY_SAFARI$1
  53774. });
  53775. function isNonBlankString$1(str) {
  53776. return typeof str === "string" && Boolean(str.trim());
  53777. }
  53778. function throwIfWhitespace$1(str) {
  53779. if (str.indexOf(" ") >= 0) {
  53780. throw new Error("class has illegal whitespace characters");
  53781. }
  53782. }
  53783. function isReal$1() {
  53784. return document_1 === window_1.document;
  53785. }
  53786. function isEl$1(value) {
  53787. return isObject$2(value) && value.nodeType === 1;
  53788. }
  53789. function isInFrame$1() {
  53790. try {
  53791. return window_1.parent !== window_1.self;
  53792. } catch (x) {
  53793. return true;
  53794. }
  53795. }
  53796. function createQuerier$1(method) {
  53797. return function(selector, context) {
  53798. if (!isNonBlankString$1(selector)) {
  53799. return document_1[method](null);
  53800. }
  53801. if (isNonBlankString$1(context)) {
  53802. context = document_1.querySelector(context);
  53803. }
  53804. const ctx = isEl$1(context) ? context : document_1;
  53805. return ctx[method] && ctx[method](selector);
  53806. };
  53807. }
  53808. function createEl$1(tagName = "div", properties = {}, attributes = {}, content) {
  53809. const el = document_1.createElement(tagName);
  53810. Object.getOwnPropertyNames(properties).forEach(function(propName) {
  53811. const val = properties[propName];
  53812. if (propName === "textContent") {
  53813. textContent$1(el, val);
  53814. } else if (el[propName] !== val || propName === "tabIndex") {
  53815. el[propName] = val;
  53816. }
  53817. });
  53818. Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
  53819. el.setAttribute(attrName, attributes[attrName]);
  53820. });
  53821. if (content) {
  53822. appendContent$1(el, content);
  53823. }
  53824. return el;
  53825. }
  53826. function textContent$1(el, text) {
  53827. if (typeof el.textContent === "undefined") {
  53828. el.innerText = text;
  53829. } else {
  53830. el.textContent = text;
  53831. }
  53832. return el;
  53833. }
  53834. function prependTo$1(child, parent) {
  53835. if (parent.firstChild) {
  53836. parent.insertBefore(child, parent.firstChild);
  53837. } else {
  53838. parent.appendChild(child);
  53839. }
  53840. }
  53841. function hasClass$1(element, classToCheck) {
  53842. throwIfWhitespace$1(classToCheck);
  53843. return element.classList.contains(classToCheck);
  53844. }
  53845. function addClass$1(element, ...classesToAdd) {
  53846. element.classList.add(...classesToAdd.reduce((prev, current) => prev.concat(current.split(/\s+/)), []));
  53847. return element;
  53848. }
  53849. function removeClass$1(element, ...classesToRemove) {
  53850. if (!element) {
  53851. log$1$1.warn("removeClass was called with an element that doesn't exist");
  53852. return null;
  53853. }
  53854. element.classList.remove(...classesToRemove.reduce((prev, current) => prev.concat(current.split(/\s+/)), []));
  53855. return element;
  53856. }
  53857. function toggleClass$1(element, classToToggle, predicate) {
  53858. if (typeof predicate === "function") {
  53859. predicate = predicate(element, classToToggle);
  53860. }
  53861. if (typeof predicate !== "boolean") {
  53862. predicate = void 0;
  53863. }
  53864. classToToggle.split(/\s+/).forEach((className) => element.classList.toggle(className, predicate));
  53865. return element;
  53866. }
  53867. function setAttributes$1(el, attributes) {
  53868. Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
  53869. const attrValue = attributes[attrName];
  53870. if (attrValue === null || typeof attrValue === "undefined" || attrValue === false) {
  53871. el.removeAttribute(attrName);
  53872. } else {
  53873. el.setAttribute(attrName, attrValue === true ? "" : attrValue);
  53874. }
  53875. });
  53876. }
  53877. function getAttributes$1(tag) {
  53878. const obj = {};
  53879. const knownBooleans = ",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";
  53880. if (tag && tag.attributes && tag.attributes.length > 0) {
  53881. const attrs = tag.attributes;
  53882. for (let i2 = attrs.length - 1; i2 >= 0; i2--) {
  53883. const attrName = attrs[i2].name;
  53884. let attrVal = attrs[i2].value;
  53885. if (typeof tag[attrName] === "boolean" || knownBooleans.indexOf("," + attrName + ",") !== -1) {
  53886. attrVal = attrVal !== null ? true : false;
  53887. }
  53888. obj[attrName] = attrVal;
  53889. }
  53890. }
  53891. return obj;
  53892. }
  53893. function getAttribute$1(el, attribute) {
  53894. return el.getAttribute(attribute);
  53895. }
  53896. function setAttribute$1(el, attribute, value) {
  53897. el.setAttribute(attribute, value);
  53898. }
  53899. function removeAttribute$1(el, attribute) {
  53900. el.removeAttribute(attribute);
  53901. }
  53902. function blockTextSelection$1() {
  53903. document_1.body.focus();
  53904. document_1.onselectstart = function() {
  53905. return false;
  53906. };
  53907. }
  53908. function unblockTextSelection$1() {
  53909. document_1.onselectstart = function() {
  53910. return true;
  53911. };
  53912. }
  53913. function getBoundingClientRect$1(el) {
  53914. if (el && el.getBoundingClientRect && el.parentNode) {
  53915. const rect = el.getBoundingClientRect();
  53916. const result = {};
  53917. ["bottom", "height", "left", "right", "top", "width"].forEach((k) => {
  53918. if (rect[k] !== void 0) {
  53919. result[k] = rect[k];
  53920. }
  53921. });
  53922. if (!result.height) {
  53923. result.height = parseFloat(computedStyle$1(el, "height"));
  53924. }
  53925. if (!result.width) {
  53926. result.width = parseFloat(computedStyle$1(el, "width"));
  53927. }
  53928. return result;
  53929. }
  53930. }
  53931. function findPosition$1(el) {
  53932. if (!el || el && !el.offsetParent) {
  53933. return {
  53934. left: 0,
  53935. top: 0,
  53936. width: 0,
  53937. height: 0
  53938. };
  53939. }
  53940. const width2 = el.offsetWidth;
  53941. const height2 = el.offsetHeight;
  53942. let left = 0;
  53943. let top = 0;
  53944. while (el.offsetParent && el !== document_1[FullscreenApi$1.fullscreenElement]) {
  53945. left += el.offsetLeft;
  53946. top += el.offsetTop;
  53947. el = el.offsetParent;
  53948. }
  53949. return {
  53950. left,
  53951. top,
  53952. width: width2,
  53953. height: height2
  53954. };
  53955. }
  53956. function getPointerPosition$1(el, event2) {
  53957. const translated = {
  53958. x: 0,
  53959. y: 0
  53960. };
  53961. if (IS_IOS$1) {
  53962. let item = el;
  53963. while (item && item.nodeName.toLowerCase() !== "html") {
  53964. const transform3 = computedStyle$1(item, "transform");
  53965. if (/^matrix/.test(transform3)) {
  53966. const values3 = transform3.slice(7, -1).split(/,\s/).map(Number);
  53967. translated.x += values3[4];
  53968. translated.y += values3[5];
  53969. } else if (/^matrix3d/.test(transform3)) {
  53970. const values3 = transform3.slice(9, -1).split(/,\s/).map(Number);
  53971. translated.x += values3[12];
  53972. translated.y += values3[13];
  53973. }
  53974. item = item.parentNode;
  53975. }
  53976. }
  53977. const position2 = {};
  53978. const boxTarget = findPosition$1(event2.target);
  53979. const box = findPosition$1(el);
  53980. const boxW = box.width;
  53981. const boxH = box.height;
  53982. let offsetY = event2.offsetY - (box.top - boxTarget.top);
  53983. let offsetX = event2.offsetX - (box.left - boxTarget.left);
  53984. if (event2.changedTouches) {
  53985. offsetX = event2.changedTouches[0].pageX - box.left;
  53986. offsetY = event2.changedTouches[0].pageY + box.top;
  53987. if (IS_IOS$1) {
  53988. offsetX -= translated.x;
  53989. offsetY -= translated.y;
  53990. }
  53991. }
  53992. position2.y = 1 - Math.max(0, Math.min(1, offsetY / boxH));
  53993. position2.x = Math.max(0, Math.min(1, offsetX / boxW));
  53994. return position2;
  53995. }
  53996. function isTextNode$1(value) {
  53997. return isObject$2(value) && value.nodeType === 3;
  53998. }
  53999. function emptyEl$1(el) {
  54000. while (el.firstChild) {
  54001. el.removeChild(el.firstChild);
  54002. }
  54003. return el;
  54004. }
  54005. function normalizeContent$1(content) {
  54006. if (typeof content === "function") {
  54007. content = content();
  54008. }
  54009. return (Array.isArray(content) ? content : [content]).map((value) => {
  54010. if (typeof value === "function") {
  54011. value = value();
  54012. }
  54013. if (isEl$1(value) || isTextNode$1(value)) {
  54014. return value;
  54015. }
  54016. if (typeof value === "string" && /\S/.test(value)) {
  54017. return document_1.createTextNode(value);
  54018. }
  54019. }).filter((value) => value);
  54020. }
  54021. function appendContent$1(el, content) {
  54022. normalizeContent$1(content).forEach((node) => el.appendChild(node));
  54023. return el;
  54024. }
  54025. function insertContent$1(el, content) {
  54026. return appendContent$1(emptyEl$1(el), content);
  54027. }
  54028. function isSingleLeftClick$1(event2) {
  54029. if (event2.button === void 0 && event2.buttons === void 0) {
  54030. return true;
  54031. }
  54032. if (event2.button === 0 && event2.buttons === void 0) {
  54033. return true;
  54034. }
  54035. if (event2.type === "mouseup" && event2.button === 0 && event2.buttons === 0) {
  54036. return true;
  54037. }
  54038. if (event2.button !== 0 || event2.buttons !== 1) {
  54039. return false;
  54040. }
  54041. return true;
  54042. }
  54043. const $$1 = createQuerier$1("querySelector");
  54044. const $$$1 = createQuerier$1("querySelectorAll");
  54045. function computedStyle$1(el, prop) {
  54046. if (!el || !prop) {
  54047. return "";
  54048. }
  54049. if (typeof window_1.getComputedStyle === "function") {
  54050. let computedStyleValue;
  54051. try {
  54052. computedStyleValue = window_1.getComputedStyle(el);
  54053. } catch (e) {
  54054. return "";
  54055. }
  54056. return computedStyleValue ? computedStyleValue.getPropertyValue(prop) || computedStyleValue[prop] : "";
  54057. }
  54058. return "";
  54059. }
  54060. var Dom$2 = /* @__PURE__ */ Object.freeze({
  54061. __proto__: null,
  54062. isReal: isReal$1,
  54063. isEl: isEl$1,
  54064. isInFrame: isInFrame$1,
  54065. createEl: createEl$1,
  54066. textContent: textContent$1,
  54067. prependTo: prependTo$1,
  54068. hasClass: hasClass$1,
  54069. addClass: addClass$1,
  54070. removeClass: removeClass$1,
  54071. toggleClass: toggleClass$1,
  54072. setAttributes: setAttributes$1,
  54073. getAttributes: getAttributes$1,
  54074. getAttribute: getAttribute$1,
  54075. setAttribute: setAttribute$1,
  54076. removeAttribute: removeAttribute$1,
  54077. blockTextSelection: blockTextSelection$1,
  54078. unblockTextSelection: unblockTextSelection$1,
  54079. getBoundingClientRect: getBoundingClientRect$1,
  54080. findPosition: findPosition$1,
  54081. getPointerPosition: getPointerPosition$1,
  54082. isTextNode: isTextNode$1,
  54083. emptyEl: emptyEl$1,
  54084. normalizeContent: normalizeContent$1,
  54085. appendContent: appendContent$1,
  54086. insertContent: insertContent$1,
  54087. isSingleLeftClick: isSingleLeftClick$1,
  54088. $: $$1,
  54089. $$: $$$1,
  54090. computedStyle: computedStyle$1
  54091. });
  54092. let _windowLoaded$1 = false;
  54093. let videojs$1$1;
  54094. const autoSetup$1 = function() {
  54095. if (videojs$1$1.options.autoSetup === false) {
  54096. return;
  54097. }
  54098. const vids = Array.prototype.slice.call(document_1.getElementsByTagName("video"));
  54099. const audios = Array.prototype.slice.call(document_1.getElementsByTagName("audio"));
  54100. const divs = Array.prototype.slice.call(document_1.getElementsByTagName("video-js"));
  54101. const mediaEls = vids.concat(audios, divs);
  54102. if (mediaEls && mediaEls.length > 0) {
  54103. for (let i2 = 0, e = mediaEls.length; i2 < e; i2++) {
  54104. const mediaEl = mediaEls[i2];
  54105. if (mediaEl && mediaEl.getAttribute) {
  54106. if (mediaEl.player === void 0) {
  54107. const options2 = mediaEl.getAttribute("data-setup");
  54108. if (options2 !== null) {
  54109. videojs$1$1(mediaEl);
  54110. }
  54111. }
  54112. } else {
  54113. autoSetupTimeout$1(1);
  54114. break;
  54115. }
  54116. }
  54117. } else if (!_windowLoaded$1) {
  54118. autoSetupTimeout$1(1);
  54119. }
  54120. };
  54121. function autoSetupTimeout$1(wait, vjs) {
  54122. if (!isReal$1()) {
  54123. return;
  54124. }
  54125. if (vjs) {
  54126. videojs$1$1 = vjs;
  54127. }
  54128. window_1.setTimeout(autoSetup$1, wait);
  54129. }
  54130. function setWindowLoaded$1() {
  54131. _windowLoaded$1 = true;
  54132. window_1.removeEventListener("load", setWindowLoaded$1);
  54133. }
  54134. if (isReal$1()) {
  54135. if (document_1.readyState === "complete") {
  54136. setWindowLoaded$1();
  54137. } else {
  54138. window_1.addEventListener("load", setWindowLoaded$1);
  54139. }
  54140. }
  54141. const createStyleElement$1 = function(className) {
  54142. const style = document_1.createElement("style");
  54143. style.className = className;
  54144. return style;
  54145. };
  54146. const setTextContent$1 = function(el, content) {
  54147. if (el.styleSheet) {
  54148. el.styleSheet.cssText = content;
  54149. } else {
  54150. el.textContent = content;
  54151. }
  54152. };
  54153. var DomData$1 = /* @__PURE__ */ new WeakMap();
  54154. const _initialGuid$1 = 3;
  54155. let _guid$1 = _initialGuid$1;
  54156. function newGUID$1() {
  54157. return _guid$1++;
  54158. }
  54159. function _cleanUpEvents$1(elem, type2) {
  54160. if (!DomData$1.has(elem)) {
  54161. return;
  54162. }
  54163. const data = DomData$1.get(elem);
  54164. if (data.handlers[type2].length === 0) {
  54165. delete data.handlers[type2];
  54166. if (elem.removeEventListener) {
  54167. elem.removeEventListener(type2, data.dispatcher, false);
  54168. } else if (elem.detachEvent) {
  54169. elem.detachEvent("on" + type2, data.dispatcher);
  54170. }
  54171. }
  54172. if (Object.getOwnPropertyNames(data.handlers).length <= 0) {
  54173. delete data.handlers;
  54174. delete data.dispatcher;
  54175. delete data.disabled;
  54176. }
  54177. if (Object.getOwnPropertyNames(data).length === 0) {
  54178. DomData$1.delete(elem);
  54179. }
  54180. }
  54181. function _handleMultipleEvents$1(fn2, elem, types, callback2) {
  54182. types.forEach(function(type2) {
  54183. fn2(elem, type2, callback2);
  54184. });
  54185. }
  54186. function fixEvent$1(event2) {
  54187. if (event2.fixed_) {
  54188. return event2;
  54189. }
  54190. function returnTrue() {
  54191. return true;
  54192. }
  54193. function returnFalse() {
  54194. return false;
  54195. }
  54196. if (!event2 || !event2.isPropagationStopped || !event2.isImmediatePropagationStopped) {
  54197. const old = event2 || window_1.event;
  54198. event2 = {};
  54199. for (const key in old) {
  54200. if (key !== "layerX" && key !== "layerY" && key !== "keyLocation" && key !== "webkitMovementX" && key !== "webkitMovementY" && key !== "path") {
  54201. if (!(key === "returnValue" && old.preventDefault)) {
  54202. event2[key] = old[key];
  54203. }
  54204. }
  54205. }
  54206. if (!event2.target) {
  54207. event2.target = event2.srcElement || document_1;
  54208. }
  54209. if (!event2.relatedTarget) {
  54210. event2.relatedTarget = event2.fromElement === event2.target ? event2.toElement : event2.fromElement;
  54211. }
  54212. event2.preventDefault = function() {
  54213. if (old.preventDefault) {
  54214. old.preventDefault();
  54215. }
  54216. event2.returnValue = false;
  54217. old.returnValue = false;
  54218. event2.defaultPrevented = true;
  54219. };
  54220. event2.defaultPrevented = false;
  54221. event2.stopPropagation = function() {
  54222. if (old.stopPropagation) {
  54223. old.stopPropagation();
  54224. }
  54225. event2.cancelBubble = true;
  54226. old.cancelBubble = true;
  54227. event2.isPropagationStopped = returnTrue;
  54228. };
  54229. event2.isPropagationStopped = returnFalse;
  54230. event2.stopImmediatePropagation = function() {
  54231. if (old.stopImmediatePropagation) {
  54232. old.stopImmediatePropagation();
  54233. }
  54234. event2.isImmediatePropagationStopped = returnTrue;
  54235. event2.stopPropagation();
  54236. };
  54237. event2.isImmediatePropagationStopped = returnFalse;
  54238. if (event2.clientX !== null && event2.clientX !== void 0) {
  54239. const doc = document_1.documentElement;
  54240. const body = document_1.body;
  54241. event2.pageX = event2.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
  54242. event2.pageY = event2.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
  54243. }
  54244. event2.which = event2.charCode || event2.keyCode;
  54245. if (event2.button !== null && event2.button !== void 0) {
  54246. event2.button = event2.button & 1 ? 0 : event2.button & 4 ? 1 : event2.button & 2 ? 2 : 0;
  54247. }
  54248. }
  54249. event2.fixed_ = true;
  54250. return event2;
  54251. }
  54252. let _supportsPassive$1;
  54253. const supportsPassive$1 = function() {
  54254. if (typeof _supportsPassive$1 !== "boolean") {
  54255. _supportsPassive$1 = false;
  54256. try {
  54257. const opts = Object.defineProperty({}, "passive", {
  54258. get() {
  54259. _supportsPassive$1 = true;
  54260. }
  54261. });
  54262. window_1.addEventListener("test", null, opts);
  54263. window_1.removeEventListener("test", null, opts);
  54264. } catch (e) {
  54265. }
  54266. }
  54267. return _supportsPassive$1;
  54268. };
  54269. const passiveEvents$1 = ["touchstart", "touchmove"];
  54270. function on$1(elem, type2, fn2) {
  54271. if (Array.isArray(type2)) {
  54272. return _handleMultipleEvents$1(on$1, elem, type2, fn2);
  54273. }
  54274. if (!DomData$1.has(elem)) {
  54275. DomData$1.set(elem, {});
  54276. }
  54277. const data = DomData$1.get(elem);
  54278. if (!data.handlers) {
  54279. data.handlers = {};
  54280. }
  54281. if (!data.handlers[type2]) {
  54282. data.handlers[type2] = [];
  54283. }
  54284. if (!fn2.guid) {
  54285. fn2.guid = newGUID$1();
  54286. }
  54287. data.handlers[type2].push(fn2);
  54288. if (!data.dispatcher) {
  54289. data.disabled = false;
  54290. data.dispatcher = function(event2, hash) {
  54291. if (data.disabled) {
  54292. return;
  54293. }
  54294. event2 = fixEvent$1(event2);
  54295. const handlers = data.handlers[event2.type];
  54296. if (handlers) {
  54297. const handlersCopy = handlers.slice(0);
  54298. for (let m = 0, n = handlersCopy.length; m < n; m++) {
  54299. if (event2.isImmediatePropagationStopped()) {
  54300. break;
  54301. } else {
  54302. try {
  54303. handlersCopy[m].call(elem, event2, hash);
  54304. } catch (e) {
  54305. log$1$1.error(e);
  54306. }
  54307. }
  54308. }
  54309. }
  54310. };
  54311. }
  54312. if (data.handlers[type2].length === 1) {
  54313. if (elem.addEventListener) {
  54314. let options2 = false;
  54315. if (supportsPassive$1() && passiveEvents$1.indexOf(type2) > -1) {
  54316. options2 = {
  54317. passive: true
  54318. };
  54319. }
  54320. elem.addEventListener(type2, data.dispatcher, options2);
  54321. } else if (elem.attachEvent) {
  54322. elem.attachEvent("on" + type2, data.dispatcher);
  54323. }
  54324. }
  54325. }
  54326. function off$1(elem, type2, fn2) {
  54327. if (!DomData$1.has(elem)) {
  54328. return;
  54329. }
  54330. const data = DomData$1.get(elem);
  54331. if (!data.handlers) {
  54332. return;
  54333. }
  54334. if (Array.isArray(type2)) {
  54335. return _handleMultipleEvents$1(off$1, elem, type2, fn2);
  54336. }
  54337. const removeType = function(el, t2) {
  54338. data.handlers[t2] = [];
  54339. _cleanUpEvents$1(el, t2);
  54340. };
  54341. if (type2 === void 0) {
  54342. for (const t2 in data.handlers) {
  54343. if (Object.prototype.hasOwnProperty.call(data.handlers || {}, t2)) {
  54344. removeType(elem, t2);
  54345. }
  54346. }
  54347. return;
  54348. }
  54349. const handlers = data.handlers[type2];
  54350. if (!handlers) {
  54351. return;
  54352. }
  54353. if (!fn2) {
  54354. removeType(elem, type2);
  54355. return;
  54356. }
  54357. if (fn2.guid) {
  54358. for (let n = 0; n < handlers.length; n++) {
  54359. if (handlers[n].guid === fn2.guid) {
  54360. handlers.splice(n--, 1);
  54361. }
  54362. }
  54363. }
  54364. _cleanUpEvents$1(elem, type2);
  54365. }
  54366. function trigger$1(elem, event2, hash) {
  54367. const elemData = DomData$1.has(elem) ? DomData$1.get(elem) : {};
  54368. const parent = elem.parentNode || elem.ownerDocument;
  54369. if (typeof event2 === "string") {
  54370. event2 = {
  54371. type: event2,
  54372. target: elem
  54373. };
  54374. } else if (!event2.target) {
  54375. event2.target = elem;
  54376. }
  54377. event2 = fixEvent$1(event2);
  54378. if (elemData.dispatcher) {
  54379. elemData.dispatcher.call(elem, event2, hash);
  54380. }
  54381. if (parent && !event2.isPropagationStopped() && event2.bubbles === true) {
  54382. trigger$1.call(null, parent, event2, hash);
  54383. } else if (!parent && !event2.defaultPrevented && event2.target && event2.target[event2.type]) {
  54384. if (!DomData$1.has(event2.target)) {
  54385. DomData$1.set(event2.target, {});
  54386. }
  54387. const targetData = DomData$1.get(event2.target);
  54388. if (event2.target[event2.type]) {
  54389. targetData.disabled = true;
  54390. if (typeof event2.target[event2.type] === "function") {
  54391. event2.target[event2.type]();
  54392. }
  54393. targetData.disabled = false;
  54394. }
  54395. }
  54396. return !event2.defaultPrevented;
  54397. }
  54398. function one$1(elem, type2, fn2) {
  54399. if (Array.isArray(type2)) {
  54400. return _handleMultipleEvents$1(one$1, elem, type2, fn2);
  54401. }
  54402. const func = function() {
  54403. off$1(elem, type2, func);
  54404. fn2.apply(this, arguments);
  54405. };
  54406. func.guid = fn2.guid = fn2.guid || newGUID$1();
  54407. on$1(elem, type2, func);
  54408. }
  54409. function any$1(elem, type2, fn2) {
  54410. const func = function() {
  54411. off$1(elem, type2, func);
  54412. fn2.apply(this, arguments);
  54413. };
  54414. func.guid = fn2.guid = fn2.guid || newGUID$1();
  54415. on$1(elem, type2, func);
  54416. }
  54417. var Events$1 = /* @__PURE__ */ Object.freeze({
  54418. __proto__: null,
  54419. fixEvent: fixEvent$1,
  54420. on: on$1,
  54421. off: off$1,
  54422. trigger: trigger$1,
  54423. one: one$1,
  54424. any: any$1
  54425. });
  54426. const UPDATE_REFRESH_INTERVAL$1 = 30;
  54427. const bind_ = function(context, fn2, uid) {
  54428. if (!fn2.guid) {
  54429. fn2.guid = newGUID$1();
  54430. }
  54431. const bound = fn2.bind(context);
  54432. bound.guid = uid ? uid + "_" + fn2.guid : fn2.guid;
  54433. return bound;
  54434. };
  54435. const throttle$1 = function(fn2, wait) {
  54436. let last = window_1.performance.now();
  54437. const throttled = function(...args) {
  54438. const now2 = window_1.performance.now();
  54439. if (now2 - last >= wait) {
  54440. fn2(...args);
  54441. last = now2;
  54442. }
  54443. };
  54444. return throttled;
  54445. };
  54446. const debounce$1 = function(func, wait, immediate, context = window_1) {
  54447. let timeout;
  54448. const cancel = () => {
  54449. context.clearTimeout(timeout);
  54450. timeout = null;
  54451. };
  54452. const debounced = function() {
  54453. const self2 = this;
  54454. const args = arguments;
  54455. let later = function() {
  54456. timeout = null;
  54457. later = null;
  54458. if (!immediate) {
  54459. func.apply(self2, args);
  54460. }
  54461. };
  54462. if (!timeout && immediate) {
  54463. func.apply(self2, args);
  54464. }
  54465. context.clearTimeout(timeout);
  54466. timeout = context.setTimeout(later, wait);
  54467. };
  54468. debounced.cancel = cancel;
  54469. return debounced;
  54470. };
  54471. var Fn = /* @__PURE__ */ Object.freeze({
  54472. __proto__: null,
  54473. UPDATE_REFRESH_INTERVAL: UPDATE_REFRESH_INTERVAL$1,
  54474. bind_,
  54475. throttle: throttle$1,
  54476. debounce: debounce$1
  54477. });
  54478. let EVENT_MAP$1;
  54479. class EventTarget$2$1 {
  54480. on(type2, fn2) {
  54481. const ael = this.addEventListener;
  54482. this.addEventListener = () => {
  54483. };
  54484. on$1(this, type2, fn2);
  54485. this.addEventListener = ael;
  54486. }
  54487. off(type2, fn2) {
  54488. off$1(this, type2, fn2);
  54489. }
  54490. one(type2, fn2) {
  54491. const ael = this.addEventListener;
  54492. this.addEventListener = () => {
  54493. };
  54494. one$1(this, type2, fn2);
  54495. this.addEventListener = ael;
  54496. }
  54497. any(type2, fn2) {
  54498. const ael = this.addEventListener;
  54499. this.addEventListener = () => {
  54500. };
  54501. any$1(this, type2, fn2);
  54502. this.addEventListener = ael;
  54503. }
  54504. trigger(event2) {
  54505. const type2 = event2.type || event2;
  54506. if (typeof event2 === "string") {
  54507. event2 = {
  54508. type: type2
  54509. };
  54510. }
  54511. event2 = fixEvent$1(event2);
  54512. if (this.allowedEvents_[type2] && this["on" + type2]) {
  54513. this["on" + type2](event2);
  54514. }
  54515. trigger$1(this, event2);
  54516. }
  54517. queueTrigger(event2) {
  54518. if (!EVENT_MAP$1) {
  54519. EVENT_MAP$1 = /* @__PURE__ */ new Map();
  54520. }
  54521. const type2 = event2.type || event2;
  54522. let map = EVENT_MAP$1.get(this);
  54523. if (!map) {
  54524. map = /* @__PURE__ */ new Map();
  54525. EVENT_MAP$1.set(this, map);
  54526. }
  54527. const oldTimeout = map.get(type2);
  54528. map.delete(type2);
  54529. window_1.clearTimeout(oldTimeout);
  54530. const timeout = window_1.setTimeout(() => {
  54531. map.delete(type2);
  54532. if (map.size === 0) {
  54533. map = null;
  54534. EVENT_MAP$1.delete(this);
  54535. }
  54536. this.trigger(event2);
  54537. }, 0);
  54538. map.set(type2, timeout);
  54539. }
  54540. }
  54541. EventTarget$2$1.prototype.allowedEvents_ = {};
  54542. EventTarget$2$1.prototype.addEventListener = EventTarget$2$1.prototype.on;
  54543. EventTarget$2$1.prototype.removeEventListener = EventTarget$2$1.prototype.off;
  54544. EventTarget$2$1.prototype.dispatchEvent = EventTarget$2$1.prototype.trigger;
  54545. const objName$1 = (obj) => {
  54546. if (typeof obj.name === "function") {
  54547. return obj.name();
  54548. }
  54549. if (typeof obj.name === "string") {
  54550. return obj.name;
  54551. }
  54552. if (obj.name_) {
  54553. return obj.name_;
  54554. }
  54555. if (obj.constructor && obj.constructor.name) {
  54556. return obj.constructor.name;
  54557. }
  54558. return typeof obj;
  54559. };
  54560. const isEvented$1 = (object) => object instanceof EventTarget$2$1 || !!object.eventBusEl_ && ["on", "one", "off", "trigger"].every((k) => typeof object[k] === "function");
  54561. const addEventedCallback$1 = (target, callback2) => {
  54562. if (isEvented$1(target)) {
  54563. callback2();
  54564. } else {
  54565. if (!target.eventedCallbacks) {
  54566. target.eventedCallbacks = [];
  54567. }
  54568. target.eventedCallbacks.push(callback2);
  54569. }
  54570. };
  54571. const isValidEventType$1 = (type2) => typeof type2 === "string" && /\S/.test(type2) || Array.isArray(type2) && !!type2.length;
  54572. const validateTarget$1 = (target, obj, fnName) => {
  54573. if (!target || !target.nodeName && !isEvented$1(target)) {
  54574. throw new Error(`Invalid target for ${objName$1(obj)}#${fnName}; must be a DOM node or evented object.`);
  54575. }
  54576. };
  54577. const validateEventType$1 = (type2, obj, fnName) => {
  54578. if (!isValidEventType$1(type2)) {
  54579. throw new Error(`Invalid event type for ${objName$1(obj)}#${fnName}; must be a non-empty string or array.`);
  54580. }
  54581. };
  54582. const validateListener$1 = (listener, obj, fnName) => {
  54583. if (typeof listener !== "function") {
  54584. throw new Error(`Invalid listener for ${objName$1(obj)}#${fnName}; must be a function.`);
  54585. }
  54586. };
  54587. const normalizeListenArgs$1 = (self2, args, fnName) => {
  54588. const isTargetingSelf = args.length < 3 || args[0] === self2 || args[0] === self2.eventBusEl_;
  54589. let target;
  54590. let type2;
  54591. let listener;
  54592. if (isTargetingSelf) {
  54593. target = self2.eventBusEl_;
  54594. if (args.length >= 3) {
  54595. args.shift();
  54596. }
  54597. [type2, listener] = args;
  54598. } else {
  54599. [target, type2, listener] = args;
  54600. }
  54601. validateTarget$1(target, self2, fnName);
  54602. validateEventType$1(type2, self2, fnName);
  54603. validateListener$1(listener, self2, fnName);
  54604. listener = bind_(self2, listener);
  54605. return {
  54606. isTargetingSelf,
  54607. target,
  54608. type: type2,
  54609. listener
  54610. };
  54611. };
  54612. const listen$1 = (target, method, type2, listener) => {
  54613. validateTarget$1(target, target, method);
  54614. if (target.nodeName) {
  54615. Events$1[method](target, type2, listener);
  54616. } else {
  54617. target[method](type2, listener);
  54618. }
  54619. };
  54620. const EventedMixin$1 = {
  54621. on(...args) {
  54622. const {
  54623. isTargetingSelf,
  54624. target,
  54625. type: type2,
  54626. listener
  54627. } = normalizeListenArgs$1(this, args, "on");
  54628. listen$1(target, "on", type2, listener);
  54629. if (!isTargetingSelf) {
  54630. const removeListenerOnDispose = () => this.off(target, type2, listener);
  54631. removeListenerOnDispose.guid = listener.guid;
  54632. const removeRemoverOnTargetDispose = () => this.off("dispose", removeListenerOnDispose);
  54633. removeRemoverOnTargetDispose.guid = listener.guid;
  54634. listen$1(this, "on", "dispose", removeListenerOnDispose);
  54635. listen$1(target, "on", "dispose", removeRemoverOnTargetDispose);
  54636. }
  54637. },
  54638. one(...args) {
  54639. const {
  54640. isTargetingSelf,
  54641. target,
  54642. type: type2,
  54643. listener
  54644. } = normalizeListenArgs$1(this, args, "one");
  54645. if (isTargetingSelf) {
  54646. listen$1(target, "one", type2, listener);
  54647. } else {
  54648. const wrapper = (...largs) => {
  54649. this.off(target, type2, wrapper);
  54650. listener.apply(null, largs);
  54651. };
  54652. wrapper.guid = listener.guid;
  54653. listen$1(target, "one", type2, wrapper);
  54654. }
  54655. },
  54656. any(...args) {
  54657. const {
  54658. isTargetingSelf,
  54659. target,
  54660. type: type2,
  54661. listener
  54662. } = normalizeListenArgs$1(this, args, "any");
  54663. if (isTargetingSelf) {
  54664. listen$1(target, "any", type2, listener);
  54665. } else {
  54666. const wrapper = (...largs) => {
  54667. this.off(target, type2, wrapper);
  54668. listener.apply(null, largs);
  54669. };
  54670. wrapper.guid = listener.guid;
  54671. listen$1(target, "any", type2, wrapper);
  54672. }
  54673. },
  54674. off(targetOrType, typeOrListener, listener) {
  54675. if (!targetOrType || isValidEventType$1(targetOrType)) {
  54676. off$1(this.eventBusEl_, targetOrType, typeOrListener);
  54677. } else {
  54678. const target = targetOrType;
  54679. const type2 = typeOrListener;
  54680. validateTarget$1(target, this, "off");
  54681. validateEventType$1(type2, this, "off");
  54682. validateListener$1(listener, this, "off");
  54683. listener = bind_(this, listener);
  54684. this.off("dispose", listener);
  54685. if (target.nodeName) {
  54686. off$1(target, type2, listener);
  54687. off$1(target, "dispose", listener);
  54688. } else if (isEvented$1(target)) {
  54689. target.off(type2, listener);
  54690. target.off("dispose", listener);
  54691. }
  54692. }
  54693. },
  54694. trigger(event2, hash) {
  54695. validateTarget$1(this.eventBusEl_, this, "trigger");
  54696. const type2 = event2 && typeof event2 !== "string" ? event2.type : event2;
  54697. if (!isValidEventType$1(type2)) {
  54698. throw new Error(`Invalid event type for ${objName$1(this)}#trigger; must be a non-empty string or object with a type key that has a non-empty value.`);
  54699. }
  54700. return trigger$1(this.eventBusEl_, event2, hash);
  54701. }
  54702. };
  54703. function evented$1(target, options2 = {}) {
  54704. const {
  54705. eventBusKey
  54706. } = options2;
  54707. if (eventBusKey) {
  54708. if (!target[eventBusKey].nodeName) {
  54709. throw new Error(`The eventBusKey "${eventBusKey}" does not refer to an element.`);
  54710. }
  54711. target.eventBusEl_ = target[eventBusKey];
  54712. } else {
  54713. target.eventBusEl_ = createEl$1("span", {
  54714. className: "vjs-event-bus"
  54715. });
  54716. }
  54717. Object.assign(target, EventedMixin$1);
  54718. if (target.eventedCallbacks) {
  54719. target.eventedCallbacks.forEach((callback2) => {
  54720. callback2();
  54721. });
  54722. }
  54723. target.on("dispose", () => {
  54724. target.off();
  54725. [target, target.el_, target.eventBusEl_].forEach(function(val) {
  54726. if (val && DomData$1.has(val)) {
  54727. DomData$1.delete(val);
  54728. }
  54729. });
  54730. window_1.setTimeout(() => {
  54731. target.eventBusEl_ = null;
  54732. }, 0);
  54733. });
  54734. return target;
  54735. }
  54736. const StatefulMixin$1 = {
  54737. state: {},
  54738. setState(stateUpdates) {
  54739. if (typeof stateUpdates === "function") {
  54740. stateUpdates = stateUpdates();
  54741. }
  54742. let changes;
  54743. each$1(stateUpdates, (value, key) => {
  54744. if (this.state[key] !== value) {
  54745. changes = changes || {};
  54746. changes[key] = {
  54747. from: this.state[key],
  54748. to: value
  54749. };
  54750. }
  54751. this.state[key] = value;
  54752. });
  54753. if (changes && isEvented$1(this)) {
  54754. this.trigger({
  54755. changes,
  54756. type: "statechanged"
  54757. });
  54758. }
  54759. return changes;
  54760. }
  54761. };
  54762. function stateful$1(target, defaultState) {
  54763. Object.assign(target, StatefulMixin$1);
  54764. target.state = Object.assign({}, target.state, defaultState);
  54765. if (typeof target.handleStateChanged === "function" && isEvented$1(target)) {
  54766. target.on("statechanged", target.handleStateChanged);
  54767. }
  54768. return target;
  54769. }
  54770. const toLowerCase$1 = function(string) {
  54771. if (typeof string !== "string") {
  54772. return string;
  54773. }
  54774. return string.replace(/./, (w) => w.toLowerCase());
  54775. };
  54776. const toTitleCase$1$1 = function(string) {
  54777. if (typeof string !== "string") {
  54778. return string;
  54779. }
  54780. return string.replace(/./, (w) => w.toUpperCase());
  54781. };
  54782. const titleCaseEquals$1 = function(str1, str2) {
  54783. return toTitleCase$1$1(str1) === toTitleCase$1$1(str2);
  54784. };
  54785. var Str = /* @__PURE__ */ Object.freeze({
  54786. __proto__: null,
  54787. toLowerCase: toLowerCase$1,
  54788. toTitleCase: toTitleCase$1$1,
  54789. titleCaseEquals: titleCaseEquals$1
  54790. });
  54791. class Component$1$1 {
  54792. constructor(player, options2, ready) {
  54793. if (!player && this.play) {
  54794. this.player_ = player = this;
  54795. } else {
  54796. this.player_ = player;
  54797. }
  54798. this.isDisposed_ = false;
  54799. this.parentComponent_ = null;
  54800. this.options_ = merge$1({}, this.options_);
  54801. options2 = this.options_ = merge$1(this.options_, options2);
  54802. this.id_ = options2.id || options2.el && options2.el.id;
  54803. if (!this.id_) {
  54804. const id = player && player.id && player.id() || "no_player";
  54805. this.id_ = `${id}_component_${newGUID$1()}`;
  54806. }
  54807. this.name_ = options2.name || null;
  54808. if (options2.el) {
  54809. this.el_ = options2.el;
  54810. } else if (options2.createEl !== false) {
  54811. this.el_ = this.createEl();
  54812. }
  54813. if (options2.className && this.el_) {
  54814. options2.className.split(" ").forEach((c) => this.addClass(c));
  54815. }
  54816. ["on", "off", "one", "any", "trigger"].forEach((fn2) => {
  54817. this[fn2] = void 0;
  54818. });
  54819. if (options2.evented !== false) {
  54820. evented$1(this, {
  54821. eventBusKey: this.el_ ? "el_" : null
  54822. });
  54823. this.handleLanguagechange = this.handleLanguagechange.bind(this);
  54824. this.on(this.player_, "languagechange", this.handleLanguagechange);
  54825. }
  54826. stateful$1(this, this.constructor.defaultState);
  54827. this.children_ = [];
  54828. this.childIndex_ = {};
  54829. this.childNameIndex_ = {};
  54830. this.setTimeoutIds_ = /* @__PURE__ */ new Set();
  54831. this.setIntervalIds_ = /* @__PURE__ */ new Set();
  54832. this.rafIds_ = /* @__PURE__ */ new Set();
  54833. this.namedRafs_ = /* @__PURE__ */ new Map();
  54834. this.clearingTimersOnDispose_ = false;
  54835. if (options2.initChildren !== false) {
  54836. this.initChildren();
  54837. }
  54838. this.ready(ready);
  54839. if (options2.reportTouchActivity !== false) {
  54840. this.enableTouchActivity();
  54841. }
  54842. }
  54843. on(type2, fn2) {
  54844. }
  54845. off(type2, fn2) {
  54846. }
  54847. one(type2, fn2) {
  54848. }
  54849. any(type2, fn2) {
  54850. }
  54851. trigger(event2) {
  54852. }
  54853. dispose(options2 = {}) {
  54854. if (this.isDisposed_) {
  54855. return;
  54856. }
  54857. if (this.readyQueue_) {
  54858. this.readyQueue_.length = 0;
  54859. }
  54860. this.trigger({
  54861. type: "dispose",
  54862. bubbles: false
  54863. });
  54864. this.isDisposed_ = true;
  54865. if (this.children_) {
  54866. for (let i2 = this.children_.length - 1; i2 >= 0; i2--) {
  54867. if (this.children_[i2].dispose) {
  54868. this.children_[i2].dispose();
  54869. }
  54870. }
  54871. }
  54872. this.children_ = null;
  54873. this.childIndex_ = null;
  54874. this.childNameIndex_ = null;
  54875. this.parentComponent_ = null;
  54876. if (this.el_) {
  54877. if (this.el_.parentNode) {
  54878. if (options2.restoreEl) {
  54879. this.el_.parentNode.replaceChild(options2.restoreEl, this.el_);
  54880. } else {
  54881. this.el_.parentNode.removeChild(this.el_);
  54882. }
  54883. }
  54884. this.el_ = null;
  54885. }
  54886. this.player_ = null;
  54887. }
  54888. isDisposed() {
  54889. return Boolean(this.isDisposed_);
  54890. }
  54891. player() {
  54892. return this.player_;
  54893. }
  54894. options(obj) {
  54895. if (!obj) {
  54896. return this.options_;
  54897. }
  54898. this.options_ = merge$1(this.options_, obj);
  54899. return this.options_;
  54900. }
  54901. el() {
  54902. return this.el_;
  54903. }
  54904. createEl(tagName, properties, attributes) {
  54905. return createEl$1(tagName, properties, attributes);
  54906. }
  54907. localize(string, tokens, defaultValue2 = string) {
  54908. const code = this.player_.language && this.player_.language();
  54909. const languages = this.player_.languages && this.player_.languages();
  54910. const language = languages && languages[code];
  54911. const primaryCode = code && code.split("-")[0];
  54912. const primaryLang = languages && languages[primaryCode];
  54913. let localizedString = defaultValue2;
  54914. if (language && language[string]) {
  54915. localizedString = language[string];
  54916. } else if (primaryLang && primaryLang[string]) {
  54917. localizedString = primaryLang[string];
  54918. }
  54919. if (tokens) {
  54920. localizedString = localizedString.replace(/\{(\d+)\}/g, function(match, index2) {
  54921. const value = tokens[index2 - 1];
  54922. let ret = value;
  54923. if (typeof value === "undefined") {
  54924. ret = match;
  54925. }
  54926. return ret;
  54927. });
  54928. }
  54929. return localizedString;
  54930. }
  54931. handleLanguagechange() {
  54932. }
  54933. contentEl() {
  54934. return this.contentEl_ || this.el_;
  54935. }
  54936. id() {
  54937. return this.id_;
  54938. }
  54939. name() {
  54940. return this.name_;
  54941. }
  54942. children() {
  54943. return this.children_;
  54944. }
  54945. getChildById(id) {
  54946. return this.childIndex_[id];
  54947. }
  54948. getChild(name) {
  54949. if (!name) {
  54950. return;
  54951. }
  54952. return this.childNameIndex_[name];
  54953. }
  54954. getDescendant(...names2) {
  54955. names2 = names2.reduce((acc, n) => acc.concat(n), []);
  54956. let currentChild = this;
  54957. for (let i2 = 0; i2 < names2.length; i2++) {
  54958. currentChild = currentChild.getChild(names2[i2]);
  54959. if (!currentChild || !currentChild.getChild) {
  54960. return;
  54961. }
  54962. }
  54963. return currentChild;
  54964. }
  54965. addChild(child, options2 = {}, index2 = this.children_.length) {
  54966. let component;
  54967. let componentName;
  54968. if (typeof child === "string") {
  54969. componentName = toTitleCase$1$1(child);
  54970. const componentClassName = options2.componentClass || componentName;
  54971. options2.name = componentName;
  54972. const ComponentClass = Component$1$1.getComponent(componentClassName);
  54973. if (!ComponentClass) {
  54974. throw new Error(`Component ${componentClassName} does not exist`);
  54975. }
  54976. if (typeof ComponentClass !== "function") {
  54977. return null;
  54978. }
  54979. component = new ComponentClass(this.player_ || this, options2);
  54980. } else {
  54981. component = child;
  54982. }
  54983. if (component.parentComponent_) {
  54984. component.parentComponent_.removeChild(component);
  54985. }
  54986. this.children_.splice(index2, 0, component);
  54987. component.parentComponent_ = this;
  54988. if (typeof component.id === "function") {
  54989. this.childIndex_[component.id()] = component;
  54990. }
  54991. componentName = componentName || component.name && toTitleCase$1$1(component.name());
  54992. if (componentName) {
  54993. this.childNameIndex_[componentName] = component;
  54994. this.childNameIndex_[toLowerCase$1(componentName)] = component;
  54995. }
  54996. if (typeof component.el === "function" && component.el()) {
  54997. let refNode = null;
  54998. if (this.children_[index2 + 1]) {
  54999. if (this.children_[index2 + 1].el_) {
  55000. refNode = this.children_[index2 + 1].el_;
  55001. } else if (isEl$1(this.children_[index2 + 1])) {
  55002. refNode = this.children_[index2 + 1];
  55003. }
  55004. }
  55005. this.contentEl().insertBefore(component.el(), refNode);
  55006. }
  55007. return component;
  55008. }
  55009. removeChild(component) {
  55010. if (typeof component === "string") {
  55011. component = this.getChild(component);
  55012. }
  55013. if (!component || !this.children_) {
  55014. return;
  55015. }
  55016. let childFound = false;
  55017. for (let i2 = this.children_.length - 1; i2 >= 0; i2--) {
  55018. if (this.children_[i2] === component) {
  55019. childFound = true;
  55020. this.children_.splice(i2, 1);
  55021. break;
  55022. }
  55023. }
  55024. if (!childFound) {
  55025. return;
  55026. }
  55027. component.parentComponent_ = null;
  55028. this.childIndex_[component.id()] = null;
  55029. this.childNameIndex_[toTitleCase$1$1(component.name())] = null;
  55030. this.childNameIndex_[toLowerCase$1(component.name())] = null;
  55031. const compEl = component.el();
  55032. if (compEl && compEl.parentNode === this.contentEl()) {
  55033. this.contentEl().removeChild(component.el());
  55034. }
  55035. }
  55036. initChildren() {
  55037. const children = this.options_.children;
  55038. if (children) {
  55039. const parentOptions = this.options_;
  55040. const handleAdd = (child) => {
  55041. const name = child.name;
  55042. let opts = child.opts;
  55043. if (parentOptions[name] !== void 0) {
  55044. opts = parentOptions[name];
  55045. }
  55046. if (opts === false) {
  55047. return;
  55048. }
  55049. if (opts === true) {
  55050. opts = {};
  55051. }
  55052. opts.playerOptions = this.options_.playerOptions;
  55053. const newChild = this.addChild(name, opts);
  55054. if (newChild) {
  55055. this[name] = newChild;
  55056. }
  55057. };
  55058. let workingChildren;
  55059. const Tech2 = Component$1$1.getComponent("Tech");
  55060. if (Array.isArray(children)) {
  55061. workingChildren = children;
  55062. } else {
  55063. workingChildren = Object.keys(children);
  55064. }
  55065. workingChildren.concat(Object.keys(this.options_).filter(function(child) {
  55066. return !workingChildren.some(function(wchild) {
  55067. if (typeof wchild === "string") {
  55068. return child === wchild;
  55069. }
  55070. return child === wchild.name;
  55071. });
  55072. })).map((child) => {
  55073. let name;
  55074. let opts;
  55075. if (typeof child === "string") {
  55076. name = child;
  55077. opts = children[name] || this.options_[name] || {};
  55078. } else {
  55079. name = child.name;
  55080. opts = child;
  55081. }
  55082. return {
  55083. name,
  55084. opts
  55085. };
  55086. }).filter((child) => {
  55087. const c = Component$1$1.getComponent(child.opts.componentClass || toTitleCase$1$1(child.name));
  55088. return c && !Tech2.isTech(c);
  55089. }).forEach(handleAdd);
  55090. }
  55091. }
  55092. buildCSSClass() {
  55093. return "";
  55094. }
  55095. ready(fn2, sync = false) {
  55096. if (!fn2) {
  55097. return;
  55098. }
  55099. if (!this.isReady_) {
  55100. this.readyQueue_ = this.readyQueue_ || [];
  55101. this.readyQueue_.push(fn2);
  55102. return;
  55103. }
  55104. if (sync) {
  55105. fn2.call(this);
  55106. } else {
  55107. this.setTimeout(fn2, 1);
  55108. }
  55109. }
  55110. triggerReady() {
  55111. this.isReady_ = true;
  55112. this.setTimeout(function() {
  55113. const readyQueue = this.readyQueue_;
  55114. this.readyQueue_ = [];
  55115. if (readyQueue && readyQueue.length > 0) {
  55116. readyQueue.forEach(function(fn2) {
  55117. fn2.call(this);
  55118. }, this);
  55119. }
  55120. this.trigger("ready");
  55121. }, 1);
  55122. }
  55123. $(selector, context) {
  55124. return $$1(selector, context || this.contentEl());
  55125. }
  55126. $$(selector, context) {
  55127. return $$$1(selector, context || this.contentEl());
  55128. }
  55129. hasClass(classToCheck) {
  55130. return hasClass$1(this.el_, classToCheck);
  55131. }
  55132. addClass(...classesToAdd) {
  55133. addClass$1(this.el_, ...classesToAdd);
  55134. }
  55135. removeClass(...classesToRemove) {
  55136. removeClass$1(this.el_, ...classesToRemove);
  55137. }
  55138. toggleClass(classToToggle, predicate) {
  55139. toggleClass$1(this.el_, classToToggle, predicate);
  55140. }
  55141. show() {
  55142. this.removeClass("vjs-hidden");
  55143. }
  55144. hide() {
  55145. this.addClass("vjs-hidden");
  55146. }
  55147. lockShowing() {
  55148. this.addClass("vjs-lock-showing");
  55149. }
  55150. unlockShowing() {
  55151. this.removeClass("vjs-lock-showing");
  55152. }
  55153. getAttribute(attribute) {
  55154. return getAttribute$1(this.el_, attribute);
  55155. }
  55156. setAttribute(attribute, value) {
  55157. setAttribute$1(this.el_, attribute, value);
  55158. }
  55159. removeAttribute(attribute) {
  55160. removeAttribute$1(this.el_, attribute);
  55161. }
  55162. width(num, skipListeners) {
  55163. return this.dimension("width", num, skipListeners);
  55164. }
  55165. height(num, skipListeners) {
  55166. return this.dimension("height", num, skipListeners);
  55167. }
  55168. dimensions(width2, height2) {
  55169. this.width(width2, true);
  55170. this.height(height2);
  55171. }
  55172. dimension(widthOrHeight, num, skipListeners) {
  55173. if (num !== void 0) {
  55174. if (num === null || num !== num) {
  55175. num = 0;
  55176. }
  55177. if (("" + num).indexOf("%") !== -1 || ("" + num).indexOf("px") !== -1) {
  55178. this.el_.style[widthOrHeight] = num;
  55179. } else if (num === "auto") {
  55180. this.el_.style[widthOrHeight] = "";
  55181. } else {
  55182. this.el_.style[widthOrHeight] = num + "px";
  55183. }
  55184. if (!skipListeners) {
  55185. this.trigger("componentresize");
  55186. }
  55187. return;
  55188. }
  55189. if (!this.el_) {
  55190. return 0;
  55191. }
  55192. const val = this.el_.style[widthOrHeight];
  55193. const pxIndex = val.indexOf("px");
  55194. if (pxIndex !== -1) {
  55195. return parseInt(val.slice(0, pxIndex), 10);
  55196. }
  55197. return parseInt(this.el_["offset" + toTitleCase$1$1(widthOrHeight)], 10);
  55198. }
  55199. currentDimension(widthOrHeight) {
  55200. let computedWidthOrHeight = 0;
  55201. if (widthOrHeight !== "width" && widthOrHeight !== "height") {
  55202. throw new Error("currentDimension only accepts width or height value");
  55203. }
  55204. computedWidthOrHeight = computedStyle$1(this.el_, widthOrHeight);
  55205. computedWidthOrHeight = parseFloat(computedWidthOrHeight);
  55206. if (computedWidthOrHeight === 0 || isNaN(computedWidthOrHeight)) {
  55207. const rule = `offset${toTitleCase$1$1(widthOrHeight)}`;
  55208. computedWidthOrHeight = this.el_[rule];
  55209. }
  55210. return computedWidthOrHeight;
  55211. }
  55212. currentDimensions() {
  55213. return {
  55214. width: this.currentDimension("width"),
  55215. height: this.currentDimension("height")
  55216. };
  55217. }
  55218. currentWidth() {
  55219. return this.currentDimension("width");
  55220. }
  55221. currentHeight() {
  55222. return this.currentDimension("height");
  55223. }
  55224. focus() {
  55225. this.el_.focus();
  55226. }
  55227. blur() {
  55228. this.el_.blur();
  55229. }
  55230. handleKeyDown(event2) {
  55231. if (this.player_) {
  55232. if (!keycode.isEventKey(event2, "Tab")) {
  55233. event2.stopPropagation();
  55234. }
  55235. this.player_.handleKeyDown(event2);
  55236. }
  55237. }
  55238. handleKeyPress(event2) {
  55239. this.handleKeyDown(event2);
  55240. }
  55241. emitTapEvents() {
  55242. let touchStart = 0;
  55243. let firstTouch = null;
  55244. const tapMovementThreshold = 10;
  55245. const touchTimeThreshold = 200;
  55246. let couldBeTap;
  55247. this.on("touchstart", function(event2) {
  55248. if (event2.touches.length === 1) {
  55249. firstTouch = {
  55250. pageX: event2.touches[0].pageX,
  55251. pageY: event2.touches[0].pageY
  55252. };
  55253. touchStart = window_1.performance.now();
  55254. couldBeTap = true;
  55255. }
  55256. });
  55257. this.on("touchmove", function(event2) {
  55258. if (event2.touches.length > 1) {
  55259. couldBeTap = false;
  55260. } else if (firstTouch) {
  55261. const xdiff = event2.touches[0].pageX - firstTouch.pageX;
  55262. const ydiff = event2.touches[0].pageY - firstTouch.pageY;
  55263. const touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);
  55264. if (touchDistance > tapMovementThreshold) {
  55265. couldBeTap = false;
  55266. }
  55267. }
  55268. });
  55269. const noTap = function() {
  55270. couldBeTap = false;
  55271. };
  55272. this.on("touchleave", noTap);
  55273. this.on("touchcancel", noTap);
  55274. this.on("touchend", function(event2) {
  55275. firstTouch = null;
  55276. if (couldBeTap === true) {
  55277. const touchTime = window_1.performance.now() - touchStart;
  55278. if (touchTime < touchTimeThreshold) {
  55279. event2.preventDefault();
  55280. this.trigger("tap");
  55281. }
  55282. }
  55283. });
  55284. }
  55285. enableTouchActivity() {
  55286. if (!this.player() || !this.player().reportUserActivity) {
  55287. return;
  55288. }
  55289. const report = bind_(this.player(), this.player().reportUserActivity);
  55290. let touchHolding;
  55291. this.on("touchstart", function() {
  55292. report();
  55293. this.clearInterval(touchHolding);
  55294. touchHolding = this.setInterval(report, 250);
  55295. });
  55296. const touchEnd = function(event2) {
  55297. report();
  55298. this.clearInterval(touchHolding);
  55299. };
  55300. this.on("touchmove", report);
  55301. this.on("touchend", touchEnd);
  55302. this.on("touchcancel", touchEnd);
  55303. }
  55304. setTimeout(fn2, timeout) {
  55305. var timeoutId;
  55306. fn2 = bind_(this, fn2);
  55307. this.clearTimersOnDispose_();
  55308. timeoutId = window_1.setTimeout(() => {
  55309. if (this.setTimeoutIds_.has(timeoutId)) {
  55310. this.setTimeoutIds_.delete(timeoutId);
  55311. }
  55312. fn2();
  55313. }, timeout);
  55314. this.setTimeoutIds_.add(timeoutId);
  55315. return timeoutId;
  55316. }
  55317. clearTimeout(timeoutId) {
  55318. if (this.setTimeoutIds_.has(timeoutId)) {
  55319. this.setTimeoutIds_.delete(timeoutId);
  55320. window_1.clearTimeout(timeoutId);
  55321. }
  55322. return timeoutId;
  55323. }
  55324. setInterval(fn2, interval) {
  55325. fn2 = bind_(this, fn2);
  55326. this.clearTimersOnDispose_();
  55327. const intervalId = window_1.setInterval(fn2, interval);
  55328. this.setIntervalIds_.add(intervalId);
  55329. return intervalId;
  55330. }
  55331. clearInterval(intervalId) {
  55332. if (this.setIntervalIds_.has(intervalId)) {
  55333. this.setIntervalIds_.delete(intervalId);
  55334. window_1.clearInterval(intervalId);
  55335. }
  55336. return intervalId;
  55337. }
  55338. requestAnimationFrame(fn2) {
  55339. this.clearTimersOnDispose_();
  55340. var id;
  55341. fn2 = bind_(this, fn2);
  55342. id = window_1.requestAnimationFrame(() => {
  55343. if (this.rafIds_.has(id)) {
  55344. this.rafIds_.delete(id);
  55345. }
  55346. fn2();
  55347. });
  55348. this.rafIds_.add(id);
  55349. return id;
  55350. }
  55351. requestNamedAnimationFrame(name, fn2) {
  55352. if (this.namedRafs_.has(name)) {
  55353. return;
  55354. }
  55355. this.clearTimersOnDispose_();
  55356. fn2 = bind_(this, fn2);
  55357. const id = this.requestAnimationFrame(() => {
  55358. fn2();
  55359. if (this.namedRafs_.has(name)) {
  55360. this.namedRafs_.delete(name);
  55361. }
  55362. });
  55363. this.namedRafs_.set(name, id);
  55364. return name;
  55365. }
  55366. cancelNamedAnimationFrame(name) {
  55367. if (!this.namedRafs_.has(name)) {
  55368. return;
  55369. }
  55370. this.cancelAnimationFrame(this.namedRafs_.get(name));
  55371. this.namedRafs_.delete(name);
  55372. }
  55373. cancelAnimationFrame(id) {
  55374. if (this.rafIds_.has(id)) {
  55375. this.rafIds_.delete(id);
  55376. window_1.cancelAnimationFrame(id);
  55377. }
  55378. return id;
  55379. }
  55380. clearTimersOnDispose_() {
  55381. if (this.clearingTimersOnDispose_) {
  55382. return;
  55383. }
  55384. this.clearingTimersOnDispose_ = true;
  55385. this.one("dispose", () => {
  55386. [["namedRafs_", "cancelNamedAnimationFrame"], ["rafIds_", "cancelAnimationFrame"], ["setTimeoutIds_", "clearTimeout"], ["setIntervalIds_", "clearInterval"]].forEach(([idName, cancelName]) => {
  55387. this[idName].forEach((val, key) => this[cancelName](key));
  55388. });
  55389. this.clearingTimersOnDispose_ = false;
  55390. });
  55391. }
  55392. static registerComponent(name, ComponentToRegister) {
  55393. if (typeof name !== "string" || !name) {
  55394. throw new Error(`Illegal component name, "${name}"; must be a non-empty string.`);
  55395. }
  55396. const Tech2 = Component$1$1.getComponent("Tech");
  55397. const isTech = Tech2 && Tech2.isTech(ComponentToRegister);
  55398. const isComp = Component$1$1 === ComponentToRegister || Component$1$1.prototype.isPrototypeOf(ComponentToRegister.prototype);
  55399. if (isTech || !isComp) {
  55400. let reason;
  55401. if (isTech) {
  55402. reason = "techs must be registered using Tech.registerTech()";
  55403. } else {
  55404. reason = "must be a Component subclass";
  55405. }
  55406. throw new Error(`Illegal component, "${name}"; ${reason}.`);
  55407. }
  55408. name = toTitleCase$1$1(name);
  55409. if (!Component$1$1.components_) {
  55410. Component$1$1.components_ = {};
  55411. }
  55412. const Player2 = Component$1$1.getComponent("Player");
  55413. if (name === "Player" && Player2 && Player2.players) {
  55414. const players = Player2.players;
  55415. const playerNames = Object.keys(players);
  55416. if (players && playerNames.length > 0 && playerNames.map((pname) => players[pname]).every(Boolean)) {
  55417. throw new Error("Can not register Player component after player has been created.");
  55418. }
  55419. }
  55420. Component$1$1.components_[name] = ComponentToRegister;
  55421. Component$1$1.components_[toLowerCase$1(name)] = ComponentToRegister;
  55422. return ComponentToRegister;
  55423. }
  55424. static getComponent(name) {
  55425. if (!name || !Component$1$1.components_) {
  55426. return;
  55427. }
  55428. return Component$1$1.components_[name];
  55429. }
  55430. }
  55431. Component$1$1.registerComponent("Component", Component$1$1);
  55432. function rangeCheck$1(fnName, index2, maxIndex) {
  55433. if (typeof index2 !== "number" || index2 < 0 || index2 > maxIndex) {
  55434. throw new Error(`Failed to execute '${fnName}' on 'TimeRanges': The index provided (${index2}) is non-numeric or out of bounds (0-${maxIndex}).`);
  55435. }
  55436. }
  55437. function getRange$1(fnName, valueIndex, ranges, rangeIndex) {
  55438. rangeCheck$1(fnName, rangeIndex, ranges.length - 1);
  55439. return ranges[rangeIndex][valueIndex];
  55440. }
  55441. function createTimeRangesObj$1(ranges) {
  55442. let timeRangesObj;
  55443. if (ranges === void 0 || ranges.length === 0) {
  55444. timeRangesObj = {
  55445. length: 0,
  55446. start() {
  55447. throw new Error("This TimeRanges object is empty");
  55448. },
  55449. end() {
  55450. throw new Error("This TimeRanges object is empty");
  55451. }
  55452. };
  55453. } else {
  55454. timeRangesObj = {
  55455. length: ranges.length,
  55456. start: getRange$1.bind(null, "start", 0, ranges),
  55457. end: getRange$1.bind(null, "end", 1, ranges)
  55458. };
  55459. }
  55460. if (window_1.Symbol && window_1.Symbol.iterator) {
  55461. timeRangesObj[window_1.Symbol.iterator] = () => (ranges || []).values();
  55462. }
  55463. return timeRangesObj;
  55464. }
  55465. function createTimeRanges$1(start2, end) {
  55466. if (Array.isArray(start2)) {
  55467. return createTimeRangesObj$1(start2);
  55468. } else if (start2 === void 0 || end === void 0) {
  55469. return createTimeRangesObj$1();
  55470. }
  55471. return createTimeRangesObj$1([[start2, end]]);
  55472. }
  55473. const defaultImplementation$1 = function(seconds, guide) {
  55474. seconds = seconds < 0 ? 0 : seconds;
  55475. let s = Math.floor(seconds % 60);
  55476. let m = Math.floor(seconds / 60 % 60);
  55477. let h2 = Math.floor(seconds / 3600);
  55478. const gm = Math.floor(guide / 60 % 60);
  55479. const gh = Math.floor(guide / 3600);
  55480. if (isNaN(seconds) || seconds === Infinity) {
  55481. h2 = m = s = "-";
  55482. }
  55483. h2 = h2 > 0 || gh > 0 ? h2 + ":" : "";
  55484. m = ((h2 || gm >= 10) && m < 10 ? "0" + m : m) + ":";
  55485. s = s < 10 ? "0" + s : s;
  55486. return h2 + m + s;
  55487. };
  55488. let implementation$1 = defaultImplementation$1;
  55489. function setFormatTime$1(customImplementation) {
  55490. implementation$1 = customImplementation;
  55491. }
  55492. function resetFormatTime$1() {
  55493. implementation$1 = defaultImplementation$1;
  55494. }
  55495. function formatTime$1(seconds, guide = seconds) {
  55496. return implementation$1(seconds, guide);
  55497. }
  55498. var Time = /* @__PURE__ */ Object.freeze({
  55499. __proto__: null,
  55500. createTimeRanges: createTimeRanges$1,
  55501. createTimeRange: createTimeRanges$1,
  55502. setFormatTime: setFormatTime$1,
  55503. resetFormatTime: resetFormatTime$1,
  55504. formatTime: formatTime$1
  55505. });
  55506. function bufferedPercent$1(buffered, duration5) {
  55507. let bufferedDuration = 0;
  55508. let start2;
  55509. let end;
  55510. if (!duration5) {
  55511. return 0;
  55512. }
  55513. if (!buffered || !buffered.length) {
  55514. buffered = createTimeRanges$1(0, 0);
  55515. }
  55516. for (let i2 = 0; i2 < buffered.length; i2++) {
  55517. start2 = buffered.start(i2);
  55518. end = buffered.end(i2);
  55519. if (end > duration5) {
  55520. end = duration5;
  55521. }
  55522. bufferedDuration += end - start2;
  55523. }
  55524. return bufferedDuration / duration5;
  55525. }
  55526. function MediaError$1(value) {
  55527. if (value instanceof MediaError$1) {
  55528. return value;
  55529. }
  55530. if (typeof value === "number") {
  55531. this.code = value;
  55532. } else if (typeof value === "string") {
  55533. this.message = value;
  55534. } else if (isObject$2(value)) {
  55535. if (typeof value.code === "number") {
  55536. this.code = value.code;
  55537. }
  55538. Object.assign(this, value);
  55539. }
  55540. if (!this.message) {
  55541. this.message = MediaError$1.defaultMessages[this.code] || "";
  55542. }
  55543. }
  55544. MediaError$1.prototype.code = 0;
  55545. MediaError$1.prototype.message = "";
  55546. MediaError$1.prototype.status = null;
  55547. MediaError$1.errorTypes = ["MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED"];
  55548. MediaError$1.defaultMessages = {
  55549. 1: "You aborted the media playback",
  55550. 2: "A network error caused the media download to fail part-way.",
  55551. 3: "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",
  55552. 4: "The media could not be loaded, either because the server or network failed or because the format is not supported.",
  55553. 5: "The media is encrypted and we do not have the keys to decrypt it."
  55554. };
  55555. for (let errNum = 0; errNum < MediaError$1.errorTypes.length; errNum++) {
  55556. MediaError$1[MediaError$1.errorTypes[errNum]] = errNum;
  55557. MediaError$1.prototype[MediaError$1.errorTypes[errNum]] = errNum;
  55558. }
  55559. function isPromise$1(value) {
  55560. return value !== void 0 && value !== null && typeof value.then === "function";
  55561. }
  55562. function silencePromise$1(value) {
  55563. if (isPromise$1(value)) {
  55564. value.then(null, (e) => {
  55565. });
  55566. }
  55567. }
  55568. const trackToJson_$1 = function(track) {
  55569. const ret = ["kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src"].reduce((acc, prop, i2) => {
  55570. if (track[prop]) {
  55571. acc[prop] = track[prop];
  55572. }
  55573. return acc;
  55574. }, {
  55575. cues: track.cues && Array.prototype.map.call(track.cues, function(cue) {
  55576. return {
  55577. startTime: cue.startTime,
  55578. endTime: cue.endTime,
  55579. text: cue.text,
  55580. id: cue.id
  55581. };
  55582. })
  55583. });
  55584. return ret;
  55585. };
  55586. const textTracksToJson$1 = function(tech) {
  55587. const trackEls = tech.$$("track");
  55588. const trackObjs = Array.prototype.map.call(trackEls, (t2) => t2.track);
  55589. const tracks = Array.prototype.map.call(trackEls, function(trackEl) {
  55590. const json = trackToJson_$1(trackEl.track);
  55591. if (trackEl.src) {
  55592. json.src = trackEl.src;
  55593. }
  55594. return json;
  55595. });
  55596. return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function(track) {
  55597. return trackObjs.indexOf(track) === -1;
  55598. }).map(trackToJson_$1));
  55599. };
  55600. const jsonToTextTracks$1 = function(json, tech) {
  55601. json.forEach(function(track) {
  55602. const addedTrack = tech.addRemoteTextTrack(track).track;
  55603. if (!track.src && track.cues) {
  55604. track.cues.forEach((cue) => addedTrack.addCue(cue));
  55605. }
  55606. });
  55607. return tech.textTracks();
  55608. };
  55609. var textTrackConverter$1 = {
  55610. textTracksToJson: textTracksToJson$1,
  55611. jsonToTextTracks: jsonToTextTracks$1,
  55612. trackToJson_: trackToJson_$1
  55613. };
  55614. const MODAL_CLASS_NAME$1 = "vjs-modal-dialog";
  55615. class ModalDialog$1 extends Component$1$1 {
  55616. constructor(player, options2) {
  55617. super(player, options2);
  55618. this.handleKeyDown_ = (e) => this.handleKeyDown(e);
  55619. this.close_ = (e) => this.close(e);
  55620. this.opened_ = this.hasBeenOpened_ = this.hasBeenFilled_ = false;
  55621. this.closeable(!this.options_.uncloseable);
  55622. this.content(this.options_.content);
  55623. this.contentEl_ = createEl$1("div", {
  55624. className: `${MODAL_CLASS_NAME$1}-content`
  55625. }, {
  55626. role: "document"
  55627. });
  55628. this.descEl_ = createEl$1("p", {
  55629. className: `${MODAL_CLASS_NAME$1}-description vjs-control-text`,
  55630. id: this.el().getAttribute("aria-describedby")
  55631. });
  55632. textContent$1(this.descEl_, this.description());
  55633. this.el_.appendChild(this.descEl_);
  55634. this.el_.appendChild(this.contentEl_);
  55635. }
  55636. createEl() {
  55637. return super.createEl("div", {
  55638. className: this.buildCSSClass(),
  55639. tabIndex: -1
  55640. }, {
  55641. "aria-describedby": `${this.id()}_description`,
  55642. "aria-hidden": "true",
  55643. "aria-label": this.label(),
  55644. "role": "dialog"
  55645. });
  55646. }
  55647. dispose() {
  55648. this.contentEl_ = null;
  55649. this.descEl_ = null;
  55650. this.previouslyActiveEl_ = null;
  55651. super.dispose();
  55652. }
  55653. buildCSSClass() {
  55654. return `${MODAL_CLASS_NAME$1} vjs-hidden ${super.buildCSSClass()}`;
  55655. }
  55656. label() {
  55657. return this.localize(this.options_.label || "Modal Window");
  55658. }
  55659. description() {
  55660. let desc = this.options_.description || this.localize("This is a modal window.");
  55661. if (this.closeable()) {
  55662. desc += " " + this.localize("This modal can be closed by pressing the Escape key or activating the close button.");
  55663. }
  55664. return desc;
  55665. }
  55666. open() {
  55667. if (!this.opened_) {
  55668. const player = this.player();
  55669. this.trigger("beforemodalopen");
  55670. this.opened_ = true;
  55671. if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) {
  55672. this.fill();
  55673. }
  55674. this.wasPlaying_ = !player.paused();
  55675. if (this.options_.pauseOnOpen && this.wasPlaying_) {
  55676. player.pause();
  55677. }
  55678. this.on("keydown", this.handleKeyDown_);
  55679. this.hadControls_ = player.controls();
  55680. player.controls(false);
  55681. this.show();
  55682. this.conditionalFocus_();
  55683. this.el().setAttribute("aria-hidden", "false");
  55684. this.trigger("modalopen");
  55685. this.hasBeenOpened_ = true;
  55686. }
  55687. }
  55688. opened(value) {
  55689. if (typeof value === "boolean") {
  55690. this[value ? "open" : "close"]();
  55691. }
  55692. return this.opened_;
  55693. }
  55694. close() {
  55695. if (!this.opened_) {
  55696. return;
  55697. }
  55698. const player = this.player();
  55699. this.trigger("beforemodalclose");
  55700. this.opened_ = false;
  55701. if (this.wasPlaying_ && this.options_.pauseOnOpen) {
  55702. player.play();
  55703. }
  55704. this.off("keydown", this.handleKeyDown_);
  55705. if (this.hadControls_) {
  55706. player.controls(true);
  55707. }
  55708. this.hide();
  55709. this.el().setAttribute("aria-hidden", "true");
  55710. this.trigger("modalclose");
  55711. this.conditionalBlur_();
  55712. if (this.options_.temporary) {
  55713. this.dispose();
  55714. }
  55715. }
  55716. closeable(value) {
  55717. if (typeof value === "boolean") {
  55718. const closeable = this.closeable_ = !!value;
  55719. let close = this.getChild("closeButton");
  55720. if (closeable && !close) {
  55721. const temp = this.contentEl_;
  55722. this.contentEl_ = this.el_;
  55723. close = this.addChild("closeButton", {
  55724. controlText: "Close Modal Dialog"
  55725. });
  55726. this.contentEl_ = temp;
  55727. this.on(close, "close", this.close_);
  55728. }
  55729. if (!closeable && close) {
  55730. this.off(close, "close", this.close_);
  55731. this.removeChild(close);
  55732. close.dispose();
  55733. }
  55734. }
  55735. return this.closeable_;
  55736. }
  55737. fill() {
  55738. this.fillWith(this.content());
  55739. }
  55740. fillWith(content) {
  55741. const contentEl = this.contentEl();
  55742. const parentEl = contentEl.parentNode;
  55743. const nextSiblingEl = contentEl.nextSibling;
  55744. this.trigger("beforemodalfill");
  55745. this.hasBeenFilled_ = true;
  55746. parentEl.removeChild(contentEl);
  55747. this.empty();
  55748. insertContent$1(contentEl, content);
  55749. this.trigger("modalfill");
  55750. if (nextSiblingEl) {
  55751. parentEl.insertBefore(contentEl, nextSiblingEl);
  55752. } else {
  55753. parentEl.appendChild(contentEl);
  55754. }
  55755. const closeButton = this.getChild("closeButton");
  55756. if (closeButton) {
  55757. parentEl.appendChild(closeButton.el_);
  55758. }
  55759. }
  55760. empty() {
  55761. this.trigger("beforemodalempty");
  55762. emptyEl$1(this.contentEl());
  55763. this.trigger("modalempty");
  55764. }
  55765. content(value) {
  55766. if (typeof value !== "undefined") {
  55767. this.content_ = value;
  55768. }
  55769. return this.content_;
  55770. }
  55771. conditionalFocus_() {
  55772. const activeEl = document_1.activeElement;
  55773. const playerEl = this.player_.el_;
  55774. this.previouslyActiveEl_ = null;
  55775. if (playerEl.contains(activeEl) || playerEl === activeEl) {
  55776. this.previouslyActiveEl_ = activeEl;
  55777. this.focus();
  55778. }
  55779. }
  55780. conditionalBlur_() {
  55781. if (this.previouslyActiveEl_) {
  55782. this.previouslyActiveEl_.focus();
  55783. this.previouslyActiveEl_ = null;
  55784. }
  55785. }
  55786. handleKeyDown(event2) {
  55787. event2.stopPropagation();
  55788. if (keycode.isEventKey(event2, "Escape") && this.closeable()) {
  55789. event2.preventDefault();
  55790. this.close();
  55791. return;
  55792. }
  55793. if (!keycode.isEventKey(event2, "Tab")) {
  55794. return;
  55795. }
  55796. const focusableEls = this.focusableEls_();
  55797. const activeEl = this.el_.querySelector(":focus");
  55798. let focusIndex;
  55799. for (let i2 = 0; i2 < focusableEls.length; i2++) {
  55800. if (activeEl === focusableEls[i2]) {
  55801. focusIndex = i2;
  55802. break;
  55803. }
  55804. }
  55805. if (document_1.activeElement === this.el_) {
  55806. focusIndex = 0;
  55807. }
  55808. if (event2.shiftKey && focusIndex === 0) {
  55809. focusableEls[focusableEls.length - 1].focus();
  55810. event2.preventDefault();
  55811. } else if (!event2.shiftKey && focusIndex === focusableEls.length - 1) {
  55812. focusableEls[0].focus();
  55813. event2.preventDefault();
  55814. }
  55815. }
  55816. focusableEls_() {
  55817. const allChildren = this.el_.querySelectorAll("*");
  55818. return Array.prototype.filter.call(allChildren, (child) => {
  55819. return (child instanceof window_1.HTMLAnchorElement || child instanceof window_1.HTMLAreaElement) && child.hasAttribute("href") || (child instanceof window_1.HTMLInputElement || child instanceof window_1.HTMLSelectElement || child instanceof window_1.HTMLTextAreaElement || child instanceof window_1.HTMLButtonElement) && !child.hasAttribute("disabled") || child instanceof window_1.HTMLIFrameElement || child instanceof window_1.HTMLObjectElement || child instanceof window_1.HTMLEmbedElement || child.hasAttribute("tabindex") && child.getAttribute("tabindex") !== -1 || child.hasAttribute("contenteditable");
  55820. });
  55821. }
  55822. }
  55823. ModalDialog$1.prototype.options_ = {
  55824. pauseOnOpen: true,
  55825. temporary: true
  55826. };
  55827. Component$1$1.registerComponent("ModalDialog", ModalDialog$1);
  55828. class TrackList$1 extends EventTarget$2$1 {
  55829. constructor(tracks = []) {
  55830. super();
  55831. this.tracks_ = [];
  55832. Object.defineProperty(this, "length", {
  55833. get() {
  55834. return this.tracks_.length;
  55835. }
  55836. });
  55837. for (let i2 = 0; i2 < tracks.length; i2++) {
  55838. this.addTrack(tracks[i2]);
  55839. }
  55840. }
  55841. addTrack(track) {
  55842. const index2 = this.tracks_.length;
  55843. if (!("" + index2 in this)) {
  55844. Object.defineProperty(this, index2, {
  55845. get() {
  55846. return this.tracks_[index2];
  55847. }
  55848. });
  55849. }
  55850. if (this.tracks_.indexOf(track) === -1) {
  55851. this.tracks_.push(track);
  55852. this.trigger({
  55853. track,
  55854. type: "addtrack",
  55855. target: this
  55856. });
  55857. }
  55858. track.labelchange_ = () => {
  55859. this.trigger({
  55860. track,
  55861. type: "labelchange",
  55862. target: this
  55863. });
  55864. };
  55865. if (isEvented$1(track)) {
  55866. track.addEventListener("labelchange", track.labelchange_);
  55867. }
  55868. }
  55869. removeTrack(rtrack) {
  55870. let track;
  55871. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  55872. if (this[i2] === rtrack) {
  55873. track = this[i2];
  55874. if (track.off) {
  55875. track.off();
  55876. }
  55877. this.tracks_.splice(i2, 1);
  55878. break;
  55879. }
  55880. }
  55881. if (!track) {
  55882. return;
  55883. }
  55884. this.trigger({
  55885. track,
  55886. type: "removetrack",
  55887. target: this
  55888. });
  55889. }
  55890. getTrackById(id) {
  55891. let result = null;
  55892. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  55893. const track = this[i2];
  55894. if (track.id === id) {
  55895. result = track;
  55896. break;
  55897. }
  55898. }
  55899. return result;
  55900. }
  55901. }
  55902. TrackList$1.prototype.allowedEvents_ = {
  55903. change: "change",
  55904. addtrack: "addtrack",
  55905. removetrack: "removetrack",
  55906. labelchange: "labelchange"
  55907. };
  55908. for (const event2 in TrackList$1.prototype.allowedEvents_) {
  55909. TrackList$1.prototype["on" + event2] = null;
  55910. }
  55911. const disableOthers$1$1 = function(list, track) {
  55912. for (let i2 = 0; i2 < list.length; i2++) {
  55913. if (!Object.keys(list[i2]).length || track.id === list[i2].id) {
  55914. continue;
  55915. }
  55916. list[i2].enabled = false;
  55917. }
  55918. };
  55919. class AudioTrackList$1 extends TrackList$1 {
  55920. constructor(tracks = []) {
  55921. for (let i2 = tracks.length - 1; i2 >= 0; i2--) {
  55922. if (tracks[i2].enabled) {
  55923. disableOthers$1$1(tracks, tracks[i2]);
  55924. break;
  55925. }
  55926. }
  55927. super(tracks);
  55928. this.changing_ = false;
  55929. }
  55930. addTrack(track) {
  55931. if (track.enabled) {
  55932. disableOthers$1$1(this, track);
  55933. }
  55934. super.addTrack(track);
  55935. if (!track.addEventListener) {
  55936. return;
  55937. }
  55938. track.enabledChange_ = () => {
  55939. if (this.changing_) {
  55940. return;
  55941. }
  55942. this.changing_ = true;
  55943. disableOthers$1$1(this, track);
  55944. this.changing_ = false;
  55945. this.trigger("change");
  55946. };
  55947. track.addEventListener("enabledchange", track.enabledChange_);
  55948. }
  55949. removeTrack(rtrack) {
  55950. super.removeTrack(rtrack);
  55951. if (rtrack.removeEventListener && rtrack.enabledChange_) {
  55952. rtrack.removeEventListener("enabledchange", rtrack.enabledChange_);
  55953. rtrack.enabledChange_ = null;
  55954. }
  55955. }
  55956. }
  55957. const disableOthers$2 = function(list, track) {
  55958. for (let i2 = 0; i2 < list.length; i2++) {
  55959. if (!Object.keys(list[i2]).length || track.id === list[i2].id) {
  55960. continue;
  55961. }
  55962. list[i2].selected = false;
  55963. }
  55964. };
  55965. class VideoTrackList$1 extends TrackList$1 {
  55966. constructor(tracks = []) {
  55967. for (let i2 = tracks.length - 1; i2 >= 0; i2--) {
  55968. if (tracks[i2].selected) {
  55969. disableOthers$2(tracks, tracks[i2]);
  55970. break;
  55971. }
  55972. }
  55973. super(tracks);
  55974. this.changing_ = false;
  55975. Object.defineProperty(this, "selectedIndex", {
  55976. get() {
  55977. for (let i2 = 0; i2 < this.length; i2++) {
  55978. if (this[i2].selected) {
  55979. return i2;
  55980. }
  55981. }
  55982. return -1;
  55983. },
  55984. set() {
  55985. }
  55986. });
  55987. }
  55988. addTrack(track) {
  55989. if (track.selected) {
  55990. disableOthers$2(this, track);
  55991. }
  55992. super.addTrack(track);
  55993. if (!track.addEventListener) {
  55994. return;
  55995. }
  55996. track.selectedChange_ = () => {
  55997. if (this.changing_) {
  55998. return;
  55999. }
  56000. this.changing_ = true;
  56001. disableOthers$2(this, track);
  56002. this.changing_ = false;
  56003. this.trigger("change");
  56004. };
  56005. track.addEventListener("selectedchange", track.selectedChange_);
  56006. }
  56007. removeTrack(rtrack) {
  56008. super.removeTrack(rtrack);
  56009. if (rtrack.removeEventListener && rtrack.selectedChange_) {
  56010. rtrack.removeEventListener("selectedchange", rtrack.selectedChange_);
  56011. rtrack.selectedChange_ = null;
  56012. }
  56013. }
  56014. }
  56015. class TextTrackList$1 extends TrackList$1 {
  56016. addTrack(track) {
  56017. super.addTrack(track);
  56018. if (!this.queueChange_) {
  56019. this.queueChange_ = () => this.queueTrigger("change");
  56020. }
  56021. if (!this.triggerSelectedlanguagechange) {
  56022. this.triggerSelectedlanguagechange_ = () => this.trigger("selectedlanguagechange");
  56023. }
  56024. track.addEventListener("modechange", this.queueChange_);
  56025. const nonLanguageTextTrackKind = ["metadata", "chapters"];
  56026. if (nonLanguageTextTrackKind.indexOf(track.kind) === -1) {
  56027. track.addEventListener("modechange", this.triggerSelectedlanguagechange_);
  56028. }
  56029. }
  56030. removeTrack(rtrack) {
  56031. super.removeTrack(rtrack);
  56032. if (rtrack.removeEventListener) {
  56033. if (this.queueChange_) {
  56034. rtrack.removeEventListener("modechange", this.queueChange_);
  56035. }
  56036. if (this.selectedlanguagechange_) {
  56037. rtrack.removeEventListener("modechange", this.triggerSelectedlanguagechange_);
  56038. }
  56039. }
  56040. }
  56041. }
  56042. class HtmlTrackElementList$1 {
  56043. constructor(trackElements = []) {
  56044. this.trackElements_ = [];
  56045. Object.defineProperty(this, "length", {
  56046. get() {
  56047. return this.trackElements_.length;
  56048. }
  56049. });
  56050. for (let i2 = 0, length = trackElements.length; i2 < length; i2++) {
  56051. this.addTrackElement_(trackElements[i2]);
  56052. }
  56053. }
  56054. addTrackElement_(trackElement) {
  56055. const index2 = this.trackElements_.length;
  56056. if (!("" + index2 in this)) {
  56057. Object.defineProperty(this, index2, {
  56058. get() {
  56059. return this.trackElements_[index2];
  56060. }
  56061. });
  56062. }
  56063. if (this.trackElements_.indexOf(trackElement) === -1) {
  56064. this.trackElements_.push(trackElement);
  56065. }
  56066. }
  56067. getTrackElementByTrack_(track) {
  56068. let trackElement_;
  56069. for (let i2 = 0, length = this.trackElements_.length; i2 < length; i2++) {
  56070. if (track === this.trackElements_[i2].track) {
  56071. trackElement_ = this.trackElements_[i2];
  56072. break;
  56073. }
  56074. }
  56075. return trackElement_;
  56076. }
  56077. removeTrackElement_(trackElement) {
  56078. for (let i2 = 0, length = this.trackElements_.length; i2 < length; i2++) {
  56079. if (trackElement === this.trackElements_[i2]) {
  56080. if (this.trackElements_[i2].track && typeof this.trackElements_[i2].track.off === "function") {
  56081. this.trackElements_[i2].track.off();
  56082. }
  56083. if (typeof this.trackElements_[i2].off === "function") {
  56084. this.trackElements_[i2].off();
  56085. }
  56086. this.trackElements_.splice(i2, 1);
  56087. break;
  56088. }
  56089. }
  56090. }
  56091. }
  56092. class TextTrackCueList$1 {
  56093. constructor(cues) {
  56094. TextTrackCueList$1.prototype.setCues_.call(this, cues);
  56095. Object.defineProperty(this, "length", {
  56096. get() {
  56097. return this.length_;
  56098. }
  56099. });
  56100. }
  56101. setCues_(cues) {
  56102. const oldLength = this.length || 0;
  56103. let i2 = 0;
  56104. const l = cues.length;
  56105. this.cues_ = cues;
  56106. this.length_ = cues.length;
  56107. const defineProp = function(index2) {
  56108. if (!("" + index2 in this)) {
  56109. Object.defineProperty(this, "" + index2, {
  56110. get() {
  56111. return this.cues_[index2];
  56112. }
  56113. });
  56114. }
  56115. };
  56116. if (oldLength < l) {
  56117. i2 = oldLength;
  56118. for (; i2 < l; i2++) {
  56119. defineProp.call(this, i2);
  56120. }
  56121. }
  56122. }
  56123. getCueById(id) {
  56124. let result = null;
  56125. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  56126. const cue = this[i2];
  56127. if (cue.id === id) {
  56128. result = cue;
  56129. break;
  56130. }
  56131. }
  56132. return result;
  56133. }
  56134. }
  56135. const VideoTrackKind$1 = {
  56136. alternative: "alternative",
  56137. captions: "captions",
  56138. main: "main",
  56139. sign: "sign",
  56140. subtitles: "subtitles",
  56141. commentary: "commentary"
  56142. };
  56143. const AudioTrackKind$1 = {
  56144. "alternative": "alternative",
  56145. "descriptions": "descriptions",
  56146. "main": "main",
  56147. "main-desc": "main-desc",
  56148. "translation": "translation",
  56149. "commentary": "commentary"
  56150. };
  56151. const TextTrackKind$1 = {
  56152. subtitles: "subtitles",
  56153. captions: "captions",
  56154. descriptions: "descriptions",
  56155. chapters: "chapters",
  56156. metadata: "metadata"
  56157. };
  56158. const TextTrackMode$1 = {
  56159. disabled: "disabled",
  56160. hidden: "hidden",
  56161. showing: "showing"
  56162. };
  56163. class Track$1 extends EventTarget$2$1 {
  56164. constructor(options2 = {}) {
  56165. super();
  56166. const trackProps = {
  56167. id: options2.id || "vjs_track_" + newGUID$1(),
  56168. kind: options2.kind || "",
  56169. language: options2.language || ""
  56170. };
  56171. let label = options2.label || "";
  56172. for (const key in trackProps) {
  56173. Object.defineProperty(this, key, {
  56174. get() {
  56175. return trackProps[key];
  56176. },
  56177. set() {
  56178. }
  56179. });
  56180. }
  56181. Object.defineProperty(this, "label", {
  56182. get() {
  56183. return label;
  56184. },
  56185. set(newLabel) {
  56186. if (newLabel !== label) {
  56187. label = newLabel;
  56188. this.trigger("labelchange");
  56189. }
  56190. }
  56191. });
  56192. }
  56193. }
  56194. const parseUrl$1 = function(url) {
  56195. const props = ["protocol", "hostname", "port", "pathname", "search", "hash", "host"];
  56196. const a = document_1.createElement("a");
  56197. a.href = url;
  56198. const details = {};
  56199. for (let i2 = 0; i2 < props.length; i2++) {
  56200. details[props[i2]] = a[props[i2]];
  56201. }
  56202. if (details.protocol === "http:") {
  56203. details.host = details.host.replace(/:80$/, "");
  56204. }
  56205. if (details.protocol === "https:") {
  56206. details.host = details.host.replace(/:443$/, "");
  56207. }
  56208. if (!details.protocol) {
  56209. details.protocol = window_1.location.protocol;
  56210. }
  56211. if (!details.host) {
  56212. details.host = window_1.location.host;
  56213. }
  56214. return details;
  56215. };
  56216. const getAbsoluteURL$1 = function(url) {
  56217. if (!url.match(/^https?:\/\//)) {
  56218. const a = document_1.createElement("a");
  56219. a.href = url;
  56220. url = a.href;
  56221. }
  56222. return url;
  56223. };
  56224. const getFileExtension$1 = function(path) {
  56225. if (typeof path === "string") {
  56226. const splitPathRe = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/;
  56227. const pathParts = splitPathRe.exec(path);
  56228. if (pathParts) {
  56229. return pathParts.pop().toLowerCase();
  56230. }
  56231. }
  56232. return "";
  56233. };
  56234. const isCrossOrigin$1 = function(url, winLoc = window_1.location) {
  56235. const urlInfo = parseUrl$1(url);
  56236. const srcProtocol = urlInfo.protocol === ":" ? winLoc.protocol : urlInfo.protocol;
  56237. const crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host;
  56238. return crossOrigin;
  56239. };
  56240. var Url$2 = /* @__PURE__ */ Object.freeze({
  56241. __proto__: null,
  56242. parseUrl: parseUrl$1,
  56243. getAbsoluteURL: getAbsoluteURL$1,
  56244. getFileExtension: getFileExtension$1,
  56245. isCrossOrigin: isCrossOrigin$1
  56246. });
  56247. const parseCues$1 = function(srcContent, track) {
  56248. const parser2 = new window_1.WebVTT.Parser(window_1, window_1.vttjs, window_1.WebVTT.StringDecoder());
  56249. const errors2 = [];
  56250. parser2.oncue = function(cue) {
  56251. track.addCue(cue);
  56252. };
  56253. parser2.onparsingerror = function(error) {
  56254. errors2.push(error);
  56255. };
  56256. parser2.onflush = function() {
  56257. track.trigger({
  56258. type: "loadeddata",
  56259. target: track
  56260. });
  56261. };
  56262. parser2.parse(srcContent);
  56263. if (errors2.length > 0) {
  56264. if (window_1.console && window_1.console.groupCollapsed) {
  56265. window_1.console.groupCollapsed(`Text Track parsing errors for ${track.src}`);
  56266. }
  56267. errors2.forEach((error) => log$1$1.error(error));
  56268. if (window_1.console && window_1.console.groupEnd) {
  56269. window_1.console.groupEnd();
  56270. }
  56271. }
  56272. parser2.flush();
  56273. };
  56274. const loadTrack$1 = function(src, track) {
  56275. const opts = {
  56276. uri: src
  56277. };
  56278. const crossOrigin = isCrossOrigin$1(src);
  56279. if (crossOrigin) {
  56280. opts.cors = crossOrigin;
  56281. }
  56282. const withCredentials = track.tech_.crossOrigin() === "use-credentials";
  56283. if (withCredentials) {
  56284. opts.withCredentials = withCredentials;
  56285. }
  56286. XHR(opts, bind_(this, function(err, response, responseBody) {
  56287. if (err) {
  56288. return log$1$1.error(err, response);
  56289. }
  56290. track.loaded_ = true;
  56291. if (typeof window_1.WebVTT !== "function") {
  56292. if (track.tech_) {
  56293. track.tech_.any(["vttjsloaded", "vttjserror"], (event2) => {
  56294. if (event2.type === "vttjserror") {
  56295. log$1$1.error(`vttjs failed to load, stopping trying to process ${track.src}`);
  56296. return;
  56297. }
  56298. return parseCues$1(responseBody, track);
  56299. });
  56300. }
  56301. } else {
  56302. parseCues$1(responseBody, track);
  56303. }
  56304. }));
  56305. };
  56306. class TextTrack$1 extends Track$1 {
  56307. constructor(options2 = {}) {
  56308. if (!options2.tech) {
  56309. throw new Error("A tech was not provided.");
  56310. }
  56311. const settings = merge$1(options2, {
  56312. kind: TextTrackKind$1[options2.kind] || "subtitles",
  56313. language: options2.language || options2.srclang || ""
  56314. });
  56315. let mode = TextTrackMode$1[settings.mode] || "disabled";
  56316. const default_ = settings.default;
  56317. if (settings.kind === "metadata" || settings.kind === "chapters") {
  56318. mode = "hidden";
  56319. }
  56320. super(settings);
  56321. this.tech_ = settings.tech;
  56322. this.cues_ = [];
  56323. this.activeCues_ = [];
  56324. this.preload_ = this.tech_.preloadTextTracks !== false;
  56325. const cues = new TextTrackCueList$1(this.cues_);
  56326. const activeCues = new TextTrackCueList$1(this.activeCues_);
  56327. let changed = false;
  56328. this.timeupdateHandler = bind_(this, function(event2 = {}) {
  56329. if (this.tech_.isDisposed()) {
  56330. return;
  56331. }
  56332. if (!this.tech_.isReady_) {
  56333. if (event2.type !== "timeupdate") {
  56334. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  56335. }
  56336. return;
  56337. }
  56338. this.activeCues = this.activeCues;
  56339. if (changed) {
  56340. this.trigger("cuechange");
  56341. changed = false;
  56342. }
  56343. if (event2.type !== "timeupdate") {
  56344. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  56345. }
  56346. });
  56347. const disposeHandler = () => {
  56348. this.stopTracking();
  56349. };
  56350. this.tech_.one("dispose", disposeHandler);
  56351. if (mode !== "disabled") {
  56352. this.startTracking();
  56353. }
  56354. Object.defineProperties(this, {
  56355. default: {
  56356. get() {
  56357. return default_;
  56358. },
  56359. set() {
  56360. }
  56361. },
  56362. mode: {
  56363. get() {
  56364. return mode;
  56365. },
  56366. set(newMode) {
  56367. if (!TextTrackMode$1[newMode]) {
  56368. return;
  56369. }
  56370. if (mode === newMode) {
  56371. return;
  56372. }
  56373. mode = newMode;
  56374. if (!this.preload_ && mode !== "disabled" && this.cues.length === 0) {
  56375. loadTrack$1(this.src, this);
  56376. }
  56377. this.stopTracking();
  56378. if (mode !== "disabled") {
  56379. this.startTracking();
  56380. }
  56381. this.trigger("modechange");
  56382. }
  56383. },
  56384. cues: {
  56385. get() {
  56386. if (!this.loaded_) {
  56387. return null;
  56388. }
  56389. return cues;
  56390. },
  56391. set() {
  56392. }
  56393. },
  56394. activeCues: {
  56395. get() {
  56396. if (!this.loaded_) {
  56397. return null;
  56398. }
  56399. if (this.cues.length === 0) {
  56400. return activeCues;
  56401. }
  56402. const ct2 = this.tech_.currentTime();
  56403. const active = [];
  56404. for (let i2 = 0, l = this.cues.length; i2 < l; i2++) {
  56405. const cue = this.cues[i2];
  56406. if (cue.startTime <= ct2 && cue.endTime >= ct2) {
  56407. active.push(cue);
  56408. }
  56409. }
  56410. changed = false;
  56411. if (active.length !== this.activeCues_.length) {
  56412. changed = true;
  56413. } else {
  56414. for (let i2 = 0; i2 < active.length; i2++) {
  56415. if (this.activeCues_.indexOf(active[i2]) === -1) {
  56416. changed = true;
  56417. }
  56418. }
  56419. }
  56420. this.activeCues_ = active;
  56421. activeCues.setCues_(this.activeCues_);
  56422. return activeCues;
  56423. },
  56424. set() {
  56425. }
  56426. }
  56427. });
  56428. if (settings.src) {
  56429. this.src = settings.src;
  56430. if (!this.preload_) {
  56431. this.loaded_ = true;
  56432. }
  56433. if (this.preload_ || settings.kind !== "subtitles" && settings.kind !== "captions") {
  56434. loadTrack$1(this.src, this);
  56435. }
  56436. } else {
  56437. this.loaded_ = true;
  56438. }
  56439. }
  56440. startTracking() {
  56441. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  56442. this.tech_.on("timeupdate", this.timeupdateHandler);
  56443. }
  56444. stopTracking() {
  56445. if (this.rvf_) {
  56446. this.tech_.cancelVideoFrameCallback(this.rvf_);
  56447. this.rvf_ = void 0;
  56448. }
  56449. this.tech_.off("timeupdate", this.timeupdateHandler);
  56450. }
  56451. addCue(originalCue) {
  56452. let cue = originalCue;
  56453. if (window_1.vttjs && !(originalCue instanceof window_1.vttjs.VTTCue)) {
  56454. cue = new window_1.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);
  56455. for (const prop in originalCue) {
  56456. if (!(prop in cue)) {
  56457. cue[prop] = originalCue[prop];
  56458. }
  56459. }
  56460. cue.id = originalCue.id;
  56461. cue.originalCue_ = originalCue;
  56462. }
  56463. const tracks = this.tech_.textTracks();
  56464. for (let i2 = 0; i2 < tracks.length; i2++) {
  56465. if (tracks[i2] !== this) {
  56466. tracks[i2].removeCue(cue);
  56467. }
  56468. }
  56469. this.cues_.push(cue);
  56470. this.cues.setCues_(this.cues_);
  56471. }
  56472. removeCue(removeCue) {
  56473. let i2 = this.cues_.length;
  56474. while (i2--) {
  56475. const cue = this.cues_[i2];
  56476. if (cue === removeCue || cue.originalCue_ && cue.originalCue_ === removeCue) {
  56477. this.cues_.splice(i2, 1);
  56478. this.cues.setCues_(this.cues_);
  56479. break;
  56480. }
  56481. }
  56482. }
  56483. }
  56484. TextTrack$1.prototype.allowedEvents_ = {
  56485. cuechange: "cuechange"
  56486. };
  56487. class AudioTrack$1 extends Track$1 {
  56488. constructor(options2 = {}) {
  56489. const settings = merge$1(options2, {
  56490. kind: AudioTrackKind$1[options2.kind] || ""
  56491. });
  56492. super(settings);
  56493. let enabled = false;
  56494. Object.defineProperty(this, "enabled", {
  56495. get() {
  56496. return enabled;
  56497. },
  56498. set(newEnabled) {
  56499. if (typeof newEnabled !== "boolean" || newEnabled === enabled) {
  56500. return;
  56501. }
  56502. enabled = newEnabled;
  56503. this.trigger("enabledchange");
  56504. }
  56505. });
  56506. if (settings.enabled) {
  56507. this.enabled = settings.enabled;
  56508. }
  56509. this.loaded_ = true;
  56510. }
  56511. }
  56512. class VideoTrack$1 extends Track$1 {
  56513. constructor(options2 = {}) {
  56514. const settings = merge$1(options2, {
  56515. kind: VideoTrackKind$1[options2.kind] || ""
  56516. });
  56517. super(settings);
  56518. let selected = false;
  56519. Object.defineProperty(this, "selected", {
  56520. get() {
  56521. return selected;
  56522. },
  56523. set(newSelected) {
  56524. if (typeof newSelected !== "boolean" || newSelected === selected) {
  56525. return;
  56526. }
  56527. selected = newSelected;
  56528. this.trigger("selectedchange");
  56529. }
  56530. });
  56531. if (settings.selected) {
  56532. this.selected = settings.selected;
  56533. }
  56534. }
  56535. }
  56536. class HTMLTrackElement$1 extends EventTarget$2$1 {
  56537. constructor(options2 = {}) {
  56538. super();
  56539. let readyState;
  56540. const track = new TextTrack$1(options2);
  56541. this.kind = track.kind;
  56542. this.src = track.src;
  56543. this.srclang = track.language;
  56544. this.label = track.label;
  56545. this.default = track.default;
  56546. Object.defineProperties(this, {
  56547. readyState: {
  56548. get() {
  56549. return readyState;
  56550. }
  56551. },
  56552. track: {
  56553. get() {
  56554. return track;
  56555. }
  56556. }
  56557. });
  56558. readyState = HTMLTrackElement$1.NONE;
  56559. track.addEventListener("loadeddata", () => {
  56560. readyState = HTMLTrackElement$1.LOADED;
  56561. this.trigger({
  56562. type: "load",
  56563. target: this
  56564. });
  56565. });
  56566. }
  56567. }
  56568. HTMLTrackElement$1.prototype.allowedEvents_ = {
  56569. load: "load"
  56570. };
  56571. HTMLTrackElement$1.NONE = 0;
  56572. HTMLTrackElement$1.LOADING = 1;
  56573. HTMLTrackElement$1.LOADED = 2;
  56574. HTMLTrackElement$1.ERROR = 3;
  56575. const NORMAL$1 = {
  56576. audio: {
  56577. ListClass: AudioTrackList$1,
  56578. TrackClass: AudioTrack$1,
  56579. capitalName: "Audio"
  56580. },
  56581. video: {
  56582. ListClass: VideoTrackList$1,
  56583. TrackClass: VideoTrack$1,
  56584. capitalName: "Video"
  56585. },
  56586. text: {
  56587. ListClass: TextTrackList$1,
  56588. TrackClass: TextTrack$1,
  56589. capitalName: "Text"
  56590. }
  56591. };
  56592. Object.keys(NORMAL$1).forEach(function(type2) {
  56593. NORMAL$1[type2].getterName = `${type2}Tracks`;
  56594. NORMAL$1[type2].privateName = `${type2}Tracks_`;
  56595. });
  56596. const REMOTE$1 = {
  56597. remoteText: {
  56598. ListClass: TextTrackList$1,
  56599. TrackClass: TextTrack$1,
  56600. capitalName: "RemoteText",
  56601. getterName: "remoteTextTracks",
  56602. privateName: "remoteTextTracks_"
  56603. },
  56604. remoteTextEl: {
  56605. ListClass: HtmlTrackElementList$1,
  56606. TrackClass: HTMLTrackElement$1,
  56607. capitalName: "RemoteTextTrackEls",
  56608. getterName: "remoteTextTrackEls",
  56609. privateName: "remoteTextTrackEls_"
  56610. }
  56611. };
  56612. const ALL$1 = Object.assign({}, NORMAL$1, REMOTE$1);
  56613. REMOTE$1.names = Object.keys(REMOTE$1);
  56614. NORMAL$1.names = Object.keys(NORMAL$1);
  56615. ALL$1.names = [].concat(REMOTE$1.names).concat(NORMAL$1.names);
  56616. function createTrackHelper$1(self2, kind, label, language, options2 = {}) {
  56617. const tracks = self2.textTracks();
  56618. options2.kind = kind;
  56619. if (label) {
  56620. options2.label = label;
  56621. }
  56622. if (language) {
  56623. options2.language = language;
  56624. }
  56625. options2.tech = self2;
  56626. const track = new ALL$1.text.TrackClass(options2);
  56627. tracks.addTrack(track);
  56628. return track;
  56629. }
  56630. class Tech$2 extends Component$1$1 {
  56631. constructor(options2 = {}, ready = function() {
  56632. }) {
  56633. options2.reportTouchActivity = false;
  56634. super(null, options2, ready);
  56635. this.onDurationChange_ = (e) => this.onDurationChange(e);
  56636. this.trackProgress_ = (e) => this.trackProgress(e);
  56637. this.trackCurrentTime_ = (e) => this.trackCurrentTime(e);
  56638. this.stopTrackingCurrentTime_ = (e) => this.stopTrackingCurrentTime(e);
  56639. this.disposeSourceHandler_ = (e) => this.disposeSourceHandler(e);
  56640. this.queuedHanders_ = /* @__PURE__ */ new Set();
  56641. this.hasStarted_ = false;
  56642. this.on("playing", function() {
  56643. this.hasStarted_ = true;
  56644. });
  56645. this.on("loadstart", function() {
  56646. this.hasStarted_ = false;
  56647. });
  56648. ALL$1.names.forEach((name) => {
  56649. const props = ALL$1[name];
  56650. if (options2 && options2[props.getterName]) {
  56651. this[props.privateName] = options2[props.getterName];
  56652. }
  56653. });
  56654. if (!this.featuresProgressEvents) {
  56655. this.manualProgressOn();
  56656. }
  56657. if (!this.featuresTimeupdateEvents) {
  56658. this.manualTimeUpdatesOn();
  56659. }
  56660. ["Text", "Audio", "Video"].forEach((track) => {
  56661. if (options2[`native${track}Tracks`] === false) {
  56662. this[`featuresNative${track}Tracks`] = false;
  56663. }
  56664. });
  56665. if (options2.nativeCaptions === false || options2.nativeTextTracks === false) {
  56666. this.featuresNativeTextTracks = false;
  56667. } else if (options2.nativeCaptions === true || options2.nativeTextTracks === true) {
  56668. this.featuresNativeTextTracks = true;
  56669. }
  56670. if (!this.featuresNativeTextTracks) {
  56671. this.emulateTextTracks();
  56672. }
  56673. this.preloadTextTracks = options2.preloadTextTracks !== false;
  56674. this.autoRemoteTextTracks_ = new ALL$1.text.ListClass();
  56675. this.initTrackListeners();
  56676. if (!options2.nativeControlsForTouch) {
  56677. this.emitTapEvents();
  56678. }
  56679. if (this.constructor) {
  56680. this.name_ = this.constructor.name || "Unknown Tech";
  56681. }
  56682. }
  56683. triggerSourceset(src) {
  56684. if (!this.isReady_) {
  56685. this.one("ready", () => this.setTimeout(() => this.triggerSourceset(src), 1));
  56686. }
  56687. this.trigger({
  56688. src,
  56689. type: "sourceset"
  56690. });
  56691. }
  56692. manualProgressOn() {
  56693. this.on("durationchange", this.onDurationChange_);
  56694. this.manualProgress = true;
  56695. this.one("ready", this.trackProgress_);
  56696. }
  56697. manualProgressOff() {
  56698. this.manualProgress = false;
  56699. this.stopTrackingProgress();
  56700. this.off("durationchange", this.onDurationChange_);
  56701. }
  56702. trackProgress(event2) {
  56703. this.stopTrackingProgress();
  56704. this.progressInterval = this.setInterval(bind_(this, function() {
  56705. const numBufferedPercent = this.bufferedPercent();
  56706. if (this.bufferedPercent_ !== numBufferedPercent) {
  56707. this.trigger("progress");
  56708. }
  56709. this.bufferedPercent_ = numBufferedPercent;
  56710. if (numBufferedPercent === 1) {
  56711. this.stopTrackingProgress();
  56712. }
  56713. }), 500);
  56714. }
  56715. onDurationChange(event2) {
  56716. this.duration_ = this.duration();
  56717. }
  56718. buffered() {
  56719. return createTimeRanges$1(0, 0);
  56720. }
  56721. bufferedPercent() {
  56722. return bufferedPercent$1(this.buffered(), this.duration_);
  56723. }
  56724. stopTrackingProgress() {
  56725. this.clearInterval(this.progressInterval);
  56726. }
  56727. manualTimeUpdatesOn() {
  56728. this.manualTimeUpdates = true;
  56729. this.on("play", this.trackCurrentTime_);
  56730. this.on("pause", this.stopTrackingCurrentTime_);
  56731. }
  56732. manualTimeUpdatesOff() {
  56733. this.manualTimeUpdates = false;
  56734. this.stopTrackingCurrentTime();
  56735. this.off("play", this.trackCurrentTime_);
  56736. this.off("pause", this.stopTrackingCurrentTime_);
  56737. }
  56738. trackCurrentTime() {
  56739. if (this.currentTimeInterval) {
  56740. this.stopTrackingCurrentTime();
  56741. }
  56742. this.currentTimeInterval = this.setInterval(function() {
  56743. this.trigger({
  56744. type: "timeupdate",
  56745. target: this,
  56746. manuallyTriggered: true
  56747. });
  56748. }, 250);
  56749. }
  56750. stopTrackingCurrentTime() {
  56751. this.clearInterval(this.currentTimeInterval);
  56752. this.trigger({
  56753. type: "timeupdate",
  56754. target: this,
  56755. manuallyTriggered: true
  56756. });
  56757. }
  56758. dispose() {
  56759. this.clearTracks(NORMAL$1.names);
  56760. if (this.manualProgress) {
  56761. this.manualProgressOff();
  56762. }
  56763. if (this.manualTimeUpdates) {
  56764. this.manualTimeUpdatesOff();
  56765. }
  56766. super.dispose();
  56767. }
  56768. clearTracks(types) {
  56769. types = [].concat(types);
  56770. types.forEach((type2) => {
  56771. const list = this[`${type2}Tracks`]() || [];
  56772. let i2 = list.length;
  56773. while (i2--) {
  56774. const track = list[i2];
  56775. if (type2 === "text") {
  56776. this.removeRemoteTextTrack(track);
  56777. }
  56778. list.removeTrack(track);
  56779. }
  56780. });
  56781. }
  56782. cleanupAutoTextTracks() {
  56783. const list = this.autoRemoteTextTracks_ || [];
  56784. let i2 = list.length;
  56785. while (i2--) {
  56786. const track = list[i2];
  56787. this.removeRemoteTextTrack(track);
  56788. }
  56789. }
  56790. reset() {
  56791. }
  56792. crossOrigin() {
  56793. }
  56794. setCrossOrigin() {
  56795. }
  56796. error(err) {
  56797. if (err !== void 0) {
  56798. this.error_ = new MediaError$1(err);
  56799. this.trigger("error");
  56800. }
  56801. return this.error_;
  56802. }
  56803. played() {
  56804. if (this.hasStarted_) {
  56805. return createTimeRanges$1(0, 0);
  56806. }
  56807. return createTimeRanges$1();
  56808. }
  56809. play() {
  56810. }
  56811. setScrubbing(_isScrubbing) {
  56812. }
  56813. scrubbing() {
  56814. }
  56815. setCurrentTime(_seconds) {
  56816. if (this.manualTimeUpdates) {
  56817. this.trigger({
  56818. type: "timeupdate",
  56819. target: this,
  56820. manuallyTriggered: true
  56821. });
  56822. }
  56823. }
  56824. initTrackListeners() {
  56825. NORMAL$1.names.forEach((name) => {
  56826. const props = NORMAL$1[name];
  56827. const trackListChanges = () => {
  56828. this.trigger(`${name}trackchange`);
  56829. };
  56830. const tracks = this[props.getterName]();
  56831. tracks.addEventListener("removetrack", trackListChanges);
  56832. tracks.addEventListener("addtrack", trackListChanges);
  56833. this.on("dispose", () => {
  56834. tracks.removeEventListener("removetrack", trackListChanges);
  56835. tracks.removeEventListener("addtrack", trackListChanges);
  56836. });
  56837. });
  56838. }
  56839. addWebVttScript_() {
  56840. if (window_1.WebVTT) {
  56841. return;
  56842. }
  56843. if (document_1.body.contains(this.el())) {
  56844. if (!this.options_["vtt.js"] && isPlain$1(vtt) && Object.keys(vtt).length > 0) {
  56845. this.trigger("vttjsloaded");
  56846. return;
  56847. }
  56848. const script = document_1.createElement("script");
  56849. script.src = this.options_["vtt.js"] || "https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js";
  56850. script.onload = () => {
  56851. this.trigger("vttjsloaded");
  56852. };
  56853. script.onerror = () => {
  56854. this.trigger("vttjserror");
  56855. };
  56856. this.on("dispose", () => {
  56857. script.onload = null;
  56858. script.onerror = null;
  56859. });
  56860. window_1.WebVTT = true;
  56861. this.el().parentNode.appendChild(script);
  56862. } else {
  56863. this.ready(this.addWebVttScript_);
  56864. }
  56865. }
  56866. emulateTextTracks() {
  56867. const tracks = this.textTracks();
  56868. const remoteTracks = this.remoteTextTracks();
  56869. const handleAddTrack = (e) => tracks.addTrack(e.track);
  56870. const handleRemoveTrack = (e) => tracks.removeTrack(e.track);
  56871. remoteTracks.on("addtrack", handleAddTrack);
  56872. remoteTracks.on("removetrack", handleRemoveTrack);
  56873. this.addWebVttScript_();
  56874. const updateDisplay = () => this.trigger("texttrackchange");
  56875. const textTracksChanges = () => {
  56876. updateDisplay();
  56877. for (let i2 = 0; i2 < tracks.length; i2++) {
  56878. const track = tracks[i2];
  56879. track.removeEventListener("cuechange", updateDisplay);
  56880. if (track.mode === "showing") {
  56881. track.addEventListener("cuechange", updateDisplay);
  56882. }
  56883. }
  56884. };
  56885. textTracksChanges();
  56886. tracks.addEventListener("change", textTracksChanges);
  56887. tracks.addEventListener("addtrack", textTracksChanges);
  56888. tracks.addEventListener("removetrack", textTracksChanges);
  56889. this.on("dispose", function() {
  56890. remoteTracks.off("addtrack", handleAddTrack);
  56891. remoteTracks.off("removetrack", handleRemoveTrack);
  56892. tracks.removeEventListener("change", textTracksChanges);
  56893. tracks.removeEventListener("addtrack", textTracksChanges);
  56894. tracks.removeEventListener("removetrack", textTracksChanges);
  56895. for (let i2 = 0; i2 < tracks.length; i2++) {
  56896. const track = tracks[i2];
  56897. track.removeEventListener("cuechange", updateDisplay);
  56898. }
  56899. });
  56900. }
  56901. addTextTrack(kind, label, language) {
  56902. if (!kind) {
  56903. throw new Error("TextTrack kind is required but was not provided");
  56904. }
  56905. return createTrackHelper$1(this, kind, label, language);
  56906. }
  56907. createRemoteTextTrack(options2) {
  56908. const track = merge$1(options2, {
  56909. tech: this
  56910. });
  56911. return new REMOTE$1.remoteTextEl.TrackClass(track);
  56912. }
  56913. addRemoteTextTrack(options2 = {}, manualCleanup) {
  56914. const htmlTrackElement = this.createRemoteTextTrack(options2);
  56915. if (typeof manualCleanup !== "boolean") {
  56916. manualCleanup = false;
  56917. }
  56918. this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);
  56919. this.remoteTextTracks().addTrack(htmlTrackElement.track);
  56920. if (manualCleanup === false) {
  56921. this.ready(() => this.autoRemoteTextTracks_.addTrack(htmlTrackElement.track));
  56922. }
  56923. return htmlTrackElement;
  56924. }
  56925. removeRemoteTextTrack(track) {
  56926. const trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track);
  56927. this.remoteTextTrackEls().removeTrackElement_(trackElement);
  56928. this.remoteTextTracks().removeTrack(track);
  56929. this.autoRemoteTextTracks_.removeTrack(track);
  56930. }
  56931. getVideoPlaybackQuality() {
  56932. return {};
  56933. }
  56934. requestPictureInPicture() {
  56935. return Promise.reject();
  56936. }
  56937. disablePictureInPicture() {
  56938. return true;
  56939. }
  56940. setDisablePictureInPicture() {
  56941. }
  56942. requestVideoFrameCallback(cb) {
  56943. const id = newGUID$1();
  56944. if (!this.isReady_ || this.paused()) {
  56945. this.queuedHanders_.add(id);
  56946. this.one("playing", () => {
  56947. if (this.queuedHanders_.has(id)) {
  56948. this.queuedHanders_.delete(id);
  56949. cb();
  56950. }
  56951. });
  56952. } else {
  56953. this.requestNamedAnimationFrame(id, cb);
  56954. }
  56955. return id;
  56956. }
  56957. cancelVideoFrameCallback(id) {
  56958. if (this.queuedHanders_.has(id)) {
  56959. this.queuedHanders_.delete(id);
  56960. } else {
  56961. this.cancelNamedAnimationFrame(id);
  56962. }
  56963. }
  56964. setPoster() {
  56965. }
  56966. playsinline() {
  56967. }
  56968. setPlaysinline() {
  56969. }
  56970. overrideNativeAudioTracks(override) {
  56971. }
  56972. overrideNativeVideoTracks(override) {
  56973. }
  56974. canPlayType(_type) {
  56975. return "";
  56976. }
  56977. static canPlayType(_type) {
  56978. return "";
  56979. }
  56980. static canPlaySource(srcObj, options2) {
  56981. return Tech$2.canPlayType(srcObj.type);
  56982. }
  56983. static isTech(component) {
  56984. return component.prototype instanceof Tech$2 || component instanceof Tech$2 || component === Tech$2;
  56985. }
  56986. static registerTech(name, tech) {
  56987. if (!Tech$2.techs_) {
  56988. Tech$2.techs_ = {};
  56989. }
  56990. if (!Tech$2.isTech(tech)) {
  56991. throw new Error(`Tech ${name} must be a Tech`);
  56992. }
  56993. if (!Tech$2.canPlayType) {
  56994. throw new Error("Techs must have a static canPlayType method on them");
  56995. }
  56996. if (!Tech$2.canPlaySource) {
  56997. throw new Error("Techs must have a static canPlaySource method on them");
  56998. }
  56999. name = toTitleCase$1$1(name);
  57000. Tech$2.techs_[name] = tech;
  57001. Tech$2.techs_[toLowerCase$1(name)] = tech;
  57002. if (name !== "Tech") {
  57003. Tech$2.defaultTechOrder_.push(name);
  57004. }
  57005. return tech;
  57006. }
  57007. static getTech(name) {
  57008. if (!name) {
  57009. return;
  57010. }
  57011. if (Tech$2.techs_ && Tech$2.techs_[name]) {
  57012. return Tech$2.techs_[name];
  57013. }
  57014. name = toTitleCase$1$1(name);
  57015. if (window_1 && window_1.videojs && window_1.videojs[name]) {
  57016. log$1$1.warn(`The ${name} tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)`);
  57017. return window_1.videojs[name];
  57018. }
  57019. }
  57020. }
  57021. ALL$1.names.forEach(function(name) {
  57022. const props = ALL$1[name];
  57023. Tech$2.prototype[props.getterName] = function() {
  57024. this[props.privateName] = this[props.privateName] || new props.ListClass();
  57025. return this[props.privateName];
  57026. };
  57027. });
  57028. Tech$2.prototype.featuresVolumeControl = true;
  57029. Tech$2.prototype.featuresMuteControl = true;
  57030. Tech$2.prototype.featuresFullscreenResize = false;
  57031. Tech$2.prototype.featuresPlaybackRate = false;
  57032. Tech$2.prototype.featuresProgressEvents = false;
  57033. Tech$2.prototype.featuresSourceset = false;
  57034. Tech$2.prototype.featuresTimeupdateEvents = false;
  57035. Tech$2.prototype.featuresNativeTextTracks = false;
  57036. Tech$2.prototype.featuresVideoFrameCallback = false;
  57037. Tech$2.withSourceHandlers = function(_Tech) {
  57038. _Tech.registerSourceHandler = function(handler, index2) {
  57039. let handlers = _Tech.sourceHandlers;
  57040. if (!handlers) {
  57041. handlers = _Tech.sourceHandlers = [];
  57042. }
  57043. if (index2 === void 0) {
  57044. index2 = handlers.length;
  57045. }
  57046. handlers.splice(index2, 0, handler);
  57047. };
  57048. _Tech.canPlayType = function(type2) {
  57049. const handlers = _Tech.sourceHandlers || [];
  57050. let can;
  57051. for (let i2 = 0; i2 < handlers.length; i2++) {
  57052. can = handlers[i2].canPlayType(type2);
  57053. if (can) {
  57054. return can;
  57055. }
  57056. }
  57057. return "";
  57058. };
  57059. _Tech.selectSourceHandler = function(source, options2) {
  57060. const handlers = _Tech.sourceHandlers || [];
  57061. let can;
  57062. for (let i2 = 0; i2 < handlers.length; i2++) {
  57063. can = handlers[i2].canHandleSource(source, options2);
  57064. if (can) {
  57065. return handlers[i2];
  57066. }
  57067. }
  57068. return null;
  57069. };
  57070. _Tech.canPlaySource = function(srcObj, options2) {
  57071. const sh = _Tech.selectSourceHandler(srcObj, options2);
  57072. if (sh) {
  57073. return sh.canHandleSource(srcObj, options2);
  57074. }
  57075. return "";
  57076. };
  57077. const deferrable = ["seekable", "seeking", "duration"];
  57078. deferrable.forEach(function(fnName) {
  57079. const originalFn = this[fnName];
  57080. if (typeof originalFn !== "function") {
  57081. return;
  57082. }
  57083. this[fnName] = function() {
  57084. if (this.sourceHandler_ && this.sourceHandler_[fnName]) {
  57085. return this.sourceHandler_[fnName].apply(this.sourceHandler_, arguments);
  57086. }
  57087. return originalFn.apply(this, arguments);
  57088. };
  57089. }, _Tech.prototype);
  57090. _Tech.prototype.setSource = function(source) {
  57091. let sh = _Tech.selectSourceHandler(source, this.options_);
  57092. if (!sh) {
  57093. if (_Tech.nativeSourceHandler) {
  57094. sh = _Tech.nativeSourceHandler;
  57095. } else {
  57096. log$1$1.error("No source handler found for the current source.");
  57097. }
  57098. }
  57099. this.disposeSourceHandler();
  57100. this.off("dispose", this.disposeSourceHandler_);
  57101. if (sh !== _Tech.nativeSourceHandler) {
  57102. this.currentSource_ = source;
  57103. }
  57104. this.sourceHandler_ = sh.handleSource(source, this, this.options_);
  57105. this.one("dispose", this.disposeSourceHandler_);
  57106. };
  57107. _Tech.prototype.disposeSourceHandler = function() {
  57108. if (this.currentSource_) {
  57109. this.clearTracks(["audio", "video"]);
  57110. this.currentSource_ = null;
  57111. }
  57112. this.cleanupAutoTextTracks();
  57113. if (this.sourceHandler_) {
  57114. if (this.sourceHandler_.dispose) {
  57115. this.sourceHandler_.dispose();
  57116. }
  57117. this.sourceHandler_ = null;
  57118. }
  57119. };
  57120. };
  57121. Component$1$1.registerComponent("Tech", Tech$2);
  57122. Tech$2.registerTech("Tech", Tech$2);
  57123. Tech$2.defaultTechOrder_ = [];
  57124. const middlewares$1 = {};
  57125. const middlewareInstances$1 = {};
  57126. const TERMINATOR$1 = {};
  57127. function use$1(type2, middleware) {
  57128. middlewares$1[type2] = middlewares$1[type2] || [];
  57129. middlewares$1[type2].push(middleware);
  57130. }
  57131. function setSource$1(player, src, next) {
  57132. player.setTimeout(() => setSourceHelper$1(src, middlewares$1[src.type], next, player), 1);
  57133. }
  57134. function setTech$1(middleware, tech) {
  57135. middleware.forEach((mw) => mw.setTech && mw.setTech(tech));
  57136. }
  57137. function get$1(middleware, tech, method) {
  57138. return middleware.reduceRight(middlewareIterator$1(method), tech[method]());
  57139. }
  57140. function set$1(middleware, tech, method, arg) {
  57141. return tech[method](middleware.reduce(middlewareIterator$1(method), arg));
  57142. }
  57143. function mediate$1(middleware, tech, method, arg = null) {
  57144. const callMethod = "call" + toTitleCase$1$1(method);
  57145. const middlewareValue = middleware.reduce(middlewareIterator$1(callMethod), arg);
  57146. const terminated = middlewareValue === TERMINATOR$1;
  57147. const returnValue = terminated ? null : tech[method](middlewareValue);
  57148. executeRight$1(middleware, method, returnValue, terminated);
  57149. return returnValue;
  57150. }
  57151. const allowedGetters$1 = {
  57152. buffered: 1,
  57153. currentTime: 1,
  57154. duration: 1,
  57155. muted: 1,
  57156. played: 1,
  57157. paused: 1,
  57158. seekable: 1,
  57159. volume: 1,
  57160. ended: 1
  57161. };
  57162. const allowedSetters$1 = {
  57163. setCurrentTime: 1,
  57164. setMuted: 1,
  57165. setVolume: 1
  57166. };
  57167. const allowedMediators$1 = {
  57168. play: 1,
  57169. pause: 1
  57170. };
  57171. function middlewareIterator$1(method) {
  57172. return (value, mw) => {
  57173. if (value === TERMINATOR$1) {
  57174. return TERMINATOR$1;
  57175. }
  57176. if (mw[method]) {
  57177. return mw[method](value);
  57178. }
  57179. return value;
  57180. };
  57181. }
  57182. function executeRight$1(mws, method, value, terminated) {
  57183. for (let i2 = mws.length - 1; i2 >= 0; i2--) {
  57184. const mw = mws[i2];
  57185. if (mw[method]) {
  57186. mw[method](terminated, value);
  57187. }
  57188. }
  57189. }
  57190. function clearCacheForPlayer$1(player) {
  57191. middlewareInstances$1[player.id()] = null;
  57192. }
  57193. function getOrCreateFactory$1(player, mwFactory) {
  57194. const mws = middlewareInstances$1[player.id()];
  57195. let mw = null;
  57196. if (mws === void 0 || mws === null) {
  57197. mw = mwFactory(player);
  57198. middlewareInstances$1[player.id()] = [[mwFactory, mw]];
  57199. return mw;
  57200. }
  57201. for (let i2 = 0; i2 < mws.length; i2++) {
  57202. const [mwf, mwi] = mws[i2];
  57203. if (mwf !== mwFactory) {
  57204. continue;
  57205. }
  57206. mw = mwi;
  57207. }
  57208. if (mw === null) {
  57209. mw = mwFactory(player);
  57210. mws.push([mwFactory, mw]);
  57211. }
  57212. return mw;
  57213. }
  57214. function setSourceHelper$1(src = {}, middleware = [], next, player, acc = [], lastRun = false) {
  57215. const [mwFactory, ...mwrest] = middleware;
  57216. if (typeof mwFactory === "string") {
  57217. setSourceHelper$1(src, middlewares$1[mwFactory], next, player, acc, lastRun);
  57218. } else if (mwFactory) {
  57219. const mw = getOrCreateFactory$1(player, mwFactory);
  57220. if (!mw.setSource) {
  57221. acc.push(mw);
  57222. return setSourceHelper$1(src, mwrest, next, player, acc, lastRun);
  57223. }
  57224. mw.setSource(Object.assign({}, src), function(err, _src) {
  57225. if (err) {
  57226. return setSourceHelper$1(src, mwrest, next, player, acc, lastRun);
  57227. }
  57228. acc.push(mw);
  57229. setSourceHelper$1(_src, src.type === _src.type ? mwrest : middlewares$1[_src.type], next, player, acc, lastRun);
  57230. });
  57231. } else if (mwrest.length) {
  57232. setSourceHelper$1(src, mwrest, next, player, acc, lastRun);
  57233. } else if (lastRun) {
  57234. next(src, acc);
  57235. } else {
  57236. setSourceHelper$1(src, middlewares$1["*"], next, player, acc, true);
  57237. }
  57238. }
  57239. const MimetypesKind$1 = {
  57240. opus: "video/ogg",
  57241. ogv: "video/ogg",
  57242. mp4: "video/mp4",
  57243. mov: "video/mp4",
  57244. m4v: "video/mp4",
  57245. mkv: "video/x-matroska",
  57246. m4a: "audio/mp4",
  57247. mp3: "audio/mpeg",
  57248. aac: "audio/aac",
  57249. caf: "audio/x-caf",
  57250. flac: "audio/flac",
  57251. oga: "audio/ogg",
  57252. wav: "audio/wav",
  57253. m3u8: "application/x-mpegURL",
  57254. mpd: "application/dash+xml",
  57255. jpg: "image/jpeg",
  57256. jpeg: "image/jpeg",
  57257. gif: "image/gif",
  57258. png: "image/png",
  57259. svg: "image/svg+xml",
  57260. webp: "image/webp"
  57261. };
  57262. const getMimetype$1 = function(src = "") {
  57263. const ext = getFileExtension$1(src);
  57264. const mimetype = MimetypesKind$1[ext.toLowerCase()];
  57265. return mimetype || "";
  57266. };
  57267. const findMimetype$1 = (player, src) => {
  57268. if (!src) {
  57269. return "";
  57270. }
  57271. if (player.cache_.source.src === src && player.cache_.source.type) {
  57272. return player.cache_.source.type;
  57273. }
  57274. const matchingSources = player.cache_.sources.filter((s) => s.src === src);
  57275. if (matchingSources.length) {
  57276. return matchingSources[0].type;
  57277. }
  57278. const sources = player.$$("source");
  57279. for (let i2 = 0; i2 < sources.length; i2++) {
  57280. const s = sources[i2];
  57281. if (s.type && s.src && s.src === src) {
  57282. return s.type;
  57283. }
  57284. }
  57285. return getMimetype$1(src);
  57286. };
  57287. const filterSource$1 = function(src) {
  57288. if (Array.isArray(src)) {
  57289. let newsrc = [];
  57290. src.forEach(function(srcobj) {
  57291. srcobj = filterSource$1(srcobj);
  57292. if (Array.isArray(srcobj)) {
  57293. newsrc = newsrc.concat(srcobj);
  57294. } else if (isObject$2(srcobj)) {
  57295. newsrc.push(srcobj);
  57296. }
  57297. });
  57298. src = newsrc;
  57299. } else if (typeof src === "string" && src.trim()) {
  57300. src = [fixSource$1({
  57301. src
  57302. })];
  57303. } else if (isObject$2(src) && typeof src.src === "string" && src.src && src.src.trim()) {
  57304. src = [fixSource$1(src)];
  57305. } else {
  57306. src = [];
  57307. }
  57308. return src;
  57309. };
  57310. function fixSource$1(src) {
  57311. if (!src.type) {
  57312. const mimetype = getMimetype$1(src.src);
  57313. if (mimetype) {
  57314. src.type = mimetype;
  57315. }
  57316. }
  57317. return src;
  57318. }
  57319. class MediaLoader$1 extends Component$1$1 {
  57320. constructor(player, options2, ready) {
  57321. const options_ = merge$1({
  57322. createEl: false
  57323. }, options2);
  57324. super(player, options_, ready);
  57325. if (!options2.playerOptions.sources || options2.playerOptions.sources.length === 0) {
  57326. for (let i2 = 0, j = options2.playerOptions.techOrder; i2 < j.length; i2++) {
  57327. const techName = toTitleCase$1$1(j[i2]);
  57328. let tech = Tech$2.getTech(techName);
  57329. if (!techName) {
  57330. tech = Component$1$1.getComponent(techName);
  57331. }
  57332. if (tech && tech.isSupported()) {
  57333. player.loadTech_(techName);
  57334. break;
  57335. }
  57336. }
  57337. } else {
  57338. player.src(options2.playerOptions.sources);
  57339. }
  57340. }
  57341. }
  57342. Component$1$1.registerComponent("MediaLoader", MediaLoader$1);
  57343. class ClickableComponent$1 extends Component$1$1 {
  57344. constructor(player, options2) {
  57345. super(player, options2);
  57346. if (this.options_.controlText) {
  57347. this.controlText(this.options_.controlText);
  57348. }
  57349. this.handleMouseOver_ = (e) => this.handleMouseOver(e);
  57350. this.handleMouseOut_ = (e) => this.handleMouseOut(e);
  57351. this.handleClick_ = (e) => this.handleClick(e);
  57352. this.handleKeyDown_ = (e) => this.handleKeyDown(e);
  57353. this.emitTapEvents();
  57354. this.enable();
  57355. }
  57356. createEl(tag = "div", props = {}, attributes = {}) {
  57357. props = Object.assign({
  57358. className: this.buildCSSClass(),
  57359. tabIndex: 0
  57360. }, props);
  57361. if (tag === "button") {
  57362. log$1$1.error(`Creating a ClickableComponent with an HTML element of ${tag} is not supported; use a Button instead.`);
  57363. }
  57364. attributes = Object.assign({
  57365. role: "button"
  57366. }, attributes);
  57367. this.tabIndex_ = props.tabIndex;
  57368. const el = createEl$1(tag, props, attributes);
  57369. el.appendChild(createEl$1("span", {
  57370. className: "vjs-icon-placeholder"
  57371. }, {
  57372. "aria-hidden": true
  57373. }));
  57374. this.createControlTextEl(el);
  57375. return el;
  57376. }
  57377. dispose() {
  57378. this.controlTextEl_ = null;
  57379. super.dispose();
  57380. }
  57381. createControlTextEl(el) {
  57382. this.controlTextEl_ = createEl$1("span", {
  57383. className: "vjs-control-text"
  57384. }, {
  57385. "aria-live": "polite"
  57386. });
  57387. if (el) {
  57388. el.appendChild(this.controlTextEl_);
  57389. }
  57390. this.controlText(this.controlText_, el);
  57391. return this.controlTextEl_;
  57392. }
  57393. controlText(text, el = this.el()) {
  57394. if (text === void 0) {
  57395. return this.controlText_ || "Need Text";
  57396. }
  57397. const localizedText = this.localize(text);
  57398. this.controlText_ = text;
  57399. textContent$1(this.controlTextEl_, localizedText);
  57400. if (!this.nonIconControl && !this.player_.options_.noUITitleAttributes) {
  57401. el.setAttribute("title", localizedText);
  57402. }
  57403. }
  57404. buildCSSClass() {
  57405. return `vjs-control vjs-button ${super.buildCSSClass()}`;
  57406. }
  57407. enable() {
  57408. if (!this.enabled_) {
  57409. this.enabled_ = true;
  57410. this.removeClass("vjs-disabled");
  57411. this.el_.setAttribute("aria-disabled", "false");
  57412. if (typeof this.tabIndex_ !== "undefined") {
  57413. this.el_.setAttribute("tabIndex", this.tabIndex_);
  57414. }
  57415. this.on(["tap", "click"], this.handleClick_);
  57416. this.on("keydown", this.handleKeyDown_);
  57417. }
  57418. }
  57419. disable() {
  57420. this.enabled_ = false;
  57421. this.addClass("vjs-disabled");
  57422. this.el_.setAttribute("aria-disabled", "true");
  57423. if (typeof this.tabIndex_ !== "undefined") {
  57424. this.el_.removeAttribute("tabIndex");
  57425. }
  57426. this.off("mouseover", this.handleMouseOver_);
  57427. this.off("mouseout", this.handleMouseOut_);
  57428. this.off(["tap", "click"], this.handleClick_);
  57429. this.off("keydown", this.handleKeyDown_);
  57430. }
  57431. handleLanguagechange() {
  57432. this.controlText(this.controlText_);
  57433. }
  57434. handleClick(event2) {
  57435. if (this.options_.clickHandler) {
  57436. this.options_.clickHandler.call(this, arguments);
  57437. }
  57438. }
  57439. handleKeyDown(event2) {
  57440. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  57441. event2.preventDefault();
  57442. event2.stopPropagation();
  57443. this.trigger("click");
  57444. } else {
  57445. super.handleKeyDown(event2);
  57446. }
  57447. }
  57448. }
  57449. Component$1$1.registerComponent("ClickableComponent", ClickableComponent$1);
  57450. class PosterImage$1 extends ClickableComponent$1 {
  57451. constructor(player, options2) {
  57452. super(player, options2);
  57453. this.update();
  57454. this.update_ = (e) => this.update(e);
  57455. player.on("posterchange", this.update_);
  57456. }
  57457. dispose() {
  57458. this.player().off("posterchange", this.update_);
  57459. super.dispose();
  57460. }
  57461. createEl() {
  57462. return createEl$1("div", {
  57463. className: "vjs-poster"
  57464. });
  57465. }
  57466. crossOrigin(value) {
  57467. if (typeof value === "undefined") {
  57468. if (this.$("img")) {
  57469. return this.$("img").crossOrigin;
  57470. } else if (this.player_.tech_ && this.player_.tech_.isReady_) {
  57471. return this.player_.crossOrigin();
  57472. }
  57473. return this.player_.options_.crossOrigin || this.player_.options_.crossorigin || null;
  57474. }
  57475. if (value !== null && value !== "anonymous" && value !== "use-credentials") {
  57476. this.player_.log.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${value}"`);
  57477. return;
  57478. }
  57479. if (this.$("img")) {
  57480. this.$("img").crossOrigin = value;
  57481. }
  57482. return;
  57483. }
  57484. update(event2) {
  57485. const url = this.player().poster();
  57486. this.setSrc(url);
  57487. if (url) {
  57488. this.show();
  57489. } else {
  57490. this.hide();
  57491. }
  57492. }
  57493. setSrc(url) {
  57494. if (!url) {
  57495. this.el_.textContent = "";
  57496. return;
  57497. }
  57498. if (!this.$("img")) {
  57499. this.el_.appendChild(createEl$1("picture", {
  57500. className: "vjs-poster",
  57501. tabIndex: -1
  57502. }, {}, createEl$1("img", {
  57503. loading: "lazy",
  57504. crossOrigin: this.crossOrigin()
  57505. }, {
  57506. alt: ""
  57507. })));
  57508. }
  57509. this.$("img").src = url;
  57510. }
  57511. handleClick(event2) {
  57512. if (!this.player_.controls()) {
  57513. return;
  57514. }
  57515. if (this.player_.tech(true)) {
  57516. this.player_.tech(true).focus();
  57517. }
  57518. if (this.player_.paused()) {
  57519. silencePromise$1(this.player_.play());
  57520. } else {
  57521. this.player_.pause();
  57522. }
  57523. }
  57524. }
  57525. PosterImage$1.prototype.crossorigin = PosterImage$1.prototype.crossOrigin;
  57526. Component$1$1.registerComponent("PosterImage", PosterImage$1);
  57527. const darkGray$1 = "#222";
  57528. const lightGray$1 = "#ccc";
  57529. const fontMap$1 = {
  57530. monospace: "monospace",
  57531. sansSerif: "sans-serif",
  57532. serif: "serif",
  57533. monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace',
  57534. monospaceSerif: '"Courier New", monospace',
  57535. proportionalSansSerif: "sans-serif",
  57536. proportionalSerif: "serif",
  57537. casual: '"Comic Sans MS", Impact, fantasy',
  57538. script: '"Monotype Corsiva", cursive',
  57539. smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif'
  57540. };
  57541. function constructColor$1(color2, opacity) {
  57542. let hex;
  57543. if (color2.length === 4) {
  57544. hex = color2[1] + color2[1] + color2[2] + color2[2] + color2[3] + color2[3];
  57545. } else if (color2.length === 7) {
  57546. hex = color2.slice(1);
  57547. } else {
  57548. throw new Error("Invalid color code provided, " + color2 + "; must be formatted as e.g. #f0e or #f604e2.");
  57549. }
  57550. return "rgba(" + parseInt(hex.slice(0, 2), 16) + "," + parseInt(hex.slice(2, 4), 16) + "," + parseInt(hex.slice(4, 6), 16) + "," + opacity + ")";
  57551. }
  57552. function tryUpdateStyle$1(el, style, rule) {
  57553. try {
  57554. el.style[style] = rule;
  57555. } catch (e) {
  57556. return;
  57557. }
  57558. }
  57559. class TextTrackDisplay$1 extends Component$1$1 {
  57560. constructor(player, options2, ready) {
  57561. super(player, options2, ready);
  57562. const updateDisplayHandler = (e) => this.updateDisplay(e);
  57563. player.on("loadstart", (e) => this.toggleDisplay(e));
  57564. player.on("texttrackchange", updateDisplayHandler);
  57565. player.on("loadedmetadata", (e) => this.preselectTrack(e));
  57566. player.ready(bind_(this, function() {
  57567. if (player.tech_ && player.tech_.featuresNativeTextTracks) {
  57568. this.hide();
  57569. return;
  57570. }
  57571. player.on("fullscreenchange", updateDisplayHandler);
  57572. player.on("playerresize", updateDisplayHandler);
  57573. const screenOrientation = window_1.screen.orientation || window_1;
  57574. const changeOrientationEvent = window_1.screen.orientation ? "change" : "orientationchange";
  57575. screenOrientation.addEventListener(changeOrientationEvent, updateDisplayHandler);
  57576. player.on("dispose", () => screenOrientation.removeEventListener(changeOrientationEvent, updateDisplayHandler));
  57577. const tracks = this.options_.playerOptions.tracks || [];
  57578. for (let i2 = 0; i2 < tracks.length; i2++) {
  57579. this.player_.addRemoteTextTrack(tracks[i2], true);
  57580. }
  57581. this.preselectTrack();
  57582. }));
  57583. }
  57584. preselectTrack() {
  57585. const modes = {
  57586. captions: 1,
  57587. subtitles: 1
  57588. };
  57589. const trackList = this.player_.textTracks();
  57590. const userPref = this.player_.cache_.selectedLanguage;
  57591. let firstDesc;
  57592. let firstCaptions;
  57593. let preferredTrack;
  57594. for (let i2 = 0; i2 < trackList.length; i2++) {
  57595. const track = trackList[i2];
  57596. if (userPref && userPref.enabled && userPref.language && userPref.language === track.language && track.kind in modes) {
  57597. if (track.kind === userPref.kind) {
  57598. preferredTrack = track;
  57599. } else if (!preferredTrack) {
  57600. preferredTrack = track;
  57601. }
  57602. } else if (userPref && !userPref.enabled) {
  57603. preferredTrack = null;
  57604. firstDesc = null;
  57605. firstCaptions = null;
  57606. } else if (track.default) {
  57607. if (track.kind === "descriptions" && !firstDesc) {
  57608. firstDesc = track;
  57609. } else if (track.kind in modes && !firstCaptions) {
  57610. firstCaptions = track;
  57611. }
  57612. }
  57613. }
  57614. if (preferredTrack) {
  57615. preferredTrack.mode = "showing";
  57616. } else if (firstCaptions) {
  57617. firstCaptions.mode = "showing";
  57618. } else if (firstDesc) {
  57619. firstDesc.mode = "showing";
  57620. }
  57621. }
  57622. toggleDisplay() {
  57623. if (this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks) {
  57624. this.hide();
  57625. } else {
  57626. this.show();
  57627. }
  57628. }
  57629. createEl() {
  57630. return super.createEl("div", {
  57631. className: "vjs-text-track-display"
  57632. }, {
  57633. "translate": "yes",
  57634. "aria-live": "off",
  57635. "aria-atomic": "true"
  57636. });
  57637. }
  57638. clearDisplay() {
  57639. if (typeof window_1.WebVTT === "function") {
  57640. window_1.WebVTT.processCues(window_1, [], this.el_);
  57641. }
  57642. }
  57643. updateDisplay() {
  57644. const tracks = this.player_.textTracks();
  57645. const allowMultipleShowingTracks = this.options_.allowMultipleShowingTracks;
  57646. this.clearDisplay();
  57647. if (allowMultipleShowingTracks) {
  57648. const showingTracks = [];
  57649. for (let i3 = 0; i3 < tracks.length; ++i3) {
  57650. const track = tracks[i3];
  57651. if (track.mode !== "showing") {
  57652. continue;
  57653. }
  57654. showingTracks.push(track);
  57655. }
  57656. this.updateForTrack(showingTracks);
  57657. return;
  57658. }
  57659. let descriptionsTrack = null;
  57660. let captionsSubtitlesTrack = null;
  57661. let i2 = tracks.length;
  57662. while (i2--) {
  57663. const track = tracks[i2];
  57664. if (track.mode === "showing") {
  57665. if (track.kind === "descriptions") {
  57666. descriptionsTrack = track;
  57667. } else {
  57668. captionsSubtitlesTrack = track;
  57669. }
  57670. }
  57671. }
  57672. if (captionsSubtitlesTrack) {
  57673. if (this.getAttribute("aria-live") !== "off") {
  57674. this.setAttribute("aria-live", "off");
  57675. }
  57676. this.updateForTrack(captionsSubtitlesTrack);
  57677. } else if (descriptionsTrack) {
  57678. if (this.getAttribute("aria-live") !== "assertive") {
  57679. this.setAttribute("aria-live", "assertive");
  57680. }
  57681. this.updateForTrack(descriptionsTrack);
  57682. }
  57683. }
  57684. updateDisplayState(track) {
  57685. const overrides = this.player_.textTrackSettings.getValues();
  57686. const cues = track.activeCues;
  57687. let i2 = cues.length;
  57688. while (i2--) {
  57689. const cue = cues[i2];
  57690. if (!cue) {
  57691. continue;
  57692. }
  57693. const cueDiv = cue.displayState;
  57694. if (overrides.color) {
  57695. cueDiv.firstChild.style.color = overrides.color;
  57696. }
  57697. if (overrides.textOpacity) {
  57698. tryUpdateStyle$1(cueDiv.firstChild, "color", constructColor$1(overrides.color || "#fff", overrides.textOpacity));
  57699. }
  57700. if (overrides.backgroundColor) {
  57701. cueDiv.firstChild.style.backgroundColor = overrides.backgroundColor;
  57702. }
  57703. if (overrides.backgroundOpacity) {
  57704. tryUpdateStyle$1(cueDiv.firstChild, "backgroundColor", constructColor$1(overrides.backgroundColor || "#000", overrides.backgroundOpacity));
  57705. }
  57706. if (overrides.windowColor) {
  57707. if (overrides.windowOpacity) {
  57708. tryUpdateStyle$1(cueDiv, "backgroundColor", constructColor$1(overrides.windowColor, overrides.windowOpacity));
  57709. } else {
  57710. cueDiv.style.backgroundColor = overrides.windowColor;
  57711. }
  57712. }
  57713. if (overrides.edgeStyle) {
  57714. if (overrides.edgeStyle === "dropshadow") {
  57715. cueDiv.firstChild.style.textShadow = `2px 2px 3px ${darkGray$1}, 2px 2px 4px ${darkGray$1}, 2px 2px 5px ${darkGray$1}`;
  57716. } else if (overrides.edgeStyle === "raised") {
  57717. cueDiv.firstChild.style.textShadow = `1px 1px ${darkGray$1}, 2px 2px ${darkGray$1}, 3px 3px ${darkGray$1}`;
  57718. } else if (overrides.edgeStyle === "depressed") {
  57719. cueDiv.firstChild.style.textShadow = `1px 1px ${lightGray$1}, 0 1px ${lightGray$1}, -1px -1px ${darkGray$1}, 0 -1px ${darkGray$1}`;
  57720. } else if (overrides.edgeStyle === "uniform") {
  57721. cueDiv.firstChild.style.textShadow = `0 0 4px ${darkGray$1}, 0 0 4px ${darkGray$1}, 0 0 4px ${darkGray$1}, 0 0 4px ${darkGray$1}`;
  57722. }
  57723. }
  57724. if (overrides.fontPercent && overrides.fontPercent !== 1) {
  57725. const fontSize = window_1.parseFloat(cueDiv.style.fontSize);
  57726. cueDiv.style.fontSize = fontSize * overrides.fontPercent + "px";
  57727. cueDiv.style.height = "auto";
  57728. cueDiv.style.top = "auto";
  57729. }
  57730. if (overrides.fontFamily && overrides.fontFamily !== "default") {
  57731. if (overrides.fontFamily === "small-caps") {
  57732. cueDiv.firstChild.style.fontVariant = "small-caps";
  57733. } else {
  57734. cueDiv.firstChild.style.fontFamily = fontMap$1[overrides.fontFamily];
  57735. }
  57736. }
  57737. }
  57738. }
  57739. updateForTrack(tracks) {
  57740. if (!Array.isArray(tracks)) {
  57741. tracks = [tracks];
  57742. }
  57743. if (typeof window_1.WebVTT !== "function" || tracks.every((track) => {
  57744. return !track.activeCues;
  57745. })) {
  57746. return;
  57747. }
  57748. const cues = [];
  57749. for (let i2 = 0; i2 < tracks.length; ++i2) {
  57750. const track = tracks[i2];
  57751. for (let j = 0; j < track.activeCues.length; ++j) {
  57752. cues.push(track.activeCues[j]);
  57753. }
  57754. }
  57755. window_1.WebVTT.processCues(window_1, cues, this.el_);
  57756. for (let i2 = 0; i2 < tracks.length; ++i2) {
  57757. const track = tracks[i2];
  57758. for (let j = 0; j < track.activeCues.length; ++j) {
  57759. const cueEl = track.activeCues[j].displayState;
  57760. addClass$1(cueEl, "vjs-text-track-cue", "vjs-text-track-cue-" + (track.language ? track.language : i2));
  57761. if (track.language) {
  57762. setAttribute$1(cueEl, "lang", track.language);
  57763. }
  57764. }
  57765. if (this.player_.textTrackSettings) {
  57766. this.updateDisplayState(track);
  57767. }
  57768. }
  57769. }
  57770. }
  57771. Component$1$1.registerComponent("TextTrackDisplay", TextTrackDisplay$1);
  57772. class LoadingSpinner$1 extends Component$1$1 {
  57773. createEl() {
  57774. const isAudio = this.player_.isAudio();
  57775. const playerType = this.localize(isAudio ? "Audio Player" : "Video Player");
  57776. const controlText = createEl$1("span", {
  57777. className: "vjs-control-text",
  57778. textContent: this.localize("{1} is loading.", [playerType])
  57779. });
  57780. const el = super.createEl("div", {
  57781. className: "vjs-loading-spinner",
  57782. dir: "ltr"
  57783. });
  57784. el.appendChild(controlText);
  57785. return el;
  57786. }
  57787. handleLanguagechange() {
  57788. this.$(".vjs-control-text").textContent = this.localize("{1} is loading.", [this.player_.isAudio() ? "Audio Player" : "Video Player"]);
  57789. }
  57790. }
  57791. Component$1$1.registerComponent("LoadingSpinner", LoadingSpinner$1);
  57792. class Button$1 extends ClickableComponent$1 {
  57793. createEl(tag, props = {}, attributes = {}) {
  57794. tag = "button";
  57795. props = Object.assign({
  57796. className: this.buildCSSClass()
  57797. }, props);
  57798. attributes = Object.assign({
  57799. type: "button"
  57800. }, attributes);
  57801. const el = createEl$1(tag, props, attributes);
  57802. el.appendChild(createEl$1("span", {
  57803. className: "vjs-icon-placeholder"
  57804. }, {
  57805. "aria-hidden": true
  57806. }));
  57807. this.createControlTextEl(el);
  57808. return el;
  57809. }
  57810. addChild(child, options2 = {}) {
  57811. const className = this.constructor.name;
  57812. log$1$1.warn(`Adding an actionable (user controllable) child to a Button (${className}) is not supported; use a ClickableComponent instead.`);
  57813. return Component$1$1.prototype.addChild.call(this, child, options2);
  57814. }
  57815. enable() {
  57816. super.enable();
  57817. this.el_.removeAttribute("disabled");
  57818. }
  57819. disable() {
  57820. super.disable();
  57821. this.el_.setAttribute("disabled", "disabled");
  57822. }
  57823. handleKeyDown(event2) {
  57824. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  57825. event2.stopPropagation();
  57826. return;
  57827. }
  57828. super.handleKeyDown(event2);
  57829. }
  57830. }
  57831. Component$1$1.registerComponent("Button", Button$1);
  57832. class BigPlayButton$1 extends Button$1 {
  57833. constructor(player, options2) {
  57834. super(player, options2);
  57835. this.mouseused_ = false;
  57836. this.on("mousedown", (e) => this.handleMouseDown(e));
  57837. }
  57838. buildCSSClass() {
  57839. return "vjs-big-play-button";
  57840. }
  57841. handleClick(event2) {
  57842. const playPromise = this.player_.play();
  57843. if (this.mouseused_ && event2.clientX && event2.clientY) {
  57844. silencePromise$1(playPromise);
  57845. if (this.player_.tech(true)) {
  57846. this.player_.tech(true).focus();
  57847. }
  57848. return;
  57849. }
  57850. const cb = this.player_.getChild("controlBar");
  57851. const playToggle = cb && cb.getChild("playToggle");
  57852. if (!playToggle) {
  57853. this.player_.tech(true).focus();
  57854. return;
  57855. }
  57856. const playFocus = () => playToggle.focus();
  57857. if (isPromise$1(playPromise)) {
  57858. playPromise.then(playFocus, () => {
  57859. });
  57860. } else {
  57861. this.setTimeout(playFocus, 1);
  57862. }
  57863. }
  57864. handleKeyDown(event2) {
  57865. this.mouseused_ = false;
  57866. super.handleKeyDown(event2);
  57867. }
  57868. handleMouseDown(event2) {
  57869. this.mouseused_ = true;
  57870. }
  57871. }
  57872. BigPlayButton$1.prototype.controlText_ = "Play Video";
  57873. Component$1$1.registerComponent("BigPlayButton", BigPlayButton$1);
  57874. class CloseButton$1 extends Button$1 {
  57875. constructor(player, options2) {
  57876. super(player, options2);
  57877. this.controlText(options2 && options2.controlText || this.localize("Close"));
  57878. }
  57879. buildCSSClass() {
  57880. return `vjs-close-button ${super.buildCSSClass()}`;
  57881. }
  57882. handleClick(event2) {
  57883. this.trigger({
  57884. type: "close",
  57885. bubbles: false
  57886. });
  57887. }
  57888. handleKeyDown(event2) {
  57889. if (keycode.isEventKey(event2, "Esc")) {
  57890. event2.preventDefault();
  57891. event2.stopPropagation();
  57892. this.trigger("click");
  57893. } else {
  57894. super.handleKeyDown(event2);
  57895. }
  57896. }
  57897. }
  57898. Component$1$1.registerComponent("CloseButton", CloseButton$1);
  57899. class PlayToggle$1 extends Button$1 {
  57900. constructor(player, options2 = {}) {
  57901. super(player, options2);
  57902. options2.replay = options2.replay === void 0 || options2.replay;
  57903. this.on(player, "play", (e) => this.handlePlay(e));
  57904. this.on(player, "pause", (e) => this.handlePause(e));
  57905. if (options2.replay) {
  57906. this.on(player, "ended", (e) => this.handleEnded(e));
  57907. }
  57908. }
  57909. buildCSSClass() {
  57910. return `vjs-play-control ${super.buildCSSClass()}`;
  57911. }
  57912. handleClick(event2) {
  57913. if (this.player_.paused()) {
  57914. silencePromise$1(this.player_.play());
  57915. } else {
  57916. this.player_.pause();
  57917. }
  57918. }
  57919. handleSeeked(event2) {
  57920. this.removeClass("vjs-ended");
  57921. if (this.player_.paused()) {
  57922. this.handlePause(event2);
  57923. } else {
  57924. this.handlePlay(event2);
  57925. }
  57926. }
  57927. handlePlay(event2) {
  57928. this.removeClass("vjs-ended", "vjs-paused");
  57929. this.addClass("vjs-playing");
  57930. this.controlText("Pause");
  57931. }
  57932. handlePause(event2) {
  57933. this.removeClass("vjs-playing");
  57934. this.addClass("vjs-paused");
  57935. this.controlText("Play");
  57936. }
  57937. handleEnded(event2) {
  57938. this.removeClass("vjs-playing");
  57939. this.addClass("vjs-ended");
  57940. this.controlText("Replay");
  57941. this.one(this.player_, "seeked", (e) => this.handleSeeked(e));
  57942. }
  57943. }
  57944. PlayToggle$1.prototype.controlText_ = "Play";
  57945. Component$1$1.registerComponent("PlayToggle", PlayToggle$1);
  57946. class TimeDisplay$1 extends Component$1$1 {
  57947. constructor(player, options2) {
  57948. super(player, options2);
  57949. this.on(player, ["timeupdate", "ended"], (e) => this.updateContent(e));
  57950. this.updateTextNode_();
  57951. }
  57952. createEl() {
  57953. const className = this.buildCSSClass();
  57954. const el = super.createEl("div", {
  57955. className: `${className} vjs-time-control vjs-control`
  57956. });
  57957. const span = createEl$1("span", {
  57958. className: "vjs-control-text",
  57959. textContent: `${this.localize(this.labelText_)}\xA0`
  57960. }, {
  57961. role: "presentation"
  57962. });
  57963. el.appendChild(span);
  57964. this.contentEl_ = createEl$1("span", {
  57965. className: `${className}-display`
  57966. }, {
  57967. role: "presentation"
  57968. });
  57969. el.appendChild(this.contentEl_);
  57970. return el;
  57971. }
  57972. dispose() {
  57973. this.contentEl_ = null;
  57974. this.textNode_ = null;
  57975. super.dispose();
  57976. }
  57977. updateTextNode_(time = 0) {
  57978. time = formatTime$1(time);
  57979. if (this.formattedTime_ === time) {
  57980. return;
  57981. }
  57982. this.formattedTime_ = time;
  57983. this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_", () => {
  57984. if (!this.contentEl_) {
  57985. return;
  57986. }
  57987. let oldNode = this.textNode_;
  57988. if (oldNode && this.contentEl_.firstChild !== oldNode) {
  57989. oldNode = null;
  57990. log$1$1.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.");
  57991. }
  57992. this.textNode_ = document_1.createTextNode(this.formattedTime_);
  57993. if (!this.textNode_) {
  57994. return;
  57995. }
  57996. if (oldNode) {
  57997. this.contentEl_.replaceChild(this.textNode_, oldNode);
  57998. } else {
  57999. this.contentEl_.appendChild(this.textNode_);
  58000. }
  58001. });
  58002. }
  58003. updateContent(event2) {
  58004. }
  58005. }
  58006. TimeDisplay$1.prototype.labelText_ = "Time";
  58007. TimeDisplay$1.prototype.controlText_ = "Time";
  58008. Component$1$1.registerComponent("TimeDisplay", TimeDisplay$1);
  58009. class CurrentTimeDisplay$1 extends TimeDisplay$1 {
  58010. buildCSSClass() {
  58011. return "vjs-current-time";
  58012. }
  58013. updateContent(event2) {
  58014. let time;
  58015. if (this.player_.ended()) {
  58016. time = this.player_.duration();
  58017. } else {
  58018. time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  58019. }
  58020. this.updateTextNode_(time);
  58021. }
  58022. }
  58023. CurrentTimeDisplay$1.prototype.labelText_ = "Current Time";
  58024. CurrentTimeDisplay$1.prototype.controlText_ = "Current Time";
  58025. Component$1$1.registerComponent("CurrentTimeDisplay", CurrentTimeDisplay$1);
  58026. class DurationDisplay$1 extends TimeDisplay$1 {
  58027. constructor(player, options2) {
  58028. super(player, options2);
  58029. const updateContent = (e) => this.updateContent(e);
  58030. this.on(player, "durationchange", updateContent);
  58031. this.on(player, "loadstart", updateContent);
  58032. this.on(player, "loadedmetadata", updateContent);
  58033. }
  58034. buildCSSClass() {
  58035. return "vjs-duration";
  58036. }
  58037. updateContent(event2) {
  58038. const duration5 = this.player_.duration();
  58039. this.updateTextNode_(duration5);
  58040. }
  58041. }
  58042. DurationDisplay$1.prototype.labelText_ = "Duration";
  58043. DurationDisplay$1.prototype.controlText_ = "Duration";
  58044. Component$1$1.registerComponent("DurationDisplay", DurationDisplay$1);
  58045. class TimeDivider$1 extends Component$1$1 {
  58046. createEl() {
  58047. const el = super.createEl("div", {
  58048. className: "vjs-time-control vjs-time-divider"
  58049. }, {
  58050. "aria-hidden": true
  58051. });
  58052. const div = super.createEl("div");
  58053. const span = super.createEl("span", {
  58054. textContent: "/"
  58055. });
  58056. div.appendChild(span);
  58057. el.appendChild(div);
  58058. return el;
  58059. }
  58060. }
  58061. Component$1$1.registerComponent("TimeDivider", TimeDivider$1);
  58062. class RemainingTimeDisplay$1 extends TimeDisplay$1 {
  58063. constructor(player, options2) {
  58064. super(player, options2);
  58065. this.on(player, "durationchange", (e) => this.updateContent(e));
  58066. }
  58067. buildCSSClass() {
  58068. return "vjs-remaining-time";
  58069. }
  58070. createEl() {
  58071. const el = super.createEl();
  58072. if (this.options_.displayNegative !== false) {
  58073. el.insertBefore(createEl$1("span", {}, {
  58074. "aria-hidden": true
  58075. }, "-"), this.contentEl_);
  58076. }
  58077. return el;
  58078. }
  58079. updateContent(event2) {
  58080. if (typeof this.player_.duration() !== "number") {
  58081. return;
  58082. }
  58083. let time;
  58084. if (this.player_.ended()) {
  58085. time = 0;
  58086. } else if (this.player_.remainingTimeDisplay) {
  58087. time = this.player_.remainingTimeDisplay();
  58088. } else {
  58089. time = this.player_.remainingTime();
  58090. }
  58091. this.updateTextNode_(time);
  58092. }
  58093. }
  58094. RemainingTimeDisplay$1.prototype.labelText_ = "Remaining Time";
  58095. RemainingTimeDisplay$1.prototype.controlText_ = "Remaining Time";
  58096. Component$1$1.registerComponent("RemainingTimeDisplay", RemainingTimeDisplay$1);
  58097. class LiveDisplay$1 extends Component$1$1 {
  58098. constructor(player, options2) {
  58099. super(player, options2);
  58100. this.updateShowing();
  58101. this.on(this.player(), "durationchange", (e) => this.updateShowing(e));
  58102. }
  58103. createEl() {
  58104. const el = super.createEl("div", {
  58105. className: "vjs-live-control vjs-control"
  58106. });
  58107. this.contentEl_ = createEl$1("div", {
  58108. className: "vjs-live-display"
  58109. }, {
  58110. "aria-live": "off"
  58111. });
  58112. this.contentEl_.appendChild(createEl$1("span", {
  58113. className: "vjs-control-text",
  58114. textContent: `${this.localize("Stream Type")}\xA0`
  58115. }));
  58116. this.contentEl_.appendChild(document_1.createTextNode(this.localize("LIVE")));
  58117. el.appendChild(this.contentEl_);
  58118. return el;
  58119. }
  58120. dispose() {
  58121. this.contentEl_ = null;
  58122. super.dispose();
  58123. }
  58124. updateShowing(event2) {
  58125. if (this.player().duration() === Infinity) {
  58126. this.show();
  58127. } else {
  58128. this.hide();
  58129. }
  58130. }
  58131. }
  58132. Component$1$1.registerComponent("LiveDisplay", LiveDisplay$1);
  58133. class SeekToLive$1 extends Button$1 {
  58134. constructor(player, options2) {
  58135. super(player, options2);
  58136. this.updateLiveEdgeStatus();
  58137. if (this.player_.liveTracker) {
  58138. this.updateLiveEdgeStatusHandler_ = (e) => this.updateLiveEdgeStatus(e);
  58139. this.on(this.player_.liveTracker, "liveedgechange", this.updateLiveEdgeStatusHandler_);
  58140. }
  58141. }
  58142. createEl() {
  58143. const el = super.createEl("button", {
  58144. className: "vjs-seek-to-live-control vjs-control"
  58145. });
  58146. this.textEl_ = createEl$1("span", {
  58147. className: "vjs-seek-to-live-text",
  58148. textContent: this.localize("LIVE")
  58149. }, {
  58150. "aria-hidden": "true"
  58151. });
  58152. el.appendChild(this.textEl_);
  58153. return el;
  58154. }
  58155. updateLiveEdgeStatus() {
  58156. if (!this.player_.liveTracker || this.player_.liveTracker.atLiveEdge()) {
  58157. this.setAttribute("aria-disabled", true);
  58158. this.addClass("vjs-at-live-edge");
  58159. this.controlText("Seek to live, currently playing live");
  58160. } else {
  58161. this.setAttribute("aria-disabled", false);
  58162. this.removeClass("vjs-at-live-edge");
  58163. this.controlText("Seek to live, currently behind live");
  58164. }
  58165. }
  58166. handleClick() {
  58167. this.player_.liveTracker.seekToLiveEdge();
  58168. }
  58169. dispose() {
  58170. if (this.player_.liveTracker) {
  58171. this.off(this.player_.liveTracker, "liveedgechange", this.updateLiveEdgeStatusHandler_);
  58172. }
  58173. this.textEl_ = null;
  58174. super.dispose();
  58175. }
  58176. }
  58177. SeekToLive$1.prototype.controlText_ = "Seek to live, currently playing live";
  58178. Component$1$1.registerComponent("SeekToLive", SeekToLive$1);
  58179. function clamp$1(number, min2, max2) {
  58180. number = Number(number);
  58181. return Math.min(max2, Math.max(min2, isNaN(number) ? min2 : number));
  58182. }
  58183. var Num = /* @__PURE__ */ Object.freeze({
  58184. __proto__: null,
  58185. clamp: clamp$1
  58186. });
  58187. class Slider$1 extends Component$1$1 {
  58188. constructor(player, options2) {
  58189. super(player, options2);
  58190. this.handleMouseDown_ = (e) => this.handleMouseDown(e);
  58191. this.handleMouseUp_ = (e) => this.handleMouseUp(e);
  58192. this.handleKeyDown_ = (e) => this.handleKeyDown(e);
  58193. this.handleClick_ = (e) => this.handleClick(e);
  58194. this.handleMouseMove_ = (e) => this.handleMouseMove(e);
  58195. this.update_ = (e) => this.update(e);
  58196. this.bar = this.getChild(this.options_.barName);
  58197. this.vertical(!!this.options_.vertical);
  58198. this.enable();
  58199. }
  58200. enabled() {
  58201. return this.enabled_;
  58202. }
  58203. enable() {
  58204. if (this.enabled()) {
  58205. return;
  58206. }
  58207. this.on("mousedown", this.handleMouseDown_);
  58208. this.on("touchstart", this.handleMouseDown_);
  58209. this.on("keydown", this.handleKeyDown_);
  58210. this.on("click", this.handleClick_);
  58211. this.on(this.player_, "controlsvisible", this.update);
  58212. if (this.playerEvent) {
  58213. this.on(this.player_, this.playerEvent, this.update);
  58214. }
  58215. this.removeClass("disabled");
  58216. this.setAttribute("tabindex", 0);
  58217. this.enabled_ = true;
  58218. }
  58219. disable() {
  58220. if (!this.enabled()) {
  58221. return;
  58222. }
  58223. const doc = this.bar.el_.ownerDocument;
  58224. this.off("mousedown", this.handleMouseDown_);
  58225. this.off("touchstart", this.handleMouseDown_);
  58226. this.off("keydown", this.handleKeyDown_);
  58227. this.off("click", this.handleClick_);
  58228. this.off(this.player_, "controlsvisible", this.update_);
  58229. this.off(doc, "mousemove", this.handleMouseMove_);
  58230. this.off(doc, "mouseup", this.handleMouseUp_);
  58231. this.off(doc, "touchmove", this.handleMouseMove_);
  58232. this.off(doc, "touchend", this.handleMouseUp_);
  58233. this.removeAttribute("tabindex");
  58234. this.addClass("disabled");
  58235. if (this.playerEvent) {
  58236. this.off(this.player_, this.playerEvent, this.update);
  58237. }
  58238. this.enabled_ = false;
  58239. }
  58240. createEl(type2, props = {}, attributes = {}) {
  58241. props.className = props.className + " vjs-slider";
  58242. props = Object.assign({
  58243. tabIndex: 0
  58244. }, props);
  58245. attributes = Object.assign({
  58246. "role": "slider",
  58247. "aria-valuenow": 0,
  58248. "aria-valuemin": 0,
  58249. "aria-valuemax": 100
  58250. }, attributes);
  58251. return super.createEl(type2, props, attributes);
  58252. }
  58253. handleMouseDown(event2) {
  58254. const doc = this.bar.el_.ownerDocument;
  58255. if (event2.type === "mousedown") {
  58256. event2.preventDefault();
  58257. }
  58258. if (event2.type === "touchstart" && !IS_CHROME$1) {
  58259. event2.preventDefault();
  58260. }
  58261. blockTextSelection$1();
  58262. this.addClass("vjs-sliding");
  58263. this.trigger("slideractive");
  58264. this.on(doc, "mousemove", this.handleMouseMove_);
  58265. this.on(doc, "mouseup", this.handleMouseUp_);
  58266. this.on(doc, "touchmove", this.handleMouseMove_);
  58267. this.on(doc, "touchend", this.handleMouseUp_);
  58268. this.handleMouseMove(event2, true);
  58269. }
  58270. handleMouseMove(event2) {
  58271. }
  58272. handleMouseUp(event2) {
  58273. const doc = this.bar.el_.ownerDocument;
  58274. unblockTextSelection$1();
  58275. this.removeClass("vjs-sliding");
  58276. this.trigger("sliderinactive");
  58277. this.off(doc, "mousemove", this.handleMouseMove_);
  58278. this.off(doc, "mouseup", this.handleMouseUp_);
  58279. this.off(doc, "touchmove", this.handleMouseMove_);
  58280. this.off(doc, "touchend", this.handleMouseUp_);
  58281. this.update();
  58282. }
  58283. update() {
  58284. if (!this.el_ || !this.bar) {
  58285. return;
  58286. }
  58287. const progress = this.getProgress();
  58288. if (progress === this.progress_) {
  58289. return progress;
  58290. }
  58291. this.progress_ = progress;
  58292. this.requestNamedAnimationFrame("Slider#update", () => {
  58293. const sizeKey = this.vertical() ? "height" : "width";
  58294. this.bar.el().style[sizeKey] = (progress * 100).toFixed(2) + "%";
  58295. });
  58296. return progress;
  58297. }
  58298. getProgress() {
  58299. return Number(clamp$1(this.getPercent(), 0, 1).toFixed(4));
  58300. }
  58301. calculateDistance(event2) {
  58302. const position2 = getPointerPosition$1(this.el_, event2);
  58303. if (this.vertical()) {
  58304. return position2.y;
  58305. }
  58306. return position2.x;
  58307. }
  58308. handleKeyDown(event2) {
  58309. if (keycode.isEventKey(event2, "Left") || keycode.isEventKey(event2, "Down")) {
  58310. event2.preventDefault();
  58311. event2.stopPropagation();
  58312. this.stepBack();
  58313. } else if (keycode.isEventKey(event2, "Right") || keycode.isEventKey(event2, "Up")) {
  58314. event2.preventDefault();
  58315. event2.stopPropagation();
  58316. this.stepForward();
  58317. } else {
  58318. super.handleKeyDown(event2);
  58319. }
  58320. }
  58321. handleClick(event2) {
  58322. event2.stopPropagation();
  58323. event2.preventDefault();
  58324. }
  58325. vertical(bool) {
  58326. if (bool === void 0) {
  58327. return this.vertical_ || false;
  58328. }
  58329. this.vertical_ = !!bool;
  58330. if (this.vertical_) {
  58331. this.addClass("vjs-slider-vertical");
  58332. } else {
  58333. this.addClass("vjs-slider-horizontal");
  58334. }
  58335. }
  58336. }
  58337. Component$1$1.registerComponent("Slider", Slider$1);
  58338. const percentify$1 = (time, end) => clamp$1(time / end * 100, 0, 100).toFixed(2) + "%";
  58339. class LoadProgressBar$1 extends Component$1$1 {
  58340. constructor(player, options2) {
  58341. super(player, options2);
  58342. this.partEls_ = [];
  58343. this.on(player, "progress", (e) => this.update(e));
  58344. }
  58345. createEl() {
  58346. const el = super.createEl("div", {
  58347. className: "vjs-load-progress"
  58348. });
  58349. const wrapper = createEl$1("span", {
  58350. className: "vjs-control-text"
  58351. });
  58352. const loadedText = createEl$1("span", {
  58353. textContent: this.localize("Loaded")
  58354. });
  58355. const separator = document_1.createTextNode(": ");
  58356. this.percentageEl_ = createEl$1("span", {
  58357. className: "vjs-control-text-loaded-percentage",
  58358. textContent: "0%"
  58359. });
  58360. el.appendChild(wrapper);
  58361. wrapper.appendChild(loadedText);
  58362. wrapper.appendChild(separator);
  58363. wrapper.appendChild(this.percentageEl_);
  58364. return el;
  58365. }
  58366. dispose() {
  58367. this.partEls_ = null;
  58368. this.percentageEl_ = null;
  58369. super.dispose();
  58370. }
  58371. update(event2) {
  58372. this.requestNamedAnimationFrame("LoadProgressBar#update", () => {
  58373. const liveTracker = this.player_.liveTracker;
  58374. const buffered = this.player_.buffered();
  58375. const duration5 = liveTracker && liveTracker.isLive() ? liveTracker.seekableEnd() : this.player_.duration();
  58376. const bufferedEnd = this.player_.bufferedEnd();
  58377. const children = this.partEls_;
  58378. const percent = percentify$1(bufferedEnd, duration5);
  58379. if (this.percent_ !== percent) {
  58380. this.el_.style.width = percent;
  58381. textContent$1(this.percentageEl_, percent);
  58382. this.percent_ = percent;
  58383. }
  58384. for (let i2 = 0; i2 < buffered.length; i2++) {
  58385. const start2 = buffered.start(i2);
  58386. const end = buffered.end(i2);
  58387. let part = children[i2];
  58388. if (!part) {
  58389. part = this.el_.appendChild(createEl$1());
  58390. children[i2] = part;
  58391. }
  58392. if (part.dataset.start === start2 && part.dataset.end === end) {
  58393. continue;
  58394. }
  58395. part.dataset.start = start2;
  58396. part.dataset.end = end;
  58397. part.style.left = percentify$1(start2, bufferedEnd);
  58398. part.style.width = percentify$1(end - start2, bufferedEnd);
  58399. }
  58400. for (let i2 = children.length; i2 > buffered.length; i2--) {
  58401. this.el_.removeChild(children[i2 - 1]);
  58402. }
  58403. children.length = buffered.length;
  58404. });
  58405. }
  58406. }
  58407. Component$1$1.registerComponent("LoadProgressBar", LoadProgressBar$1);
  58408. class TimeTooltip$1 extends Component$1$1 {
  58409. constructor(player, options2) {
  58410. super(player, options2);
  58411. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  58412. }
  58413. createEl() {
  58414. return super.createEl("div", {
  58415. className: "vjs-time-tooltip"
  58416. }, {
  58417. "aria-hidden": "true"
  58418. });
  58419. }
  58420. update(seekBarRect, seekBarPoint, content) {
  58421. const tooltipRect = findPosition$1(this.el_);
  58422. const playerRect = getBoundingClientRect$1(this.player_.el());
  58423. const seekBarPointPx = seekBarRect.width * seekBarPoint;
  58424. if (!playerRect || !tooltipRect) {
  58425. return;
  58426. }
  58427. const spaceLeftOfPoint = seekBarRect.left - playerRect.left + seekBarPointPx;
  58428. const spaceRightOfPoint = seekBarRect.width - seekBarPointPx + (playerRect.right - seekBarRect.right);
  58429. let pullTooltipBy = tooltipRect.width / 2;
  58430. if (spaceLeftOfPoint < pullTooltipBy) {
  58431. pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;
  58432. } else if (spaceRightOfPoint < pullTooltipBy) {
  58433. pullTooltipBy = spaceRightOfPoint;
  58434. }
  58435. if (pullTooltipBy < 0) {
  58436. pullTooltipBy = 0;
  58437. } else if (pullTooltipBy > tooltipRect.width) {
  58438. pullTooltipBy = tooltipRect.width;
  58439. }
  58440. pullTooltipBy = Math.round(pullTooltipBy);
  58441. this.el_.style.right = `-${pullTooltipBy}px`;
  58442. this.write(content);
  58443. }
  58444. write(content) {
  58445. textContent$1(this.el_, content);
  58446. }
  58447. updateTime(seekBarRect, seekBarPoint, time, cb) {
  58448. this.requestNamedAnimationFrame("TimeTooltip#updateTime", () => {
  58449. let content;
  58450. const duration5 = this.player_.duration();
  58451. if (this.player_.liveTracker && this.player_.liveTracker.isLive()) {
  58452. const liveWindow = this.player_.liveTracker.liveWindow();
  58453. const secondsBehind = liveWindow - seekBarPoint * liveWindow;
  58454. content = (secondsBehind < 1 ? "" : "-") + formatTime$1(secondsBehind, liveWindow);
  58455. } else {
  58456. content = formatTime$1(time, duration5);
  58457. }
  58458. this.update(seekBarRect, seekBarPoint, content);
  58459. if (cb) {
  58460. cb();
  58461. }
  58462. });
  58463. }
  58464. }
  58465. Component$1$1.registerComponent("TimeTooltip", TimeTooltip$1);
  58466. class PlayProgressBar$1 extends Component$1$1 {
  58467. constructor(player, options2) {
  58468. super(player, options2);
  58469. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  58470. }
  58471. createEl() {
  58472. return super.createEl("div", {
  58473. className: "vjs-play-progress vjs-slider-bar"
  58474. }, {
  58475. "aria-hidden": "true"
  58476. });
  58477. }
  58478. update(seekBarRect, seekBarPoint) {
  58479. const timeTooltip = this.getChild("timeTooltip");
  58480. if (!timeTooltip) {
  58481. return;
  58482. }
  58483. const time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  58484. timeTooltip.updateTime(seekBarRect, seekBarPoint, time);
  58485. }
  58486. }
  58487. PlayProgressBar$1.prototype.options_ = {
  58488. children: []
  58489. };
  58490. if (!IS_IOS$1 && !IS_ANDROID$1) {
  58491. PlayProgressBar$1.prototype.options_.children.push("timeTooltip");
  58492. }
  58493. Component$1$1.registerComponent("PlayProgressBar", PlayProgressBar$1);
  58494. class MouseTimeDisplay$1 extends Component$1$1 {
  58495. constructor(player, options2) {
  58496. super(player, options2);
  58497. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  58498. }
  58499. createEl() {
  58500. return super.createEl("div", {
  58501. className: "vjs-mouse-display"
  58502. });
  58503. }
  58504. update(seekBarRect, seekBarPoint) {
  58505. const time = seekBarPoint * this.player_.duration();
  58506. this.getChild("timeTooltip").updateTime(seekBarRect, seekBarPoint, time, () => {
  58507. this.el_.style.left = `${seekBarRect.width * seekBarPoint}px`;
  58508. });
  58509. }
  58510. }
  58511. MouseTimeDisplay$1.prototype.options_ = {
  58512. children: ["timeTooltip"]
  58513. };
  58514. Component$1$1.registerComponent("MouseTimeDisplay", MouseTimeDisplay$1);
  58515. const STEP_SECONDS$1 = 5;
  58516. const PAGE_KEY_MULTIPLIER$1 = 12;
  58517. class SeekBar$1 extends Slider$1 {
  58518. constructor(player, options2) {
  58519. super(player, options2);
  58520. this.setEventHandlers_();
  58521. }
  58522. setEventHandlers_() {
  58523. this.update_ = bind_(this, this.update);
  58524. this.update = throttle$1(this.update_, UPDATE_REFRESH_INTERVAL$1);
  58525. this.on(this.player_, ["ended", "durationchange", "timeupdate"], this.update);
  58526. if (this.player_.liveTracker) {
  58527. this.on(this.player_.liveTracker, "liveedgechange", this.update);
  58528. }
  58529. this.updateInterval = null;
  58530. this.enableIntervalHandler_ = (e) => this.enableInterval_(e);
  58531. this.disableIntervalHandler_ = (e) => this.disableInterval_(e);
  58532. this.on(this.player_, ["playing"], this.enableIntervalHandler_);
  58533. this.on(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_);
  58534. if ("hidden" in document_1 && "visibilityState" in document_1) {
  58535. this.on(document_1, "visibilitychange", this.toggleVisibility_);
  58536. }
  58537. }
  58538. toggleVisibility_(e) {
  58539. if (document_1.visibilityState === "hidden") {
  58540. this.cancelNamedAnimationFrame("SeekBar#update");
  58541. this.cancelNamedAnimationFrame("Slider#update");
  58542. this.disableInterval_(e);
  58543. } else {
  58544. if (!this.player_.ended() && !this.player_.paused()) {
  58545. this.enableInterval_();
  58546. }
  58547. this.update();
  58548. }
  58549. }
  58550. enableInterval_() {
  58551. if (this.updateInterval) {
  58552. return;
  58553. }
  58554. this.updateInterval = this.setInterval(this.update, UPDATE_REFRESH_INTERVAL$1);
  58555. }
  58556. disableInterval_(e) {
  58557. if (this.player_.liveTracker && this.player_.liveTracker.isLive() && e && e.type !== "ended") {
  58558. return;
  58559. }
  58560. if (!this.updateInterval) {
  58561. return;
  58562. }
  58563. this.clearInterval(this.updateInterval);
  58564. this.updateInterval = null;
  58565. }
  58566. createEl() {
  58567. return super.createEl("div", {
  58568. className: "vjs-progress-holder"
  58569. }, {
  58570. "aria-label": this.localize("Progress Bar")
  58571. });
  58572. }
  58573. update(event2) {
  58574. if (document_1.visibilityState === "hidden") {
  58575. return;
  58576. }
  58577. const percent = super.update();
  58578. this.requestNamedAnimationFrame("SeekBar#update", () => {
  58579. const currentTime = this.player_.ended() ? this.player_.duration() : this.getCurrentTime_();
  58580. const liveTracker = this.player_.liveTracker;
  58581. let duration5 = this.player_.duration();
  58582. if (liveTracker && liveTracker.isLive()) {
  58583. duration5 = this.player_.liveTracker.liveCurrentTime();
  58584. }
  58585. if (this.percent_ !== percent) {
  58586. this.el_.setAttribute("aria-valuenow", (percent * 100).toFixed(2));
  58587. this.percent_ = percent;
  58588. }
  58589. if (this.currentTime_ !== currentTime || this.duration_ !== duration5) {
  58590. this.el_.setAttribute("aria-valuetext", this.localize("progress bar timing: currentTime={1} duration={2}", [formatTime$1(currentTime, duration5), formatTime$1(duration5, duration5)], "{1} of {2}"));
  58591. this.currentTime_ = currentTime;
  58592. this.duration_ = duration5;
  58593. }
  58594. if (this.bar) {
  58595. this.bar.update(getBoundingClientRect$1(this.el()), this.getProgress());
  58596. }
  58597. });
  58598. return percent;
  58599. }
  58600. userSeek_(ct2) {
  58601. if (this.player_.liveTracker && this.player_.liveTracker.isLive()) {
  58602. this.player_.liveTracker.nextSeekedFromUser();
  58603. }
  58604. this.player_.currentTime(ct2);
  58605. }
  58606. getCurrentTime_() {
  58607. return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  58608. }
  58609. getPercent() {
  58610. const currentTime = this.getCurrentTime_();
  58611. let percent;
  58612. const liveTracker = this.player_.liveTracker;
  58613. if (liveTracker && liveTracker.isLive()) {
  58614. percent = (currentTime - liveTracker.seekableStart()) / liveTracker.liveWindow();
  58615. if (liveTracker.atLiveEdge()) {
  58616. percent = 1;
  58617. }
  58618. } else {
  58619. percent = currentTime / this.player_.duration();
  58620. }
  58621. return percent;
  58622. }
  58623. handleMouseDown(event2) {
  58624. if (!isSingleLeftClick$1(event2)) {
  58625. return;
  58626. }
  58627. event2.stopPropagation();
  58628. this.videoWasPlaying = !this.player_.paused();
  58629. this.player_.pause();
  58630. super.handleMouseDown(event2);
  58631. }
  58632. handleMouseMove(event2, mouseDown = false) {
  58633. if (!isSingleLeftClick$1(event2)) {
  58634. return;
  58635. }
  58636. if (!mouseDown && !this.player_.scrubbing()) {
  58637. this.player_.scrubbing(true);
  58638. }
  58639. let newTime;
  58640. const distance2 = this.calculateDistance(event2);
  58641. const liveTracker = this.player_.liveTracker;
  58642. if (!liveTracker || !liveTracker.isLive()) {
  58643. newTime = distance2 * this.player_.duration();
  58644. if (newTime === this.player_.duration()) {
  58645. newTime = newTime - 0.1;
  58646. }
  58647. } else {
  58648. if (distance2 >= 0.99) {
  58649. liveTracker.seekToLiveEdge();
  58650. return;
  58651. }
  58652. const seekableStart = liveTracker.seekableStart();
  58653. const seekableEnd = liveTracker.liveCurrentTime();
  58654. newTime = seekableStart + distance2 * liveTracker.liveWindow();
  58655. if (newTime >= seekableEnd) {
  58656. newTime = seekableEnd;
  58657. }
  58658. if (newTime <= seekableStart) {
  58659. newTime = seekableStart + 0.1;
  58660. }
  58661. if (newTime === Infinity) {
  58662. return;
  58663. }
  58664. }
  58665. this.userSeek_(newTime);
  58666. }
  58667. enable() {
  58668. super.enable();
  58669. const mouseTimeDisplay = this.getChild("mouseTimeDisplay");
  58670. if (!mouseTimeDisplay) {
  58671. return;
  58672. }
  58673. mouseTimeDisplay.show();
  58674. }
  58675. disable() {
  58676. super.disable();
  58677. const mouseTimeDisplay = this.getChild("mouseTimeDisplay");
  58678. if (!mouseTimeDisplay) {
  58679. return;
  58680. }
  58681. mouseTimeDisplay.hide();
  58682. }
  58683. handleMouseUp(event2) {
  58684. super.handleMouseUp(event2);
  58685. if (event2) {
  58686. event2.stopPropagation();
  58687. }
  58688. this.player_.scrubbing(false);
  58689. this.player_.trigger({
  58690. type: "timeupdate",
  58691. target: this,
  58692. manuallyTriggered: true
  58693. });
  58694. if (this.videoWasPlaying) {
  58695. silencePromise$1(this.player_.play());
  58696. } else {
  58697. this.update_();
  58698. }
  58699. }
  58700. stepForward() {
  58701. this.userSeek_(this.player_.currentTime() + STEP_SECONDS$1);
  58702. }
  58703. stepBack() {
  58704. this.userSeek_(this.player_.currentTime() - STEP_SECONDS$1);
  58705. }
  58706. handleAction(event2) {
  58707. if (this.player_.paused()) {
  58708. this.player_.play();
  58709. } else {
  58710. this.player_.pause();
  58711. }
  58712. }
  58713. handleKeyDown(event2) {
  58714. const liveTracker = this.player_.liveTracker;
  58715. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  58716. event2.preventDefault();
  58717. event2.stopPropagation();
  58718. this.handleAction(event2);
  58719. } else if (keycode.isEventKey(event2, "Home")) {
  58720. event2.preventDefault();
  58721. event2.stopPropagation();
  58722. this.userSeek_(0);
  58723. } else if (keycode.isEventKey(event2, "End")) {
  58724. event2.preventDefault();
  58725. event2.stopPropagation();
  58726. if (liveTracker && liveTracker.isLive()) {
  58727. this.userSeek_(liveTracker.liveCurrentTime());
  58728. } else {
  58729. this.userSeek_(this.player_.duration());
  58730. }
  58731. } else if (/^[0-9]$/.test(keycode(event2))) {
  58732. event2.preventDefault();
  58733. event2.stopPropagation();
  58734. const gotoFraction = (keycode.codes[keycode(event2)] - keycode.codes["0"]) * 10 / 100;
  58735. if (liveTracker && liveTracker.isLive()) {
  58736. this.userSeek_(liveTracker.seekableStart() + liveTracker.liveWindow() * gotoFraction);
  58737. } else {
  58738. this.userSeek_(this.player_.duration() * gotoFraction);
  58739. }
  58740. } else if (keycode.isEventKey(event2, "PgDn")) {
  58741. event2.preventDefault();
  58742. event2.stopPropagation();
  58743. this.userSeek_(this.player_.currentTime() - STEP_SECONDS$1 * PAGE_KEY_MULTIPLIER$1);
  58744. } else if (keycode.isEventKey(event2, "PgUp")) {
  58745. event2.preventDefault();
  58746. event2.stopPropagation();
  58747. this.userSeek_(this.player_.currentTime() + STEP_SECONDS$1 * PAGE_KEY_MULTIPLIER$1);
  58748. } else {
  58749. super.handleKeyDown(event2);
  58750. }
  58751. }
  58752. dispose() {
  58753. this.disableInterval_();
  58754. this.off(this.player_, ["ended", "durationchange", "timeupdate"], this.update);
  58755. if (this.player_.liveTracker) {
  58756. this.off(this.player_.liveTracker, "liveedgechange", this.update);
  58757. }
  58758. this.off(this.player_, ["playing"], this.enableIntervalHandler_);
  58759. this.off(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_);
  58760. if ("hidden" in document_1 && "visibilityState" in document_1) {
  58761. this.off(document_1, "visibilitychange", this.toggleVisibility_);
  58762. }
  58763. super.dispose();
  58764. }
  58765. }
  58766. SeekBar$1.prototype.options_ = {
  58767. children: ["loadProgressBar", "playProgressBar"],
  58768. barName: "playProgressBar"
  58769. };
  58770. if (!IS_IOS$1 && !IS_ANDROID$1) {
  58771. SeekBar$1.prototype.options_.children.splice(1, 0, "mouseTimeDisplay");
  58772. }
  58773. Component$1$1.registerComponent("SeekBar", SeekBar$1);
  58774. class ProgressControl$1 extends Component$1$1 {
  58775. constructor(player, options2) {
  58776. super(player, options2);
  58777. this.handleMouseMove = throttle$1(bind_(this, this.handleMouseMove), UPDATE_REFRESH_INTERVAL$1);
  58778. this.throttledHandleMouseSeek = throttle$1(bind_(this, this.handleMouseSeek), UPDATE_REFRESH_INTERVAL$1);
  58779. this.handleMouseUpHandler_ = (e) => this.handleMouseUp(e);
  58780. this.handleMouseDownHandler_ = (e) => this.handleMouseDown(e);
  58781. this.enable();
  58782. }
  58783. createEl() {
  58784. return super.createEl("div", {
  58785. className: "vjs-progress-control vjs-control"
  58786. });
  58787. }
  58788. handleMouseMove(event2) {
  58789. const seekBar = this.getChild("seekBar");
  58790. if (!seekBar) {
  58791. return;
  58792. }
  58793. const playProgressBar = seekBar.getChild("playProgressBar");
  58794. const mouseTimeDisplay = seekBar.getChild("mouseTimeDisplay");
  58795. if (!playProgressBar && !mouseTimeDisplay) {
  58796. return;
  58797. }
  58798. const seekBarEl = seekBar.el();
  58799. const seekBarRect = findPosition$1(seekBarEl);
  58800. let seekBarPoint = getPointerPosition$1(seekBarEl, event2).x;
  58801. seekBarPoint = clamp$1(seekBarPoint, 0, 1);
  58802. if (mouseTimeDisplay) {
  58803. mouseTimeDisplay.update(seekBarRect, seekBarPoint);
  58804. }
  58805. if (playProgressBar) {
  58806. playProgressBar.update(seekBarRect, seekBar.getProgress());
  58807. }
  58808. }
  58809. handleMouseSeek(event2) {
  58810. const seekBar = this.getChild("seekBar");
  58811. if (seekBar) {
  58812. seekBar.handleMouseMove(event2);
  58813. }
  58814. }
  58815. enabled() {
  58816. return this.enabled_;
  58817. }
  58818. disable() {
  58819. this.children().forEach((child) => child.disable && child.disable());
  58820. if (!this.enabled()) {
  58821. return;
  58822. }
  58823. this.off(["mousedown", "touchstart"], this.handleMouseDownHandler_);
  58824. this.off(this.el_, "mousemove", this.handleMouseMove);
  58825. this.removeListenersAddedOnMousedownAndTouchstart();
  58826. this.addClass("disabled");
  58827. this.enabled_ = false;
  58828. if (this.player_.scrubbing()) {
  58829. const seekBar = this.getChild("seekBar");
  58830. this.player_.scrubbing(false);
  58831. if (seekBar.videoWasPlaying) {
  58832. silencePromise$1(this.player_.play());
  58833. }
  58834. }
  58835. }
  58836. enable() {
  58837. this.children().forEach((child) => child.enable && child.enable());
  58838. if (this.enabled()) {
  58839. return;
  58840. }
  58841. this.on(["mousedown", "touchstart"], this.handleMouseDownHandler_);
  58842. this.on(this.el_, "mousemove", this.handleMouseMove);
  58843. this.removeClass("disabled");
  58844. this.enabled_ = true;
  58845. }
  58846. removeListenersAddedOnMousedownAndTouchstart() {
  58847. const doc = this.el_.ownerDocument;
  58848. this.off(doc, "mousemove", this.throttledHandleMouseSeek);
  58849. this.off(doc, "touchmove", this.throttledHandleMouseSeek);
  58850. this.off(doc, "mouseup", this.handleMouseUpHandler_);
  58851. this.off(doc, "touchend", this.handleMouseUpHandler_);
  58852. }
  58853. handleMouseDown(event2) {
  58854. const doc = this.el_.ownerDocument;
  58855. const seekBar = this.getChild("seekBar");
  58856. if (seekBar) {
  58857. seekBar.handleMouseDown(event2);
  58858. }
  58859. this.on(doc, "mousemove", this.throttledHandleMouseSeek);
  58860. this.on(doc, "touchmove", this.throttledHandleMouseSeek);
  58861. this.on(doc, "mouseup", this.handleMouseUpHandler_);
  58862. this.on(doc, "touchend", this.handleMouseUpHandler_);
  58863. }
  58864. handleMouseUp(event2) {
  58865. const seekBar = this.getChild("seekBar");
  58866. if (seekBar) {
  58867. seekBar.handleMouseUp(event2);
  58868. }
  58869. this.removeListenersAddedOnMousedownAndTouchstart();
  58870. }
  58871. }
  58872. ProgressControl$1.prototype.options_ = {
  58873. children: ["seekBar"]
  58874. };
  58875. Component$1$1.registerComponent("ProgressControl", ProgressControl$1);
  58876. class PictureInPictureToggle$1 extends Button$1 {
  58877. constructor(player, options2) {
  58878. super(player, options2);
  58879. this.on(player, ["enterpictureinpicture", "leavepictureinpicture"], (e) => this.handlePictureInPictureChange(e));
  58880. this.on(player, ["disablepictureinpicturechanged", "loadedmetadata"], (e) => this.handlePictureInPictureEnabledChange(e));
  58881. this.on(player, ["loadedmetadata", "audioonlymodechange", "audiopostermodechange"], () => {
  58882. const isSourceAudio = player.currentType().substring(0, 5) === "audio";
  58883. if (isSourceAudio || player.audioPosterMode() || player.audioOnlyMode()) {
  58884. if (player.isInPictureInPicture()) {
  58885. player.exitPictureInPicture();
  58886. }
  58887. this.hide();
  58888. } else {
  58889. this.show();
  58890. }
  58891. });
  58892. this.disable();
  58893. }
  58894. buildCSSClass() {
  58895. return `vjs-picture-in-picture-control ${super.buildCSSClass()}`;
  58896. }
  58897. handlePictureInPictureEnabledChange() {
  58898. if (document_1.pictureInPictureEnabled && this.player_.disablePictureInPicture() === false || this.player_.options_.enableDocumentPictureInPicture && "documentPictureInPicture" in window_1) {
  58899. this.enable();
  58900. } else {
  58901. this.disable();
  58902. }
  58903. }
  58904. handlePictureInPictureChange(event2) {
  58905. if (this.player_.isInPictureInPicture()) {
  58906. this.controlText("Exit Picture-in-Picture");
  58907. } else {
  58908. this.controlText("Picture-in-Picture");
  58909. }
  58910. this.handlePictureInPictureEnabledChange();
  58911. }
  58912. handleClick(event2) {
  58913. if (!this.player_.isInPictureInPicture()) {
  58914. this.player_.requestPictureInPicture();
  58915. } else {
  58916. this.player_.exitPictureInPicture();
  58917. }
  58918. }
  58919. }
  58920. PictureInPictureToggle$1.prototype.controlText_ = "Picture-in-Picture";
  58921. Component$1$1.registerComponent("PictureInPictureToggle", PictureInPictureToggle$1);
  58922. class FullscreenToggle$1 extends Button$1 {
  58923. constructor(player, options2) {
  58924. super(player, options2);
  58925. this.on(player, "fullscreenchange", (e) => this.handleFullscreenChange(e));
  58926. if (document_1[player.fsApi_.fullscreenEnabled] === false) {
  58927. this.disable();
  58928. }
  58929. }
  58930. buildCSSClass() {
  58931. return `vjs-fullscreen-control ${super.buildCSSClass()}`;
  58932. }
  58933. handleFullscreenChange(event2) {
  58934. if (this.player_.isFullscreen()) {
  58935. this.controlText("Exit Fullscreen");
  58936. } else {
  58937. this.controlText("Fullscreen");
  58938. }
  58939. }
  58940. handleClick(event2) {
  58941. if (!this.player_.isFullscreen()) {
  58942. this.player_.requestFullscreen();
  58943. } else {
  58944. this.player_.exitFullscreen();
  58945. }
  58946. }
  58947. }
  58948. FullscreenToggle$1.prototype.controlText_ = "Fullscreen";
  58949. Component$1$1.registerComponent("FullscreenToggle", FullscreenToggle$1);
  58950. const checkVolumeSupport$1 = function(self2, player) {
  58951. if (player.tech_ && !player.tech_.featuresVolumeControl) {
  58952. self2.addClass("vjs-hidden");
  58953. }
  58954. self2.on(player, "loadstart", function() {
  58955. if (!player.tech_.featuresVolumeControl) {
  58956. self2.addClass("vjs-hidden");
  58957. } else {
  58958. self2.removeClass("vjs-hidden");
  58959. }
  58960. });
  58961. };
  58962. class VolumeLevel$1 extends Component$1$1 {
  58963. createEl() {
  58964. const el = super.createEl("div", {
  58965. className: "vjs-volume-level"
  58966. });
  58967. el.appendChild(super.createEl("span", {
  58968. className: "vjs-control-text"
  58969. }));
  58970. return el;
  58971. }
  58972. }
  58973. Component$1$1.registerComponent("VolumeLevel", VolumeLevel$1);
  58974. class VolumeLevelTooltip$1 extends Component$1$1 {
  58975. constructor(player, options2) {
  58976. super(player, options2);
  58977. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  58978. }
  58979. createEl() {
  58980. return super.createEl("div", {
  58981. className: "vjs-volume-tooltip"
  58982. }, {
  58983. "aria-hidden": "true"
  58984. });
  58985. }
  58986. update(rangeBarRect, rangeBarPoint, vertical, content) {
  58987. if (!vertical) {
  58988. const tooltipRect = getBoundingClientRect$1(this.el_);
  58989. const playerRect = getBoundingClientRect$1(this.player_.el());
  58990. const volumeBarPointPx = rangeBarRect.width * rangeBarPoint;
  58991. if (!playerRect || !tooltipRect) {
  58992. return;
  58993. }
  58994. const spaceLeftOfPoint = rangeBarRect.left - playerRect.left + volumeBarPointPx;
  58995. const spaceRightOfPoint = rangeBarRect.width - volumeBarPointPx + (playerRect.right - rangeBarRect.right);
  58996. let pullTooltipBy = tooltipRect.width / 2;
  58997. if (spaceLeftOfPoint < pullTooltipBy) {
  58998. pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;
  58999. } else if (spaceRightOfPoint < pullTooltipBy) {
  59000. pullTooltipBy = spaceRightOfPoint;
  59001. }
  59002. if (pullTooltipBy < 0) {
  59003. pullTooltipBy = 0;
  59004. } else if (pullTooltipBy > tooltipRect.width) {
  59005. pullTooltipBy = tooltipRect.width;
  59006. }
  59007. this.el_.style.right = `-${pullTooltipBy}px`;
  59008. }
  59009. this.write(`${content}%`);
  59010. }
  59011. write(content) {
  59012. textContent$1(this.el_, content);
  59013. }
  59014. updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, cb) {
  59015. this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume", () => {
  59016. this.update(rangeBarRect, rangeBarPoint, vertical, volume.toFixed(0));
  59017. if (cb) {
  59018. cb();
  59019. }
  59020. });
  59021. }
  59022. }
  59023. Component$1$1.registerComponent("VolumeLevelTooltip", VolumeLevelTooltip$1);
  59024. class MouseVolumeLevelDisplay$1 extends Component$1$1 {
  59025. constructor(player, options2) {
  59026. super(player, options2);
  59027. this.update = throttle$1(bind_(this, this.update), UPDATE_REFRESH_INTERVAL$1);
  59028. }
  59029. createEl() {
  59030. return super.createEl("div", {
  59031. className: "vjs-mouse-display"
  59032. });
  59033. }
  59034. update(rangeBarRect, rangeBarPoint, vertical) {
  59035. const volume = 100 * rangeBarPoint;
  59036. this.getChild("volumeLevelTooltip").updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, () => {
  59037. if (vertical) {
  59038. this.el_.style.bottom = `${rangeBarRect.height * rangeBarPoint}px`;
  59039. } else {
  59040. this.el_.style.left = `${rangeBarRect.width * rangeBarPoint}px`;
  59041. }
  59042. });
  59043. }
  59044. }
  59045. MouseVolumeLevelDisplay$1.prototype.options_ = {
  59046. children: ["volumeLevelTooltip"]
  59047. };
  59048. Component$1$1.registerComponent("MouseVolumeLevelDisplay", MouseVolumeLevelDisplay$1);
  59049. class VolumeBar$1 extends Slider$1 {
  59050. constructor(player, options2) {
  59051. super(player, options2);
  59052. this.on("slideractive", (e) => this.updateLastVolume_(e));
  59053. this.on(player, "volumechange", (e) => this.updateARIAAttributes(e));
  59054. player.ready(() => this.updateARIAAttributes());
  59055. }
  59056. createEl() {
  59057. return super.createEl("div", {
  59058. className: "vjs-volume-bar vjs-slider-bar"
  59059. }, {
  59060. "aria-label": this.localize("Volume Level"),
  59061. "aria-live": "polite"
  59062. });
  59063. }
  59064. handleMouseDown(event2) {
  59065. if (!isSingleLeftClick$1(event2)) {
  59066. return;
  59067. }
  59068. super.handleMouseDown(event2);
  59069. }
  59070. handleMouseMove(event2) {
  59071. const mouseVolumeLevelDisplay = this.getChild("mouseVolumeLevelDisplay");
  59072. if (mouseVolumeLevelDisplay) {
  59073. const volumeBarEl = this.el();
  59074. const volumeBarRect = getBoundingClientRect$1(volumeBarEl);
  59075. const vertical = this.vertical();
  59076. let volumeBarPoint = getPointerPosition$1(volumeBarEl, event2);
  59077. volumeBarPoint = vertical ? volumeBarPoint.y : volumeBarPoint.x;
  59078. volumeBarPoint = clamp$1(volumeBarPoint, 0, 1);
  59079. mouseVolumeLevelDisplay.update(volumeBarRect, volumeBarPoint, vertical);
  59080. }
  59081. if (!isSingleLeftClick$1(event2)) {
  59082. return;
  59083. }
  59084. this.checkMuted();
  59085. this.player_.volume(this.calculateDistance(event2));
  59086. }
  59087. checkMuted() {
  59088. if (this.player_.muted()) {
  59089. this.player_.muted(false);
  59090. }
  59091. }
  59092. getPercent() {
  59093. if (this.player_.muted()) {
  59094. return 0;
  59095. }
  59096. return this.player_.volume();
  59097. }
  59098. stepForward() {
  59099. this.checkMuted();
  59100. this.player_.volume(this.player_.volume() + 0.1);
  59101. }
  59102. stepBack() {
  59103. this.checkMuted();
  59104. this.player_.volume(this.player_.volume() - 0.1);
  59105. }
  59106. updateARIAAttributes(event2) {
  59107. const ariaValue = this.player_.muted() ? 0 : this.volumeAsPercentage_();
  59108. this.el_.setAttribute("aria-valuenow", ariaValue);
  59109. this.el_.setAttribute("aria-valuetext", ariaValue + "%");
  59110. }
  59111. volumeAsPercentage_() {
  59112. return Math.round(this.player_.volume() * 100);
  59113. }
  59114. updateLastVolume_() {
  59115. const volumeBeforeDrag = this.player_.volume();
  59116. this.one("sliderinactive", () => {
  59117. if (this.player_.volume() === 0) {
  59118. this.player_.lastVolume_(volumeBeforeDrag);
  59119. }
  59120. });
  59121. }
  59122. }
  59123. VolumeBar$1.prototype.options_ = {
  59124. children: ["volumeLevel"],
  59125. barName: "volumeLevel"
  59126. };
  59127. if (!IS_IOS$1 && !IS_ANDROID$1) {
  59128. VolumeBar$1.prototype.options_.children.splice(0, 0, "mouseVolumeLevelDisplay");
  59129. }
  59130. VolumeBar$1.prototype.playerEvent = "volumechange";
  59131. Component$1$1.registerComponent("VolumeBar", VolumeBar$1);
  59132. class VolumeControl$1 extends Component$1$1 {
  59133. constructor(player, options2 = {}) {
  59134. options2.vertical = options2.vertical || false;
  59135. if (typeof options2.volumeBar === "undefined" || isPlain$1(options2.volumeBar)) {
  59136. options2.volumeBar = options2.volumeBar || {};
  59137. options2.volumeBar.vertical = options2.vertical;
  59138. }
  59139. super(player, options2);
  59140. checkVolumeSupport$1(this, player);
  59141. this.throttledHandleMouseMove = throttle$1(bind_(this, this.handleMouseMove), UPDATE_REFRESH_INTERVAL$1);
  59142. this.handleMouseUpHandler_ = (e) => this.handleMouseUp(e);
  59143. this.on("mousedown", (e) => this.handleMouseDown(e));
  59144. this.on("touchstart", (e) => this.handleMouseDown(e));
  59145. this.on("mousemove", (e) => this.handleMouseMove(e));
  59146. this.on(this.volumeBar, ["focus", "slideractive"], () => {
  59147. this.volumeBar.addClass("vjs-slider-active");
  59148. this.addClass("vjs-slider-active");
  59149. this.trigger("slideractive");
  59150. });
  59151. this.on(this.volumeBar, ["blur", "sliderinactive"], () => {
  59152. this.volumeBar.removeClass("vjs-slider-active");
  59153. this.removeClass("vjs-slider-active");
  59154. this.trigger("sliderinactive");
  59155. });
  59156. }
  59157. createEl() {
  59158. let orientationClass = "vjs-volume-horizontal";
  59159. if (this.options_.vertical) {
  59160. orientationClass = "vjs-volume-vertical";
  59161. }
  59162. return super.createEl("div", {
  59163. className: `vjs-volume-control vjs-control ${orientationClass}`
  59164. });
  59165. }
  59166. handleMouseDown(event2) {
  59167. const doc = this.el_.ownerDocument;
  59168. this.on(doc, "mousemove", this.throttledHandleMouseMove);
  59169. this.on(doc, "touchmove", this.throttledHandleMouseMove);
  59170. this.on(doc, "mouseup", this.handleMouseUpHandler_);
  59171. this.on(doc, "touchend", this.handleMouseUpHandler_);
  59172. }
  59173. handleMouseUp(event2) {
  59174. const doc = this.el_.ownerDocument;
  59175. this.off(doc, "mousemove", this.throttledHandleMouseMove);
  59176. this.off(doc, "touchmove", this.throttledHandleMouseMove);
  59177. this.off(doc, "mouseup", this.handleMouseUpHandler_);
  59178. this.off(doc, "touchend", this.handleMouseUpHandler_);
  59179. }
  59180. handleMouseMove(event2) {
  59181. this.volumeBar.handleMouseMove(event2);
  59182. }
  59183. }
  59184. VolumeControl$1.prototype.options_ = {
  59185. children: ["volumeBar"]
  59186. };
  59187. Component$1$1.registerComponent("VolumeControl", VolumeControl$1);
  59188. const checkMuteSupport$1 = function(self2, player) {
  59189. if (player.tech_ && !player.tech_.featuresMuteControl) {
  59190. self2.addClass("vjs-hidden");
  59191. }
  59192. self2.on(player, "loadstart", function() {
  59193. if (!player.tech_.featuresMuteControl) {
  59194. self2.addClass("vjs-hidden");
  59195. } else {
  59196. self2.removeClass("vjs-hidden");
  59197. }
  59198. });
  59199. };
  59200. class MuteToggle$1 extends Button$1 {
  59201. constructor(player, options2) {
  59202. super(player, options2);
  59203. checkMuteSupport$1(this, player);
  59204. this.on(player, ["loadstart", "volumechange"], (e) => this.update(e));
  59205. }
  59206. buildCSSClass() {
  59207. return `vjs-mute-control ${super.buildCSSClass()}`;
  59208. }
  59209. handleClick(event2) {
  59210. const vol = this.player_.volume();
  59211. const lastVolume = this.player_.lastVolume_();
  59212. if (vol === 0) {
  59213. const volumeToSet = lastVolume < 0.1 ? 0.1 : lastVolume;
  59214. this.player_.volume(volumeToSet);
  59215. this.player_.muted(false);
  59216. } else {
  59217. this.player_.muted(this.player_.muted() ? false : true);
  59218. }
  59219. }
  59220. update(event2) {
  59221. this.updateIcon_();
  59222. this.updateControlText_();
  59223. }
  59224. updateIcon_() {
  59225. const vol = this.player_.volume();
  59226. let level = 3;
  59227. if (IS_IOS$1 && this.player_.tech_ && this.player_.tech_.el_) {
  59228. this.player_.muted(this.player_.tech_.el_.muted);
  59229. }
  59230. if (vol === 0 || this.player_.muted()) {
  59231. level = 0;
  59232. } else if (vol < 0.33) {
  59233. level = 1;
  59234. } else if (vol < 0.67) {
  59235. level = 2;
  59236. }
  59237. removeClass$1(this.el_, [0, 1, 2, 3].reduce((str, i2) => str + `${i2 ? " " : ""}vjs-vol-${i2}`, ""));
  59238. addClass$1(this.el_, `vjs-vol-${level}`);
  59239. }
  59240. updateControlText_() {
  59241. const soundOff = this.player_.muted() || this.player_.volume() === 0;
  59242. const text = soundOff ? "Unmute" : "Mute";
  59243. if (this.controlText() !== text) {
  59244. this.controlText(text);
  59245. }
  59246. }
  59247. }
  59248. MuteToggle$1.prototype.controlText_ = "Mute";
  59249. Component$1$1.registerComponent("MuteToggle", MuteToggle$1);
  59250. class VolumePanel$1 extends Component$1$1 {
  59251. constructor(player, options2 = {}) {
  59252. if (typeof options2.inline !== "undefined") {
  59253. options2.inline = options2.inline;
  59254. } else {
  59255. options2.inline = true;
  59256. }
  59257. if (typeof options2.volumeControl === "undefined" || isPlain$1(options2.volumeControl)) {
  59258. options2.volumeControl = options2.volumeControl || {};
  59259. options2.volumeControl.vertical = !options2.inline;
  59260. }
  59261. super(player, options2);
  59262. this.handleKeyPressHandler_ = (e) => this.handleKeyPress(e);
  59263. this.on(player, ["loadstart"], (e) => this.volumePanelState_(e));
  59264. this.on(this.muteToggle, "keyup", (e) => this.handleKeyPress(e));
  59265. this.on(this.volumeControl, "keyup", (e) => this.handleVolumeControlKeyUp(e));
  59266. this.on("keydown", (e) => this.handleKeyPress(e));
  59267. this.on("mouseover", (e) => this.handleMouseOver(e));
  59268. this.on("mouseout", (e) => this.handleMouseOut(e));
  59269. this.on(this.volumeControl, ["slideractive"], this.sliderActive_);
  59270. this.on(this.volumeControl, ["sliderinactive"], this.sliderInactive_);
  59271. }
  59272. sliderActive_() {
  59273. this.addClass("vjs-slider-active");
  59274. }
  59275. sliderInactive_() {
  59276. this.removeClass("vjs-slider-active");
  59277. }
  59278. volumePanelState_() {
  59279. if (this.volumeControl.hasClass("vjs-hidden") && this.muteToggle.hasClass("vjs-hidden")) {
  59280. this.addClass("vjs-hidden");
  59281. }
  59282. if (this.volumeControl.hasClass("vjs-hidden") && !this.muteToggle.hasClass("vjs-hidden")) {
  59283. this.addClass("vjs-mute-toggle-only");
  59284. }
  59285. }
  59286. createEl() {
  59287. let orientationClass = "vjs-volume-panel-horizontal";
  59288. if (!this.options_.inline) {
  59289. orientationClass = "vjs-volume-panel-vertical";
  59290. }
  59291. return super.createEl("div", {
  59292. className: `vjs-volume-panel vjs-control ${orientationClass}`
  59293. });
  59294. }
  59295. dispose() {
  59296. this.handleMouseOut();
  59297. super.dispose();
  59298. }
  59299. handleVolumeControlKeyUp(event2) {
  59300. if (keycode.isEventKey(event2, "Esc")) {
  59301. this.muteToggle.focus();
  59302. }
  59303. }
  59304. handleMouseOver(event2) {
  59305. this.addClass("vjs-hover");
  59306. on$1(document_1, "keyup", this.handleKeyPressHandler_);
  59307. }
  59308. handleMouseOut(event2) {
  59309. this.removeClass("vjs-hover");
  59310. off$1(document_1, "keyup", this.handleKeyPressHandler_);
  59311. }
  59312. handleKeyPress(event2) {
  59313. if (keycode.isEventKey(event2, "Esc")) {
  59314. this.handleMouseOut();
  59315. }
  59316. }
  59317. }
  59318. VolumePanel$1.prototype.options_ = {
  59319. children: ["muteToggle", "volumeControl"]
  59320. };
  59321. Component$1$1.registerComponent("VolumePanel", VolumePanel$1);
  59322. class SkipForward extends Button$1 {
  59323. constructor(player, options2) {
  59324. super(player, options2);
  59325. this.validOptions = [5, 10, 30];
  59326. this.skipTime = this.getSkipForwardTime();
  59327. if (this.skipTime && this.validOptions.includes(this.skipTime)) {
  59328. this.controlText(this.localize("Skip forward {1} seconds", [this.skipTime]));
  59329. this.show();
  59330. } else {
  59331. this.hide();
  59332. }
  59333. }
  59334. getSkipForwardTime() {
  59335. const playerOptions = this.options_.playerOptions;
  59336. return playerOptions.controlBar && playerOptions.controlBar.skipButtons && playerOptions.controlBar.skipButtons.forward;
  59337. }
  59338. buildCSSClass() {
  59339. return `vjs-skip-forward-${this.getSkipForwardTime()} ${super.buildCSSClass()}`;
  59340. }
  59341. handleClick(event2) {
  59342. const currentVideoTime = this.player_.currentTime();
  59343. const liveTracker = this.player_.liveTracker;
  59344. const duration5 = liveTracker && liveTracker.isLive() ? liveTracker.seekableEnd() : this.player_.duration();
  59345. let newTime;
  59346. if (currentVideoTime + this.skipTime <= duration5) {
  59347. newTime = currentVideoTime + this.skipTime;
  59348. } else {
  59349. newTime = duration5;
  59350. }
  59351. this.player_.currentTime(newTime);
  59352. }
  59353. handleLanguagechange() {
  59354. this.controlText(this.localize("Skip forward {1} seconds", [this.skipTime]));
  59355. }
  59356. }
  59357. Component$1$1.registerComponent("SkipForward", SkipForward);
  59358. class SkipBackward extends Button$1 {
  59359. constructor(player, options2) {
  59360. super(player, options2);
  59361. this.validOptions = [5, 10, 30];
  59362. this.skipTime = this.getSkipBackwardTime();
  59363. if (this.skipTime && this.validOptions.includes(this.skipTime)) {
  59364. this.controlText(this.localize("Skip backward {1} seconds", [this.skipTime]));
  59365. this.show();
  59366. } else {
  59367. this.hide();
  59368. }
  59369. }
  59370. getSkipBackwardTime() {
  59371. const playerOptions = this.options_.playerOptions;
  59372. return playerOptions.controlBar && playerOptions.controlBar.skipButtons && playerOptions.controlBar.skipButtons.backward;
  59373. }
  59374. buildCSSClass() {
  59375. return `vjs-skip-backward-${this.getSkipBackwardTime()} ${super.buildCSSClass()}`;
  59376. }
  59377. handleClick(event2) {
  59378. const currentVideoTime = this.player_.currentTime();
  59379. const liveTracker = this.player_.liveTracker;
  59380. const seekableStart = liveTracker && liveTracker.isLive() && liveTracker.seekableStart();
  59381. let newTime;
  59382. if (seekableStart && currentVideoTime - this.skipTime <= seekableStart) {
  59383. newTime = seekableStart;
  59384. } else if (currentVideoTime >= this.skipTime) {
  59385. newTime = currentVideoTime - this.skipTime;
  59386. } else {
  59387. newTime = 0;
  59388. }
  59389. this.player_.currentTime(newTime);
  59390. }
  59391. handleLanguagechange() {
  59392. this.controlText(this.localize("Skip backward {1} seconds", [this.skipTime]));
  59393. }
  59394. }
  59395. SkipBackward.prototype.controlText_ = "Skip Backward";
  59396. Component$1$1.registerComponent("SkipBackward", SkipBackward);
  59397. class Menu$1 extends Component$1$1 {
  59398. constructor(player, options2) {
  59399. super(player, options2);
  59400. if (options2) {
  59401. this.menuButton_ = options2.menuButton;
  59402. }
  59403. this.focusedChild_ = -1;
  59404. this.on("keydown", (e) => this.handleKeyDown(e));
  59405. this.boundHandleBlur_ = (e) => this.handleBlur(e);
  59406. this.boundHandleTapClick_ = (e) => this.handleTapClick(e);
  59407. }
  59408. addEventListenerForItem(component) {
  59409. if (!(component instanceof Component$1$1)) {
  59410. return;
  59411. }
  59412. this.on(component, "blur", this.boundHandleBlur_);
  59413. this.on(component, ["tap", "click"], this.boundHandleTapClick_);
  59414. }
  59415. removeEventListenerForItem(component) {
  59416. if (!(component instanceof Component$1$1)) {
  59417. return;
  59418. }
  59419. this.off(component, "blur", this.boundHandleBlur_);
  59420. this.off(component, ["tap", "click"], this.boundHandleTapClick_);
  59421. }
  59422. removeChild(component) {
  59423. if (typeof component === "string") {
  59424. component = this.getChild(component);
  59425. }
  59426. this.removeEventListenerForItem(component);
  59427. super.removeChild(component);
  59428. }
  59429. addItem(component) {
  59430. const childComponent = this.addChild(component);
  59431. if (childComponent) {
  59432. this.addEventListenerForItem(childComponent);
  59433. }
  59434. }
  59435. createEl() {
  59436. const contentElType = this.options_.contentElType || "ul";
  59437. this.contentEl_ = createEl$1(contentElType, {
  59438. className: "vjs-menu-content"
  59439. });
  59440. this.contentEl_.setAttribute("role", "menu");
  59441. const el = super.createEl("div", {
  59442. append: this.contentEl_,
  59443. className: "vjs-menu"
  59444. });
  59445. el.appendChild(this.contentEl_);
  59446. on$1(el, "click", function(event2) {
  59447. event2.preventDefault();
  59448. event2.stopImmediatePropagation();
  59449. });
  59450. return el;
  59451. }
  59452. dispose() {
  59453. this.contentEl_ = null;
  59454. this.boundHandleBlur_ = null;
  59455. this.boundHandleTapClick_ = null;
  59456. super.dispose();
  59457. }
  59458. handleBlur(event2) {
  59459. const relatedTarget = event2.relatedTarget || document_1.activeElement;
  59460. if (!this.children().some((element) => {
  59461. return element.el() === relatedTarget;
  59462. })) {
  59463. const btn = this.menuButton_;
  59464. if (btn && btn.buttonPressed_ && relatedTarget !== btn.el().firstChild) {
  59465. btn.unpressButton();
  59466. }
  59467. }
  59468. }
  59469. handleTapClick(event2) {
  59470. if (this.menuButton_) {
  59471. this.menuButton_.unpressButton();
  59472. const childComponents = this.children();
  59473. if (!Array.isArray(childComponents)) {
  59474. return;
  59475. }
  59476. const foundComponent = childComponents.filter((component) => component.el() === event2.target)[0];
  59477. if (!foundComponent) {
  59478. return;
  59479. }
  59480. if (foundComponent.name() !== "CaptionSettingsMenuItem") {
  59481. this.menuButton_.focus();
  59482. }
  59483. }
  59484. }
  59485. handleKeyDown(event2) {
  59486. if (keycode.isEventKey(event2, "Left") || keycode.isEventKey(event2, "Down")) {
  59487. event2.preventDefault();
  59488. event2.stopPropagation();
  59489. this.stepForward();
  59490. } else if (keycode.isEventKey(event2, "Right") || keycode.isEventKey(event2, "Up")) {
  59491. event2.preventDefault();
  59492. event2.stopPropagation();
  59493. this.stepBack();
  59494. }
  59495. }
  59496. stepForward() {
  59497. let stepChild = 0;
  59498. if (this.focusedChild_ !== void 0) {
  59499. stepChild = this.focusedChild_ + 1;
  59500. }
  59501. this.focus(stepChild);
  59502. }
  59503. stepBack() {
  59504. let stepChild = 0;
  59505. if (this.focusedChild_ !== void 0) {
  59506. stepChild = this.focusedChild_ - 1;
  59507. }
  59508. this.focus(stepChild);
  59509. }
  59510. focus(item = 0) {
  59511. const children = this.children().slice();
  59512. const haveTitle = children.length && children[0].hasClass("vjs-menu-title");
  59513. if (haveTitle) {
  59514. children.shift();
  59515. }
  59516. if (children.length > 0) {
  59517. if (item < 0) {
  59518. item = 0;
  59519. } else if (item >= children.length) {
  59520. item = children.length - 1;
  59521. }
  59522. this.focusedChild_ = item;
  59523. children[item].el_.focus();
  59524. }
  59525. }
  59526. }
  59527. Component$1$1.registerComponent("Menu", Menu$1);
  59528. class MenuButton$1 extends Component$1$1 {
  59529. constructor(player, options2 = {}) {
  59530. super(player, options2);
  59531. this.menuButton_ = new Button$1(player, options2);
  59532. this.menuButton_.controlText(this.controlText_);
  59533. this.menuButton_.el_.setAttribute("aria-haspopup", "true");
  59534. const buttonClass = Button$1.prototype.buildCSSClass();
  59535. this.menuButton_.el_.className = this.buildCSSClass() + " " + buttonClass;
  59536. this.menuButton_.removeClass("vjs-control");
  59537. this.addChild(this.menuButton_);
  59538. this.update();
  59539. this.enabled_ = true;
  59540. const handleClick = (e) => this.handleClick(e);
  59541. this.handleMenuKeyUp_ = (e) => this.handleMenuKeyUp(e);
  59542. this.on(this.menuButton_, "tap", handleClick);
  59543. this.on(this.menuButton_, "click", handleClick);
  59544. this.on(this.menuButton_, "keydown", (e) => this.handleKeyDown(e));
  59545. this.on(this.menuButton_, "mouseenter", () => {
  59546. this.addClass("vjs-hover");
  59547. this.menu.show();
  59548. on$1(document_1, "keyup", this.handleMenuKeyUp_);
  59549. });
  59550. this.on("mouseleave", (e) => this.handleMouseLeave(e));
  59551. this.on("keydown", (e) => this.handleSubmenuKeyDown(e));
  59552. }
  59553. update() {
  59554. const menu = this.createMenu();
  59555. if (this.menu) {
  59556. this.menu.dispose();
  59557. this.removeChild(this.menu);
  59558. }
  59559. this.menu = menu;
  59560. this.addChild(menu);
  59561. this.buttonPressed_ = false;
  59562. this.menuButton_.el_.setAttribute("aria-expanded", "false");
  59563. if (this.items && this.items.length <= this.hideThreshold_) {
  59564. this.hide();
  59565. this.menu.contentEl_.removeAttribute("role");
  59566. } else {
  59567. this.show();
  59568. this.menu.contentEl_.setAttribute("role", "menu");
  59569. }
  59570. }
  59571. createMenu() {
  59572. const menu = new Menu$1(this.player_, {
  59573. menuButton: this
  59574. });
  59575. this.hideThreshold_ = 0;
  59576. if (this.options_.title) {
  59577. const titleEl = createEl$1("li", {
  59578. className: "vjs-menu-title",
  59579. textContent: toTitleCase$1$1(this.options_.title),
  59580. tabIndex: -1
  59581. });
  59582. const titleComponent = new Component$1$1(this.player_, {
  59583. el: titleEl
  59584. });
  59585. menu.addItem(titleComponent);
  59586. }
  59587. this.items = this.createItems();
  59588. if (this.items) {
  59589. for (let i2 = 0; i2 < this.items.length; i2++) {
  59590. menu.addItem(this.items[i2]);
  59591. }
  59592. }
  59593. return menu;
  59594. }
  59595. createItems() {
  59596. }
  59597. createEl() {
  59598. return super.createEl("div", {
  59599. className: this.buildWrapperCSSClass()
  59600. }, {});
  59601. }
  59602. buildWrapperCSSClass() {
  59603. let menuButtonClass = "vjs-menu-button";
  59604. if (this.options_.inline === true) {
  59605. menuButtonClass += "-inline";
  59606. } else {
  59607. menuButtonClass += "-popup";
  59608. }
  59609. const buttonClass = Button$1.prototype.buildCSSClass();
  59610. return `vjs-menu-button ${menuButtonClass} ${buttonClass} ${super.buildCSSClass()}`;
  59611. }
  59612. buildCSSClass() {
  59613. let menuButtonClass = "vjs-menu-button";
  59614. if (this.options_.inline === true) {
  59615. menuButtonClass += "-inline";
  59616. } else {
  59617. menuButtonClass += "-popup";
  59618. }
  59619. return `vjs-menu-button ${menuButtonClass} ${super.buildCSSClass()}`;
  59620. }
  59621. controlText(text, el = this.menuButton_.el()) {
  59622. return this.menuButton_.controlText(text, el);
  59623. }
  59624. dispose() {
  59625. this.handleMouseLeave();
  59626. super.dispose();
  59627. }
  59628. handleClick(event2) {
  59629. if (this.buttonPressed_) {
  59630. this.unpressButton();
  59631. } else {
  59632. this.pressButton();
  59633. }
  59634. }
  59635. handleMouseLeave(event2) {
  59636. this.removeClass("vjs-hover");
  59637. off$1(document_1, "keyup", this.handleMenuKeyUp_);
  59638. }
  59639. focus() {
  59640. this.menuButton_.focus();
  59641. }
  59642. blur() {
  59643. this.menuButton_.blur();
  59644. }
  59645. handleKeyDown(event2) {
  59646. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  59647. if (this.buttonPressed_) {
  59648. this.unpressButton();
  59649. }
  59650. if (!keycode.isEventKey(event2, "Tab")) {
  59651. event2.preventDefault();
  59652. this.menuButton_.focus();
  59653. }
  59654. } else if (keycode.isEventKey(event2, "Up") || keycode.isEventKey(event2, "Down")) {
  59655. if (!this.buttonPressed_) {
  59656. event2.preventDefault();
  59657. this.pressButton();
  59658. }
  59659. }
  59660. }
  59661. handleMenuKeyUp(event2) {
  59662. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  59663. this.removeClass("vjs-hover");
  59664. }
  59665. }
  59666. handleSubmenuKeyPress(event2) {
  59667. this.handleSubmenuKeyDown(event2);
  59668. }
  59669. handleSubmenuKeyDown(event2) {
  59670. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  59671. if (this.buttonPressed_) {
  59672. this.unpressButton();
  59673. }
  59674. if (!keycode.isEventKey(event2, "Tab")) {
  59675. event2.preventDefault();
  59676. this.menuButton_.focus();
  59677. }
  59678. }
  59679. }
  59680. pressButton() {
  59681. if (this.enabled_) {
  59682. this.buttonPressed_ = true;
  59683. this.menu.show();
  59684. this.menu.lockShowing();
  59685. this.menuButton_.el_.setAttribute("aria-expanded", "true");
  59686. if (IS_IOS$1 && isInFrame$1()) {
  59687. return;
  59688. }
  59689. this.menu.focus();
  59690. }
  59691. }
  59692. unpressButton() {
  59693. if (this.enabled_) {
  59694. this.buttonPressed_ = false;
  59695. this.menu.unlockShowing();
  59696. this.menu.hide();
  59697. this.menuButton_.el_.setAttribute("aria-expanded", "false");
  59698. }
  59699. }
  59700. disable() {
  59701. this.unpressButton();
  59702. this.enabled_ = false;
  59703. this.addClass("vjs-disabled");
  59704. this.menuButton_.disable();
  59705. }
  59706. enable() {
  59707. this.enabled_ = true;
  59708. this.removeClass("vjs-disabled");
  59709. this.menuButton_.enable();
  59710. }
  59711. }
  59712. Component$1$1.registerComponent("MenuButton", MenuButton$1);
  59713. class TrackButton$1 extends MenuButton$1 {
  59714. constructor(player, options2) {
  59715. const tracks = options2.tracks;
  59716. super(player, options2);
  59717. if (this.items.length <= 1) {
  59718. this.hide();
  59719. }
  59720. if (!tracks) {
  59721. return;
  59722. }
  59723. const updateHandler = bind_(this, this.update);
  59724. tracks.addEventListener("removetrack", updateHandler);
  59725. tracks.addEventListener("addtrack", updateHandler);
  59726. tracks.addEventListener("labelchange", updateHandler);
  59727. this.player_.on("ready", updateHandler);
  59728. this.player_.on("dispose", function() {
  59729. tracks.removeEventListener("removetrack", updateHandler);
  59730. tracks.removeEventListener("addtrack", updateHandler);
  59731. tracks.removeEventListener("labelchange", updateHandler);
  59732. });
  59733. }
  59734. }
  59735. Component$1$1.registerComponent("TrackButton", TrackButton$1);
  59736. const MenuKeys$1 = ["Tab", "Esc", "Up", "Down", "Right", "Left"];
  59737. class MenuItem$1 extends ClickableComponent$1 {
  59738. constructor(player, options2) {
  59739. super(player, options2);
  59740. this.selectable = options2.selectable;
  59741. this.isSelected_ = options2.selected || false;
  59742. this.multiSelectable = options2.multiSelectable;
  59743. this.selected(this.isSelected_);
  59744. if (this.selectable) {
  59745. if (this.multiSelectable) {
  59746. this.el_.setAttribute("role", "menuitemcheckbox");
  59747. } else {
  59748. this.el_.setAttribute("role", "menuitemradio");
  59749. }
  59750. } else {
  59751. this.el_.setAttribute("role", "menuitem");
  59752. }
  59753. }
  59754. createEl(type2, props, attrs) {
  59755. this.nonIconControl = true;
  59756. const el = super.createEl("li", Object.assign({
  59757. className: "vjs-menu-item",
  59758. tabIndex: -1
  59759. }, props), attrs);
  59760. el.replaceChild(createEl$1("span", {
  59761. className: "vjs-menu-item-text",
  59762. textContent: this.localize(this.options_.label)
  59763. }), el.querySelector(".vjs-icon-placeholder"));
  59764. return el;
  59765. }
  59766. handleKeyDown(event2) {
  59767. if (!MenuKeys$1.some((key) => keycode.isEventKey(event2, key))) {
  59768. super.handleKeyDown(event2);
  59769. }
  59770. }
  59771. handleClick(event2) {
  59772. this.selected(true);
  59773. }
  59774. selected(selected) {
  59775. if (this.selectable) {
  59776. if (selected) {
  59777. this.addClass("vjs-selected");
  59778. this.el_.setAttribute("aria-checked", "true");
  59779. this.controlText(", selected");
  59780. this.isSelected_ = true;
  59781. } else {
  59782. this.removeClass("vjs-selected");
  59783. this.el_.setAttribute("aria-checked", "false");
  59784. this.controlText("");
  59785. this.isSelected_ = false;
  59786. }
  59787. }
  59788. }
  59789. }
  59790. Component$1$1.registerComponent("MenuItem", MenuItem$1);
  59791. class TextTrackMenuItem$1 extends MenuItem$1 {
  59792. constructor(player, options2) {
  59793. const track = options2.track;
  59794. const tracks = player.textTracks();
  59795. options2.label = track.label || track.language || "Unknown";
  59796. options2.selected = track.mode === "showing";
  59797. super(player, options2);
  59798. this.track = track;
  59799. this.kinds = (options2.kinds || [options2.kind || this.track.kind]).filter(Boolean);
  59800. const changeHandler = (...args) => {
  59801. this.handleTracksChange.apply(this, args);
  59802. };
  59803. const selectedLanguageChangeHandler = (...args) => {
  59804. this.handleSelectedLanguageChange.apply(this, args);
  59805. };
  59806. player.on(["loadstart", "texttrackchange"], changeHandler);
  59807. tracks.addEventListener("change", changeHandler);
  59808. tracks.addEventListener("selectedlanguagechange", selectedLanguageChangeHandler);
  59809. this.on("dispose", function() {
  59810. player.off(["loadstart", "texttrackchange"], changeHandler);
  59811. tracks.removeEventListener("change", changeHandler);
  59812. tracks.removeEventListener("selectedlanguagechange", selectedLanguageChangeHandler);
  59813. });
  59814. if (tracks.onchange === void 0) {
  59815. let event2;
  59816. this.on(["tap", "click"], function() {
  59817. if (typeof window_1.Event !== "object") {
  59818. try {
  59819. event2 = new window_1.Event("change");
  59820. } catch (err) {
  59821. }
  59822. }
  59823. if (!event2) {
  59824. event2 = document_1.createEvent("Event");
  59825. event2.initEvent("change", true, true);
  59826. }
  59827. tracks.dispatchEvent(event2);
  59828. });
  59829. }
  59830. this.handleTracksChange();
  59831. }
  59832. handleClick(event2) {
  59833. const referenceTrack = this.track;
  59834. const tracks = this.player_.textTracks();
  59835. super.handleClick(event2);
  59836. if (!tracks) {
  59837. return;
  59838. }
  59839. for (let i2 = 0; i2 < tracks.length; i2++) {
  59840. const track = tracks[i2];
  59841. if (this.kinds.indexOf(track.kind) === -1) {
  59842. continue;
  59843. }
  59844. if (track === referenceTrack) {
  59845. if (track.mode !== "showing") {
  59846. track.mode = "showing";
  59847. }
  59848. } else if (track.mode !== "disabled") {
  59849. track.mode = "disabled";
  59850. }
  59851. }
  59852. }
  59853. handleTracksChange(event2) {
  59854. const shouldBeSelected = this.track.mode === "showing";
  59855. if (shouldBeSelected !== this.isSelected_) {
  59856. this.selected(shouldBeSelected);
  59857. }
  59858. }
  59859. handleSelectedLanguageChange(event2) {
  59860. if (this.track.mode === "showing") {
  59861. const selectedLanguage = this.player_.cache_.selectedLanguage;
  59862. if (selectedLanguage && selectedLanguage.enabled && selectedLanguage.language === this.track.language && selectedLanguage.kind !== this.track.kind) {
  59863. return;
  59864. }
  59865. this.player_.cache_.selectedLanguage = {
  59866. enabled: true,
  59867. language: this.track.language,
  59868. kind: this.track.kind
  59869. };
  59870. }
  59871. }
  59872. dispose() {
  59873. this.track = null;
  59874. super.dispose();
  59875. }
  59876. }
  59877. Component$1$1.registerComponent("TextTrackMenuItem", TextTrackMenuItem$1);
  59878. class OffTextTrackMenuItem$1 extends TextTrackMenuItem$1 {
  59879. constructor(player, options2) {
  59880. options2.track = {
  59881. player,
  59882. kind: options2.kind,
  59883. kinds: options2.kinds,
  59884. default: false,
  59885. mode: "disabled"
  59886. };
  59887. if (!options2.kinds) {
  59888. options2.kinds = [options2.kind];
  59889. }
  59890. if (options2.label) {
  59891. options2.track.label = options2.label;
  59892. } else {
  59893. options2.track.label = options2.kinds.join(" and ") + " off";
  59894. }
  59895. options2.selectable = true;
  59896. options2.multiSelectable = false;
  59897. super(player, options2);
  59898. }
  59899. handleTracksChange(event2) {
  59900. const tracks = this.player().textTracks();
  59901. let shouldBeSelected = true;
  59902. for (let i2 = 0, l = tracks.length; i2 < l; i2++) {
  59903. const track = tracks[i2];
  59904. if (this.options_.kinds.indexOf(track.kind) > -1 && track.mode === "showing") {
  59905. shouldBeSelected = false;
  59906. break;
  59907. }
  59908. }
  59909. if (shouldBeSelected !== this.isSelected_) {
  59910. this.selected(shouldBeSelected);
  59911. }
  59912. }
  59913. handleSelectedLanguageChange(event2) {
  59914. const tracks = this.player().textTracks();
  59915. let allHidden = true;
  59916. for (let i2 = 0, l = tracks.length; i2 < l; i2++) {
  59917. const track = tracks[i2];
  59918. if (["captions", "descriptions", "subtitles"].indexOf(track.kind) > -1 && track.mode === "showing") {
  59919. allHidden = false;
  59920. break;
  59921. }
  59922. }
  59923. if (allHidden) {
  59924. this.player_.cache_.selectedLanguage = {
  59925. enabled: false
  59926. };
  59927. }
  59928. }
  59929. handleLanguagechange() {
  59930. this.$(".vjs-menu-item-text").textContent = this.player_.localize(this.options_.label);
  59931. super.handleLanguagechange();
  59932. }
  59933. }
  59934. Component$1$1.registerComponent("OffTextTrackMenuItem", OffTextTrackMenuItem$1);
  59935. class TextTrackButton$1 extends TrackButton$1 {
  59936. constructor(player, options2 = {}) {
  59937. options2.tracks = player.textTracks();
  59938. super(player, options2);
  59939. }
  59940. createItems(items = [], TrackMenuItem = TextTrackMenuItem$1) {
  59941. let label;
  59942. if (this.label_) {
  59943. label = `${this.label_} off`;
  59944. }
  59945. items.push(new OffTextTrackMenuItem$1(this.player_, {
  59946. kinds: this.kinds_,
  59947. kind: this.kind_,
  59948. label
  59949. }));
  59950. this.hideThreshold_ += 1;
  59951. const tracks = this.player_.textTracks();
  59952. if (!Array.isArray(this.kinds_)) {
  59953. this.kinds_ = [this.kind_];
  59954. }
  59955. for (let i2 = 0; i2 < tracks.length; i2++) {
  59956. const track = tracks[i2];
  59957. if (this.kinds_.indexOf(track.kind) > -1) {
  59958. const item = new TrackMenuItem(this.player_, {
  59959. track,
  59960. kinds: this.kinds_,
  59961. kind: this.kind_,
  59962. selectable: true,
  59963. multiSelectable: false
  59964. });
  59965. item.addClass(`vjs-${track.kind}-menu-item`);
  59966. items.push(item);
  59967. }
  59968. }
  59969. return items;
  59970. }
  59971. }
  59972. Component$1$1.registerComponent("TextTrackButton", TextTrackButton$1);
  59973. class ChaptersTrackMenuItem$1 extends MenuItem$1 {
  59974. constructor(player, options2) {
  59975. const track = options2.track;
  59976. const cue = options2.cue;
  59977. const currentTime = player.currentTime();
  59978. options2.selectable = true;
  59979. options2.multiSelectable = false;
  59980. options2.label = cue.text;
  59981. options2.selected = cue.startTime <= currentTime && currentTime < cue.endTime;
  59982. super(player, options2);
  59983. this.track = track;
  59984. this.cue = cue;
  59985. }
  59986. handleClick(event2) {
  59987. super.handleClick();
  59988. this.player_.currentTime(this.cue.startTime);
  59989. }
  59990. }
  59991. Component$1$1.registerComponent("ChaptersTrackMenuItem", ChaptersTrackMenuItem$1);
  59992. class ChaptersButton$1 extends TextTrackButton$1 {
  59993. constructor(player, options2, ready) {
  59994. super(player, options2, ready);
  59995. this.selectCurrentItem_ = () => {
  59996. this.items.forEach((item) => {
  59997. item.selected(this.track_.activeCues[0] === item.cue);
  59998. });
  59999. };
  60000. }
  60001. buildCSSClass() {
  60002. return `vjs-chapters-button ${super.buildCSSClass()}`;
  60003. }
  60004. buildWrapperCSSClass() {
  60005. return `vjs-chapters-button ${super.buildWrapperCSSClass()}`;
  60006. }
  60007. update(event2) {
  60008. if (event2 && event2.track && event2.track.kind !== "chapters") {
  60009. return;
  60010. }
  60011. const track = this.findChaptersTrack();
  60012. if (track !== this.track_) {
  60013. this.setTrack(track);
  60014. super.update();
  60015. } else if (!this.items || track && track.cues && track.cues.length !== this.items.length) {
  60016. super.update();
  60017. }
  60018. }
  60019. setTrack(track) {
  60020. if (this.track_ === track) {
  60021. return;
  60022. }
  60023. if (!this.updateHandler_) {
  60024. this.updateHandler_ = this.update.bind(this);
  60025. }
  60026. if (this.track_) {
  60027. const remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  60028. if (remoteTextTrackEl) {
  60029. remoteTextTrackEl.removeEventListener("load", this.updateHandler_);
  60030. }
  60031. this.track_.removeEventListener("cuechange", this.selectCurrentItem_);
  60032. this.track_ = null;
  60033. }
  60034. this.track_ = track;
  60035. if (this.track_) {
  60036. this.track_.mode = "hidden";
  60037. const remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  60038. if (remoteTextTrackEl) {
  60039. remoteTextTrackEl.addEventListener("load", this.updateHandler_);
  60040. }
  60041. this.track_.addEventListener("cuechange", this.selectCurrentItem_);
  60042. }
  60043. }
  60044. findChaptersTrack() {
  60045. const tracks = this.player_.textTracks() || [];
  60046. for (let i2 = tracks.length - 1; i2 >= 0; i2--) {
  60047. const track = tracks[i2];
  60048. if (track.kind === this.kind_) {
  60049. return track;
  60050. }
  60051. }
  60052. }
  60053. getMenuCaption() {
  60054. if (this.track_ && this.track_.label) {
  60055. return this.track_.label;
  60056. }
  60057. return this.localize(toTitleCase$1$1(this.kind_));
  60058. }
  60059. createMenu() {
  60060. this.options_.title = this.getMenuCaption();
  60061. return super.createMenu();
  60062. }
  60063. createItems() {
  60064. const items = [];
  60065. if (!this.track_) {
  60066. return items;
  60067. }
  60068. const cues = this.track_.cues;
  60069. if (!cues) {
  60070. return items;
  60071. }
  60072. for (let i2 = 0, l = cues.length; i2 < l; i2++) {
  60073. const cue = cues[i2];
  60074. const mi = new ChaptersTrackMenuItem$1(this.player_, {
  60075. track: this.track_,
  60076. cue
  60077. });
  60078. items.push(mi);
  60079. }
  60080. return items;
  60081. }
  60082. }
  60083. ChaptersButton$1.prototype.kind_ = "chapters";
  60084. ChaptersButton$1.prototype.controlText_ = "Chapters";
  60085. Component$1$1.registerComponent("ChaptersButton", ChaptersButton$1);
  60086. class DescriptionsButton$1 extends TextTrackButton$1 {
  60087. constructor(player, options2, ready) {
  60088. super(player, options2, ready);
  60089. const tracks = player.textTracks();
  60090. const changeHandler = bind_(this, this.handleTracksChange);
  60091. tracks.addEventListener("change", changeHandler);
  60092. this.on("dispose", function() {
  60093. tracks.removeEventListener("change", changeHandler);
  60094. });
  60095. }
  60096. handleTracksChange(event2) {
  60097. const tracks = this.player().textTracks();
  60098. let disabled = false;
  60099. for (let i2 = 0, l = tracks.length; i2 < l; i2++) {
  60100. const track = tracks[i2];
  60101. if (track.kind !== this.kind_ && track.mode === "showing") {
  60102. disabled = true;
  60103. break;
  60104. }
  60105. }
  60106. if (disabled) {
  60107. this.disable();
  60108. } else {
  60109. this.enable();
  60110. }
  60111. }
  60112. buildCSSClass() {
  60113. return `vjs-descriptions-button ${super.buildCSSClass()}`;
  60114. }
  60115. buildWrapperCSSClass() {
  60116. return `vjs-descriptions-button ${super.buildWrapperCSSClass()}`;
  60117. }
  60118. }
  60119. DescriptionsButton$1.prototype.kind_ = "descriptions";
  60120. DescriptionsButton$1.prototype.controlText_ = "Descriptions";
  60121. Component$1$1.registerComponent("DescriptionsButton", DescriptionsButton$1);
  60122. class SubtitlesButton$1 extends TextTrackButton$1 {
  60123. constructor(player, options2, ready) {
  60124. super(player, options2, ready);
  60125. }
  60126. buildCSSClass() {
  60127. return `vjs-subtitles-button ${super.buildCSSClass()}`;
  60128. }
  60129. buildWrapperCSSClass() {
  60130. return `vjs-subtitles-button ${super.buildWrapperCSSClass()}`;
  60131. }
  60132. }
  60133. SubtitlesButton$1.prototype.kind_ = "subtitles";
  60134. SubtitlesButton$1.prototype.controlText_ = "Subtitles";
  60135. Component$1$1.registerComponent("SubtitlesButton", SubtitlesButton$1);
  60136. class CaptionSettingsMenuItem$1 extends TextTrackMenuItem$1 {
  60137. constructor(player, options2) {
  60138. options2.track = {
  60139. player,
  60140. kind: options2.kind,
  60141. label: options2.kind + " settings",
  60142. selectable: false,
  60143. default: false,
  60144. mode: "disabled"
  60145. };
  60146. options2.selectable = false;
  60147. options2.name = "CaptionSettingsMenuItem";
  60148. super(player, options2);
  60149. this.addClass("vjs-texttrack-settings");
  60150. this.controlText(", opens " + options2.kind + " settings dialog");
  60151. }
  60152. handleClick(event2) {
  60153. this.player().getChild("textTrackSettings").open();
  60154. }
  60155. handleLanguagechange() {
  60156. this.$(".vjs-menu-item-text").textContent = this.player_.localize(this.options_.kind + " settings");
  60157. super.handleLanguagechange();
  60158. }
  60159. }
  60160. Component$1$1.registerComponent("CaptionSettingsMenuItem", CaptionSettingsMenuItem$1);
  60161. class CaptionsButton$1 extends TextTrackButton$1 {
  60162. constructor(player, options2, ready) {
  60163. super(player, options2, ready);
  60164. }
  60165. buildCSSClass() {
  60166. return `vjs-captions-button ${super.buildCSSClass()}`;
  60167. }
  60168. buildWrapperCSSClass() {
  60169. return `vjs-captions-button ${super.buildWrapperCSSClass()}`;
  60170. }
  60171. createItems() {
  60172. const items = [];
  60173. if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild("textTrackSettings")) {
  60174. items.push(new CaptionSettingsMenuItem$1(this.player_, {
  60175. kind: this.kind_
  60176. }));
  60177. this.hideThreshold_ += 1;
  60178. }
  60179. return super.createItems(items);
  60180. }
  60181. }
  60182. CaptionsButton$1.prototype.kind_ = "captions";
  60183. CaptionsButton$1.prototype.controlText_ = "Captions";
  60184. Component$1$1.registerComponent("CaptionsButton", CaptionsButton$1);
  60185. class SubsCapsMenuItem$1 extends TextTrackMenuItem$1 {
  60186. createEl(type2, props, attrs) {
  60187. const el = super.createEl(type2, props, attrs);
  60188. const parentSpan = el.querySelector(".vjs-menu-item-text");
  60189. if (this.options_.track.kind === "captions") {
  60190. parentSpan.appendChild(createEl$1("span", {
  60191. className: "vjs-icon-placeholder"
  60192. }, {
  60193. "aria-hidden": true
  60194. }));
  60195. parentSpan.appendChild(createEl$1("span", {
  60196. className: "vjs-control-text",
  60197. textContent: ` ${this.localize("Captions")}`
  60198. }));
  60199. }
  60200. return el;
  60201. }
  60202. }
  60203. Component$1$1.registerComponent("SubsCapsMenuItem", SubsCapsMenuItem$1);
  60204. class SubsCapsButton$1 extends TextTrackButton$1 {
  60205. constructor(player, options2 = {}) {
  60206. super(player, options2);
  60207. this.label_ = "subtitles";
  60208. if (["en", "en-us", "en-ca", "fr-ca"].indexOf(this.player_.language_) > -1) {
  60209. this.label_ = "captions";
  60210. }
  60211. this.menuButton_.controlText(toTitleCase$1$1(this.label_));
  60212. }
  60213. buildCSSClass() {
  60214. return `vjs-subs-caps-button ${super.buildCSSClass()}`;
  60215. }
  60216. buildWrapperCSSClass() {
  60217. return `vjs-subs-caps-button ${super.buildWrapperCSSClass()}`;
  60218. }
  60219. createItems() {
  60220. let items = [];
  60221. if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild("textTrackSettings")) {
  60222. items.push(new CaptionSettingsMenuItem$1(this.player_, {
  60223. kind: this.label_
  60224. }));
  60225. this.hideThreshold_ += 1;
  60226. }
  60227. items = super.createItems(items, SubsCapsMenuItem$1);
  60228. return items;
  60229. }
  60230. }
  60231. SubsCapsButton$1.prototype.kinds_ = ["captions", "subtitles"];
  60232. SubsCapsButton$1.prototype.controlText_ = "Subtitles";
  60233. Component$1$1.registerComponent("SubsCapsButton", SubsCapsButton$1);
  60234. class AudioTrackMenuItem$1 extends MenuItem$1 {
  60235. constructor(player, options2) {
  60236. const track = options2.track;
  60237. const tracks = player.audioTracks();
  60238. options2.label = track.label || track.language || "Unknown";
  60239. options2.selected = track.enabled;
  60240. super(player, options2);
  60241. this.track = track;
  60242. this.addClass(`vjs-${track.kind}-menu-item`);
  60243. const changeHandler = (...args) => {
  60244. this.handleTracksChange.apply(this, args);
  60245. };
  60246. tracks.addEventListener("change", changeHandler);
  60247. this.on("dispose", () => {
  60248. tracks.removeEventListener("change", changeHandler);
  60249. });
  60250. }
  60251. createEl(type2, props, attrs) {
  60252. const el = super.createEl(type2, props, attrs);
  60253. const parentSpan = el.querySelector(".vjs-menu-item-text");
  60254. if (this.options_.track.kind === "main-desc") {
  60255. parentSpan.appendChild(createEl$1("span", {
  60256. className: "vjs-icon-placeholder"
  60257. }, {
  60258. "aria-hidden": true
  60259. }));
  60260. parentSpan.appendChild(createEl$1("span", {
  60261. className: "vjs-control-text",
  60262. textContent: " " + this.localize("Descriptions")
  60263. }));
  60264. }
  60265. return el;
  60266. }
  60267. handleClick(event2) {
  60268. super.handleClick(event2);
  60269. this.track.enabled = true;
  60270. if (this.player_.tech_.featuresNativeAudioTracks) {
  60271. const tracks = this.player_.audioTracks();
  60272. for (let i2 = 0; i2 < tracks.length; i2++) {
  60273. const track = tracks[i2];
  60274. if (track === this.track) {
  60275. continue;
  60276. }
  60277. track.enabled = track === this.track;
  60278. }
  60279. }
  60280. }
  60281. handleTracksChange(event2) {
  60282. this.selected(this.track.enabled);
  60283. }
  60284. }
  60285. Component$1$1.registerComponent("AudioTrackMenuItem", AudioTrackMenuItem$1);
  60286. class AudioTrackButton$1 extends TrackButton$1 {
  60287. constructor(player, options2 = {}) {
  60288. options2.tracks = player.audioTracks();
  60289. super(player, options2);
  60290. }
  60291. buildCSSClass() {
  60292. return `vjs-audio-button ${super.buildCSSClass()}`;
  60293. }
  60294. buildWrapperCSSClass() {
  60295. return `vjs-audio-button ${super.buildWrapperCSSClass()}`;
  60296. }
  60297. createItems(items = []) {
  60298. this.hideThreshold_ = 1;
  60299. const tracks = this.player_.audioTracks();
  60300. for (let i2 = 0; i2 < tracks.length; i2++) {
  60301. const track = tracks[i2];
  60302. items.push(new AudioTrackMenuItem$1(this.player_, {
  60303. track,
  60304. selectable: true,
  60305. multiSelectable: false
  60306. }));
  60307. }
  60308. return items;
  60309. }
  60310. }
  60311. AudioTrackButton$1.prototype.controlText_ = "Audio Track";
  60312. Component$1$1.registerComponent("AudioTrackButton", AudioTrackButton$1);
  60313. class PlaybackRateMenuItem$1 extends MenuItem$1 {
  60314. constructor(player, options2) {
  60315. const label = options2.rate;
  60316. const rate = parseFloat(label, 10);
  60317. options2.label = label;
  60318. options2.selected = rate === player.playbackRate();
  60319. options2.selectable = true;
  60320. options2.multiSelectable = false;
  60321. super(player, options2);
  60322. this.label = label;
  60323. this.rate = rate;
  60324. this.on(player, "ratechange", (e) => this.update(e));
  60325. }
  60326. handleClick(event2) {
  60327. super.handleClick();
  60328. this.player().playbackRate(this.rate);
  60329. }
  60330. update(event2) {
  60331. this.selected(this.player().playbackRate() === this.rate);
  60332. }
  60333. }
  60334. PlaybackRateMenuItem$1.prototype.contentElType = "button";
  60335. Component$1$1.registerComponent("PlaybackRateMenuItem", PlaybackRateMenuItem$1);
  60336. class PlaybackRateMenuButton$1 extends MenuButton$1 {
  60337. constructor(player, options2) {
  60338. super(player, options2);
  60339. this.menuButton_.el_.setAttribute("aria-describedby", this.labelElId_);
  60340. this.updateVisibility();
  60341. this.updateLabel();
  60342. this.on(player, "loadstart", (e) => this.updateVisibility(e));
  60343. this.on(player, "ratechange", (e) => this.updateLabel(e));
  60344. this.on(player, "playbackrateschange", (e) => this.handlePlaybackRateschange(e));
  60345. }
  60346. createEl() {
  60347. const el = super.createEl();
  60348. this.labelElId_ = "vjs-playback-rate-value-label-" + this.id_;
  60349. this.labelEl_ = createEl$1("div", {
  60350. className: "vjs-playback-rate-value",
  60351. id: this.labelElId_,
  60352. textContent: "1x"
  60353. });
  60354. el.appendChild(this.labelEl_);
  60355. return el;
  60356. }
  60357. dispose() {
  60358. this.labelEl_ = null;
  60359. super.dispose();
  60360. }
  60361. buildCSSClass() {
  60362. return `vjs-playback-rate ${super.buildCSSClass()}`;
  60363. }
  60364. buildWrapperCSSClass() {
  60365. return `vjs-playback-rate ${super.buildWrapperCSSClass()}`;
  60366. }
  60367. createItems() {
  60368. const rates = this.playbackRates();
  60369. const items = [];
  60370. for (let i2 = rates.length - 1; i2 >= 0; i2--) {
  60371. items.push(new PlaybackRateMenuItem$1(this.player(), {
  60372. rate: rates[i2] + "x"
  60373. }));
  60374. }
  60375. return items;
  60376. }
  60377. handlePlaybackRateschange(event2) {
  60378. this.update();
  60379. }
  60380. playbackRates() {
  60381. const player = this.player();
  60382. return player.playbackRates && player.playbackRates() || [];
  60383. }
  60384. playbackRateSupported() {
  60385. return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this.playbackRates().length > 0;
  60386. }
  60387. updateVisibility(event2) {
  60388. if (this.playbackRateSupported()) {
  60389. this.removeClass("vjs-hidden");
  60390. } else {
  60391. this.addClass("vjs-hidden");
  60392. }
  60393. }
  60394. updateLabel(event2) {
  60395. if (this.playbackRateSupported()) {
  60396. this.labelEl_.textContent = this.player().playbackRate() + "x";
  60397. }
  60398. }
  60399. }
  60400. PlaybackRateMenuButton$1.prototype.controlText_ = "Playback Rate";
  60401. Component$1$1.registerComponent("PlaybackRateMenuButton", PlaybackRateMenuButton$1);
  60402. class Spacer$1 extends Component$1$1 {
  60403. buildCSSClass() {
  60404. return `vjs-spacer ${super.buildCSSClass()}`;
  60405. }
  60406. createEl(tag = "div", props = {}, attributes = {}) {
  60407. if (!props.className) {
  60408. props.className = this.buildCSSClass();
  60409. }
  60410. return super.createEl(tag, props, attributes);
  60411. }
  60412. }
  60413. Component$1$1.registerComponent("Spacer", Spacer$1);
  60414. class CustomControlSpacer$1 extends Spacer$1 {
  60415. buildCSSClass() {
  60416. return `vjs-custom-control-spacer ${super.buildCSSClass()}`;
  60417. }
  60418. createEl() {
  60419. return super.createEl("div", {
  60420. className: this.buildCSSClass(),
  60421. textContent: "\xA0"
  60422. });
  60423. }
  60424. }
  60425. Component$1$1.registerComponent("CustomControlSpacer", CustomControlSpacer$1);
  60426. class ControlBar$1 extends Component$1$1 {
  60427. createEl() {
  60428. return super.createEl("div", {
  60429. className: "vjs-control-bar",
  60430. dir: "ltr"
  60431. });
  60432. }
  60433. }
  60434. ControlBar$1.prototype.options_ = {
  60435. children: ["playToggle", "skipBackward", "skipForward", "volumePanel", "currentTimeDisplay", "timeDivider", "durationDisplay", "progressControl", "liveDisplay", "seekToLive", "remainingTimeDisplay", "customControlSpacer", "playbackRateMenuButton", "chaptersButton", "descriptionsButton", "subsCapsButton", "audioTrackButton", "fullscreenToggle"]
  60436. };
  60437. if ("exitPictureInPicture" in document_1) {
  60438. ControlBar$1.prototype.options_.children.splice(ControlBar$1.prototype.options_.children.length - 1, 0, "pictureInPictureToggle");
  60439. }
  60440. Component$1$1.registerComponent("ControlBar", ControlBar$1);
  60441. class ErrorDisplay$1 extends ModalDialog$1 {
  60442. constructor(player, options2) {
  60443. super(player, options2);
  60444. this.on(player, "error", (e) => this.open(e));
  60445. }
  60446. buildCSSClass() {
  60447. return `vjs-error-display ${super.buildCSSClass()}`;
  60448. }
  60449. content() {
  60450. const error = this.player().error();
  60451. return error ? this.localize(error.message) : "";
  60452. }
  60453. }
  60454. ErrorDisplay$1.prototype.options_ = Object.assign({}, ModalDialog$1.prototype.options_, {
  60455. pauseOnOpen: false,
  60456. fillAlways: true,
  60457. temporary: false,
  60458. uncloseable: true
  60459. });
  60460. Component$1$1.registerComponent("ErrorDisplay", ErrorDisplay$1);
  60461. const LOCAL_STORAGE_KEY$1$1 = "vjs-text-track-settings";
  60462. const COLOR_BLACK$1 = ["#000", "Black"];
  60463. const COLOR_BLUE$1 = ["#00F", "Blue"];
  60464. const COLOR_CYAN$1 = ["#0FF", "Cyan"];
  60465. const COLOR_GREEN$1 = ["#0F0", "Green"];
  60466. const COLOR_MAGENTA$1 = ["#F0F", "Magenta"];
  60467. const COLOR_RED$1 = ["#F00", "Red"];
  60468. const COLOR_WHITE$1 = ["#FFF", "White"];
  60469. const COLOR_YELLOW$1 = ["#FF0", "Yellow"];
  60470. const OPACITY_OPAQUE$1 = ["1", "Opaque"];
  60471. const OPACITY_SEMI$1 = ["0.5", "Semi-Transparent"];
  60472. const OPACITY_TRANS$1 = ["0", "Transparent"];
  60473. const selectConfigs$1 = {
  60474. backgroundColor: {
  60475. selector: ".vjs-bg-color > select",
  60476. id: "captions-background-color-%s",
  60477. label: "Color",
  60478. options: [COLOR_BLACK$1, COLOR_WHITE$1, COLOR_RED$1, COLOR_GREEN$1, COLOR_BLUE$1, COLOR_YELLOW$1, COLOR_MAGENTA$1, COLOR_CYAN$1]
  60479. },
  60480. backgroundOpacity: {
  60481. selector: ".vjs-bg-opacity > select",
  60482. id: "captions-background-opacity-%s",
  60483. label: "Opacity",
  60484. options: [OPACITY_OPAQUE$1, OPACITY_SEMI$1, OPACITY_TRANS$1]
  60485. },
  60486. color: {
  60487. selector: ".vjs-text-color > select",
  60488. id: "captions-foreground-color-%s",
  60489. label: "Color",
  60490. options: [COLOR_WHITE$1, COLOR_BLACK$1, COLOR_RED$1, COLOR_GREEN$1, COLOR_BLUE$1, COLOR_YELLOW$1, COLOR_MAGENTA$1, COLOR_CYAN$1]
  60491. },
  60492. edgeStyle: {
  60493. selector: ".vjs-edge-style > select",
  60494. id: "%s",
  60495. label: "Text Edge Style",
  60496. options: [["none", "None"], ["raised", "Raised"], ["depressed", "Depressed"], ["uniform", "Uniform"], ["dropshadow", "Dropshadow"]]
  60497. },
  60498. fontFamily: {
  60499. selector: ".vjs-font-family > select",
  60500. id: "captions-font-family-%s",
  60501. label: "Font Family",
  60502. options: [["proportionalSansSerif", "Proportional Sans-Serif"], ["monospaceSansSerif", "Monospace Sans-Serif"], ["proportionalSerif", "Proportional Serif"], ["monospaceSerif", "Monospace Serif"], ["casual", "Casual"], ["script", "Script"], ["small-caps", "Small Caps"]]
  60503. },
  60504. fontPercent: {
  60505. selector: ".vjs-font-percent > select",
  60506. id: "captions-font-size-%s",
  60507. label: "Font Size",
  60508. options: [["0.50", "50%"], ["0.75", "75%"], ["1.00", "100%"], ["1.25", "125%"], ["1.50", "150%"], ["1.75", "175%"], ["2.00", "200%"], ["3.00", "300%"], ["4.00", "400%"]],
  60509. default: 2,
  60510. parser: (v) => v === "1.00" ? null : Number(v)
  60511. },
  60512. textOpacity: {
  60513. selector: ".vjs-text-opacity > select",
  60514. id: "captions-foreground-opacity-%s",
  60515. label: "Opacity",
  60516. options: [OPACITY_OPAQUE$1, OPACITY_SEMI$1]
  60517. },
  60518. windowColor: {
  60519. selector: ".vjs-window-color > select",
  60520. id: "captions-window-color-%s",
  60521. label: "Color"
  60522. },
  60523. windowOpacity: {
  60524. selector: ".vjs-window-opacity > select",
  60525. id: "captions-window-opacity-%s",
  60526. label: "Opacity",
  60527. options: [OPACITY_TRANS$1, OPACITY_SEMI$1, OPACITY_OPAQUE$1]
  60528. }
  60529. };
  60530. selectConfigs$1.windowColor.options = selectConfigs$1.backgroundColor.options;
  60531. function parseOptionValue$1(value, parser2) {
  60532. if (parser2) {
  60533. value = parser2(value);
  60534. }
  60535. if (value && value !== "none") {
  60536. return value;
  60537. }
  60538. }
  60539. function getSelectedOptionValue$1(el, parser2) {
  60540. const value = el.options[el.options.selectedIndex].value;
  60541. return parseOptionValue$1(value, parser2);
  60542. }
  60543. function setSelectedOption$1(el, value, parser2) {
  60544. if (!value) {
  60545. return;
  60546. }
  60547. for (let i2 = 0; i2 < el.options.length; i2++) {
  60548. if (parseOptionValue$1(el.options[i2].value, parser2) === value) {
  60549. el.selectedIndex = i2;
  60550. break;
  60551. }
  60552. }
  60553. }
  60554. class TextTrackSettings$1 extends ModalDialog$1 {
  60555. constructor(player, options2) {
  60556. options2.temporary = false;
  60557. super(player, options2);
  60558. this.updateDisplay = this.updateDisplay.bind(this);
  60559. this.fill();
  60560. this.hasBeenOpened_ = this.hasBeenFilled_ = true;
  60561. this.endDialog = createEl$1("p", {
  60562. className: "vjs-control-text",
  60563. textContent: this.localize("End of dialog window.")
  60564. });
  60565. this.el().appendChild(this.endDialog);
  60566. this.setDefaults();
  60567. if (options2.persistTextTrackSettings === void 0) {
  60568. this.options_.persistTextTrackSettings = this.options_.playerOptions.persistTextTrackSettings;
  60569. }
  60570. this.on(this.$(".vjs-done-button"), "click", () => {
  60571. this.saveSettings();
  60572. this.close();
  60573. });
  60574. this.on(this.$(".vjs-default-button"), "click", () => {
  60575. this.setDefaults();
  60576. this.updateDisplay();
  60577. });
  60578. each$1(selectConfigs$1, (config) => {
  60579. this.on(this.$(config.selector), "change", this.updateDisplay);
  60580. });
  60581. if (this.options_.persistTextTrackSettings) {
  60582. this.restoreSettings();
  60583. }
  60584. }
  60585. dispose() {
  60586. this.endDialog = null;
  60587. super.dispose();
  60588. }
  60589. createElSelect_(key, legendId = "", type2 = "label") {
  60590. const config = selectConfigs$1[key];
  60591. const id = config.id.replace("%s", this.id_);
  60592. const selectLabelledbyIds = [legendId, id].join(" ").trim();
  60593. return [`<${type2} id="${id}" class="${type2 === "label" ? "vjs-label" : ""}">`, this.localize(config.label), `</${type2}>`, `<select aria-labelledby="${selectLabelledbyIds}">`].concat(config.options.map((o) => {
  60594. const optionId = id + "-" + o[1].replace(/\W+/g, "");
  60595. return [`<option id="${optionId}" value="${o[0]}" `, `aria-labelledby="${selectLabelledbyIds} ${optionId}">`, this.localize(o[1]), "</option>"].join("");
  60596. })).concat("</select>").join("");
  60597. }
  60598. createElFgColor_() {
  60599. const legendId = `captions-text-legend-${this.id_}`;
  60600. return ['<fieldset class="vjs-fg vjs-track-setting">', `<legend id="${legendId}">`, this.localize("Text"), "</legend>", '<span class="vjs-text-color">', this.createElSelect_("color", legendId), "</span>", '<span class="vjs-text-opacity vjs-opacity">', this.createElSelect_("textOpacity", legendId), "</span>", "</fieldset>"].join("");
  60601. }
  60602. createElBgColor_() {
  60603. const legendId = `captions-background-${this.id_}`;
  60604. return ['<fieldset class="vjs-bg vjs-track-setting">', `<legend id="${legendId}">`, this.localize("Text Background"), "</legend>", '<span class="vjs-bg-color">', this.createElSelect_("backgroundColor", legendId), "</span>", '<span class="vjs-bg-opacity vjs-opacity">', this.createElSelect_("backgroundOpacity", legendId), "</span>", "</fieldset>"].join("");
  60605. }
  60606. createElWinColor_() {
  60607. const legendId = `captions-window-${this.id_}`;
  60608. return ['<fieldset class="vjs-window vjs-track-setting">', `<legend id="${legendId}">`, this.localize("Caption Area Background"), "</legend>", '<span class="vjs-window-color">', this.createElSelect_("windowColor", legendId), "</span>", '<span class="vjs-window-opacity vjs-opacity">', this.createElSelect_("windowOpacity", legendId), "</span>", "</fieldset>"].join("");
  60609. }
  60610. createElColors_() {
  60611. return createEl$1("div", {
  60612. className: "vjs-track-settings-colors",
  60613. innerHTML: [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()].join("")
  60614. });
  60615. }
  60616. createElFont_() {
  60617. return createEl$1("div", {
  60618. className: "vjs-track-settings-font",
  60619. innerHTML: ['<fieldset class="vjs-font-percent vjs-track-setting">', this.createElSelect_("fontPercent", "", "legend"), "</fieldset>", '<fieldset class="vjs-edge-style vjs-track-setting">', this.createElSelect_("edgeStyle", "", "legend"), "</fieldset>", '<fieldset class="vjs-font-family vjs-track-setting">', this.createElSelect_("fontFamily", "", "legend"), "</fieldset>"].join("")
  60620. });
  60621. }
  60622. createElControls_() {
  60623. const defaultsDescription = this.localize("restore all settings to the default values");
  60624. return createEl$1("div", {
  60625. className: "vjs-track-settings-controls",
  60626. innerHTML: [`<button type="button" class="vjs-default-button" title="${defaultsDescription}">`, this.localize("Reset"), `<span class="vjs-control-text"> ${defaultsDescription}</span>`, "</button>", `<button type="button" class="vjs-done-button">${this.localize("Done")}</button>`].join("")
  60627. });
  60628. }
  60629. content() {
  60630. return [this.createElColors_(), this.createElFont_(), this.createElControls_()];
  60631. }
  60632. label() {
  60633. return this.localize("Caption Settings Dialog");
  60634. }
  60635. description() {
  60636. return this.localize("Beginning of dialog window. Escape will cancel and close the window.");
  60637. }
  60638. buildCSSClass() {
  60639. return super.buildCSSClass() + " vjs-text-track-settings";
  60640. }
  60641. getValues() {
  60642. return reduce$1(selectConfigs$1, (accum, config, key) => {
  60643. const value = getSelectedOptionValue$1(this.$(config.selector), config.parser);
  60644. if (value !== void 0) {
  60645. accum[key] = value;
  60646. }
  60647. return accum;
  60648. }, {});
  60649. }
  60650. setValues(values3) {
  60651. each$1(selectConfigs$1, (config, key) => {
  60652. setSelectedOption$1(this.$(config.selector), values3[key], config.parser);
  60653. });
  60654. }
  60655. setDefaults() {
  60656. each$1(selectConfigs$1, (config) => {
  60657. const index2 = config.hasOwnProperty("default") ? config.default : 0;
  60658. this.$(config.selector).selectedIndex = index2;
  60659. });
  60660. }
  60661. restoreSettings() {
  60662. let values3;
  60663. try {
  60664. values3 = JSON.parse(window_1.localStorage.getItem(LOCAL_STORAGE_KEY$1$1));
  60665. } catch (err) {
  60666. log$1$1.warn(err);
  60667. }
  60668. if (values3) {
  60669. this.setValues(values3);
  60670. }
  60671. }
  60672. saveSettings() {
  60673. if (!this.options_.persistTextTrackSettings) {
  60674. return;
  60675. }
  60676. const values3 = this.getValues();
  60677. try {
  60678. if (Object.keys(values3).length) {
  60679. window_1.localStorage.setItem(LOCAL_STORAGE_KEY$1$1, JSON.stringify(values3));
  60680. } else {
  60681. window_1.localStorage.removeItem(LOCAL_STORAGE_KEY$1$1);
  60682. }
  60683. } catch (err) {
  60684. log$1$1.warn(err);
  60685. }
  60686. }
  60687. updateDisplay() {
  60688. const ttDisplay = this.player_.getChild("textTrackDisplay");
  60689. if (ttDisplay) {
  60690. ttDisplay.updateDisplay();
  60691. }
  60692. }
  60693. conditionalBlur_() {
  60694. this.previouslyActiveEl_ = null;
  60695. const cb = this.player_.controlBar;
  60696. const subsCapsBtn = cb && cb.subsCapsButton;
  60697. const ccBtn = cb && cb.captionsButton;
  60698. if (subsCapsBtn) {
  60699. subsCapsBtn.focus();
  60700. } else if (ccBtn) {
  60701. ccBtn.focus();
  60702. }
  60703. }
  60704. handleLanguagechange() {
  60705. this.fill();
  60706. }
  60707. }
  60708. Component$1$1.registerComponent("TextTrackSettings", TextTrackSettings$1);
  60709. class ResizeManager$1 extends Component$1$1 {
  60710. constructor(player, options2) {
  60711. let RESIZE_OBSERVER_AVAILABLE = options2.ResizeObserver || window_1.ResizeObserver;
  60712. if (options2.ResizeObserver === null) {
  60713. RESIZE_OBSERVER_AVAILABLE = false;
  60714. }
  60715. const options_ = merge$1({
  60716. createEl: !RESIZE_OBSERVER_AVAILABLE,
  60717. reportTouchActivity: false
  60718. }, options2);
  60719. super(player, options_);
  60720. this.ResizeObserver = options2.ResizeObserver || window_1.ResizeObserver;
  60721. this.loadListener_ = null;
  60722. this.resizeObserver_ = null;
  60723. this.debouncedHandler_ = debounce$1(() => {
  60724. this.resizeHandler();
  60725. }, 100, false, this);
  60726. if (RESIZE_OBSERVER_AVAILABLE) {
  60727. this.resizeObserver_ = new this.ResizeObserver(this.debouncedHandler_);
  60728. this.resizeObserver_.observe(player.el());
  60729. } else {
  60730. this.loadListener_ = () => {
  60731. if (!this.el_ || !this.el_.contentWindow) {
  60732. return;
  60733. }
  60734. const debouncedHandler_ = this.debouncedHandler_;
  60735. let unloadListener_ = this.unloadListener_ = function() {
  60736. off$1(this, "resize", debouncedHandler_);
  60737. off$1(this, "unload", unloadListener_);
  60738. unloadListener_ = null;
  60739. };
  60740. on$1(this.el_.contentWindow, "unload", unloadListener_);
  60741. on$1(this.el_.contentWindow, "resize", debouncedHandler_);
  60742. };
  60743. this.one("load", this.loadListener_);
  60744. }
  60745. }
  60746. createEl() {
  60747. return super.createEl("iframe", {
  60748. className: "vjs-resize-manager",
  60749. tabIndex: -1,
  60750. title: this.localize("No content")
  60751. }, {
  60752. "aria-hidden": "true"
  60753. });
  60754. }
  60755. resizeHandler() {
  60756. if (!this.player_ || !this.player_.trigger) {
  60757. return;
  60758. }
  60759. this.player_.trigger("playerresize");
  60760. }
  60761. dispose() {
  60762. if (this.debouncedHandler_) {
  60763. this.debouncedHandler_.cancel();
  60764. }
  60765. if (this.resizeObserver_) {
  60766. if (this.player_.el()) {
  60767. this.resizeObserver_.unobserve(this.player_.el());
  60768. }
  60769. this.resizeObserver_.disconnect();
  60770. }
  60771. if (this.loadListener_) {
  60772. this.off("load", this.loadListener_);
  60773. }
  60774. if (this.el_ && this.el_.contentWindow && this.unloadListener_) {
  60775. this.unloadListener_.call(this.el_.contentWindow);
  60776. }
  60777. this.ResizeObserver = null;
  60778. this.resizeObserver = null;
  60779. this.debouncedHandler_ = null;
  60780. this.loadListener_ = null;
  60781. super.dispose();
  60782. }
  60783. }
  60784. Component$1$1.registerComponent("ResizeManager", ResizeManager$1);
  60785. const defaults$2 = {
  60786. trackingThreshold: 20,
  60787. liveTolerance: 15
  60788. };
  60789. class LiveTracker$1 extends Component$1$1 {
  60790. constructor(player, options2) {
  60791. const options_ = merge$1(defaults$2, options2, {
  60792. createEl: false
  60793. });
  60794. super(player, options_);
  60795. this.trackLiveHandler_ = () => this.trackLive_();
  60796. this.handlePlay_ = (e) => this.handlePlay(e);
  60797. this.handleFirstTimeupdate_ = (e) => this.handleFirstTimeupdate(e);
  60798. this.handleSeeked_ = (e) => this.handleSeeked(e);
  60799. this.seekToLiveEdge_ = (e) => this.seekToLiveEdge(e);
  60800. this.reset_();
  60801. this.on(this.player_, "durationchange", (e) => this.handleDurationchange(e));
  60802. this.on(this.player_, "canplay", () => this.toggleTracking());
  60803. }
  60804. trackLive_() {
  60805. const seekable3 = this.player_.seekable();
  60806. if (!seekable3 || !seekable3.length) {
  60807. return;
  60808. }
  60809. const newTime = Number(window_1.performance.now().toFixed(4));
  60810. const deltaTime = this.lastTime_ === -1 ? 0 : (newTime - this.lastTime_) / 1e3;
  60811. this.lastTime_ = newTime;
  60812. this.pastSeekEnd_ = this.pastSeekEnd() + deltaTime;
  60813. const liveCurrentTime = this.liveCurrentTime();
  60814. const currentTime = this.player_.currentTime();
  60815. let isBehind = this.player_.paused() || this.seekedBehindLive_ || Math.abs(liveCurrentTime - currentTime) > this.options_.liveTolerance;
  60816. if (!this.timeupdateSeen_ || liveCurrentTime === Infinity) {
  60817. isBehind = false;
  60818. }
  60819. if (isBehind !== this.behindLiveEdge_) {
  60820. this.behindLiveEdge_ = isBehind;
  60821. this.trigger("liveedgechange");
  60822. }
  60823. }
  60824. handleDurationchange() {
  60825. this.toggleTracking();
  60826. }
  60827. toggleTracking() {
  60828. if (this.player_.duration() === Infinity && this.liveWindow() >= this.options_.trackingThreshold) {
  60829. if (this.player_.options_.liveui) {
  60830. this.player_.addClass("vjs-liveui");
  60831. }
  60832. this.startTracking();
  60833. } else {
  60834. this.player_.removeClass("vjs-liveui");
  60835. this.stopTracking();
  60836. }
  60837. }
  60838. startTracking() {
  60839. if (this.isTracking()) {
  60840. return;
  60841. }
  60842. if (!this.timeupdateSeen_) {
  60843. this.timeupdateSeen_ = this.player_.hasStarted();
  60844. }
  60845. this.trackingInterval_ = this.setInterval(this.trackLiveHandler_, UPDATE_REFRESH_INTERVAL$1);
  60846. this.trackLive_();
  60847. this.on(this.player_, ["play", "pause"], this.trackLiveHandler_);
  60848. if (!this.timeupdateSeen_) {
  60849. this.one(this.player_, "play", this.handlePlay_);
  60850. this.one(this.player_, "timeupdate", this.handleFirstTimeupdate_);
  60851. } else {
  60852. this.on(this.player_, "seeked", this.handleSeeked_);
  60853. }
  60854. }
  60855. handleFirstTimeupdate() {
  60856. this.timeupdateSeen_ = true;
  60857. this.on(this.player_, "seeked", this.handleSeeked_);
  60858. }
  60859. handleSeeked() {
  60860. const timeDiff = Math.abs(this.liveCurrentTime() - this.player_.currentTime());
  60861. this.seekedBehindLive_ = this.nextSeekedFromUser_ && timeDiff > 2;
  60862. this.nextSeekedFromUser_ = false;
  60863. this.trackLive_();
  60864. }
  60865. handlePlay() {
  60866. this.one(this.player_, "timeupdate", this.seekToLiveEdge_);
  60867. }
  60868. reset_() {
  60869. this.lastTime_ = -1;
  60870. this.pastSeekEnd_ = 0;
  60871. this.lastSeekEnd_ = -1;
  60872. this.behindLiveEdge_ = true;
  60873. this.timeupdateSeen_ = false;
  60874. this.seekedBehindLive_ = false;
  60875. this.nextSeekedFromUser_ = false;
  60876. this.clearInterval(this.trackingInterval_);
  60877. this.trackingInterval_ = null;
  60878. this.off(this.player_, ["play", "pause"], this.trackLiveHandler_);
  60879. this.off(this.player_, "seeked", this.handleSeeked_);
  60880. this.off(this.player_, "play", this.handlePlay_);
  60881. this.off(this.player_, "timeupdate", this.handleFirstTimeupdate_);
  60882. this.off(this.player_, "timeupdate", this.seekToLiveEdge_);
  60883. }
  60884. nextSeekedFromUser() {
  60885. this.nextSeekedFromUser_ = true;
  60886. }
  60887. stopTracking() {
  60888. if (!this.isTracking()) {
  60889. return;
  60890. }
  60891. this.reset_();
  60892. this.trigger("liveedgechange");
  60893. }
  60894. seekableEnd() {
  60895. const seekable3 = this.player_.seekable();
  60896. const seekableEnds = [];
  60897. let i2 = seekable3 ? seekable3.length : 0;
  60898. while (i2--) {
  60899. seekableEnds.push(seekable3.end(i2));
  60900. }
  60901. return seekableEnds.length ? seekableEnds.sort()[seekableEnds.length - 1] : Infinity;
  60902. }
  60903. seekableStart() {
  60904. const seekable3 = this.player_.seekable();
  60905. const seekableStarts = [];
  60906. let i2 = seekable3 ? seekable3.length : 0;
  60907. while (i2--) {
  60908. seekableStarts.push(seekable3.start(i2));
  60909. }
  60910. return seekableStarts.length ? seekableStarts.sort()[0] : 0;
  60911. }
  60912. liveWindow() {
  60913. const liveCurrentTime = this.liveCurrentTime();
  60914. if (liveCurrentTime === Infinity) {
  60915. return 0;
  60916. }
  60917. return liveCurrentTime - this.seekableStart();
  60918. }
  60919. isLive() {
  60920. return this.isTracking();
  60921. }
  60922. atLiveEdge() {
  60923. return !this.behindLiveEdge();
  60924. }
  60925. liveCurrentTime() {
  60926. return this.pastSeekEnd() + this.seekableEnd();
  60927. }
  60928. pastSeekEnd() {
  60929. const seekableEnd = this.seekableEnd();
  60930. if (this.lastSeekEnd_ !== -1 && seekableEnd !== this.lastSeekEnd_) {
  60931. this.pastSeekEnd_ = 0;
  60932. }
  60933. this.lastSeekEnd_ = seekableEnd;
  60934. return this.pastSeekEnd_;
  60935. }
  60936. behindLiveEdge() {
  60937. return this.behindLiveEdge_;
  60938. }
  60939. isTracking() {
  60940. return typeof this.trackingInterval_ === "number";
  60941. }
  60942. seekToLiveEdge() {
  60943. this.seekedBehindLive_ = false;
  60944. if (this.atLiveEdge()) {
  60945. return;
  60946. }
  60947. this.nextSeekedFromUser_ = false;
  60948. this.player_.currentTime(this.liveCurrentTime());
  60949. }
  60950. dispose() {
  60951. this.stopTracking();
  60952. super.dispose();
  60953. }
  60954. }
  60955. Component$1$1.registerComponent("LiveTracker", LiveTracker$1);
  60956. class TitleBar extends Component$1$1 {
  60957. constructor(player, options2) {
  60958. super(player, options2);
  60959. this.on("statechanged", (e) => this.updateDom_());
  60960. this.updateDom_();
  60961. }
  60962. createEl() {
  60963. this.els = {
  60964. title: createEl$1("div", {
  60965. className: "vjs-title-bar-title",
  60966. id: `vjs-title-bar-title-${newGUID$1()}`
  60967. }),
  60968. description: createEl$1("div", {
  60969. className: "vjs-title-bar-description",
  60970. id: `vjs-title-bar-description-${newGUID$1()}`
  60971. })
  60972. };
  60973. return createEl$1("div", {
  60974. className: "vjs-title-bar"
  60975. }, {}, Object.values(this.els));
  60976. }
  60977. updateDom_() {
  60978. const tech = this.player_.tech_;
  60979. const techEl = tech && tech.el_;
  60980. const techAriaAttrs = {
  60981. title: "aria-labelledby",
  60982. description: "aria-describedby"
  60983. };
  60984. ["title", "description"].forEach((k) => {
  60985. const value = this.state[k];
  60986. const el = this.els[k];
  60987. const techAriaAttr = techAriaAttrs[k];
  60988. emptyEl$1(el);
  60989. if (value) {
  60990. textContent$1(el, value);
  60991. }
  60992. if (techEl) {
  60993. techEl.removeAttribute(techAriaAttr);
  60994. if (value) {
  60995. techEl.setAttribute(techAriaAttr, el.id);
  60996. }
  60997. }
  60998. });
  60999. if (this.state.title || this.state.description) {
  61000. this.show();
  61001. } else {
  61002. this.hide();
  61003. }
  61004. }
  61005. update(options2) {
  61006. this.setState(options2);
  61007. }
  61008. dispose() {
  61009. const tech = this.player_.tech_;
  61010. const techEl = tech && tech.el_;
  61011. if (techEl) {
  61012. techEl.removeAttribute("aria-labelledby");
  61013. techEl.removeAttribute("aria-describedby");
  61014. }
  61015. super.dispose();
  61016. this.els = null;
  61017. }
  61018. }
  61019. Component$1$1.registerComponent("TitleBar", TitleBar);
  61020. const sourcesetLoad$1 = (tech) => {
  61021. const el = tech.el();
  61022. if (el.hasAttribute("src")) {
  61023. tech.triggerSourceset(el.src);
  61024. return true;
  61025. }
  61026. const sources = tech.$$("source");
  61027. const srcUrls = [];
  61028. let src = "";
  61029. if (!sources.length) {
  61030. return false;
  61031. }
  61032. for (let i2 = 0; i2 < sources.length; i2++) {
  61033. const url = sources[i2].src;
  61034. if (url && srcUrls.indexOf(url) === -1) {
  61035. srcUrls.push(url);
  61036. }
  61037. }
  61038. if (!srcUrls.length) {
  61039. return false;
  61040. }
  61041. if (srcUrls.length === 1) {
  61042. src = srcUrls[0];
  61043. }
  61044. tech.triggerSourceset(src);
  61045. return true;
  61046. };
  61047. const innerHTMLDescriptorPolyfill$1 = Object.defineProperty({}, "innerHTML", {
  61048. get() {
  61049. return this.cloneNode(true).innerHTML;
  61050. },
  61051. set(v) {
  61052. const dummy = document_1.createElement(this.nodeName.toLowerCase());
  61053. dummy.innerHTML = v;
  61054. const docFrag = document_1.createDocumentFragment();
  61055. while (dummy.childNodes.length) {
  61056. docFrag.appendChild(dummy.childNodes[0]);
  61057. }
  61058. this.innerText = "";
  61059. window_1.Element.prototype.appendChild.call(this, docFrag);
  61060. return this.innerHTML;
  61061. }
  61062. });
  61063. const getDescriptor$1 = (priority, prop) => {
  61064. let descriptor = {};
  61065. for (let i2 = 0; i2 < priority.length; i2++) {
  61066. descriptor = Object.getOwnPropertyDescriptor(priority[i2], prop);
  61067. if (descriptor && descriptor.set && descriptor.get) {
  61068. break;
  61069. }
  61070. }
  61071. descriptor.enumerable = true;
  61072. descriptor.configurable = true;
  61073. return descriptor;
  61074. };
  61075. const getInnerHTMLDescriptor$1 = (tech) => getDescriptor$1([tech.el(), window_1.HTMLMediaElement.prototype, window_1.Element.prototype, innerHTMLDescriptorPolyfill$1], "innerHTML");
  61076. const firstSourceWatch$1 = function(tech) {
  61077. const el = tech.el();
  61078. if (el.resetSourceWatch_) {
  61079. return;
  61080. }
  61081. const old = {};
  61082. const innerDescriptor = getInnerHTMLDescriptor$1(tech);
  61083. const appendWrapper = (appendFn) => (...args) => {
  61084. const retval = appendFn.apply(el, args);
  61085. sourcesetLoad$1(tech);
  61086. return retval;
  61087. };
  61088. ["append", "appendChild", "insertAdjacentHTML"].forEach((k) => {
  61089. if (!el[k]) {
  61090. return;
  61091. }
  61092. old[k] = el[k];
  61093. el[k] = appendWrapper(old[k]);
  61094. });
  61095. Object.defineProperty(el, "innerHTML", merge$1(innerDescriptor, {
  61096. set: appendWrapper(innerDescriptor.set)
  61097. }));
  61098. el.resetSourceWatch_ = () => {
  61099. el.resetSourceWatch_ = null;
  61100. Object.keys(old).forEach((k) => {
  61101. el[k] = old[k];
  61102. });
  61103. Object.defineProperty(el, "innerHTML", innerDescriptor);
  61104. };
  61105. tech.one("sourceset", el.resetSourceWatch_);
  61106. };
  61107. const srcDescriptorPolyfill$1 = Object.defineProperty({}, "src", {
  61108. get() {
  61109. if (this.hasAttribute("src")) {
  61110. return getAbsoluteURL$1(window_1.Element.prototype.getAttribute.call(this, "src"));
  61111. }
  61112. return "";
  61113. },
  61114. set(v) {
  61115. window_1.Element.prototype.setAttribute.call(this, "src", v);
  61116. return v;
  61117. }
  61118. });
  61119. const getSrcDescriptor$1 = (tech) => getDescriptor$1([tech.el(), window_1.HTMLMediaElement.prototype, srcDescriptorPolyfill$1], "src");
  61120. const setupSourceset$1 = function(tech) {
  61121. if (!tech.featuresSourceset) {
  61122. return;
  61123. }
  61124. const el = tech.el();
  61125. if (el.resetSourceset_) {
  61126. return;
  61127. }
  61128. const srcDescriptor = getSrcDescriptor$1(tech);
  61129. const oldSetAttribute = el.setAttribute;
  61130. const oldLoad = el.load;
  61131. Object.defineProperty(el, "src", merge$1(srcDescriptor, {
  61132. set: (v) => {
  61133. const retval = srcDescriptor.set.call(el, v);
  61134. tech.triggerSourceset(el.src);
  61135. return retval;
  61136. }
  61137. }));
  61138. el.setAttribute = (n, v) => {
  61139. const retval = oldSetAttribute.call(el, n, v);
  61140. if (/src/i.test(n)) {
  61141. tech.triggerSourceset(el.src);
  61142. }
  61143. return retval;
  61144. };
  61145. el.load = () => {
  61146. const retval = oldLoad.call(el);
  61147. if (!sourcesetLoad$1(tech)) {
  61148. tech.triggerSourceset("");
  61149. firstSourceWatch$1(tech);
  61150. }
  61151. return retval;
  61152. };
  61153. if (el.currentSrc) {
  61154. tech.triggerSourceset(el.currentSrc);
  61155. } else if (!sourcesetLoad$1(tech)) {
  61156. firstSourceWatch$1(tech);
  61157. }
  61158. el.resetSourceset_ = () => {
  61159. el.resetSourceset_ = null;
  61160. el.load = oldLoad;
  61161. el.setAttribute = oldSetAttribute;
  61162. Object.defineProperty(el, "src", srcDescriptor);
  61163. if (el.resetSourceWatch_) {
  61164. el.resetSourceWatch_();
  61165. }
  61166. };
  61167. };
  61168. class Html5$2 extends Tech$2 {
  61169. constructor(options2, ready) {
  61170. super(options2, ready);
  61171. const source = options2.source;
  61172. let crossoriginTracks = false;
  61173. this.featuresVideoFrameCallback = this.featuresVideoFrameCallback && this.el_.tagName === "VIDEO";
  61174. if (source && (this.el_.currentSrc !== source.src || options2.tag && options2.tag.initNetworkState_ === 3)) {
  61175. this.setSource(source);
  61176. } else {
  61177. this.handleLateInit_(this.el_);
  61178. }
  61179. if (options2.enableSourceset) {
  61180. this.setupSourcesetHandling_();
  61181. }
  61182. this.isScrubbing_ = false;
  61183. if (this.el_.hasChildNodes()) {
  61184. const nodes = this.el_.childNodes;
  61185. let nodesLength = nodes.length;
  61186. const removeNodes = [];
  61187. while (nodesLength--) {
  61188. const node = nodes[nodesLength];
  61189. const nodeName = node.nodeName.toLowerCase();
  61190. if (nodeName === "track") {
  61191. if (!this.featuresNativeTextTracks) {
  61192. removeNodes.push(node);
  61193. } else {
  61194. this.remoteTextTrackEls().addTrackElement_(node);
  61195. this.remoteTextTracks().addTrack(node.track);
  61196. this.textTracks().addTrack(node.track);
  61197. if (!crossoriginTracks && !this.el_.hasAttribute("crossorigin") && isCrossOrigin$1(node.src)) {
  61198. crossoriginTracks = true;
  61199. }
  61200. }
  61201. }
  61202. }
  61203. for (let i2 = 0; i2 < removeNodes.length; i2++) {
  61204. this.el_.removeChild(removeNodes[i2]);
  61205. }
  61206. }
  61207. this.proxyNativeTracks_();
  61208. if (this.featuresNativeTextTracks && crossoriginTracks) {
  61209. log$1$1.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading.");
  61210. }
  61211. this.restoreMetadataTracksInIOSNativePlayer_();
  61212. if ((TOUCH_ENABLED$1 || IS_IPHONE$1) && options2.nativeControlsForTouch === true) {
  61213. this.setControls(true);
  61214. }
  61215. this.proxyWebkitFullscreen_();
  61216. this.triggerReady();
  61217. }
  61218. dispose() {
  61219. if (this.el_ && this.el_.resetSourceset_) {
  61220. this.el_.resetSourceset_();
  61221. }
  61222. Html5$2.disposeMediaElement(this.el_);
  61223. this.options_ = null;
  61224. super.dispose();
  61225. }
  61226. setupSourcesetHandling_() {
  61227. setupSourceset$1(this);
  61228. }
  61229. restoreMetadataTracksInIOSNativePlayer_() {
  61230. const textTracks = this.textTracks();
  61231. let metadataTracksPreFullscreenState;
  61232. const takeMetadataTrackSnapshot = () => {
  61233. metadataTracksPreFullscreenState = [];
  61234. for (let i2 = 0; i2 < textTracks.length; i2++) {
  61235. const track = textTracks[i2];
  61236. if (track.kind === "metadata") {
  61237. metadataTracksPreFullscreenState.push({
  61238. track,
  61239. storedMode: track.mode
  61240. });
  61241. }
  61242. }
  61243. };
  61244. takeMetadataTrackSnapshot();
  61245. textTracks.addEventListener("change", takeMetadataTrackSnapshot);
  61246. this.on("dispose", () => textTracks.removeEventListener("change", takeMetadataTrackSnapshot));
  61247. const restoreTrackMode = () => {
  61248. for (let i2 = 0; i2 < metadataTracksPreFullscreenState.length; i2++) {
  61249. const storedTrack = metadataTracksPreFullscreenState[i2];
  61250. if (storedTrack.track.mode === "disabled" && storedTrack.track.mode !== storedTrack.storedMode) {
  61251. storedTrack.track.mode = storedTrack.storedMode;
  61252. }
  61253. }
  61254. textTracks.removeEventListener("change", restoreTrackMode);
  61255. };
  61256. this.on("webkitbeginfullscreen", () => {
  61257. textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  61258. textTracks.removeEventListener("change", restoreTrackMode);
  61259. textTracks.addEventListener("change", restoreTrackMode);
  61260. });
  61261. this.on("webkitendfullscreen", () => {
  61262. textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  61263. textTracks.addEventListener("change", takeMetadataTrackSnapshot);
  61264. textTracks.removeEventListener("change", restoreTrackMode);
  61265. });
  61266. }
  61267. overrideNative_(type2, override) {
  61268. if (override !== this[`featuresNative${type2}Tracks`]) {
  61269. return;
  61270. }
  61271. const lowerCaseType = type2.toLowerCase();
  61272. if (this[`${lowerCaseType}TracksListeners_`]) {
  61273. Object.keys(this[`${lowerCaseType}TracksListeners_`]).forEach((eventName) => {
  61274. const elTracks = this.el()[`${lowerCaseType}Tracks`];
  61275. elTracks.removeEventListener(eventName, this[`${lowerCaseType}TracksListeners_`][eventName]);
  61276. });
  61277. }
  61278. this[`featuresNative${type2}Tracks`] = !override;
  61279. this[`${lowerCaseType}TracksListeners_`] = null;
  61280. this.proxyNativeTracksForType_(lowerCaseType);
  61281. }
  61282. overrideNativeAudioTracks(override) {
  61283. this.overrideNative_("Audio", override);
  61284. }
  61285. overrideNativeVideoTracks(override) {
  61286. this.overrideNative_("Video", override);
  61287. }
  61288. proxyNativeTracksForType_(name) {
  61289. const props = NORMAL$1[name];
  61290. const elTracks = this.el()[props.getterName];
  61291. const techTracks = this[props.getterName]();
  61292. if (!this[`featuresNative${props.capitalName}Tracks`] || !elTracks || !elTracks.addEventListener) {
  61293. return;
  61294. }
  61295. const listeners = {
  61296. change: (e) => {
  61297. const event2 = {
  61298. type: "change",
  61299. target: techTracks,
  61300. currentTarget: techTracks,
  61301. srcElement: techTracks
  61302. };
  61303. techTracks.trigger(event2);
  61304. if (name === "text") {
  61305. this[REMOTE$1.remoteText.getterName]().trigger(event2);
  61306. }
  61307. },
  61308. addtrack(e) {
  61309. techTracks.addTrack(e.track);
  61310. },
  61311. removetrack(e) {
  61312. techTracks.removeTrack(e.track);
  61313. }
  61314. };
  61315. const removeOldTracks = function() {
  61316. const removeTracks = [];
  61317. for (let i2 = 0; i2 < techTracks.length; i2++) {
  61318. let found = false;
  61319. for (let j = 0; j < elTracks.length; j++) {
  61320. if (elTracks[j] === techTracks[i2]) {
  61321. found = true;
  61322. break;
  61323. }
  61324. }
  61325. if (!found) {
  61326. removeTracks.push(techTracks[i2]);
  61327. }
  61328. }
  61329. while (removeTracks.length) {
  61330. techTracks.removeTrack(removeTracks.shift());
  61331. }
  61332. };
  61333. this[props.getterName + "Listeners_"] = listeners;
  61334. Object.keys(listeners).forEach((eventName) => {
  61335. const listener = listeners[eventName];
  61336. elTracks.addEventListener(eventName, listener);
  61337. this.on("dispose", (e) => elTracks.removeEventListener(eventName, listener));
  61338. });
  61339. this.on("loadstart", removeOldTracks);
  61340. this.on("dispose", (e) => this.off("loadstart", removeOldTracks));
  61341. }
  61342. proxyNativeTracks_() {
  61343. NORMAL$1.names.forEach((name) => {
  61344. this.proxyNativeTracksForType_(name);
  61345. });
  61346. }
  61347. createEl() {
  61348. let el = this.options_.tag;
  61349. if (!el || !(this.options_.playerElIngest || this.movingMediaElementInDOM)) {
  61350. if (el) {
  61351. const clone = el.cloneNode(true);
  61352. if (el.parentNode) {
  61353. el.parentNode.insertBefore(clone, el);
  61354. }
  61355. Html5$2.disposeMediaElement(el);
  61356. el = clone;
  61357. } else {
  61358. el = document_1.createElement("video");
  61359. const tagAttributes = this.options_.tag && getAttributes$1(this.options_.tag);
  61360. const attributes = merge$1({}, tagAttributes);
  61361. if (!TOUCH_ENABLED$1 || this.options_.nativeControlsForTouch !== true) {
  61362. delete attributes.controls;
  61363. }
  61364. setAttributes$1(el, Object.assign(attributes, {
  61365. id: this.options_.techId,
  61366. class: "vjs-tech"
  61367. }));
  61368. }
  61369. el.playerId = this.options_.playerId;
  61370. }
  61371. if (typeof this.options_.preload !== "undefined") {
  61372. setAttribute$1(el, "preload", this.options_.preload);
  61373. }
  61374. if (this.options_.disablePictureInPicture !== void 0) {
  61375. el.disablePictureInPicture = this.options_.disablePictureInPicture;
  61376. }
  61377. const settingsAttrs = ["loop", "muted", "playsinline", "autoplay"];
  61378. for (let i2 = 0; i2 < settingsAttrs.length; i2++) {
  61379. const attr = settingsAttrs[i2];
  61380. const value = this.options_[attr];
  61381. if (typeof value !== "undefined") {
  61382. if (value) {
  61383. setAttribute$1(el, attr, attr);
  61384. } else {
  61385. removeAttribute$1(el, attr);
  61386. }
  61387. el[attr] = value;
  61388. }
  61389. }
  61390. return el;
  61391. }
  61392. handleLateInit_(el) {
  61393. if (el.networkState === 0 || el.networkState === 3) {
  61394. return;
  61395. }
  61396. if (el.readyState === 0) {
  61397. let loadstartFired = false;
  61398. const setLoadstartFired = function() {
  61399. loadstartFired = true;
  61400. };
  61401. this.on("loadstart", setLoadstartFired);
  61402. const triggerLoadstart = function() {
  61403. if (!loadstartFired) {
  61404. this.trigger("loadstart");
  61405. }
  61406. };
  61407. this.on("loadedmetadata", triggerLoadstart);
  61408. this.ready(function() {
  61409. this.off("loadstart", setLoadstartFired);
  61410. this.off("loadedmetadata", triggerLoadstart);
  61411. if (!loadstartFired) {
  61412. this.trigger("loadstart");
  61413. }
  61414. });
  61415. return;
  61416. }
  61417. const eventsToTrigger = ["loadstart"];
  61418. eventsToTrigger.push("loadedmetadata");
  61419. if (el.readyState >= 2) {
  61420. eventsToTrigger.push("loadeddata");
  61421. }
  61422. if (el.readyState >= 3) {
  61423. eventsToTrigger.push("canplay");
  61424. }
  61425. if (el.readyState >= 4) {
  61426. eventsToTrigger.push("canplaythrough");
  61427. }
  61428. this.ready(function() {
  61429. eventsToTrigger.forEach(function(type2) {
  61430. this.trigger(type2);
  61431. }, this);
  61432. });
  61433. }
  61434. setScrubbing(isScrubbing) {
  61435. this.isScrubbing_ = isScrubbing;
  61436. }
  61437. scrubbing() {
  61438. return this.isScrubbing_;
  61439. }
  61440. setCurrentTime(seconds) {
  61441. try {
  61442. if (this.isScrubbing_ && this.el_.fastSeek && IS_ANY_SAFARI$1) {
  61443. this.el_.fastSeek(seconds);
  61444. } else {
  61445. this.el_.currentTime = seconds;
  61446. }
  61447. } catch (e) {
  61448. log$1$1(e, "Video is not ready. (Video.js)");
  61449. }
  61450. }
  61451. duration() {
  61452. if (this.el_.duration === Infinity && IS_ANDROID$1 && IS_CHROME$1 && this.el_.currentTime === 0) {
  61453. const checkProgress = () => {
  61454. if (this.el_.currentTime > 0) {
  61455. if (this.el_.duration === Infinity) {
  61456. this.trigger("durationchange");
  61457. }
  61458. this.off("timeupdate", checkProgress);
  61459. }
  61460. };
  61461. this.on("timeupdate", checkProgress);
  61462. return NaN;
  61463. }
  61464. return this.el_.duration || NaN;
  61465. }
  61466. width() {
  61467. return this.el_.offsetWidth;
  61468. }
  61469. height() {
  61470. return this.el_.offsetHeight;
  61471. }
  61472. proxyWebkitFullscreen_() {
  61473. if (!("webkitDisplayingFullscreen" in this.el_)) {
  61474. return;
  61475. }
  61476. const endFn = function() {
  61477. this.trigger("fullscreenchange", {
  61478. isFullscreen: false
  61479. });
  61480. if (this.el_.controls && !this.options_.nativeControlsForTouch && this.controls()) {
  61481. this.el_.controls = false;
  61482. }
  61483. };
  61484. const beginFn = function() {
  61485. if ("webkitPresentationMode" in this.el_ && this.el_.webkitPresentationMode !== "picture-in-picture") {
  61486. this.one("webkitendfullscreen", endFn);
  61487. this.trigger("fullscreenchange", {
  61488. isFullscreen: true,
  61489. nativeIOSFullscreen: true
  61490. });
  61491. }
  61492. };
  61493. this.on("webkitbeginfullscreen", beginFn);
  61494. this.on("dispose", () => {
  61495. this.off("webkitbeginfullscreen", beginFn);
  61496. this.off("webkitendfullscreen", endFn);
  61497. });
  61498. }
  61499. supportsFullScreen() {
  61500. return typeof this.el_.webkitEnterFullScreen === "function";
  61501. }
  61502. enterFullScreen() {
  61503. const video = this.el_;
  61504. if (video.paused && video.networkState <= video.HAVE_METADATA) {
  61505. silencePromise$1(this.el_.play());
  61506. this.setTimeout(function() {
  61507. video.pause();
  61508. try {
  61509. video.webkitEnterFullScreen();
  61510. } catch (e) {
  61511. this.trigger("fullscreenerror", e);
  61512. }
  61513. }, 0);
  61514. } else {
  61515. try {
  61516. video.webkitEnterFullScreen();
  61517. } catch (e) {
  61518. this.trigger("fullscreenerror", e);
  61519. }
  61520. }
  61521. }
  61522. exitFullScreen() {
  61523. if (!this.el_.webkitDisplayingFullscreen) {
  61524. this.trigger("fullscreenerror", new Error("The video is not fullscreen"));
  61525. return;
  61526. }
  61527. this.el_.webkitExitFullScreen();
  61528. }
  61529. requestPictureInPicture() {
  61530. return this.el_.requestPictureInPicture();
  61531. }
  61532. requestVideoFrameCallback(cb) {
  61533. if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {
  61534. return this.el_.requestVideoFrameCallback(cb);
  61535. }
  61536. return super.requestVideoFrameCallback(cb);
  61537. }
  61538. cancelVideoFrameCallback(id) {
  61539. if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {
  61540. this.el_.cancelVideoFrameCallback(id);
  61541. } else {
  61542. super.cancelVideoFrameCallback(id);
  61543. }
  61544. }
  61545. src(src) {
  61546. if (src === void 0) {
  61547. return this.el_.src;
  61548. }
  61549. this.setSrc(src);
  61550. }
  61551. reset() {
  61552. Html5$2.resetMediaElement(this.el_);
  61553. }
  61554. currentSrc() {
  61555. if (this.currentSource_) {
  61556. return this.currentSource_.src;
  61557. }
  61558. return this.el_.currentSrc;
  61559. }
  61560. setControls(val) {
  61561. this.el_.controls = !!val;
  61562. }
  61563. addTextTrack(kind, label, language) {
  61564. if (!this.featuresNativeTextTracks) {
  61565. return super.addTextTrack(kind, label, language);
  61566. }
  61567. return this.el_.addTextTrack(kind, label, language);
  61568. }
  61569. createRemoteTextTrack(options2) {
  61570. if (!this.featuresNativeTextTracks) {
  61571. return super.createRemoteTextTrack(options2);
  61572. }
  61573. const htmlTrackElement = document_1.createElement("track");
  61574. if (options2.kind) {
  61575. htmlTrackElement.kind = options2.kind;
  61576. }
  61577. if (options2.label) {
  61578. htmlTrackElement.label = options2.label;
  61579. }
  61580. if (options2.language || options2.srclang) {
  61581. htmlTrackElement.srclang = options2.language || options2.srclang;
  61582. }
  61583. if (options2.default) {
  61584. htmlTrackElement.default = options2.default;
  61585. }
  61586. if (options2.id) {
  61587. htmlTrackElement.id = options2.id;
  61588. }
  61589. if (options2.src) {
  61590. htmlTrackElement.src = options2.src;
  61591. }
  61592. return htmlTrackElement;
  61593. }
  61594. addRemoteTextTrack(options2, manualCleanup) {
  61595. const htmlTrackElement = super.addRemoteTextTrack(options2, manualCleanup);
  61596. if (this.featuresNativeTextTracks) {
  61597. this.el().appendChild(htmlTrackElement);
  61598. }
  61599. return htmlTrackElement;
  61600. }
  61601. removeRemoteTextTrack(track) {
  61602. super.removeRemoteTextTrack(track);
  61603. if (this.featuresNativeTextTracks) {
  61604. const tracks = this.$$("track");
  61605. let i2 = tracks.length;
  61606. while (i2--) {
  61607. if (track === tracks[i2] || track === tracks[i2].track) {
  61608. this.el().removeChild(tracks[i2]);
  61609. }
  61610. }
  61611. }
  61612. }
  61613. getVideoPlaybackQuality() {
  61614. if (typeof this.el().getVideoPlaybackQuality === "function") {
  61615. return this.el().getVideoPlaybackQuality();
  61616. }
  61617. const videoPlaybackQuality = {};
  61618. if (typeof this.el().webkitDroppedFrameCount !== "undefined" && typeof this.el().webkitDecodedFrameCount !== "undefined") {
  61619. videoPlaybackQuality.droppedVideoFrames = this.el().webkitDroppedFrameCount;
  61620. videoPlaybackQuality.totalVideoFrames = this.el().webkitDecodedFrameCount;
  61621. }
  61622. if (window_1.performance) {
  61623. videoPlaybackQuality.creationTime = window_1.performance.now();
  61624. }
  61625. return videoPlaybackQuality;
  61626. }
  61627. }
  61628. defineLazyProperty$1(Html5$2, "TEST_VID", function() {
  61629. if (!isReal$1()) {
  61630. return;
  61631. }
  61632. const video = document_1.createElement("video");
  61633. const track = document_1.createElement("track");
  61634. track.kind = "captions";
  61635. track.srclang = "en";
  61636. track.label = "English";
  61637. video.appendChild(track);
  61638. return video;
  61639. });
  61640. Html5$2.isSupported = function() {
  61641. try {
  61642. Html5$2.TEST_VID.volume = 0.5;
  61643. } catch (e) {
  61644. return false;
  61645. }
  61646. return !!(Html5$2.TEST_VID && Html5$2.TEST_VID.canPlayType);
  61647. };
  61648. Html5$2.canPlayType = function(type2) {
  61649. return Html5$2.TEST_VID.canPlayType(type2);
  61650. };
  61651. Html5$2.canPlaySource = function(srcObj, options2) {
  61652. return Html5$2.canPlayType(srcObj.type);
  61653. };
  61654. Html5$2.canControlVolume = function() {
  61655. try {
  61656. const volume = Html5$2.TEST_VID.volume;
  61657. Html5$2.TEST_VID.volume = volume / 2 + 0.1;
  61658. const canControl = volume !== Html5$2.TEST_VID.volume;
  61659. if (canControl && IS_IOS$1) {
  61660. window_1.setTimeout(() => {
  61661. if (Html5$2 && Html5$2.prototype) {
  61662. Html5$2.prototype.featuresVolumeControl = volume !== Html5$2.TEST_VID.volume;
  61663. }
  61664. });
  61665. return false;
  61666. }
  61667. return canControl;
  61668. } catch (e) {
  61669. return false;
  61670. }
  61671. };
  61672. Html5$2.canMuteVolume = function() {
  61673. try {
  61674. const muted = Html5$2.TEST_VID.muted;
  61675. Html5$2.TEST_VID.muted = !muted;
  61676. if (Html5$2.TEST_VID.muted) {
  61677. setAttribute$1(Html5$2.TEST_VID, "muted", "muted");
  61678. } else {
  61679. removeAttribute$1(Html5$2.TEST_VID, "muted", "muted");
  61680. }
  61681. return muted !== Html5$2.TEST_VID.muted;
  61682. } catch (e) {
  61683. return false;
  61684. }
  61685. };
  61686. Html5$2.canControlPlaybackRate = function() {
  61687. if (IS_ANDROID$1 && IS_CHROME$1 && CHROME_VERSION$1 < 58) {
  61688. return false;
  61689. }
  61690. try {
  61691. const playbackRate = Html5$2.TEST_VID.playbackRate;
  61692. Html5$2.TEST_VID.playbackRate = playbackRate / 2 + 0.1;
  61693. return playbackRate !== Html5$2.TEST_VID.playbackRate;
  61694. } catch (e) {
  61695. return false;
  61696. }
  61697. };
  61698. Html5$2.canOverrideAttributes = function() {
  61699. try {
  61700. const noop2 = () => {
  61701. };
  61702. Object.defineProperty(document_1.createElement("video"), "src", {
  61703. get: noop2,
  61704. set: noop2
  61705. });
  61706. Object.defineProperty(document_1.createElement("audio"), "src", {
  61707. get: noop2,
  61708. set: noop2
  61709. });
  61710. Object.defineProperty(document_1.createElement("video"), "innerHTML", {
  61711. get: noop2,
  61712. set: noop2
  61713. });
  61714. Object.defineProperty(document_1.createElement("audio"), "innerHTML", {
  61715. get: noop2,
  61716. set: noop2
  61717. });
  61718. } catch (e) {
  61719. return false;
  61720. }
  61721. return true;
  61722. };
  61723. Html5$2.supportsNativeTextTracks = function() {
  61724. return IS_ANY_SAFARI$1 || IS_IOS$1 && IS_CHROME$1;
  61725. };
  61726. Html5$2.supportsNativeVideoTracks = function() {
  61727. return !!(Html5$2.TEST_VID && Html5$2.TEST_VID.videoTracks);
  61728. };
  61729. Html5$2.supportsNativeAudioTracks = function() {
  61730. return !!(Html5$2.TEST_VID && Html5$2.TEST_VID.audioTracks);
  61731. };
  61732. Html5$2.Events = ["loadstart", "suspend", "abort", "error", "emptied", "stalled", "loadedmetadata", "loadeddata", "canplay", "canplaythrough", "playing", "waiting", "seeking", "seeked", "ended", "durationchange", "timeupdate", "progress", "play", "pause", "ratechange", "resize", "volumechange"];
  61733. [["featuresMuteControl", "canMuteVolume"], ["featuresPlaybackRate", "canControlPlaybackRate"], ["featuresSourceset", "canOverrideAttributes"], ["featuresNativeTextTracks", "supportsNativeTextTracks"], ["featuresNativeVideoTracks", "supportsNativeVideoTracks"], ["featuresNativeAudioTracks", "supportsNativeAudioTracks"]].forEach(function([key, fn2]) {
  61734. defineLazyProperty$1(Html5$2.prototype, key, () => Html5$2[fn2](), true);
  61735. });
  61736. Html5$2.prototype.featuresVolumeControl = Html5$2.canControlVolume();
  61737. Html5$2.prototype.movingMediaElementInDOM = !IS_IOS$1;
  61738. Html5$2.prototype.featuresFullscreenResize = true;
  61739. Html5$2.prototype.featuresProgressEvents = true;
  61740. Html5$2.prototype.featuresTimeupdateEvents = true;
  61741. Html5$2.prototype.featuresVideoFrameCallback = !!(Html5$2.TEST_VID && Html5$2.TEST_VID.requestVideoFrameCallback);
  61742. Html5$2.disposeMediaElement = function(el) {
  61743. if (!el) {
  61744. return;
  61745. }
  61746. if (el.parentNode) {
  61747. el.parentNode.removeChild(el);
  61748. }
  61749. while (el.hasChildNodes()) {
  61750. el.removeChild(el.firstChild);
  61751. }
  61752. el.removeAttribute("src");
  61753. if (typeof el.load === "function") {
  61754. (function() {
  61755. try {
  61756. el.load();
  61757. } catch (e) {
  61758. }
  61759. })();
  61760. }
  61761. };
  61762. Html5$2.resetMediaElement = function(el) {
  61763. if (!el) {
  61764. return;
  61765. }
  61766. const sources = el.querySelectorAll("source");
  61767. let i2 = sources.length;
  61768. while (i2--) {
  61769. el.removeChild(sources[i2]);
  61770. }
  61771. el.removeAttribute("src");
  61772. if (typeof el.load === "function") {
  61773. (function() {
  61774. try {
  61775. el.load();
  61776. } catch (e) {
  61777. }
  61778. })();
  61779. }
  61780. };
  61781. [
  61782. "muted",
  61783. "defaultMuted",
  61784. "autoplay",
  61785. "controls",
  61786. "loop",
  61787. "playsinline"
  61788. ].forEach(function(prop) {
  61789. Html5$2.prototype[prop] = function() {
  61790. return this.el_[prop] || this.el_.hasAttribute(prop);
  61791. };
  61792. });
  61793. [
  61794. "muted",
  61795. "defaultMuted",
  61796. "autoplay",
  61797. "loop",
  61798. "playsinline"
  61799. ].forEach(function(prop) {
  61800. Html5$2.prototype["set" + toTitleCase$1$1(prop)] = function(v) {
  61801. this.el_[prop] = v;
  61802. if (v) {
  61803. this.el_.setAttribute(prop, prop);
  61804. } else {
  61805. this.el_.removeAttribute(prop);
  61806. }
  61807. };
  61808. });
  61809. [
  61810. "paused",
  61811. "currentTime",
  61812. "buffered",
  61813. "volume",
  61814. "poster",
  61815. "preload",
  61816. "error",
  61817. "seeking",
  61818. "seekable",
  61819. "ended",
  61820. "playbackRate",
  61821. "defaultPlaybackRate",
  61822. "disablePictureInPicture",
  61823. "played",
  61824. "networkState",
  61825. "readyState",
  61826. "videoWidth",
  61827. "videoHeight",
  61828. "crossOrigin"
  61829. ].forEach(function(prop) {
  61830. Html5$2.prototype[prop] = function() {
  61831. return this.el_[prop];
  61832. };
  61833. });
  61834. [
  61835. "volume",
  61836. "src",
  61837. "poster",
  61838. "preload",
  61839. "playbackRate",
  61840. "defaultPlaybackRate",
  61841. "disablePictureInPicture",
  61842. "crossOrigin"
  61843. ].forEach(function(prop) {
  61844. Html5$2.prototype["set" + toTitleCase$1$1(prop)] = function(v) {
  61845. this.el_[prop] = v;
  61846. };
  61847. });
  61848. [
  61849. "pause",
  61850. "load",
  61851. "play"
  61852. ].forEach(function(prop) {
  61853. Html5$2.prototype[prop] = function() {
  61854. return this.el_[prop]();
  61855. };
  61856. });
  61857. Tech$2.withSourceHandlers(Html5$2);
  61858. Html5$2.nativeSourceHandler = {};
  61859. Html5$2.nativeSourceHandler.canPlayType = function(type2) {
  61860. try {
  61861. return Html5$2.TEST_VID.canPlayType(type2);
  61862. } catch (e) {
  61863. return "";
  61864. }
  61865. };
  61866. Html5$2.nativeSourceHandler.canHandleSource = function(source, options2) {
  61867. if (source.type) {
  61868. return Html5$2.nativeSourceHandler.canPlayType(source.type);
  61869. } else if (source.src) {
  61870. const ext = getFileExtension$1(source.src);
  61871. return Html5$2.nativeSourceHandler.canPlayType(`video/${ext}`);
  61872. }
  61873. return "";
  61874. };
  61875. Html5$2.nativeSourceHandler.handleSource = function(source, tech, options2) {
  61876. tech.setSrc(source.src);
  61877. };
  61878. Html5$2.nativeSourceHandler.dispose = function() {
  61879. };
  61880. Html5$2.registerSourceHandler(Html5$2.nativeSourceHandler);
  61881. Tech$2.registerTech("Html5", Html5$2);
  61882. const TECH_EVENTS_RETRIGGER$1 = [
  61883. "progress",
  61884. "abort",
  61885. "suspend",
  61886. "emptied",
  61887. "stalled",
  61888. "loadedmetadata",
  61889. "loadeddata",
  61890. "timeupdate",
  61891. "resize",
  61892. "volumechange",
  61893. "texttrackchange"
  61894. ];
  61895. const TECH_EVENTS_QUEUE$1 = {
  61896. canplay: "CanPlay",
  61897. canplaythrough: "CanPlayThrough",
  61898. playing: "Playing",
  61899. seeked: "Seeked"
  61900. };
  61901. const BREAKPOINT_ORDER$1 = ["tiny", "xsmall", "small", "medium", "large", "xlarge", "huge"];
  61902. const BREAKPOINT_CLASSES$1 = {};
  61903. BREAKPOINT_ORDER$1.forEach((k) => {
  61904. const v = k.charAt(0) === "x" ? `x-${k.substring(1)}` : k;
  61905. BREAKPOINT_CLASSES$1[k] = `vjs-layout-${v}`;
  61906. });
  61907. const DEFAULT_BREAKPOINTS$1 = {
  61908. tiny: 210,
  61909. xsmall: 320,
  61910. small: 425,
  61911. medium: 768,
  61912. large: 1440,
  61913. xlarge: 2560,
  61914. huge: Infinity
  61915. };
  61916. class Player$1 extends Component$1$1 {
  61917. constructor(tag, options2, ready) {
  61918. tag.id = tag.id || options2.id || `vjs_video_${newGUID$1()}`;
  61919. options2 = Object.assign(Player$1.getTagSettings(tag), options2);
  61920. options2.initChildren = false;
  61921. options2.createEl = false;
  61922. options2.evented = false;
  61923. options2.reportTouchActivity = false;
  61924. if (!options2.language) {
  61925. const closest = tag.closest("[lang]");
  61926. if (closest) {
  61927. options2.language = closest.getAttribute("lang");
  61928. }
  61929. }
  61930. super(null, options2, ready);
  61931. this.boundDocumentFullscreenChange_ = (e) => this.documentFullscreenChange_(e);
  61932. this.boundFullWindowOnEscKey_ = (e) => this.fullWindowOnEscKey(e);
  61933. this.boundUpdateStyleEl_ = (e) => this.updateStyleEl_(e);
  61934. this.boundApplyInitTime_ = (e) => this.applyInitTime_(e);
  61935. this.boundUpdateCurrentBreakpoint_ = (e) => this.updateCurrentBreakpoint_(e);
  61936. this.boundHandleTechClick_ = (e) => this.handleTechClick_(e);
  61937. this.boundHandleTechDoubleClick_ = (e) => this.handleTechDoubleClick_(e);
  61938. this.boundHandleTechTouchStart_ = (e) => this.handleTechTouchStart_(e);
  61939. this.boundHandleTechTouchMove_ = (e) => this.handleTechTouchMove_(e);
  61940. this.boundHandleTechTouchEnd_ = (e) => this.handleTechTouchEnd_(e);
  61941. this.boundHandleTechTap_ = (e) => this.handleTechTap_(e);
  61942. this.isFullscreen_ = false;
  61943. this.log = createLogger$2(this.id_);
  61944. this.fsApi_ = FullscreenApi$1;
  61945. this.isPosterFromTech_ = false;
  61946. this.queuedCallbacks_ = [];
  61947. this.isReady_ = false;
  61948. this.hasStarted_ = false;
  61949. this.userActive_ = false;
  61950. this.debugEnabled_ = false;
  61951. this.audioOnlyMode_ = false;
  61952. this.audioPosterMode_ = false;
  61953. this.audioOnlyCache_ = {
  61954. playerHeight: null,
  61955. hiddenChildren: []
  61956. };
  61957. if (!this.options_ || !this.options_.techOrder || !this.options_.techOrder.length) {
  61958. throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");
  61959. }
  61960. this.tag = tag;
  61961. this.tagAttributes = tag && getAttributes$1(tag);
  61962. this.language(this.options_.language);
  61963. if (options2.languages) {
  61964. const languagesToLower = {};
  61965. Object.getOwnPropertyNames(options2.languages).forEach(function(name) {
  61966. languagesToLower[name.toLowerCase()] = options2.languages[name];
  61967. });
  61968. this.languages_ = languagesToLower;
  61969. } else {
  61970. this.languages_ = Player$1.prototype.options_.languages;
  61971. }
  61972. this.resetCache_();
  61973. this.poster_ = options2.poster || "";
  61974. this.controls_ = !!options2.controls;
  61975. tag.controls = false;
  61976. tag.removeAttribute("controls");
  61977. this.changingSrc_ = false;
  61978. this.playCallbacks_ = [];
  61979. this.playTerminatedQueue_ = [];
  61980. if (tag.hasAttribute("autoplay")) {
  61981. this.autoplay(true);
  61982. } else {
  61983. this.autoplay(this.options_.autoplay);
  61984. }
  61985. if (options2.plugins) {
  61986. Object.keys(options2.plugins).forEach((name) => {
  61987. if (typeof this[name] !== "function") {
  61988. throw new Error(`plugin "${name}" does not exist`);
  61989. }
  61990. });
  61991. }
  61992. this.scrubbing_ = false;
  61993. this.el_ = this.createEl();
  61994. evented$1(this, {
  61995. eventBusKey: "el_"
  61996. });
  61997. if (this.fsApi_.requestFullscreen) {
  61998. on$1(document_1, this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);
  61999. this.on(this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);
  62000. }
  62001. if (this.fluid_) {
  62002. this.on(["playerreset", "resize"], this.boundUpdateStyleEl_);
  62003. }
  62004. const playerOptionsCopy = merge$1(this.options_);
  62005. if (options2.plugins) {
  62006. Object.keys(options2.plugins).forEach((name) => {
  62007. this[name](options2.plugins[name]);
  62008. });
  62009. }
  62010. if (options2.debug) {
  62011. this.debug(true);
  62012. }
  62013. this.options_.playerOptions = playerOptionsCopy;
  62014. this.middleware_ = [];
  62015. this.playbackRates(options2.playbackRates);
  62016. this.initChildren();
  62017. this.isAudio(tag.nodeName.toLowerCase() === "audio");
  62018. if (this.controls()) {
  62019. this.addClass("vjs-controls-enabled");
  62020. } else {
  62021. this.addClass("vjs-controls-disabled");
  62022. }
  62023. this.el_.setAttribute("role", "region");
  62024. if (this.isAudio()) {
  62025. this.el_.setAttribute("aria-label", this.localize("Audio Player"));
  62026. } else {
  62027. this.el_.setAttribute("aria-label", this.localize("Video Player"));
  62028. }
  62029. if (this.isAudio()) {
  62030. this.addClass("vjs-audio");
  62031. }
  62032. if (TOUCH_ENABLED$1) {
  62033. this.addClass("vjs-touch-enabled");
  62034. }
  62035. if (!IS_IOS$1) {
  62036. this.addClass("vjs-workinghover");
  62037. }
  62038. Player$1.players[this.id_] = this;
  62039. const majorVersion = version$6$1.split(".")[0];
  62040. this.addClass(`vjs-v${majorVersion}`);
  62041. this.userActive(true);
  62042. this.reportUserActivity();
  62043. this.one("play", (e) => this.listenForUserActivity_(e));
  62044. this.on("keydown", (e) => this.handleKeyDown(e));
  62045. this.on("languagechange", (e) => this.handleLanguagechange(e));
  62046. this.breakpoints(this.options_.breakpoints);
  62047. this.responsive(this.options_.responsive);
  62048. this.on("ready", () => {
  62049. this.audioPosterMode(this.options_.audioPosterMode);
  62050. this.audioOnlyMode(this.options_.audioOnlyMode);
  62051. });
  62052. }
  62053. dispose() {
  62054. this.trigger("dispose");
  62055. this.off("dispose");
  62056. off$1(document_1, this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);
  62057. off$1(document_1, "keydown", this.boundFullWindowOnEscKey_);
  62058. if (this.styleEl_ && this.styleEl_.parentNode) {
  62059. this.styleEl_.parentNode.removeChild(this.styleEl_);
  62060. this.styleEl_ = null;
  62061. }
  62062. Player$1.players[this.id_] = null;
  62063. if (this.tag && this.tag.player) {
  62064. this.tag.player = null;
  62065. }
  62066. if (this.el_ && this.el_.player) {
  62067. this.el_.player = null;
  62068. }
  62069. if (this.tech_) {
  62070. this.tech_.dispose();
  62071. this.isPosterFromTech_ = false;
  62072. this.poster_ = "";
  62073. }
  62074. if (this.playerElIngest_) {
  62075. this.playerElIngest_ = null;
  62076. }
  62077. if (this.tag) {
  62078. this.tag = null;
  62079. }
  62080. clearCacheForPlayer$1(this);
  62081. ALL$1.names.forEach((name) => {
  62082. const props = ALL$1[name];
  62083. const list = this[props.getterName]();
  62084. if (list && list.off) {
  62085. list.off();
  62086. }
  62087. });
  62088. super.dispose({
  62089. restoreEl: this.options_.restoreEl
  62090. });
  62091. }
  62092. createEl() {
  62093. let tag = this.tag;
  62094. let el;
  62095. let playerElIngest = this.playerElIngest_ = tag.parentNode && tag.parentNode.hasAttribute && tag.parentNode.hasAttribute("data-vjs-player");
  62096. const divEmbed = this.tag.tagName.toLowerCase() === "video-js";
  62097. if (playerElIngest) {
  62098. el = this.el_ = tag.parentNode;
  62099. } else if (!divEmbed) {
  62100. el = this.el_ = super.createEl("div");
  62101. }
  62102. const attrs = getAttributes$1(tag);
  62103. if (divEmbed) {
  62104. el = this.el_ = tag;
  62105. tag = this.tag = document_1.createElement("video");
  62106. while (el.children.length) {
  62107. tag.appendChild(el.firstChild);
  62108. }
  62109. if (!hasClass$1(el, "video-js")) {
  62110. addClass$1(el, "video-js");
  62111. }
  62112. el.appendChild(tag);
  62113. playerElIngest = this.playerElIngest_ = el;
  62114. Object.keys(el).forEach((k) => {
  62115. try {
  62116. tag[k] = el[k];
  62117. } catch (e) {
  62118. }
  62119. });
  62120. }
  62121. tag.setAttribute("tabindex", "-1");
  62122. attrs.tabindex = "-1";
  62123. if (IS_CHROME$1 && IS_WINDOWS$1) {
  62124. tag.setAttribute("role", "application");
  62125. attrs.role = "application";
  62126. }
  62127. tag.removeAttribute("width");
  62128. tag.removeAttribute("height");
  62129. if ("width" in attrs) {
  62130. delete attrs.width;
  62131. }
  62132. if ("height" in attrs) {
  62133. delete attrs.height;
  62134. }
  62135. Object.getOwnPropertyNames(attrs).forEach(function(attr) {
  62136. if (!(divEmbed && attr === "class")) {
  62137. el.setAttribute(attr, attrs[attr]);
  62138. }
  62139. if (divEmbed) {
  62140. tag.setAttribute(attr, attrs[attr]);
  62141. }
  62142. });
  62143. tag.playerId = tag.id;
  62144. tag.id += "_html5_api";
  62145. tag.className = "vjs-tech";
  62146. tag.player = el.player = this;
  62147. this.addClass("vjs-paused");
  62148. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true) {
  62149. this.styleEl_ = createStyleElement$1("vjs-styles-dimensions");
  62150. const defaultsStyleEl = $$1(".vjs-styles-defaults");
  62151. const head = $$1("head");
  62152. head.insertBefore(this.styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild);
  62153. }
  62154. this.fill_ = false;
  62155. this.fluid_ = false;
  62156. this.width(this.options_.width);
  62157. this.height(this.options_.height);
  62158. this.fill(this.options_.fill);
  62159. this.fluid(this.options_.fluid);
  62160. this.aspectRatio(this.options_.aspectRatio);
  62161. this.crossOrigin(this.options_.crossOrigin || this.options_.crossorigin);
  62162. const links = tag.getElementsByTagName("a");
  62163. for (let i2 = 0; i2 < links.length; i2++) {
  62164. const linkEl = links.item(i2);
  62165. addClass$1(linkEl, "vjs-hidden");
  62166. linkEl.setAttribute("hidden", "hidden");
  62167. }
  62168. tag.initNetworkState_ = tag.networkState;
  62169. if (tag.parentNode && !playerElIngest) {
  62170. tag.parentNode.insertBefore(el, tag);
  62171. }
  62172. prependTo$1(tag, el);
  62173. this.children_.unshift(tag);
  62174. this.el_.setAttribute("lang", this.language_);
  62175. this.el_.setAttribute("translate", "no");
  62176. this.el_ = el;
  62177. return el;
  62178. }
  62179. crossOrigin(value) {
  62180. if (typeof value === "undefined") {
  62181. return this.techGet_("crossOrigin");
  62182. }
  62183. if (value !== null && value !== "anonymous" && value !== "use-credentials") {
  62184. log$1$1.warn(`crossOrigin must be null, "anonymous" or "use-credentials", given "${value}"`);
  62185. return;
  62186. }
  62187. this.techCall_("setCrossOrigin", value);
  62188. if (this.posterImage) {
  62189. this.posterImage.crossOrigin(value);
  62190. }
  62191. return;
  62192. }
  62193. width(value) {
  62194. return this.dimension("width", value);
  62195. }
  62196. height(value) {
  62197. return this.dimension("height", value);
  62198. }
  62199. dimension(dimension, value) {
  62200. const privDimension = dimension + "_";
  62201. if (value === void 0) {
  62202. return this[privDimension] || 0;
  62203. }
  62204. if (value === "" || value === "auto") {
  62205. this[privDimension] = void 0;
  62206. this.updateStyleEl_();
  62207. return;
  62208. }
  62209. const parsedVal = parseFloat(value);
  62210. if (isNaN(parsedVal)) {
  62211. log$1$1.error(`Improper value "${value}" supplied for for ${dimension}`);
  62212. return;
  62213. }
  62214. this[privDimension] = parsedVal;
  62215. this.updateStyleEl_();
  62216. }
  62217. fluid(bool) {
  62218. if (bool === void 0) {
  62219. return !!this.fluid_;
  62220. }
  62221. this.fluid_ = !!bool;
  62222. if (isEvented$1(this)) {
  62223. this.off(["playerreset", "resize"], this.boundUpdateStyleEl_);
  62224. }
  62225. if (bool) {
  62226. this.addClass("vjs-fluid");
  62227. this.fill(false);
  62228. addEventedCallback$1(this, () => {
  62229. this.on(["playerreset", "resize"], this.boundUpdateStyleEl_);
  62230. });
  62231. } else {
  62232. this.removeClass("vjs-fluid");
  62233. }
  62234. this.updateStyleEl_();
  62235. }
  62236. fill(bool) {
  62237. if (bool === void 0) {
  62238. return !!this.fill_;
  62239. }
  62240. this.fill_ = !!bool;
  62241. if (bool) {
  62242. this.addClass("vjs-fill");
  62243. this.fluid(false);
  62244. } else {
  62245. this.removeClass("vjs-fill");
  62246. }
  62247. }
  62248. aspectRatio(ratio) {
  62249. if (ratio === void 0) {
  62250. return this.aspectRatio_;
  62251. }
  62252. if (!/^\d+\:\d+$/.test(ratio)) {
  62253. throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");
  62254. }
  62255. this.aspectRatio_ = ratio;
  62256. this.fluid(true);
  62257. this.updateStyleEl_();
  62258. }
  62259. updateStyleEl_() {
  62260. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE === true) {
  62261. const width3 = typeof this.width_ === "number" ? this.width_ : this.options_.width;
  62262. const height3 = typeof this.height_ === "number" ? this.height_ : this.options_.height;
  62263. const techEl = this.tech_ && this.tech_.el();
  62264. if (techEl) {
  62265. if (width3 >= 0) {
  62266. techEl.width = width3;
  62267. }
  62268. if (height3 >= 0) {
  62269. techEl.height = height3;
  62270. }
  62271. }
  62272. return;
  62273. }
  62274. let width2;
  62275. let height2;
  62276. let aspectRatio;
  62277. let idClass;
  62278. if (this.aspectRatio_ !== void 0 && this.aspectRatio_ !== "auto") {
  62279. aspectRatio = this.aspectRatio_;
  62280. } else if (this.videoWidth() > 0) {
  62281. aspectRatio = this.videoWidth() + ":" + this.videoHeight();
  62282. } else {
  62283. aspectRatio = "16:9";
  62284. }
  62285. const ratioParts = aspectRatio.split(":");
  62286. const ratioMultiplier = ratioParts[1] / ratioParts[0];
  62287. if (this.width_ !== void 0) {
  62288. width2 = this.width_;
  62289. } else if (this.height_ !== void 0) {
  62290. width2 = this.height_ / ratioMultiplier;
  62291. } else {
  62292. width2 = this.videoWidth() || 300;
  62293. }
  62294. if (this.height_ !== void 0) {
  62295. height2 = this.height_;
  62296. } else {
  62297. height2 = width2 * ratioMultiplier;
  62298. }
  62299. if (/^[^a-zA-Z]/.test(this.id())) {
  62300. idClass = "dimensions-" + this.id();
  62301. } else {
  62302. idClass = this.id() + "-dimensions";
  62303. }
  62304. this.addClass(idClass);
  62305. setTextContent$1(this.styleEl_, `
  62306. .${idClass} {
  62307. width: ${width2}px;
  62308. height: ${height2}px;
  62309. }
  62310. .${idClass}.vjs-fluid:not(.vjs-audio-only-mode) {
  62311. padding-top: ${ratioMultiplier * 100}%;
  62312. }
  62313. `);
  62314. }
  62315. loadTech_(techName, source) {
  62316. if (this.tech_) {
  62317. this.unloadTech_();
  62318. }
  62319. const titleTechName = toTitleCase$1$1(techName);
  62320. const camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1);
  62321. if (titleTechName !== "Html5" && this.tag) {
  62322. Tech$2.getTech("Html5").disposeMediaElement(this.tag);
  62323. this.tag.player = null;
  62324. this.tag = null;
  62325. }
  62326. this.techName_ = titleTechName;
  62327. this.isReady_ = false;
  62328. let autoplay = this.autoplay();
  62329. if (typeof this.autoplay() === "string" || this.autoplay() === true && this.options_.normalizeAutoplay) {
  62330. autoplay = false;
  62331. }
  62332. const techOptions = {
  62333. source,
  62334. autoplay,
  62335. "nativeControlsForTouch": this.options_.nativeControlsForTouch,
  62336. "playerId": this.id(),
  62337. "techId": `${this.id()}_${camelTechName}_api`,
  62338. "playsinline": this.options_.playsinline,
  62339. "preload": this.options_.preload,
  62340. "loop": this.options_.loop,
  62341. "disablePictureInPicture": this.options_.disablePictureInPicture,
  62342. "muted": this.options_.muted,
  62343. "poster": this.poster(),
  62344. "language": this.language(),
  62345. "playerElIngest": this.playerElIngest_ || false,
  62346. "vtt.js": this.options_["vtt.js"],
  62347. "canOverridePoster": !!this.options_.techCanOverridePoster,
  62348. "enableSourceset": this.options_.enableSourceset
  62349. };
  62350. ALL$1.names.forEach((name) => {
  62351. const props = ALL$1[name];
  62352. techOptions[props.getterName] = this[props.privateName];
  62353. });
  62354. Object.assign(techOptions, this.options_[titleTechName]);
  62355. Object.assign(techOptions, this.options_[camelTechName]);
  62356. Object.assign(techOptions, this.options_[techName.toLowerCase()]);
  62357. if (this.tag) {
  62358. techOptions.tag = this.tag;
  62359. }
  62360. if (source && source.src === this.cache_.src && this.cache_.currentTime > 0) {
  62361. techOptions.startTime = this.cache_.currentTime;
  62362. }
  62363. const TechClass = Tech$2.getTech(techName);
  62364. if (!TechClass) {
  62365. throw new Error(`No Tech named '${titleTechName}' exists! '${titleTechName}' should be registered using videojs.registerTech()'`);
  62366. }
  62367. this.tech_ = new TechClass(techOptions);
  62368. this.tech_.ready(bind_(this, this.handleTechReady_), true);
  62369. textTrackConverter$1.jsonToTextTracks(this.textTracksJson_ || [], this.tech_);
  62370. TECH_EVENTS_RETRIGGER$1.forEach((event2) => {
  62371. this.on(this.tech_, event2, (e) => this[`handleTech${toTitleCase$1$1(event2)}_`](e));
  62372. });
  62373. Object.keys(TECH_EVENTS_QUEUE$1).forEach((event2) => {
  62374. this.on(this.tech_, event2, (eventObj) => {
  62375. if (this.tech_.playbackRate() === 0 && this.tech_.seeking()) {
  62376. this.queuedCallbacks_.push({
  62377. callback: this[`handleTech${TECH_EVENTS_QUEUE$1[event2]}_`].bind(this),
  62378. event: eventObj
  62379. });
  62380. return;
  62381. }
  62382. this[`handleTech${TECH_EVENTS_QUEUE$1[event2]}_`](eventObj);
  62383. });
  62384. });
  62385. this.on(this.tech_, "loadstart", (e) => this.handleTechLoadStart_(e));
  62386. this.on(this.tech_, "sourceset", (e) => this.handleTechSourceset_(e));
  62387. this.on(this.tech_, "waiting", (e) => this.handleTechWaiting_(e));
  62388. this.on(this.tech_, "ended", (e) => this.handleTechEnded_(e));
  62389. this.on(this.tech_, "seeking", (e) => this.handleTechSeeking_(e));
  62390. this.on(this.tech_, "play", (e) => this.handleTechPlay_(e));
  62391. this.on(this.tech_, "pause", (e) => this.handleTechPause_(e));
  62392. this.on(this.tech_, "durationchange", (e) => this.handleTechDurationChange_(e));
  62393. this.on(this.tech_, "fullscreenchange", (e, data) => this.handleTechFullscreenChange_(e, data));
  62394. this.on(this.tech_, "fullscreenerror", (e, err) => this.handleTechFullscreenError_(e, err));
  62395. this.on(this.tech_, "enterpictureinpicture", (e) => this.handleTechEnterPictureInPicture_(e));
  62396. this.on(this.tech_, "leavepictureinpicture", (e) => this.handleTechLeavePictureInPicture_(e));
  62397. this.on(this.tech_, "error", (e) => this.handleTechError_(e));
  62398. this.on(this.tech_, "posterchange", (e) => this.handleTechPosterChange_(e));
  62399. this.on(this.tech_, "textdata", (e) => this.handleTechTextData_(e));
  62400. this.on(this.tech_, "ratechange", (e) => this.handleTechRateChange_(e));
  62401. this.on(this.tech_, "loadedmetadata", this.boundUpdateStyleEl_);
  62402. this.usingNativeControls(this.techGet_("controls"));
  62403. if (this.controls() && !this.usingNativeControls()) {
  62404. this.addTechControlsListeners_();
  62405. }
  62406. if (this.tech_.el().parentNode !== this.el() && (titleTechName !== "Html5" || !this.tag)) {
  62407. prependTo$1(this.tech_.el(), this.el());
  62408. }
  62409. if (this.tag) {
  62410. this.tag.player = null;
  62411. this.tag = null;
  62412. }
  62413. }
  62414. unloadTech_() {
  62415. ALL$1.names.forEach((name) => {
  62416. const props = ALL$1[name];
  62417. this[props.privateName] = this[props.getterName]();
  62418. });
  62419. this.textTracksJson_ = textTrackConverter$1.textTracksToJson(this.tech_);
  62420. this.isReady_ = false;
  62421. this.tech_.dispose();
  62422. this.tech_ = false;
  62423. if (this.isPosterFromTech_) {
  62424. this.poster_ = "";
  62425. this.trigger("posterchange");
  62426. }
  62427. this.isPosterFromTech_ = false;
  62428. }
  62429. tech(safety) {
  62430. if (safety === void 0) {
  62431. log$1$1.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n");
  62432. }
  62433. return this.tech_;
  62434. }
  62435. addTechControlsListeners_() {
  62436. this.removeTechControlsListeners_();
  62437. this.on(this.tech_, "click", this.boundHandleTechClick_);
  62438. this.on(this.tech_, "dblclick", this.boundHandleTechDoubleClick_);
  62439. this.on(this.tech_, "touchstart", this.boundHandleTechTouchStart_);
  62440. this.on(this.tech_, "touchmove", this.boundHandleTechTouchMove_);
  62441. this.on(this.tech_, "touchend", this.boundHandleTechTouchEnd_);
  62442. this.on(this.tech_, "tap", this.boundHandleTechTap_);
  62443. }
  62444. removeTechControlsListeners_() {
  62445. this.off(this.tech_, "tap", this.boundHandleTechTap_);
  62446. this.off(this.tech_, "touchstart", this.boundHandleTechTouchStart_);
  62447. this.off(this.tech_, "touchmove", this.boundHandleTechTouchMove_);
  62448. this.off(this.tech_, "touchend", this.boundHandleTechTouchEnd_);
  62449. this.off(this.tech_, "click", this.boundHandleTechClick_);
  62450. this.off(this.tech_, "dblclick", this.boundHandleTechDoubleClick_);
  62451. }
  62452. handleTechReady_() {
  62453. this.triggerReady();
  62454. if (this.cache_.volume) {
  62455. this.techCall_("setVolume", this.cache_.volume);
  62456. }
  62457. this.handleTechPosterChange_();
  62458. this.handleTechDurationChange_();
  62459. }
  62460. handleTechLoadStart_() {
  62461. this.removeClass("vjs-ended", "vjs-seeking");
  62462. this.error(null);
  62463. this.handleTechDurationChange_();
  62464. if (!this.paused()) {
  62465. this.trigger("loadstart");
  62466. } else {
  62467. this.hasStarted(false);
  62468. this.trigger("loadstart");
  62469. }
  62470. this.manualAutoplay_(this.autoplay() === true && this.options_.normalizeAutoplay ? "play" : this.autoplay());
  62471. }
  62472. manualAutoplay_(type2) {
  62473. if (!this.tech_ || typeof type2 !== "string") {
  62474. return;
  62475. }
  62476. const resolveMuted = () => {
  62477. const previouslyMuted = this.muted();
  62478. this.muted(true);
  62479. const restoreMuted = () => {
  62480. this.muted(previouslyMuted);
  62481. };
  62482. this.playTerminatedQueue_.push(restoreMuted);
  62483. const mutedPromise = this.play();
  62484. if (!isPromise$1(mutedPromise)) {
  62485. return;
  62486. }
  62487. return mutedPromise.catch((err) => {
  62488. restoreMuted();
  62489. throw new Error(`Rejection at manualAutoplay. Restoring muted value. ${err ? err : ""}`);
  62490. });
  62491. };
  62492. let promise;
  62493. if (type2 === "any" && !this.muted()) {
  62494. promise = this.play();
  62495. if (isPromise$1(promise)) {
  62496. promise = promise.catch(resolveMuted);
  62497. }
  62498. } else if (type2 === "muted" && !this.muted()) {
  62499. promise = resolveMuted();
  62500. } else {
  62501. promise = this.play();
  62502. }
  62503. if (!isPromise$1(promise)) {
  62504. return;
  62505. }
  62506. return promise.then(() => {
  62507. this.trigger({
  62508. type: "autoplay-success",
  62509. autoplay: type2
  62510. });
  62511. }).catch(() => {
  62512. this.trigger({
  62513. type: "autoplay-failure",
  62514. autoplay: type2
  62515. });
  62516. });
  62517. }
  62518. updateSourceCaches_(srcObj = "") {
  62519. let src = srcObj;
  62520. let type2 = "";
  62521. if (typeof src !== "string") {
  62522. src = srcObj.src;
  62523. type2 = srcObj.type;
  62524. }
  62525. this.cache_.source = this.cache_.source || {};
  62526. this.cache_.sources = this.cache_.sources || [];
  62527. if (src && !type2) {
  62528. type2 = findMimetype$1(this, src);
  62529. }
  62530. this.cache_.source = merge$1({}, srcObj, {
  62531. src,
  62532. type: type2
  62533. });
  62534. const matchingSources = this.cache_.sources.filter((s) => s.src && s.src === src);
  62535. const sourceElSources = [];
  62536. const sourceEls = this.$$("source");
  62537. const matchingSourceEls = [];
  62538. for (let i2 = 0; i2 < sourceEls.length; i2++) {
  62539. const sourceObj = getAttributes$1(sourceEls[i2]);
  62540. sourceElSources.push(sourceObj);
  62541. if (sourceObj.src && sourceObj.src === src) {
  62542. matchingSourceEls.push(sourceObj.src);
  62543. }
  62544. }
  62545. if (matchingSourceEls.length && !matchingSources.length) {
  62546. this.cache_.sources = sourceElSources;
  62547. } else if (!matchingSources.length) {
  62548. this.cache_.sources = [this.cache_.source];
  62549. }
  62550. this.cache_.src = src;
  62551. }
  62552. handleTechSourceset_(event2) {
  62553. if (!this.changingSrc_) {
  62554. let updateSourceCaches = (src) => this.updateSourceCaches_(src);
  62555. const playerSrc = this.currentSource().src;
  62556. const eventSrc = event2.src;
  62557. if (playerSrc && !/^blob:/.test(playerSrc) && /^blob:/.test(eventSrc)) {
  62558. if (!this.lastSource_ || this.lastSource_.tech !== eventSrc && this.lastSource_.player !== playerSrc) {
  62559. updateSourceCaches = () => {
  62560. };
  62561. }
  62562. }
  62563. updateSourceCaches(eventSrc);
  62564. if (!event2.src) {
  62565. this.tech_.any(["sourceset", "loadstart"], (e) => {
  62566. if (e.type === "sourceset") {
  62567. return;
  62568. }
  62569. const techSrc = this.techGet("currentSrc");
  62570. this.lastSource_.tech = techSrc;
  62571. this.updateSourceCaches_(techSrc);
  62572. });
  62573. }
  62574. }
  62575. this.lastSource_ = {
  62576. player: this.currentSource().src,
  62577. tech: event2.src
  62578. };
  62579. this.trigger({
  62580. src: event2.src,
  62581. type: "sourceset"
  62582. });
  62583. }
  62584. hasStarted(request) {
  62585. if (request === void 0) {
  62586. return this.hasStarted_;
  62587. }
  62588. if (request === this.hasStarted_) {
  62589. return;
  62590. }
  62591. this.hasStarted_ = request;
  62592. if (this.hasStarted_) {
  62593. this.addClass("vjs-has-started");
  62594. } else {
  62595. this.removeClass("vjs-has-started");
  62596. }
  62597. }
  62598. handleTechPlay_() {
  62599. this.removeClass("vjs-ended", "vjs-paused");
  62600. this.addClass("vjs-playing");
  62601. this.hasStarted(true);
  62602. this.trigger("play");
  62603. }
  62604. handleTechRateChange_() {
  62605. if (this.tech_.playbackRate() > 0 && this.cache_.lastPlaybackRate === 0) {
  62606. this.queuedCallbacks_.forEach((queued) => queued.callback(queued.event));
  62607. this.queuedCallbacks_ = [];
  62608. }
  62609. this.cache_.lastPlaybackRate = this.tech_.playbackRate();
  62610. this.trigger("ratechange");
  62611. }
  62612. handleTechWaiting_() {
  62613. this.addClass("vjs-waiting");
  62614. this.trigger("waiting");
  62615. const timeWhenWaiting = this.currentTime();
  62616. const timeUpdateListener = () => {
  62617. if (timeWhenWaiting !== this.currentTime()) {
  62618. this.removeClass("vjs-waiting");
  62619. this.off("timeupdate", timeUpdateListener);
  62620. }
  62621. };
  62622. this.on("timeupdate", timeUpdateListener);
  62623. }
  62624. handleTechCanPlay_() {
  62625. this.removeClass("vjs-waiting");
  62626. this.trigger("canplay");
  62627. }
  62628. handleTechCanPlayThrough_() {
  62629. this.removeClass("vjs-waiting");
  62630. this.trigger("canplaythrough");
  62631. }
  62632. handleTechPlaying_() {
  62633. this.removeClass("vjs-waiting");
  62634. this.trigger("playing");
  62635. }
  62636. handleTechSeeking_() {
  62637. this.addClass("vjs-seeking");
  62638. this.trigger("seeking");
  62639. }
  62640. handleTechSeeked_() {
  62641. this.removeClass("vjs-seeking", "vjs-ended");
  62642. this.trigger("seeked");
  62643. }
  62644. handleTechPause_() {
  62645. this.removeClass("vjs-playing");
  62646. this.addClass("vjs-paused");
  62647. this.trigger("pause");
  62648. }
  62649. handleTechEnded_() {
  62650. this.addClass("vjs-ended");
  62651. this.removeClass("vjs-waiting");
  62652. if (this.options_.loop) {
  62653. this.currentTime(0);
  62654. this.play();
  62655. } else if (!this.paused()) {
  62656. this.pause();
  62657. }
  62658. this.trigger("ended");
  62659. }
  62660. handleTechDurationChange_() {
  62661. this.duration(this.techGet_("duration"));
  62662. }
  62663. handleTechClick_(event2) {
  62664. if (!this.controls_) {
  62665. return;
  62666. }
  62667. if (this.options_ === void 0 || this.options_.userActions === void 0 || this.options_.userActions.click === void 0 || this.options_.userActions.click !== false) {
  62668. if (this.options_ !== void 0 && this.options_.userActions !== void 0 && typeof this.options_.userActions.click === "function") {
  62669. this.options_.userActions.click.call(this, event2);
  62670. } else if (this.paused()) {
  62671. silencePromise$1(this.play());
  62672. } else {
  62673. this.pause();
  62674. }
  62675. }
  62676. }
  62677. handleTechDoubleClick_(event2) {
  62678. if (!this.controls_) {
  62679. return;
  62680. }
  62681. const inAllowedEls = Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"), (el) => el.contains(event2.target));
  62682. if (!inAllowedEls) {
  62683. if (this.options_ === void 0 || this.options_.userActions === void 0 || this.options_.userActions.doubleClick === void 0 || this.options_.userActions.doubleClick !== false) {
  62684. if (this.options_ !== void 0 && this.options_.userActions !== void 0 && typeof this.options_.userActions.doubleClick === "function") {
  62685. this.options_.userActions.doubleClick.call(this, event2);
  62686. } else if (this.isFullscreen()) {
  62687. this.exitFullscreen();
  62688. } else {
  62689. this.requestFullscreen();
  62690. }
  62691. }
  62692. }
  62693. }
  62694. handleTechTap_() {
  62695. this.userActive(!this.userActive());
  62696. }
  62697. handleTechTouchStart_() {
  62698. this.userWasActive = this.userActive();
  62699. }
  62700. handleTechTouchMove_() {
  62701. if (this.userWasActive) {
  62702. this.reportUserActivity();
  62703. }
  62704. }
  62705. handleTechTouchEnd_(event2) {
  62706. if (event2.cancelable) {
  62707. event2.preventDefault();
  62708. }
  62709. }
  62710. toggleFullscreenClass_() {
  62711. if (this.isFullscreen()) {
  62712. this.addClass("vjs-fullscreen");
  62713. } else {
  62714. this.removeClass("vjs-fullscreen");
  62715. }
  62716. }
  62717. documentFullscreenChange_(e) {
  62718. const targetPlayer = e.target.player;
  62719. if (targetPlayer && targetPlayer !== this) {
  62720. return;
  62721. }
  62722. const el = this.el();
  62723. let isFs = document_1[this.fsApi_.fullscreenElement] === el;
  62724. if (!isFs && el.matches) {
  62725. isFs = el.matches(":" + this.fsApi_.fullscreen);
  62726. } else if (!isFs && el.msMatchesSelector) {
  62727. isFs = el.msMatchesSelector(":" + this.fsApi_.fullscreen);
  62728. }
  62729. this.isFullscreen(isFs);
  62730. }
  62731. handleTechFullscreenChange_(event2, data) {
  62732. if (data) {
  62733. if (data.nativeIOSFullscreen) {
  62734. this.addClass("vjs-ios-native-fs");
  62735. this.tech_.one("webkitendfullscreen", () => {
  62736. this.removeClass("vjs-ios-native-fs");
  62737. });
  62738. }
  62739. this.isFullscreen(data.isFullscreen);
  62740. }
  62741. }
  62742. handleTechFullscreenError_(event2, err) {
  62743. this.trigger("fullscreenerror", err);
  62744. }
  62745. togglePictureInPictureClass_() {
  62746. if (this.isInPictureInPicture()) {
  62747. this.addClass("vjs-picture-in-picture");
  62748. } else {
  62749. this.removeClass("vjs-picture-in-picture");
  62750. }
  62751. }
  62752. handleTechEnterPictureInPicture_(event2) {
  62753. this.isInPictureInPicture(true);
  62754. }
  62755. handleTechLeavePictureInPicture_(event2) {
  62756. this.isInPictureInPicture(false);
  62757. }
  62758. handleTechError_() {
  62759. const error = this.tech_.error();
  62760. this.error(error);
  62761. }
  62762. handleTechTextData_() {
  62763. let data = null;
  62764. if (arguments.length > 1) {
  62765. data = arguments[1];
  62766. }
  62767. this.trigger("textdata", data);
  62768. }
  62769. getCache() {
  62770. return this.cache_;
  62771. }
  62772. resetCache_() {
  62773. this.cache_ = {
  62774. currentTime: 0,
  62775. initTime: 0,
  62776. inactivityTimeout: this.options_.inactivityTimeout,
  62777. duration: NaN,
  62778. lastVolume: 1,
  62779. lastPlaybackRate: this.defaultPlaybackRate(),
  62780. media: null,
  62781. src: "",
  62782. source: {},
  62783. sources: [],
  62784. playbackRates: [],
  62785. volume: 1
  62786. };
  62787. }
  62788. techCall_(method, arg) {
  62789. this.ready(function() {
  62790. if (method in allowedSetters$1) {
  62791. return set$1(this.middleware_, this.tech_, method, arg);
  62792. } else if (method in allowedMediators$1) {
  62793. return mediate$1(this.middleware_, this.tech_, method, arg);
  62794. }
  62795. try {
  62796. if (this.tech_) {
  62797. this.tech_[method](arg);
  62798. }
  62799. } catch (e) {
  62800. log$1$1(e);
  62801. throw e;
  62802. }
  62803. }, true);
  62804. }
  62805. techGet_(method) {
  62806. if (!this.tech_ || !this.tech_.isReady_) {
  62807. return;
  62808. }
  62809. if (method in allowedGetters$1) {
  62810. return get$1(this.middleware_, this.tech_, method);
  62811. } else if (method in allowedMediators$1) {
  62812. return mediate$1(this.middleware_, this.tech_, method);
  62813. }
  62814. try {
  62815. return this.tech_[method]();
  62816. } catch (e) {
  62817. if (this.tech_[method] === void 0) {
  62818. log$1$1(`Video.js: ${method} method not defined for ${this.techName_} playback technology.`, e);
  62819. throw e;
  62820. }
  62821. if (e.name === "TypeError") {
  62822. log$1$1(`Video.js: ${method} unavailable on ${this.techName_} playback technology element.`, e);
  62823. this.tech_.isReady_ = false;
  62824. throw e;
  62825. }
  62826. log$1$1(e);
  62827. throw e;
  62828. }
  62829. }
  62830. play() {
  62831. return new Promise((resolve2) => {
  62832. this.play_(resolve2);
  62833. });
  62834. }
  62835. play_(callback2 = silencePromise$1) {
  62836. this.playCallbacks_.push(callback2);
  62837. const isSrcReady = Boolean(!this.changingSrc_ && (this.src() || this.currentSrc()));
  62838. const isSafariOrIOS = Boolean(IS_ANY_SAFARI$1 || IS_IOS$1);
  62839. if (this.waitToPlay_) {
  62840. this.off(["ready", "loadstart"], this.waitToPlay_);
  62841. this.waitToPlay_ = null;
  62842. }
  62843. if (!this.isReady_ || !isSrcReady) {
  62844. this.waitToPlay_ = (e) => {
  62845. this.play_();
  62846. };
  62847. this.one(["ready", "loadstart"], this.waitToPlay_);
  62848. if (!isSrcReady && isSafariOrIOS) {
  62849. this.load();
  62850. }
  62851. return;
  62852. }
  62853. const val = this.techGet_("play");
  62854. const isNativeReplay = isSafariOrIOS && this.hasClass("vjs-ended");
  62855. if (isNativeReplay) {
  62856. this.resetProgressBar_();
  62857. }
  62858. if (val === null) {
  62859. this.runPlayTerminatedQueue_();
  62860. } else {
  62861. this.runPlayCallbacks_(val);
  62862. }
  62863. }
  62864. runPlayTerminatedQueue_() {
  62865. const queue = this.playTerminatedQueue_.slice(0);
  62866. this.playTerminatedQueue_ = [];
  62867. queue.forEach(function(q2) {
  62868. q2();
  62869. });
  62870. }
  62871. runPlayCallbacks_(val) {
  62872. const callbacks = this.playCallbacks_.slice(0);
  62873. this.playCallbacks_ = [];
  62874. this.playTerminatedQueue_ = [];
  62875. callbacks.forEach(function(cb) {
  62876. cb(val);
  62877. });
  62878. }
  62879. pause() {
  62880. this.techCall_("pause");
  62881. }
  62882. paused() {
  62883. return this.techGet_("paused") === false ? false : true;
  62884. }
  62885. played() {
  62886. return this.techGet_("played") || createTimeRanges$1(0, 0);
  62887. }
  62888. scrubbing(isScrubbing) {
  62889. if (typeof isScrubbing === "undefined") {
  62890. return this.scrubbing_;
  62891. }
  62892. this.scrubbing_ = !!isScrubbing;
  62893. this.techCall_("setScrubbing", this.scrubbing_);
  62894. if (isScrubbing) {
  62895. this.addClass("vjs-scrubbing");
  62896. } else {
  62897. this.removeClass("vjs-scrubbing");
  62898. }
  62899. }
  62900. currentTime(seconds) {
  62901. if (typeof seconds !== "undefined") {
  62902. if (seconds < 0) {
  62903. seconds = 0;
  62904. }
  62905. if (!this.isReady_ || this.changingSrc_ || !this.tech_ || !this.tech_.isReady_) {
  62906. this.cache_.initTime = seconds;
  62907. this.off("canplay", this.boundApplyInitTime_);
  62908. this.one("canplay", this.boundApplyInitTime_);
  62909. return;
  62910. }
  62911. this.techCall_("setCurrentTime", seconds);
  62912. this.cache_.initTime = 0;
  62913. return;
  62914. }
  62915. this.cache_.currentTime = this.techGet_("currentTime") || 0;
  62916. return this.cache_.currentTime;
  62917. }
  62918. applyInitTime_() {
  62919. this.currentTime(this.cache_.initTime);
  62920. }
  62921. duration(seconds) {
  62922. if (seconds === void 0) {
  62923. return this.cache_.duration !== void 0 ? this.cache_.duration : NaN;
  62924. }
  62925. seconds = parseFloat(seconds);
  62926. if (seconds < 0) {
  62927. seconds = Infinity;
  62928. }
  62929. if (seconds !== this.cache_.duration) {
  62930. this.cache_.duration = seconds;
  62931. if (seconds === Infinity) {
  62932. this.addClass("vjs-live");
  62933. } else {
  62934. this.removeClass("vjs-live");
  62935. }
  62936. if (!isNaN(seconds)) {
  62937. this.trigger("durationchange");
  62938. }
  62939. }
  62940. }
  62941. remainingTime() {
  62942. return this.duration() - this.currentTime();
  62943. }
  62944. remainingTimeDisplay() {
  62945. return Math.floor(this.duration()) - Math.floor(this.currentTime());
  62946. }
  62947. buffered() {
  62948. let buffered = this.techGet_("buffered");
  62949. if (!buffered || !buffered.length) {
  62950. buffered = createTimeRanges$1(0, 0);
  62951. }
  62952. return buffered;
  62953. }
  62954. bufferedPercent() {
  62955. return bufferedPercent$1(this.buffered(), this.duration());
  62956. }
  62957. bufferedEnd() {
  62958. const buffered = this.buffered();
  62959. const duration5 = this.duration();
  62960. let end = buffered.end(buffered.length - 1);
  62961. if (end > duration5) {
  62962. end = duration5;
  62963. }
  62964. return end;
  62965. }
  62966. volume(percentAsDecimal) {
  62967. let vol;
  62968. if (percentAsDecimal !== void 0) {
  62969. vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal)));
  62970. this.cache_.volume = vol;
  62971. this.techCall_("setVolume", vol);
  62972. if (vol > 0) {
  62973. this.lastVolume_(vol);
  62974. }
  62975. return;
  62976. }
  62977. vol = parseFloat(this.techGet_("volume"));
  62978. return isNaN(vol) ? 1 : vol;
  62979. }
  62980. muted(muted) {
  62981. if (muted !== void 0) {
  62982. this.techCall_("setMuted", muted);
  62983. return;
  62984. }
  62985. return this.techGet_("muted") || false;
  62986. }
  62987. defaultMuted(defaultMuted) {
  62988. if (defaultMuted !== void 0) {
  62989. return this.techCall_("setDefaultMuted", defaultMuted);
  62990. }
  62991. return this.techGet_("defaultMuted") || false;
  62992. }
  62993. lastVolume_(percentAsDecimal) {
  62994. if (percentAsDecimal !== void 0 && percentAsDecimal !== 0) {
  62995. this.cache_.lastVolume = percentAsDecimal;
  62996. return;
  62997. }
  62998. return this.cache_.lastVolume;
  62999. }
  63000. supportsFullScreen() {
  63001. return this.techGet_("supportsFullScreen") || false;
  63002. }
  63003. isFullscreen(isFS) {
  63004. if (isFS !== void 0) {
  63005. const oldValue = this.isFullscreen_;
  63006. this.isFullscreen_ = Boolean(isFS);
  63007. if (this.isFullscreen_ !== oldValue && this.fsApi_.prefixed) {
  63008. this.trigger("fullscreenchange");
  63009. }
  63010. this.toggleFullscreenClass_();
  63011. return;
  63012. }
  63013. return this.isFullscreen_;
  63014. }
  63015. requestFullscreen(fullscreenOptions) {
  63016. if (this.isInPictureInPicture()) {
  63017. this.exitPictureInPicture();
  63018. }
  63019. const self2 = this;
  63020. return new Promise((resolve2, reject2) => {
  63021. function offHandler() {
  63022. self2.off("fullscreenerror", errorHandler);
  63023. self2.off("fullscreenchange", changeHandler);
  63024. }
  63025. function changeHandler() {
  63026. offHandler();
  63027. resolve2();
  63028. }
  63029. function errorHandler(e, err) {
  63030. offHandler();
  63031. reject2(err);
  63032. }
  63033. self2.one("fullscreenchange", changeHandler);
  63034. self2.one("fullscreenerror", errorHandler);
  63035. const promise = self2.requestFullscreenHelper_(fullscreenOptions);
  63036. if (promise) {
  63037. promise.then(offHandler, offHandler);
  63038. promise.then(resolve2, reject2);
  63039. }
  63040. });
  63041. }
  63042. requestFullscreenHelper_(fullscreenOptions) {
  63043. let fsOptions;
  63044. if (!this.fsApi_.prefixed) {
  63045. fsOptions = this.options_.fullscreen && this.options_.fullscreen.options || {};
  63046. if (fullscreenOptions !== void 0) {
  63047. fsOptions = fullscreenOptions;
  63048. }
  63049. }
  63050. if (this.fsApi_.requestFullscreen) {
  63051. const promise = this.el_[this.fsApi_.requestFullscreen](fsOptions);
  63052. if (promise) {
  63053. promise.then(() => this.isFullscreen(true), () => this.isFullscreen(false));
  63054. }
  63055. return promise;
  63056. } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
  63057. this.techCall_("enterFullScreen");
  63058. } else {
  63059. this.enterFullWindow();
  63060. }
  63061. }
  63062. exitFullscreen() {
  63063. const self2 = this;
  63064. return new Promise((resolve2, reject2) => {
  63065. function offHandler() {
  63066. self2.off("fullscreenerror", errorHandler);
  63067. self2.off("fullscreenchange", changeHandler);
  63068. }
  63069. function changeHandler() {
  63070. offHandler();
  63071. resolve2();
  63072. }
  63073. function errorHandler(e, err) {
  63074. offHandler();
  63075. reject2(err);
  63076. }
  63077. self2.one("fullscreenchange", changeHandler);
  63078. self2.one("fullscreenerror", errorHandler);
  63079. const promise = self2.exitFullscreenHelper_();
  63080. if (promise) {
  63081. promise.then(offHandler, offHandler);
  63082. promise.then(resolve2, reject2);
  63083. }
  63084. });
  63085. }
  63086. exitFullscreenHelper_() {
  63087. if (this.fsApi_.requestFullscreen) {
  63088. const promise = document_1[this.fsApi_.exitFullscreen]();
  63089. if (promise) {
  63090. silencePromise$1(promise.then(() => this.isFullscreen(false)));
  63091. }
  63092. return promise;
  63093. } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
  63094. this.techCall_("exitFullScreen");
  63095. } else {
  63096. this.exitFullWindow();
  63097. }
  63098. }
  63099. enterFullWindow() {
  63100. this.isFullscreen(true);
  63101. this.isFullWindow = true;
  63102. this.docOrigOverflow = document_1.documentElement.style.overflow;
  63103. on$1(document_1, "keydown", this.boundFullWindowOnEscKey_);
  63104. document_1.documentElement.style.overflow = "hidden";
  63105. addClass$1(document_1.body, "vjs-full-window");
  63106. this.trigger("enterFullWindow");
  63107. }
  63108. fullWindowOnEscKey(event2) {
  63109. if (keycode.isEventKey(event2, "Esc")) {
  63110. if (this.isFullscreen() === true) {
  63111. if (!this.isFullWindow) {
  63112. this.exitFullscreen();
  63113. } else {
  63114. this.exitFullWindow();
  63115. }
  63116. }
  63117. }
  63118. }
  63119. exitFullWindow() {
  63120. this.isFullscreen(false);
  63121. this.isFullWindow = false;
  63122. off$1(document_1, "keydown", this.boundFullWindowOnEscKey_);
  63123. document_1.documentElement.style.overflow = this.docOrigOverflow;
  63124. removeClass$1(document_1.body, "vjs-full-window");
  63125. this.trigger("exitFullWindow");
  63126. }
  63127. disablePictureInPicture(value) {
  63128. if (value === void 0) {
  63129. return this.techGet_("disablePictureInPicture");
  63130. }
  63131. this.techCall_("setDisablePictureInPicture", value);
  63132. this.options_.disablePictureInPicture = value;
  63133. this.trigger("disablepictureinpicturechanged");
  63134. }
  63135. isInPictureInPicture(isPiP) {
  63136. if (isPiP !== void 0) {
  63137. this.isInPictureInPicture_ = !!isPiP;
  63138. this.togglePictureInPictureClass_();
  63139. return;
  63140. }
  63141. return !!this.isInPictureInPicture_;
  63142. }
  63143. requestPictureInPicture() {
  63144. if (this.options_.enableDocumentPictureInPicture && window_1.documentPictureInPicture) {
  63145. const pipContainer = document_1.createElement(this.el().tagName);
  63146. pipContainer.classList = this.el().classList;
  63147. pipContainer.classList.add("vjs-pip-container");
  63148. if (this.posterImage) {
  63149. pipContainer.appendChild(this.posterImage.el().cloneNode(true));
  63150. }
  63151. if (this.titleBar) {
  63152. pipContainer.appendChild(this.titleBar.el().cloneNode(true));
  63153. }
  63154. pipContainer.appendChild(createEl$1("p", {
  63155. className: "vjs-pip-text"
  63156. }, {}, this.localize("Playing in picture-in-picture")));
  63157. return window_1.documentPictureInPicture.requestWindow({
  63158. initialAspectRatio: this.videoWidth() / this.videoHeight(),
  63159. copyStyleSheets: true
  63160. }).then((pipWindow) => {
  63161. this.el_.parentNode.insertBefore(pipContainer, this.el_);
  63162. pipWindow.document.body.append(this.el_);
  63163. pipWindow.document.body.classList.add("vjs-pip-window");
  63164. this.player_.isInPictureInPicture(true);
  63165. this.player_.trigger("enterpictureinpicture");
  63166. pipWindow.addEventListener("unload", (event2) => {
  63167. const pipVideo = event2.target.querySelector(".video-js");
  63168. pipContainer.replaceWith(pipVideo);
  63169. this.player_.isInPictureInPicture(false);
  63170. this.player_.trigger("leavepictureinpicture");
  63171. });
  63172. return pipWindow;
  63173. });
  63174. }
  63175. if ("pictureInPictureEnabled" in document_1 && this.disablePictureInPicture() === false) {
  63176. return this.techGet_("requestPictureInPicture");
  63177. }
  63178. return Promise.reject("No PiP mode is available");
  63179. }
  63180. exitPictureInPicture() {
  63181. if (window_1.documentPictureInPicture && window_1.documentPictureInPicture.window) {
  63182. window_1.documentPictureInPicture.window.close();
  63183. return Promise.resolve();
  63184. }
  63185. if ("pictureInPictureEnabled" in document_1) {
  63186. return document_1.exitPictureInPicture();
  63187. }
  63188. }
  63189. handleKeyDown(event2) {
  63190. const {
  63191. userActions
  63192. } = this.options_;
  63193. if (!userActions || !userActions.hotkeys) {
  63194. return;
  63195. }
  63196. const excludeElement = (el) => {
  63197. const tagName = el.tagName.toLowerCase();
  63198. if (el.isContentEditable) {
  63199. return true;
  63200. }
  63201. const allowedInputTypes = ["button", "checkbox", "hidden", "radio", "reset", "submit"];
  63202. if (tagName === "input") {
  63203. return allowedInputTypes.indexOf(el.type) === -1;
  63204. }
  63205. const excludedTags = ["textarea"];
  63206. return excludedTags.indexOf(tagName) !== -1;
  63207. };
  63208. if (excludeElement(this.el_.ownerDocument.activeElement)) {
  63209. return;
  63210. }
  63211. if (typeof userActions.hotkeys === "function") {
  63212. userActions.hotkeys.call(this, event2);
  63213. } else {
  63214. this.handleHotkeys(event2);
  63215. }
  63216. }
  63217. handleHotkeys(event2) {
  63218. const hotkeys = this.options_.userActions ? this.options_.userActions.hotkeys : {};
  63219. const {
  63220. fullscreenKey = (keydownEvent) => keycode.isEventKey(keydownEvent, "f"),
  63221. muteKey = (keydownEvent) => keycode.isEventKey(keydownEvent, "m"),
  63222. playPauseKey = (keydownEvent) => keycode.isEventKey(keydownEvent, "k") || keycode.isEventKey(keydownEvent, "Space")
  63223. } = hotkeys;
  63224. if (fullscreenKey.call(this, event2)) {
  63225. event2.preventDefault();
  63226. event2.stopPropagation();
  63227. const FSToggle = Component$1$1.getComponent("FullscreenToggle");
  63228. if (document_1[this.fsApi_.fullscreenEnabled] !== false) {
  63229. FSToggle.prototype.handleClick.call(this, event2);
  63230. }
  63231. } else if (muteKey.call(this, event2)) {
  63232. event2.preventDefault();
  63233. event2.stopPropagation();
  63234. const MuteToggle2 = Component$1$1.getComponent("MuteToggle");
  63235. MuteToggle2.prototype.handleClick.call(this, event2);
  63236. } else if (playPauseKey.call(this, event2)) {
  63237. event2.preventDefault();
  63238. event2.stopPropagation();
  63239. const PlayToggle2 = Component$1$1.getComponent("PlayToggle");
  63240. PlayToggle2.prototype.handleClick.call(this, event2);
  63241. }
  63242. }
  63243. canPlayType(type2) {
  63244. let can;
  63245. for (let i2 = 0, j = this.options_.techOrder; i2 < j.length; i2++) {
  63246. const techName = j[i2];
  63247. let tech = Tech$2.getTech(techName);
  63248. if (!tech) {
  63249. tech = Component$1$1.getComponent(techName);
  63250. }
  63251. if (!tech) {
  63252. log$1$1.error(`The "${techName}" tech is undefined. Skipped browser support check for that tech.`);
  63253. continue;
  63254. }
  63255. if (tech.isSupported()) {
  63256. can = tech.canPlayType(type2);
  63257. if (can) {
  63258. return can;
  63259. }
  63260. }
  63261. }
  63262. return "";
  63263. }
  63264. selectSource(sources) {
  63265. const techs = this.options_.techOrder.map((techName) => {
  63266. return [techName, Tech$2.getTech(techName)];
  63267. }).filter(([techName, tech]) => {
  63268. if (tech) {
  63269. return tech.isSupported();
  63270. }
  63271. log$1$1.error(`The "${techName}" tech is undefined. Skipped browser support check for that tech.`);
  63272. return false;
  63273. });
  63274. const findFirstPassingTechSourcePair = function(outerArray, innerArray, tester) {
  63275. let found;
  63276. outerArray.some((outerChoice) => {
  63277. return innerArray.some((innerChoice) => {
  63278. found = tester(outerChoice, innerChoice);
  63279. if (found) {
  63280. return true;
  63281. }
  63282. });
  63283. });
  63284. return found;
  63285. };
  63286. let foundSourceAndTech;
  63287. const flip = (fn2) => (a, b) => fn2(b, a);
  63288. const finder = ([techName, tech], source) => {
  63289. if (tech.canPlaySource(source, this.options_[techName.toLowerCase()])) {
  63290. return {
  63291. source,
  63292. tech: techName
  63293. };
  63294. }
  63295. };
  63296. if (this.options_.sourceOrder) {
  63297. foundSourceAndTech = findFirstPassingTechSourcePair(sources, techs, flip(finder));
  63298. } else {
  63299. foundSourceAndTech = findFirstPassingTechSourcePair(techs, sources, finder);
  63300. }
  63301. return foundSourceAndTech || false;
  63302. }
  63303. handleSrc_(source, isRetry) {
  63304. if (typeof source === "undefined") {
  63305. return this.cache_.src || "";
  63306. }
  63307. if (this.resetRetryOnError_) {
  63308. this.resetRetryOnError_();
  63309. }
  63310. const sources = filterSource$1(source);
  63311. if (!sources.length) {
  63312. this.setTimeout(function() {
  63313. this.error({
  63314. code: 4,
  63315. message: this.options_.notSupportedMessage
  63316. });
  63317. }, 0);
  63318. return;
  63319. }
  63320. this.changingSrc_ = true;
  63321. if (!isRetry) {
  63322. this.cache_.sources = sources;
  63323. }
  63324. this.updateSourceCaches_(sources[0]);
  63325. setSource$1(this, sources[0], (middlewareSource, mws) => {
  63326. this.middleware_ = mws;
  63327. if (!isRetry) {
  63328. this.cache_.sources = sources;
  63329. }
  63330. this.updateSourceCaches_(middlewareSource);
  63331. const err = this.src_(middlewareSource);
  63332. if (err) {
  63333. if (sources.length > 1) {
  63334. return this.handleSrc_(sources.slice(1));
  63335. }
  63336. this.changingSrc_ = false;
  63337. this.setTimeout(function() {
  63338. this.error({
  63339. code: 4,
  63340. message: this.options_.notSupportedMessage
  63341. });
  63342. }, 0);
  63343. this.triggerReady();
  63344. return;
  63345. }
  63346. setTech$1(mws, this.tech_);
  63347. });
  63348. if (sources.length > 1) {
  63349. const retry = () => {
  63350. this.error(null);
  63351. this.handleSrc_(sources.slice(1), true);
  63352. };
  63353. const stopListeningForErrors = () => {
  63354. this.off("error", retry);
  63355. };
  63356. this.one("error", retry);
  63357. this.one("playing", stopListeningForErrors);
  63358. this.resetRetryOnError_ = () => {
  63359. this.off("error", retry);
  63360. this.off("playing", stopListeningForErrors);
  63361. };
  63362. }
  63363. }
  63364. src(source) {
  63365. return this.handleSrc_(source, false);
  63366. }
  63367. src_(source) {
  63368. const sourceTech = this.selectSource([source]);
  63369. if (!sourceTech) {
  63370. return true;
  63371. }
  63372. if (!titleCaseEquals$1(sourceTech.tech, this.techName_)) {
  63373. this.changingSrc_ = true;
  63374. this.loadTech_(sourceTech.tech, sourceTech.source);
  63375. this.tech_.ready(() => {
  63376. this.changingSrc_ = false;
  63377. });
  63378. return false;
  63379. }
  63380. this.ready(function() {
  63381. if (this.tech_.constructor.prototype.hasOwnProperty("setSource")) {
  63382. this.techCall_("setSource", source);
  63383. } else {
  63384. this.techCall_("src", source.src);
  63385. }
  63386. this.changingSrc_ = false;
  63387. }, true);
  63388. return false;
  63389. }
  63390. load() {
  63391. this.techCall_("load");
  63392. }
  63393. reset() {
  63394. if (this.paused()) {
  63395. this.doReset_();
  63396. } else {
  63397. const playPromise = this.play();
  63398. silencePromise$1(playPromise.then(() => this.doReset_()));
  63399. }
  63400. }
  63401. doReset_() {
  63402. if (this.tech_) {
  63403. this.tech_.clearTracks("text");
  63404. }
  63405. this.resetCache_();
  63406. this.poster("");
  63407. this.loadTech_(this.options_.techOrder[0], null);
  63408. this.techCall_("reset");
  63409. this.resetControlBarUI_();
  63410. if (isEvented$1(this)) {
  63411. this.trigger("playerreset");
  63412. }
  63413. }
  63414. resetControlBarUI_() {
  63415. this.resetProgressBar_();
  63416. this.resetPlaybackRate_();
  63417. this.resetVolumeBar_();
  63418. }
  63419. resetProgressBar_() {
  63420. this.currentTime(0);
  63421. const {
  63422. currentTimeDisplay,
  63423. durationDisplay,
  63424. progressControl,
  63425. remainingTimeDisplay
  63426. } = this.controlBar || {};
  63427. const {
  63428. seekBar
  63429. } = progressControl || {};
  63430. if (currentTimeDisplay) {
  63431. currentTimeDisplay.updateContent();
  63432. }
  63433. if (durationDisplay) {
  63434. durationDisplay.updateContent();
  63435. }
  63436. if (remainingTimeDisplay) {
  63437. remainingTimeDisplay.updateContent();
  63438. }
  63439. if (seekBar) {
  63440. seekBar.update();
  63441. if (seekBar.loadProgressBar) {
  63442. seekBar.loadProgressBar.update();
  63443. }
  63444. }
  63445. }
  63446. resetPlaybackRate_() {
  63447. this.playbackRate(this.defaultPlaybackRate());
  63448. this.handleTechRateChange_();
  63449. }
  63450. resetVolumeBar_() {
  63451. this.volume(1);
  63452. this.trigger("volumechange");
  63453. }
  63454. currentSources() {
  63455. const source = this.currentSource();
  63456. const sources = [];
  63457. if (Object.keys(source).length !== 0) {
  63458. sources.push(source);
  63459. }
  63460. return this.cache_.sources || sources;
  63461. }
  63462. currentSource() {
  63463. return this.cache_.source || {};
  63464. }
  63465. currentSrc() {
  63466. return this.currentSource() && this.currentSource().src || "";
  63467. }
  63468. currentType() {
  63469. return this.currentSource() && this.currentSource().type || "";
  63470. }
  63471. preload(value) {
  63472. if (value !== void 0) {
  63473. this.techCall_("setPreload", value);
  63474. this.options_.preload = value;
  63475. return;
  63476. }
  63477. return this.techGet_("preload");
  63478. }
  63479. autoplay(value) {
  63480. if (value === void 0) {
  63481. return this.options_.autoplay || false;
  63482. }
  63483. let techAutoplay;
  63484. if (typeof value === "string" && /(any|play|muted)/.test(value) || value === true && this.options_.normalizeAutoplay) {
  63485. this.options_.autoplay = value;
  63486. this.manualAutoplay_(typeof value === "string" ? value : "play");
  63487. techAutoplay = false;
  63488. } else if (!value) {
  63489. this.options_.autoplay = false;
  63490. } else {
  63491. this.options_.autoplay = true;
  63492. }
  63493. techAutoplay = typeof techAutoplay === "undefined" ? this.options_.autoplay : techAutoplay;
  63494. if (this.tech_) {
  63495. this.techCall_("setAutoplay", techAutoplay);
  63496. }
  63497. }
  63498. playsinline(value) {
  63499. if (value !== void 0) {
  63500. this.techCall_("setPlaysinline", value);
  63501. this.options_.playsinline = value;
  63502. return this;
  63503. }
  63504. return this.techGet_("playsinline");
  63505. }
  63506. loop(value) {
  63507. if (value !== void 0) {
  63508. this.techCall_("setLoop", value);
  63509. this.options_.loop = value;
  63510. return;
  63511. }
  63512. return this.techGet_("loop");
  63513. }
  63514. poster(src) {
  63515. if (src === void 0) {
  63516. return this.poster_;
  63517. }
  63518. if (!src) {
  63519. src = "";
  63520. }
  63521. if (src === this.poster_) {
  63522. return;
  63523. }
  63524. this.poster_ = src;
  63525. this.techCall_("setPoster", src);
  63526. this.isPosterFromTech_ = false;
  63527. this.trigger("posterchange");
  63528. }
  63529. handleTechPosterChange_() {
  63530. if ((!this.poster_ || this.options_.techCanOverridePoster) && this.tech_ && this.tech_.poster) {
  63531. const newPoster = this.tech_.poster() || "";
  63532. if (newPoster !== this.poster_) {
  63533. this.poster_ = newPoster;
  63534. this.isPosterFromTech_ = true;
  63535. this.trigger("posterchange");
  63536. }
  63537. }
  63538. }
  63539. controls(bool) {
  63540. if (bool === void 0) {
  63541. return !!this.controls_;
  63542. }
  63543. bool = !!bool;
  63544. if (this.controls_ === bool) {
  63545. return;
  63546. }
  63547. this.controls_ = bool;
  63548. if (this.usingNativeControls()) {
  63549. this.techCall_("setControls", bool);
  63550. }
  63551. if (this.controls_) {
  63552. this.removeClass("vjs-controls-disabled");
  63553. this.addClass("vjs-controls-enabled");
  63554. this.trigger("controlsenabled");
  63555. if (!this.usingNativeControls()) {
  63556. this.addTechControlsListeners_();
  63557. }
  63558. } else {
  63559. this.removeClass("vjs-controls-enabled");
  63560. this.addClass("vjs-controls-disabled");
  63561. this.trigger("controlsdisabled");
  63562. if (!this.usingNativeControls()) {
  63563. this.removeTechControlsListeners_();
  63564. }
  63565. }
  63566. }
  63567. usingNativeControls(bool) {
  63568. if (bool === void 0) {
  63569. return !!this.usingNativeControls_;
  63570. }
  63571. bool = !!bool;
  63572. if (this.usingNativeControls_ === bool) {
  63573. return;
  63574. }
  63575. this.usingNativeControls_ = bool;
  63576. if (this.usingNativeControls_) {
  63577. this.addClass("vjs-using-native-controls");
  63578. this.trigger("usingnativecontrols");
  63579. } else {
  63580. this.removeClass("vjs-using-native-controls");
  63581. this.trigger("usingcustomcontrols");
  63582. }
  63583. }
  63584. error(err) {
  63585. if (err === void 0) {
  63586. return this.error_ || null;
  63587. }
  63588. hooks$1("beforeerror").forEach((hookFunction) => {
  63589. const newErr = hookFunction(this, err);
  63590. if (!(isObject$2(newErr) && !Array.isArray(newErr) || typeof newErr === "string" || typeof newErr === "number" || newErr === null)) {
  63591. this.log.error("please return a value that MediaError expects in beforeerror hooks");
  63592. return;
  63593. }
  63594. err = newErr;
  63595. });
  63596. if (this.options_.suppressNotSupportedError && err && err.code === 4) {
  63597. const triggerSuppressedError = function() {
  63598. this.error(err);
  63599. };
  63600. this.options_.suppressNotSupportedError = false;
  63601. this.any(["click", "touchstart"], triggerSuppressedError);
  63602. this.one("loadstart", function() {
  63603. this.off(["click", "touchstart"], triggerSuppressedError);
  63604. });
  63605. return;
  63606. }
  63607. if (err === null) {
  63608. this.error_ = err;
  63609. this.removeClass("vjs-error");
  63610. if (this.errorDisplay) {
  63611. this.errorDisplay.close();
  63612. }
  63613. return;
  63614. }
  63615. this.error_ = new MediaError$1(err);
  63616. this.addClass("vjs-error");
  63617. log$1$1.error(`(CODE:${this.error_.code} ${MediaError$1.errorTypes[this.error_.code]})`, this.error_.message, this.error_);
  63618. this.trigger("error");
  63619. hooks$1("error").forEach((hookFunction) => hookFunction(this, this.error_));
  63620. return;
  63621. }
  63622. reportUserActivity(event2) {
  63623. this.userActivity_ = true;
  63624. }
  63625. userActive(bool) {
  63626. if (bool === void 0) {
  63627. return this.userActive_;
  63628. }
  63629. bool = !!bool;
  63630. if (bool === this.userActive_) {
  63631. return;
  63632. }
  63633. this.userActive_ = bool;
  63634. if (this.userActive_) {
  63635. this.userActivity_ = true;
  63636. this.removeClass("vjs-user-inactive");
  63637. this.addClass("vjs-user-active");
  63638. this.trigger("useractive");
  63639. return;
  63640. }
  63641. if (this.tech_) {
  63642. this.tech_.one("mousemove", function(e) {
  63643. e.stopPropagation();
  63644. e.preventDefault();
  63645. });
  63646. }
  63647. this.userActivity_ = false;
  63648. this.removeClass("vjs-user-active");
  63649. this.addClass("vjs-user-inactive");
  63650. this.trigger("userinactive");
  63651. }
  63652. listenForUserActivity_() {
  63653. let mouseInProgress;
  63654. let lastMoveX;
  63655. let lastMoveY;
  63656. const handleActivity = bind_(this, this.reportUserActivity);
  63657. const handleMouseMove = function(e) {
  63658. if (e.screenX !== lastMoveX || e.screenY !== lastMoveY) {
  63659. lastMoveX = e.screenX;
  63660. lastMoveY = e.screenY;
  63661. handleActivity();
  63662. }
  63663. };
  63664. const handleMouseDown = function() {
  63665. handleActivity();
  63666. this.clearInterval(mouseInProgress);
  63667. mouseInProgress = this.setInterval(handleActivity, 250);
  63668. };
  63669. const handleMouseUpAndMouseLeave = function(event2) {
  63670. handleActivity();
  63671. this.clearInterval(mouseInProgress);
  63672. };
  63673. this.on("mousedown", handleMouseDown);
  63674. this.on("mousemove", handleMouseMove);
  63675. this.on("mouseup", handleMouseUpAndMouseLeave);
  63676. this.on("mouseleave", handleMouseUpAndMouseLeave);
  63677. const controlBar = this.getChild("controlBar");
  63678. if (controlBar && !IS_IOS$1 && !IS_ANDROID$1) {
  63679. controlBar.on("mouseenter", function(event2) {
  63680. if (this.player().options_.inactivityTimeout !== 0) {
  63681. this.player().cache_.inactivityTimeout = this.player().options_.inactivityTimeout;
  63682. }
  63683. this.player().options_.inactivityTimeout = 0;
  63684. });
  63685. controlBar.on("mouseleave", function(event2) {
  63686. this.player().options_.inactivityTimeout = this.player().cache_.inactivityTimeout;
  63687. });
  63688. }
  63689. this.on("keydown", handleActivity);
  63690. this.on("keyup", handleActivity);
  63691. let inactivityTimeout;
  63692. this.setInterval(function() {
  63693. if (!this.userActivity_) {
  63694. return;
  63695. }
  63696. this.userActivity_ = false;
  63697. this.userActive(true);
  63698. this.clearTimeout(inactivityTimeout);
  63699. const timeout = this.options_.inactivityTimeout;
  63700. if (timeout <= 0) {
  63701. return;
  63702. }
  63703. inactivityTimeout = this.setTimeout(function() {
  63704. if (!this.userActivity_) {
  63705. this.userActive(false);
  63706. }
  63707. }, timeout);
  63708. }, 250);
  63709. }
  63710. playbackRate(rate) {
  63711. if (rate !== void 0) {
  63712. this.techCall_("setPlaybackRate", rate);
  63713. return;
  63714. }
  63715. if (this.tech_ && this.tech_.featuresPlaybackRate) {
  63716. return this.cache_.lastPlaybackRate || this.techGet_("playbackRate");
  63717. }
  63718. return 1;
  63719. }
  63720. defaultPlaybackRate(rate) {
  63721. if (rate !== void 0) {
  63722. return this.techCall_("setDefaultPlaybackRate", rate);
  63723. }
  63724. if (this.tech_ && this.tech_.featuresPlaybackRate) {
  63725. return this.techGet_("defaultPlaybackRate");
  63726. }
  63727. return 1;
  63728. }
  63729. isAudio(bool) {
  63730. if (bool !== void 0) {
  63731. this.isAudio_ = !!bool;
  63732. return;
  63733. }
  63734. return !!this.isAudio_;
  63735. }
  63736. enableAudioOnlyUI_() {
  63737. this.addClass("vjs-audio-only-mode");
  63738. const playerChildren = this.children();
  63739. const controlBar = this.getChild("ControlBar");
  63740. const controlBarHeight = controlBar && controlBar.currentHeight();
  63741. playerChildren.forEach((child) => {
  63742. if (child === controlBar) {
  63743. return;
  63744. }
  63745. if (child.el_ && !child.hasClass("vjs-hidden")) {
  63746. child.hide();
  63747. this.audioOnlyCache_.hiddenChildren.push(child);
  63748. }
  63749. });
  63750. this.audioOnlyCache_.playerHeight = this.currentHeight();
  63751. this.height(controlBarHeight);
  63752. this.trigger("audioonlymodechange");
  63753. }
  63754. disableAudioOnlyUI_() {
  63755. this.removeClass("vjs-audio-only-mode");
  63756. this.audioOnlyCache_.hiddenChildren.forEach((child) => child.show());
  63757. this.height(this.audioOnlyCache_.playerHeight);
  63758. this.trigger("audioonlymodechange");
  63759. }
  63760. audioOnlyMode(value) {
  63761. if (typeof value !== "boolean" || value === this.audioOnlyMode_) {
  63762. return this.audioOnlyMode_;
  63763. }
  63764. this.audioOnlyMode_ = value;
  63765. if (value) {
  63766. const exitPromises = [];
  63767. if (this.isInPictureInPicture()) {
  63768. exitPromises.push(this.exitPictureInPicture());
  63769. }
  63770. if (this.isFullscreen()) {
  63771. exitPromises.push(this.exitFullscreen());
  63772. }
  63773. if (this.audioPosterMode()) {
  63774. exitPromises.push(this.audioPosterMode(false));
  63775. }
  63776. return Promise.all(exitPromises).then(() => this.enableAudioOnlyUI_());
  63777. }
  63778. return Promise.resolve().then(() => this.disableAudioOnlyUI_());
  63779. }
  63780. enablePosterModeUI_() {
  63781. const tech = this.tech_ && this.tech_;
  63782. tech.hide();
  63783. this.addClass("vjs-audio-poster-mode");
  63784. this.trigger("audiopostermodechange");
  63785. }
  63786. disablePosterModeUI_() {
  63787. const tech = this.tech_ && this.tech_;
  63788. tech.show();
  63789. this.removeClass("vjs-audio-poster-mode");
  63790. this.trigger("audiopostermodechange");
  63791. }
  63792. audioPosterMode(value) {
  63793. if (typeof value !== "boolean" || value === this.audioPosterMode_) {
  63794. return this.audioPosterMode_;
  63795. }
  63796. this.audioPosterMode_ = value;
  63797. if (value) {
  63798. if (this.audioOnlyMode()) {
  63799. const audioOnlyModePromise = this.audioOnlyMode(false);
  63800. return audioOnlyModePromise.then(() => {
  63801. this.enablePosterModeUI_();
  63802. });
  63803. }
  63804. return Promise.resolve().then(() => {
  63805. this.enablePosterModeUI_();
  63806. });
  63807. }
  63808. return Promise.resolve().then(() => {
  63809. this.disablePosterModeUI_();
  63810. });
  63811. }
  63812. addTextTrack(kind, label, language) {
  63813. if (this.tech_) {
  63814. return this.tech_.addTextTrack(kind, label, language);
  63815. }
  63816. }
  63817. addRemoteTextTrack(options2, manualCleanup) {
  63818. if (this.tech_) {
  63819. return this.tech_.addRemoteTextTrack(options2, manualCleanup);
  63820. }
  63821. }
  63822. removeRemoteTextTrack(obj = {}) {
  63823. let {
  63824. track
  63825. } = obj;
  63826. if (!track) {
  63827. track = obj;
  63828. }
  63829. if (this.tech_) {
  63830. return this.tech_.removeRemoteTextTrack(track);
  63831. }
  63832. }
  63833. getVideoPlaybackQuality() {
  63834. return this.techGet_("getVideoPlaybackQuality");
  63835. }
  63836. videoWidth() {
  63837. return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0;
  63838. }
  63839. videoHeight() {
  63840. return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0;
  63841. }
  63842. language(code) {
  63843. if (code === void 0) {
  63844. return this.language_;
  63845. }
  63846. if (this.language_ !== String(code).toLowerCase()) {
  63847. this.language_ = String(code).toLowerCase();
  63848. if (isEvented$1(this)) {
  63849. this.trigger("languagechange");
  63850. }
  63851. }
  63852. }
  63853. languages() {
  63854. return merge$1(Player$1.prototype.options_.languages, this.languages_);
  63855. }
  63856. toJSON() {
  63857. const options2 = merge$1(this.options_);
  63858. const tracks = options2.tracks;
  63859. options2.tracks = [];
  63860. for (let i2 = 0; i2 < tracks.length; i2++) {
  63861. let track = tracks[i2];
  63862. track = merge$1(track);
  63863. track.player = void 0;
  63864. options2.tracks[i2] = track;
  63865. }
  63866. return options2;
  63867. }
  63868. createModal(content, options2) {
  63869. options2 = options2 || {};
  63870. options2.content = content || "";
  63871. const modal = new ModalDialog$1(this, options2);
  63872. this.addChild(modal);
  63873. modal.on("dispose", () => {
  63874. this.removeChild(modal);
  63875. });
  63876. modal.open();
  63877. return modal;
  63878. }
  63879. updateCurrentBreakpoint_() {
  63880. if (!this.responsive()) {
  63881. return;
  63882. }
  63883. const currentBreakpoint = this.currentBreakpoint();
  63884. const currentWidth = this.currentWidth();
  63885. for (let i2 = 0; i2 < BREAKPOINT_ORDER$1.length; i2++) {
  63886. const candidateBreakpoint = BREAKPOINT_ORDER$1[i2];
  63887. const maxWidth = this.breakpoints_[candidateBreakpoint];
  63888. if (currentWidth <= maxWidth) {
  63889. if (currentBreakpoint === candidateBreakpoint) {
  63890. return;
  63891. }
  63892. if (currentBreakpoint) {
  63893. this.removeClass(BREAKPOINT_CLASSES$1[currentBreakpoint]);
  63894. }
  63895. this.addClass(BREAKPOINT_CLASSES$1[candidateBreakpoint]);
  63896. this.breakpoint_ = candidateBreakpoint;
  63897. break;
  63898. }
  63899. }
  63900. }
  63901. removeCurrentBreakpoint_() {
  63902. const className = this.currentBreakpointClass();
  63903. this.breakpoint_ = "";
  63904. if (className) {
  63905. this.removeClass(className);
  63906. }
  63907. }
  63908. breakpoints(breakpoints) {
  63909. if (breakpoints === void 0) {
  63910. return Object.assign(this.breakpoints_);
  63911. }
  63912. this.breakpoint_ = "";
  63913. this.breakpoints_ = Object.assign({}, DEFAULT_BREAKPOINTS$1, breakpoints);
  63914. this.updateCurrentBreakpoint_();
  63915. return Object.assign(this.breakpoints_);
  63916. }
  63917. responsive(value) {
  63918. if (value === void 0) {
  63919. return this.responsive_;
  63920. }
  63921. value = Boolean(value);
  63922. const current = this.responsive_;
  63923. if (value === current) {
  63924. return;
  63925. }
  63926. this.responsive_ = value;
  63927. if (value) {
  63928. this.on("playerresize", this.boundUpdateCurrentBreakpoint_);
  63929. this.updateCurrentBreakpoint_();
  63930. } else {
  63931. this.off("playerresize", this.boundUpdateCurrentBreakpoint_);
  63932. this.removeCurrentBreakpoint_();
  63933. }
  63934. return value;
  63935. }
  63936. currentBreakpoint() {
  63937. return this.breakpoint_;
  63938. }
  63939. currentBreakpointClass() {
  63940. return BREAKPOINT_CLASSES$1[this.breakpoint_] || "";
  63941. }
  63942. loadMedia(media, ready) {
  63943. if (!media || typeof media !== "object") {
  63944. return;
  63945. }
  63946. this.reset();
  63947. this.cache_.media = merge$1(media);
  63948. const {
  63949. artist,
  63950. artwork,
  63951. description,
  63952. poster,
  63953. src,
  63954. textTracks,
  63955. title
  63956. } = this.cache_.media;
  63957. if (!artwork && poster) {
  63958. this.cache_.media.artwork = [{
  63959. src: poster,
  63960. type: getMimetype$1(poster)
  63961. }];
  63962. }
  63963. if (src) {
  63964. this.src(src);
  63965. }
  63966. if (poster) {
  63967. this.poster(poster);
  63968. }
  63969. if (Array.isArray(textTracks)) {
  63970. textTracks.forEach((tt2) => this.addRemoteTextTrack(tt2, false));
  63971. }
  63972. if (this.titleBar) {
  63973. this.titleBar.update({
  63974. title,
  63975. description: description || artist || ""
  63976. });
  63977. }
  63978. this.ready(ready);
  63979. }
  63980. getMedia() {
  63981. if (!this.cache_.media) {
  63982. const poster = this.poster();
  63983. const src = this.currentSources();
  63984. const textTracks = Array.prototype.map.call(this.remoteTextTracks(), (tt2) => ({
  63985. kind: tt2.kind,
  63986. label: tt2.label,
  63987. language: tt2.language,
  63988. src: tt2.src
  63989. }));
  63990. const media = {
  63991. src,
  63992. textTracks
  63993. };
  63994. if (poster) {
  63995. media.poster = poster;
  63996. media.artwork = [{
  63997. src: media.poster,
  63998. type: getMimetype$1(media.poster)
  63999. }];
  64000. }
  64001. return media;
  64002. }
  64003. return merge$1(this.cache_.media);
  64004. }
  64005. static getTagSettings(tag) {
  64006. const baseOptions = {
  64007. sources: [],
  64008. tracks: []
  64009. };
  64010. const tagOptions = getAttributes$1(tag);
  64011. const dataSetup = tagOptions["data-setup"];
  64012. if (hasClass$1(tag, "vjs-fill")) {
  64013. tagOptions.fill = true;
  64014. }
  64015. if (hasClass$1(tag, "vjs-fluid")) {
  64016. tagOptions.fluid = true;
  64017. }
  64018. if (dataSetup !== null) {
  64019. const [err, data] = tuple(dataSetup || "{}");
  64020. if (err) {
  64021. log$1$1.error(err);
  64022. }
  64023. Object.assign(tagOptions, data);
  64024. }
  64025. Object.assign(baseOptions, tagOptions);
  64026. if (tag.hasChildNodes()) {
  64027. const children = tag.childNodes;
  64028. for (let i2 = 0, j = children.length; i2 < j; i2++) {
  64029. const child = children[i2];
  64030. const childName = child.nodeName.toLowerCase();
  64031. if (childName === "source") {
  64032. baseOptions.sources.push(getAttributes$1(child));
  64033. } else if (childName === "track") {
  64034. baseOptions.tracks.push(getAttributes$1(child));
  64035. }
  64036. }
  64037. }
  64038. return baseOptions;
  64039. }
  64040. debug(enabled) {
  64041. if (enabled === void 0) {
  64042. return this.debugEnabled_;
  64043. }
  64044. if (enabled) {
  64045. this.trigger("debugon");
  64046. this.previousLogLevel_ = this.log.level;
  64047. this.log.level("debug");
  64048. this.debugEnabled_ = true;
  64049. } else {
  64050. this.trigger("debugoff");
  64051. this.log.level(this.previousLogLevel_);
  64052. this.previousLogLevel_ = void 0;
  64053. this.debugEnabled_ = false;
  64054. }
  64055. }
  64056. playbackRates(newRates) {
  64057. if (newRates === void 0) {
  64058. return this.cache_.playbackRates;
  64059. }
  64060. if (!Array.isArray(newRates)) {
  64061. return;
  64062. }
  64063. if (!newRates.every((rate) => typeof rate === "number")) {
  64064. return;
  64065. }
  64066. this.cache_.playbackRates = newRates;
  64067. this.trigger("playbackrateschange");
  64068. }
  64069. }
  64070. ALL$1.names.forEach(function(name) {
  64071. const props = ALL$1[name];
  64072. Player$1.prototype[props.getterName] = function() {
  64073. if (this.tech_) {
  64074. return this.tech_[props.getterName]();
  64075. }
  64076. this[props.privateName] = this[props.privateName] || new props.ListClass();
  64077. return this[props.privateName];
  64078. };
  64079. });
  64080. Player$1.prototype.crossorigin = Player$1.prototype.crossOrigin;
  64081. Player$1.players = {};
  64082. const navigator$3 = window_1.navigator;
  64083. Player$1.prototype.options_ = {
  64084. techOrder: Tech$2.defaultTechOrder_,
  64085. html5: {},
  64086. enableSourceset: true,
  64087. inactivityTimeout: 2e3,
  64088. playbackRates: [],
  64089. liveui: false,
  64090. children: ["mediaLoader", "posterImage", "titleBar", "textTrackDisplay", "loadingSpinner", "bigPlayButton", "liveTracker", "controlBar", "errorDisplay", "textTrackSettings", "resizeManager"],
  64091. language: navigator$3 && (navigator$3.languages && navigator$3.languages[0] || navigator$3.userLanguage || navigator$3.language) || "en",
  64092. languages: {},
  64093. notSupportedMessage: "No compatible source was found for this media.",
  64094. normalizeAutoplay: false,
  64095. fullscreen: {
  64096. options: {
  64097. navigationUI: "hide"
  64098. }
  64099. },
  64100. breakpoints: {},
  64101. responsive: false,
  64102. audioOnlyMode: false,
  64103. audioPosterMode: false
  64104. };
  64105. [
  64106. "ended",
  64107. "seeking",
  64108. "seekable",
  64109. "networkState",
  64110. "readyState"
  64111. ].forEach(function(fn2) {
  64112. Player$1.prototype[fn2] = function() {
  64113. return this.techGet_(fn2);
  64114. };
  64115. });
  64116. TECH_EVENTS_RETRIGGER$1.forEach(function(event2) {
  64117. Player$1.prototype[`handleTech${toTitleCase$1$1(event2)}_`] = function() {
  64118. return this.trigger(event2);
  64119. };
  64120. });
  64121. Component$1$1.registerComponent("Player", Player$1);
  64122. const BASE_PLUGIN_NAME$1 = "plugin";
  64123. const PLUGIN_CACHE_KEY$1 = "activePlugins_";
  64124. const pluginStorage$1 = {};
  64125. const pluginExists$1 = (name) => pluginStorage$1.hasOwnProperty(name);
  64126. const getPlugin$1 = (name) => pluginExists$1(name) ? pluginStorage$1[name] : void 0;
  64127. const markPluginAsActive$1 = (player, name) => {
  64128. player[PLUGIN_CACHE_KEY$1] = player[PLUGIN_CACHE_KEY$1] || {};
  64129. player[PLUGIN_CACHE_KEY$1][name] = true;
  64130. };
  64131. const triggerSetupEvent$1 = (player, hash, before) => {
  64132. const eventName = (before ? "before" : "") + "pluginsetup";
  64133. player.trigger(eventName, hash);
  64134. player.trigger(eventName + ":" + hash.name, hash);
  64135. };
  64136. const createBasicPlugin$1 = function(name, plugin) {
  64137. const basicPluginWrapper = function() {
  64138. triggerSetupEvent$1(this, {
  64139. name,
  64140. plugin,
  64141. instance: null
  64142. }, true);
  64143. const instance = plugin.apply(this, arguments);
  64144. markPluginAsActive$1(this, name);
  64145. triggerSetupEvent$1(this, {
  64146. name,
  64147. plugin,
  64148. instance
  64149. });
  64150. return instance;
  64151. };
  64152. Object.keys(plugin).forEach(function(prop) {
  64153. basicPluginWrapper[prop] = plugin[prop];
  64154. });
  64155. return basicPluginWrapper;
  64156. };
  64157. const createPluginFactory$1 = (name, PluginSubClass) => {
  64158. PluginSubClass.prototype.name = name;
  64159. return function(...args) {
  64160. triggerSetupEvent$1(this, {
  64161. name,
  64162. plugin: PluginSubClass,
  64163. instance: null
  64164. }, true);
  64165. const instance = new PluginSubClass(...[this, ...args]);
  64166. this[name] = () => instance;
  64167. triggerSetupEvent$1(this, instance.getEventHash());
  64168. return instance;
  64169. };
  64170. };
  64171. class Plugin$1 {
  64172. constructor(player) {
  64173. if (this.constructor === Plugin$1) {
  64174. throw new Error("Plugin must be sub-classed; not directly instantiated.");
  64175. }
  64176. this.player = player;
  64177. if (!this.log) {
  64178. this.log = this.player.log.createLogger(this.name);
  64179. }
  64180. evented$1(this);
  64181. delete this.trigger;
  64182. stateful$1(this, this.constructor.defaultState);
  64183. markPluginAsActive$1(player, this.name);
  64184. this.dispose = this.dispose.bind(this);
  64185. player.on("dispose", this.dispose);
  64186. }
  64187. version() {
  64188. return this.constructor.VERSION;
  64189. }
  64190. getEventHash(hash = {}) {
  64191. hash.name = this.name;
  64192. hash.plugin = this.constructor;
  64193. hash.instance = this;
  64194. return hash;
  64195. }
  64196. trigger(event2, hash = {}) {
  64197. return trigger$1(this.eventBusEl_, event2, this.getEventHash(hash));
  64198. }
  64199. handleStateChanged(e) {
  64200. }
  64201. dispose() {
  64202. const {
  64203. name,
  64204. player
  64205. } = this;
  64206. this.trigger("dispose");
  64207. this.off();
  64208. player.off("dispose", this.dispose);
  64209. player[PLUGIN_CACHE_KEY$1][name] = false;
  64210. this.player = this.state = null;
  64211. player[name] = createPluginFactory$1(name, pluginStorage$1[name]);
  64212. }
  64213. static isBasic(plugin) {
  64214. const p = typeof plugin === "string" ? getPlugin$1(plugin) : plugin;
  64215. return typeof p === "function" && !Plugin$1.prototype.isPrototypeOf(p.prototype);
  64216. }
  64217. static registerPlugin(name, plugin) {
  64218. if (typeof name !== "string") {
  64219. throw new Error(`Illegal plugin name, "${name}", must be a string, was ${typeof name}.`);
  64220. }
  64221. if (pluginExists$1(name)) {
  64222. log$1$1.warn(`A plugin named "${name}" already exists. You may want to avoid re-registering plugins!`);
  64223. } else if (Player$1.prototype.hasOwnProperty(name)) {
  64224. throw new Error(`Illegal plugin name, "${name}", cannot share a name with an existing player method!`);
  64225. }
  64226. if (typeof plugin !== "function") {
  64227. throw new Error(`Illegal plugin for "${name}", must be a function, was ${typeof plugin}.`);
  64228. }
  64229. pluginStorage$1[name] = plugin;
  64230. if (name !== BASE_PLUGIN_NAME$1) {
  64231. if (Plugin$1.isBasic(plugin)) {
  64232. Player$1.prototype[name] = createBasicPlugin$1(name, plugin);
  64233. } else {
  64234. Player$1.prototype[name] = createPluginFactory$1(name, plugin);
  64235. }
  64236. }
  64237. return plugin;
  64238. }
  64239. static deregisterPlugin(name) {
  64240. if (name === BASE_PLUGIN_NAME$1) {
  64241. throw new Error("Cannot de-register base plugin.");
  64242. }
  64243. if (pluginExists$1(name)) {
  64244. delete pluginStorage$1[name];
  64245. delete Player$1.prototype[name];
  64246. }
  64247. }
  64248. static getPlugins(names2 = Object.keys(pluginStorage$1)) {
  64249. let result;
  64250. names2.forEach((name) => {
  64251. const plugin = getPlugin$1(name);
  64252. if (plugin) {
  64253. result = result || {};
  64254. result[name] = plugin;
  64255. }
  64256. });
  64257. return result;
  64258. }
  64259. static getPluginVersion(name) {
  64260. const plugin = getPlugin$1(name);
  64261. return plugin && plugin.VERSION || "";
  64262. }
  64263. }
  64264. Plugin$1.getPlugin = getPlugin$1;
  64265. Plugin$1.BASE_PLUGIN_NAME = BASE_PLUGIN_NAME$1;
  64266. Plugin$1.registerPlugin(BASE_PLUGIN_NAME$1, Plugin$1);
  64267. Player$1.prototype.usingPlugin = function(name) {
  64268. return !!this[PLUGIN_CACHE_KEY$1] && this[PLUGIN_CACHE_KEY$1][name] === true;
  64269. };
  64270. Player$1.prototype.hasPlugin = function(name) {
  64271. return !!pluginExists$1(name);
  64272. };
  64273. function deprecate(message, fn2) {
  64274. let warned = false;
  64275. return function(...args) {
  64276. if (!warned) {
  64277. log$1$1.warn(message);
  64278. }
  64279. warned = true;
  64280. return fn2.apply(this, args);
  64281. };
  64282. }
  64283. function deprecateForMajor(major, oldName, newName, fn2) {
  64284. return deprecate(`${oldName} is deprecated and will be removed in ${major}.0; please use ${newName} instead.`, fn2);
  64285. }
  64286. const normalizeId$1 = (id) => id.indexOf("#") === 0 ? id.slice(1) : id;
  64287. function videojs$2(id, options2, ready) {
  64288. let player = videojs$2.getPlayer(id);
  64289. if (player) {
  64290. if (options2) {
  64291. log$1$1.warn(`Player "${id}" is already initialised. Options will not be applied.`);
  64292. }
  64293. if (ready) {
  64294. player.ready(ready);
  64295. }
  64296. return player;
  64297. }
  64298. const el = typeof id === "string" ? $$1("#" + normalizeId$1(id)) : id;
  64299. if (!isEl$1(el)) {
  64300. throw new TypeError("The element or ID supplied is not valid. (videojs)");
  64301. }
  64302. if (!el.ownerDocument.defaultView || !el.ownerDocument.body.contains(el)) {
  64303. log$1$1.warn("The element supplied is not included in the DOM");
  64304. }
  64305. options2 = options2 || {};
  64306. if (options2.restoreEl === true) {
  64307. options2.restoreEl = (el.parentNode && el.parentNode.hasAttribute("data-vjs-player") ? el.parentNode : el).cloneNode(true);
  64308. }
  64309. hooks$1("beforesetup").forEach((hookFunction) => {
  64310. const opts = hookFunction(el, merge$1(options2));
  64311. if (!isObject$2(opts) || Array.isArray(opts)) {
  64312. log$1$1.error("please return an object in beforesetup hooks");
  64313. return;
  64314. }
  64315. options2 = merge$1(options2, opts);
  64316. });
  64317. const PlayerComponent = Component$1$1.getComponent("Player");
  64318. player = new PlayerComponent(el, options2, ready);
  64319. hooks$1("setup").forEach((hookFunction) => hookFunction(player));
  64320. return player;
  64321. }
  64322. videojs$2.hooks_ = hooks_$1;
  64323. videojs$2.hooks = hooks$1;
  64324. videojs$2.hook = hook$1;
  64325. videojs$2.hookOnce = hookOnce$1;
  64326. videojs$2.removeHook = removeHook$1;
  64327. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true && isReal$1()) {
  64328. let style = $$1(".vjs-styles-defaults");
  64329. if (!style) {
  64330. style = createStyleElement$1("vjs-styles-defaults");
  64331. const head = $$1("head");
  64332. if (head) {
  64333. head.insertBefore(style, head.firstChild);
  64334. }
  64335. setTextContent$1(style, `
  64336. .video-js {
  64337. width: 300px;
  64338. height: 150px;
  64339. }
  64340. .vjs-fluid:not(.vjs-audio-only-mode) {
  64341. padding-top: 56.25%
  64342. }
  64343. `);
  64344. }
  64345. }
  64346. autoSetupTimeout$1(1, videojs$2);
  64347. videojs$2.VERSION = version$6$1;
  64348. videojs$2.options = Player$1.prototype.options_;
  64349. videojs$2.getPlayers = () => Player$1.players;
  64350. videojs$2.getPlayer = (id) => {
  64351. const players = Player$1.players;
  64352. let tag;
  64353. if (typeof id === "string") {
  64354. const nId = normalizeId$1(id);
  64355. const player = players[nId];
  64356. if (player) {
  64357. return player;
  64358. }
  64359. tag = $$1("#" + nId);
  64360. } else {
  64361. tag = id;
  64362. }
  64363. if (isEl$1(tag)) {
  64364. const {
  64365. player,
  64366. playerId
  64367. } = tag;
  64368. if (player || players[playerId]) {
  64369. return player || players[playerId];
  64370. }
  64371. }
  64372. };
  64373. videojs$2.getAllPlayers = () => Object.keys(Player$1.players).map((k) => Player$1.players[k]).filter(Boolean);
  64374. videojs$2.players = Player$1.players;
  64375. videojs$2.getComponent = Component$1$1.getComponent;
  64376. videojs$2.registerComponent = (name, comp) => {
  64377. if (Tech$2.isTech(comp)) {
  64378. log$1$1.warn(`The ${name} tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)`);
  64379. }
  64380. Component$1$1.registerComponent.call(Component$1$1, name, comp);
  64381. };
  64382. videojs$2.getTech = Tech$2.getTech;
  64383. videojs$2.registerTech = Tech$2.registerTech;
  64384. videojs$2.use = use$1;
  64385. Object.defineProperty(videojs$2, "middleware", {
  64386. value: {},
  64387. writeable: false,
  64388. enumerable: true
  64389. });
  64390. Object.defineProperty(videojs$2.middleware, "TERMINATOR", {
  64391. value: TERMINATOR$1,
  64392. writeable: false,
  64393. enumerable: true
  64394. });
  64395. videojs$2.browser = browser$1;
  64396. videojs$2.obj = Obj;
  64397. videojs$2.mergeOptions = deprecateForMajor(9, "videojs.mergeOptions", "videojs.obj.merge", merge$1);
  64398. videojs$2.defineLazyProperty = deprecateForMajor(9, "videojs.defineLazyProperty", "videojs.obj.defineLazyProperty", defineLazyProperty$1);
  64399. videojs$2.bind = deprecateForMajor(9, "videojs.bind", "native Function.prototype.bind", bind_);
  64400. videojs$2.registerPlugin = Plugin$1.registerPlugin;
  64401. videojs$2.deregisterPlugin = Plugin$1.deregisterPlugin;
  64402. videojs$2.plugin = (name, plugin) => {
  64403. log$1$1.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead");
  64404. return Plugin$1.registerPlugin(name, plugin);
  64405. };
  64406. videojs$2.getPlugins = Plugin$1.getPlugins;
  64407. videojs$2.getPlugin = Plugin$1.getPlugin;
  64408. videojs$2.getPluginVersion = Plugin$1.getPluginVersion;
  64409. videojs$2.addLanguage = function(code, data) {
  64410. code = ("" + code).toLowerCase();
  64411. videojs$2.options.languages = merge$1(videojs$2.options.languages, {
  64412. [code]: data
  64413. });
  64414. return videojs$2.options.languages[code];
  64415. };
  64416. videojs$2.log = log$1$1;
  64417. videojs$2.createLogger = createLogger$2;
  64418. videojs$2.time = Time;
  64419. videojs$2.createTimeRange = deprecateForMajor(9, "videojs.createTimeRange", "videojs.time.createTimeRanges", createTimeRanges$1);
  64420. videojs$2.createTimeRanges = deprecateForMajor(9, "videojs.createTimeRanges", "videojs.time.createTimeRanges", createTimeRanges$1);
  64421. videojs$2.formatTime = deprecateForMajor(9, "videojs.formatTime", "videojs.time.formatTime", formatTime$1);
  64422. videojs$2.setFormatTime = deprecateForMajor(9, "videojs.setFormatTime", "videojs.time.setFormatTime", setFormatTime$1);
  64423. videojs$2.resetFormatTime = deprecateForMajor(9, "videojs.resetFormatTime", "videojs.time.resetFormatTime", resetFormatTime$1);
  64424. videojs$2.parseUrl = deprecateForMajor(9, "videojs.parseUrl", "videojs.url.parseUrl", parseUrl$1);
  64425. videojs$2.isCrossOrigin = deprecateForMajor(9, "videojs.isCrossOrigin", "videojs.url.isCrossOrigin", isCrossOrigin$1);
  64426. videojs$2.EventTarget = EventTarget$2$1;
  64427. videojs$2.any = any$1;
  64428. videojs$2.on = on$1;
  64429. videojs$2.one = one$1;
  64430. videojs$2.off = off$1;
  64431. videojs$2.trigger = trigger$1;
  64432. videojs$2.xhr = XHR;
  64433. videojs$2.TextTrack = TextTrack$1;
  64434. videojs$2.AudioTrack = AudioTrack$1;
  64435. videojs$2.VideoTrack = VideoTrack$1;
  64436. ["isEl", "isTextNode", "createEl", "hasClass", "addClass", "removeClass", "toggleClass", "setAttributes", "getAttributes", "emptyEl", "appendContent", "insertContent"].forEach((k) => {
  64437. videojs$2[k] = function() {
  64438. log$1$1.warn(`videojs.${k}() is deprecated; use videojs.dom.${k}() instead`);
  64439. return Dom$2[k].apply(null, arguments);
  64440. };
  64441. });
  64442. videojs$2.computedStyle = deprecateForMajor(9, "videojs.computedStyle", "videojs.dom.computedStyle", computedStyle$1);
  64443. videojs$2.dom = Dom$2;
  64444. videojs$2.fn = Fn;
  64445. videojs$2.num = Num;
  64446. videojs$2.str = Str;
  64447. videojs$2.url = Url$2;
  64448. /*! @name videojs-contrib-quality-levels @version 3.0.0 @license Apache-2.0 */
  64449. class QualityLevel {
  64450. constructor(representation) {
  64451. let level = this;
  64452. level.id = representation.id;
  64453. level.label = level.id;
  64454. level.width = representation.width;
  64455. level.height = representation.height;
  64456. level.bitrate = representation.bandwidth;
  64457. level.frameRate = representation.frameRate;
  64458. level.enabled_ = representation.enabled;
  64459. Object.defineProperty(level, "enabled", {
  64460. get() {
  64461. return level.enabled_();
  64462. },
  64463. set(enable) {
  64464. level.enabled_(enable);
  64465. }
  64466. });
  64467. return level;
  64468. }
  64469. }
  64470. class QualityLevelList extends videojs$2.EventTarget {
  64471. constructor() {
  64472. super();
  64473. let list = this;
  64474. list.levels_ = [];
  64475. list.selectedIndex_ = -1;
  64476. Object.defineProperty(list, "selectedIndex", {
  64477. get() {
  64478. return list.selectedIndex_;
  64479. }
  64480. });
  64481. Object.defineProperty(list, "length", {
  64482. get() {
  64483. return list.levels_.length;
  64484. }
  64485. });
  64486. return list;
  64487. }
  64488. addQualityLevel(representation) {
  64489. let qualityLevel = this.getQualityLevelById(representation.id);
  64490. if (qualityLevel) {
  64491. return qualityLevel;
  64492. }
  64493. const index2 = this.levels_.length;
  64494. qualityLevel = new QualityLevel(representation);
  64495. if (!("" + index2 in this)) {
  64496. Object.defineProperty(this, index2, {
  64497. get() {
  64498. return this.levels_[index2];
  64499. }
  64500. });
  64501. }
  64502. this.levels_.push(qualityLevel);
  64503. this.trigger({
  64504. qualityLevel,
  64505. type: "addqualitylevel"
  64506. });
  64507. return qualityLevel;
  64508. }
  64509. removeQualityLevel(qualityLevel) {
  64510. let removed = null;
  64511. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  64512. if (this[i2] === qualityLevel) {
  64513. removed = this.levels_.splice(i2, 1)[0];
  64514. if (this.selectedIndex_ === i2) {
  64515. this.selectedIndex_ = -1;
  64516. } else if (this.selectedIndex_ > i2) {
  64517. this.selectedIndex_--;
  64518. }
  64519. break;
  64520. }
  64521. }
  64522. if (removed) {
  64523. this.trigger({
  64524. qualityLevel,
  64525. type: "removequalitylevel"
  64526. });
  64527. }
  64528. return removed;
  64529. }
  64530. getQualityLevelById(id) {
  64531. for (let i2 = 0, l = this.length; i2 < l; i2++) {
  64532. const level = this[i2];
  64533. if (level.id === id) {
  64534. return level;
  64535. }
  64536. }
  64537. return null;
  64538. }
  64539. dispose() {
  64540. this.selectedIndex_ = -1;
  64541. this.levels_.length = 0;
  64542. }
  64543. }
  64544. QualityLevelList.prototype.allowedEvents_ = {
  64545. change: "change",
  64546. addqualitylevel: "addqualitylevel",
  64547. removequalitylevel: "removequalitylevel"
  64548. };
  64549. for (const event2 in QualityLevelList.prototype.allowedEvents_) {
  64550. QualityLevelList.prototype["on" + event2] = null;
  64551. }
  64552. var version$5$1 = "3.0.0";
  64553. const registerPlugin$1 = videojs$2.registerPlugin || videojs$2.plugin;
  64554. const initPlugin$1 = function(player, options2) {
  64555. const originalPluginFn = player.qualityLevels;
  64556. const qualityLevelList = new QualityLevelList();
  64557. const disposeHandler = function() {
  64558. qualityLevelList.dispose();
  64559. player.qualityLevels = originalPluginFn;
  64560. player.off("dispose", disposeHandler);
  64561. };
  64562. player.on("dispose", disposeHandler);
  64563. player.qualityLevels = () => qualityLevelList;
  64564. player.qualityLevels.VERSION = version$5$1;
  64565. return qualityLevelList;
  64566. };
  64567. const qualityLevels = function(options2) {
  64568. return initPlugin$1(this, videojs$2.mergeOptions({}, options2));
  64569. };
  64570. registerPlugin$1("qualityLevels", qualityLevels);
  64571. qualityLevels.VERSION = version$5$1;
  64572. /*! @name @videojs/http-streaming @version 3.0.2 @license Apache-2.0 */
  64573. const resolveUrl$2 = resolveUrl$4;
  64574. const resolveManifestRedirect$1 = (url, req) => {
  64575. if (req && req.responseURL && url !== req.responseURL) {
  64576. return req.responseURL;
  64577. }
  64578. return url;
  64579. };
  64580. const logger$1 = (source) => {
  64581. if (videojs$2.log.debug) {
  64582. return videojs$2.log.debug.bind(videojs$2, "VHS:", `${source} >`);
  64583. }
  64584. return function() {
  64585. };
  64586. };
  64587. function merge$2(...args) {
  64588. const context = videojs$2.obj || videojs$2;
  64589. const fn2 = context.merge || context.mergeOptions;
  64590. return fn2.apply(context, args);
  64591. }
  64592. function createTimeRanges$2(...args) {
  64593. const context = videojs$2.time || videojs$2;
  64594. const fn2 = context.createTimeRanges || context.createTimeRanges;
  64595. return fn2.apply(context, args);
  64596. }
  64597. const TIME_FUDGE_FACTOR$1 = 1 / 30;
  64598. const SAFE_TIME_DELTA$1 = TIME_FUDGE_FACTOR$1 * 3;
  64599. const filterRanges$1 = function(timeRanges, predicate) {
  64600. const results = [];
  64601. let i2;
  64602. if (timeRanges && timeRanges.length) {
  64603. for (i2 = 0; i2 < timeRanges.length; i2++) {
  64604. if (predicate(timeRanges.start(i2), timeRanges.end(i2))) {
  64605. results.push([timeRanges.start(i2), timeRanges.end(i2)]);
  64606. }
  64607. }
  64608. }
  64609. return createTimeRanges$2(results);
  64610. };
  64611. const findRange$1 = function(buffered, time) {
  64612. return filterRanges$1(buffered, function(start2, end) {
  64613. return start2 - SAFE_TIME_DELTA$1 <= time && end + SAFE_TIME_DELTA$1 >= time;
  64614. });
  64615. };
  64616. const findNextRange$1 = function(timeRanges, time) {
  64617. return filterRanges$1(timeRanges, function(start2) {
  64618. return start2 - TIME_FUDGE_FACTOR$1 >= time;
  64619. });
  64620. };
  64621. const findGaps$1 = function(buffered) {
  64622. if (buffered.length < 2) {
  64623. return createTimeRanges$2();
  64624. }
  64625. const ranges = [];
  64626. for (let i2 = 1; i2 < buffered.length; i2++) {
  64627. const start2 = buffered.end(i2 - 1);
  64628. const end = buffered.start(i2);
  64629. ranges.push([start2, end]);
  64630. }
  64631. return createTimeRanges$2(ranges);
  64632. };
  64633. const bufferIntersection$1 = function(bufferA, bufferB) {
  64634. let start2 = null;
  64635. let end = null;
  64636. let arity = 0;
  64637. const extents = [];
  64638. const ranges = [];
  64639. if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) {
  64640. return createTimeRanges$2();
  64641. }
  64642. let count = bufferA.length;
  64643. while (count--) {
  64644. extents.push({
  64645. time: bufferA.start(count),
  64646. type: "start"
  64647. });
  64648. extents.push({
  64649. time: bufferA.end(count),
  64650. type: "end"
  64651. });
  64652. }
  64653. count = bufferB.length;
  64654. while (count--) {
  64655. extents.push({
  64656. time: bufferB.start(count),
  64657. type: "start"
  64658. });
  64659. extents.push({
  64660. time: bufferB.end(count),
  64661. type: "end"
  64662. });
  64663. }
  64664. extents.sort(function(a, b) {
  64665. return a.time - b.time;
  64666. });
  64667. for (count = 0; count < extents.length; count++) {
  64668. if (extents[count].type === "start") {
  64669. arity++;
  64670. if (arity === 2) {
  64671. start2 = extents[count].time;
  64672. }
  64673. } else if (extents[count].type === "end") {
  64674. arity--;
  64675. if (arity === 1) {
  64676. end = extents[count].time;
  64677. }
  64678. }
  64679. if (start2 !== null && end !== null) {
  64680. ranges.push([start2, end]);
  64681. start2 = null;
  64682. end = null;
  64683. }
  64684. }
  64685. return createTimeRanges$2(ranges);
  64686. };
  64687. const printableRange$1 = (range3) => {
  64688. const strArr = [];
  64689. if (!range3 || !range3.length) {
  64690. return "";
  64691. }
  64692. for (let i2 = 0; i2 < range3.length; i2++) {
  64693. strArr.push(range3.start(i2) + " => " + range3.end(i2));
  64694. }
  64695. return strArr.join(", ");
  64696. };
  64697. const timeUntilRebuffer$1 = function(buffered, currentTime, playbackRate = 1) {
  64698. const bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0;
  64699. return (bufferedEnd - currentTime) / playbackRate;
  64700. };
  64701. const timeRangesToArray$1 = (timeRanges) => {
  64702. const timeRangesList = [];
  64703. for (let i2 = 0; i2 < timeRanges.length; i2++) {
  64704. timeRangesList.push({
  64705. start: timeRanges.start(i2),
  64706. end: timeRanges.end(i2)
  64707. });
  64708. }
  64709. return timeRangesList;
  64710. };
  64711. const isRangeDifferent$1 = function(a, b) {
  64712. if (a === b) {
  64713. return false;
  64714. }
  64715. if (!a && b || !b && a) {
  64716. return true;
  64717. }
  64718. if (a.length !== b.length) {
  64719. return true;
  64720. }
  64721. for (let i2 = 0; i2 < a.length; i2++) {
  64722. if (a.start(i2) !== b.start(i2) || a.end(i2) !== b.end(i2)) {
  64723. return true;
  64724. }
  64725. }
  64726. return false;
  64727. };
  64728. const lastBufferedEnd$1 = function(a) {
  64729. if (!a || !a.length || !a.end) {
  64730. return;
  64731. }
  64732. return a.end(a.length - 1);
  64733. };
  64734. const timeAheadOf$1 = function(range3, startTime) {
  64735. let time = 0;
  64736. if (!range3 || !range3.length) {
  64737. return time;
  64738. }
  64739. for (let i2 = 0; i2 < range3.length; i2++) {
  64740. const start2 = range3.start(i2);
  64741. const end = range3.end(i2);
  64742. if (startTime > end) {
  64743. continue;
  64744. }
  64745. if (startTime > start2 && startTime <= end) {
  64746. time += end - startTime;
  64747. continue;
  64748. }
  64749. time += end - start2;
  64750. }
  64751. return time;
  64752. };
  64753. const segmentDurationWithParts$1 = (playlist, segment) => {
  64754. if (!segment.preload) {
  64755. return segment.duration;
  64756. }
  64757. let result = 0;
  64758. (segment.parts || []).forEach(function(p) {
  64759. result += p.duration;
  64760. });
  64761. (segment.preloadHints || []).forEach(function(p) {
  64762. if (p.type === "PART") {
  64763. result += playlist.partTargetDuration;
  64764. }
  64765. });
  64766. return result;
  64767. };
  64768. const getPartsAndSegments$1 = (playlist) => (playlist.segments || []).reduce((acc, segment, si) => {
  64769. if (segment.parts) {
  64770. segment.parts.forEach(function(part, pi) {
  64771. acc.push({
  64772. duration: part.duration,
  64773. segmentIndex: si,
  64774. partIndex: pi,
  64775. part,
  64776. segment
  64777. });
  64778. });
  64779. } else {
  64780. acc.push({
  64781. duration: segment.duration,
  64782. segmentIndex: si,
  64783. partIndex: null,
  64784. segment,
  64785. part: null
  64786. });
  64787. }
  64788. return acc;
  64789. }, []);
  64790. const getLastParts$1 = (media) => {
  64791. const lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1];
  64792. return lastSegment && lastSegment.parts || [];
  64793. };
  64794. const getKnownPartCount$1 = ({
  64795. preloadSegment
  64796. }) => {
  64797. if (!preloadSegment) {
  64798. return;
  64799. }
  64800. const {
  64801. parts,
  64802. preloadHints
  64803. } = preloadSegment;
  64804. let partCount = (preloadHints || []).reduce((count, hint) => count + (hint.type === "PART" ? 1 : 0), 0);
  64805. partCount += parts && parts.length ? parts.length : 0;
  64806. return partCount;
  64807. };
  64808. const liveEdgeDelay$1 = (main, media) => {
  64809. if (media.endList) {
  64810. return 0;
  64811. }
  64812. if (main && main.suggestedPresentationDelay) {
  64813. return main.suggestedPresentationDelay;
  64814. }
  64815. const hasParts = getLastParts$1(media).length > 0;
  64816. if (hasParts && media.serverControl && media.serverControl.partHoldBack) {
  64817. return media.serverControl.partHoldBack;
  64818. } else if (hasParts && media.partTargetDuration) {
  64819. return media.partTargetDuration * 3;
  64820. } else if (media.serverControl && media.serverControl.holdBack) {
  64821. return media.serverControl.holdBack;
  64822. } else if (media.targetDuration) {
  64823. return media.targetDuration * 3;
  64824. }
  64825. return 0;
  64826. };
  64827. const backwardDuration$1 = function(playlist, endSequence) {
  64828. let result = 0;
  64829. let i2 = endSequence - playlist.mediaSequence;
  64830. let segment = playlist.segments[i2];
  64831. if (segment) {
  64832. if (typeof segment.start !== "undefined") {
  64833. return {
  64834. result: segment.start,
  64835. precise: true
  64836. };
  64837. }
  64838. if (typeof segment.end !== "undefined") {
  64839. return {
  64840. result: segment.end - segment.duration,
  64841. precise: true
  64842. };
  64843. }
  64844. }
  64845. while (i2--) {
  64846. segment = playlist.segments[i2];
  64847. if (typeof segment.end !== "undefined") {
  64848. return {
  64849. result: result + segment.end,
  64850. precise: true
  64851. };
  64852. }
  64853. result += segmentDurationWithParts$1(playlist, segment);
  64854. if (typeof segment.start !== "undefined") {
  64855. return {
  64856. result: result + segment.start,
  64857. precise: true
  64858. };
  64859. }
  64860. }
  64861. return {
  64862. result,
  64863. precise: false
  64864. };
  64865. };
  64866. const forwardDuration$1 = function(playlist, endSequence) {
  64867. let result = 0;
  64868. let segment;
  64869. let i2 = endSequence - playlist.mediaSequence;
  64870. for (; i2 < playlist.segments.length; i2++) {
  64871. segment = playlist.segments[i2];
  64872. if (typeof segment.start !== "undefined") {
  64873. return {
  64874. result: segment.start - result,
  64875. precise: true
  64876. };
  64877. }
  64878. result += segmentDurationWithParts$1(playlist, segment);
  64879. if (typeof segment.end !== "undefined") {
  64880. return {
  64881. result: segment.end - result,
  64882. precise: true
  64883. };
  64884. }
  64885. }
  64886. return {
  64887. result: -1,
  64888. precise: false
  64889. };
  64890. };
  64891. const intervalDuration$1 = function(playlist, endSequence, expired) {
  64892. if (typeof endSequence === "undefined") {
  64893. endSequence = playlist.mediaSequence + playlist.segments.length;
  64894. }
  64895. if (endSequence < playlist.mediaSequence) {
  64896. return 0;
  64897. }
  64898. const backward = backwardDuration$1(playlist, endSequence);
  64899. if (backward.precise) {
  64900. return backward.result;
  64901. }
  64902. const forward = forwardDuration$1(playlist, endSequence);
  64903. if (forward.precise) {
  64904. return forward.result;
  64905. }
  64906. return backward.result + expired;
  64907. };
  64908. const duration$1 = function(playlist, endSequence, expired) {
  64909. if (!playlist) {
  64910. return 0;
  64911. }
  64912. if (typeof expired !== "number") {
  64913. expired = 0;
  64914. }
  64915. if (typeof endSequence === "undefined") {
  64916. if (playlist.totalDuration) {
  64917. return playlist.totalDuration;
  64918. }
  64919. if (!playlist.endList) {
  64920. return window_1.Infinity;
  64921. }
  64922. }
  64923. return intervalDuration$1(playlist, endSequence, expired);
  64924. };
  64925. const sumDurations$1 = function({
  64926. defaultDuration,
  64927. durationList,
  64928. startIndex,
  64929. endIndex
  64930. }) {
  64931. let durations = 0;
  64932. if (startIndex > endIndex) {
  64933. [startIndex, endIndex] = [endIndex, startIndex];
  64934. }
  64935. if (startIndex < 0) {
  64936. for (let i2 = startIndex; i2 < Math.min(0, endIndex); i2++) {
  64937. durations += defaultDuration;
  64938. }
  64939. startIndex = 0;
  64940. }
  64941. for (let i2 = startIndex; i2 < endIndex; i2++) {
  64942. durations += durationList[i2].duration;
  64943. }
  64944. return durations;
  64945. };
  64946. const playlistEnd$1 = function(playlist, expired, useSafeLiveEnd, liveEdgePadding) {
  64947. if (!playlist || !playlist.segments) {
  64948. return null;
  64949. }
  64950. if (playlist.endList) {
  64951. return duration$1(playlist);
  64952. }
  64953. if (expired === null) {
  64954. return null;
  64955. }
  64956. expired = expired || 0;
  64957. let lastSegmentEndTime = intervalDuration$1(playlist, playlist.mediaSequence + playlist.segments.length, expired);
  64958. if (useSafeLiveEnd) {
  64959. liveEdgePadding = typeof liveEdgePadding === "number" ? liveEdgePadding : liveEdgeDelay$1(null, playlist);
  64960. lastSegmentEndTime -= liveEdgePadding;
  64961. }
  64962. return Math.max(0, lastSegmentEndTime);
  64963. };
  64964. const seekable$1 = function(playlist, expired, liveEdgePadding) {
  64965. const useSafeLiveEnd = true;
  64966. const seekableStart = expired || 0;
  64967. const seekableEnd = playlistEnd$1(playlist, expired, useSafeLiveEnd, liveEdgePadding);
  64968. if (seekableEnd === null) {
  64969. return createTimeRanges$2();
  64970. }
  64971. return createTimeRanges$2(seekableStart, seekableEnd);
  64972. };
  64973. const getMediaInfoForTime$1 = function({
  64974. playlist,
  64975. currentTime,
  64976. startingSegmentIndex,
  64977. startingPartIndex,
  64978. startTime,
  64979. exactManifestTimings
  64980. }) {
  64981. let time = currentTime - startTime;
  64982. const partsAndSegments = getPartsAndSegments$1(playlist);
  64983. let startIndex = 0;
  64984. for (let i2 = 0; i2 < partsAndSegments.length; i2++) {
  64985. const partAndSegment = partsAndSegments[i2];
  64986. if (startingSegmentIndex !== partAndSegment.segmentIndex) {
  64987. continue;
  64988. }
  64989. if (typeof startingPartIndex === "number" && typeof partAndSegment.partIndex === "number" && startingPartIndex !== partAndSegment.partIndex) {
  64990. continue;
  64991. }
  64992. startIndex = i2;
  64993. break;
  64994. }
  64995. if (time < 0) {
  64996. if (startIndex > 0) {
  64997. for (let i2 = startIndex - 1; i2 >= 0; i2--) {
  64998. const partAndSegment = partsAndSegments[i2];
  64999. time += partAndSegment.duration;
  65000. if (exactManifestTimings) {
  65001. if (time < 0) {
  65002. continue;
  65003. }
  65004. } else if (time + TIME_FUDGE_FACTOR$1 <= 0) {
  65005. continue;
  65006. }
  65007. return {
  65008. partIndex: partAndSegment.partIndex,
  65009. segmentIndex: partAndSegment.segmentIndex,
  65010. startTime: startTime - sumDurations$1({
  65011. defaultDuration: playlist.targetDuration,
  65012. durationList: partsAndSegments,
  65013. startIndex,
  65014. endIndex: i2
  65015. })
  65016. };
  65017. }
  65018. }
  65019. return {
  65020. partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,
  65021. segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,
  65022. startTime: currentTime
  65023. };
  65024. }
  65025. if (startIndex < 0) {
  65026. for (let i2 = startIndex; i2 < 0; i2++) {
  65027. time -= playlist.targetDuration;
  65028. if (time < 0) {
  65029. return {
  65030. partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,
  65031. segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,
  65032. startTime: currentTime
  65033. };
  65034. }
  65035. }
  65036. startIndex = 0;
  65037. }
  65038. for (let i2 = startIndex; i2 < partsAndSegments.length; i2++) {
  65039. const partAndSegment = partsAndSegments[i2];
  65040. time -= partAndSegment.duration;
  65041. if (exactManifestTimings) {
  65042. if (time > 0) {
  65043. continue;
  65044. }
  65045. } else if (time - TIME_FUDGE_FACTOR$1 >= 0) {
  65046. continue;
  65047. }
  65048. return {
  65049. partIndex: partAndSegment.partIndex,
  65050. segmentIndex: partAndSegment.segmentIndex,
  65051. startTime: startTime + sumDurations$1({
  65052. defaultDuration: playlist.targetDuration,
  65053. durationList: partsAndSegments,
  65054. startIndex,
  65055. endIndex: i2
  65056. })
  65057. };
  65058. }
  65059. return {
  65060. segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex,
  65061. partIndex: partsAndSegments[partsAndSegments.length - 1].partIndex,
  65062. startTime: currentTime
  65063. };
  65064. };
  65065. const isExcluded = function(playlist) {
  65066. return playlist.excludeUntil && playlist.excludeUntil > Date.now();
  65067. };
  65068. const isIncompatible$1 = function(playlist) {
  65069. return playlist.excludeUntil && playlist.excludeUntil === Infinity;
  65070. };
  65071. const isEnabled$1 = function(playlist) {
  65072. const excluded = isExcluded(playlist);
  65073. return !playlist.disabled && !excluded;
  65074. };
  65075. const isDisabled$1 = function(playlist) {
  65076. return playlist.disabled;
  65077. };
  65078. const isAes$1 = function(media) {
  65079. for (let i2 = 0; i2 < media.segments.length; i2++) {
  65080. if (media.segments[i2].key) {
  65081. return true;
  65082. }
  65083. }
  65084. return false;
  65085. };
  65086. const hasAttribute$1 = function(attr, playlist) {
  65087. return playlist.attributes && playlist.attributes[attr];
  65088. };
  65089. const estimateSegmentRequestTime$1 = function(segmentDuration, bandwidth2, playlist, bytesReceived = 0) {
  65090. if (!hasAttribute$1("BANDWIDTH", playlist)) {
  65091. return NaN;
  65092. }
  65093. const size = segmentDuration * playlist.attributes.BANDWIDTH;
  65094. return (size - bytesReceived * 8) / bandwidth2;
  65095. };
  65096. const isLowestEnabledRendition$1 = (main, media) => {
  65097. if (main.playlists.length === 1) {
  65098. return true;
  65099. }
  65100. const currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE;
  65101. return main.playlists.filter((playlist) => {
  65102. if (!isEnabled$1(playlist)) {
  65103. return false;
  65104. }
  65105. return (playlist.attributes.BANDWIDTH || 0) < currentBandwidth;
  65106. }).length === 0;
  65107. };
  65108. const playlistMatch$1 = (a, b) => {
  65109. if (!a && !b || !a && b || a && !b) {
  65110. return false;
  65111. }
  65112. if (a === b) {
  65113. return true;
  65114. }
  65115. if (a.id && b.id && a.id === b.id) {
  65116. return true;
  65117. }
  65118. if (a.resolvedUri && b.resolvedUri && a.resolvedUri === b.resolvedUri) {
  65119. return true;
  65120. }
  65121. if (a.uri && b.uri && a.uri === b.uri) {
  65122. return true;
  65123. }
  65124. return false;
  65125. };
  65126. const someAudioVariant$1 = function(main, callback2) {
  65127. const AUDIO5 = main && main.mediaGroups && main.mediaGroups.AUDIO || {};
  65128. let found = false;
  65129. for (const groupName in AUDIO5) {
  65130. for (const label in AUDIO5[groupName]) {
  65131. found = callback2(AUDIO5[groupName][label]);
  65132. if (found) {
  65133. break;
  65134. }
  65135. }
  65136. if (found) {
  65137. break;
  65138. }
  65139. }
  65140. return !!found;
  65141. };
  65142. const isAudioOnly$1 = (main) => {
  65143. if (!main || !main.playlists || !main.playlists.length) {
  65144. const found = someAudioVariant$1(main, (variant) => variant.playlists && variant.playlists.length || variant.uri);
  65145. return found;
  65146. }
  65147. for (let i2 = 0; i2 < main.playlists.length; i2++) {
  65148. const playlist = main.playlists[i2];
  65149. const CODECS = playlist.attributes && playlist.attributes.CODECS;
  65150. if (CODECS && CODECS.split(",").every((c) => isAudioCodec$1(c))) {
  65151. continue;
  65152. }
  65153. const found = someAudioVariant$1(main, (variant) => playlistMatch$1(playlist, variant));
  65154. if (found) {
  65155. continue;
  65156. }
  65157. return false;
  65158. }
  65159. return true;
  65160. };
  65161. var Playlist$1 = {
  65162. liveEdgeDelay: liveEdgeDelay$1,
  65163. duration: duration$1,
  65164. seekable: seekable$1,
  65165. getMediaInfoForTime: getMediaInfoForTime$1,
  65166. isEnabled: isEnabled$1,
  65167. isDisabled: isDisabled$1,
  65168. isExcluded,
  65169. isIncompatible: isIncompatible$1,
  65170. playlistEnd: playlistEnd$1,
  65171. isAes: isAes$1,
  65172. hasAttribute: hasAttribute$1,
  65173. estimateSegmentRequestTime: estimateSegmentRequestTime$1,
  65174. isLowestEnabledRendition: isLowestEnabledRendition$1,
  65175. isAudioOnly: isAudioOnly$1,
  65176. playlistMatch: playlistMatch$1,
  65177. segmentDurationWithParts: segmentDurationWithParts$1
  65178. };
  65179. const {
  65180. log: log$2
  65181. } = videojs$2;
  65182. const createPlaylistID$1 = (index2, uri) => {
  65183. return `${index2}-${uri}`;
  65184. };
  65185. const groupID$1 = (type2, group, label) => {
  65186. return `placeholder-uri-${type2}-${group}-${label}`;
  65187. };
  65188. const parseManifest$1 = ({
  65189. onwarn,
  65190. oninfo,
  65191. manifestString,
  65192. customTagParsers = [],
  65193. customTagMappers = [],
  65194. llhls
  65195. }) => {
  65196. const parser2 = new Parser$1();
  65197. if (onwarn) {
  65198. parser2.on("warn", onwarn);
  65199. }
  65200. if (oninfo) {
  65201. parser2.on("info", oninfo);
  65202. }
  65203. customTagParsers.forEach((customParser) => parser2.addParser(customParser));
  65204. customTagMappers.forEach((mapper) => parser2.addTagMapper(mapper));
  65205. parser2.push(manifestString);
  65206. parser2.end();
  65207. const manifest = parser2.manifest;
  65208. if (!llhls) {
  65209. ["preloadSegment", "skip", "serverControl", "renditionReports", "partInf", "partTargetDuration"].forEach(function(k) {
  65210. if (manifest.hasOwnProperty(k)) {
  65211. delete manifest[k];
  65212. }
  65213. });
  65214. if (manifest.segments) {
  65215. manifest.segments.forEach(function(segment) {
  65216. ["parts", "preloadHints"].forEach(function(k) {
  65217. if (segment.hasOwnProperty(k)) {
  65218. delete segment[k];
  65219. }
  65220. });
  65221. });
  65222. }
  65223. }
  65224. if (!manifest.targetDuration) {
  65225. let targetDuration = 10;
  65226. if (manifest.segments && manifest.segments.length) {
  65227. targetDuration = manifest.segments.reduce((acc, s) => Math.max(acc, s.duration), 0);
  65228. }
  65229. if (onwarn) {
  65230. onwarn(`manifest has no targetDuration defaulting to ${targetDuration}`);
  65231. }
  65232. manifest.targetDuration = targetDuration;
  65233. }
  65234. const parts = getLastParts$1(manifest);
  65235. if (parts.length && !manifest.partTargetDuration) {
  65236. const partTargetDuration = parts.reduce((acc, p) => Math.max(acc, p.duration), 0);
  65237. if (onwarn) {
  65238. onwarn(`manifest has no partTargetDuration defaulting to ${partTargetDuration}`);
  65239. log$2.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.");
  65240. }
  65241. manifest.partTargetDuration = partTargetDuration;
  65242. }
  65243. return manifest;
  65244. };
  65245. const forEachMediaGroup$2 = (main, callback2) => {
  65246. if (!main.mediaGroups) {
  65247. return;
  65248. }
  65249. ["AUDIO", "SUBTITLES"].forEach((mediaType) => {
  65250. if (!main.mediaGroups[mediaType]) {
  65251. return;
  65252. }
  65253. for (const groupKey in main.mediaGroups[mediaType]) {
  65254. for (const labelKey in main.mediaGroups[mediaType][groupKey]) {
  65255. const mediaProperties = main.mediaGroups[mediaType][groupKey][labelKey];
  65256. callback2(mediaProperties, mediaType, groupKey, labelKey);
  65257. }
  65258. }
  65259. });
  65260. };
  65261. const setupMediaPlaylist$1 = ({
  65262. playlist,
  65263. uri,
  65264. id
  65265. }) => {
  65266. playlist.id = id;
  65267. playlist.playlistErrors_ = 0;
  65268. if (uri) {
  65269. playlist.uri = uri;
  65270. }
  65271. playlist.attributes = playlist.attributes || {};
  65272. };
  65273. const setupMediaPlaylists$1 = (main) => {
  65274. let i2 = main.playlists.length;
  65275. while (i2--) {
  65276. const playlist = main.playlists[i2];
  65277. setupMediaPlaylist$1({
  65278. playlist,
  65279. id: createPlaylistID$1(i2, playlist.uri)
  65280. });
  65281. playlist.resolvedUri = resolveUrl$2(main.uri, playlist.uri);
  65282. main.playlists[playlist.id] = playlist;
  65283. main.playlists[playlist.uri] = playlist;
  65284. if (!playlist.attributes.BANDWIDTH) {
  65285. log$2.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.");
  65286. }
  65287. }
  65288. };
  65289. const resolveMediaGroupUris$1 = (main) => {
  65290. forEachMediaGroup$2(main, (properties) => {
  65291. if (properties.uri) {
  65292. properties.resolvedUri = resolveUrl$2(main.uri, properties.uri);
  65293. }
  65294. });
  65295. };
  65296. const mainForMedia = (media, uri) => {
  65297. const id = createPlaylistID$1(0, uri);
  65298. const main = {
  65299. mediaGroups: {
  65300. "AUDIO": {},
  65301. "VIDEO": {},
  65302. "CLOSED-CAPTIONS": {},
  65303. "SUBTITLES": {}
  65304. },
  65305. uri: window_1.location.href,
  65306. resolvedUri: window_1.location.href,
  65307. playlists: [{
  65308. uri,
  65309. id,
  65310. resolvedUri: uri,
  65311. attributes: {}
  65312. }]
  65313. };
  65314. main.playlists[id] = main.playlists[0];
  65315. main.playlists[uri] = main.playlists[0];
  65316. return main;
  65317. };
  65318. const addPropertiesToMain = (main, uri, createGroupID = groupID$1) => {
  65319. main.uri = uri;
  65320. for (let i2 = 0; i2 < main.playlists.length; i2++) {
  65321. if (!main.playlists[i2].uri) {
  65322. const phonyUri = `placeholder-uri-${i2}`;
  65323. main.playlists[i2].uri = phonyUri;
  65324. }
  65325. }
  65326. const audioOnlyMain = isAudioOnly$1(main);
  65327. forEachMediaGroup$2(main, (properties, mediaType, groupKey, labelKey) => {
  65328. if (!properties.playlists || !properties.playlists.length) {
  65329. if (audioOnlyMain && mediaType === "AUDIO" && !properties.uri) {
  65330. for (let i2 = 0; i2 < main.playlists.length; i2++) {
  65331. const p = main.playlists[i2];
  65332. if (p.attributes && p.attributes.AUDIO && p.attributes.AUDIO === groupKey) {
  65333. return;
  65334. }
  65335. }
  65336. }
  65337. properties.playlists = [_extends$2({}, properties)];
  65338. }
  65339. properties.playlists.forEach(function(p, i2) {
  65340. const groupId = createGroupID(mediaType, groupKey, labelKey, p);
  65341. const id = createPlaylistID$1(i2, groupId);
  65342. if (p.uri) {
  65343. p.resolvedUri = p.resolvedUri || resolveUrl$2(main.uri, p.uri);
  65344. } else {
  65345. p.uri = i2 === 0 ? groupId : id;
  65346. p.resolvedUri = p.uri;
  65347. }
  65348. p.id = p.id || id;
  65349. p.attributes = p.attributes || {};
  65350. main.playlists[p.id] = p;
  65351. main.playlists[p.uri] = p;
  65352. });
  65353. });
  65354. setupMediaPlaylists$1(main);
  65355. resolveMediaGroupUris$1(main);
  65356. };
  65357. const {
  65358. EventTarget: EventTarget$1$1
  65359. } = videojs$2;
  65360. const addLLHLSQueryDirectives$1 = (uri, media) => {
  65361. if (media.endList || !media.serverControl) {
  65362. return uri;
  65363. }
  65364. const parameters = {};
  65365. if (media.serverControl.canBlockReload) {
  65366. const {
  65367. preloadSegment
  65368. } = media;
  65369. let nextMSN = media.mediaSequence + media.segments.length;
  65370. if (preloadSegment) {
  65371. const parts = preloadSegment.parts || [];
  65372. const nextPart = getKnownPartCount$1(media) - 1;
  65373. if (nextPart > -1 && nextPart !== parts.length - 1) {
  65374. parameters._HLS_part = nextPart;
  65375. }
  65376. if (nextPart > -1 || parts.length) {
  65377. nextMSN--;
  65378. }
  65379. }
  65380. parameters._HLS_msn = nextMSN;
  65381. }
  65382. if (media.serverControl && media.serverControl.canSkipUntil) {
  65383. parameters._HLS_skip = media.serverControl.canSkipDateranges ? "v2" : "YES";
  65384. }
  65385. if (Object.keys(parameters).length) {
  65386. const parsedUri = new window_1.URL(uri);
  65387. ["_HLS_skip", "_HLS_msn", "_HLS_part"].forEach(function(name) {
  65388. if (!parameters.hasOwnProperty(name)) {
  65389. return;
  65390. }
  65391. parsedUri.searchParams.set(name, parameters[name]);
  65392. });
  65393. uri = parsedUri.toString();
  65394. }
  65395. return uri;
  65396. };
  65397. const updateSegment$1 = (a, b) => {
  65398. if (!a) {
  65399. return b;
  65400. }
  65401. const result = merge$2(a, b);
  65402. if (a.preloadHints && !b.preloadHints) {
  65403. delete result.preloadHints;
  65404. }
  65405. if (a.parts && !b.parts) {
  65406. delete result.parts;
  65407. } else if (a.parts && b.parts) {
  65408. for (let i2 = 0; i2 < b.parts.length; i2++) {
  65409. if (a.parts && a.parts[i2]) {
  65410. result.parts[i2] = merge$2(a.parts[i2], b.parts[i2]);
  65411. }
  65412. }
  65413. }
  65414. if (!a.skipped && b.skipped) {
  65415. result.skipped = false;
  65416. }
  65417. if (a.preload && !b.preload) {
  65418. result.preload = false;
  65419. }
  65420. return result;
  65421. };
  65422. const updateSegments$1 = (original, update, offset) => {
  65423. const oldSegments = original.slice();
  65424. const newSegments = update.slice();
  65425. offset = offset || 0;
  65426. const result = [];
  65427. let currentMap;
  65428. for (let newIndex = 0; newIndex < newSegments.length; newIndex++) {
  65429. const oldSegment = oldSegments[newIndex + offset];
  65430. const newSegment = newSegments[newIndex];
  65431. if (oldSegment) {
  65432. currentMap = oldSegment.map || currentMap;
  65433. result.push(updateSegment$1(oldSegment, newSegment));
  65434. } else {
  65435. if (currentMap && !newSegment.map) {
  65436. newSegment.map = currentMap;
  65437. }
  65438. result.push(newSegment);
  65439. }
  65440. }
  65441. return result;
  65442. };
  65443. const resolveSegmentUris$1 = (segment, baseUri) => {
  65444. if (!segment.resolvedUri && segment.uri) {
  65445. segment.resolvedUri = resolveUrl$2(baseUri, segment.uri);
  65446. }
  65447. if (segment.key && !segment.key.resolvedUri) {
  65448. segment.key.resolvedUri = resolveUrl$2(baseUri, segment.key.uri);
  65449. }
  65450. if (segment.map && !segment.map.resolvedUri) {
  65451. segment.map.resolvedUri = resolveUrl$2(baseUri, segment.map.uri);
  65452. }
  65453. if (segment.map && segment.map.key && !segment.map.key.resolvedUri) {
  65454. segment.map.key.resolvedUri = resolveUrl$2(baseUri, segment.map.key.uri);
  65455. }
  65456. if (segment.parts && segment.parts.length) {
  65457. segment.parts.forEach((p) => {
  65458. if (p.resolvedUri) {
  65459. return;
  65460. }
  65461. p.resolvedUri = resolveUrl$2(baseUri, p.uri);
  65462. });
  65463. }
  65464. if (segment.preloadHints && segment.preloadHints.length) {
  65465. segment.preloadHints.forEach((p) => {
  65466. if (p.resolvedUri) {
  65467. return;
  65468. }
  65469. p.resolvedUri = resolveUrl$2(baseUri, p.uri);
  65470. });
  65471. }
  65472. };
  65473. const getAllSegments$1 = function(media) {
  65474. const segments = media.segments || [];
  65475. const preloadSegment = media.preloadSegment;
  65476. if (preloadSegment && preloadSegment.parts && preloadSegment.parts.length) {
  65477. if (preloadSegment.preloadHints) {
  65478. for (let i2 = 0; i2 < preloadSegment.preloadHints.length; i2++) {
  65479. if (preloadSegment.preloadHints[i2].type === "MAP") {
  65480. return segments;
  65481. }
  65482. }
  65483. }
  65484. preloadSegment.duration = media.targetDuration;
  65485. preloadSegment.preload = true;
  65486. segments.push(preloadSegment);
  65487. }
  65488. return segments;
  65489. };
  65490. const isPlaylistUnchanged$1 = (a, b) => a === b || a.segments && b.segments && a.segments.length === b.segments.length && a.endList === b.endList && a.mediaSequence === b.mediaSequence && a.preloadSegment === b.preloadSegment;
  65491. const updateMain$1 = (main, newMedia, unchangedCheck = isPlaylistUnchanged$1) => {
  65492. const result = merge$2(main, {});
  65493. const oldMedia = result.playlists[newMedia.id];
  65494. if (!oldMedia) {
  65495. return null;
  65496. }
  65497. if (unchangedCheck(oldMedia, newMedia)) {
  65498. return null;
  65499. }
  65500. newMedia.segments = getAllSegments$1(newMedia);
  65501. const mergedPlaylist = merge$2(oldMedia, newMedia);
  65502. if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment) {
  65503. delete mergedPlaylist.preloadSegment;
  65504. }
  65505. if (oldMedia.segments) {
  65506. if (newMedia.skip) {
  65507. newMedia.segments = newMedia.segments || [];
  65508. for (let i2 = 0; i2 < newMedia.skip.skippedSegments; i2++) {
  65509. newMedia.segments.unshift({
  65510. skipped: true
  65511. });
  65512. }
  65513. }
  65514. mergedPlaylist.segments = updateSegments$1(oldMedia.segments, newMedia.segments, newMedia.mediaSequence - oldMedia.mediaSequence);
  65515. }
  65516. mergedPlaylist.segments.forEach((segment) => {
  65517. resolveSegmentUris$1(segment, mergedPlaylist.resolvedUri);
  65518. });
  65519. for (let i2 = 0; i2 < result.playlists.length; i2++) {
  65520. if (result.playlists[i2].id === newMedia.id) {
  65521. result.playlists[i2] = mergedPlaylist;
  65522. }
  65523. }
  65524. result.playlists[newMedia.id] = mergedPlaylist;
  65525. result.playlists[newMedia.uri] = mergedPlaylist;
  65526. forEachMediaGroup$2(main, (properties, mediaType, groupKey, labelKey) => {
  65527. if (!properties.playlists) {
  65528. return;
  65529. }
  65530. for (let i2 = 0; i2 < properties.playlists.length; i2++) {
  65531. if (newMedia.id === properties.playlists[i2].id) {
  65532. properties.playlists[i2] = mergedPlaylist;
  65533. }
  65534. }
  65535. });
  65536. return result;
  65537. };
  65538. const refreshDelay$1 = (media, update) => {
  65539. const segments = media.segments || [];
  65540. const lastSegment = segments[segments.length - 1];
  65541. const lastPart = lastSegment && lastSegment.parts && lastSegment.parts[lastSegment.parts.length - 1];
  65542. const lastDuration = lastPart && lastPart.duration || lastSegment && lastSegment.duration;
  65543. if (update && lastDuration) {
  65544. return lastDuration * 1e3;
  65545. }
  65546. return (media.partTargetDuration || media.targetDuration || 10) * 500;
  65547. };
  65548. class PlaylistLoader$1 extends EventTarget$1$1 {
  65549. constructor(src, vhs, options2 = {}) {
  65550. super();
  65551. if (!src) {
  65552. throw new Error("A non-empty playlist URL or object is required");
  65553. }
  65554. this.logger_ = logger$1("PlaylistLoader");
  65555. const {
  65556. withCredentials = false
  65557. } = options2;
  65558. this.src = src;
  65559. this.vhs_ = vhs;
  65560. this.withCredentials = withCredentials;
  65561. const vhsOptions = vhs.options_;
  65562. this.customTagParsers = vhsOptions && vhsOptions.customTagParsers || [];
  65563. this.customTagMappers = vhsOptions && vhsOptions.customTagMappers || [];
  65564. this.llhls = vhsOptions && vhsOptions.llhls;
  65565. this.state = "HAVE_NOTHING";
  65566. this.handleMediaupdatetimeout_ = this.handleMediaupdatetimeout_.bind(this);
  65567. this.on("mediaupdatetimeout", this.handleMediaupdatetimeout_);
  65568. }
  65569. handleMediaupdatetimeout_() {
  65570. if (this.state !== "HAVE_METADATA") {
  65571. return;
  65572. }
  65573. const media = this.media();
  65574. let uri = resolveUrl$2(this.main.uri, media.uri);
  65575. if (this.llhls) {
  65576. uri = addLLHLSQueryDirectives$1(uri, media);
  65577. }
  65578. this.state = "HAVE_CURRENT_METADATA";
  65579. this.request = this.vhs_.xhr({
  65580. uri,
  65581. withCredentials: this.withCredentials
  65582. }, (error, req) => {
  65583. if (!this.request) {
  65584. return;
  65585. }
  65586. if (error) {
  65587. return this.playlistRequestError(this.request, this.media(), "HAVE_METADATA");
  65588. }
  65589. this.haveMetadata({
  65590. playlistString: this.request.responseText,
  65591. url: this.media().uri,
  65592. id: this.media().id
  65593. });
  65594. });
  65595. }
  65596. playlistRequestError(xhr, playlist, startingState) {
  65597. const {
  65598. uri,
  65599. id
  65600. } = playlist;
  65601. this.request = null;
  65602. if (startingState) {
  65603. this.state = startingState;
  65604. }
  65605. this.error = {
  65606. playlist: this.main.playlists[id],
  65607. status: xhr.status,
  65608. message: `HLS playlist request error at URL: ${uri}.`,
  65609. responseText: xhr.responseText,
  65610. code: xhr.status >= 500 ? 4 : 2
  65611. };
  65612. this.trigger("error");
  65613. }
  65614. parseManifest_({
  65615. url,
  65616. manifestString
  65617. }) {
  65618. return parseManifest$1({
  65619. onwarn: ({
  65620. message
  65621. }) => this.logger_(`m3u8-parser warn for ${url}: ${message}`),
  65622. oninfo: ({
  65623. message
  65624. }) => this.logger_(`m3u8-parser info for ${url}: ${message}`),
  65625. manifestString,
  65626. customTagParsers: this.customTagParsers,
  65627. customTagMappers: this.customTagMappers,
  65628. llhls: this.llhls
  65629. });
  65630. }
  65631. haveMetadata({
  65632. playlistString,
  65633. playlistObject,
  65634. url,
  65635. id
  65636. }) {
  65637. this.request = null;
  65638. this.state = "HAVE_METADATA";
  65639. const playlist = playlistObject || this.parseManifest_({
  65640. url,
  65641. manifestString: playlistString
  65642. });
  65643. playlist.lastRequest = Date.now();
  65644. setupMediaPlaylist$1({
  65645. playlist,
  65646. uri: url,
  65647. id
  65648. });
  65649. const update = updateMain$1(this.main, playlist);
  65650. this.targetDuration = playlist.partTargetDuration || playlist.targetDuration;
  65651. this.pendingMedia_ = null;
  65652. if (update) {
  65653. this.main = update;
  65654. this.media_ = this.main.playlists[id];
  65655. } else {
  65656. this.trigger("playlistunchanged");
  65657. }
  65658. this.updateMediaUpdateTimeout_(refreshDelay$1(this.media(), !!update));
  65659. this.trigger("loadedplaylist");
  65660. }
  65661. dispose() {
  65662. this.trigger("dispose");
  65663. this.stopRequest();
  65664. window_1.clearTimeout(this.mediaUpdateTimeout);
  65665. window_1.clearTimeout(this.finalRenditionTimeout);
  65666. this.off();
  65667. }
  65668. stopRequest() {
  65669. if (this.request) {
  65670. const oldRequest = this.request;
  65671. this.request = null;
  65672. oldRequest.onreadystatechange = null;
  65673. oldRequest.abort();
  65674. }
  65675. }
  65676. media(playlist, shouldDelay) {
  65677. if (!playlist) {
  65678. return this.media_;
  65679. }
  65680. if (this.state === "HAVE_NOTHING") {
  65681. throw new Error("Cannot switch media playlist from " + this.state);
  65682. }
  65683. if (typeof playlist === "string") {
  65684. if (!this.main.playlists[playlist]) {
  65685. throw new Error("Unknown playlist URI: " + playlist);
  65686. }
  65687. playlist = this.main.playlists[playlist];
  65688. }
  65689. window_1.clearTimeout(this.finalRenditionTimeout);
  65690. if (shouldDelay) {
  65691. const delay = (playlist.partTargetDuration || playlist.targetDuration) / 2 * 1e3 || 5 * 1e3;
  65692. this.finalRenditionTimeout = window_1.setTimeout(this.media.bind(this, playlist, false), delay);
  65693. return;
  65694. }
  65695. const startingState = this.state;
  65696. const mediaChange = !this.media_ || playlist.id !== this.media_.id;
  65697. const mainPlaylistRef = this.main.playlists[playlist.id];
  65698. if (mainPlaylistRef && mainPlaylistRef.endList || playlist.endList && playlist.segments.length) {
  65699. if (this.request) {
  65700. this.request.onreadystatechange = null;
  65701. this.request.abort();
  65702. this.request = null;
  65703. }
  65704. this.state = "HAVE_METADATA";
  65705. this.media_ = playlist;
  65706. if (mediaChange) {
  65707. this.trigger("mediachanging");
  65708. if (startingState === "HAVE_MAIN_MANIFEST") {
  65709. this.trigger("loadedmetadata");
  65710. } else {
  65711. this.trigger("mediachange");
  65712. }
  65713. }
  65714. return;
  65715. }
  65716. this.updateMediaUpdateTimeout_(refreshDelay$1(playlist, true));
  65717. if (!mediaChange) {
  65718. return;
  65719. }
  65720. this.state = "SWITCHING_MEDIA";
  65721. if (this.request) {
  65722. if (playlist.resolvedUri === this.request.url) {
  65723. return;
  65724. }
  65725. this.request.onreadystatechange = null;
  65726. this.request.abort();
  65727. this.request = null;
  65728. }
  65729. if (this.media_) {
  65730. this.trigger("mediachanging");
  65731. }
  65732. this.pendingMedia_ = playlist;
  65733. this.request = this.vhs_.xhr({
  65734. uri: playlist.resolvedUri,
  65735. withCredentials: this.withCredentials
  65736. }, (error, req) => {
  65737. if (!this.request) {
  65738. return;
  65739. }
  65740. playlist.lastRequest = Date.now();
  65741. playlist.resolvedUri = resolveManifestRedirect$1(playlist.resolvedUri, req);
  65742. if (error) {
  65743. return this.playlistRequestError(this.request, playlist, startingState);
  65744. }
  65745. this.haveMetadata({
  65746. playlistString: req.responseText,
  65747. url: playlist.uri,
  65748. id: playlist.id
  65749. });
  65750. if (startingState === "HAVE_MAIN_MANIFEST") {
  65751. this.trigger("loadedmetadata");
  65752. } else {
  65753. this.trigger("mediachange");
  65754. }
  65755. });
  65756. }
  65757. pause() {
  65758. if (this.mediaUpdateTimeout) {
  65759. window_1.clearTimeout(this.mediaUpdateTimeout);
  65760. this.mediaUpdateTimeout = null;
  65761. }
  65762. this.stopRequest();
  65763. if (this.state === "HAVE_NOTHING") {
  65764. this.started = false;
  65765. }
  65766. if (this.state === "SWITCHING_MEDIA") {
  65767. if (this.media_) {
  65768. this.state = "HAVE_METADATA";
  65769. } else {
  65770. this.state = "HAVE_MAIN_MANIFEST";
  65771. }
  65772. } else if (this.state === "HAVE_CURRENT_METADATA") {
  65773. this.state = "HAVE_METADATA";
  65774. }
  65775. }
  65776. load(shouldDelay) {
  65777. if (this.mediaUpdateTimeout) {
  65778. window_1.clearTimeout(this.mediaUpdateTimeout);
  65779. this.mediaUpdateTimeout = null;
  65780. }
  65781. const media = this.media();
  65782. if (shouldDelay) {
  65783. const delay = media ? (media.partTargetDuration || media.targetDuration) / 2 * 1e3 : 5 * 1e3;
  65784. this.mediaUpdateTimeout = window_1.setTimeout(() => {
  65785. this.mediaUpdateTimeout = null;
  65786. this.load();
  65787. }, delay);
  65788. return;
  65789. }
  65790. if (!this.started) {
  65791. this.start();
  65792. return;
  65793. }
  65794. if (media && !media.endList) {
  65795. this.trigger("mediaupdatetimeout");
  65796. } else {
  65797. this.trigger("loadedplaylist");
  65798. }
  65799. }
  65800. updateMediaUpdateTimeout_(delay) {
  65801. if (this.mediaUpdateTimeout) {
  65802. window_1.clearTimeout(this.mediaUpdateTimeout);
  65803. this.mediaUpdateTimeout = null;
  65804. }
  65805. if (!this.media() || this.media().endList) {
  65806. return;
  65807. }
  65808. this.mediaUpdateTimeout = window_1.setTimeout(() => {
  65809. this.mediaUpdateTimeout = null;
  65810. this.trigger("mediaupdatetimeout");
  65811. this.updateMediaUpdateTimeout_(delay);
  65812. }, delay);
  65813. }
  65814. start() {
  65815. this.started = true;
  65816. if (typeof this.src === "object") {
  65817. if (!this.src.uri) {
  65818. this.src.uri = window_1.location.href;
  65819. }
  65820. this.src.resolvedUri = this.src.uri;
  65821. setTimeout(() => {
  65822. this.setupInitialPlaylist(this.src);
  65823. }, 0);
  65824. return;
  65825. }
  65826. this.request = this.vhs_.xhr({
  65827. uri: this.src,
  65828. withCredentials: this.withCredentials
  65829. }, (error, req) => {
  65830. if (!this.request) {
  65831. return;
  65832. }
  65833. this.request = null;
  65834. if (error) {
  65835. this.error = {
  65836. status: req.status,
  65837. message: `HLS playlist request error at URL: ${this.src}.`,
  65838. responseText: req.responseText,
  65839. code: 2
  65840. };
  65841. if (this.state === "HAVE_NOTHING") {
  65842. this.started = false;
  65843. }
  65844. return this.trigger("error");
  65845. }
  65846. this.src = resolveManifestRedirect$1(this.src, req);
  65847. const manifest = this.parseManifest_({
  65848. manifestString: req.responseText,
  65849. url: this.src
  65850. });
  65851. this.setupInitialPlaylist(manifest);
  65852. });
  65853. }
  65854. srcUri() {
  65855. return typeof this.src === "string" ? this.src : this.src.uri;
  65856. }
  65857. setupInitialPlaylist(manifest) {
  65858. this.state = "HAVE_MAIN_MANIFEST";
  65859. if (manifest.playlists) {
  65860. this.main = manifest;
  65861. addPropertiesToMain(this.main, this.srcUri());
  65862. manifest.playlists.forEach((playlist) => {
  65863. playlist.segments = getAllSegments$1(playlist);
  65864. playlist.segments.forEach((segment) => {
  65865. resolveSegmentUris$1(segment, playlist.resolvedUri);
  65866. });
  65867. });
  65868. this.trigger("loadedplaylist");
  65869. if (!this.request) {
  65870. this.media(this.main.playlists[0]);
  65871. }
  65872. return;
  65873. }
  65874. const uri = this.srcUri() || window_1.location.href;
  65875. this.main = mainForMedia(manifest, uri);
  65876. this.haveMetadata({
  65877. playlistObject: manifest,
  65878. url: uri,
  65879. id: this.main.playlists[0].id
  65880. });
  65881. this.trigger("loadedmetadata");
  65882. }
  65883. }
  65884. const {
  65885. xhr: videojsXHR$1
  65886. } = videojs$2;
  65887. const callbackWrapper$1 = function(request, error, response, callback2) {
  65888. const reqResponse = request.responseType === "arraybuffer" ? request.response : request.responseText;
  65889. if (!error && reqResponse) {
  65890. request.responseTime = Date.now();
  65891. request.roundTripTime = request.responseTime - request.requestTime;
  65892. request.bytesReceived = reqResponse.byteLength || reqResponse.length;
  65893. if (!request.bandwidth) {
  65894. request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1e3);
  65895. }
  65896. }
  65897. if (response.headers) {
  65898. request.responseHeaders = response.headers;
  65899. }
  65900. if (error && error.code === "ETIMEDOUT") {
  65901. request.timedout = true;
  65902. }
  65903. if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) {
  65904. error = new Error("XHR Failed with a response of: " + (request && (reqResponse || request.responseText)));
  65905. }
  65906. callback2(error, request);
  65907. };
  65908. const xhrFactory$1 = function() {
  65909. const xhr = function XhrFunction(options2, callback2) {
  65910. options2 = merge$2({
  65911. timeout: 45e3
  65912. }, options2);
  65913. const beforeRequest = XhrFunction.beforeRequest || videojs$2.Vhs.xhr.beforeRequest;
  65914. if (beforeRequest && typeof beforeRequest === "function") {
  65915. const newOptions = beforeRequest(options2);
  65916. if (newOptions) {
  65917. options2 = newOptions;
  65918. }
  65919. }
  65920. const xhrMethod = videojs$2.Vhs.xhr.original === true ? videojsXHR$1 : videojs$2.Vhs.xhr;
  65921. const request = xhrMethod(options2, function(error, response) {
  65922. return callbackWrapper$1(request, error, response, callback2);
  65923. });
  65924. const originalAbort = request.abort;
  65925. request.abort = function() {
  65926. request.aborted = true;
  65927. return originalAbort.apply(request, arguments);
  65928. };
  65929. request.uri = options2.uri;
  65930. request.requestTime = Date.now();
  65931. return request;
  65932. };
  65933. xhr.original = true;
  65934. return xhr;
  65935. };
  65936. const byterangeStr$1 = function(byterange) {
  65937. let byterangeEnd;
  65938. const byterangeStart = byterange.offset;
  65939. if (typeof byterange.offset === "bigint" || typeof byterange.length === "bigint") {
  65940. byterangeEnd = window_1.BigInt(byterange.offset) + window_1.BigInt(byterange.length) - window_1.BigInt(1);
  65941. } else {
  65942. byterangeEnd = byterange.offset + byterange.length - 1;
  65943. }
  65944. return "bytes=" + byterangeStart + "-" + byterangeEnd;
  65945. };
  65946. const segmentXhrHeaders$1 = function(segment) {
  65947. const headers = {};
  65948. if (segment.byterange) {
  65949. headers.Range = byterangeStr$1(segment.byterange);
  65950. }
  65951. return headers;
  65952. };
  65953. const textRange$1 = function(range3, i2) {
  65954. return range3.start(i2) + "-" + range3.end(i2);
  65955. };
  65956. const formatHexString$1 = function(e, i2) {
  65957. const value = e.toString(16);
  65958. return "00".substring(0, 2 - value.length) + value + (i2 % 2 ? " " : "");
  65959. };
  65960. const formatAsciiString$1 = function(e) {
  65961. if (e >= 32 && e < 126) {
  65962. return String.fromCharCode(e);
  65963. }
  65964. return ".";
  65965. };
  65966. const createTransferableMessage$1 = function(message) {
  65967. const transferable = {};
  65968. Object.keys(message).forEach((key) => {
  65969. const value = message[key];
  65970. if (isArrayBufferView$1(value)) {
  65971. transferable[key] = {
  65972. bytes: value.buffer,
  65973. byteOffset: value.byteOffset,
  65974. byteLength: value.byteLength
  65975. };
  65976. } else {
  65977. transferable[key] = value;
  65978. }
  65979. });
  65980. return transferable;
  65981. };
  65982. const initSegmentId$1 = function(initSegment) {
  65983. const byterange = initSegment.byterange || {
  65984. length: Infinity,
  65985. offset: 0
  65986. };
  65987. return [byterange.length, byterange.offset, initSegment.resolvedUri].join(",");
  65988. };
  65989. const segmentKeyId$1 = function(key) {
  65990. return key.resolvedUri;
  65991. };
  65992. const hexDump$1 = (data) => {
  65993. const bytes = Array.prototype.slice.call(data);
  65994. const step = 16;
  65995. let result = "";
  65996. let hex;
  65997. let ascii;
  65998. for (let j = 0; j < bytes.length / step; j++) {
  65999. hex = bytes.slice(j * step, j * step + step).map(formatHexString$1).join("");
  66000. ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString$1).join("");
  66001. result += hex + " " + ascii + "\n";
  66002. }
  66003. return result;
  66004. };
  66005. const tagDump$1 = ({
  66006. bytes
  66007. }) => hexDump$1(bytes);
  66008. const textRanges$1 = (ranges) => {
  66009. let result = "";
  66010. let i2;
  66011. for (i2 = 0; i2 < ranges.length; i2++) {
  66012. result += textRange$1(ranges, i2) + " ";
  66013. }
  66014. return result;
  66015. };
  66016. var utils$1 = /* @__PURE__ */ Object.freeze({
  66017. __proto__: null,
  66018. createTransferableMessage: createTransferableMessage$1,
  66019. initSegmentId: initSegmentId$1,
  66020. segmentKeyId: segmentKeyId$1,
  66021. hexDump: hexDump$1,
  66022. tagDump: tagDump$1,
  66023. textRanges: textRanges$1
  66024. });
  66025. const SEGMENT_END_FUDGE_PERCENT$1 = 0.25;
  66026. const playerTimeToProgramTime$1 = (playerTime, segment) => {
  66027. if (!segment.dateTimeObject) {
  66028. return null;
  66029. }
  66030. const transmuxerPrependedSeconds = segment.videoTimingInfo.transmuxerPrependedSeconds;
  66031. const transmuxedStart = segment.videoTimingInfo.transmuxedPresentationStart;
  66032. const startOfSegment = transmuxedStart + transmuxerPrependedSeconds;
  66033. const offsetFromSegmentStart = playerTime - startOfSegment;
  66034. return new Date(segment.dateTimeObject.getTime() + offsetFromSegmentStart * 1e3);
  66035. };
  66036. const originalSegmentVideoDuration$1 = (videoTimingInfo) => {
  66037. return videoTimingInfo.transmuxedPresentationEnd - videoTimingInfo.transmuxedPresentationStart - videoTimingInfo.transmuxerPrependedSeconds;
  66038. };
  66039. const findSegmentForProgramTime$1 = (programTime, playlist) => {
  66040. let dateTimeObject;
  66041. try {
  66042. dateTimeObject = new Date(programTime);
  66043. } catch (e) {
  66044. return null;
  66045. }
  66046. if (!playlist || !playlist.segments || playlist.segments.length === 0) {
  66047. return null;
  66048. }
  66049. let segment = playlist.segments[0];
  66050. if (dateTimeObject < segment.dateTimeObject) {
  66051. return null;
  66052. }
  66053. for (let i2 = 0; i2 < playlist.segments.length - 1; i2++) {
  66054. segment = playlist.segments[i2];
  66055. const nextSegmentStart = playlist.segments[i2 + 1].dateTimeObject;
  66056. if (dateTimeObject < nextSegmentStart) {
  66057. break;
  66058. }
  66059. }
  66060. const lastSegment = playlist.segments[playlist.segments.length - 1];
  66061. const lastSegmentStart = lastSegment.dateTimeObject;
  66062. const lastSegmentDuration = lastSegment.videoTimingInfo ? originalSegmentVideoDuration$1(lastSegment.videoTimingInfo) : lastSegment.duration + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT$1;
  66063. const lastSegmentEnd = new Date(lastSegmentStart.getTime() + lastSegmentDuration * 1e3);
  66064. if (dateTimeObject > lastSegmentEnd) {
  66065. return null;
  66066. }
  66067. if (dateTimeObject > lastSegmentStart) {
  66068. segment = lastSegment;
  66069. }
  66070. return {
  66071. segment,
  66072. estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : Playlist$1.duration(playlist, playlist.mediaSequence + playlist.segments.indexOf(segment)),
  66073. type: segment.videoTimingInfo ? "accurate" : "estimate"
  66074. };
  66075. };
  66076. const findSegmentForPlayerTime$1 = (time, playlist) => {
  66077. if (!playlist || !playlist.segments || playlist.segments.length === 0) {
  66078. return null;
  66079. }
  66080. let segmentEnd = 0;
  66081. let segment;
  66082. for (let i2 = 0; i2 < playlist.segments.length; i2++) {
  66083. segment = playlist.segments[i2];
  66084. segmentEnd = segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationEnd : segmentEnd + segment.duration;
  66085. if (time <= segmentEnd) {
  66086. break;
  66087. }
  66088. }
  66089. const lastSegment = playlist.segments[playlist.segments.length - 1];
  66090. if (lastSegment.videoTimingInfo && lastSegment.videoTimingInfo.transmuxedPresentationEnd < time) {
  66091. return null;
  66092. }
  66093. if (time > segmentEnd) {
  66094. if (time > segmentEnd + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT$1) {
  66095. return null;
  66096. }
  66097. segment = lastSegment;
  66098. }
  66099. return {
  66100. segment,
  66101. estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : segmentEnd - segment.duration,
  66102. type: segment.videoTimingInfo ? "accurate" : "estimate"
  66103. };
  66104. };
  66105. const getOffsetFromTimestamp$1 = (comparisonTimeStamp, programTime) => {
  66106. let segmentDateTime;
  66107. let programDateTime;
  66108. try {
  66109. segmentDateTime = new Date(comparisonTimeStamp);
  66110. programDateTime = new Date(programTime);
  66111. } catch (e) {
  66112. }
  66113. const segmentTimeEpoch = segmentDateTime.getTime();
  66114. const programTimeEpoch = programDateTime.getTime();
  66115. return (programTimeEpoch - segmentTimeEpoch) / 1e3;
  66116. };
  66117. const verifyProgramDateTimeTags$1 = (playlist) => {
  66118. if (!playlist.segments || playlist.segments.length === 0) {
  66119. return false;
  66120. }
  66121. for (let i2 = 0; i2 < playlist.segments.length; i2++) {
  66122. const segment = playlist.segments[i2];
  66123. if (!segment.dateTimeObject) {
  66124. return false;
  66125. }
  66126. }
  66127. return true;
  66128. };
  66129. const getProgramTime$1 = ({
  66130. playlist,
  66131. time = void 0,
  66132. callback: callback2
  66133. }) => {
  66134. if (!callback2) {
  66135. throw new Error("getProgramTime: callback must be provided");
  66136. }
  66137. if (!playlist || time === void 0) {
  66138. return callback2({
  66139. message: "getProgramTime: playlist and time must be provided"
  66140. });
  66141. }
  66142. const matchedSegment = findSegmentForPlayerTime$1(time, playlist);
  66143. if (!matchedSegment) {
  66144. return callback2({
  66145. message: "valid programTime was not found"
  66146. });
  66147. }
  66148. if (matchedSegment.type === "estimate") {
  66149. return callback2({
  66150. message: "Accurate programTime could not be determined. Please seek to e.seekTime and try again",
  66151. seekTime: matchedSegment.estimatedStart
  66152. });
  66153. }
  66154. const programTimeObject = {
  66155. mediaSeconds: time
  66156. };
  66157. const programTime = playerTimeToProgramTime$1(time, matchedSegment.segment);
  66158. if (programTime) {
  66159. programTimeObject.programDateTime = programTime.toISOString();
  66160. }
  66161. return callback2(null, programTimeObject);
  66162. };
  66163. const seekToProgramTime$1 = ({
  66164. programTime,
  66165. playlist,
  66166. retryCount = 2,
  66167. seekTo,
  66168. pauseAfterSeek = true,
  66169. tech,
  66170. callback: callback2
  66171. }) => {
  66172. if (!callback2) {
  66173. throw new Error("seekToProgramTime: callback must be provided");
  66174. }
  66175. if (typeof programTime === "undefined" || !playlist || !seekTo) {
  66176. return callback2({
  66177. message: "seekToProgramTime: programTime, seekTo and playlist must be provided"
  66178. });
  66179. }
  66180. if (!playlist.endList && !tech.hasStarted_) {
  66181. return callback2({
  66182. message: "player must be playing a live stream to start buffering"
  66183. });
  66184. }
  66185. if (!verifyProgramDateTimeTags$1(playlist)) {
  66186. return callback2({
  66187. message: "programDateTime tags must be provided in the manifest " + playlist.resolvedUri
  66188. });
  66189. }
  66190. const matchedSegment = findSegmentForProgramTime$1(programTime, playlist);
  66191. if (!matchedSegment) {
  66192. return callback2({
  66193. message: `${programTime} was not found in the stream`
  66194. });
  66195. }
  66196. const segment = matchedSegment.segment;
  66197. const mediaOffset = getOffsetFromTimestamp$1(segment.dateTimeObject, programTime);
  66198. if (matchedSegment.type === "estimate") {
  66199. if (retryCount === 0) {
  66200. return callback2({
  66201. message: `${programTime} is not buffered yet. Try again`
  66202. });
  66203. }
  66204. seekTo(matchedSegment.estimatedStart + mediaOffset);
  66205. tech.one("seeked", () => {
  66206. seekToProgramTime$1({
  66207. programTime,
  66208. playlist,
  66209. retryCount: retryCount - 1,
  66210. seekTo,
  66211. pauseAfterSeek,
  66212. tech,
  66213. callback: callback2
  66214. });
  66215. });
  66216. return;
  66217. }
  66218. const seekToTime = segment.start + mediaOffset;
  66219. const seekedCallback = () => {
  66220. return callback2(null, tech.currentTime());
  66221. };
  66222. tech.one("seeked", seekedCallback);
  66223. if (pauseAfterSeek) {
  66224. tech.pause();
  66225. }
  66226. seekTo(seekToTime);
  66227. };
  66228. const callbackOnCompleted$1 = (request, cb) => {
  66229. if (request.readyState === 4) {
  66230. return cb();
  66231. }
  66232. return;
  66233. };
  66234. const containerRequest$1 = (uri, xhr, cb) => {
  66235. let bytes = [];
  66236. let id3Offset;
  66237. let finished = false;
  66238. const endRequestAndCallback = function(err, req, type2, _bytes) {
  66239. req.abort();
  66240. finished = true;
  66241. return cb(err, req, type2, _bytes);
  66242. };
  66243. const progressListener = function(error, request2) {
  66244. if (finished) {
  66245. return;
  66246. }
  66247. if (error) {
  66248. return endRequestAndCallback(error, request2, "", bytes);
  66249. }
  66250. const newPart = request2.responseText.substring(bytes && bytes.byteLength || 0, request2.responseText.length);
  66251. bytes = concatTypedArrays$1(bytes, stringToBytes$1(newPart, true));
  66252. id3Offset = id3Offset || getId3Offset$1(bytes);
  66253. if (bytes.length < 10 || id3Offset && bytes.length < id3Offset + 2) {
  66254. return callbackOnCompleted$1(request2, () => endRequestAndCallback(error, request2, "", bytes));
  66255. }
  66256. const type2 = detectContainerForBytes$1(bytes);
  66257. if (type2 === "ts" && bytes.length < 188) {
  66258. return callbackOnCompleted$1(request2, () => endRequestAndCallback(error, request2, "", bytes));
  66259. }
  66260. if (!type2 && bytes.length < 376) {
  66261. return callbackOnCompleted$1(request2, () => endRequestAndCallback(error, request2, "", bytes));
  66262. }
  66263. return endRequestAndCallback(null, request2, type2, bytes);
  66264. };
  66265. const options2 = {
  66266. uri,
  66267. beforeSend(request2) {
  66268. request2.overrideMimeType("text/plain; charset=x-user-defined");
  66269. request2.addEventListener("progress", function({
  66270. total,
  66271. loaded
  66272. }) {
  66273. return callbackWrapper$1(request2, null, {
  66274. statusCode: request2.status
  66275. }, progressListener);
  66276. });
  66277. }
  66278. };
  66279. const request = xhr(options2, function(error, response) {
  66280. return callbackWrapper$1(request, error, response, progressListener);
  66281. });
  66282. return request;
  66283. };
  66284. const {
  66285. EventTarget: EventTarget$3
  66286. } = videojs$2;
  66287. const dashPlaylistUnchanged$1 = function(a, b) {
  66288. if (!isPlaylistUnchanged$1(a, b)) {
  66289. return false;
  66290. }
  66291. if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) {
  66292. return false;
  66293. } else if (!a.sidx && b.sidx || a.sidx && !b.sidx) {
  66294. return false;
  66295. }
  66296. if (a.segments && !b.segments || !a.segments && b.segments) {
  66297. return false;
  66298. }
  66299. if (!a.segments && !b.segments) {
  66300. return true;
  66301. }
  66302. for (let i2 = 0; i2 < a.segments.length; i2++) {
  66303. const aSegment = a.segments[i2];
  66304. const bSegment = b.segments[i2];
  66305. if (aSegment.uri !== bSegment.uri) {
  66306. return false;
  66307. }
  66308. if (!aSegment.byterange && !bSegment.byterange) {
  66309. continue;
  66310. }
  66311. const aByterange = aSegment.byterange;
  66312. const bByterange = bSegment.byterange;
  66313. if (aByterange && !bByterange || !aByterange && bByterange) {
  66314. return false;
  66315. }
  66316. if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) {
  66317. return false;
  66318. }
  66319. }
  66320. return true;
  66321. };
  66322. const dashGroupId$1 = (type2, group, label, playlist) => {
  66323. const playlistId = playlist.attributes.NAME || label;
  66324. return `placeholder-uri-${type2}-${group}-${playlistId}`;
  66325. };
  66326. const parseMainXml = ({
  66327. mainXml,
  66328. srcUrl,
  66329. clientOffset,
  66330. sidxMapping,
  66331. previousManifest
  66332. }) => {
  66333. const manifest = parse$1(mainXml, {
  66334. manifestUri: srcUrl,
  66335. clientOffset,
  66336. sidxMapping,
  66337. previousManifest
  66338. });
  66339. addPropertiesToMain(manifest, srcUrl, dashGroupId$1);
  66340. return manifest;
  66341. };
  66342. const removeOldMediaGroupLabels$1 = (update, newMain) => {
  66343. forEachMediaGroup$2(update, (properties, type2, group, label) => {
  66344. if (!(label in newMain.mediaGroups[type2][group])) {
  66345. delete update.mediaGroups[type2][group][label];
  66346. }
  66347. });
  66348. };
  66349. const updateMain = (oldMain, newMain, sidxMapping) => {
  66350. let noChanges = true;
  66351. let update = merge$2(oldMain, {
  66352. duration: newMain.duration,
  66353. minimumUpdatePeriod: newMain.minimumUpdatePeriod,
  66354. timelineStarts: newMain.timelineStarts
  66355. });
  66356. for (let i2 = 0; i2 < newMain.playlists.length; i2++) {
  66357. const playlist = newMain.playlists[i2];
  66358. if (playlist.sidx) {
  66359. const sidxKey = generateSidxKey$1(playlist.sidx);
  66360. if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) {
  66361. addSidxSegmentsToPlaylist$1$1(playlist, sidxMapping[sidxKey].sidx, playlist.sidx.resolvedUri);
  66362. }
  66363. }
  66364. const playlistUpdate = updateMain$1(update, playlist, dashPlaylistUnchanged$1);
  66365. if (playlistUpdate) {
  66366. update = playlistUpdate;
  66367. noChanges = false;
  66368. }
  66369. }
  66370. forEachMediaGroup$2(newMain, (properties, type2, group, label) => {
  66371. if (properties.playlists && properties.playlists.length) {
  66372. const id = properties.playlists[0].id;
  66373. const playlistUpdate = updateMain$1(update, properties.playlists[0], dashPlaylistUnchanged$1);
  66374. if (playlistUpdate) {
  66375. update = playlistUpdate;
  66376. if (!(label in update.mediaGroups[type2][group])) {
  66377. update.mediaGroups[type2][group][label] = properties;
  66378. }
  66379. update.mediaGroups[type2][group][label].playlists[0] = update.playlists[id];
  66380. noChanges = false;
  66381. }
  66382. }
  66383. });
  66384. removeOldMediaGroupLabels$1(update, newMain);
  66385. if (newMain.minimumUpdatePeriod !== oldMain.minimumUpdatePeriod) {
  66386. noChanges = false;
  66387. }
  66388. if (noChanges) {
  66389. return null;
  66390. }
  66391. return update;
  66392. };
  66393. const equivalentSidx$1 = (a, b) => {
  66394. const neitherMap = Boolean(!a.map && !b.map);
  66395. const equivalentMap = neitherMap || Boolean(a.map && b.map && a.map.byterange.offset === b.map.byterange.offset && a.map.byterange.length === b.map.byterange.length);
  66396. return equivalentMap && a.uri === b.uri && a.byterange.offset === b.byterange.offset && a.byterange.length === b.byterange.length;
  66397. };
  66398. const compareSidxEntry$1 = (playlists, oldSidxMapping) => {
  66399. const newSidxMapping = {};
  66400. for (const id in playlists) {
  66401. const playlist = playlists[id];
  66402. const currentSidxInfo = playlist.sidx;
  66403. if (currentSidxInfo) {
  66404. const key = generateSidxKey$1(currentSidxInfo);
  66405. if (!oldSidxMapping[key]) {
  66406. break;
  66407. }
  66408. const savedSidxInfo = oldSidxMapping[key].sidxInfo;
  66409. if (equivalentSidx$1(savedSidxInfo, currentSidxInfo)) {
  66410. newSidxMapping[key] = oldSidxMapping[key];
  66411. }
  66412. }
  66413. }
  66414. return newSidxMapping;
  66415. };
  66416. const filterChangedSidxMappings$1 = (main, oldSidxMapping) => {
  66417. const videoSidx = compareSidxEntry$1(main.playlists, oldSidxMapping);
  66418. let mediaGroupSidx = videoSidx;
  66419. forEachMediaGroup$2(main, (properties, mediaType, groupKey, labelKey) => {
  66420. if (properties.playlists && properties.playlists.length) {
  66421. const playlists = properties.playlists;
  66422. mediaGroupSidx = merge$2(mediaGroupSidx, compareSidxEntry$1(playlists, oldSidxMapping));
  66423. }
  66424. });
  66425. return mediaGroupSidx;
  66426. };
  66427. class DashPlaylistLoader$1 extends EventTarget$3 {
  66428. constructor(srcUrlOrPlaylist, vhs, options2 = {}, mainPlaylistLoader) {
  66429. super();
  66430. this.mainPlaylistLoader_ = mainPlaylistLoader || this;
  66431. if (!mainPlaylistLoader) {
  66432. this.isMain_ = true;
  66433. }
  66434. const {
  66435. withCredentials = false
  66436. } = options2;
  66437. this.vhs_ = vhs;
  66438. this.withCredentials = withCredentials;
  66439. if (!srcUrlOrPlaylist) {
  66440. throw new Error("A non-empty playlist URL or object is required");
  66441. }
  66442. this.on("minimumUpdatePeriod", () => {
  66443. this.refreshXml_();
  66444. });
  66445. this.on("mediaupdatetimeout", () => {
  66446. this.refreshMedia_(this.media().id);
  66447. });
  66448. this.state = "HAVE_NOTHING";
  66449. this.loadedPlaylists_ = {};
  66450. this.logger_ = logger$1("DashPlaylistLoader");
  66451. if (this.isMain_) {
  66452. this.mainPlaylistLoader_.srcUrl = srcUrlOrPlaylist;
  66453. this.mainPlaylistLoader_.sidxMapping_ = {};
  66454. } else {
  66455. this.childPlaylist_ = srcUrlOrPlaylist;
  66456. }
  66457. }
  66458. requestErrored_(err, request, startingState) {
  66459. if (!this.request) {
  66460. return true;
  66461. }
  66462. this.request = null;
  66463. if (err) {
  66464. this.error = typeof err === "object" && !(err instanceof Error) ? err : {
  66465. status: request.status,
  66466. message: "DASH request error at URL: " + request.uri,
  66467. response: request.response,
  66468. code: 2
  66469. };
  66470. if (startingState) {
  66471. this.state = startingState;
  66472. }
  66473. this.trigger("error");
  66474. return true;
  66475. }
  66476. }
  66477. addSidxSegments_(playlist, startingState, cb) {
  66478. const sidxKey = playlist.sidx && generateSidxKey$1(playlist.sidx);
  66479. if (!playlist.sidx || !sidxKey || this.mainPlaylistLoader_.sidxMapping_[sidxKey]) {
  66480. this.mediaRequest_ = window_1.setTimeout(() => cb(false), 0);
  66481. return;
  66482. }
  66483. const uri = resolveManifestRedirect$1(playlist.sidx.resolvedUri);
  66484. const fin = (err, request) => {
  66485. if (this.requestErrored_(err, request, startingState)) {
  66486. return;
  66487. }
  66488. const sidxMapping = this.mainPlaylistLoader_.sidxMapping_;
  66489. let sidx;
  66490. try {
  66491. sidx = parseSidx_1$1(toUint8$1(request.response).subarray(8));
  66492. } catch (e) {
  66493. this.requestErrored_(e, request, startingState);
  66494. return;
  66495. }
  66496. sidxMapping[sidxKey] = {
  66497. sidxInfo: playlist.sidx,
  66498. sidx
  66499. };
  66500. addSidxSegmentsToPlaylist$1$1(playlist, sidx, playlist.sidx.resolvedUri);
  66501. return cb(true);
  66502. };
  66503. this.request = containerRequest$1(uri, this.vhs_.xhr, (err, request, container, bytes) => {
  66504. if (err) {
  66505. return fin(err, request);
  66506. }
  66507. if (!container || container !== "mp4") {
  66508. return fin({
  66509. status: request.status,
  66510. message: `Unsupported ${container || "unknown"} container type for sidx segment at URL: ${uri}`,
  66511. response: "",
  66512. playlist,
  66513. internal: true,
  66514. playlistExclusionDuration: Infinity,
  66515. code: 2
  66516. }, request);
  66517. }
  66518. const {
  66519. offset,
  66520. length
  66521. } = playlist.sidx.byterange;
  66522. if (bytes.length >= length + offset) {
  66523. return fin(err, {
  66524. response: bytes.subarray(offset, offset + length),
  66525. status: request.status,
  66526. uri: request.uri
  66527. });
  66528. }
  66529. this.request = this.vhs_.xhr({
  66530. uri,
  66531. responseType: "arraybuffer",
  66532. headers: segmentXhrHeaders$1({
  66533. byterange: playlist.sidx.byterange
  66534. })
  66535. }, fin);
  66536. });
  66537. }
  66538. dispose() {
  66539. this.trigger("dispose");
  66540. this.stopRequest();
  66541. this.loadedPlaylists_ = {};
  66542. window_1.clearTimeout(this.minimumUpdatePeriodTimeout_);
  66543. window_1.clearTimeout(this.mediaRequest_);
  66544. window_1.clearTimeout(this.mediaUpdateTimeout);
  66545. this.mediaUpdateTimeout = null;
  66546. this.mediaRequest_ = null;
  66547. this.minimumUpdatePeriodTimeout_ = null;
  66548. if (this.mainPlaylistLoader_.createMupOnMedia_) {
  66549. this.off("loadedmetadata", this.mainPlaylistLoader_.createMupOnMedia_);
  66550. this.mainPlaylistLoader_.createMupOnMedia_ = null;
  66551. }
  66552. this.off();
  66553. }
  66554. hasPendingRequest() {
  66555. return this.request || this.mediaRequest_;
  66556. }
  66557. stopRequest() {
  66558. if (this.request) {
  66559. const oldRequest = this.request;
  66560. this.request = null;
  66561. oldRequest.onreadystatechange = null;
  66562. oldRequest.abort();
  66563. }
  66564. }
  66565. media(playlist) {
  66566. if (!playlist) {
  66567. return this.media_;
  66568. }
  66569. if (this.state === "HAVE_NOTHING") {
  66570. throw new Error("Cannot switch media playlist from " + this.state);
  66571. }
  66572. const startingState = this.state;
  66573. if (typeof playlist === "string") {
  66574. if (!this.mainPlaylistLoader_.main.playlists[playlist]) {
  66575. throw new Error("Unknown playlist URI: " + playlist);
  66576. }
  66577. playlist = this.mainPlaylistLoader_.main.playlists[playlist];
  66578. }
  66579. const mediaChange = !this.media_ || playlist.id !== this.media_.id;
  66580. if (mediaChange && this.loadedPlaylists_[playlist.id] && this.loadedPlaylists_[playlist.id].endList) {
  66581. this.state = "HAVE_METADATA";
  66582. this.media_ = playlist;
  66583. if (mediaChange) {
  66584. this.trigger("mediachanging");
  66585. this.trigger("mediachange");
  66586. }
  66587. return;
  66588. }
  66589. if (!mediaChange) {
  66590. return;
  66591. }
  66592. if (this.media_) {
  66593. this.trigger("mediachanging");
  66594. }
  66595. this.addSidxSegments_(playlist, startingState, (sidxChanged) => {
  66596. this.haveMetadata({
  66597. startingState,
  66598. playlist
  66599. });
  66600. });
  66601. }
  66602. haveMetadata({
  66603. startingState,
  66604. playlist
  66605. }) {
  66606. this.state = "HAVE_METADATA";
  66607. this.loadedPlaylists_[playlist.id] = playlist;
  66608. this.mediaRequest_ = null;
  66609. this.refreshMedia_(playlist.id);
  66610. if (startingState === "HAVE_MAIN_MANIFEST") {
  66611. this.trigger("loadedmetadata");
  66612. } else {
  66613. this.trigger("mediachange");
  66614. }
  66615. }
  66616. pause() {
  66617. if (this.mainPlaylistLoader_.createMupOnMedia_) {
  66618. this.off("loadedmetadata", this.mainPlaylistLoader_.createMupOnMedia_);
  66619. this.mainPlaylistLoader_.createMupOnMedia_ = null;
  66620. }
  66621. this.stopRequest();
  66622. window_1.clearTimeout(this.mediaUpdateTimeout);
  66623. this.mediaUpdateTimeout = null;
  66624. if (this.isMain_) {
  66625. window_1.clearTimeout(this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_);
  66626. this.mainPlaylistLoader_.minimumUpdatePeriodTimeout_ = null;
  66627. }
  66628. if (this.state === "HAVE_NOTHING") {
  66629. this.started = false;
  66630. }
  66631. }
  66632. load(isFinalRendition) {
  66633. window_1.clearTimeout(this.mediaUpdateTimeout);
  66634. this.mediaUpdateTimeout = null;
  66635. const media = this.media();
  66636. if (isFinalRendition) {
  66637. const delay = media ? media.targetDuration / 2 * 1e3 : 5 * 1e3;
  66638. this.mediaUpdateTimeout = window_1.setTimeout(() => this.load(), delay);
  66639. return;
  66640. }
  66641. if (!this.started) {
  66642. this.start();
  66643. return;
  66644. }
  66645. if (media && !media.endList) {
  66646. if (this.isMain_ && !this.minimumUpdatePeriodTimeout_) {
  66647. this.trigger("minimumUpdatePeriod");
  66648. this.updateMinimumUpdatePeriodTimeout_();
  66649. }
  66650. this.trigger("mediaupdatetimeout");
  66651. } else {
  66652. this.trigger("loadedplaylist");
  66653. }
  66654. }
  66655. start() {
  66656. this.started = true;
  66657. if (!this.isMain_) {
  66658. this.mediaRequest_ = window_1.setTimeout(() => this.haveMain_(), 0);
  66659. return;
  66660. }
  66661. this.requestMain_((req, mainChanged) => {
  66662. this.haveMain_();
  66663. if (!this.hasPendingRequest() && !this.media_) {
  66664. this.media(this.mainPlaylistLoader_.main.playlists[0]);
  66665. }
  66666. });
  66667. }
  66668. requestMain_(cb) {
  66669. this.request = this.vhs_.xhr({
  66670. uri: this.mainPlaylistLoader_.srcUrl,
  66671. withCredentials: this.withCredentials
  66672. }, (error, req) => {
  66673. if (this.requestErrored_(error, req)) {
  66674. if (this.state === "HAVE_NOTHING") {
  66675. this.started = false;
  66676. }
  66677. return;
  66678. }
  66679. const mainChanged = req.responseText !== this.mainPlaylistLoader_.mainXml_;
  66680. this.mainPlaylistLoader_.mainXml_ = req.responseText;
  66681. if (req.responseHeaders && req.responseHeaders.date) {
  66682. this.mainLoaded_ = Date.parse(req.responseHeaders.date);
  66683. } else {
  66684. this.mainLoaded_ = Date.now();
  66685. }
  66686. this.mainPlaylistLoader_.srcUrl = resolveManifestRedirect$1(this.mainPlaylistLoader_.srcUrl, req);
  66687. if (mainChanged) {
  66688. this.handleMain_();
  66689. this.syncClientServerClock_(() => {
  66690. return cb(req, mainChanged);
  66691. });
  66692. return;
  66693. }
  66694. return cb(req, mainChanged);
  66695. });
  66696. }
  66697. syncClientServerClock_(done) {
  66698. const utcTiming = parseUTCTiming$1(this.mainPlaylistLoader_.mainXml_);
  66699. if (utcTiming === null) {
  66700. this.mainPlaylistLoader_.clientOffset_ = this.mainLoaded_ - Date.now();
  66701. return done();
  66702. }
  66703. if (utcTiming.method === "DIRECT") {
  66704. this.mainPlaylistLoader_.clientOffset_ = utcTiming.value - Date.now();
  66705. return done();
  66706. }
  66707. this.request = this.vhs_.xhr({
  66708. uri: resolveUrl$2(this.mainPlaylistLoader_.srcUrl, utcTiming.value),
  66709. method: utcTiming.method,
  66710. withCredentials: this.withCredentials
  66711. }, (error, req) => {
  66712. if (!this.request) {
  66713. return;
  66714. }
  66715. if (error) {
  66716. this.mainPlaylistLoader_.clientOffset_ = this.mainLoaded_ - Date.now();
  66717. return done();
  66718. }
  66719. let serverTime;
  66720. if (utcTiming.method === "HEAD") {
  66721. if (!req.responseHeaders || !req.responseHeaders.date) {
  66722. serverTime = this.mainLoaded_;
  66723. } else {
  66724. serverTime = Date.parse(req.responseHeaders.date);
  66725. }
  66726. } else {
  66727. serverTime = Date.parse(req.responseText);
  66728. }
  66729. this.mainPlaylistLoader_.clientOffset_ = serverTime - Date.now();
  66730. done();
  66731. });
  66732. }
  66733. haveMain_() {
  66734. this.state = "HAVE_MAIN_MANIFEST";
  66735. if (this.isMain_) {
  66736. this.trigger("loadedplaylist");
  66737. } else if (!this.media_) {
  66738. this.media(this.childPlaylist_);
  66739. }
  66740. }
  66741. handleMain_() {
  66742. this.mediaRequest_ = null;
  66743. const oldMain = this.mainPlaylistLoader_.main;
  66744. let newMain = parseMainXml({
  66745. mainXml: this.mainPlaylistLoader_.mainXml_,
  66746. srcUrl: this.mainPlaylistLoader_.srcUrl,
  66747. clientOffset: this.mainPlaylistLoader_.clientOffset_,
  66748. sidxMapping: this.mainPlaylistLoader_.sidxMapping_,
  66749. previousManifest: oldMain
  66750. });
  66751. if (oldMain) {
  66752. newMain = updateMain(oldMain, newMain, this.mainPlaylistLoader_.sidxMapping_);
  66753. }
  66754. this.mainPlaylistLoader_.main = newMain ? newMain : oldMain;
  66755. const location = this.mainPlaylistLoader_.main.locations && this.mainPlaylistLoader_.main.locations[0];
  66756. if (location && location !== this.mainPlaylistLoader_.srcUrl) {
  66757. this.mainPlaylistLoader_.srcUrl = location;
  66758. }
  66759. if (!oldMain || newMain && newMain.minimumUpdatePeriod !== oldMain.minimumUpdatePeriod) {
  66760. this.updateMinimumUpdatePeriodTimeout_();
  66761. }
  66762. return Boolean(newMain);
  66763. }
  66764. updateMinimumUpdatePeriodTimeout_() {
  66765. const mpl = this.mainPlaylistLoader_;
  66766. if (mpl.createMupOnMedia_) {
  66767. mpl.off("loadedmetadata", mpl.createMupOnMedia_);
  66768. mpl.createMupOnMedia_ = null;
  66769. }
  66770. if (mpl.minimumUpdatePeriodTimeout_) {
  66771. window_1.clearTimeout(mpl.minimumUpdatePeriodTimeout_);
  66772. mpl.minimumUpdatePeriodTimeout_ = null;
  66773. }
  66774. let mup = mpl.main && mpl.main.minimumUpdatePeriod;
  66775. if (mup === 0) {
  66776. if (mpl.media()) {
  66777. mup = mpl.media().targetDuration * 1e3;
  66778. } else {
  66779. mpl.createMupOnMedia_ = mpl.updateMinimumUpdatePeriodTimeout_;
  66780. mpl.one("loadedmetadata", mpl.createMupOnMedia_);
  66781. }
  66782. }
  66783. if (typeof mup !== "number" || mup <= 0) {
  66784. if (mup < 0) {
  66785. this.logger_(`found invalid minimumUpdatePeriod of ${mup}, not setting a timeout`);
  66786. }
  66787. return;
  66788. }
  66789. this.createMUPTimeout_(mup);
  66790. }
  66791. createMUPTimeout_(mup) {
  66792. const mpl = this.mainPlaylistLoader_;
  66793. mpl.minimumUpdatePeriodTimeout_ = window_1.setTimeout(() => {
  66794. mpl.minimumUpdatePeriodTimeout_ = null;
  66795. mpl.trigger("minimumUpdatePeriod");
  66796. mpl.createMUPTimeout_(mup);
  66797. }, mup);
  66798. }
  66799. refreshXml_() {
  66800. this.requestMain_((req, mainChanged) => {
  66801. if (!mainChanged) {
  66802. return;
  66803. }
  66804. if (this.media_) {
  66805. this.media_ = this.mainPlaylistLoader_.main.playlists[this.media_.id];
  66806. }
  66807. this.mainPlaylistLoader_.sidxMapping_ = filterChangedSidxMappings$1(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.sidxMapping_);
  66808. this.addSidxSegments_(this.media(), this.state, (sidxChanged) => {
  66809. this.refreshMedia_(this.media().id);
  66810. });
  66811. });
  66812. }
  66813. refreshMedia_(mediaID) {
  66814. if (!mediaID) {
  66815. throw new Error("refreshMedia_ must take a media id");
  66816. }
  66817. if (this.media_ && this.isMain_) {
  66818. this.handleMain_();
  66819. }
  66820. const playlists = this.mainPlaylistLoader_.main.playlists;
  66821. const mediaChanged = !this.media_ || this.media_ !== playlists[mediaID];
  66822. if (mediaChanged) {
  66823. this.media_ = playlists[mediaID];
  66824. } else {
  66825. this.trigger("playlistunchanged");
  66826. }
  66827. if (!this.mediaUpdateTimeout) {
  66828. const createMediaUpdateTimeout = () => {
  66829. if (this.media().endList) {
  66830. return;
  66831. }
  66832. this.mediaUpdateTimeout = window_1.setTimeout(() => {
  66833. this.trigger("mediaupdatetimeout");
  66834. createMediaUpdateTimeout();
  66835. }, refreshDelay$1(this.media(), Boolean(mediaChanged)));
  66836. };
  66837. createMediaUpdateTimeout();
  66838. }
  66839. this.trigger("loadedplaylist");
  66840. }
  66841. }
  66842. var Config$1 = {
  66843. GOAL_BUFFER_LENGTH: 30,
  66844. MAX_GOAL_BUFFER_LENGTH: 60,
  66845. BACK_BUFFER_LENGTH: 30,
  66846. GOAL_BUFFER_LENGTH_RATE: 1,
  66847. INITIAL_BANDWIDTH: 4194304,
  66848. BANDWIDTH_VARIANCE: 1.2,
  66849. BUFFER_LOW_WATER_LINE: 0,
  66850. MAX_BUFFER_LOW_WATER_LINE: 30,
  66851. EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16,
  66852. BUFFER_LOW_WATER_LINE_RATE: 1,
  66853. BUFFER_HIGH_WATER_LINE: 30
  66854. };
  66855. const stringToArrayBuffer$1 = (string) => {
  66856. const view = new Uint8Array(new ArrayBuffer(string.length));
  66857. for (let i2 = 0; i2 < string.length; i2++) {
  66858. view[i2] = string.charCodeAt(i2);
  66859. }
  66860. return view.buffer;
  66861. };
  66862. const browserWorkerPolyFill$1 = function(workerObj) {
  66863. workerObj.on = workerObj.addEventListener;
  66864. workerObj.off = workerObj.removeEventListener;
  66865. return workerObj;
  66866. };
  66867. const createObjectURL$1 = function(str) {
  66868. try {
  66869. return URL.createObjectURL(new Blob([str], {
  66870. type: "application/javascript"
  66871. }));
  66872. } catch (e) {
  66873. const blob = new BlobBuilder();
  66874. blob.append(str);
  66875. return URL.createObjectURL(blob.getBlob());
  66876. }
  66877. };
  66878. const factory$1 = function(code) {
  66879. return function() {
  66880. const objectUrl = createObjectURL$1(code);
  66881. const worker = browserWorkerPolyFill$1(new Worker(objectUrl));
  66882. worker.objURL = objectUrl;
  66883. const terminate = worker.terminate;
  66884. worker.on = worker.addEventListener;
  66885. worker.off = worker.removeEventListener;
  66886. worker.terminate = function() {
  66887. URL.revokeObjectURL(objectUrl);
  66888. return terminate.call(this);
  66889. };
  66890. return worker;
  66891. };
  66892. };
  66893. const transform$1 = function(code) {
  66894. return `var browserWorkerPolyFill = ${browserWorkerPolyFill$1.toString()};
  66895. browserWorkerPolyFill(self);
  66896. ` + code;
  66897. };
  66898. const getWorkerString$1 = function(fn2) {
  66899. return fn2.toString().replace(/^function.+?{/, "").slice(0, -1);
  66900. };
  66901. const workerCode$1$1 = transform$1(getWorkerString$1(function() {
  66902. var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  66903. var Stream$8 = function() {
  66904. this.init = function() {
  66905. var listeners = {};
  66906. this.on = function(type3, listener) {
  66907. if (!listeners[type3]) {
  66908. listeners[type3] = [];
  66909. }
  66910. listeners[type3] = listeners[type3].concat(listener);
  66911. };
  66912. this.off = function(type3, listener) {
  66913. var index2;
  66914. if (!listeners[type3]) {
  66915. return false;
  66916. }
  66917. index2 = listeners[type3].indexOf(listener);
  66918. listeners[type3] = listeners[type3].slice();
  66919. listeners[type3].splice(index2, 1);
  66920. return index2 > -1;
  66921. };
  66922. this.trigger = function(type3) {
  66923. var callbacks, i2, length, args;
  66924. callbacks = listeners[type3];
  66925. if (!callbacks) {
  66926. return;
  66927. }
  66928. if (arguments.length === 2) {
  66929. length = callbacks.length;
  66930. for (i2 = 0; i2 < length; ++i2) {
  66931. callbacks[i2].call(this, arguments[1]);
  66932. }
  66933. } else {
  66934. args = [];
  66935. i2 = arguments.length;
  66936. for (i2 = 1; i2 < arguments.length; ++i2) {
  66937. args.push(arguments[i2]);
  66938. }
  66939. length = callbacks.length;
  66940. for (i2 = 0; i2 < length; ++i2) {
  66941. callbacks[i2].apply(this, args);
  66942. }
  66943. }
  66944. };
  66945. this.dispose = function() {
  66946. listeners = {};
  66947. };
  66948. };
  66949. };
  66950. Stream$8.prototype.pipe = function(destination2) {
  66951. this.on("data", function(data) {
  66952. destination2.push(data);
  66953. });
  66954. this.on("done", function(flushSource) {
  66955. destination2.flush(flushSource);
  66956. });
  66957. this.on("partialdone", function(flushSource) {
  66958. destination2.partialFlush(flushSource);
  66959. });
  66960. this.on("endedtimeline", function(flushSource) {
  66961. destination2.endTimeline(flushSource);
  66962. });
  66963. this.on("reset", function(flushSource) {
  66964. destination2.reset(flushSource);
  66965. });
  66966. return destination2;
  66967. };
  66968. Stream$8.prototype.push = function(data) {
  66969. this.trigger("data", data);
  66970. };
  66971. Stream$8.prototype.flush = function(flushSource) {
  66972. this.trigger("done", flushSource);
  66973. };
  66974. Stream$8.prototype.partialFlush = function(flushSource) {
  66975. this.trigger("partialdone", flushSource);
  66976. };
  66977. Stream$8.prototype.endTimeline = function(flushSource) {
  66978. this.trigger("endedtimeline", flushSource);
  66979. };
  66980. Stream$8.prototype.reset = function(flushSource) {
  66981. this.trigger("reset", flushSource);
  66982. };
  66983. var stream = Stream$8;
  66984. var MAX_UINT32$12 = Math.pow(2, 32);
  66985. var getUint64$32 = function(uint8) {
  66986. var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
  66987. var value;
  66988. if (dv.getBigUint64) {
  66989. value = dv.getBigUint64(0);
  66990. if (value < Number.MAX_SAFE_INTEGER) {
  66991. return Number(value);
  66992. }
  66993. return value;
  66994. }
  66995. return dv.getUint32(0) * MAX_UINT32$12 + dv.getUint32(4);
  66996. };
  66997. var numbers2 = {
  66998. getUint64: getUint64$32,
  66999. MAX_UINT32: MAX_UINT32$12
  67000. };
  67001. var MAX_UINT322 = numbers2.MAX_UINT32;
  67002. var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS;
  67003. (function() {
  67004. var i2;
  67005. types = {
  67006. avc1: [],
  67007. avcC: [],
  67008. btrt: [],
  67009. dinf: [],
  67010. dref: [],
  67011. esds: [],
  67012. ftyp: [],
  67013. hdlr: [],
  67014. mdat: [],
  67015. mdhd: [],
  67016. mdia: [],
  67017. mfhd: [],
  67018. minf: [],
  67019. moof: [],
  67020. moov: [],
  67021. mp4a: [],
  67022. mvex: [],
  67023. mvhd: [],
  67024. pasp: [],
  67025. sdtp: [],
  67026. smhd: [],
  67027. stbl: [],
  67028. stco: [],
  67029. stsc: [],
  67030. stsd: [],
  67031. stsz: [],
  67032. stts: [],
  67033. styp: [],
  67034. tfdt: [],
  67035. tfhd: [],
  67036. traf: [],
  67037. trak: [],
  67038. trun: [],
  67039. trex: [],
  67040. tkhd: [],
  67041. vmhd: []
  67042. };
  67043. if (typeof Uint8Array === "undefined") {
  67044. return;
  67045. }
  67046. for (i2 in types) {
  67047. if (types.hasOwnProperty(i2)) {
  67048. types[i2] = [i2.charCodeAt(0), i2.charCodeAt(1), i2.charCodeAt(2), i2.charCodeAt(3)];
  67049. }
  67050. }
  67051. MAJOR_BRAND = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]);
  67052. AVC1_BRAND = new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]);
  67053. MINOR_VERSION = new Uint8Array([0, 0, 0, 1]);
  67054. VIDEO_HDLR = new Uint8Array([
  67055. 0,
  67056. 0,
  67057. 0,
  67058. 0,
  67059. 0,
  67060. 0,
  67061. 0,
  67062. 0,
  67063. 118,
  67064. 105,
  67065. 100,
  67066. 101,
  67067. 0,
  67068. 0,
  67069. 0,
  67070. 0,
  67071. 0,
  67072. 0,
  67073. 0,
  67074. 0,
  67075. 0,
  67076. 0,
  67077. 0,
  67078. 0,
  67079. 86,
  67080. 105,
  67081. 100,
  67082. 101,
  67083. 111,
  67084. 72,
  67085. 97,
  67086. 110,
  67087. 100,
  67088. 108,
  67089. 101,
  67090. 114,
  67091. 0
  67092. ]);
  67093. AUDIO_HDLR = new Uint8Array([
  67094. 0,
  67095. 0,
  67096. 0,
  67097. 0,
  67098. 0,
  67099. 0,
  67100. 0,
  67101. 0,
  67102. 115,
  67103. 111,
  67104. 117,
  67105. 110,
  67106. 0,
  67107. 0,
  67108. 0,
  67109. 0,
  67110. 0,
  67111. 0,
  67112. 0,
  67113. 0,
  67114. 0,
  67115. 0,
  67116. 0,
  67117. 0,
  67118. 83,
  67119. 111,
  67120. 117,
  67121. 110,
  67122. 100,
  67123. 72,
  67124. 97,
  67125. 110,
  67126. 100,
  67127. 108,
  67128. 101,
  67129. 114,
  67130. 0
  67131. ]);
  67132. HDLR_TYPES = {
  67133. video: VIDEO_HDLR,
  67134. audio: AUDIO_HDLR
  67135. };
  67136. DREF = new Uint8Array([
  67137. 0,
  67138. 0,
  67139. 0,
  67140. 0,
  67141. 0,
  67142. 0,
  67143. 0,
  67144. 1,
  67145. 0,
  67146. 0,
  67147. 0,
  67148. 12,
  67149. 117,
  67150. 114,
  67151. 108,
  67152. 32,
  67153. 0,
  67154. 0,
  67155. 0,
  67156. 1
  67157. ]);
  67158. SMHD = new Uint8Array([
  67159. 0,
  67160. 0,
  67161. 0,
  67162. 0,
  67163. 0,
  67164. 0,
  67165. 0,
  67166. 0
  67167. ]);
  67168. STCO = new Uint8Array([
  67169. 0,
  67170. 0,
  67171. 0,
  67172. 0,
  67173. 0,
  67174. 0,
  67175. 0,
  67176. 0
  67177. ]);
  67178. STSC = STCO;
  67179. STSZ = new Uint8Array([
  67180. 0,
  67181. 0,
  67182. 0,
  67183. 0,
  67184. 0,
  67185. 0,
  67186. 0,
  67187. 0,
  67188. 0,
  67189. 0,
  67190. 0,
  67191. 0
  67192. ]);
  67193. STTS = STCO;
  67194. VMHD = new Uint8Array([
  67195. 0,
  67196. 0,
  67197. 0,
  67198. 1,
  67199. 0,
  67200. 0,
  67201. 0,
  67202. 0,
  67203. 0,
  67204. 0,
  67205. 0,
  67206. 0
  67207. ]);
  67208. })();
  67209. box = function(type3) {
  67210. var payload = [], size = 0, i2, result, view;
  67211. for (i2 = 1; i2 < arguments.length; i2++) {
  67212. payload.push(arguments[i2]);
  67213. }
  67214. i2 = payload.length;
  67215. while (i2--) {
  67216. size += payload[i2].byteLength;
  67217. }
  67218. result = new Uint8Array(size + 8);
  67219. view = new DataView(result.buffer, result.byteOffset, result.byteLength);
  67220. view.setUint32(0, result.byteLength);
  67221. result.set(type3, 4);
  67222. for (i2 = 0, size = 8; i2 < payload.length; i2++) {
  67223. result.set(payload[i2], size);
  67224. size += payload[i2].byteLength;
  67225. }
  67226. return result;
  67227. };
  67228. dinf = function() {
  67229. return box(types.dinf, box(types.dref, DREF));
  67230. };
  67231. esds = function(track) {
  67232. return box(types.esds, new Uint8Array([
  67233. 0,
  67234. 0,
  67235. 0,
  67236. 0,
  67237. 3,
  67238. 25,
  67239. 0,
  67240. 0,
  67241. 0,
  67242. 4,
  67243. 17,
  67244. 64,
  67245. 21,
  67246. 0,
  67247. 6,
  67248. 0,
  67249. 0,
  67250. 0,
  67251. 218,
  67252. 192,
  67253. 0,
  67254. 0,
  67255. 218,
  67256. 192,
  67257. 5,
  67258. 2,
  67259. track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1,
  67260. track.samplingfrequencyindex << 7 | track.channelcount << 3,
  67261. 6,
  67262. 1,
  67263. 2
  67264. ]));
  67265. };
  67266. ftyp = function() {
  67267. return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND);
  67268. };
  67269. hdlr = function(type3) {
  67270. return box(types.hdlr, HDLR_TYPES[type3]);
  67271. };
  67272. mdat = function(data) {
  67273. return box(types.mdat, data);
  67274. };
  67275. mdhd = function(track) {
  67276. var result = new Uint8Array([
  67277. 0,
  67278. 0,
  67279. 0,
  67280. 0,
  67281. 0,
  67282. 0,
  67283. 0,
  67284. 2,
  67285. 0,
  67286. 0,
  67287. 0,
  67288. 3,
  67289. 0,
  67290. 1,
  67291. 95,
  67292. 144,
  67293. track.duration >>> 24 & 255,
  67294. track.duration >>> 16 & 255,
  67295. track.duration >>> 8 & 255,
  67296. track.duration & 255,
  67297. 85,
  67298. 196,
  67299. 0,
  67300. 0
  67301. ]);
  67302. if (track.samplerate) {
  67303. result[12] = track.samplerate >>> 24 & 255;
  67304. result[13] = track.samplerate >>> 16 & 255;
  67305. result[14] = track.samplerate >>> 8 & 255;
  67306. result[15] = track.samplerate & 255;
  67307. }
  67308. return box(types.mdhd, result);
  67309. };
  67310. mdia = function(track) {
  67311. return box(types.mdia, mdhd(track), hdlr(track.type), minf(track));
  67312. };
  67313. mfhd = function(sequenceNumber) {
  67314. return box(types.mfhd, new Uint8Array([
  67315. 0,
  67316. 0,
  67317. 0,
  67318. 0,
  67319. (sequenceNumber & 4278190080) >> 24,
  67320. (sequenceNumber & 16711680) >> 16,
  67321. (sequenceNumber & 65280) >> 8,
  67322. sequenceNumber & 255
  67323. ]));
  67324. };
  67325. minf = function(track) {
  67326. return box(types.minf, track.type === "video" ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track));
  67327. };
  67328. moof = function(sequenceNumber, tracks) {
  67329. var trackFragments = [], i2 = tracks.length;
  67330. while (i2--) {
  67331. trackFragments[i2] = traf(tracks[i2]);
  67332. }
  67333. return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments));
  67334. };
  67335. moov = function(tracks) {
  67336. var i2 = tracks.length, boxes = [];
  67337. while (i2--) {
  67338. boxes[i2] = trak(tracks[i2]);
  67339. }
  67340. return box.apply(null, [types.moov, mvhd(4294967295)].concat(boxes).concat(mvex(tracks)));
  67341. };
  67342. mvex = function(tracks) {
  67343. var i2 = tracks.length, boxes = [];
  67344. while (i2--) {
  67345. boxes[i2] = trex(tracks[i2]);
  67346. }
  67347. return box.apply(null, [types.mvex].concat(boxes));
  67348. };
  67349. mvhd = function(duration5) {
  67350. var bytes = new Uint8Array([
  67351. 0,
  67352. 0,
  67353. 0,
  67354. 0,
  67355. 0,
  67356. 0,
  67357. 0,
  67358. 1,
  67359. 0,
  67360. 0,
  67361. 0,
  67362. 2,
  67363. 0,
  67364. 1,
  67365. 95,
  67366. 144,
  67367. (duration5 & 4278190080) >> 24,
  67368. (duration5 & 16711680) >> 16,
  67369. (duration5 & 65280) >> 8,
  67370. duration5 & 255,
  67371. 0,
  67372. 1,
  67373. 0,
  67374. 0,
  67375. 1,
  67376. 0,
  67377. 0,
  67378. 0,
  67379. 0,
  67380. 0,
  67381. 0,
  67382. 0,
  67383. 0,
  67384. 0,
  67385. 0,
  67386. 0,
  67387. 0,
  67388. 1,
  67389. 0,
  67390. 0,
  67391. 0,
  67392. 0,
  67393. 0,
  67394. 0,
  67395. 0,
  67396. 0,
  67397. 0,
  67398. 0,
  67399. 0,
  67400. 0,
  67401. 0,
  67402. 0,
  67403. 0,
  67404. 1,
  67405. 0,
  67406. 0,
  67407. 0,
  67408. 0,
  67409. 0,
  67410. 0,
  67411. 0,
  67412. 0,
  67413. 0,
  67414. 0,
  67415. 0,
  67416. 0,
  67417. 0,
  67418. 0,
  67419. 64,
  67420. 0,
  67421. 0,
  67422. 0,
  67423. 0,
  67424. 0,
  67425. 0,
  67426. 0,
  67427. 0,
  67428. 0,
  67429. 0,
  67430. 0,
  67431. 0,
  67432. 0,
  67433. 0,
  67434. 0,
  67435. 0,
  67436. 0,
  67437. 0,
  67438. 0,
  67439. 0,
  67440. 0,
  67441. 0,
  67442. 0,
  67443. 0,
  67444. 0,
  67445. 0,
  67446. 0,
  67447. 255,
  67448. 255,
  67449. 255,
  67450. 255
  67451. ]);
  67452. return box(types.mvhd, bytes);
  67453. };
  67454. sdtp = function(track) {
  67455. var samples = track.samples || [], bytes = new Uint8Array(4 + samples.length), flags, i2;
  67456. for (i2 = 0; i2 < samples.length; i2++) {
  67457. flags = samples[i2].flags;
  67458. bytes[i2 + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;
  67459. }
  67460. return box(types.sdtp, bytes);
  67461. };
  67462. stbl = function(track) {
  67463. return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO));
  67464. };
  67465. (function() {
  67466. var videoSample, audioSample;
  67467. stsd = function(track) {
  67468. return box(types.stsd, new Uint8Array([
  67469. 0,
  67470. 0,
  67471. 0,
  67472. 0,
  67473. 0,
  67474. 0,
  67475. 0,
  67476. 1
  67477. ]), track.type === "video" ? videoSample(track) : audioSample(track));
  67478. };
  67479. videoSample = function(track) {
  67480. var sps = track.sps || [], pps = track.pps || [], sequenceParameterSets = [], pictureParameterSets = [], i2, avc1Box;
  67481. for (i2 = 0; i2 < sps.length; i2++) {
  67482. sequenceParameterSets.push((sps[i2].byteLength & 65280) >>> 8);
  67483. sequenceParameterSets.push(sps[i2].byteLength & 255);
  67484. sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i2]));
  67485. }
  67486. for (i2 = 0; i2 < pps.length; i2++) {
  67487. pictureParameterSets.push((pps[i2].byteLength & 65280) >>> 8);
  67488. pictureParameterSets.push(pps[i2].byteLength & 255);
  67489. pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i2]));
  67490. }
  67491. avc1Box = [types.avc1, new Uint8Array([
  67492. 0,
  67493. 0,
  67494. 0,
  67495. 0,
  67496. 0,
  67497. 0,
  67498. 0,
  67499. 1,
  67500. 0,
  67501. 0,
  67502. 0,
  67503. 0,
  67504. 0,
  67505. 0,
  67506. 0,
  67507. 0,
  67508. 0,
  67509. 0,
  67510. 0,
  67511. 0,
  67512. 0,
  67513. 0,
  67514. 0,
  67515. 0,
  67516. (track.width & 65280) >> 8,
  67517. track.width & 255,
  67518. (track.height & 65280) >> 8,
  67519. track.height & 255,
  67520. 0,
  67521. 72,
  67522. 0,
  67523. 0,
  67524. 0,
  67525. 72,
  67526. 0,
  67527. 0,
  67528. 0,
  67529. 0,
  67530. 0,
  67531. 0,
  67532. 0,
  67533. 1,
  67534. 19,
  67535. 118,
  67536. 105,
  67537. 100,
  67538. 101,
  67539. 111,
  67540. 106,
  67541. 115,
  67542. 45,
  67543. 99,
  67544. 111,
  67545. 110,
  67546. 116,
  67547. 114,
  67548. 105,
  67549. 98,
  67550. 45,
  67551. 104,
  67552. 108,
  67553. 115,
  67554. 0,
  67555. 0,
  67556. 0,
  67557. 0,
  67558. 0,
  67559. 0,
  67560. 0,
  67561. 0,
  67562. 0,
  67563. 0,
  67564. 0,
  67565. 0,
  67566. 0,
  67567. 24,
  67568. 17,
  67569. 17
  67570. ]), box(types.avcC, new Uint8Array([
  67571. 1,
  67572. track.profileIdc,
  67573. track.profileCompatibility,
  67574. track.levelIdc,
  67575. 255
  67576. ].concat(
  67577. [sps.length],
  67578. sequenceParameterSets,
  67579. [pps.length],
  67580. pictureParameterSets
  67581. ))), box(types.btrt, new Uint8Array([
  67582. 0,
  67583. 28,
  67584. 156,
  67585. 128,
  67586. 0,
  67587. 45,
  67588. 198,
  67589. 192,
  67590. 0,
  67591. 45,
  67592. 198,
  67593. 192
  67594. ]))];
  67595. if (track.sarRatio) {
  67596. var hSpacing = track.sarRatio[0], vSpacing = track.sarRatio[1];
  67597. avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 4278190080) >> 24, (hSpacing & 16711680) >> 16, (hSpacing & 65280) >> 8, hSpacing & 255, (vSpacing & 4278190080) >> 24, (vSpacing & 16711680) >> 16, (vSpacing & 65280) >> 8, vSpacing & 255])));
  67598. }
  67599. return box.apply(null, avc1Box);
  67600. };
  67601. audioSample = function(track) {
  67602. return box(types.mp4a, new Uint8Array([
  67603. 0,
  67604. 0,
  67605. 0,
  67606. 0,
  67607. 0,
  67608. 0,
  67609. 0,
  67610. 1,
  67611. 0,
  67612. 0,
  67613. 0,
  67614. 0,
  67615. 0,
  67616. 0,
  67617. 0,
  67618. 0,
  67619. (track.channelcount & 65280) >> 8,
  67620. track.channelcount & 255,
  67621. (track.samplesize & 65280) >> 8,
  67622. track.samplesize & 255,
  67623. 0,
  67624. 0,
  67625. 0,
  67626. 0,
  67627. (track.samplerate & 65280) >> 8,
  67628. track.samplerate & 255,
  67629. 0,
  67630. 0
  67631. ]), esds(track));
  67632. };
  67633. })();
  67634. tkhd = function(track) {
  67635. var result = new Uint8Array([
  67636. 0,
  67637. 0,
  67638. 0,
  67639. 7,
  67640. 0,
  67641. 0,
  67642. 0,
  67643. 0,
  67644. 0,
  67645. 0,
  67646. 0,
  67647. 0,
  67648. (track.id & 4278190080) >> 24,
  67649. (track.id & 16711680) >> 16,
  67650. (track.id & 65280) >> 8,
  67651. track.id & 255,
  67652. 0,
  67653. 0,
  67654. 0,
  67655. 0,
  67656. (track.duration & 4278190080) >> 24,
  67657. (track.duration & 16711680) >> 16,
  67658. (track.duration & 65280) >> 8,
  67659. track.duration & 255,
  67660. 0,
  67661. 0,
  67662. 0,
  67663. 0,
  67664. 0,
  67665. 0,
  67666. 0,
  67667. 0,
  67668. 0,
  67669. 0,
  67670. 0,
  67671. 0,
  67672. 1,
  67673. 0,
  67674. 0,
  67675. 0,
  67676. 0,
  67677. 1,
  67678. 0,
  67679. 0,
  67680. 0,
  67681. 0,
  67682. 0,
  67683. 0,
  67684. 0,
  67685. 0,
  67686. 0,
  67687. 0,
  67688. 0,
  67689. 0,
  67690. 0,
  67691. 0,
  67692. 0,
  67693. 1,
  67694. 0,
  67695. 0,
  67696. 0,
  67697. 0,
  67698. 0,
  67699. 0,
  67700. 0,
  67701. 0,
  67702. 0,
  67703. 0,
  67704. 0,
  67705. 0,
  67706. 0,
  67707. 0,
  67708. 64,
  67709. 0,
  67710. 0,
  67711. 0,
  67712. (track.width & 65280) >> 8,
  67713. track.width & 255,
  67714. 0,
  67715. 0,
  67716. (track.height & 65280) >> 8,
  67717. track.height & 255,
  67718. 0,
  67719. 0
  67720. ]);
  67721. return box(types.tkhd, result);
  67722. };
  67723. traf = function(track) {
  67724. var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime;
  67725. trackFragmentHeader = box(types.tfhd, new Uint8Array([
  67726. 0,
  67727. 0,
  67728. 0,
  67729. 58,
  67730. (track.id & 4278190080) >> 24,
  67731. (track.id & 16711680) >> 16,
  67732. (track.id & 65280) >> 8,
  67733. track.id & 255,
  67734. 0,
  67735. 0,
  67736. 0,
  67737. 1,
  67738. 0,
  67739. 0,
  67740. 0,
  67741. 0,
  67742. 0,
  67743. 0,
  67744. 0,
  67745. 0,
  67746. 0,
  67747. 0,
  67748. 0,
  67749. 0
  67750. ]));
  67751. upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / MAX_UINT322);
  67752. lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % MAX_UINT322);
  67753. trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([
  67754. 1,
  67755. 0,
  67756. 0,
  67757. 0,
  67758. upperWordBaseMediaDecodeTime >>> 24 & 255,
  67759. upperWordBaseMediaDecodeTime >>> 16 & 255,
  67760. upperWordBaseMediaDecodeTime >>> 8 & 255,
  67761. upperWordBaseMediaDecodeTime & 255,
  67762. lowerWordBaseMediaDecodeTime >>> 24 & 255,
  67763. lowerWordBaseMediaDecodeTime >>> 16 & 255,
  67764. lowerWordBaseMediaDecodeTime >>> 8 & 255,
  67765. lowerWordBaseMediaDecodeTime & 255
  67766. ]));
  67767. dataOffset = 32 + 20 + 8 + 16 + 8 + 8;
  67768. if (track.type === "audio") {
  67769. trackFragmentRun = trun$1(track, dataOffset);
  67770. return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun);
  67771. }
  67772. sampleDependencyTable = sdtp(track);
  67773. trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset);
  67774. return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable);
  67775. };
  67776. trak = function(track) {
  67777. track.duration = track.duration || 4294967295;
  67778. return box(types.trak, tkhd(track), mdia(track));
  67779. };
  67780. trex = function(track) {
  67781. var result = new Uint8Array([
  67782. 0,
  67783. 0,
  67784. 0,
  67785. 0,
  67786. (track.id & 4278190080) >> 24,
  67787. (track.id & 16711680) >> 16,
  67788. (track.id & 65280) >> 8,
  67789. track.id & 255,
  67790. 0,
  67791. 0,
  67792. 0,
  67793. 1,
  67794. 0,
  67795. 0,
  67796. 0,
  67797. 0,
  67798. 0,
  67799. 0,
  67800. 0,
  67801. 0,
  67802. 0,
  67803. 1,
  67804. 0,
  67805. 1
  67806. ]);
  67807. if (track.type !== "video") {
  67808. result[result.length - 1] = 0;
  67809. }
  67810. return box(types.trex, result);
  67811. };
  67812. (function() {
  67813. var audioTrun, videoTrun, trunHeader;
  67814. trunHeader = function(samples, offset) {
  67815. var durationPresent = 0, sizePresent = 0, flagsPresent = 0, compositionTimeOffset = 0;
  67816. if (samples.length) {
  67817. if (samples[0].duration !== void 0) {
  67818. durationPresent = 1;
  67819. }
  67820. if (samples[0].size !== void 0) {
  67821. sizePresent = 2;
  67822. }
  67823. if (samples[0].flags !== void 0) {
  67824. flagsPresent = 4;
  67825. }
  67826. if (samples[0].compositionTimeOffset !== void 0) {
  67827. compositionTimeOffset = 8;
  67828. }
  67829. }
  67830. return [
  67831. 0,
  67832. 0,
  67833. durationPresent | sizePresent | flagsPresent | compositionTimeOffset,
  67834. 1,
  67835. (samples.length & 4278190080) >>> 24,
  67836. (samples.length & 16711680) >>> 16,
  67837. (samples.length & 65280) >>> 8,
  67838. samples.length & 255,
  67839. (offset & 4278190080) >>> 24,
  67840. (offset & 16711680) >>> 16,
  67841. (offset & 65280) >>> 8,
  67842. offset & 255
  67843. ];
  67844. };
  67845. videoTrun = function(track, offset) {
  67846. var bytesOffest, bytes, header, samples, sample, i2;
  67847. samples = track.samples || [];
  67848. offset += 8 + 12 + 16 * samples.length;
  67849. header = trunHeader(samples, offset);
  67850. bytes = new Uint8Array(header.length + samples.length * 16);
  67851. bytes.set(header);
  67852. bytesOffest = header.length;
  67853. for (i2 = 0; i2 < samples.length; i2++) {
  67854. sample = samples[i2];
  67855. bytes[bytesOffest++] = (sample.duration & 4278190080) >>> 24;
  67856. bytes[bytesOffest++] = (sample.duration & 16711680) >>> 16;
  67857. bytes[bytesOffest++] = (sample.duration & 65280) >>> 8;
  67858. bytes[bytesOffest++] = sample.duration & 255;
  67859. bytes[bytesOffest++] = (sample.size & 4278190080) >>> 24;
  67860. bytes[bytesOffest++] = (sample.size & 16711680) >>> 16;
  67861. bytes[bytesOffest++] = (sample.size & 65280) >>> 8;
  67862. bytes[bytesOffest++] = sample.size & 255;
  67863. bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn;
  67864. bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample;
  67865. bytes[bytesOffest++] = sample.flags.degradationPriority & 240 << 8;
  67866. bytes[bytesOffest++] = sample.flags.degradationPriority & 15;
  67867. bytes[bytesOffest++] = (sample.compositionTimeOffset & 4278190080) >>> 24;
  67868. bytes[bytesOffest++] = (sample.compositionTimeOffset & 16711680) >>> 16;
  67869. bytes[bytesOffest++] = (sample.compositionTimeOffset & 65280) >>> 8;
  67870. bytes[bytesOffest++] = sample.compositionTimeOffset & 255;
  67871. }
  67872. return box(types.trun, bytes);
  67873. };
  67874. audioTrun = function(track, offset) {
  67875. var bytes, bytesOffest, header, samples, sample, i2;
  67876. samples = track.samples || [];
  67877. offset += 8 + 12 + 8 * samples.length;
  67878. header = trunHeader(samples, offset);
  67879. bytes = new Uint8Array(header.length + samples.length * 8);
  67880. bytes.set(header);
  67881. bytesOffest = header.length;
  67882. for (i2 = 0; i2 < samples.length; i2++) {
  67883. sample = samples[i2];
  67884. bytes[bytesOffest++] = (sample.duration & 4278190080) >>> 24;
  67885. bytes[bytesOffest++] = (sample.duration & 16711680) >>> 16;
  67886. bytes[bytesOffest++] = (sample.duration & 65280) >>> 8;
  67887. bytes[bytesOffest++] = sample.duration & 255;
  67888. bytes[bytesOffest++] = (sample.size & 4278190080) >>> 24;
  67889. bytes[bytesOffest++] = (sample.size & 16711680) >>> 16;
  67890. bytes[bytesOffest++] = (sample.size & 65280) >>> 8;
  67891. bytes[bytesOffest++] = sample.size & 255;
  67892. }
  67893. return box(types.trun, bytes);
  67894. };
  67895. trun$1 = function(track, offset) {
  67896. if (track.type === "audio") {
  67897. return audioTrun(track, offset);
  67898. }
  67899. return videoTrun(track, offset);
  67900. };
  67901. })();
  67902. var mp4Generator = {
  67903. ftyp,
  67904. mdat,
  67905. moof,
  67906. moov,
  67907. initSegment: function(tracks) {
  67908. var fileType = ftyp(), movie = moov(tracks), result;
  67909. result = new Uint8Array(fileType.byteLength + movie.byteLength);
  67910. result.set(fileType);
  67911. result.set(movie, fileType.byteLength);
  67912. return result;
  67913. }
  67914. };
  67915. var groupNalsIntoFrames = function(nalUnits) {
  67916. var i2, currentNal, currentFrame = [], frames = [];
  67917. frames.byteLength = 0;
  67918. frames.nalCount = 0;
  67919. frames.duration = 0;
  67920. currentFrame.byteLength = 0;
  67921. for (i2 = 0; i2 < nalUnits.length; i2++) {
  67922. currentNal = nalUnits[i2];
  67923. if (currentNal.nalUnitType === "access_unit_delimiter_rbsp") {
  67924. if (currentFrame.length) {
  67925. currentFrame.duration = currentNal.dts - currentFrame.dts;
  67926. frames.byteLength += currentFrame.byteLength;
  67927. frames.nalCount += currentFrame.length;
  67928. frames.duration += currentFrame.duration;
  67929. frames.push(currentFrame);
  67930. }
  67931. currentFrame = [currentNal];
  67932. currentFrame.byteLength = currentNal.data.byteLength;
  67933. currentFrame.pts = currentNal.pts;
  67934. currentFrame.dts = currentNal.dts;
  67935. } else {
  67936. if (currentNal.nalUnitType === "slice_layer_without_partitioning_rbsp_idr") {
  67937. currentFrame.keyFrame = true;
  67938. }
  67939. currentFrame.duration = currentNal.dts - currentFrame.dts;
  67940. currentFrame.byteLength += currentNal.data.byteLength;
  67941. currentFrame.push(currentNal);
  67942. }
  67943. }
  67944. if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) {
  67945. currentFrame.duration = frames[frames.length - 1].duration;
  67946. }
  67947. frames.byteLength += currentFrame.byteLength;
  67948. frames.nalCount += currentFrame.length;
  67949. frames.duration += currentFrame.duration;
  67950. frames.push(currentFrame);
  67951. return frames;
  67952. };
  67953. var groupFramesIntoGops = function(frames) {
  67954. var i2, currentFrame, currentGop = [], gops = [];
  67955. currentGop.byteLength = 0;
  67956. currentGop.nalCount = 0;
  67957. currentGop.duration = 0;
  67958. currentGop.pts = frames[0].pts;
  67959. currentGop.dts = frames[0].dts;
  67960. gops.byteLength = 0;
  67961. gops.nalCount = 0;
  67962. gops.duration = 0;
  67963. gops.pts = frames[0].pts;
  67964. gops.dts = frames[0].dts;
  67965. for (i2 = 0; i2 < frames.length; i2++) {
  67966. currentFrame = frames[i2];
  67967. if (currentFrame.keyFrame) {
  67968. if (currentGop.length) {
  67969. gops.push(currentGop);
  67970. gops.byteLength += currentGop.byteLength;
  67971. gops.nalCount += currentGop.nalCount;
  67972. gops.duration += currentGop.duration;
  67973. }
  67974. currentGop = [currentFrame];
  67975. currentGop.nalCount = currentFrame.length;
  67976. currentGop.byteLength = currentFrame.byteLength;
  67977. currentGop.pts = currentFrame.pts;
  67978. currentGop.dts = currentFrame.dts;
  67979. currentGop.duration = currentFrame.duration;
  67980. } else {
  67981. currentGop.duration += currentFrame.duration;
  67982. currentGop.nalCount += currentFrame.length;
  67983. currentGop.byteLength += currentFrame.byteLength;
  67984. currentGop.push(currentFrame);
  67985. }
  67986. }
  67987. if (gops.length && currentGop.duration <= 0) {
  67988. currentGop.duration = gops[gops.length - 1].duration;
  67989. }
  67990. gops.byteLength += currentGop.byteLength;
  67991. gops.nalCount += currentGop.nalCount;
  67992. gops.duration += currentGop.duration;
  67993. gops.push(currentGop);
  67994. return gops;
  67995. };
  67996. var extendFirstKeyFrame = function(gops) {
  67997. var currentGop;
  67998. if (!gops[0][0].keyFrame && gops.length > 1) {
  67999. currentGop = gops.shift();
  68000. gops.byteLength -= currentGop.byteLength;
  68001. gops.nalCount -= currentGop.nalCount;
  68002. gops[0][0].dts = currentGop.dts;
  68003. gops[0][0].pts = currentGop.pts;
  68004. gops[0][0].duration += currentGop.duration;
  68005. }
  68006. return gops;
  68007. };
  68008. var createDefaultSample = function() {
  68009. return {
  68010. size: 0,
  68011. flags: {
  68012. isLeading: 0,
  68013. dependsOn: 1,
  68014. isDependedOn: 0,
  68015. hasRedundancy: 0,
  68016. degradationPriority: 0,
  68017. isNonSyncSample: 1
  68018. }
  68019. };
  68020. };
  68021. var sampleForFrame = function(frame, dataOffset) {
  68022. var sample = createDefaultSample();
  68023. sample.dataOffset = dataOffset;
  68024. sample.compositionTimeOffset = frame.pts - frame.dts;
  68025. sample.duration = frame.duration;
  68026. sample.size = 4 * frame.length;
  68027. sample.size += frame.byteLength;
  68028. if (frame.keyFrame) {
  68029. sample.flags.dependsOn = 2;
  68030. sample.flags.isNonSyncSample = 0;
  68031. }
  68032. return sample;
  68033. };
  68034. var generateSampleTable$1 = function(gops, baseDataOffset) {
  68035. var h2, i2, sample, currentGop, currentFrame, dataOffset = baseDataOffset || 0, samples = [];
  68036. for (h2 = 0; h2 < gops.length; h2++) {
  68037. currentGop = gops[h2];
  68038. for (i2 = 0; i2 < currentGop.length; i2++) {
  68039. currentFrame = currentGop[i2];
  68040. sample = sampleForFrame(currentFrame, dataOffset);
  68041. dataOffset += sample.size;
  68042. samples.push(sample);
  68043. }
  68044. }
  68045. return samples;
  68046. };
  68047. var concatenateNalData = function(gops) {
  68048. var h2, i2, j, currentGop, currentFrame, currentNal, dataOffset = 0, nalsByteLength = gops.byteLength, numberOfNals = gops.nalCount, totalByteLength = nalsByteLength + 4 * numberOfNals, data = new Uint8Array(totalByteLength), view = new DataView(data.buffer);
  68049. for (h2 = 0; h2 < gops.length; h2++) {
  68050. currentGop = gops[h2];
  68051. for (i2 = 0; i2 < currentGop.length; i2++) {
  68052. currentFrame = currentGop[i2];
  68053. for (j = 0; j < currentFrame.length; j++) {
  68054. currentNal = currentFrame[j];
  68055. view.setUint32(dataOffset, currentNal.data.byteLength);
  68056. dataOffset += 4;
  68057. data.set(currentNal.data, dataOffset);
  68058. dataOffset += currentNal.data.byteLength;
  68059. }
  68060. }
  68061. }
  68062. return data;
  68063. };
  68064. var generateSampleTableForFrame = function(frame, baseDataOffset) {
  68065. var sample, dataOffset = baseDataOffset || 0, samples = [];
  68066. sample = sampleForFrame(frame, dataOffset);
  68067. samples.push(sample);
  68068. return samples;
  68069. };
  68070. var concatenateNalDataForFrame = function(frame) {
  68071. var i2, currentNal, dataOffset = 0, nalsByteLength = frame.byteLength, numberOfNals = frame.length, totalByteLength = nalsByteLength + 4 * numberOfNals, data = new Uint8Array(totalByteLength), view = new DataView(data.buffer);
  68072. for (i2 = 0; i2 < frame.length; i2++) {
  68073. currentNal = frame[i2];
  68074. view.setUint32(dataOffset, currentNal.data.byteLength);
  68075. dataOffset += 4;
  68076. data.set(currentNal.data, dataOffset);
  68077. dataOffset += currentNal.data.byteLength;
  68078. }
  68079. return data;
  68080. };
  68081. var frameUtils$1 = {
  68082. groupNalsIntoFrames,
  68083. groupFramesIntoGops,
  68084. extendFirstKeyFrame,
  68085. generateSampleTable: generateSampleTable$1,
  68086. concatenateNalData,
  68087. generateSampleTableForFrame,
  68088. concatenateNalDataForFrame
  68089. };
  68090. var highPrefix = [33, 16, 5, 32, 164, 27];
  68091. var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252];
  68092. var zeroFill = function(count) {
  68093. var a = [];
  68094. while (count--) {
  68095. a.push(0);
  68096. }
  68097. return a;
  68098. };
  68099. var makeTable = function(metaTable) {
  68100. return Object.keys(metaTable).reduce(function(obj, key) {
  68101. obj[key] = new Uint8Array(metaTable[key].reduce(function(arr, part) {
  68102. return arr.concat(part);
  68103. }, []));
  68104. return obj;
  68105. }, {});
  68106. };
  68107. var silence;
  68108. var silence_1 = function() {
  68109. if (!silence) {
  68110. var coneOfSilence2 = {
  68111. 96e3: [highPrefix, [227, 64], zeroFill(154), [56]],
  68112. 88200: [highPrefix, [231], zeroFill(170), [56]],
  68113. 64e3: [highPrefix, [248, 192], zeroFill(240), [56]],
  68114. 48e3: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]],
  68115. 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]],
  68116. 32e3: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]],
  68117. 24e3: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]],
  68118. 16e3: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]],
  68119. 12e3: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]],
  68120. 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]],
  68121. 8e3: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]]
  68122. };
  68123. silence = makeTable(coneOfSilence2);
  68124. }
  68125. return silence;
  68126. };
  68127. var ONE_SECOND_IN_TS$4 = 9e4, secondsToVideoTs2, secondsToAudioTs2, videoTsToSeconds2, audioTsToSeconds2, audioTsToVideoTs2, videoTsToAudioTs2, metadataTsToSeconds2;
  68128. secondsToVideoTs2 = function(seconds) {
  68129. return seconds * ONE_SECOND_IN_TS$4;
  68130. };
  68131. secondsToAudioTs2 = function(seconds, sampleRate) {
  68132. return seconds * sampleRate;
  68133. };
  68134. videoTsToSeconds2 = function(timestamp) {
  68135. return timestamp / ONE_SECOND_IN_TS$4;
  68136. };
  68137. audioTsToSeconds2 = function(timestamp, sampleRate) {
  68138. return timestamp / sampleRate;
  68139. };
  68140. audioTsToVideoTs2 = function(timestamp, sampleRate) {
  68141. return secondsToVideoTs2(audioTsToSeconds2(timestamp, sampleRate));
  68142. };
  68143. videoTsToAudioTs2 = function(timestamp, sampleRate) {
  68144. return secondsToAudioTs2(videoTsToSeconds2(timestamp), sampleRate);
  68145. };
  68146. metadataTsToSeconds2 = function(timestamp, timelineStartPts, keepOriginalTimestamps) {
  68147. return videoTsToSeconds2(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);
  68148. };
  68149. var clock$2 = {
  68150. ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$4,
  68151. secondsToVideoTs: secondsToVideoTs2,
  68152. secondsToAudioTs: secondsToAudioTs2,
  68153. videoTsToSeconds: videoTsToSeconds2,
  68154. audioTsToSeconds: audioTsToSeconds2,
  68155. audioTsToVideoTs: audioTsToVideoTs2,
  68156. videoTsToAudioTs: videoTsToAudioTs2,
  68157. metadataTsToSeconds: metadataTsToSeconds2
  68158. };
  68159. var coneOfSilence = silence_1;
  68160. var clock$12 = clock$2;
  68161. var sumFrameByteLengths = function(array) {
  68162. var i2, currentObj, sum = 0;
  68163. for (i2 = 0; i2 < array.length; i2++) {
  68164. currentObj = array[i2];
  68165. sum += currentObj.data.byteLength;
  68166. }
  68167. return sum;
  68168. };
  68169. var prefixWithSilence = function(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) {
  68170. var baseMediaDecodeTimeTs, frameDuration = 0, audioGapDuration = 0, audioFillFrameCount = 0, audioFillDuration = 0, silentFrame, i2, firstFrame;
  68171. if (!frames.length) {
  68172. return;
  68173. }
  68174. baseMediaDecodeTimeTs = clock$12.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate);
  68175. frameDuration = Math.ceil(clock$12.ONE_SECOND_IN_TS / (track.samplerate / 1024));
  68176. if (audioAppendStartTs && videoBaseMediaDecodeTime) {
  68177. audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime);
  68178. audioFillFrameCount = Math.floor(audioGapDuration / frameDuration);
  68179. audioFillDuration = audioFillFrameCount * frameDuration;
  68180. }
  68181. if (audioFillFrameCount < 1 || audioFillDuration > clock$12.ONE_SECOND_IN_TS / 2) {
  68182. return;
  68183. }
  68184. silentFrame = coneOfSilence()[track.samplerate];
  68185. if (!silentFrame) {
  68186. silentFrame = frames[0].data;
  68187. }
  68188. for (i2 = 0; i2 < audioFillFrameCount; i2++) {
  68189. firstFrame = frames[0];
  68190. frames.splice(0, 0, {
  68191. data: silentFrame,
  68192. dts: firstFrame.dts - frameDuration,
  68193. pts: firstFrame.pts - frameDuration
  68194. });
  68195. }
  68196. track.baseMediaDecodeTime -= Math.floor(clock$12.videoTsToAudioTs(audioFillDuration, track.samplerate));
  68197. return audioFillDuration;
  68198. };
  68199. var trimAdtsFramesByEarliestDts = function(adtsFrames, track, earliestAllowedDts) {
  68200. if (track.minSegmentDts >= earliestAllowedDts) {
  68201. return adtsFrames;
  68202. }
  68203. track.minSegmentDts = Infinity;
  68204. return adtsFrames.filter(function(currentFrame) {
  68205. if (currentFrame.dts >= earliestAllowedDts) {
  68206. track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts);
  68207. track.minSegmentPts = track.minSegmentDts;
  68208. return true;
  68209. }
  68210. return false;
  68211. });
  68212. };
  68213. var generateSampleTable = function(frames) {
  68214. var i2, currentFrame, samples = [];
  68215. for (i2 = 0; i2 < frames.length; i2++) {
  68216. currentFrame = frames[i2];
  68217. samples.push({
  68218. size: currentFrame.data.byteLength,
  68219. duration: 1024
  68220. });
  68221. }
  68222. return samples;
  68223. };
  68224. var concatenateFrameData = function(frames) {
  68225. var i2, currentFrame, dataOffset = 0, data = new Uint8Array(sumFrameByteLengths(frames));
  68226. for (i2 = 0; i2 < frames.length; i2++) {
  68227. currentFrame = frames[i2];
  68228. data.set(currentFrame.data, dataOffset);
  68229. dataOffset += currentFrame.data.byteLength;
  68230. }
  68231. return data;
  68232. };
  68233. var audioFrameUtils$1 = {
  68234. prefixWithSilence,
  68235. trimAdtsFramesByEarliestDts,
  68236. generateSampleTable,
  68237. concatenateFrameData
  68238. };
  68239. var ONE_SECOND_IN_TS$3 = clock$2.ONE_SECOND_IN_TS;
  68240. var collectDtsInfo = function(track, data) {
  68241. if (typeof data.pts === "number") {
  68242. if (track.timelineStartInfo.pts === void 0) {
  68243. track.timelineStartInfo.pts = data.pts;
  68244. }
  68245. if (track.minSegmentPts === void 0) {
  68246. track.minSegmentPts = data.pts;
  68247. } else {
  68248. track.minSegmentPts = Math.min(track.minSegmentPts, data.pts);
  68249. }
  68250. if (track.maxSegmentPts === void 0) {
  68251. track.maxSegmentPts = data.pts;
  68252. } else {
  68253. track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts);
  68254. }
  68255. }
  68256. if (typeof data.dts === "number") {
  68257. if (track.timelineStartInfo.dts === void 0) {
  68258. track.timelineStartInfo.dts = data.dts;
  68259. }
  68260. if (track.minSegmentDts === void 0) {
  68261. track.minSegmentDts = data.dts;
  68262. } else {
  68263. track.minSegmentDts = Math.min(track.minSegmentDts, data.dts);
  68264. }
  68265. if (track.maxSegmentDts === void 0) {
  68266. track.maxSegmentDts = data.dts;
  68267. } else {
  68268. track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts);
  68269. }
  68270. }
  68271. };
  68272. var clearDtsInfo = function(track) {
  68273. delete track.minSegmentDts;
  68274. delete track.maxSegmentDts;
  68275. delete track.minSegmentPts;
  68276. delete track.maxSegmentPts;
  68277. };
  68278. var calculateTrackBaseMediaDecodeTime = function(track, keepOriginalTimestamps) {
  68279. var baseMediaDecodeTime, scale, minSegmentDts = track.minSegmentDts;
  68280. if (!keepOriginalTimestamps) {
  68281. minSegmentDts -= track.timelineStartInfo.dts;
  68282. }
  68283. baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime;
  68284. baseMediaDecodeTime += minSegmentDts;
  68285. baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime);
  68286. if (track.type === "audio") {
  68287. scale = track.samplerate / ONE_SECOND_IN_TS$3;
  68288. baseMediaDecodeTime *= scale;
  68289. baseMediaDecodeTime = Math.floor(baseMediaDecodeTime);
  68290. }
  68291. return baseMediaDecodeTime;
  68292. };
  68293. var trackDecodeInfo$1 = {
  68294. clearDtsInfo,
  68295. calculateTrackBaseMediaDecodeTime,
  68296. collectDtsInfo
  68297. };
  68298. var USER_DATA_REGISTERED_ITU_T_T35 = 4, RBSP_TRAILING_BITS = 128;
  68299. var parseSei = function(bytes) {
  68300. var i2 = 0, result = {
  68301. payloadType: -1,
  68302. payloadSize: 0
  68303. }, payloadType = 0, payloadSize = 0;
  68304. while (i2 < bytes.byteLength) {
  68305. if (bytes[i2] === RBSP_TRAILING_BITS) {
  68306. break;
  68307. }
  68308. while (bytes[i2] === 255) {
  68309. payloadType += 255;
  68310. i2++;
  68311. }
  68312. payloadType += bytes[i2++];
  68313. while (bytes[i2] === 255) {
  68314. payloadSize += 255;
  68315. i2++;
  68316. }
  68317. payloadSize += bytes[i2++];
  68318. if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) {
  68319. var userIdentifier = String.fromCharCode(bytes[i2 + 3], bytes[i2 + 4], bytes[i2 + 5], bytes[i2 + 6]);
  68320. if (userIdentifier === "GA94") {
  68321. result.payloadType = payloadType;
  68322. result.payloadSize = payloadSize;
  68323. result.payload = bytes.subarray(i2, i2 + payloadSize);
  68324. break;
  68325. } else {
  68326. result.payload = void 0;
  68327. }
  68328. }
  68329. i2 += payloadSize;
  68330. payloadType = 0;
  68331. payloadSize = 0;
  68332. }
  68333. return result;
  68334. };
  68335. var parseUserData = function(sei) {
  68336. if (sei.payload[0] !== 181) {
  68337. return null;
  68338. }
  68339. if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) {
  68340. return null;
  68341. }
  68342. if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== "GA94") {
  68343. return null;
  68344. }
  68345. if (sei.payload[7] !== 3) {
  68346. return null;
  68347. }
  68348. return sei.payload.subarray(8, sei.payload.length - 1);
  68349. };
  68350. var parseCaptionPackets = function(pts, userData) {
  68351. var results = [], i2, count, offset, data;
  68352. if (!(userData[0] & 64)) {
  68353. return results;
  68354. }
  68355. count = userData[0] & 31;
  68356. for (i2 = 0; i2 < count; i2++) {
  68357. offset = i2 * 3;
  68358. data = {
  68359. type: userData[offset + 2] & 3,
  68360. pts
  68361. };
  68362. if (userData[offset + 2] & 4) {
  68363. data.ccData = userData[offset + 3] << 8 | userData[offset + 4];
  68364. results.push(data);
  68365. }
  68366. }
  68367. return results;
  68368. };
  68369. var discardEmulationPreventionBytes$12 = function(data) {
  68370. var length = data.byteLength, emulationPreventionBytesPositions = [], i2 = 1, newLength, newData;
  68371. while (i2 < length - 2) {
  68372. if (data[i2] === 0 && data[i2 + 1] === 0 && data[i2 + 2] === 3) {
  68373. emulationPreventionBytesPositions.push(i2 + 2);
  68374. i2 += 2;
  68375. } else {
  68376. i2++;
  68377. }
  68378. }
  68379. if (emulationPreventionBytesPositions.length === 0) {
  68380. return data;
  68381. }
  68382. newLength = length - emulationPreventionBytesPositions.length;
  68383. newData = new Uint8Array(newLength);
  68384. var sourceIndex = 0;
  68385. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  68386. if (sourceIndex === emulationPreventionBytesPositions[0]) {
  68387. sourceIndex++;
  68388. emulationPreventionBytesPositions.shift();
  68389. }
  68390. newData[i2] = data[sourceIndex];
  68391. }
  68392. return newData;
  68393. };
  68394. var captionPacketParser = {
  68395. parseSei,
  68396. parseUserData,
  68397. parseCaptionPackets,
  68398. discardEmulationPreventionBytes: discardEmulationPreventionBytes$12,
  68399. USER_DATA_REGISTERED_ITU_T_T35
  68400. };
  68401. var Stream$7 = stream;
  68402. var cea708Parser = captionPacketParser;
  68403. var CaptionStream$2 = function(options2) {
  68404. options2 = options2 || {};
  68405. CaptionStream$2.prototype.init.call(this);
  68406. this.parse708captions_ = typeof options2.parse708captions === "boolean" ? options2.parse708captions : true;
  68407. this.captionPackets_ = [];
  68408. this.ccStreams_ = [
  68409. new Cea608Stream(0, 0),
  68410. new Cea608Stream(0, 1),
  68411. new Cea608Stream(1, 0),
  68412. new Cea608Stream(1, 1)
  68413. ];
  68414. if (this.parse708captions_) {
  68415. this.cc708Stream_ = new Cea708Stream({
  68416. captionServices: options2.captionServices
  68417. });
  68418. }
  68419. this.reset();
  68420. this.ccStreams_.forEach(function(cc) {
  68421. cc.on("data", this.trigger.bind(this, "data"));
  68422. cc.on("partialdone", this.trigger.bind(this, "partialdone"));
  68423. cc.on("done", this.trigger.bind(this, "done"));
  68424. }, this);
  68425. if (this.parse708captions_) {
  68426. this.cc708Stream_.on("data", this.trigger.bind(this, "data"));
  68427. this.cc708Stream_.on("partialdone", this.trigger.bind(this, "partialdone"));
  68428. this.cc708Stream_.on("done", this.trigger.bind(this, "done"));
  68429. }
  68430. };
  68431. CaptionStream$2.prototype = new Stream$7();
  68432. CaptionStream$2.prototype.push = function(event2) {
  68433. var sei, userData, newCaptionPackets;
  68434. if (event2.nalUnitType !== "sei_rbsp") {
  68435. return;
  68436. }
  68437. sei = cea708Parser.parseSei(event2.escapedRBSP);
  68438. if (!sei.payload) {
  68439. return;
  68440. }
  68441. if (sei.payloadType !== cea708Parser.USER_DATA_REGISTERED_ITU_T_T35) {
  68442. return;
  68443. }
  68444. userData = cea708Parser.parseUserData(sei);
  68445. if (!userData) {
  68446. return;
  68447. }
  68448. if (event2.dts < this.latestDts_) {
  68449. this.ignoreNextEqualDts_ = true;
  68450. return;
  68451. } else if (event2.dts === this.latestDts_ && this.ignoreNextEqualDts_) {
  68452. this.numSameDts_--;
  68453. if (!this.numSameDts_) {
  68454. this.ignoreNextEqualDts_ = false;
  68455. }
  68456. return;
  68457. }
  68458. newCaptionPackets = cea708Parser.parseCaptionPackets(event2.pts, userData);
  68459. this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets);
  68460. if (this.latestDts_ !== event2.dts) {
  68461. this.numSameDts_ = 0;
  68462. }
  68463. this.numSameDts_++;
  68464. this.latestDts_ = event2.dts;
  68465. };
  68466. CaptionStream$2.prototype.flushCCStreams = function(flushType) {
  68467. this.ccStreams_.forEach(function(cc) {
  68468. return flushType === "flush" ? cc.flush() : cc.partialFlush();
  68469. }, this);
  68470. };
  68471. CaptionStream$2.prototype.flushStream = function(flushType) {
  68472. if (!this.captionPackets_.length) {
  68473. this.flushCCStreams(flushType);
  68474. return;
  68475. }
  68476. this.captionPackets_.forEach(function(elem, idx) {
  68477. elem.presortIndex = idx;
  68478. });
  68479. this.captionPackets_.sort(function(a, b) {
  68480. if (a.pts === b.pts) {
  68481. return a.presortIndex - b.presortIndex;
  68482. }
  68483. return a.pts - b.pts;
  68484. });
  68485. this.captionPackets_.forEach(function(packet) {
  68486. if (packet.type < 2) {
  68487. this.dispatchCea608Packet(packet);
  68488. } else {
  68489. this.dispatchCea708Packet(packet);
  68490. }
  68491. }, this);
  68492. this.captionPackets_.length = 0;
  68493. this.flushCCStreams(flushType);
  68494. };
  68495. CaptionStream$2.prototype.flush = function() {
  68496. return this.flushStream("flush");
  68497. };
  68498. CaptionStream$2.prototype.partialFlush = function() {
  68499. return this.flushStream("partialFlush");
  68500. };
  68501. CaptionStream$2.prototype.reset = function() {
  68502. this.latestDts_ = null;
  68503. this.ignoreNextEqualDts_ = false;
  68504. this.numSameDts_ = 0;
  68505. this.activeCea608Channel_ = [null, null];
  68506. this.ccStreams_.forEach(function(ccStream) {
  68507. ccStream.reset();
  68508. });
  68509. };
  68510. CaptionStream$2.prototype.dispatchCea608Packet = function(packet) {
  68511. if (this.setsTextOrXDSActive(packet)) {
  68512. this.activeCea608Channel_[packet.type] = null;
  68513. } else if (this.setsChannel1Active(packet)) {
  68514. this.activeCea608Channel_[packet.type] = 0;
  68515. } else if (this.setsChannel2Active(packet)) {
  68516. this.activeCea608Channel_[packet.type] = 1;
  68517. }
  68518. if (this.activeCea608Channel_[packet.type] === null) {
  68519. return;
  68520. }
  68521. this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet);
  68522. };
  68523. CaptionStream$2.prototype.setsChannel1Active = function(packet) {
  68524. return (packet.ccData & 30720) === 4096;
  68525. };
  68526. CaptionStream$2.prototype.setsChannel2Active = function(packet) {
  68527. return (packet.ccData & 30720) === 6144;
  68528. };
  68529. CaptionStream$2.prototype.setsTextOrXDSActive = function(packet) {
  68530. return (packet.ccData & 28928) === 256 || (packet.ccData & 30974) === 4138 || (packet.ccData & 30974) === 6186;
  68531. };
  68532. CaptionStream$2.prototype.dispatchCea708Packet = function(packet) {
  68533. if (this.parse708captions_) {
  68534. this.cc708Stream_.push(packet);
  68535. }
  68536. };
  68537. var CHARACTER_TRANSLATION_708 = {
  68538. 127: 9834,
  68539. 4128: 32,
  68540. 4129: 160,
  68541. 4133: 8230,
  68542. 4138: 352,
  68543. 4140: 338,
  68544. 4144: 9608,
  68545. 4145: 8216,
  68546. 4146: 8217,
  68547. 4147: 8220,
  68548. 4148: 8221,
  68549. 4149: 8226,
  68550. 4153: 8482,
  68551. 4154: 353,
  68552. 4156: 339,
  68553. 4157: 8480,
  68554. 4159: 376,
  68555. 4214: 8539,
  68556. 4215: 8540,
  68557. 4216: 8541,
  68558. 4217: 8542,
  68559. 4218: 9168,
  68560. 4219: 9124,
  68561. 4220: 9123,
  68562. 4221: 9135,
  68563. 4222: 9126,
  68564. 4223: 9121,
  68565. 4256: 12600
  68566. };
  68567. var get708CharFromCode = function(code) {
  68568. var newCode = CHARACTER_TRANSLATION_708[code] || code;
  68569. if (code & 4096 && code === newCode) {
  68570. return "";
  68571. }
  68572. return String.fromCharCode(newCode);
  68573. };
  68574. var within708TextBlock = function(b) {
  68575. return 32 <= b && b <= 127 || 160 <= b && b <= 255;
  68576. };
  68577. var Cea708Window = function(windowNum) {
  68578. this.windowNum = windowNum;
  68579. this.reset();
  68580. };
  68581. Cea708Window.prototype.reset = function() {
  68582. this.clearText();
  68583. this.pendingNewLine = false;
  68584. this.winAttr = {};
  68585. this.penAttr = {};
  68586. this.penLoc = {};
  68587. this.penColor = {};
  68588. this.visible = 0;
  68589. this.rowLock = 0;
  68590. this.columnLock = 0;
  68591. this.priority = 0;
  68592. this.relativePositioning = 0;
  68593. this.anchorVertical = 0;
  68594. this.anchorHorizontal = 0;
  68595. this.anchorPoint = 0;
  68596. this.rowCount = 1;
  68597. this.virtualRowCount = this.rowCount + 1;
  68598. this.columnCount = 41;
  68599. this.windowStyle = 0;
  68600. this.penStyle = 0;
  68601. };
  68602. Cea708Window.prototype.getText = function() {
  68603. return this.rows.join("\n");
  68604. };
  68605. Cea708Window.prototype.clearText = function() {
  68606. this.rows = [""];
  68607. this.rowIdx = 0;
  68608. };
  68609. Cea708Window.prototype.newLine = function(pts) {
  68610. if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === "function") {
  68611. this.beforeRowOverflow(pts);
  68612. }
  68613. if (this.rows.length > 0) {
  68614. this.rows.push("");
  68615. this.rowIdx++;
  68616. }
  68617. while (this.rows.length > this.virtualRowCount) {
  68618. this.rows.shift();
  68619. this.rowIdx--;
  68620. }
  68621. };
  68622. Cea708Window.prototype.isEmpty = function() {
  68623. if (this.rows.length === 0) {
  68624. return true;
  68625. } else if (this.rows.length === 1) {
  68626. return this.rows[0] === "";
  68627. }
  68628. return false;
  68629. };
  68630. Cea708Window.prototype.addText = function(text) {
  68631. this.rows[this.rowIdx] += text;
  68632. };
  68633. Cea708Window.prototype.backspace = function() {
  68634. if (!this.isEmpty()) {
  68635. var row = this.rows[this.rowIdx];
  68636. this.rows[this.rowIdx] = row.substr(0, row.length - 1);
  68637. }
  68638. };
  68639. var Cea708Service = function(serviceNum, encoding, stream2) {
  68640. this.serviceNum = serviceNum;
  68641. this.text = "";
  68642. this.currentWindow = new Cea708Window(-1);
  68643. this.windows = [];
  68644. this.stream = stream2;
  68645. if (typeof encoding === "string") {
  68646. this.createTextDecoder(encoding);
  68647. }
  68648. };
  68649. Cea708Service.prototype.init = function(pts, beforeRowOverflow) {
  68650. this.startPts = pts;
  68651. for (var win3 = 0; win3 < 8; win3++) {
  68652. this.windows[win3] = new Cea708Window(win3);
  68653. if (typeof beforeRowOverflow === "function") {
  68654. this.windows[win3].beforeRowOverflow = beforeRowOverflow;
  68655. }
  68656. }
  68657. };
  68658. Cea708Service.prototype.setCurrentWindow = function(windowNum) {
  68659. this.currentWindow = this.windows[windowNum];
  68660. };
  68661. Cea708Service.prototype.createTextDecoder = function(encoding) {
  68662. if (typeof TextDecoder === "undefined") {
  68663. this.stream.trigger("log", {
  68664. level: "warn",
  68665. message: "The `encoding` option is unsupported without TextDecoder support"
  68666. });
  68667. } else {
  68668. try {
  68669. this.textDecoder_ = new TextDecoder(encoding);
  68670. } catch (error) {
  68671. this.stream.trigger("log", {
  68672. level: "warn",
  68673. message: "TextDecoder could not be created with " + encoding + " encoding. " + error
  68674. });
  68675. }
  68676. }
  68677. };
  68678. var Cea708Stream = function(options2) {
  68679. options2 = options2 || {};
  68680. Cea708Stream.prototype.init.call(this);
  68681. var self2 = this;
  68682. var captionServices = options2.captionServices || {};
  68683. var captionServiceEncodings = {};
  68684. var serviceProps;
  68685. Object.keys(captionServices).forEach((serviceName) => {
  68686. serviceProps = captionServices[serviceName];
  68687. if (/^SERVICE/.test(serviceName)) {
  68688. captionServiceEncodings[serviceName] = serviceProps.encoding;
  68689. }
  68690. });
  68691. this.serviceEncodings = captionServiceEncodings;
  68692. this.current708Packet = null;
  68693. this.services = {};
  68694. this.push = function(packet) {
  68695. if (packet.type === 3) {
  68696. self2.new708Packet();
  68697. self2.add708Bytes(packet);
  68698. } else {
  68699. if (self2.current708Packet === null) {
  68700. self2.new708Packet();
  68701. }
  68702. self2.add708Bytes(packet);
  68703. }
  68704. };
  68705. };
  68706. Cea708Stream.prototype = new Stream$7();
  68707. Cea708Stream.prototype.new708Packet = function() {
  68708. if (this.current708Packet !== null) {
  68709. this.push708Packet();
  68710. }
  68711. this.current708Packet = {
  68712. data: [],
  68713. ptsVals: []
  68714. };
  68715. };
  68716. Cea708Stream.prototype.add708Bytes = function(packet) {
  68717. var data = packet.ccData;
  68718. var byte0 = data >>> 8;
  68719. var byte1 = data & 255;
  68720. this.current708Packet.ptsVals.push(packet.pts);
  68721. this.current708Packet.data.push(byte0);
  68722. this.current708Packet.data.push(byte1);
  68723. };
  68724. Cea708Stream.prototype.push708Packet = function() {
  68725. var packet708 = this.current708Packet;
  68726. var packetData = packet708.data;
  68727. var serviceNum = null;
  68728. var blockSize = null;
  68729. var i2 = 0;
  68730. var b = packetData[i2++];
  68731. packet708.seq = b >> 6;
  68732. packet708.sizeCode = b & 63;
  68733. for (; i2 < packetData.length; i2++) {
  68734. b = packetData[i2++];
  68735. serviceNum = b >> 5;
  68736. blockSize = b & 31;
  68737. if (serviceNum === 7 && blockSize > 0) {
  68738. b = packetData[i2++];
  68739. serviceNum = b;
  68740. }
  68741. this.pushServiceBlock(serviceNum, i2, blockSize);
  68742. if (blockSize > 0) {
  68743. i2 += blockSize - 1;
  68744. }
  68745. }
  68746. };
  68747. Cea708Stream.prototype.pushServiceBlock = function(serviceNum, start2, size) {
  68748. var b;
  68749. var i2 = start2;
  68750. var packetData = this.current708Packet.data;
  68751. var service = this.services[serviceNum];
  68752. if (!service) {
  68753. service = this.initService(serviceNum, i2);
  68754. }
  68755. for (; i2 < start2 + size && i2 < packetData.length; i2++) {
  68756. b = packetData[i2];
  68757. if (within708TextBlock(b)) {
  68758. i2 = this.handleText(i2, service);
  68759. } else if (b === 24) {
  68760. i2 = this.multiByteCharacter(i2, service);
  68761. } else if (b === 16) {
  68762. i2 = this.extendedCommands(i2, service);
  68763. } else if (128 <= b && b <= 135) {
  68764. i2 = this.setCurrentWindow(i2, service);
  68765. } else if (152 <= b && b <= 159) {
  68766. i2 = this.defineWindow(i2, service);
  68767. } else if (b === 136) {
  68768. i2 = this.clearWindows(i2, service);
  68769. } else if (b === 140) {
  68770. i2 = this.deleteWindows(i2, service);
  68771. } else if (b === 137) {
  68772. i2 = this.displayWindows(i2, service);
  68773. } else if (b === 138) {
  68774. i2 = this.hideWindows(i2, service);
  68775. } else if (b === 139) {
  68776. i2 = this.toggleWindows(i2, service);
  68777. } else if (b === 151) {
  68778. i2 = this.setWindowAttributes(i2, service);
  68779. } else if (b === 144) {
  68780. i2 = this.setPenAttributes(i2, service);
  68781. } else if (b === 145) {
  68782. i2 = this.setPenColor(i2, service);
  68783. } else if (b === 146) {
  68784. i2 = this.setPenLocation(i2, service);
  68785. } else if (b === 143) {
  68786. service = this.reset(i2, service);
  68787. } else if (b === 8) {
  68788. service.currentWindow.backspace();
  68789. } else if (b === 12) {
  68790. service.currentWindow.clearText();
  68791. } else if (b === 13) {
  68792. service.currentWindow.pendingNewLine = true;
  68793. } else if (b === 14) {
  68794. service.currentWindow.clearText();
  68795. } else if (b === 141) {
  68796. i2++;
  68797. } else
  68798. ;
  68799. }
  68800. };
  68801. Cea708Stream.prototype.extendedCommands = function(i2, service) {
  68802. var packetData = this.current708Packet.data;
  68803. var b = packetData[++i2];
  68804. if (within708TextBlock(b)) {
  68805. i2 = this.handleText(i2, service, {
  68806. isExtended: true
  68807. });
  68808. }
  68809. return i2;
  68810. };
  68811. Cea708Stream.prototype.getPts = function(byteIndex) {
  68812. return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)];
  68813. };
  68814. Cea708Stream.prototype.initService = function(serviceNum, i2) {
  68815. var serviceName = "SERVICE" + serviceNum;
  68816. var self2 = this;
  68817. var serviceName;
  68818. var encoding;
  68819. if (serviceName in this.serviceEncodings) {
  68820. encoding = this.serviceEncodings[serviceName];
  68821. }
  68822. this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self2);
  68823. this.services[serviceNum].init(this.getPts(i2), function(pts) {
  68824. self2.flushDisplayed(pts, self2.services[serviceNum]);
  68825. });
  68826. return this.services[serviceNum];
  68827. };
  68828. Cea708Stream.prototype.handleText = function(i2, service, options2) {
  68829. var isExtended = options2 && options2.isExtended;
  68830. var isMultiByte = options2 && options2.isMultiByte;
  68831. var packetData = this.current708Packet.data;
  68832. var extended = isExtended ? 4096 : 0;
  68833. var currentByte = packetData[i2];
  68834. var nextByte = packetData[i2 + 1];
  68835. var win3 = service.currentWindow;
  68836. var char;
  68837. var charCodeArray;
  68838. if (service.textDecoder_ && !isExtended) {
  68839. if (isMultiByte) {
  68840. charCodeArray = [currentByte, nextByte];
  68841. i2++;
  68842. } else {
  68843. charCodeArray = [currentByte];
  68844. }
  68845. char = service.textDecoder_.decode(new Uint8Array(charCodeArray));
  68846. } else {
  68847. char = get708CharFromCode(extended | currentByte);
  68848. }
  68849. if (win3.pendingNewLine && !win3.isEmpty()) {
  68850. win3.newLine(this.getPts(i2));
  68851. }
  68852. win3.pendingNewLine = false;
  68853. win3.addText(char);
  68854. return i2;
  68855. };
  68856. Cea708Stream.prototype.multiByteCharacter = function(i2, service) {
  68857. var packetData = this.current708Packet.data;
  68858. var firstByte = packetData[i2 + 1];
  68859. var secondByte = packetData[i2 + 2];
  68860. if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) {
  68861. i2 = this.handleText(++i2, service, {
  68862. isMultiByte: true
  68863. });
  68864. }
  68865. return i2;
  68866. };
  68867. Cea708Stream.prototype.setCurrentWindow = function(i2, service) {
  68868. var packetData = this.current708Packet.data;
  68869. var b = packetData[i2];
  68870. var windowNum = b & 7;
  68871. service.setCurrentWindow(windowNum);
  68872. return i2;
  68873. };
  68874. Cea708Stream.prototype.defineWindow = function(i2, service) {
  68875. var packetData = this.current708Packet.data;
  68876. var b = packetData[i2];
  68877. var windowNum = b & 7;
  68878. service.setCurrentWindow(windowNum);
  68879. var win3 = service.currentWindow;
  68880. b = packetData[++i2];
  68881. win3.visible = (b & 32) >> 5;
  68882. win3.rowLock = (b & 16) >> 4;
  68883. win3.columnLock = (b & 8) >> 3;
  68884. win3.priority = b & 7;
  68885. b = packetData[++i2];
  68886. win3.relativePositioning = (b & 128) >> 7;
  68887. win3.anchorVertical = b & 127;
  68888. b = packetData[++i2];
  68889. win3.anchorHorizontal = b;
  68890. b = packetData[++i2];
  68891. win3.anchorPoint = (b & 240) >> 4;
  68892. win3.rowCount = b & 15;
  68893. b = packetData[++i2];
  68894. win3.columnCount = b & 63;
  68895. b = packetData[++i2];
  68896. win3.windowStyle = (b & 56) >> 3;
  68897. win3.penStyle = b & 7;
  68898. win3.virtualRowCount = win3.rowCount + 1;
  68899. return i2;
  68900. };
  68901. Cea708Stream.prototype.setWindowAttributes = function(i2, service) {
  68902. var packetData = this.current708Packet.data;
  68903. var b = packetData[i2];
  68904. var winAttr = service.currentWindow.winAttr;
  68905. b = packetData[++i2];
  68906. winAttr.fillOpacity = (b & 192) >> 6;
  68907. winAttr.fillRed = (b & 48) >> 4;
  68908. winAttr.fillGreen = (b & 12) >> 2;
  68909. winAttr.fillBlue = b & 3;
  68910. b = packetData[++i2];
  68911. winAttr.borderType = (b & 192) >> 6;
  68912. winAttr.borderRed = (b & 48) >> 4;
  68913. winAttr.borderGreen = (b & 12) >> 2;
  68914. winAttr.borderBlue = b & 3;
  68915. b = packetData[++i2];
  68916. winAttr.borderType += (b & 128) >> 5;
  68917. winAttr.wordWrap = (b & 64) >> 6;
  68918. winAttr.printDirection = (b & 48) >> 4;
  68919. winAttr.scrollDirection = (b & 12) >> 2;
  68920. winAttr.justify = b & 3;
  68921. b = packetData[++i2];
  68922. winAttr.effectSpeed = (b & 240) >> 4;
  68923. winAttr.effectDirection = (b & 12) >> 2;
  68924. winAttr.displayEffect = b & 3;
  68925. return i2;
  68926. };
  68927. Cea708Stream.prototype.flushDisplayed = function(pts, service) {
  68928. var displayedText = [];
  68929. for (var winId = 0; winId < 8; winId++) {
  68930. if (service.windows[winId].visible && !service.windows[winId].isEmpty()) {
  68931. displayedText.push(service.windows[winId].getText());
  68932. }
  68933. }
  68934. service.endPts = pts;
  68935. service.text = displayedText.join("\n\n");
  68936. this.pushCaption(service);
  68937. service.startPts = pts;
  68938. };
  68939. Cea708Stream.prototype.pushCaption = function(service) {
  68940. if (service.text !== "") {
  68941. this.trigger("data", {
  68942. startPts: service.startPts,
  68943. endPts: service.endPts,
  68944. text: service.text,
  68945. stream: "cc708_" + service.serviceNum
  68946. });
  68947. service.text = "";
  68948. service.startPts = service.endPts;
  68949. }
  68950. };
  68951. Cea708Stream.prototype.displayWindows = function(i2, service) {
  68952. var packetData = this.current708Packet.data;
  68953. var b = packetData[++i2];
  68954. var pts = this.getPts(i2);
  68955. this.flushDisplayed(pts, service);
  68956. for (var winId = 0; winId < 8; winId++) {
  68957. if (b & 1 << winId) {
  68958. service.windows[winId].visible = 1;
  68959. }
  68960. }
  68961. return i2;
  68962. };
  68963. Cea708Stream.prototype.hideWindows = function(i2, service) {
  68964. var packetData = this.current708Packet.data;
  68965. var b = packetData[++i2];
  68966. var pts = this.getPts(i2);
  68967. this.flushDisplayed(pts, service);
  68968. for (var winId = 0; winId < 8; winId++) {
  68969. if (b & 1 << winId) {
  68970. service.windows[winId].visible = 0;
  68971. }
  68972. }
  68973. return i2;
  68974. };
  68975. Cea708Stream.prototype.toggleWindows = function(i2, service) {
  68976. var packetData = this.current708Packet.data;
  68977. var b = packetData[++i2];
  68978. var pts = this.getPts(i2);
  68979. this.flushDisplayed(pts, service);
  68980. for (var winId = 0; winId < 8; winId++) {
  68981. if (b & 1 << winId) {
  68982. service.windows[winId].visible ^= 1;
  68983. }
  68984. }
  68985. return i2;
  68986. };
  68987. Cea708Stream.prototype.clearWindows = function(i2, service) {
  68988. var packetData = this.current708Packet.data;
  68989. var b = packetData[++i2];
  68990. var pts = this.getPts(i2);
  68991. this.flushDisplayed(pts, service);
  68992. for (var winId = 0; winId < 8; winId++) {
  68993. if (b & 1 << winId) {
  68994. service.windows[winId].clearText();
  68995. }
  68996. }
  68997. return i2;
  68998. };
  68999. Cea708Stream.prototype.deleteWindows = function(i2, service) {
  69000. var packetData = this.current708Packet.data;
  69001. var b = packetData[++i2];
  69002. var pts = this.getPts(i2);
  69003. this.flushDisplayed(pts, service);
  69004. for (var winId = 0; winId < 8; winId++) {
  69005. if (b & 1 << winId) {
  69006. service.windows[winId].reset();
  69007. }
  69008. }
  69009. return i2;
  69010. };
  69011. Cea708Stream.prototype.setPenAttributes = function(i2, service) {
  69012. var packetData = this.current708Packet.data;
  69013. var b = packetData[i2];
  69014. var penAttr = service.currentWindow.penAttr;
  69015. b = packetData[++i2];
  69016. penAttr.textTag = (b & 240) >> 4;
  69017. penAttr.offset = (b & 12) >> 2;
  69018. penAttr.penSize = b & 3;
  69019. b = packetData[++i2];
  69020. penAttr.italics = (b & 128) >> 7;
  69021. penAttr.underline = (b & 64) >> 6;
  69022. penAttr.edgeType = (b & 56) >> 3;
  69023. penAttr.fontStyle = b & 7;
  69024. return i2;
  69025. };
  69026. Cea708Stream.prototype.setPenColor = function(i2, service) {
  69027. var packetData = this.current708Packet.data;
  69028. var b = packetData[i2];
  69029. var penColor = service.currentWindow.penColor;
  69030. b = packetData[++i2];
  69031. penColor.fgOpacity = (b & 192) >> 6;
  69032. penColor.fgRed = (b & 48) >> 4;
  69033. penColor.fgGreen = (b & 12) >> 2;
  69034. penColor.fgBlue = b & 3;
  69035. b = packetData[++i2];
  69036. penColor.bgOpacity = (b & 192) >> 6;
  69037. penColor.bgRed = (b & 48) >> 4;
  69038. penColor.bgGreen = (b & 12) >> 2;
  69039. penColor.bgBlue = b & 3;
  69040. b = packetData[++i2];
  69041. penColor.edgeRed = (b & 48) >> 4;
  69042. penColor.edgeGreen = (b & 12) >> 2;
  69043. penColor.edgeBlue = b & 3;
  69044. return i2;
  69045. };
  69046. Cea708Stream.prototype.setPenLocation = function(i2, service) {
  69047. var packetData = this.current708Packet.data;
  69048. var b = packetData[i2];
  69049. var penLoc = service.currentWindow.penLoc;
  69050. service.currentWindow.pendingNewLine = true;
  69051. b = packetData[++i2];
  69052. penLoc.row = b & 15;
  69053. b = packetData[++i2];
  69054. penLoc.column = b & 63;
  69055. return i2;
  69056. };
  69057. Cea708Stream.prototype.reset = function(i2, service) {
  69058. var pts = this.getPts(i2);
  69059. this.flushDisplayed(pts, service);
  69060. return this.initService(service.serviceNum, i2);
  69061. };
  69062. var CHARACTER_TRANSLATION = {
  69063. 42: 225,
  69064. 92: 233,
  69065. 94: 237,
  69066. 95: 243,
  69067. 96: 250,
  69068. 123: 231,
  69069. 124: 247,
  69070. 125: 209,
  69071. 126: 241,
  69072. 127: 9608,
  69073. 304: 174,
  69074. 305: 176,
  69075. 306: 189,
  69076. 307: 191,
  69077. 308: 8482,
  69078. 309: 162,
  69079. 310: 163,
  69080. 311: 9834,
  69081. 312: 224,
  69082. 313: 160,
  69083. 314: 232,
  69084. 315: 226,
  69085. 316: 234,
  69086. 317: 238,
  69087. 318: 244,
  69088. 319: 251,
  69089. 544: 193,
  69090. 545: 201,
  69091. 546: 211,
  69092. 547: 218,
  69093. 548: 220,
  69094. 549: 252,
  69095. 550: 8216,
  69096. 551: 161,
  69097. 552: 42,
  69098. 553: 39,
  69099. 554: 8212,
  69100. 555: 169,
  69101. 556: 8480,
  69102. 557: 8226,
  69103. 558: 8220,
  69104. 559: 8221,
  69105. 560: 192,
  69106. 561: 194,
  69107. 562: 199,
  69108. 563: 200,
  69109. 564: 202,
  69110. 565: 203,
  69111. 566: 235,
  69112. 567: 206,
  69113. 568: 207,
  69114. 569: 239,
  69115. 570: 212,
  69116. 571: 217,
  69117. 572: 249,
  69118. 573: 219,
  69119. 574: 171,
  69120. 575: 187,
  69121. 800: 195,
  69122. 801: 227,
  69123. 802: 205,
  69124. 803: 204,
  69125. 804: 236,
  69126. 805: 210,
  69127. 806: 242,
  69128. 807: 213,
  69129. 808: 245,
  69130. 809: 123,
  69131. 810: 125,
  69132. 811: 92,
  69133. 812: 94,
  69134. 813: 95,
  69135. 814: 124,
  69136. 815: 126,
  69137. 816: 196,
  69138. 817: 228,
  69139. 818: 214,
  69140. 819: 246,
  69141. 820: 223,
  69142. 821: 165,
  69143. 822: 164,
  69144. 823: 9474,
  69145. 824: 197,
  69146. 825: 229,
  69147. 826: 216,
  69148. 827: 248,
  69149. 828: 9484,
  69150. 829: 9488,
  69151. 830: 9492,
  69152. 831: 9496
  69153. };
  69154. var getCharFromCode = function(code) {
  69155. if (code === null) {
  69156. return "";
  69157. }
  69158. code = CHARACTER_TRANSLATION[code] || code;
  69159. return String.fromCharCode(code);
  69160. };
  69161. var BOTTOM_ROW = 14;
  69162. var ROWS = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152];
  69163. var createDisplayBuffer = function() {
  69164. var result = [], i2 = BOTTOM_ROW + 1;
  69165. while (i2--) {
  69166. result.push("");
  69167. }
  69168. return result;
  69169. };
  69170. var Cea608Stream = function(field, dataChannel) {
  69171. Cea608Stream.prototype.init.call(this);
  69172. this.field_ = field || 0;
  69173. this.dataChannel_ = dataChannel || 0;
  69174. this.name_ = "CC" + ((this.field_ << 1 | this.dataChannel_) + 1);
  69175. this.setConstants();
  69176. this.reset();
  69177. this.push = function(packet) {
  69178. var data, swap, char0, char1, text;
  69179. data = packet.ccData & 32639;
  69180. if (data === this.lastControlCode_) {
  69181. this.lastControlCode_ = null;
  69182. return;
  69183. }
  69184. if ((data & 61440) === 4096) {
  69185. this.lastControlCode_ = data;
  69186. } else if (data !== this.PADDING_) {
  69187. this.lastControlCode_ = null;
  69188. }
  69189. char0 = data >>> 8;
  69190. char1 = data & 255;
  69191. if (data === this.PADDING_) {
  69192. return;
  69193. } else if (data === this.RESUME_CAPTION_LOADING_) {
  69194. this.mode_ = "popOn";
  69195. } else if (data === this.END_OF_CAPTION_) {
  69196. this.mode_ = "popOn";
  69197. this.clearFormatting(packet.pts);
  69198. this.flushDisplayed(packet.pts);
  69199. swap = this.displayed_;
  69200. this.displayed_ = this.nonDisplayed_;
  69201. this.nonDisplayed_ = swap;
  69202. this.startPts_ = packet.pts;
  69203. } else if (data === this.ROLL_UP_2_ROWS_) {
  69204. this.rollUpRows_ = 2;
  69205. this.setRollUp(packet.pts);
  69206. } else if (data === this.ROLL_UP_3_ROWS_) {
  69207. this.rollUpRows_ = 3;
  69208. this.setRollUp(packet.pts);
  69209. } else if (data === this.ROLL_UP_4_ROWS_) {
  69210. this.rollUpRows_ = 4;
  69211. this.setRollUp(packet.pts);
  69212. } else if (data === this.CARRIAGE_RETURN_) {
  69213. this.clearFormatting(packet.pts);
  69214. this.flushDisplayed(packet.pts);
  69215. this.shiftRowsUp_();
  69216. this.startPts_ = packet.pts;
  69217. } else if (data === this.BACKSPACE_) {
  69218. if (this.mode_ === "popOn") {
  69219. this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);
  69220. } else {
  69221. this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
  69222. }
  69223. } else if (data === this.ERASE_DISPLAYED_MEMORY_) {
  69224. this.flushDisplayed(packet.pts);
  69225. this.displayed_ = createDisplayBuffer();
  69226. } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) {
  69227. this.nonDisplayed_ = createDisplayBuffer();
  69228. } else if (data === this.RESUME_DIRECT_CAPTIONING_) {
  69229. if (this.mode_ !== "paintOn") {
  69230. this.flushDisplayed(packet.pts);
  69231. this.displayed_ = createDisplayBuffer();
  69232. }
  69233. this.mode_ = "paintOn";
  69234. this.startPts_ = packet.pts;
  69235. } else if (this.isSpecialCharacter(char0, char1)) {
  69236. char0 = (char0 & 3) << 8;
  69237. text = getCharFromCode(char0 | char1);
  69238. this[this.mode_](packet.pts, text);
  69239. this.column_++;
  69240. } else if (this.isExtCharacter(char0, char1)) {
  69241. if (this.mode_ === "popOn") {
  69242. this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);
  69243. } else {
  69244. this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
  69245. }
  69246. char0 = (char0 & 3) << 8;
  69247. text = getCharFromCode(char0 | char1);
  69248. this[this.mode_](packet.pts, text);
  69249. this.column_++;
  69250. } else if (this.isMidRowCode(char0, char1)) {
  69251. this.clearFormatting(packet.pts);
  69252. this[this.mode_](packet.pts, " ");
  69253. this.column_++;
  69254. if ((char1 & 14) === 14) {
  69255. this.addFormatting(packet.pts, ["i"]);
  69256. }
  69257. if ((char1 & 1) === 1) {
  69258. this.addFormatting(packet.pts, ["u"]);
  69259. }
  69260. } else if (this.isOffsetControlCode(char0, char1)) {
  69261. this.column_ += char1 & 3;
  69262. } else if (this.isPAC(char0, char1)) {
  69263. var row = ROWS.indexOf(data & 7968);
  69264. if (this.mode_ === "rollUp") {
  69265. if (row - this.rollUpRows_ + 1 < 0) {
  69266. row = this.rollUpRows_ - 1;
  69267. }
  69268. this.setRollUp(packet.pts, row);
  69269. }
  69270. if (row !== this.row_) {
  69271. this.clearFormatting(packet.pts);
  69272. this.row_ = row;
  69273. }
  69274. if (char1 & 1 && this.formatting_.indexOf("u") === -1) {
  69275. this.addFormatting(packet.pts, ["u"]);
  69276. }
  69277. if ((data & 16) === 16) {
  69278. this.column_ = ((data & 14) >> 1) * 4;
  69279. }
  69280. if (this.isColorPAC(char1)) {
  69281. if ((char1 & 14) === 14) {
  69282. this.addFormatting(packet.pts, ["i"]);
  69283. }
  69284. }
  69285. } else if (this.isNormalChar(char0)) {
  69286. if (char1 === 0) {
  69287. char1 = null;
  69288. }
  69289. text = getCharFromCode(char0);
  69290. text += getCharFromCode(char1);
  69291. this[this.mode_](packet.pts, text);
  69292. this.column_ += text.length;
  69293. }
  69294. };
  69295. };
  69296. Cea608Stream.prototype = new Stream$7();
  69297. Cea608Stream.prototype.flushDisplayed = function(pts) {
  69298. var content = this.displayed_.map(function(row, index2) {
  69299. try {
  69300. return row.trim();
  69301. } catch (e) {
  69302. this.trigger("log", {
  69303. level: "warn",
  69304. message: "Skipping a malformed 608 caption at index " + index2 + "."
  69305. });
  69306. return "";
  69307. }
  69308. }, this).join("\n").replace(/^\n+|\n+$/g, "");
  69309. if (content.length) {
  69310. this.trigger("data", {
  69311. startPts: this.startPts_,
  69312. endPts: pts,
  69313. text: content,
  69314. stream: this.name_
  69315. });
  69316. }
  69317. };
  69318. Cea608Stream.prototype.reset = function() {
  69319. this.mode_ = "popOn";
  69320. this.topRow_ = 0;
  69321. this.startPts_ = 0;
  69322. this.displayed_ = createDisplayBuffer();
  69323. this.nonDisplayed_ = createDisplayBuffer();
  69324. this.lastControlCode_ = null;
  69325. this.column_ = 0;
  69326. this.row_ = BOTTOM_ROW;
  69327. this.rollUpRows_ = 2;
  69328. this.formatting_ = [];
  69329. };
  69330. Cea608Stream.prototype.setConstants = function() {
  69331. if (this.dataChannel_ === 0) {
  69332. this.BASE_ = 16;
  69333. this.EXT_ = 17;
  69334. this.CONTROL_ = (20 | this.field_) << 8;
  69335. this.OFFSET_ = 23;
  69336. } else if (this.dataChannel_ === 1) {
  69337. this.BASE_ = 24;
  69338. this.EXT_ = 25;
  69339. this.CONTROL_ = (28 | this.field_) << 8;
  69340. this.OFFSET_ = 31;
  69341. }
  69342. this.PADDING_ = 0;
  69343. this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 32;
  69344. this.END_OF_CAPTION_ = this.CONTROL_ | 47;
  69345. this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 37;
  69346. this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 38;
  69347. this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 39;
  69348. this.CARRIAGE_RETURN_ = this.CONTROL_ | 45;
  69349. this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 41;
  69350. this.BACKSPACE_ = this.CONTROL_ | 33;
  69351. this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 44;
  69352. this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 46;
  69353. };
  69354. Cea608Stream.prototype.isSpecialCharacter = function(char0, char1) {
  69355. return char0 === this.EXT_ && char1 >= 48 && char1 <= 63;
  69356. };
  69357. Cea608Stream.prototype.isExtCharacter = function(char0, char1) {
  69358. return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 32 && char1 <= 63;
  69359. };
  69360. Cea608Stream.prototype.isMidRowCode = function(char0, char1) {
  69361. return char0 === this.EXT_ && char1 >= 32 && char1 <= 47;
  69362. };
  69363. Cea608Stream.prototype.isOffsetControlCode = function(char0, char1) {
  69364. return char0 === this.OFFSET_ && char1 >= 33 && char1 <= 35;
  69365. };
  69366. Cea608Stream.prototype.isPAC = function(char0, char1) {
  69367. return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 64 && char1 <= 127;
  69368. };
  69369. Cea608Stream.prototype.isColorPAC = function(char1) {
  69370. return char1 >= 64 && char1 <= 79 || char1 >= 96 && char1 <= 127;
  69371. };
  69372. Cea608Stream.prototype.isNormalChar = function(char) {
  69373. return char >= 32 && char <= 127;
  69374. };
  69375. Cea608Stream.prototype.setRollUp = function(pts, newBaseRow) {
  69376. if (this.mode_ !== "rollUp") {
  69377. this.row_ = BOTTOM_ROW;
  69378. this.mode_ = "rollUp";
  69379. this.flushDisplayed(pts);
  69380. this.nonDisplayed_ = createDisplayBuffer();
  69381. this.displayed_ = createDisplayBuffer();
  69382. }
  69383. if (newBaseRow !== void 0 && newBaseRow !== this.row_) {
  69384. for (var i2 = 0; i2 < this.rollUpRows_; i2++) {
  69385. this.displayed_[newBaseRow - i2] = this.displayed_[this.row_ - i2];
  69386. this.displayed_[this.row_ - i2] = "";
  69387. }
  69388. }
  69389. if (newBaseRow === void 0) {
  69390. newBaseRow = this.row_;
  69391. }
  69392. this.topRow_ = newBaseRow - this.rollUpRows_ + 1;
  69393. };
  69394. Cea608Stream.prototype.addFormatting = function(pts, format) {
  69395. this.formatting_ = this.formatting_.concat(format);
  69396. var text = format.reduce(function(text2, format2) {
  69397. return text2 + "<" + format2 + ">";
  69398. }, "");
  69399. this[this.mode_](pts, text);
  69400. };
  69401. Cea608Stream.prototype.clearFormatting = function(pts) {
  69402. if (!this.formatting_.length) {
  69403. return;
  69404. }
  69405. var text = this.formatting_.reverse().reduce(function(text2, format) {
  69406. return text2 + "</" + format + ">";
  69407. }, "");
  69408. this.formatting_ = [];
  69409. this[this.mode_](pts, text);
  69410. };
  69411. Cea608Stream.prototype.popOn = function(pts, text) {
  69412. var baseRow = this.nonDisplayed_[this.row_];
  69413. baseRow += text;
  69414. this.nonDisplayed_[this.row_] = baseRow;
  69415. };
  69416. Cea608Stream.prototype.rollUp = function(pts, text) {
  69417. var baseRow = this.displayed_[this.row_];
  69418. baseRow += text;
  69419. this.displayed_[this.row_] = baseRow;
  69420. };
  69421. Cea608Stream.prototype.shiftRowsUp_ = function() {
  69422. var i2;
  69423. for (i2 = 0; i2 < this.topRow_; i2++) {
  69424. this.displayed_[i2] = "";
  69425. }
  69426. for (i2 = this.row_ + 1; i2 < BOTTOM_ROW + 1; i2++) {
  69427. this.displayed_[i2] = "";
  69428. }
  69429. for (i2 = this.topRow_; i2 < this.row_; i2++) {
  69430. this.displayed_[i2] = this.displayed_[i2 + 1];
  69431. }
  69432. this.displayed_[this.row_] = "";
  69433. };
  69434. Cea608Stream.prototype.paintOn = function(pts, text) {
  69435. var baseRow = this.displayed_[this.row_];
  69436. baseRow += text;
  69437. this.displayed_[this.row_] = baseRow;
  69438. };
  69439. var captionStream = {
  69440. CaptionStream: CaptionStream$2,
  69441. Cea608Stream,
  69442. Cea708Stream
  69443. };
  69444. var streamTypes = {
  69445. H264_STREAM_TYPE: 27,
  69446. ADTS_STREAM_TYPE: 15,
  69447. METADATA_STREAM_TYPE: 21
  69448. };
  69449. var Stream$6 = stream;
  69450. var MAX_TS = 8589934592;
  69451. var RO_THRESH = 4294967296;
  69452. var TYPE_SHARED = "shared";
  69453. var handleRollover$1 = function(value, reference) {
  69454. var direction = 1;
  69455. if (value > reference) {
  69456. direction = -1;
  69457. }
  69458. while (Math.abs(reference - value) > RO_THRESH) {
  69459. value += direction * MAX_TS;
  69460. }
  69461. return value;
  69462. };
  69463. var TimestampRolloverStream$1 = function(type3) {
  69464. var lastDTS, referenceDTS;
  69465. TimestampRolloverStream$1.prototype.init.call(this);
  69466. this.type_ = type3 || TYPE_SHARED;
  69467. this.push = function(data) {
  69468. if (this.type_ !== TYPE_SHARED && data.type !== this.type_) {
  69469. return;
  69470. }
  69471. if (referenceDTS === void 0) {
  69472. referenceDTS = data.dts;
  69473. }
  69474. data.dts = handleRollover$1(data.dts, referenceDTS);
  69475. data.pts = handleRollover$1(data.pts, referenceDTS);
  69476. lastDTS = data.dts;
  69477. this.trigger("data", data);
  69478. };
  69479. this.flush = function() {
  69480. referenceDTS = lastDTS;
  69481. this.trigger("done");
  69482. };
  69483. this.endTimeline = function() {
  69484. this.flush();
  69485. this.trigger("endedtimeline");
  69486. };
  69487. this.discontinuity = function() {
  69488. referenceDTS = void 0;
  69489. lastDTS = void 0;
  69490. };
  69491. this.reset = function() {
  69492. this.discontinuity();
  69493. this.trigger("reset");
  69494. };
  69495. };
  69496. TimestampRolloverStream$1.prototype = new Stream$6();
  69497. var timestampRolloverStream = {
  69498. TimestampRolloverStream: TimestampRolloverStream$1,
  69499. handleRollover: handleRollover$1
  69500. };
  69501. var typedArrayIndexOf$1 = (typedArray2, element, fromIndex) => {
  69502. if (!typedArray2) {
  69503. return -1;
  69504. }
  69505. var currentIndex = fromIndex;
  69506. for (; currentIndex < typedArray2.length; currentIndex++) {
  69507. if (typedArray2[currentIndex] === element) {
  69508. return currentIndex;
  69509. }
  69510. }
  69511. return -1;
  69512. };
  69513. var typedArray = {
  69514. typedArrayIndexOf: typedArrayIndexOf$1
  69515. };
  69516. var typedArrayIndexOf = typedArray.typedArrayIndexOf, textEncodingDescriptionByte = {
  69517. Iso88591: 0,
  69518. Utf16: 1,
  69519. Utf16be: 2,
  69520. Utf8: 3
  69521. }, percentEncode$1 = function(bytes, start2, end) {
  69522. var i2, result = "";
  69523. for (i2 = start2; i2 < end; i2++) {
  69524. result += "%" + ("00" + bytes[i2].toString(16)).slice(-2);
  69525. }
  69526. return result;
  69527. }, parseUtf8 = function(bytes, start2, end) {
  69528. return decodeURIComponent(percentEncode$1(bytes, start2, end));
  69529. }, parseIso88591$1 = function(bytes, start2, end) {
  69530. return unescape(percentEncode$1(bytes, start2, end));
  69531. }, parseSyncSafeInteger$1 = function(data) {
  69532. return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];
  69533. }, frameParsers = {
  69534. "APIC": function(frame) {
  69535. var i2 = 1, mimeTypeEndIndex, descriptionEndIndex, LINK_MIME_TYPE = "-->";
  69536. if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {
  69537. return;
  69538. }
  69539. mimeTypeEndIndex = typedArrayIndexOf(frame.data, 0, i2);
  69540. if (mimeTypeEndIndex < 0) {
  69541. return;
  69542. }
  69543. frame.mimeType = parseIso88591$1(frame.data, i2, mimeTypeEndIndex);
  69544. i2 = mimeTypeEndIndex + 1;
  69545. frame.pictureType = frame.data[i2];
  69546. i2++;
  69547. descriptionEndIndex = typedArrayIndexOf(frame.data, 0, i2);
  69548. if (descriptionEndIndex < 0) {
  69549. return;
  69550. }
  69551. frame.description = parseUtf8(frame.data, i2, descriptionEndIndex);
  69552. i2 = descriptionEndIndex + 1;
  69553. if (frame.mimeType === LINK_MIME_TYPE) {
  69554. frame.url = parseIso88591$1(frame.data, i2, frame.data.length);
  69555. } else {
  69556. frame.pictureData = frame.data.subarray(i2, frame.data.length);
  69557. }
  69558. },
  69559. "T*": function(frame) {
  69560. if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {
  69561. return;
  69562. }
  69563. frame.value = parseUtf8(frame.data, 1, frame.data.length).replace(/\0*$/, "");
  69564. frame.values = frame.value.split("\0");
  69565. },
  69566. "TXXX": function(frame) {
  69567. var descriptionEndIndex;
  69568. if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {
  69569. return;
  69570. }
  69571. descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1);
  69572. if (descriptionEndIndex === -1) {
  69573. return;
  69574. }
  69575. frame.description = parseUtf8(frame.data, 1, descriptionEndIndex);
  69576. frame.value = parseUtf8(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0*$/, "");
  69577. frame.data = frame.value;
  69578. },
  69579. "W*": function(frame) {
  69580. frame.url = parseIso88591$1(frame.data, 0, frame.data.length).replace(/\0.*$/, "");
  69581. },
  69582. "WXXX": function(frame) {
  69583. var descriptionEndIndex;
  69584. if (frame.data[0] !== textEncodingDescriptionByte.Utf8) {
  69585. return;
  69586. }
  69587. descriptionEndIndex = typedArrayIndexOf(frame.data, 0, 1);
  69588. if (descriptionEndIndex === -1) {
  69589. return;
  69590. }
  69591. frame.description = parseUtf8(frame.data, 1, descriptionEndIndex);
  69592. frame.url = parseIso88591$1(frame.data, descriptionEndIndex + 1, frame.data.length).replace(/\0.*$/, "");
  69593. },
  69594. "PRIV": function(frame) {
  69595. var i2;
  69596. for (i2 = 0; i2 < frame.data.length; i2++) {
  69597. if (frame.data[i2] === 0) {
  69598. frame.owner = parseIso88591$1(frame.data, 0, i2);
  69599. break;
  69600. }
  69601. }
  69602. frame.privateData = frame.data.subarray(i2 + 1);
  69603. frame.data = frame.privateData;
  69604. }
  69605. };
  69606. var parseId3Frames$1 = function(data) {
  69607. var frameSize, frameHeader, frameStart = 10, tagSize = 0, frames = [];
  69608. if (data.length < 10 || data[0] !== "I".charCodeAt(0) || data[1] !== "D".charCodeAt(0) || data[2] !== "3".charCodeAt(0)) {
  69609. return;
  69610. }
  69611. tagSize = parseSyncSafeInteger$1(data.subarray(6, 10));
  69612. tagSize += 10;
  69613. var hasExtendedHeader = data[5] & 64;
  69614. if (hasExtendedHeader) {
  69615. frameStart += 4;
  69616. frameStart += parseSyncSafeInteger$1(data.subarray(10, 14));
  69617. tagSize -= parseSyncSafeInteger$1(data.subarray(16, 20));
  69618. }
  69619. do {
  69620. frameSize = parseSyncSafeInteger$1(data.subarray(frameStart + 4, frameStart + 8));
  69621. if (frameSize < 1) {
  69622. break;
  69623. }
  69624. frameHeader = String.fromCharCode(data[frameStart], data[frameStart + 1], data[frameStart + 2], data[frameStart + 3]);
  69625. var frame = {
  69626. id: frameHeader,
  69627. data: data.subarray(frameStart + 10, frameStart + frameSize + 10)
  69628. };
  69629. frame.key = frame.id;
  69630. if (frameParsers[frame.id]) {
  69631. frameParsers[frame.id](frame);
  69632. } else if (frame.id[0] === "T") {
  69633. frameParsers["T*"](frame);
  69634. } else if (frame.id[0] === "W") {
  69635. frameParsers["W*"](frame);
  69636. }
  69637. frames.push(frame);
  69638. frameStart += 10;
  69639. frameStart += frameSize;
  69640. } while (frameStart < tagSize);
  69641. return frames;
  69642. };
  69643. var parseId3 = {
  69644. parseId3Frames: parseId3Frames$1,
  69645. parseSyncSafeInteger: parseSyncSafeInteger$1,
  69646. frameParsers
  69647. };
  69648. var Stream$5 = stream, StreamTypes$3 = streamTypes, id3 = parseId3, MetadataStream;
  69649. MetadataStream = function(options2) {
  69650. var settings = {
  69651. descriptor: options2 && options2.descriptor
  69652. }, tagSize = 0, buffer = [], bufferSize = 0, i2;
  69653. MetadataStream.prototype.init.call(this);
  69654. this.dispatchType = StreamTypes$3.METADATA_STREAM_TYPE.toString(16);
  69655. if (settings.descriptor) {
  69656. for (i2 = 0; i2 < settings.descriptor.length; i2++) {
  69657. this.dispatchType += ("00" + settings.descriptor[i2].toString(16)).slice(-2);
  69658. }
  69659. }
  69660. this.push = function(chunk) {
  69661. var tag, frameStart, frameSize, frame, i3, frameHeader;
  69662. if (chunk.type !== "timed-metadata") {
  69663. return;
  69664. }
  69665. if (chunk.dataAlignmentIndicator) {
  69666. bufferSize = 0;
  69667. buffer.length = 0;
  69668. }
  69669. if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== "I".charCodeAt(0) || chunk.data[1] !== "D".charCodeAt(0) || chunk.data[2] !== "3".charCodeAt(0))) {
  69670. this.trigger("log", {
  69671. level: "warn",
  69672. message: "Skipping unrecognized metadata packet"
  69673. });
  69674. return;
  69675. }
  69676. buffer.push(chunk);
  69677. bufferSize += chunk.data.byteLength;
  69678. if (buffer.length === 1) {
  69679. tagSize = id3.parseSyncSafeInteger(chunk.data.subarray(6, 10));
  69680. tagSize += 10;
  69681. }
  69682. if (bufferSize < tagSize) {
  69683. return;
  69684. }
  69685. tag = {
  69686. data: new Uint8Array(tagSize),
  69687. frames: [],
  69688. pts: buffer[0].pts,
  69689. dts: buffer[0].dts
  69690. };
  69691. for (i3 = 0; i3 < tagSize; ) {
  69692. tag.data.set(buffer[0].data.subarray(0, tagSize - i3), i3);
  69693. i3 += buffer[0].data.byteLength;
  69694. bufferSize -= buffer[0].data.byteLength;
  69695. buffer.shift();
  69696. }
  69697. frameStart = 10;
  69698. if (tag.data[5] & 64) {
  69699. frameStart += 4;
  69700. frameStart += id3.parseSyncSafeInteger(tag.data.subarray(10, 14));
  69701. tagSize -= id3.parseSyncSafeInteger(tag.data.subarray(16, 20));
  69702. }
  69703. do {
  69704. frameSize = id3.parseSyncSafeInteger(tag.data.subarray(frameStart + 4, frameStart + 8));
  69705. if (frameSize < 1) {
  69706. this.trigger("log", {
  69707. level: "warn",
  69708. message: "Malformed ID3 frame encountered. Skipping remaining metadata parsing."
  69709. });
  69710. break;
  69711. }
  69712. frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]);
  69713. frame = {
  69714. id: frameHeader,
  69715. data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10)
  69716. };
  69717. frame.key = frame.id;
  69718. if (id3.frameParsers[frame.id]) {
  69719. id3.frameParsers[frame.id](frame);
  69720. } else if (frame.id[0] === "T") {
  69721. id3.frameParsers["T*"](frame);
  69722. } else if (frame.id[0] === "W") {
  69723. id3.frameParsers["W*"](frame);
  69724. }
  69725. if (frame.owner === "com.apple.streaming.transportStreamTimestamp") {
  69726. var d2 = frame.data, size = (d2[3] & 1) << 30 | d2[4] << 22 | d2[5] << 14 | d2[6] << 6 | d2[7] >>> 2;
  69727. size *= 4;
  69728. size += d2[7] & 3;
  69729. frame.timeStamp = size;
  69730. if (tag.pts === void 0 && tag.dts === void 0) {
  69731. tag.pts = frame.timeStamp;
  69732. tag.dts = frame.timeStamp;
  69733. }
  69734. this.trigger("timestamp", frame);
  69735. }
  69736. tag.frames.push(frame);
  69737. frameStart += 10;
  69738. frameStart += frameSize;
  69739. } while (frameStart < tagSize);
  69740. this.trigger("data", tag);
  69741. };
  69742. };
  69743. MetadataStream.prototype = new Stream$5();
  69744. var metadataStream = MetadataStream;
  69745. var Stream$4 = stream, CaptionStream$1 = captionStream, StreamTypes$2 = streamTypes, TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream;
  69746. var TransportPacketStream, TransportParseStream, ElementaryStream;
  69747. var MP2T_PACKET_LENGTH$1 = 188, SYNC_BYTE$1 = 71;
  69748. TransportPacketStream = function() {
  69749. var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1), bytesInBuffer = 0;
  69750. TransportPacketStream.prototype.init.call(this);
  69751. this.push = function(bytes) {
  69752. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH$1, everything;
  69753. if (bytesInBuffer) {
  69754. everything = new Uint8Array(bytes.byteLength + bytesInBuffer);
  69755. everything.set(buffer.subarray(0, bytesInBuffer));
  69756. everything.set(bytes, bytesInBuffer);
  69757. bytesInBuffer = 0;
  69758. } else {
  69759. everything = bytes;
  69760. }
  69761. while (endIndex < everything.byteLength) {
  69762. if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) {
  69763. this.trigger("data", everything.subarray(startIndex, endIndex));
  69764. startIndex += MP2T_PACKET_LENGTH$1;
  69765. endIndex += MP2T_PACKET_LENGTH$1;
  69766. continue;
  69767. }
  69768. startIndex++;
  69769. endIndex++;
  69770. }
  69771. if (startIndex < everything.byteLength) {
  69772. buffer.set(everything.subarray(startIndex), 0);
  69773. bytesInBuffer = everything.byteLength - startIndex;
  69774. }
  69775. };
  69776. this.flush = function() {
  69777. if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) {
  69778. this.trigger("data", buffer);
  69779. bytesInBuffer = 0;
  69780. }
  69781. this.trigger("done");
  69782. };
  69783. this.endTimeline = function() {
  69784. this.flush();
  69785. this.trigger("endedtimeline");
  69786. };
  69787. this.reset = function() {
  69788. bytesInBuffer = 0;
  69789. this.trigger("reset");
  69790. };
  69791. };
  69792. TransportPacketStream.prototype = new Stream$4();
  69793. TransportParseStream = function() {
  69794. var parsePsi, parsePat2, parsePmt2, self2;
  69795. TransportParseStream.prototype.init.call(this);
  69796. self2 = this;
  69797. this.packetsWaitingForPmt = [];
  69798. this.programMapTable = void 0;
  69799. parsePsi = function(payload, psi) {
  69800. var offset = 0;
  69801. if (psi.payloadUnitStartIndicator) {
  69802. offset += payload[offset] + 1;
  69803. }
  69804. if (psi.type === "pat") {
  69805. parsePat2(payload.subarray(offset), psi);
  69806. } else {
  69807. parsePmt2(payload.subarray(offset), psi);
  69808. }
  69809. };
  69810. parsePat2 = function(payload, pat) {
  69811. pat.section_number = payload[7];
  69812. pat.last_section_number = payload[8];
  69813. self2.pmtPid = (payload[10] & 31) << 8 | payload[11];
  69814. pat.pmtPid = self2.pmtPid;
  69815. };
  69816. parsePmt2 = function(payload, pmt) {
  69817. var sectionLength, tableEnd, programInfoLength, offset;
  69818. if (!(payload[5] & 1)) {
  69819. return;
  69820. }
  69821. self2.programMapTable = {
  69822. video: null,
  69823. audio: null,
  69824. "timed-metadata": {}
  69825. };
  69826. sectionLength = (payload[1] & 15) << 8 | payload[2];
  69827. tableEnd = 3 + sectionLength - 4;
  69828. programInfoLength = (payload[10] & 15) << 8 | payload[11];
  69829. offset = 12 + programInfoLength;
  69830. while (offset < tableEnd) {
  69831. var streamType = payload[offset];
  69832. var pid = (payload[offset + 1] & 31) << 8 | payload[offset + 2];
  69833. if (streamType === StreamTypes$2.H264_STREAM_TYPE && self2.programMapTable.video === null) {
  69834. self2.programMapTable.video = pid;
  69835. } else if (streamType === StreamTypes$2.ADTS_STREAM_TYPE && self2.programMapTable.audio === null) {
  69836. self2.programMapTable.audio = pid;
  69837. } else if (streamType === StreamTypes$2.METADATA_STREAM_TYPE) {
  69838. self2.programMapTable["timed-metadata"][pid] = streamType;
  69839. }
  69840. offset += ((payload[offset + 3] & 15) << 8 | payload[offset + 4]) + 5;
  69841. }
  69842. pmt.programMapTable = self2.programMapTable;
  69843. };
  69844. this.push = function(packet) {
  69845. var result = {}, offset = 4;
  69846. result.payloadUnitStartIndicator = !!(packet[1] & 64);
  69847. result.pid = packet[1] & 31;
  69848. result.pid <<= 8;
  69849. result.pid |= packet[2];
  69850. if ((packet[3] & 48) >>> 4 > 1) {
  69851. offset += packet[offset] + 1;
  69852. }
  69853. if (result.pid === 0) {
  69854. result.type = "pat";
  69855. parsePsi(packet.subarray(offset), result);
  69856. this.trigger("data", result);
  69857. } else if (result.pid === this.pmtPid) {
  69858. result.type = "pmt";
  69859. parsePsi(packet.subarray(offset), result);
  69860. this.trigger("data", result);
  69861. while (this.packetsWaitingForPmt.length) {
  69862. this.processPes_.apply(this, this.packetsWaitingForPmt.shift());
  69863. }
  69864. } else if (this.programMapTable === void 0) {
  69865. this.packetsWaitingForPmt.push([packet, offset, result]);
  69866. } else {
  69867. this.processPes_(packet, offset, result);
  69868. }
  69869. };
  69870. this.processPes_ = function(packet, offset, result) {
  69871. if (result.pid === this.programMapTable.video) {
  69872. result.streamType = StreamTypes$2.H264_STREAM_TYPE;
  69873. } else if (result.pid === this.programMapTable.audio) {
  69874. result.streamType = StreamTypes$2.ADTS_STREAM_TYPE;
  69875. } else {
  69876. result.streamType = this.programMapTable["timed-metadata"][result.pid];
  69877. }
  69878. result.type = "pes";
  69879. result.data = packet.subarray(offset);
  69880. this.trigger("data", result);
  69881. };
  69882. };
  69883. TransportParseStream.prototype = new Stream$4();
  69884. TransportParseStream.STREAM_TYPES = {
  69885. h264: 27,
  69886. adts: 15
  69887. };
  69888. ElementaryStream = function() {
  69889. var self2 = this, segmentHadPmt = false, video = {
  69890. data: [],
  69891. size: 0
  69892. }, audio = {
  69893. data: [],
  69894. size: 0
  69895. }, timedMetadata = {
  69896. data: [],
  69897. size: 0
  69898. }, programMapTable, parsePes = function(payload, pes) {
  69899. var ptsDtsFlags;
  69900. const startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2];
  69901. pes.data = new Uint8Array();
  69902. if (startPrefix !== 1) {
  69903. return;
  69904. }
  69905. pes.packetLength = 6 + (payload[4] << 8 | payload[5]);
  69906. pes.dataAlignmentIndicator = (payload[6] & 4) !== 0;
  69907. ptsDtsFlags = payload[7];
  69908. if (ptsDtsFlags & 192) {
  69909. pes.pts = (payload[9] & 14) << 27 | (payload[10] & 255) << 20 | (payload[11] & 254) << 12 | (payload[12] & 255) << 5 | (payload[13] & 254) >>> 3;
  69910. pes.pts *= 4;
  69911. pes.pts += (payload[13] & 6) >>> 1;
  69912. pes.dts = pes.pts;
  69913. if (ptsDtsFlags & 64) {
  69914. pes.dts = (payload[14] & 14) << 27 | (payload[15] & 255) << 20 | (payload[16] & 254) << 12 | (payload[17] & 255) << 5 | (payload[18] & 254) >>> 3;
  69915. pes.dts *= 4;
  69916. pes.dts += (payload[18] & 6) >>> 1;
  69917. }
  69918. }
  69919. pes.data = payload.subarray(9 + payload[8]);
  69920. }, flushStream = function(stream2, type3, forceFlush) {
  69921. var packetData = new Uint8Array(stream2.size), event2 = {
  69922. type: type3
  69923. }, i2 = 0, offset = 0, packetFlushable = false, fragment;
  69924. if (!stream2.data.length || stream2.size < 9) {
  69925. return;
  69926. }
  69927. event2.trackId = stream2.data[0].pid;
  69928. for (i2 = 0; i2 < stream2.data.length; i2++) {
  69929. fragment = stream2.data[i2];
  69930. packetData.set(fragment.data, offset);
  69931. offset += fragment.data.byteLength;
  69932. }
  69933. parsePes(packetData, event2);
  69934. packetFlushable = type3 === "video" || event2.packetLength <= stream2.size;
  69935. if (forceFlush || packetFlushable) {
  69936. stream2.size = 0;
  69937. stream2.data.length = 0;
  69938. }
  69939. if (packetFlushable) {
  69940. self2.trigger("data", event2);
  69941. }
  69942. };
  69943. ElementaryStream.prototype.init.call(this);
  69944. this.push = function(data) {
  69945. ({
  69946. pat: function() {
  69947. },
  69948. pes: function() {
  69949. var stream2, streamType;
  69950. switch (data.streamType) {
  69951. case StreamTypes$2.H264_STREAM_TYPE:
  69952. stream2 = video;
  69953. streamType = "video";
  69954. break;
  69955. case StreamTypes$2.ADTS_STREAM_TYPE:
  69956. stream2 = audio;
  69957. streamType = "audio";
  69958. break;
  69959. case StreamTypes$2.METADATA_STREAM_TYPE:
  69960. stream2 = timedMetadata;
  69961. streamType = "timed-metadata";
  69962. break;
  69963. default:
  69964. return;
  69965. }
  69966. if (data.payloadUnitStartIndicator) {
  69967. flushStream(stream2, streamType, true);
  69968. }
  69969. stream2.data.push(data);
  69970. stream2.size += data.data.byteLength;
  69971. },
  69972. pmt: function() {
  69973. var event2 = {
  69974. type: "metadata",
  69975. tracks: []
  69976. };
  69977. programMapTable = data.programMapTable;
  69978. if (programMapTable.video !== null) {
  69979. event2.tracks.push({
  69980. timelineStartInfo: {
  69981. baseMediaDecodeTime: 0
  69982. },
  69983. id: +programMapTable.video,
  69984. codec: "avc",
  69985. type: "video"
  69986. });
  69987. }
  69988. if (programMapTable.audio !== null) {
  69989. event2.tracks.push({
  69990. timelineStartInfo: {
  69991. baseMediaDecodeTime: 0
  69992. },
  69993. id: +programMapTable.audio,
  69994. codec: "adts",
  69995. type: "audio"
  69996. });
  69997. }
  69998. segmentHadPmt = true;
  69999. self2.trigger("data", event2);
  70000. }
  70001. })[data.type]();
  70002. };
  70003. this.reset = function() {
  70004. video.size = 0;
  70005. video.data.length = 0;
  70006. audio.size = 0;
  70007. audio.data.length = 0;
  70008. this.trigger("reset");
  70009. };
  70010. this.flushStreams_ = function() {
  70011. flushStream(video, "video");
  70012. flushStream(audio, "audio");
  70013. flushStream(timedMetadata, "timed-metadata");
  70014. };
  70015. this.flush = function() {
  70016. if (!segmentHadPmt && programMapTable) {
  70017. var pmt = {
  70018. type: "metadata",
  70019. tracks: []
  70020. };
  70021. if (programMapTable.video !== null) {
  70022. pmt.tracks.push({
  70023. timelineStartInfo: {
  70024. baseMediaDecodeTime: 0
  70025. },
  70026. id: +programMapTable.video,
  70027. codec: "avc",
  70028. type: "video"
  70029. });
  70030. }
  70031. if (programMapTable.audio !== null) {
  70032. pmt.tracks.push({
  70033. timelineStartInfo: {
  70034. baseMediaDecodeTime: 0
  70035. },
  70036. id: +programMapTable.audio,
  70037. codec: "adts",
  70038. type: "audio"
  70039. });
  70040. }
  70041. self2.trigger("data", pmt);
  70042. }
  70043. segmentHadPmt = false;
  70044. this.flushStreams_();
  70045. this.trigger("done");
  70046. };
  70047. };
  70048. ElementaryStream.prototype = new Stream$4();
  70049. var m2ts$1 = {
  70050. PAT_PID: 0,
  70051. MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1,
  70052. TransportPacketStream,
  70053. TransportParseStream,
  70054. ElementaryStream,
  70055. TimestampRolloverStream,
  70056. CaptionStream: CaptionStream$1.CaptionStream,
  70057. Cea608Stream: CaptionStream$1.Cea608Stream,
  70058. Cea708Stream: CaptionStream$1.Cea708Stream,
  70059. MetadataStream: metadataStream
  70060. };
  70061. for (var type2 in StreamTypes$2) {
  70062. if (StreamTypes$2.hasOwnProperty(type2)) {
  70063. m2ts$1[type2] = StreamTypes$2[type2];
  70064. }
  70065. }
  70066. var m2ts_1 = m2ts$1;
  70067. var Stream$3 = stream;
  70068. var ONE_SECOND_IN_TS$2 = clock$2.ONE_SECOND_IN_TS;
  70069. var AdtsStream$1;
  70070. var ADTS_SAMPLING_FREQUENCIES$1 = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  70071. AdtsStream$1 = function(handlePartialSegments) {
  70072. var buffer, frameNum = 0;
  70073. AdtsStream$1.prototype.init.call(this);
  70074. this.skipWarn_ = function(start2, end) {
  70075. this.trigger("log", {
  70076. level: "warn",
  70077. message: `adts skiping bytes ${start2} to ${end} in frame ${frameNum} outside syncword`
  70078. });
  70079. };
  70080. this.push = function(packet) {
  70081. var i2 = 0, frameLength, protectionSkipBytes, oldBuffer, sampleCount, adtsFrameDuration;
  70082. if (!handlePartialSegments) {
  70083. frameNum = 0;
  70084. }
  70085. if (packet.type !== "audio") {
  70086. return;
  70087. }
  70088. if (buffer && buffer.length) {
  70089. oldBuffer = buffer;
  70090. buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength);
  70091. buffer.set(oldBuffer);
  70092. buffer.set(packet.data, oldBuffer.byteLength);
  70093. } else {
  70094. buffer = packet.data;
  70095. }
  70096. var skip;
  70097. while (i2 + 7 < buffer.length) {
  70098. if (buffer[i2] !== 255 || (buffer[i2 + 1] & 246) !== 240) {
  70099. if (typeof skip !== "number") {
  70100. skip = i2;
  70101. }
  70102. i2++;
  70103. continue;
  70104. }
  70105. if (typeof skip === "number") {
  70106. this.skipWarn_(skip, i2);
  70107. skip = null;
  70108. }
  70109. protectionSkipBytes = (~buffer[i2 + 1] & 1) * 2;
  70110. frameLength = (buffer[i2 + 3] & 3) << 11 | buffer[i2 + 4] << 3 | (buffer[i2 + 5] & 224) >> 5;
  70111. sampleCount = ((buffer[i2 + 6] & 3) + 1) * 1024;
  70112. adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i2 + 2] & 60) >>> 2];
  70113. if (buffer.byteLength - i2 < frameLength) {
  70114. break;
  70115. }
  70116. this.trigger("data", {
  70117. pts: packet.pts + frameNum * adtsFrameDuration,
  70118. dts: packet.dts + frameNum * adtsFrameDuration,
  70119. sampleCount,
  70120. audioobjecttype: (buffer[i2 + 2] >>> 6 & 3) + 1,
  70121. channelcount: (buffer[i2 + 2] & 1) << 2 | (buffer[i2 + 3] & 192) >>> 6,
  70122. samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i2 + 2] & 60) >>> 2],
  70123. samplingfrequencyindex: (buffer[i2 + 2] & 60) >>> 2,
  70124. samplesize: 16,
  70125. data: buffer.subarray(i2 + 7 + protectionSkipBytes, i2 + frameLength)
  70126. });
  70127. frameNum++;
  70128. i2 += frameLength;
  70129. }
  70130. if (typeof skip === "number") {
  70131. this.skipWarn_(skip, i2);
  70132. skip = null;
  70133. }
  70134. buffer = buffer.subarray(i2);
  70135. };
  70136. this.flush = function() {
  70137. frameNum = 0;
  70138. this.trigger("done");
  70139. };
  70140. this.reset = function() {
  70141. buffer = void 0;
  70142. this.trigger("reset");
  70143. };
  70144. this.endTimeline = function() {
  70145. buffer = void 0;
  70146. this.trigger("endedtimeline");
  70147. };
  70148. };
  70149. AdtsStream$1.prototype = new Stream$3();
  70150. var adts = AdtsStream$1;
  70151. var ExpGolomb$1;
  70152. ExpGolomb$1 = function(workingData) {
  70153. var workingBytesAvailable = workingData.byteLength, workingWord = 0, workingBitsAvailable = 0;
  70154. this.length = function() {
  70155. return 8 * workingBytesAvailable;
  70156. };
  70157. this.bitsAvailable = function() {
  70158. return 8 * workingBytesAvailable + workingBitsAvailable;
  70159. };
  70160. this.loadWord = function() {
  70161. var position2 = workingData.byteLength - workingBytesAvailable, workingBytes = new Uint8Array(4), availableBytes = Math.min(4, workingBytesAvailable);
  70162. if (availableBytes === 0) {
  70163. throw new Error("no bytes available");
  70164. }
  70165. workingBytes.set(workingData.subarray(position2, position2 + availableBytes));
  70166. workingWord = new DataView(workingBytes.buffer).getUint32(0);
  70167. workingBitsAvailable = availableBytes * 8;
  70168. workingBytesAvailable -= availableBytes;
  70169. };
  70170. this.skipBits = function(count) {
  70171. var skipBytes;
  70172. if (workingBitsAvailable > count) {
  70173. workingWord <<= count;
  70174. workingBitsAvailable -= count;
  70175. } else {
  70176. count -= workingBitsAvailable;
  70177. skipBytes = Math.floor(count / 8);
  70178. count -= skipBytes * 8;
  70179. workingBytesAvailable -= skipBytes;
  70180. this.loadWord();
  70181. workingWord <<= count;
  70182. workingBitsAvailable -= count;
  70183. }
  70184. };
  70185. this.readBits = function(size) {
  70186. var bits = Math.min(workingBitsAvailable, size), valu = workingWord >>> 32 - bits;
  70187. workingBitsAvailable -= bits;
  70188. if (workingBitsAvailable > 0) {
  70189. workingWord <<= bits;
  70190. } else if (workingBytesAvailable > 0) {
  70191. this.loadWord();
  70192. }
  70193. bits = size - bits;
  70194. if (bits > 0) {
  70195. return valu << bits | this.readBits(bits);
  70196. }
  70197. return valu;
  70198. };
  70199. this.skipLeadingZeros = function() {
  70200. var leadingZeroCount;
  70201. for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) {
  70202. if ((workingWord & 2147483648 >>> leadingZeroCount) !== 0) {
  70203. workingWord <<= leadingZeroCount;
  70204. workingBitsAvailable -= leadingZeroCount;
  70205. return leadingZeroCount;
  70206. }
  70207. }
  70208. this.loadWord();
  70209. return leadingZeroCount + this.skipLeadingZeros();
  70210. };
  70211. this.skipUnsignedExpGolomb = function() {
  70212. this.skipBits(1 + this.skipLeadingZeros());
  70213. };
  70214. this.skipExpGolomb = function() {
  70215. this.skipBits(1 + this.skipLeadingZeros());
  70216. };
  70217. this.readUnsignedExpGolomb = function() {
  70218. var clz = this.skipLeadingZeros();
  70219. return this.readBits(clz + 1) - 1;
  70220. };
  70221. this.readExpGolomb = function() {
  70222. var valu = this.readUnsignedExpGolomb();
  70223. if (1 & valu) {
  70224. return 1 + valu >>> 1;
  70225. }
  70226. return -1 * (valu >>> 1);
  70227. };
  70228. this.readBoolean = function() {
  70229. return this.readBits(1) === 1;
  70230. };
  70231. this.readUnsignedByte = function() {
  70232. return this.readBits(8);
  70233. };
  70234. this.loadWord();
  70235. };
  70236. var expGolomb = ExpGolomb$1;
  70237. var Stream$2 = stream;
  70238. var ExpGolomb = expGolomb;
  70239. var H264Stream$1, NalByteStream;
  70240. var PROFILES_WITH_OPTIONAL_SPS_DATA;
  70241. NalByteStream = function() {
  70242. var syncPoint = 0, i2, buffer;
  70243. NalByteStream.prototype.init.call(this);
  70244. this.push = function(data) {
  70245. var swapBuffer;
  70246. if (!buffer) {
  70247. buffer = data.data;
  70248. } else {
  70249. swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength);
  70250. swapBuffer.set(buffer);
  70251. swapBuffer.set(data.data, buffer.byteLength);
  70252. buffer = swapBuffer;
  70253. }
  70254. var len = buffer.byteLength;
  70255. for (; syncPoint < len - 3; syncPoint++) {
  70256. if (buffer[syncPoint + 2] === 1) {
  70257. i2 = syncPoint + 5;
  70258. break;
  70259. }
  70260. }
  70261. while (i2 < len) {
  70262. switch (buffer[i2]) {
  70263. case 0:
  70264. if (buffer[i2 - 1] !== 0) {
  70265. i2 += 2;
  70266. break;
  70267. } else if (buffer[i2 - 2] !== 0) {
  70268. i2++;
  70269. break;
  70270. }
  70271. if (syncPoint + 3 !== i2 - 2) {
  70272. this.trigger("data", buffer.subarray(syncPoint + 3, i2 - 2));
  70273. }
  70274. do {
  70275. i2++;
  70276. } while (buffer[i2] !== 1 && i2 < len);
  70277. syncPoint = i2 - 2;
  70278. i2 += 3;
  70279. break;
  70280. case 1:
  70281. if (buffer[i2 - 1] !== 0 || buffer[i2 - 2] !== 0) {
  70282. i2 += 3;
  70283. break;
  70284. }
  70285. this.trigger("data", buffer.subarray(syncPoint + 3, i2 - 2));
  70286. syncPoint = i2 - 2;
  70287. i2 += 3;
  70288. break;
  70289. default:
  70290. i2 += 3;
  70291. break;
  70292. }
  70293. }
  70294. buffer = buffer.subarray(syncPoint);
  70295. i2 -= syncPoint;
  70296. syncPoint = 0;
  70297. };
  70298. this.reset = function() {
  70299. buffer = null;
  70300. syncPoint = 0;
  70301. this.trigger("reset");
  70302. };
  70303. this.flush = function() {
  70304. if (buffer && buffer.byteLength > 3) {
  70305. this.trigger("data", buffer.subarray(syncPoint + 3));
  70306. }
  70307. buffer = null;
  70308. syncPoint = 0;
  70309. this.trigger("done");
  70310. };
  70311. this.endTimeline = function() {
  70312. this.flush();
  70313. this.trigger("endedtimeline");
  70314. };
  70315. };
  70316. NalByteStream.prototype = new Stream$2();
  70317. PROFILES_WITH_OPTIONAL_SPS_DATA = {
  70318. 100: true,
  70319. 110: true,
  70320. 122: true,
  70321. 244: true,
  70322. 44: true,
  70323. 83: true,
  70324. 86: true,
  70325. 118: true,
  70326. 128: true,
  70327. 138: true,
  70328. 139: true,
  70329. 134: true
  70330. };
  70331. H264Stream$1 = function() {
  70332. var nalByteStream = new NalByteStream(), self2, trackId, currentPts, currentDts, discardEmulationPreventionBytes5, readSequenceParameterSet, skipScalingList;
  70333. H264Stream$1.prototype.init.call(this);
  70334. self2 = this;
  70335. this.push = function(packet) {
  70336. if (packet.type !== "video") {
  70337. return;
  70338. }
  70339. trackId = packet.trackId;
  70340. currentPts = packet.pts;
  70341. currentDts = packet.dts;
  70342. nalByteStream.push(packet);
  70343. };
  70344. nalByteStream.on("data", function(data) {
  70345. var event2 = {
  70346. trackId,
  70347. pts: currentPts,
  70348. dts: currentDts,
  70349. data,
  70350. nalUnitTypeCode: data[0] & 31
  70351. };
  70352. switch (event2.nalUnitTypeCode) {
  70353. case 5:
  70354. event2.nalUnitType = "slice_layer_without_partitioning_rbsp_idr";
  70355. break;
  70356. case 6:
  70357. event2.nalUnitType = "sei_rbsp";
  70358. event2.escapedRBSP = discardEmulationPreventionBytes5(data.subarray(1));
  70359. break;
  70360. case 7:
  70361. event2.nalUnitType = "seq_parameter_set_rbsp";
  70362. event2.escapedRBSP = discardEmulationPreventionBytes5(data.subarray(1));
  70363. event2.config = readSequenceParameterSet(event2.escapedRBSP);
  70364. break;
  70365. case 8:
  70366. event2.nalUnitType = "pic_parameter_set_rbsp";
  70367. break;
  70368. case 9:
  70369. event2.nalUnitType = "access_unit_delimiter_rbsp";
  70370. break;
  70371. }
  70372. self2.trigger("data", event2);
  70373. });
  70374. nalByteStream.on("done", function() {
  70375. self2.trigger("done");
  70376. });
  70377. nalByteStream.on("partialdone", function() {
  70378. self2.trigger("partialdone");
  70379. });
  70380. nalByteStream.on("reset", function() {
  70381. self2.trigger("reset");
  70382. });
  70383. nalByteStream.on("endedtimeline", function() {
  70384. self2.trigger("endedtimeline");
  70385. });
  70386. this.flush = function() {
  70387. nalByteStream.flush();
  70388. };
  70389. this.partialFlush = function() {
  70390. nalByteStream.partialFlush();
  70391. };
  70392. this.reset = function() {
  70393. nalByteStream.reset();
  70394. };
  70395. this.endTimeline = function() {
  70396. nalByteStream.endTimeline();
  70397. };
  70398. skipScalingList = function(count, expGolombDecoder) {
  70399. var lastScale = 8, nextScale = 8, j, deltaScale;
  70400. for (j = 0; j < count; j++) {
  70401. if (nextScale !== 0) {
  70402. deltaScale = expGolombDecoder.readExpGolomb();
  70403. nextScale = (lastScale + deltaScale + 256) % 256;
  70404. }
  70405. lastScale = nextScale === 0 ? lastScale : nextScale;
  70406. }
  70407. };
  70408. discardEmulationPreventionBytes5 = function(data) {
  70409. var length = data.byteLength, emulationPreventionBytesPositions = [], i2 = 1, newLength, newData;
  70410. while (i2 < length - 2) {
  70411. if (data[i2] === 0 && data[i2 + 1] === 0 && data[i2 + 2] === 3) {
  70412. emulationPreventionBytesPositions.push(i2 + 2);
  70413. i2 += 2;
  70414. } else {
  70415. i2++;
  70416. }
  70417. }
  70418. if (emulationPreventionBytesPositions.length === 0) {
  70419. return data;
  70420. }
  70421. newLength = length - emulationPreventionBytesPositions.length;
  70422. newData = new Uint8Array(newLength);
  70423. var sourceIndex = 0;
  70424. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  70425. if (sourceIndex === emulationPreventionBytesPositions[0]) {
  70426. sourceIndex++;
  70427. emulationPreventionBytesPositions.shift();
  70428. }
  70429. newData[i2] = data[sourceIndex];
  70430. }
  70431. return newData;
  70432. };
  70433. readSequenceParameterSet = function(data) {
  70434. var frameCropLeftOffset = 0, frameCropRightOffset = 0, frameCropTopOffset = 0, frameCropBottomOffset = 0, expGolombDecoder, profileIdc, levelIdc, profileCompatibility, chromaFormatIdc, picOrderCntType, numRefFramesInPicOrderCntCycle, picWidthInMbsMinus1, picHeightInMapUnitsMinus1, frameMbsOnlyFlag, scalingListCount, sarRatio = [1, 1], aspectRatioIdc, i2;
  70435. expGolombDecoder = new ExpGolomb(data);
  70436. profileIdc = expGolombDecoder.readUnsignedByte();
  70437. profileCompatibility = expGolombDecoder.readUnsignedByte();
  70438. levelIdc = expGolombDecoder.readUnsignedByte();
  70439. expGolombDecoder.skipUnsignedExpGolomb();
  70440. if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) {
  70441. chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb();
  70442. if (chromaFormatIdc === 3) {
  70443. expGolombDecoder.skipBits(1);
  70444. }
  70445. expGolombDecoder.skipUnsignedExpGolomb();
  70446. expGolombDecoder.skipUnsignedExpGolomb();
  70447. expGolombDecoder.skipBits(1);
  70448. if (expGolombDecoder.readBoolean()) {
  70449. scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;
  70450. for (i2 = 0; i2 < scalingListCount; i2++) {
  70451. if (expGolombDecoder.readBoolean()) {
  70452. if (i2 < 6) {
  70453. skipScalingList(16, expGolombDecoder);
  70454. } else {
  70455. skipScalingList(64, expGolombDecoder);
  70456. }
  70457. }
  70458. }
  70459. }
  70460. }
  70461. expGolombDecoder.skipUnsignedExpGolomb();
  70462. picOrderCntType = expGolombDecoder.readUnsignedExpGolomb();
  70463. if (picOrderCntType === 0) {
  70464. expGolombDecoder.readUnsignedExpGolomb();
  70465. } else if (picOrderCntType === 1) {
  70466. expGolombDecoder.skipBits(1);
  70467. expGolombDecoder.skipExpGolomb();
  70468. expGolombDecoder.skipExpGolomb();
  70469. numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb();
  70470. for (i2 = 0; i2 < numRefFramesInPicOrderCntCycle; i2++) {
  70471. expGolombDecoder.skipExpGolomb();
  70472. }
  70473. }
  70474. expGolombDecoder.skipUnsignedExpGolomb();
  70475. expGolombDecoder.skipBits(1);
  70476. picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb();
  70477. picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb();
  70478. frameMbsOnlyFlag = expGolombDecoder.readBits(1);
  70479. if (frameMbsOnlyFlag === 0) {
  70480. expGolombDecoder.skipBits(1);
  70481. }
  70482. expGolombDecoder.skipBits(1);
  70483. if (expGolombDecoder.readBoolean()) {
  70484. frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb();
  70485. frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb();
  70486. frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb();
  70487. frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb();
  70488. }
  70489. if (expGolombDecoder.readBoolean()) {
  70490. if (expGolombDecoder.readBoolean()) {
  70491. aspectRatioIdc = expGolombDecoder.readUnsignedByte();
  70492. switch (aspectRatioIdc) {
  70493. case 1:
  70494. sarRatio = [1, 1];
  70495. break;
  70496. case 2:
  70497. sarRatio = [12, 11];
  70498. break;
  70499. case 3:
  70500. sarRatio = [10, 11];
  70501. break;
  70502. case 4:
  70503. sarRatio = [16, 11];
  70504. break;
  70505. case 5:
  70506. sarRatio = [40, 33];
  70507. break;
  70508. case 6:
  70509. sarRatio = [24, 11];
  70510. break;
  70511. case 7:
  70512. sarRatio = [20, 11];
  70513. break;
  70514. case 8:
  70515. sarRatio = [32, 11];
  70516. break;
  70517. case 9:
  70518. sarRatio = [80, 33];
  70519. break;
  70520. case 10:
  70521. sarRatio = [18, 11];
  70522. break;
  70523. case 11:
  70524. sarRatio = [15, 11];
  70525. break;
  70526. case 12:
  70527. sarRatio = [64, 33];
  70528. break;
  70529. case 13:
  70530. sarRatio = [160, 99];
  70531. break;
  70532. case 14:
  70533. sarRatio = [4, 3];
  70534. break;
  70535. case 15:
  70536. sarRatio = [3, 2];
  70537. break;
  70538. case 16:
  70539. sarRatio = [2, 1];
  70540. break;
  70541. case 255: {
  70542. sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()];
  70543. break;
  70544. }
  70545. }
  70546. if (sarRatio) {
  70547. sarRatio[0] / sarRatio[1];
  70548. }
  70549. }
  70550. }
  70551. return {
  70552. profileIdc,
  70553. levelIdc,
  70554. profileCompatibility,
  70555. width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2,
  70556. height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2,
  70557. sarRatio
  70558. };
  70559. };
  70560. };
  70561. H264Stream$1.prototype = new Stream$2();
  70562. var h2643 = {
  70563. H264Stream: H264Stream$1,
  70564. NalByteStream
  70565. };
  70566. var ADTS_SAMPLING_FREQUENCIES = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  70567. var parseId3TagSize = function(header, byteIndex) {
  70568. var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], flags = header[byteIndex + 5], footerPresent = (flags & 16) >> 4;
  70569. returnSize = returnSize >= 0 ? returnSize : 0;
  70570. if (footerPresent) {
  70571. return returnSize + 20;
  70572. }
  70573. return returnSize + 10;
  70574. };
  70575. var getId3Offset4 = function(data, offset) {
  70576. if (data.length - offset < 10 || data[offset] !== "I".charCodeAt(0) || data[offset + 1] !== "D".charCodeAt(0) || data[offset + 2] !== "3".charCodeAt(0)) {
  70577. return offset;
  70578. }
  70579. offset += parseId3TagSize(data, offset);
  70580. return getId3Offset4(data, offset);
  70581. };
  70582. var isLikelyAacData$1 = function(data) {
  70583. var offset = getId3Offset4(data, 0);
  70584. return data.length >= offset + 2 && (data[offset] & 255) === 255 && (data[offset + 1] & 240) === 240 && (data[offset + 1] & 22) === 16;
  70585. };
  70586. var parseSyncSafeInteger = function(data) {
  70587. return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];
  70588. };
  70589. var percentEncode = function(bytes, start2, end) {
  70590. var i2, result = "";
  70591. for (i2 = start2; i2 < end; i2++) {
  70592. result += "%" + ("00" + bytes[i2].toString(16)).slice(-2);
  70593. }
  70594. return result;
  70595. };
  70596. var parseIso88591 = function(bytes, start2, end) {
  70597. return unescape(percentEncode(bytes, start2, end));
  70598. };
  70599. var parseAdtsSize = function(header, byteIndex) {
  70600. var lowThree = (header[byteIndex + 5] & 224) >> 5, middle = header[byteIndex + 4] << 3, highTwo = header[byteIndex + 3] & 3 << 11;
  70601. return highTwo | middle | lowThree;
  70602. };
  70603. var parseType$4 = function(header, byteIndex) {
  70604. if (header[byteIndex] === "I".charCodeAt(0) && header[byteIndex + 1] === "D".charCodeAt(0) && header[byteIndex + 2] === "3".charCodeAt(0)) {
  70605. return "timed-metadata";
  70606. } else if (header[byteIndex] & true && (header[byteIndex + 1] & 240) === 240) {
  70607. return "audio";
  70608. }
  70609. return null;
  70610. };
  70611. var parseSampleRate = function(packet) {
  70612. var i2 = 0;
  70613. while (i2 + 5 < packet.length) {
  70614. if (packet[i2] !== 255 || (packet[i2 + 1] & 246) !== 240) {
  70615. i2++;
  70616. continue;
  70617. }
  70618. return ADTS_SAMPLING_FREQUENCIES[(packet[i2 + 2] & 60) >>> 2];
  70619. }
  70620. return null;
  70621. };
  70622. var parseAacTimestamp = function(packet) {
  70623. var frameStart, frameSize, frame, frameHeader;
  70624. frameStart = 10;
  70625. if (packet[5] & 64) {
  70626. frameStart += 4;
  70627. frameStart += parseSyncSafeInteger(packet.subarray(10, 14));
  70628. }
  70629. do {
  70630. frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8));
  70631. if (frameSize < 1) {
  70632. return null;
  70633. }
  70634. frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]);
  70635. if (frameHeader === "PRIV") {
  70636. frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10);
  70637. for (var i2 = 0; i2 < frame.byteLength; i2++) {
  70638. if (frame[i2] === 0) {
  70639. var owner = parseIso88591(frame, 0, i2);
  70640. if (owner === "com.apple.streaming.transportStreamTimestamp") {
  70641. var d2 = frame.subarray(i2 + 1);
  70642. var size = (d2[3] & 1) << 30 | d2[4] << 22 | d2[5] << 14 | d2[6] << 6 | d2[7] >>> 2;
  70643. size *= 4;
  70644. size += d2[7] & 3;
  70645. return size;
  70646. }
  70647. break;
  70648. }
  70649. }
  70650. }
  70651. frameStart += 10;
  70652. frameStart += frameSize;
  70653. } while (frameStart < packet.byteLength);
  70654. return null;
  70655. };
  70656. var utils2 = {
  70657. isLikelyAacData: isLikelyAacData$1,
  70658. parseId3TagSize,
  70659. parseAdtsSize,
  70660. parseType: parseType$4,
  70661. parseSampleRate,
  70662. parseAacTimestamp
  70663. };
  70664. var Stream$12 = stream;
  70665. var aacUtils = utils2;
  70666. var AacStream$1;
  70667. AacStream$1 = function() {
  70668. var everything = new Uint8Array(), timeStamp = 0;
  70669. AacStream$1.prototype.init.call(this);
  70670. this.setTimestamp = function(timestamp) {
  70671. timeStamp = timestamp;
  70672. };
  70673. this.push = function(bytes) {
  70674. var frameSize = 0, byteIndex = 0, bytesLeft, chunk, packet, tempLength;
  70675. if (everything.length) {
  70676. tempLength = everything.length;
  70677. everything = new Uint8Array(bytes.byteLength + tempLength);
  70678. everything.set(everything.subarray(0, tempLength));
  70679. everything.set(bytes, tempLength);
  70680. } else {
  70681. everything = bytes;
  70682. }
  70683. while (everything.length - byteIndex >= 3) {
  70684. if (everything[byteIndex] === "I".charCodeAt(0) && everything[byteIndex + 1] === "D".charCodeAt(0) && everything[byteIndex + 2] === "3".charCodeAt(0)) {
  70685. if (everything.length - byteIndex < 10) {
  70686. break;
  70687. }
  70688. frameSize = aacUtils.parseId3TagSize(everything, byteIndex);
  70689. if (byteIndex + frameSize > everything.length) {
  70690. break;
  70691. }
  70692. chunk = {
  70693. type: "timed-metadata",
  70694. data: everything.subarray(byteIndex, byteIndex + frameSize)
  70695. };
  70696. this.trigger("data", chunk);
  70697. byteIndex += frameSize;
  70698. continue;
  70699. } else if ((everything[byteIndex] & 255) === 255 && (everything[byteIndex + 1] & 240) === 240) {
  70700. if (everything.length - byteIndex < 7) {
  70701. break;
  70702. }
  70703. frameSize = aacUtils.parseAdtsSize(everything, byteIndex);
  70704. if (byteIndex + frameSize > everything.length) {
  70705. break;
  70706. }
  70707. packet = {
  70708. type: "audio",
  70709. data: everything.subarray(byteIndex, byteIndex + frameSize),
  70710. pts: timeStamp,
  70711. dts: timeStamp
  70712. };
  70713. this.trigger("data", packet);
  70714. byteIndex += frameSize;
  70715. continue;
  70716. }
  70717. byteIndex++;
  70718. }
  70719. bytesLeft = everything.length - byteIndex;
  70720. if (bytesLeft > 0) {
  70721. everything = everything.subarray(byteIndex);
  70722. } else {
  70723. everything = new Uint8Array();
  70724. }
  70725. };
  70726. this.reset = function() {
  70727. everything = new Uint8Array();
  70728. this.trigger("reset");
  70729. };
  70730. this.endTimeline = function() {
  70731. everything = new Uint8Array();
  70732. this.trigger("endedtimeline");
  70733. };
  70734. };
  70735. AacStream$1.prototype = new Stream$12();
  70736. var aac3 = AacStream$1;
  70737. var AUDIO_PROPERTIES$1 = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"];
  70738. var audioProperties = AUDIO_PROPERTIES$1;
  70739. var VIDEO_PROPERTIES$1 = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility", "sarRatio"];
  70740. var videoProperties = VIDEO_PROPERTIES$1;
  70741. var Stream2 = stream;
  70742. var mp43 = mp4Generator;
  70743. var frameUtils = frameUtils$1;
  70744. var audioFrameUtils = audioFrameUtils$1;
  70745. var trackDecodeInfo = trackDecodeInfo$1;
  70746. var m2ts = m2ts_1;
  70747. var clock2 = clock$2;
  70748. var AdtsStream = adts;
  70749. var H264Stream = h2643.H264Stream;
  70750. var AacStream = aac3;
  70751. var isLikelyAacData = utils2.isLikelyAacData;
  70752. var ONE_SECOND_IN_TS$12 = clock$2.ONE_SECOND_IN_TS;
  70753. var AUDIO_PROPERTIES = audioProperties;
  70754. var VIDEO_PROPERTIES = videoProperties;
  70755. var VideoSegmentStream, AudioSegmentStream, Transmuxer, CoalesceStream;
  70756. var retriggerForStream = function(key, event2) {
  70757. event2.stream = key;
  70758. this.trigger("log", event2);
  70759. };
  70760. var addPipelineLogRetriggers = function(transmuxer2, pipeline) {
  70761. var keys3 = Object.keys(pipeline);
  70762. for (var i2 = 0; i2 < keys3.length; i2++) {
  70763. var key = keys3[i2];
  70764. if (key === "headOfPipeline" || !pipeline[key].on) {
  70765. continue;
  70766. }
  70767. pipeline[key].on("log", retriggerForStream.bind(transmuxer2, key));
  70768. }
  70769. };
  70770. var arrayEquals = function(a, b) {
  70771. var i2;
  70772. if (a.length !== b.length) {
  70773. return false;
  70774. }
  70775. for (i2 = 0; i2 < a.length; i2++) {
  70776. if (a[i2] !== b[i2]) {
  70777. return false;
  70778. }
  70779. }
  70780. return true;
  70781. };
  70782. var generateSegmentTimingInfo = function(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) {
  70783. var ptsOffsetFromDts = startPts - startDts, decodeDuration = endDts - startDts, presentationDuration = endPts - startPts;
  70784. return {
  70785. start: {
  70786. dts: baseMediaDecodeTime,
  70787. pts: baseMediaDecodeTime + ptsOffsetFromDts
  70788. },
  70789. end: {
  70790. dts: baseMediaDecodeTime + decodeDuration,
  70791. pts: baseMediaDecodeTime + presentationDuration
  70792. },
  70793. prependedContentDuration,
  70794. baseMediaDecodeTime
  70795. };
  70796. };
  70797. AudioSegmentStream = function(track, options2) {
  70798. var adtsFrames = [], sequenceNumber, earliestAllowedDts = 0, audioAppendStartTs = 0, videoBaseMediaDecodeTime = Infinity;
  70799. options2 = options2 || {};
  70800. sequenceNumber = options2.firstSequenceNumber || 0;
  70801. AudioSegmentStream.prototype.init.call(this);
  70802. this.push = function(data) {
  70803. trackDecodeInfo.collectDtsInfo(track, data);
  70804. if (track) {
  70805. AUDIO_PROPERTIES.forEach(function(prop) {
  70806. track[prop] = data[prop];
  70807. });
  70808. }
  70809. adtsFrames.push(data);
  70810. };
  70811. this.setEarliestDts = function(earliestDts) {
  70812. earliestAllowedDts = earliestDts;
  70813. };
  70814. this.setVideoBaseMediaDecodeTime = function(baseMediaDecodeTime) {
  70815. videoBaseMediaDecodeTime = baseMediaDecodeTime;
  70816. };
  70817. this.setAudioAppendStart = function(timestamp) {
  70818. audioAppendStartTs = timestamp;
  70819. };
  70820. this.flush = function() {
  70821. var frames, moof2, mdat2, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed;
  70822. if (adtsFrames.length === 0) {
  70823. this.trigger("done", "AudioSegmentStream");
  70824. return;
  70825. }
  70826. frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts);
  70827. track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options2.keepOriginalTimestamps);
  70828. videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime);
  70829. track.samples = audioFrameUtils.generateSampleTable(frames);
  70830. mdat2 = mp43.mdat(audioFrameUtils.concatenateFrameData(frames));
  70831. adtsFrames = [];
  70832. moof2 = mp43.moof(sequenceNumber, [track]);
  70833. boxes = new Uint8Array(moof2.byteLength + mdat2.byteLength);
  70834. sequenceNumber++;
  70835. boxes.set(moof2);
  70836. boxes.set(mdat2, moof2.byteLength);
  70837. trackDecodeInfo.clearDtsInfo(track);
  70838. frameDuration = Math.ceil(ONE_SECOND_IN_TS$12 * 1024 / track.samplerate);
  70839. if (frames.length) {
  70840. segmentDuration = frames.length * frameDuration;
  70841. this.trigger("segmentTimingInfo", generateSegmentTimingInfo(
  70842. clock2.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate),
  70843. frames[0].dts,
  70844. frames[0].pts,
  70845. frames[0].dts + segmentDuration,
  70846. frames[0].pts + segmentDuration,
  70847. videoClockCyclesOfSilencePrefixed || 0
  70848. ));
  70849. this.trigger("timingInfo", {
  70850. start: frames[0].pts,
  70851. end: frames[0].pts + segmentDuration
  70852. });
  70853. }
  70854. this.trigger("data", {
  70855. track,
  70856. boxes
  70857. });
  70858. this.trigger("done", "AudioSegmentStream");
  70859. };
  70860. this.reset = function() {
  70861. trackDecodeInfo.clearDtsInfo(track);
  70862. adtsFrames = [];
  70863. this.trigger("reset");
  70864. };
  70865. };
  70866. AudioSegmentStream.prototype = new Stream2();
  70867. VideoSegmentStream = function(track, options2) {
  70868. var sequenceNumber, nalUnits = [], gopsToAlignWith = [], config, pps;
  70869. options2 = options2 || {};
  70870. sequenceNumber = options2.firstSequenceNumber || 0;
  70871. VideoSegmentStream.prototype.init.call(this);
  70872. delete track.minPTS;
  70873. this.gopCache_ = [];
  70874. this.push = function(nalUnit) {
  70875. trackDecodeInfo.collectDtsInfo(track, nalUnit);
  70876. if (nalUnit.nalUnitType === "seq_parameter_set_rbsp" && !config) {
  70877. config = nalUnit.config;
  70878. track.sps = [nalUnit.data];
  70879. VIDEO_PROPERTIES.forEach(function(prop) {
  70880. track[prop] = config[prop];
  70881. }, this);
  70882. }
  70883. if (nalUnit.nalUnitType === "pic_parameter_set_rbsp" && !pps) {
  70884. pps = nalUnit.data;
  70885. track.pps = [nalUnit.data];
  70886. }
  70887. nalUnits.push(nalUnit);
  70888. };
  70889. this.flush = function() {
  70890. var frames, gopForFusion, gops, moof2, mdat2, boxes, prependedContentDuration = 0, firstGop, lastGop;
  70891. while (nalUnits.length) {
  70892. if (nalUnits[0].nalUnitType === "access_unit_delimiter_rbsp") {
  70893. break;
  70894. }
  70895. nalUnits.shift();
  70896. }
  70897. if (nalUnits.length === 0) {
  70898. this.resetStream_();
  70899. this.trigger("done", "VideoSegmentStream");
  70900. return;
  70901. }
  70902. frames = frameUtils.groupNalsIntoFrames(nalUnits);
  70903. gops = frameUtils.groupFramesIntoGops(frames);
  70904. if (!gops[0][0].keyFrame) {
  70905. gopForFusion = this.getGopForFusion_(nalUnits[0], track);
  70906. if (gopForFusion) {
  70907. prependedContentDuration = gopForFusion.duration;
  70908. gops.unshift(gopForFusion);
  70909. gops.byteLength += gopForFusion.byteLength;
  70910. gops.nalCount += gopForFusion.nalCount;
  70911. gops.pts = gopForFusion.pts;
  70912. gops.dts = gopForFusion.dts;
  70913. gops.duration += gopForFusion.duration;
  70914. } else {
  70915. gops = frameUtils.extendFirstKeyFrame(gops);
  70916. }
  70917. }
  70918. if (gopsToAlignWith.length) {
  70919. var alignedGops;
  70920. if (options2.alignGopsAtEnd) {
  70921. alignedGops = this.alignGopsAtEnd_(gops);
  70922. } else {
  70923. alignedGops = this.alignGopsAtStart_(gops);
  70924. }
  70925. if (!alignedGops) {
  70926. this.gopCache_.unshift({
  70927. gop: gops.pop(),
  70928. pps: track.pps,
  70929. sps: track.sps
  70930. });
  70931. this.gopCache_.length = Math.min(6, this.gopCache_.length);
  70932. nalUnits = [];
  70933. this.resetStream_();
  70934. this.trigger("done", "VideoSegmentStream");
  70935. return;
  70936. }
  70937. trackDecodeInfo.clearDtsInfo(track);
  70938. gops = alignedGops;
  70939. }
  70940. trackDecodeInfo.collectDtsInfo(track, gops);
  70941. track.samples = frameUtils.generateSampleTable(gops);
  70942. mdat2 = mp43.mdat(frameUtils.concatenateNalData(gops));
  70943. track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options2.keepOriginalTimestamps);
  70944. this.trigger("processedGopsInfo", gops.map(function(gop) {
  70945. return {
  70946. pts: gop.pts,
  70947. dts: gop.dts,
  70948. byteLength: gop.byteLength
  70949. };
  70950. }));
  70951. firstGop = gops[0];
  70952. lastGop = gops[gops.length - 1];
  70953. this.trigger("segmentTimingInfo", generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration));
  70954. this.trigger("timingInfo", {
  70955. start: gops[0].pts,
  70956. end: gops[gops.length - 1].pts + gops[gops.length - 1].duration
  70957. });
  70958. this.gopCache_.unshift({
  70959. gop: gops.pop(),
  70960. pps: track.pps,
  70961. sps: track.sps
  70962. });
  70963. this.gopCache_.length = Math.min(6, this.gopCache_.length);
  70964. nalUnits = [];
  70965. this.trigger("baseMediaDecodeTime", track.baseMediaDecodeTime);
  70966. this.trigger("timelineStartInfo", track.timelineStartInfo);
  70967. moof2 = mp43.moof(sequenceNumber, [track]);
  70968. boxes = new Uint8Array(moof2.byteLength + mdat2.byteLength);
  70969. sequenceNumber++;
  70970. boxes.set(moof2);
  70971. boxes.set(mdat2, moof2.byteLength);
  70972. this.trigger("data", {
  70973. track,
  70974. boxes
  70975. });
  70976. this.resetStream_();
  70977. this.trigger("done", "VideoSegmentStream");
  70978. };
  70979. this.reset = function() {
  70980. this.resetStream_();
  70981. nalUnits = [];
  70982. this.gopCache_.length = 0;
  70983. gopsToAlignWith.length = 0;
  70984. this.trigger("reset");
  70985. };
  70986. this.resetStream_ = function() {
  70987. trackDecodeInfo.clearDtsInfo(track);
  70988. config = void 0;
  70989. pps = void 0;
  70990. };
  70991. this.getGopForFusion_ = function(nalUnit) {
  70992. var halfSecond = 45e3, allowableOverlap = 1e4, nearestDistance = Infinity, dtsDistance, nearestGopObj, currentGop, currentGopObj, i2;
  70993. for (i2 = 0; i2 < this.gopCache_.length; i2++) {
  70994. currentGopObj = this.gopCache_[i2];
  70995. currentGop = currentGopObj.gop;
  70996. if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) {
  70997. continue;
  70998. }
  70999. if (currentGop.dts < track.timelineStartInfo.dts) {
  71000. continue;
  71001. }
  71002. dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration;
  71003. if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) {
  71004. if (!nearestGopObj || nearestDistance > dtsDistance) {
  71005. nearestGopObj = currentGopObj;
  71006. nearestDistance = dtsDistance;
  71007. }
  71008. }
  71009. }
  71010. if (nearestGopObj) {
  71011. return nearestGopObj.gop;
  71012. }
  71013. return null;
  71014. };
  71015. this.alignGopsAtStart_ = function(gops) {
  71016. var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration5, alignedGops;
  71017. byteLength = gops.byteLength;
  71018. nalCount = gops.nalCount;
  71019. duration5 = gops.duration;
  71020. alignIndex = gopIndex = 0;
  71021. while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) {
  71022. align = gopsToAlignWith[alignIndex];
  71023. gop = gops[gopIndex];
  71024. if (align.pts === gop.pts) {
  71025. break;
  71026. }
  71027. if (gop.pts > align.pts) {
  71028. alignIndex++;
  71029. continue;
  71030. }
  71031. gopIndex++;
  71032. byteLength -= gop.byteLength;
  71033. nalCount -= gop.nalCount;
  71034. duration5 -= gop.duration;
  71035. }
  71036. if (gopIndex === 0) {
  71037. return gops;
  71038. }
  71039. if (gopIndex === gops.length) {
  71040. return null;
  71041. }
  71042. alignedGops = gops.slice(gopIndex);
  71043. alignedGops.byteLength = byteLength;
  71044. alignedGops.duration = duration5;
  71045. alignedGops.nalCount = nalCount;
  71046. alignedGops.pts = alignedGops[0].pts;
  71047. alignedGops.dts = alignedGops[0].dts;
  71048. return alignedGops;
  71049. };
  71050. this.alignGopsAtEnd_ = function(gops) {
  71051. var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound;
  71052. alignIndex = gopsToAlignWith.length - 1;
  71053. gopIndex = gops.length - 1;
  71054. alignEndIndex = null;
  71055. matchFound = false;
  71056. while (alignIndex >= 0 && gopIndex >= 0) {
  71057. align = gopsToAlignWith[alignIndex];
  71058. gop = gops[gopIndex];
  71059. if (align.pts === gop.pts) {
  71060. matchFound = true;
  71061. break;
  71062. }
  71063. if (align.pts > gop.pts) {
  71064. alignIndex--;
  71065. continue;
  71066. }
  71067. if (alignIndex === gopsToAlignWith.length - 1) {
  71068. alignEndIndex = gopIndex;
  71069. }
  71070. gopIndex--;
  71071. }
  71072. if (!matchFound && alignEndIndex === null) {
  71073. return null;
  71074. }
  71075. var trimIndex;
  71076. if (matchFound) {
  71077. trimIndex = gopIndex;
  71078. } else {
  71079. trimIndex = alignEndIndex;
  71080. }
  71081. if (trimIndex === 0) {
  71082. return gops;
  71083. }
  71084. var alignedGops = gops.slice(trimIndex);
  71085. var metadata = alignedGops.reduce(function(total, gop2) {
  71086. total.byteLength += gop2.byteLength;
  71087. total.duration += gop2.duration;
  71088. total.nalCount += gop2.nalCount;
  71089. return total;
  71090. }, {
  71091. byteLength: 0,
  71092. duration: 0,
  71093. nalCount: 0
  71094. });
  71095. alignedGops.byteLength = metadata.byteLength;
  71096. alignedGops.duration = metadata.duration;
  71097. alignedGops.nalCount = metadata.nalCount;
  71098. alignedGops.pts = alignedGops[0].pts;
  71099. alignedGops.dts = alignedGops[0].dts;
  71100. return alignedGops;
  71101. };
  71102. this.alignGopsWith = function(newGopsToAlignWith) {
  71103. gopsToAlignWith = newGopsToAlignWith;
  71104. };
  71105. };
  71106. VideoSegmentStream.prototype = new Stream2();
  71107. CoalesceStream = function(options2, metadataStream2) {
  71108. this.numberOfTracks = 0;
  71109. this.metadataStream = metadataStream2;
  71110. options2 = options2 || {};
  71111. if (typeof options2.remux !== "undefined") {
  71112. this.remuxTracks = !!options2.remux;
  71113. } else {
  71114. this.remuxTracks = true;
  71115. }
  71116. if (typeof options2.keepOriginalTimestamps === "boolean") {
  71117. this.keepOriginalTimestamps = options2.keepOriginalTimestamps;
  71118. } else {
  71119. this.keepOriginalTimestamps = false;
  71120. }
  71121. this.pendingTracks = [];
  71122. this.videoTrack = null;
  71123. this.pendingBoxes = [];
  71124. this.pendingCaptions = [];
  71125. this.pendingMetadata = [];
  71126. this.pendingBytes = 0;
  71127. this.emittedTracks = 0;
  71128. CoalesceStream.prototype.init.call(this);
  71129. this.push = function(output) {
  71130. if (output.text) {
  71131. return this.pendingCaptions.push(output);
  71132. }
  71133. if (output.frames) {
  71134. return this.pendingMetadata.push(output);
  71135. }
  71136. this.pendingTracks.push(output.track);
  71137. this.pendingBytes += output.boxes.byteLength;
  71138. if (output.track.type === "video") {
  71139. this.videoTrack = output.track;
  71140. this.pendingBoxes.push(output.boxes);
  71141. }
  71142. if (output.track.type === "audio") {
  71143. this.audioTrack = output.track;
  71144. this.pendingBoxes.unshift(output.boxes);
  71145. }
  71146. };
  71147. };
  71148. CoalesceStream.prototype = new Stream2();
  71149. CoalesceStream.prototype.flush = function(flushSource) {
  71150. var offset = 0, event2 = {
  71151. captions: [],
  71152. captionStreams: {},
  71153. metadata: [],
  71154. info: {}
  71155. }, caption, id32, initSegment, timelineStartPts = 0, i2;
  71156. if (this.pendingTracks.length < this.numberOfTracks) {
  71157. if (flushSource !== "VideoSegmentStream" && flushSource !== "AudioSegmentStream") {
  71158. return;
  71159. } else if (this.remuxTracks) {
  71160. return;
  71161. } else if (this.pendingTracks.length === 0) {
  71162. this.emittedTracks++;
  71163. if (this.emittedTracks >= this.numberOfTracks) {
  71164. this.trigger("done");
  71165. this.emittedTracks = 0;
  71166. }
  71167. return;
  71168. }
  71169. }
  71170. if (this.videoTrack) {
  71171. timelineStartPts = this.videoTrack.timelineStartInfo.pts;
  71172. VIDEO_PROPERTIES.forEach(function(prop) {
  71173. event2.info[prop] = this.videoTrack[prop];
  71174. }, this);
  71175. } else if (this.audioTrack) {
  71176. timelineStartPts = this.audioTrack.timelineStartInfo.pts;
  71177. AUDIO_PROPERTIES.forEach(function(prop) {
  71178. event2.info[prop] = this.audioTrack[prop];
  71179. }, this);
  71180. }
  71181. if (this.videoTrack || this.audioTrack) {
  71182. if (this.pendingTracks.length === 1) {
  71183. event2.type = this.pendingTracks[0].type;
  71184. } else {
  71185. event2.type = "combined";
  71186. }
  71187. this.emittedTracks += this.pendingTracks.length;
  71188. initSegment = mp43.initSegment(this.pendingTracks);
  71189. event2.initSegment = new Uint8Array(initSegment.byteLength);
  71190. event2.initSegment.set(initSegment);
  71191. event2.data = new Uint8Array(this.pendingBytes);
  71192. for (i2 = 0; i2 < this.pendingBoxes.length; i2++) {
  71193. event2.data.set(this.pendingBoxes[i2], offset);
  71194. offset += this.pendingBoxes[i2].byteLength;
  71195. }
  71196. for (i2 = 0; i2 < this.pendingCaptions.length; i2++) {
  71197. caption = this.pendingCaptions[i2];
  71198. caption.startTime = clock2.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps);
  71199. caption.endTime = clock2.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps);
  71200. event2.captionStreams[caption.stream] = true;
  71201. event2.captions.push(caption);
  71202. }
  71203. for (i2 = 0; i2 < this.pendingMetadata.length; i2++) {
  71204. id32 = this.pendingMetadata[i2];
  71205. id32.cueTime = clock2.metadataTsToSeconds(id32.pts, timelineStartPts, this.keepOriginalTimestamps);
  71206. event2.metadata.push(id32);
  71207. }
  71208. event2.metadata.dispatchType = this.metadataStream.dispatchType;
  71209. this.pendingTracks.length = 0;
  71210. this.videoTrack = null;
  71211. this.pendingBoxes.length = 0;
  71212. this.pendingCaptions.length = 0;
  71213. this.pendingBytes = 0;
  71214. this.pendingMetadata.length = 0;
  71215. this.trigger("data", event2);
  71216. for (i2 = 0; i2 < event2.captions.length; i2++) {
  71217. caption = event2.captions[i2];
  71218. this.trigger("caption", caption);
  71219. }
  71220. for (i2 = 0; i2 < event2.metadata.length; i2++) {
  71221. id32 = event2.metadata[i2];
  71222. this.trigger("id3Frame", id32);
  71223. }
  71224. }
  71225. if (this.emittedTracks >= this.numberOfTracks) {
  71226. this.trigger("done");
  71227. this.emittedTracks = 0;
  71228. }
  71229. };
  71230. CoalesceStream.prototype.setRemux = function(val) {
  71231. this.remuxTracks = val;
  71232. };
  71233. Transmuxer = function(options2) {
  71234. var self2 = this, hasFlushed = true, videoTrack, audioTrack;
  71235. Transmuxer.prototype.init.call(this);
  71236. options2 = options2 || {};
  71237. this.baseMediaDecodeTime = options2.baseMediaDecodeTime || 0;
  71238. this.transmuxPipeline_ = {};
  71239. this.setupAacPipeline = function() {
  71240. var pipeline = {};
  71241. this.transmuxPipeline_ = pipeline;
  71242. pipeline.type = "aac";
  71243. pipeline.metadataStream = new m2ts.MetadataStream();
  71244. pipeline.aacStream = new AacStream();
  71245. pipeline.audioTimestampRolloverStream = new m2ts.TimestampRolloverStream("audio");
  71246. pipeline.timedMetadataTimestampRolloverStream = new m2ts.TimestampRolloverStream("timed-metadata");
  71247. pipeline.adtsStream = new AdtsStream();
  71248. pipeline.coalesceStream = new CoalesceStream(options2, pipeline.metadataStream);
  71249. pipeline.headOfPipeline = pipeline.aacStream;
  71250. pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream);
  71251. pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);
  71252. pipeline.metadataStream.on("timestamp", function(frame) {
  71253. pipeline.aacStream.setTimestamp(frame.timeStamp);
  71254. });
  71255. pipeline.aacStream.on("data", function(data) {
  71256. if (data.type !== "timed-metadata" && data.type !== "audio" || pipeline.audioSegmentStream) {
  71257. return;
  71258. }
  71259. audioTrack = audioTrack || {
  71260. timelineStartInfo: {
  71261. baseMediaDecodeTime: self2.baseMediaDecodeTime
  71262. },
  71263. codec: "adts",
  71264. type: "audio"
  71265. };
  71266. pipeline.coalesceStream.numberOfTracks++;
  71267. pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack, options2);
  71268. pipeline.audioSegmentStream.on("log", self2.getLogTrigger_("audioSegmentStream"));
  71269. pipeline.audioSegmentStream.on("timingInfo", self2.trigger.bind(self2, "audioTimingInfo"));
  71270. pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);
  71271. self2.trigger("trackinfo", {
  71272. hasAudio: !!audioTrack,
  71273. hasVideo: !!videoTrack
  71274. });
  71275. });
  71276. pipeline.coalesceStream.on("data", this.trigger.bind(this, "data"));
  71277. pipeline.coalesceStream.on("done", this.trigger.bind(this, "done"));
  71278. addPipelineLogRetriggers(this, pipeline);
  71279. };
  71280. this.setupTsPipeline = function() {
  71281. var pipeline = {};
  71282. this.transmuxPipeline_ = pipeline;
  71283. pipeline.type = "ts";
  71284. pipeline.metadataStream = new m2ts.MetadataStream();
  71285. pipeline.packetStream = new m2ts.TransportPacketStream();
  71286. pipeline.parseStream = new m2ts.TransportParseStream();
  71287. pipeline.elementaryStream = new m2ts.ElementaryStream();
  71288. pipeline.timestampRolloverStream = new m2ts.TimestampRolloverStream();
  71289. pipeline.adtsStream = new AdtsStream();
  71290. pipeline.h264Stream = new H264Stream();
  71291. pipeline.captionStream = new m2ts.CaptionStream(options2);
  71292. pipeline.coalesceStream = new CoalesceStream(options2, pipeline.metadataStream);
  71293. pipeline.headOfPipeline = pipeline.packetStream;
  71294. pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream);
  71295. pipeline.timestampRolloverStream.pipe(pipeline.h264Stream);
  71296. pipeline.timestampRolloverStream.pipe(pipeline.adtsStream);
  71297. pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);
  71298. pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream);
  71299. pipeline.elementaryStream.on("data", function(data) {
  71300. var i2;
  71301. if (data.type === "metadata") {
  71302. i2 = data.tracks.length;
  71303. while (i2--) {
  71304. if (!videoTrack && data.tracks[i2].type === "video") {
  71305. videoTrack = data.tracks[i2];
  71306. videoTrack.timelineStartInfo.baseMediaDecodeTime = self2.baseMediaDecodeTime;
  71307. } else if (!audioTrack && data.tracks[i2].type === "audio") {
  71308. audioTrack = data.tracks[i2];
  71309. audioTrack.timelineStartInfo.baseMediaDecodeTime = self2.baseMediaDecodeTime;
  71310. }
  71311. }
  71312. if (videoTrack && !pipeline.videoSegmentStream) {
  71313. pipeline.coalesceStream.numberOfTracks++;
  71314. pipeline.videoSegmentStream = new VideoSegmentStream(videoTrack, options2);
  71315. pipeline.videoSegmentStream.on("log", self2.getLogTrigger_("videoSegmentStream"));
  71316. pipeline.videoSegmentStream.on("timelineStartInfo", function(timelineStartInfo) {
  71317. if (audioTrack && !options2.keepOriginalTimestamps) {
  71318. audioTrack.timelineStartInfo = timelineStartInfo;
  71319. pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self2.baseMediaDecodeTime);
  71320. }
  71321. });
  71322. pipeline.videoSegmentStream.on("processedGopsInfo", self2.trigger.bind(self2, "gopInfo"));
  71323. pipeline.videoSegmentStream.on("segmentTimingInfo", self2.trigger.bind(self2, "videoSegmentTimingInfo"));
  71324. pipeline.videoSegmentStream.on("baseMediaDecodeTime", function(baseMediaDecodeTime) {
  71325. if (audioTrack) {
  71326. pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime);
  71327. }
  71328. });
  71329. pipeline.videoSegmentStream.on("timingInfo", self2.trigger.bind(self2, "videoTimingInfo"));
  71330. pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream);
  71331. }
  71332. if (audioTrack && !pipeline.audioSegmentStream) {
  71333. pipeline.coalesceStream.numberOfTracks++;
  71334. pipeline.audioSegmentStream = new AudioSegmentStream(audioTrack, options2);
  71335. pipeline.audioSegmentStream.on("log", self2.getLogTrigger_("audioSegmentStream"));
  71336. pipeline.audioSegmentStream.on("timingInfo", self2.trigger.bind(self2, "audioTimingInfo"));
  71337. pipeline.audioSegmentStream.on("segmentTimingInfo", self2.trigger.bind(self2, "audioSegmentTimingInfo"));
  71338. pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);
  71339. }
  71340. self2.trigger("trackinfo", {
  71341. hasAudio: !!audioTrack,
  71342. hasVideo: !!videoTrack
  71343. });
  71344. }
  71345. });
  71346. pipeline.coalesceStream.on("data", this.trigger.bind(this, "data"));
  71347. pipeline.coalesceStream.on("id3Frame", function(id3Frame) {
  71348. id3Frame.dispatchType = pipeline.metadataStream.dispatchType;
  71349. self2.trigger("id3Frame", id3Frame);
  71350. });
  71351. pipeline.coalesceStream.on("caption", this.trigger.bind(this, "caption"));
  71352. pipeline.coalesceStream.on("done", this.trigger.bind(this, "done"));
  71353. addPipelineLogRetriggers(this, pipeline);
  71354. };
  71355. this.setBaseMediaDecodeTime = function(baseMediaDecodeTime) {
  71356. var pipeline = this.transmuxPipeline_;
  71357. if (!options2.keepOriginalTimestamps) {
  71358. this.baseMediaDecodeTime = baseMediaDecodeTime;
  71359. }
  71360. if (audioTrack) {
  71361. audioTrack.timelineStartInfo.dts = void 0;
  71362. audioTrack.timelineStartInfo.pts = void 0;
  71363. trackDecodeInfo.clearDtsInfo(audioTrack);
  71364. if (pipeline.audioTimestampRolloverStream) {
  71365. pipeline.audioTimestampRolloverStream.discontinuity();
  71366. }
  71367. }
  71368. if (videoTrack) {
  71369. if (pipeline.videoSegmentStream) {
  71370. pipeline.videoSegmentStream.gopCache_ = [];
  71371. }
  71372. videoTrack.timelineStartInfo.dts = void 0;
  71373. videoTrack.timelineStartInfo.pts = void 0;
  71374. trackDecodeInfo.clearDtsInfo(videoTrack);
  71375. pipeline.captionStream.reset();
  71376. }
  71377. if (pipeline.timestampRolloverStream) {
  71378. pipeline.timestampRolloverStream.discontinuity();
  71379. }
  71380. };
  71381. this.setAudioAppendStart = function(timestamp) {
  71382. if (audioTrack) {
  71383. this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp);
  71384. }
  71385. };
  71386. this.setRemux = function(val) {
  71387. var pipeline = this.transmuxPipeline_;
  71388. options2.remux = val;
  71389. if (pipeline && pipeline.coalesceStream) {
  71390. pipeline.coalesceStream.setRemux(val);
  71391. }
  71392. };
  71393. this.alignGopsWith = function(gopsToAlignWith) {
  71394. if (videoTrack && this.transmuxPipeline_.videoSegmentStream) {
  71395. this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith);
  71396. }
  71397. };
  71398. this.getLogTrigger_ = function(key) {
  71399. var self3 = this;
  71400. return function(event2) {
  71401. event2.stream = key;
  71402. self3.trigger("log", event2);
  71403. };
  71404. };
  71405. this.push = function(data) {
  71406. if (hasFlushed) {
  71407. var isAac = isLikelyAacData(data);
  71408. if (isAac && this.transmuxPipeline_.type !== "aac") {
  71409. this.setupAacPipeline();
  71410. } else if (!isAac && this.transmuxPipeline_.type !== "ts") {
  71411. this.setupTsPipeline();
  71412. }
  71413. hasFlushed = false;
  71414. }
  71415. this.transmuxPipeline_.headOfPipeline.push(data);
  71416. };
  71417. this.flush = function() {
  71418. hasFlushed = true;
  71419. this.transmuxPipeline_.headOfPipeline.flush();
  71420. };
  71421. this.endTimeline = function() {
  71422. this.transmuxPipeline_.headOfPipeline.endTimeline();
  71423. };
  71424. this.reset = function() {
  71425. if (this.transmuxPipeline_.headOfPipeline) {
  71426. this.transmuxPipeline_.headOfPipeline.reset();
  71427. }
  71428. };
  71429. this.resetCaptions = function() {
  71430. if (this.transmuxPipeline_.captionStream) {
  71431. this.transmuxPipeline_.captionStream.reset();
  71432. }
  71433. };
  71434. };
  71435. Transmuxer.prototype = new Stream2();
  71436. var transmuxer = {
  71437. Transmuxer,
  71438. VideoSegmentStream,
  71439. AudioSegmentStream,
  71440. AUDIO_PROPERTIES,
  71441. VIDEO_PROPERTIES,
  71442. generateSegmentTimingInfo
  71443. };
  71444. var toUnsigned$3 = function(value) {
  71445. return value >>> 0;
  71446. };
  71447. var toHexString$1 = function(value) {
  71448. return ("00" + value.toString(16)).slice(-2);
  71449. };
  71450. var bin = {
  71451. toUnsigned: toUnsigned$3,
  71452. toHexString: toHexString$1
  71453. };
  71454. var parseType$3 = function(buffer) {
  71455. var result = "";
  71456. result += String.fromCharCode(buffer[0]);
  71457. result += String.fromCharCode(buffer[1]);
  71458. result += String.fromCharCode(buffer[2]);
  71459. result += String.fromCharCode(buffer[3]);
  71460. return result;
  71461. };
  71462. var parseType_1 = parseType$3;
  71463. var toUnsigned$2 = bin.toUnsigned;
  71464. var parseType$2 = parseType_1;
  71465. var findBox$2 = function(data, path) {
  71466. var results = [], i2, size, type3, end, subresults;
  71467. if (!path.length) {
  71468. return null;
  71469. }
  71470. for (i2 = 0; i2 < data.byteLength; ) {
  71471. size = toUnsigned$2(data[i2] << 24 | data[i2 + 1] << 16 | data[i2 + 2] << 8 | data[i2 + 3]);
  71472. type3 = parseType$2(data.subarray(i2 + 4, i2 + 8));
  71473. end = size > 1 ? i2 + size : data.byteLength;
  71474. if (type3 === path[0]) {
  71475. if (path.length === 1) {
  71476. results.push(data.subarray(i2 + 8, end));
  71477. } else {
  71478. subresults = findBox$2(data.subarray(i2 + 8, end), path.slice(1));
  71479. if (subresults.length) {
  71480. results = results.concat(subresults);
  71481. }
  71482. }
  71483. }
  71484. i2 = end;
  71485. }
  71486. return results;
  71487. };
  71488. var findBox_1 = findBox$2;
  71489. var toUnsigned$1 = bin.toUnsigned;
  71490. var getUint64$22 = numbers2.getUint64;
  71491. var tfdt = function(data) {
  71492. var result = {
  71493. version: data[0],
  71494. flags: new Uint8Array(data.subarray(1, 4))
  71495. };
  71496. if (result.version === 1) {
  71497. result.baseMediaDecodeTime = getUint64$22(data.subarray(4));
  71498. } else {
  71499. result.baseMediaDecodeTime = toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]);
  71500. }
  71501. return result;
  71502. };
  71503. var parseTfdt$2 = tfdt;
  71504. var parseSampleFlags$1 = function(flags) {
  71505. return {
  71506. isLeading: (flags[0] & 12) >>> 2,
  71507. dependsOn: flags[0] & 3,
  71508. isDependedOn: (flags[1] & 192) >>> 6,
  71509. hasRedundancy: (flags[1] & 48) >>> 4,
  71510. paddingValue: (flags[1] & 14) >>> 1,
  71511. isNonSyncSample: flags[1] & 1,
  71512. degradationPriority: flags[2] << 8 | flags[3]
  71513. };
  71514. };
  71515. var parseSampleFlags_1 = parseSampleFlags$1;
  71516. var parseSampleFlags = parseSampleFlags_1;
  71517. var trun = function(data) {
  71518. var result = {
  71519. version: data[0],
  71520. flags: new Uint8Array(data.subarray(1, 4)),
  71521. samples: []
  71522. }, view = new DataView(data.buffer, data.byteOffset, data.byteLength), dataOffsetPresent = result.flags[2] & 1, firstSampleFlagsPresent = result.flags[2] & 4, sampleDurationPresent = result.flags[1] & 1, sampleSizePresent = result.flags[1] & 2, sampleFlagsPresent = result.flags[1] & 4, sampleCompositionTimeOffsetPresent = result.flags[1] & 8, sampleCount = view.getUint32(4), offset = 8, sample;
  71523. if (dataOffsetPresent) {
  71524. result.dataOffset = view.getInt32(offset);
  71525. offset += 4;
  71526. }
  71527. if (firstSampleFlagsPresent && sampleCount) {
  71528. sample = {
  71529. flags: parseSampleFlags(data.subarray(offset, offset + 4))
  71530. };
  71531. offset += 4;
  71532. if (sampleDurationPresent) {
  71533. sample.duration = view.getUint32(offset);
  71534. offset += 4;
  71535. }
  71536. if (sampleSizePresent) {
  71537. sample.size = view.getUint32(offset);
  71538. offset += 4;
  71539. }
  71540. if (sampleCompositionTimeOffsetPresent) {
  71541. if (result.version === 1) {
  71542. sample.compositionTimeOffset = view.getInt32(offset);
  71543. } else {
  71544. sample.compositionTimeOffset = view.getUint32(offset);
  71545. }
  71546. offset += 4;
  71547. }
  71548. result.samples.push(sample);
  71549. sampleCount--;
  71550. }
  71551. while (sampleCount--) {
  71552. sample = {};
  71553. if (sampleDurationPresent) {
  71554. sample.duration = view.getUint32(offset);
  71555. offset += 4;
  71556. }
  71557. if (sampleSizePresent) {
  71558. sample.size = view.getUint32(offset);
  71559. offset += 4;
  71560. }
  71561. if (sampleFlagsPresent) {
  71562. sample.flags = parseSampleFlags(data.subarray(offset, offset + 4));
  71563. offset += 4;
  71564. }
  71565. if (sampleCompositionTimeOffsetPresent) {
  71566. if (result.version === 1) {
  71567. sample.compositionTimeOffset = view.getInt32(offset);
  71568. } else {
  71569. sample.compositionTimeOffset = view.getUint32(offset);
  71570. }
  71571. offset += 4;
  71572. }
  71573. result.samples.push(sample);
  71574. }
  71575. return result;
  71576. };
  71577. var parseTrun$2 = trun;
  71578. var tfhd = function(data) {
  71579. var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = {
  71580. version: data[0],
  71581. flags: new Uint8Array(data.subarray(1, 4)),
  71582. trackId: view.getUint32(4)
  71583. }, baseDataOffsetPresent = result.flags[2] & 1, sampleDescriptionIndexPresent = result.flags[2] & 2, defaultSampleDurationPresent = result.flags[2] & 8, defaultSampleSizePresent = result.flags[2] & 16, defaultSampleFlagsPresent = result.flags[2] & 32, durationIsEmpty = result.flags[0] & 65536, defaultBaseIsMoof = result.flags[0] & 131072, i2;
  71584. i2 = 8;
  71585. if (baseDataOffsetPresent) {
  71586. i2 += 4;
  71587. result.baseDataOffset = view.getUint32(12);
  71588. i2 += 4;
  71589. }
  71590. if (sampleDescriptionIndexPresent) {
  71591. result.sampleDescriptionIndex = view.getUint32(i2);
  71592. i2 += 4;
  71593. }
  71594. if (defaultSampleDurationPresent) {
  71595. result.defaultSampleDuration = view.getUint32(i2);
  71596. i2 += 4;
  71597. }
  71598. if (defaultSampleSizePresent) {
  71599. result.defaultSampleSize = view.getUint32(i2);
  71600. i2 += 4;
  71601. }
  71602. if (defaultSampleFlagsPresent) {
  71603. result.defaultSampleFlags = view.getUint32(i2);
  71604. }
  71605. if (durationIsEmpty) {
  71606. result.durationIsEmpty = true;
  71607. }
  71608. if (!baseDataOffsetPresent && defaultBaseIsMoof) {
  71609. result.baseDataOffsetIsMoof = true;
  71610. }
  71611. return result;
  71612. };
  71613. var parseTfhd$2 = tfhd;
  71614. var win2;
  71615. if (typeof window !== "undefined") {
  71616. win2 = window;
  71617. } else if (typeof commonjsGlobal2 !== "undefined") {
  71618. win2 = commonjsGlobal2;
  71619. } else if (typeof self !== "undefined") {
  71620. win2 = self;
  71621. } else {
  71622. win2 = {};
  71623. }
  71624. var window_12 = win2;
  71625. var discardEmulationPreventionBytes4 = captionPacketParser.discardEmulationPreventionBytes;
  71626. var CaptionStream = captionStream.CaptionStream;
  71627. var findBox$12 = findBox_1;
  71628. var parseTfdt$1 = parseTfdt$2;
  71629. var parseTrun$1 = parseTrun$2;
  71630. var parseTfhd$1 = parseTfhd$2;
  71631. var window$22 = window_12;
  71632. var mapToSample = function(offset, samples) {
  71633. var approximateOffset = offset;
  71634. for (var i2 = 0; i2 < samples.length; i2++) {
  71635. var sample = samples[i2];
  71636. if (approximateOffset < sample.size) {
  71637. return sample;
  71638. }
  71639. approximateOffset -= sample.size;
  71640. }
  71641. return null;
  71642. };
  71643. var findSeiNals = function(avcStream, samples, trackId) {
  71644. var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), result = {
  71645. logs: [],
  71646. seiNals: []
  71647. }, seiNal, i2, length, lastMatchedSample;
  71648. for (i2 = 0; i2 + 4 < avcStream.length; i2 += length) {
  71649. length = avcView.getUint32(i2);
  71650. i2 += 4;
  71651. if (length <= 0) {
  71652. continue;
  71653. }
  71654. switch (avcStream[i2] & 31) {
  71655. case 6:
  71656. var data = avcStream.subarray(i2 + 1, i2 + 1 + length);
  71657. var matchingSample = mapToSample(i2, samples);
  71658. seiNal = {
  71659. nalUnitType: "sei_rbsp",
  71660. size: length,
  71661. data,
  71662. escapedRBSP: discardEmulationPreventionBytes4(data),
  71663. trackId
  71664. };
  71665. if (matchingSample) {
  71666. seiNal.pts = matchingSample.pts;
  71667. seiNal.dts = matchingSample.dts;
  71668. lastMatchedSample = matchingSample;
  71669. } else if (lastMatchedSample) {
  71670. seiNal.pts = lastMatchedSample.pts;
  71671. seiNal.dts = lastMatchedSample.dts;
  71672. } else {
  71673. result.logs.push({
  71674. level: "warn",
  71675. message: "We've encountered a nal unit without data at " + i2 + " for trackId " + trackId + ". See mux.js#223."
  71676. });
  71677. break;
  71678. }
  71679. result.seiNals.push(seiNal);
  71680. break;
  71681. }
  71682. }
  71683. return result;
  71684. };
  71685. var parseSamples = function(truns, baseMediaDecodeTime, tfhd2) {
  71686. var currentDts = baseMediaDecodeTime;
  71687. var defaultSampleDuration = tfhd2.defaultSampleDuration || 0;
  71688. var defaultSampleSize = tfhd2.defaultSampleSize || 0;
  71689. var trackId = tfhd2.trackId;
  71690. var allSamples = [];
  71691. truns.forEach(function(trun2) {
  71692. var trackRun = parseTrun$1(trun2);
  71693. var samples = trackRun.samples;
  71694. samples.forEach(function(sample) {
  71695. if (sample.duration === void 0) {
  71696. sample.duration = defaultSampleDuration;
  71697. }
  71698. if (sample.size === void 0) {
  71699. sample.size = defaultSampleSize;
  71700. }
  71701. sample.trackId = trackId;
  71702. sample.dts = currentDts;
  71703. if (sample.compositionTimeOffset === void 0) {
  71704. sample.compositionTimeOffset = 0;
  71705. }
  71706. if (typeof currentDts === "bigint") {
  71707. sample.pts = currentDts + window$22.BigInt(sample.compositionTimeOffset);
  71708. currentDts += window$22.BigInt(sample.duration);
  71709. } else {
  71710. sample.pts = currentDts + sample.compositionTimeOffset;
  71711. currentDts += sample.duration;
  71712. }
  71713. });
  71714. allSamples = allSamples.concat(samples);
  71715. });
  71716. return allSamples;
  71717. };
  71718. var parseCaptionNals = function(segment, videoTrackId) {
  71719. var trafs = findBox$12(segment, ["moof", "traf"]);
  71720. var mdats = findBox$12(segment, ["mdat"]);
  71721. var captionNals = {};
  71722. var mdatTrafPairs = [];
  71723. mdats.forEach(function(mdat2, index2) {
  71724. var matchingTraf = trafs[index2];
  71725. mdatTrafPairs.push({
  71726. mdat: mdat2,
  71727. traf: matchingTraf
  71728. });
  71729. });
  71730. mdatTrafPairs.forEach(function(pair) {
  71731. var mdat2 = pair.mdat;
  71732. var traf2 = pair.traf;
  71733. var tfhd2 = findBox$12(traf2, ["tfhd"]);
  71734. var headerInfo = parseTfhd$1(tfhd2[0]);
  71735. var trackId = headerInfo.trackId;
  71736. var tfdt2 = findBox$12(traf2, ["tfdt"]);
  71737. var baseMediaDecodeTime = tfdt2.length > 0 ? parseTfdt$1(tfdt2[0]).baseMediaDecodeTime : 0;
  71738. var truns = findBox$12(traf2, ["trun"]);
  71739. var samples;
  71740. var result;
  71741. if (videoTrackId === trackId && truns.length > 0) {
  71742. samples = parseSamples(truns, baseMediaDecodeTime, headerInfo);
  71743. result = findSeiNals(mdat2, samples, trackId);
  71744. if (!captionNals[trackId]) {
  71745. captionNals[trackId] = {
  71746. seiNals: [],
  71747. logs: []
  71748. };
  71749. }
  71750. captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals);
  71751. captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs);
  71752. }
  71753. });
  71754. return captionNals;
  71755. };
  71756. var parseEmbeddedCaptions = function(segment, trackId, timescale3) {
  71757. var captionNals;
  71758. if (trackId === null) {
  71759. return null;
  71760. }
  71761. captionNals = parseCaptionNals(segment, trackId);
  71762. var trackNals = captionNals[trackId] || {};
  71763. return {
  71764. seiNals: trackNals.seiNals,
  71765. logs: trackNals.logs,
  71766. timescale: timescale3
  71767. };
  71768. };
  71769. var CaptionParser = function() {
  71770. var isInitialized = false;
  71771. var captionStream2;
  71772. var segmentCache;
  71773. var trackId;
  71774. var timescale3;
  71775. var parsedCaptions;
  71776. var parsingPartial;
  71777. this.isInitialized = function() {
  71778. return isInitialized;
  71779. };
  71780. this.init = function(options2) {
  71781. captionStream2 = new CaptionStream();
  71782. isInitialized = true;
  71783. parsingPartial = options2 ? options2.isPartial : false;
  71784. captionStream2.on("data", function(event2) {
  71785. event2.startTime = event2.startPts / timescale3;
  71786. event2.endTime = event2.endPts / timescale3;
  71787. parsedCaptions.captions.push(event2);
  71788. parsedCaptions.captionStreams[event2.stream] = true;
  71789. });
  71790. captionStream2.on("log", function(log2) {
  71791. parsedCaptions.logs.push(log2);
  71792. });
  71793. };
  71794. this.isNewInit = function(videoTrackIds, timescales) {
  71795. if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === "object" && Object.keys(timescales).length === 0) {
  71796. return false;
  71797. }
  71798. return trackId !== videoTrackIds[0] || timescale3 !== timescales[trackId];
  71799. };
  71800. this.parse = function(segment, videoTrackIds, timescales) {
  71801. var parsedData;
  71802. if (!this.isInitialized()) {
  71803. return null;
  71804. } else if (!videoTrackIds || !timescales) {
  71805. return null;
  71806. } else if (this.isNewInit(videoTrackIds, timescales)) {
  71807. trackId = videoTrackIds[0];
  71808. timescale3 = timescales[trackId];
  71809. } else if (trackId === null || !timescale3) {
  71810. segmentCache.push(segment);
  71811. return null;
  71812. }
  71813. while (segmentCache.length > 0) {
  71814. var cachedSegment = segmentCache.shift();
  71815. this.parse(cachedSegment, videoTrackIds, timescales);
  71816. }
  71817. parsedData = parseEmbeddedCaptions(segment, trackId, timescale3);
  71818. if (parsedData && parsedData.logs) {
  71819. parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs);
  71820. }
  71821. if (parsedData === null || !parsedData.seiNals) {
  71822. if (parsedCaptions.logs.length) {
  71823. return {
  71824. logs: parsedCaptions.logs,
  71825. captions: [],
  71826. captionStreams: []
  71827. };
  71828. }
  71829. return null;
  71830. }
  71831. this.pushNals(parsedData.seiNals);
  71832. this.flushStream();
  71833. return parsedCaptions;
  71834. };
  71835. this.pushNals = function(nals) {
  71836. if (!this.isInitialized() || !nals || nals.length === 0) {
  71837. return null;
  71838. }
  71839. nals.forEach(function(nal) {
  71840. captionStream2.push(nal);
  71841. });
  71842. };
  71843. this.flushStream = function() {
  71844. if (!this.isInitialized()) {
  71845. return null;
  71846. }
  71847. if (!parsingPartial) {
  71848. captionStream2.flush();
  71849. } else {
  71850. captionStream2.partialFlush();
  71851. }
  71852. };
  71853. this.clearParsedCaptions = function() {
  71854. parsedCaptions.captions = [];
  71855. parsedCaptions.captionStreams = {};
  71856. parsedCaptions.logs = [];
  71857. };
  71858. this.resetCaptionStream = function() {
  71859. if (!this.isInitialized()) {
  71860. return null;
  71861. }
  71862. captionStream2.reset();
  71863. };
  71864. this.clearAllCaptions = function() {
  71865. this.clearParsedCaptions();
  71866. this.resetCaptionStream();
  71867. };
  71868. this.reset = function() {
  71869. segmentCache = [];
  71870. trackId = null;
  71871. timescale3 = null;
  71872. if (!parsedCaptions) {
  71873. parsedCaptions = {
  71874. captions: [],
  71875. captionStreams: {},
  71876. logs: []
  71877. };
  71878. } else {
  71879. this.clearParsedCaptions();
  71880. }
  71881. this.resetCaptionStream();
  71882. };
  71883. this.reset();
  71884. };
  71885. var captionParser = CaptionParser;
  71886. var uint8ToCString$1 = function(data) {
  71887. var index2 = 0;
  71888. var curChar = String.fromCharCode(data[index2]);
  71889. var retString = "";
  71890. while (curChar !== "\0") {
  71891. retString += curChar;
  71892. index2++;
  71893. curChar = String.fromCharCode(data[index2]);
  71894. }
  71895. retString += curChar;
  71896. return retString;
  71897. };
  71898. var string = {
  71899. uint8ToCString: uint8ToCString$1
  71900. };
  71901. var uint8ToCString = string.uint8ToCString;
  71902. var getUint64$12 = numbers2.getUint64;
  71903. var parseEmsgBox = function(boxData) {
  71904. var offset = 4;
  71905. var version2 = boxData[0];
  71906. var scheme_id_uri, value, timescale3, presentation_time, presentation_time_delta, event_duration, id, message_data;
  71907. if (version2 === 0) {
  71908. scheme_id_uri = uint8ToCString(boxData.subarray(offset));
  71909. offset += scheme_id_uri.length;
  71910. value = uint8ToCString(boxData.subarray(offset));
  71911. offset += value.length;
  71912. var dv = new DataView(boxData.buffer);
  71913. timescale3 = dv.getUint32(offset);
  71914. offset += 4;
  71915. presentation_time_delta = dv.getUint32(offset);
  71916. offset += 4;
  71917. event_duration = dv.getUint32(offset);
  71918. offset += 4;
  71919. id = dv.getUint32(offset);
  71920. offset += 4;
  71921. } else if (version2 === 1) {
  71922. var dv = new DataView(boxData.buffer);
  71923. timescale3 = dv.getUint32(offset);
  71924. offset += 4;
  71925. presentation_time = getUint64$12(boxData.subarray(offset));
  71926. offset += 8;
  71927. event_duration = dv.getUint32(offset);
  71928. offset += 4;
  71929. id = dv.getUint32(offset);
  71930. offset += 4;
  71931. scheme_id_uri = uint8ToCString(boxData.subarray(offset));
  71932. offset += scheme_id_uri.length;
  71933. value = uint8ToCString(boxData.subarray(offset));
  71934. offset += value.length;
  71935. }
  71936. message_data = new Uint8Array(boxData.subarray(offset, boxData.byteLength));
  71937. var emsgBox = {
  71938. scheme_id_uri,
  71939. value,
  71940. timescale: timescale3 ? timescale3 : 1,
  71941. presentation_time,
  71942. presentation_time_delta,
  71943. event_duration,
  71944. id,
  71945. message_data
  71946. };
  71947. return isValidEmsgBox(version2, emsgBox) ? emsgBox : void 0;
  71948. };
  71949. var scaleTime = function(presentationTime, timescale3, timeDelta, offset) {
  71950. return presentationTime || presentationTime === 0 ? presentationTime / timescale3 : offset + timeDelta / timescale3;
  71951. };
  71952. var isValidEmsgBox = function(version2, emsg2) {
  71953. var hasScheme = emsg2.scheme_id_uri !== "\0";
  71954. var isValidV0Box = version2 === 0 && isDefined(emsg2.presentation_time_delta) && hasScheme;
  71955. var isValidV1Box = version2 === 1 && isDefined(emsg2.presentation_time) && hasScheme;
  71956. return !(version2 > 1) && isValidV0Box || isValidV1Box;
  71957. };
  71958. var isDefined = function(data) {
  71959. return data !== void 0 || data !== null;
  71960. };
  71961. var emsg$1 = {
  71962. parseEmsgBox,
  71963. scaleTime
  71964. };
  71965. var toUnsigned = bin.toUnsigned;
  71966. var toHexString = bin.toHexString;
  71967. var findBox4 = findBox_1;
  71968. var parseType$1 = parseType_1;
  71969. var emsg = emsg$1;
  71970. var parseTfhd = parseTfhd$2;
  71971. var parseTrun = parseTrun$2;
  71972. var parseTfdt = parseTfdt$2;
  71973. var getUint642 = numbers2.getUint64;
  71974. var timescale2, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader, getEmsgID3;
  71975. var window$12 = window_12;
  71976. var parseId3Frames = parseId3.parseId3Frames;
  71977. timescale2 = function(init) {
  71978. var result = {}, traks = findBox4(init, ["moov", "trak"]);
  71979. return traks.reduce(function(result2, trak2) {
  71980. var tkhd2, version2, index2, id, mdhd2;
  71981. tkhd2 = findBox4(trak2, ["tkhd"])[0];
  71982. if (!tkhd2) {
  71983. return null;
  71984. }
  71985. version2 = tkhd2[0];
  71986. index2 = version2 === 0 ? 12 : 20;
  71987. id = toUnsigned(tkhd2[index2] << 24 | tkhd2[index2 + 1] << 16 | tkhd2[index2 + 2] << 8 | tkhd2[index2 + 3]);
  71988. mdhd2 = findBox4(trak2, ["mdia", "mdhd"])[0];
  71989. if (!mdhd2) {
  71990. return null;
  71991. }
  71992. version2 = mdhd2[0];
  71993. index2 = version2 === 0 ? 12 : 20;
  71994. result2[id] = toUnsigned(mdhd2[index2] << 24 | mdhd2[index2 + 1] << 16 | mdhd2[index2 + 2] << 8 | mdhd2[index2 + 3]);
  71995. return result2;
  71996. }, result);
  71997. };
  71998. startTime = function(timescale3, fragment) {
  71999. var trafs;
  72000. trafs = findBox4(fragment, ["moof", "traf"]);
  72001. var lowestTime = trafs.reduce(function(acc, traf2) {
  72002. var tfhd2 = findBox4(traf2, ["tfhd"])[0];
  72003. var id = toUnsigned(tfhd2[4] << 24 | tfhd2[5] << 16 | tfhd2[6] << 8 | tfhd2[7]);
  72004. var scale = timescale3[id] || 9e4;
  72005. var tfdt2 = findBox4(traf2, ["tfdt"])[0];
  72006. var dv = new DataView(tfdt2.buffer, tfdt2.byteOffset, tfdt2.byteLength);
  72007. var baseTime;
  72008. if (tfdt2[0] === 1) {
  72009. baseTime = getUint642(tfdt2.subarray(4, 12));
  72010. } else {
  72011. baseTime = dv.getUint32(4);
  72012. }
  72013. let seconds;
  72014. if (typeof baseTime === "bigint") {
  72015. seconds = baseTime / window$12.BigInt(scale);
  72016. } else if (typeof baseTime === "number" && !isNaN(baseTime)) {
  72017. seconds = baseTime / scale;
  72018. }
  72019. if (seconds < Number.MAX_SAFE_INTEGER) {
  72020. seconds = Number(seconds);
  72021. }
  72022. if (seconds < acc) {
  72023. acc = seconds;
  72024. }
  72025. return acc;
  72026. }, Infinity);
  72027. return typeof lowestTime === "bigint" || isFinite(lowestTime) ? lowestTime : 0;
  72028. };
  72029. compositionStartTime = function(timescales, fragment) {
  72030. var trafBoxes = findBox4(fragment, ["moof", "traf"]);
  72031. var baseMediaDecodeTime = 0;
  72032. var compositionTimeOffset = 0;
  72033. var trackId;
  72034. if (trafBoxes && trafBoxes.length) {
  72035. var tfhd2 = findBox4(trafBoxes[0], ["tfhd"])[0];
  72036. var trun2 = findBox4(trafBoxes[0], ["trun"])[0];
  72037. var tfdt2 = findBox4(trafBoxes[0], ["tfdt"])[0];
  72038. if (tfhd2) {
  72039. var parsedTfhd = parseTfhd(tfhd2);
  72040. trackId = parsedTfhd.trackId;
  72041. }
  72042. if (tfdt2) {
  72043. var parsedTfdt = parseTfdt(tfdt2);
  72044. baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime;
  72045. }
  72046. if (trun2) {
  72047. var parsedTrun = parseTrun(trun2);
  72048. if (parsedTrun.samples && parsedTrun.samples.length) {
  72049. compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0;
  72050. }
  72051. }
  72052. }
  72053. var timescale3 = timescales[trackId] || 9e4;
  72054. if (typeof baseMediaDecodeTime === "bigint") {
  72055. compositionTimeOffset = window$12.BigInt(compositionTimeOffset);
  72056. timescale3 = window$12.BigInt(timescale3);
  72057. }
  72058. var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale3;
  72059. if (typeof result === "bigint" && result < Number.MAX_SAFE_INTEGER) {
  72060. result = Number(result);
  72061. }
  72062. return result;
  72063. };
  72064. getVideoTrackIds = function(init) {
  72065. var traks = findBox4(init, ["moov", "trak"]);
  72066. var videoTrackIds = [];
  72067. traks.forEach(function(trak2) {
  72068. var hdlrs = findBox4(trak2, ["mdia", "hdlr"]);
  72069. var tkhds = findBox4(trak2, ["tkhd"]);
  72070. hdlrs.forEach(function(hdlr2, index2) {
  72071. var handlerType = parseType$1(hdlr2.subarray(8, 12));
  72072. var tkhd2 = tkhds[index2];
  72073. var view;
  72074. var version2;
  72075. var trackId;
  72076. if (handlerType === "vide") {
  72077. view = new DataView(tkhd2.buffer, tkhd2.byteOffset, tkhd2.byteLength);
  72078. version2 = view.getUint8(0);
  72079. trackId = version2 === 0 ? view.getUint32(12) : view.getUint32(20);
  72080. videoTrackIds.push(trackId);
  72081. }
  72082. });
  72083. });
  72084. return videoTrackIds;
  72085. };
  72086. getTimescaleFromMediaHeader = function(mdhd2) {
  72087. var version2 = mdhd2[0];
  72088. var index2 = version2 === 0 ? 12 : 20;
  72089. return toUnsigned(mdhd2[index2] << 24 | mdhd2[index2 + 1] << 16 | mdhd2[index2 + 2] << 8 | mdhd2[index2 + 3]);
  72090. };
  72091. getTracks = function(init) {
  72092. var traks = findBox4(init, ["moov", "trak"]);
  72093. var tracks = [];
  72094. traks.forEach(function(trak2) {
  72095. var track = {};
  72096. var tkhd2 = findBox4(trak2, ["tkhd"])[0];
  72097. var view, tkhdVersion;
  72098. if (tkhd2) {
  72099. view = new DataView(tkhd2.buffer, tkhd2.byteOffset, tkhd2.byteLength);
  72100. tkhdVersion = view.getUint8(0);
  72101. track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20);
  72102. }
  72103. var hdlr2 = findBox4(trak2, ["mdia", "hdlr"])[0];
  72104. if (hdlr2) {
  72105. var type3 = parseType$1(hdlr2.subarray(8, 12));
  72106. if (type3 === "vide") {
  72107. track.type = "video";
  72108. } else if (type3 === "soun") {
  72109. track.type = "audio";
  72110. } else {
  72111. track.type = type3;
  72112. }
  72113. }
  72114. var stsd2 = findBox4(trak2, ["mdia", "minf", "stbl", "stsd"])[0];
  72115. if (stsd2) {
  72116. var sampleDescriptions = stsd2.subarray(8);
  72117. track.codec = parseType$1(sampleDescriptions.subarray(4, 8));
  72118. var codecBox = findBox4(sampleDescriptions, [track.codec])[0];
  72119. var codecConfig, codecConfigType;
  72120. if (codecBox) {
  72121. if (/^[asm]vc[1-9]$/i.test(track.codec)) {
  72122. codecConfig = codecBox.subarray(78);
  72123. codecConfigType = parseType$1(codecConfig.subarray(4, 8));
  72124. if (codecConfigType === "avcC" && codecConfig.length > 11) {
  72125. track.codec += ".";
  72126. track.codec += toHexString(codecConfig[9]);
  72127. track.codec += toHexString(codecConfig[10]);
  72128. track.codec += toHexString(codecConfig[11]);
  72129. } else {
  72130. track.codec = "avc1.4d400d";
  72131. }
  72132. } else if (/^mp4[a,v]$/i.test(track.codec)) {
  72133. codecConfig = codecBox.subarray(28);
  72134. codecConfigType = parseType$1(codecConfig.subarray(4, 8));
  72135. if (codecConfigType === "esds" && codecConfig.length > 20 && codecConfig[19] !== 0) {
  72136. track.codec += "." + toHexString(codecConfig[19]);
  72137. track.codec += "." + toHexString(codecConfig[20] >>> 2 & 63).replace(/^0/, "");
  72138. } else {
  72139. track.codec = "mp4a.40.2";
  72140. }
  72141. } else {
  72142. track.codec = track.codec.toLowerCase();
  72143. }
  72144. }
  72145. }
  72146. var mdhd2 = findBox4(trak2, ["mdia", "mdhd"])[0];
  72147. if (mdhd2) {
  72148. track.timescale = getTimescaleFromMediaHeader(mdhd2);
  72149. }
  72150. tracks.push(track);
  72151. });
  72152. return tracks;
  72153. };
  72154. getEmsgID3 = function(segmentData, offset = 0) {
  72155. var emsgBoxes = findBox4(segmentData, ["emsg"]);
  72156. return emsgBoxes.map((data) => {
  72157. var parsedBox = emsg.parseEmsgBox(new Uint8Array(data));
  72158. var parsedId3Frames = parseId3Frames(parsedBox.message_data);
  72159. return {
  72160. cueTime: emsg.scaleTime(parsedBox.presentation_time, parsedBox.timescale, parsedBox.presentation_time_delta, offset),
  72161. duration: emsg.scaleTime(parsedBox.event_duration, parsedBox.timescale),
  72162. frames: parsedId3Frames
  72163. };
  72164. });
  72165. };
  72166. var probe$2 = {
  72167. findBox: findBox4,
  72168. parseType: parseType$1,
  72169. timescale: timescale2,
  72170. startTime,
  72171. compositionStartTime,
  72172. videoTrackIds: getVideoTrackIds,
  72173. tracks: getTracks,
  72174. getTimescaleFromMediaHeader,
  72175. getEmsgID3
  72176. };
  72177. var StreamTypes$1 = streamTypes;
  72178. var parsePid = function(packet) {
  72179. var pid = packet[1] & 31;
  72180. pid <<= 8;
  72181. pid |= packet[2];
  72182. return pid;
  72183. };
  72184. var parsePayloadUnitStartIndicator = function(packet) {
  72185. return !!(packet[1] & 64);
  72186. };
  72187. var parseAdaptionField = function(packet) {
  72188. var offset = 0;
  72189. if ((packet[3] & 48) >>> 4 > 1) {
  72190. offset += packet[4] + 1;
  72191. }
  72192. return offset;
  72193. };
  72194. var parseType = function(packet, pmtPid) {
  72195. var pid = parsePid(packet);
  72196. if (pid === 0) {
  72197. return "pat";
  72198. } else if (pid === pmtPid) {
  72199. return "pmt";
  72200. } else if (pmtPid) {
  72201. return "pes";
  72202. }
  72203. return null;
  72204. };
  72205. var parsePat = function(packet) {
  72206. var pusi = parsePayloadUnitStartIndicator(packet);
  72207. var offset = 4 + parseAdaptionField(packet);
  72208. if (pusi) {
  72209. offset += packet[offset] + 1;
  72210. }
  72211. return (packet[offset + 10] & 31) << 8 | packet[offset + 11];
  72212. };
  72213. var parsePmt = function(packet) {
  72214. var programMapTable = {};
  72215. var pusi = parsePayloadUnitStartIndicator(packet);
  72216. var payloadOffset = 4 + parseAdaptionField(packet);
  72217. if (pusi) {
  72218. payloadOffset += packet[payloadOffset] + 1;
  72219. }
  72220. if (!(packet[payloadOffset + 5] & 1)) {
  72221. return;
  72222. }
  72223. var sectionLength, tableEnd, programInfoLength;
  72224. sectionLength = (packet[payloadOffset + 1] & 15) << 8 | packet[payloadOffset + 2];
  72225. tableEnd = 3 + sectionLength - 4;
  72226. programInfoLength = (packet[payloadOffset + 10] & 15) << 8 | packet[payloadOffset + 11];
  72227. var offset = 12 + programInfoLength;
  72228. while (offset < tableEnd) {
  72229. var i2 = payloadOffset + offset;
  72230. programMapTable[(packet[i2 + 1] & 31) << 8 | packet[i2 + 2]] = packet[i2];
  72231. offset += ((packet[i2 + 3] & 15) << 8 | packet[i2 + 4]) + 5;
  72232. }
  72233. return programMapTable;
  72234. };
  72235. var parsePesType = function(packet, programMapTable) {
  72236. var pid = parsePid(packet);
  72237. var type3 = programMapTable[pid];
  72238. switch (type3) {
  72239. case StreamTypes$1.H264_STREAM_TYPE:
  72240. return "video";
  72241. case StreamTypes$1.ADTS_STREAM_TYPE:
  72242. return "audio";
  72243. case StreamTypes$1.METADATA_STREAM_TYPE:
  72244. return "timed-metadata";
  72245. default:
  72246. return null;
  72247. }
  72248. };
  72249. var parsePesTime = function(packet) {
  72250. var pusi = parsePayloadUnitStartIndicator(packet);
  72251. if (!pusi) {
  72252. return null;
  72253. }
  72254. var offset = 4 + parseAdaptionField(packet);
  72255. if (offset >= packet.byteLength) {
  72256. return null;
  72257. }
  72258. var pes = null;
  72259. var ptsDtsFlags;
  72260. ptsDtsFlags = packet[offset + 7];
  72261. if (ptsDtsFlags & 192) {
  72262. pes = {};
  72263. pes.pts = (packet[offset + 9] & 14) << 27 | (packet[offset + 10] & 255) << 20 | (packet[offset + 11] & 254) << 12 | (packet[offset + 12] & 255) << 5 | (packet[offset + 13] & 254) >>> 3;
  72264. pes.pts *= 4;
  72265. pes.pts += (packet[offset + 13] & 6) >>> 1;
  72266. pes.dts = pes.pts;
  72267. if (ptsDtsFlags & 64) {
  72268. pes.dts = (packet[offset + 14] & 14) << 27 | (packet[offset + 15] & 255) << 20 | (packet[offset + 16] & 254) << 12 | (packet[offset + 17] & 255) << 5 | (packet[offset + 18] & 254) >>> 3;
  72269. pes.dts *= 4;
  72270. pes.dts += (packet[offset + 18] & 6) >>> 1;
  72271. }
  72272. }
  72273. return pes;
  72274. };
  72275. var parseNalUnitType = function(type3) {
  72276. switch (type3) {
  72277. case 5:
  72278. return "slice_layer_without_partitioning_rbsp_idr";
  72279. case 6:
  72280. return "sei_rbsp";
  72281. case 7:
  72282. return "seq_parameter_set_rbsp";
  72283. case 8:
  72284. return "pic_parameter_set_rbsp";
  72285. case 9:
  72286. return "access_unit_delimiter_rbsp";
  72287. default:
  72288. return null;
  72289. }
  72290. };
  72291. var videoPacketContainsKeyFrame = function(packet) {
  72292. var offset = 4 + parseAdaptionField(packet);
  72293. var frameBuffer = packet.subarray(offset);
  72294. var frameI = 0;
  72295. var frameSyncPoint = 0;
  72296. var foundKeyFrame = false;
  72297. var nalType;
  72298. for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) {
  72299. if (frameBuffer[frameSyncPoint + 2] === 1) {
  72300. frameI = frameSyncPoint + 5;
  72301. break;
  72302. }
  72303. }
  72304. while (frameI < frameBuffer.byteLength) {
  72305. switch (frameBuffer[frameI]) {
  72306. case 0:
  72307. if (frameBuffer[frameI - 1] !== 0) {
  72308. frameI += 2;
  72309. break;
  72310. } else if (frameBuffer[frameI - 2] !== 0) {
  72311. frameI++;
  72312. break;
  72313. }
  72314. if (frameSyncPoint + 3 !== frameI - 2) {
  72315. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  72316. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  72317. foundKeyFrame = true;
  72318. }
  72319. }
  72320. do {
  72321. frameI++;
  72322. } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length);
  72323. frameSyncPoint = frameI - 2;
  72324. frameI += 3;
  72325. break;
  72326. case 1:
  72327. if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) {
  72328. frameI += 3;
  72329. break;
  72330. }
  72331. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  72332. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  72333. foundKeyFrame = true;
  72334. }
  72335. frameSyncPoint = frameI - 2;
  72336. frameI += 3;
  72337. break;
  72338. default:
  72339. frameI += 3;
  72340. break;
  72341. }
  72342. }
  72343. frameBuffer = frameBuffer.subarray(frameSyncPoint);
  72344. frameI -= frameSyncPoint;
  72345. frameSyncPoint = 0;
  72346. if (frameBuffer && frameBuffer.byteLength > 3) {
  72347. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  72348. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  72349. foundKeyFrame = true;
  72350. }
  72351. }
  72352. return foundKeyFrame;
  72353. };
  72354. var probe$1 = {
  72355. parseType,
  72356. parsePat,
  72357. parsePmt,
  72358. parsePayloadUnitStartIndicator,
  72359. parsePesType,
  72360. parsePesTime,
  72361. videoPacketContainsKeyFrame
  72362. };
  72363. var StreamTypes = streamTypes;
  72364. var handleRollover = timestampRolloverStream.handleRollover;
  72365. var probe = {};
  72366. probe.ts = probe$1;
  72367. probe.aac = utils2;
  72368. var ONE_SECOND_IN_TS2 = clock$2.ONE_SECOND_IN_TS;
  72369. var MP2T_PACKET_LENGTH = 188, SYNC_BYTE = 71;
  72370. var parsePsi_ = function(bytes, pmt) {
  72371. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3;
  72372. while (endIndex < bytes.byteLength) {
  72373. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  72374. packet = bytes.subarray(startIndex, endIndex);
  72375. type3 = probe.ts.parseType(packet, pmt.pid);
  72376. switch (type3) {
  72377. case "pat":
  72378. pmt.pid = probe.ts.parsePat(packet);
  72379. break;
  72380. case "pmt":
  72381. var table = probe.ts.parsePmt(packet);
  72382. pmt.table = pmt.table || {};
  72383. Object.keys(table).forEach(function(key) {
  72384. pmt.table[key] = table[key];
  72385. });
  72386. break;
  72387. }
  72388. startIndex += MP2T_PACKET_LENGTH;
  72389. endIndex += MP2T_PACKET_LENGTH;
  72390. continue;
  72391. }
  72392. startIndex++;
  72393. endIndex++;
  72394. }
  72395. };
  72396. var parseAudioPes_ = function(bytes, pmt, result) {
  72397. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3, pesType, pusi, parsed;
  72398. var endLoop = false;
  72399. while (endIndex <= bytes.byteLength) {
  72400. if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {
  72401. packet = bytes.subarray(startIndex, endIndex);
  72402. type3 = probe.ts.parseType(packet, pmt.pid);
  72403. switch (type3) {
  72404. case "pes":
  72405. pesType = probe.ts.parsePesType(packet, pmt.table);
  72406. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  72407. if (pesType === "audio" && pusi) {
  72408. parsed = probe.ts.parsePesTime(packet);
  72409. if (parsed) {
  72410. parsed.type = "audio";
  72411. result.audio.push(parsed);
  72412. endLoop = true;
  72413. }
  72414. }
  72415. break;
  72416. }
  72417. if (endLoop) {
  72418. break;
  72419. }
  72420. startIndex += MP2T_PACKET_LENGTH;
  72421. endIndex += MP2T_PACKET_LENGTH;
  72422. continue;
  72423. }
  72424. startIndex++;
  72425. endIndex++;
  72426. }
  72427. endIndex = bytes.byteLength;
  72428. startIndex = endIndex - MP2T_PACKET_LENGTH;
  72429. endLoop = false;
  72430. while (startIndex >= 0) {
  72431. if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {
  72432. packet = bytes.subarray(startIndex, endIndex);
  72433. type3 = probe.ts.parseType(packet, pmt.pid);
  72434. switch (type3) {
  72435. case "pes":
  72436. pesType = probe.ts.parsePesType(packet, pmt.table);
  72437. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  72438. if (pesType === "audio" && pusi) {
  72439. parsed = probe.ts.parsePesTime(packet);
  72440. if (parsed) {
  72441. parsed.type = "audio";
  72442. result.audio.push(parsed);
  72443. endLoop = true;
  72444. }
  72445. }
  72446. break;
  72447. }
  72448. if (endLoop) {
  72449. break;
  72450. }
  72451. startIndex -= MP2T_PACKET_LENGTH;
  72452. endIndex -= MP2T_PACKET_LENGTH;
  72453. continue;
  72454. }
  72455. startIndex--;
  72456. endIndex--;
  72457. }
  72458. };
  72459. var parseVideoPes_ = function(bytes, pmt, result) {
  72460. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3, pesType, pusi, parsed, frame, i2, pes;
  72461. var endLoop = false;
  72462. var currentFrame = {
  72463. data: [],
  72464. size: 0
  72465. };
  72466. while (endIndex < bytes.byteLength) {
  72467. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  72468. packet = bytes.subarray(startIndex, endIndex);
  72469. type3 = probe.ts.parseType(packet, pmt.pid);
  72470. switch (type3) {
  72471. case "pes":
  72472. pesType = probe.ts.parsePesType(packet, pmt.table);
  72473. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  72474. if (pesType === "video") {
  72475. if (pusi && !endLoop) {
  72476. parsed = probe.ts.parsePesTime(packet);
  72477. if (parsed) {
  72478. parsed.type = "video";
  72479. result.video.push(parsed);
  72480. endLoop = true;
  72481. }
  72482. }
  72483. if (!result.firstKeyFrame) {
  72484. if (pusi) {
  72485. if (currentFrame.size !== 0) {
  72486. frame = new Uint8Array(currentFrame.size);
  72487. i2 = 0;
  72488. while (currentFrame.data.length) {
  72489. pes = currentFrame.data.shift();
  72490. frame.set(pes, i2);
  72491. i2 += pes.byteLength;
  72492. }
  72493. if (probe.ts.videoPacketContainsKeyFrame(frame)) {
  72494. var firstKeyFrame = probe.ts.parsePesTime(frame);
  72495. if (firstKeyFrame) {
  72496. result.firstKeyFrame = firstKeyFrame;
  72497. result.firstKeyFrame.type = "video";
  72498. } else {
  72499. console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.");
  72500. }
  72501. }
  72502. currentFrame.size = 0;
  72503. }
  72504. }
  72505. currentFrame.data.push(packet);
  72506. currentFrame.size += packet.byteLength;
  72507. }
  72508. }
  72509. break;
  72510. }
  72511. if (endLoop && result.firstKeyFrame) {
  72512. break;
  72513. }
  72514. startIndex += MP2T_PACKET_LENGTH;
  72515. endIndex += MP2T_PACKET_LENGTH;
  72516. continue;
  72517. }
  72518. startIndex++;
  72519. endIndex++;
  72520. }
  72521. endIndex = bytes.byteLength;
  72522. startIndex = endIndex - MP2T_PACKET_LENGTH;
  72523. endLoop = false;
  72524. while (startIndex >= 0) {
  72525. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  72526. packet = bytes.subarray(startIndex, endIndex);
  72527. type3 = probe.ts.parseType(packet, pmt.pid);
  72528. switch (type3) {
  72529. case "pes":
  72530. pesType = probe.ts.parsePesType(packet, pmt.table);
  72531. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  72532. if (pesType === "video" && pusi) {
  72533. parsed = probe.ts.parsePesTime(packet);
  72534. if (parsed) {
  72535. parsed.type = "video";
  72536. result.video.push(parsed);
  72537. endLoop = true;
  72538. }
  72539. }
  72540. break;
  72541. }
  72542. if (endLoop) {
  72543. break;
  72544. }
  72545. startIndex -= MP2T_PACKET_LENGTH;
  72546. endIndex -= MP2T_PACKET_LENGTH;
  72547. continue;
  72548. }
  72549. startIndex--;
  72550. endIndex--;
  72551. }
  72552. };
  72553. var adjustTimestamp_ = function(segmentInfo, baseTimestamp) {
  72554. if (segmentInfo.audio && segmentInfo.audio.length) {
  72555. var audioBaseTimestamp = baseTimestamp;
  72556. if (typeof audioBaseTimestamp === "undefined" || isNaN(audioBaseTimestamp)) {
  72557. audioBaseTimestamp = segmentInfo.audio[0].dts;
  72558. }
  72559. segmentInfo.audio.forEach(function(info) {
  72560. info.dts = handleRollover(info.dts, audioBaseTimestamp);
  72561. info.pts = handleRollover(info.pts, audioBaseTimestamp);
  72562. info.dtsTime = info.dts / ONE_SECOND_IN_TS2;
  72563. info.ptsTime = info.pts / ONE_SECOND_IN_TS2;
  72564. });
  72565. }
  72566. if (segmentInfo.video && segmentInfo.video.length) {
  72567. var videoBaseTimestamp = baseTimestamp;
  72568. if (typeof videoBaseTimestamp === "undefined" || isNaN(videoBaseTimestamp)) {
  72569. videoBaseTimestamp = segmentInfo.video[0].dts;
  72570. }
  72571. segmentInfo.video.forEach(function(info) {
  72572. info.dts = handleRollover(info.dts, videoBaseTimestamp);
  72573. info.pts = handleRollover(info.pts, videoBaseTimestamp);
  72574. info.dtsTime = info.dts / ONE_SECOND_IN_TS2;
  72575. info.ptsTime = info.pts / ONE_SECOND_IN_TS2;
  72576. });
  72577. if (segmentInfo.firstKeyFrame) {
  72578. var frame = segmentInfo.firstKeyFrame;
  72579. frame.dts = handleRollover(frame.dts, videoBaseTimestamp);
  72580. frame.pts = handleRollover(frame.pts, videoBaseTimestamp);
  72581. frame.dtsTime = frame.dts / ONE_SECOND_IN_TS2;
  72582. frame.ptsTime = frame.pts / ONE_SECOND_IN_TS2;
  72583. }
  72584. }
  72585. };
  72586. var inspectAac_ = function(bytes) {
  72587. var endLoop = false, audioCount = 0, sampleRate = null, timestamp = null, frameSize = 0, byteIndex = 0, packet;
  72588. while (bytes.length - byteIndex >= 3) {
  72589. var type3 = probe.aac.parseType(bytes, byteIndex);
  72590. switch (type3) {
  72591. case "timed-metadata":
  72592. if (bytes.length - byteIndex < 10) {
  72593. endLoop = true;
  72594. break;
  72595. }
  72596. frameSize = probe.aac.parseId3TagSize(bytes, byteIndex);
  72597. if (frameSize > bytes.length) {
  72598. endLoop = true;
  72599. break;
  72600. }
  72601. if (timestamp === null) {
  72602. packet = bytes.subarray(byteIndex, byteIndex + frameSize);
  72603. timestamp = probe.aac.parseAacTimestamp(packet);
  72604. }
  72605. byteIndex += frameSize;
  72606. break;
  72607. case "audio":
  72608. if (bytes.length - byteIndex < 7) {
  72609. endLoop = true;
  72610. break;
  72611. }
  72612. frameSize = probe.aac.parseAdtsSize(bytes, byteIndex);
  72613. if (frameSize > bytes.length) {
  72614. endLoop = true;
  72615. break;
  72616. }
  72617. if (sampleRate === null) {
  72618. packet = bytes.subarray(byteIndex, byteIndex + frameSize);
  72619. sampleRate = probe.aac.parseSampleRate(packet);
  72620. }
  72621. audioCount++;
  72622. byteIndex += frameSize;
  72623. break;
  72624. default:
  72625. byteIndex++;
  72626. break;
  72627. }
  72628. if (endLoop) {
  72629. return null;
  72630. }
  72631. }
  72632. if (sampleRate === null || timestamp === null) {
  72633. return null;
  72634. }
  72635. var audioTimescale = ONE_SECOND_IN_TS2 / sampleRate;
  72636. var result = {
  72637. audio: [{
  72638. type: "audio",
  72639. dts: timestamp,
  72640. pts: timestamp
  72641. }, {
  72642. type: "audio",
  72643. dts: timestamp + audioCount * 1024 * audioTimescale,
  72644. pts: timestamp + audioCount * 1024 * audioTimescale
  72645. }]
  72646. };
  72647. return result;
  72648. };
  72649. var inspectTs_ = function(bytes) {
  72650. var pmt = {
  72651. pid: null,
  72652. table: null
  72653. };
  72654. var result = {};
  72655. parsePsi_(bytes, pmt);
  72656. for (var pid in pmt.table) {
  72657. if (pmt.table.hasOwnProperty(pid)) {
  72658. var type3 = pmt.table[pid];
  72659. switch (type3) {
  72660. case StreamTypes.H264_STREAM_TYPE:
  72661. result.video = [];
  72662. parseVideoPes_(bytes, pmt, result);
  72663. if (result.video.length === 0) {
  72664. delete result.video;
  72665. }
  72666. break;
  72667. case StreamTypes.ADTS_STREAM_TYPE:
  72668. result.audio = [];
  72669. parseAudioPes_(bytes, pmt, result);
  72670. if (result.audio.length === 0) {
  72671. delete result.audio;
  72672. }
  72673. break;
  72674. }
  72675. }
  72676. }
  72677. return result;
  72678. };
  72679. var inspect = function(bytes, baseTimestamp) {
  72680. var isAacData = probe.aac.isLikelyAacData(bytes);
  72681. var result;
  72682. if (isAacData) {
  72683. result = inspectAac_(bytes);
  72684. } else {
  72685. result = inspectTs_(bytes);
  72686. }
  72687. if (!result || !result.audio && !result.video) {
  72688. return null;
  72689. }
  72690. adjustTimestamp_(result, baseTimestamp);
  72691. return result;
  72692. };
  72693. var tsInspector = {
  72694. inspect,
  72695. parseAudioPes_
  72696. };
  72697. const wireTransmuxerEvents = function(self2, transmuxer2) {
  72698. transmuxer2.on("data", function(segment) {
  72699. const initArray = segment.initSegment;
  72700. segment.initSegment = {
  72701. data: initArray.buffer,
  72702. byteOffset: initArray.byteOffset,
  72703. byteLength: initArray.byteLength
  72704. };
  72705. const typedArray2 = segment.data;
  72706. segment.data = typedArray2.buffer;
  72707. self2.postMessage({
  72708. action: "data",
  72709. segment,
  72710. byteOffset: typedArray2.byteOffset,
  72711. byteLength: typedArray2.byteLength
  72712. }, [segment.data]);
  72713. });
  72714. transmuxer2.on("done", function(data) {
  72715. self2.postMessage({
  72716. action: "done"
  72717. });
  72718. });
  72719. transmuxer2.on("gopInfo", function(gopInfo) {
  72720. self2.postMessage({
  72721. action: "gopInfo",
  72722. gopInfo
  72723. });
  72724. });
  72725. transmuxer2.on("videoSegmentTimingInfo", function(timingInfo) {
  72726. const videoSegmentTimingInfo = {
  72727. start: {
  72728. decode: clock$2.videoTsToSeconds(timingInfo.start.dts),
  72729. presentation: clock$2.videoTsToSeconds(timingInfo.start.pts)
  72730. },
  72731. end: {
  72732. decode: clock$2.videoTsToSeconds(timingInfo.end.dts),
  72733. presentation: clock$2.videoTsToSeconds(timingInfo.end.pts)
  72734. },
  72735. baseMediaDecodeTime: clock$2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)
  72736. };
  72737. if (timingInfo.prependedContentDuration) {
  72738. videoSegmentTimingInfo.prependedContentDuration = clock$2.videoTsToSeconds(timingInfo.prependedContentDuration);
  72739. }
  72740. self2.postMessage({
  72741. action: "videoSegmentTimingInfo",
  72742. videoSegmentTimingInfo
  72743. });
  72744. });
  72745. transmuxer2.on("audioSegmentTimingInfo", function(timingInfo) {
  72746. const audioSegmentTimingInfo = {
  72747. start: {
  72748. decode: clock$2.videoTsToSeconds(timingInfo.start.dts),
  72749. presentation: clock$2.videoTsToSeconds(timingInfo.start.pts)
  72750. },
  72751. end: {
  72752. decode: clock$2.videoTsToSeconds(timingInfo.end.dts),
  72753. presentation: clock$2.videoTsToSeconds(timingInfo.end.pts)
  72754. },
  72755. baseMediaDecodeTime: clock$2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)
  72756. };
  72757. if (timingInfo.prependedContentDuration) {
  72758. audioSegmentTimingInfo.prependedContentDuration = clock$2.videoTsToSeconds(timingInfo.prependedContentDuration);
  72759. }
  72760. self2.postMessage({
  72761. action: "audioSegmentTimingInfo",
  72762. audioSegmentTimingInfo
  72763. });
  72764. });
  72765. transmuxer2.on("id3Frame", function(id3Frame) {
  72766. self2.postMessage({
  72767. action: "id3Frame",
  72768. id3Frame
  72769. });
  72770. });
  72771. transmuxer2.on("caption", function(caption) {
  72772. self2.postMessage({
  72773. action: "caption",
  72774. caption
  72775. });
  72776. });
  72777. transmuxer2.on("trackinfo", function(trackInfo) {
  72778. self2.postMessage({
  72779. action: "trackinfo",
  72780. trackInfo
  72781. });
  72782. });
  72783. transmuxer2.on("audioTimingInfo", function(audioTimingInfo) {
  72784. self2.postMessage({
  72785. action: "audioTimingInfo",
  72786. audioTimingInfo: {
  72787. start: clock$2.videoTsToSeconds(audioTimingInfo.start),
  72788. end: clock$2.videoTsToSeconds(audioTimingInfo.end)
  72789. }
  72790. });
  72791. });
  72792. transmuxer2.on("videoTimingInfo", function(videoTimingInfo) {
  72793. self2.postMessage({
  72794. action: "videoTimingInfo",
  72795. videoTimingInfo: {
  72796. start: clock$2.videoTsToSeconds(videoTimingInfo.start),
  72797. end: clock$2.videoTsToSeconds(videoTimingInfo.end)
  72798. }
  72799. });
  72800. });
  72801. transmuxer2.on("log", function(log2) {
  72802. self2.postMessage({
  72803. action: "log",
  72804. log: log2
  72805. });
  72806. });
  72807. };
  72808. class MessageHandlers {
  72809. constructor(self2, options2) {
  72810. this.options = options2 || {};
  72811. this.self = self2;
  72812. this.init();
  72813. }
  72814. init() {
  72815. if (this.transmuxer) {
  72816. this.transmuxer.dispose();
  72817. }
  72818. this.transmuxer = new transmuxer.Transmuxer(this.options);
  72819. wireTransmuxerEvents(this.self, this.transmuxer);
  72820. }
  72821. pushMp4Captions(data) {
  72822. if (!this.captionParser) {
  72823. this.captionParser = new captionParser();
  72824. this.captionParser.init();
  72825. }
  72826. const segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);
  72827. const parsed = this.captionParser.parse(segment, data.trackIds, data.timescales);
  72828. this.self.postMessage({
  72829. action: "mp4Captions",
  72830. captions: parsed && parsed.captions || [],
  72831. logs: parsed && parsed.logs || [],
  72832. data: segment.buffer
  72833. }, [segment.buffer]);
  72834. }
  72835. probeMp4StartTime({
  72836. timescales,
  72837. data
  72838. }) {
  72839. const startTime2 = probe$2.startTime(timescales, data);
  72840. this.self.postMessage({
  72841. action: "probeMp4StartTime",
  72842. startTime: startTime2,
  72843. data
  72844. }, [data.buffer]);
  72845. }
  72846. probeMp4Tracks({
  72847. data
  72848. }) {
  72849. const tracks = probe$2.tracks(data);
  72850. this.self.postMessage({
  72851. action: "probeMp4Tracks",
  72852. tracks,
  72853. data
  72854. }, [data.buffer]);
  72855. }
  72856. probeTs({
  72857. data,
  72858. baseStartTime
  72859. }) {
  72860. const tsStartTime = typeof baseStartTime === "number" && !isNaN(baseStartTime) ? baseStartTime * clock$2.ONE_SECOND_IN_TS : void 0;
  72861. const timeInfo = tsInspector.inspect(data, tsStartTime);
  72862. let result = null;
  72863. if (timeInfo) {
  72864. result = {
  72865. hasVideo: timeInfo.video && timeInfo.video.length === 2 || false,
  72866. hasAudio: timeInfo.audio && timeInfo.audio.length === 2 || false
  72867. };
  72868. if (result.hasVideo) {
  72869. result.videoStart = timeInfo.video[0].ptsTime;
  72870. }
  72871. if (result.hasAudio) {
  72872. result.audioStart = timeInfo.audio[0].ptsTime;
  72873. }
  72874. }
  72875. this.self.postMessage({
  72876. action: "probeTs",
  72877. result,
  72878. data
  72879. }, [data.buffer]);
  72880. }
  72881. clearAllMp4Captions() {
  72882. if (this.captionParser) {
  72883. this.captionParser.clearAllCaptions();
  72884. }
  72885. }
  72886. clearParsedMp4Captions() {
  72887. if (this.captionParser) {
  72888. this.captionParser.clearParsedCaptions();
  72889. }
  72890. }
  72891. push(data) {
  72892. const segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);
  72893. this.transmuxer.push(segment);
  72894. }
  72895. reset() {
  72896. this.transmuxer.reset();
  72897. }
  72898. setTimestampOffset(data) {
  72899. const timestampOffset2 = data.timestampOffset || 0;
  72900. this.transmuxer.setBaseMediaDecodeTime(Math.round(clock$2.secondsToVideoTs(timestampOffset2)));
  72901. }
  72902. setAudioAppendStart(data) {
  72903. this.transmuxer.setAudioAppendStart(Math.ceil(clock$2.secondsToVideoTs(data.appendStart)));
  72904. }
  72905. setRemux(data) {
  72906. this.transmuxer.setRemux(data.remux);
  72907. }
  72908. flush(data) {
  72909. this.transmuxer.flush();
  72910. self.postMessage({
  72911. action: "done",
  72912. type: "transmuxed"
  72913. });
  72914. }
  72915. endTimeline() {
  72916. this.transmuxer.endTimeline();
  72917. self.postMessage({
  72918. action: "endedtimeline",
  72919. type: "transmuxed"
  72920. });
  72921. }
  72922. alignGopsWith(data) {
  72923. this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice());
  72924. }
  72925. }
  72926. self.onmessage = function(event2) {
  72927. if (event2.data.action === "init" && event2.data.options) {
  72928. this.messageHandlers = new MessageHandlers(self, event2.data.options);
  72929. return;
  72930. }
  72931. if (!this.messageHandlers) {
  72932. this.messageHandlers = new MessageHandlers(self);
  72933. }
  72934. if (event2.data && event2.data.action && event2.data.action !== "init") {
  72935. if (this.messageHandlers[event2.data.action]) {
  72936. this.messageHandlers[event2.data.action](event2.data);
  72937. }
  72938. }
  72939. };
  72940. }));
  72941. var TransmuxWorker$1 = factory$1(workerCode$1$1);
  72942. const handleData_$1 = (event2, transmuxedData, callback2) => {
  72943. const {
  72944. type: type2,
  72945. initSegment,
  72946. captions,
  72947. captionStreams,
  72948. metadata,
  72949. videoFrameDtsTime,
  72950. videoFramePtsTime
  72951. } = event2.data.segment;
  72952. transmuxedData.buffer.push({
  72953. captions,
  72954. captionStreams,
  72955. metadata
  72956. });
  72957. const boxes = event2.data.segment.boxes || {
  72958. data: event2.data.segment.data
  72959. };
  72960. const result = {
  72961. type: type2,
  72962. data: new Uint8Array(boxes.data, boxes.data.byteOffset, boxes.data.byteLength),
  72963. initSegment: new Uint8Array(initSegment.data, initSegment.byteOffset, initSegment.byteLength)
  72964. };
  72965. if (typeof videoFrameDtsTime !== "undefined") {
  72966. result.videoFrameDtsTime = videoFrameDtsTime;
  72967. }
  72968. if (typeof videoFramePtsTime !== "undefined") {
  72969. result.videoFramePtsTime = videoFramePtsTime;
  72970. }
  72971. callback2(result);
  72972. };
  72973. const handleDone_$1 = ({
  72974. transmuxedData,
  72975. callback: callback2
  72976. }) => {
  72977. transmuxedData.buffer = [];
  72978. callback2(transmuxedData);
  72979. };
  72980. const handleGopInfo_$1 = (event2, transmuxedData) => {
  72981. transmuxedData.gopInfo = event2.data.gopInfo;
  72982. };
  72983. const processTransmux$1 = (options2) => {
  72984. const {
  72985. transmuxer,
  72986. bytes,
  72987. audioAppendStart,
  72988. gopsToAlignWith,
  72989. remux,
  72990. onData,
  72991. onTrackInfo,
  72992. onAudioTimingInfo,
  72993. onVideoTimingInfo,
  72994. onVideoSegmentTimingInfo,
  72995. onAudioSegmentTimingInfo,
  72996. onId3,
  72997. onCaptions,
  72998. onDone,
  72999. onEndedTimeline,
  73000. onTransmuxerLog,
  73001. isEndOfTimeline
  73002. } = options2;
  73003. const transmuxedData = {
  73004. buffer: []
  73005. };
  73006. let waitForEndedTimelineEvent = isEndOfTimeline;
  73007. const handleMessage = (event2) => {
  73008. if (transmuxer.currentTransmux !== options2) {
  73009. return;
  73010. }
  73011. if (event2.data.action === "data") {
  73012. handleData_$1(event2, transmuxedData, onData);
  73013. }
  73014. if (event2.data.action === "trackinfo") {
  73015. onTrackInfo(event2.data.trackInfo);
  73016. }
  73017. if (event2.data.action === "gopInfo") {
  73018. handleGopInfo_$1(event2, transmuxedData);
  73019. }
  73020. if (event2.data.action === "audioTimingInfo") {
  73021. onAudioTimingInfo(event2.data.audioTimingInfo);
  73022. }
  73023. if (event2.data.action === "videoTimingInfo") {
  73024. onVideoTimingInfo(event2.data.videoTimingInfo);
  73025. }
  73026. if (event2.data.action === "videoSegmentTimingInfo") {
  73027. onVideoSegmentTimingInfo(event2.data.videoSegmentTimingInfo);
  73028. }
  73029. if (event2.data.action === "audioSegmentTimingInfo") {
  73030. onAudioSegmentTimingInfo(event2.data.audioSegmentTimingInfo);
  73031. }
  73032. if (event2.data.action === "id3Frame") {
  73033. onId3([event2.data.id3Frame], event2.data.id3Frame.dispatchType);
  73034. }
  73035. if (event2.data.action === "caption") {
  73036. onCaptions(event2.data.caption);
  73037. }
  73038. if (event2.data.action === "endedtimeline") {
  73039. waitForEndedTimelineEvent = false;
  73040. onEndedTimeline();
  73041. }
  73042. if (event2.data.action === "log") {
  73043. onTransmuxerLog(event2.data.log);
  73044. }
  73045. if (event2.data.type !== "transmuxed") {
  73046. return;
  73047. }
  73048. if (waitForEndedTimelineEvent) {
  73049. return;
  73050. }
  73051. transmuxer.onmessage = null;
  73052. handleDone_$1({
  73053. transmuxedData,
  73054. callback: onDone
  73055. });
  73056. dequeue$1(transmuxer);
  73057. };
  73058. transmuxer.onmessage = handleMessage;
  73059. if (audioAppendStart) {
  73060. transmuxer.postMessage({
  73061. action: "setAudioAppendStart",
  73062. appendStart: audioAppendStart
  73063. });
  73064. }
  73065. if (Array.isArray(gopsToAlignWith)) {
  73066. transmuxer.postMessage({
  73067. action: "alignGopsWith",
  73068. gopsToAlignWith
  73069. });
  73070. }
  73071. if (typeof remux !== "undefined") {
  73072. transmuxer.postMessage({
  73073. action: "setRemux",
  73074. remux
  73075. });
  73076. }
  73077. if (bytes.byteLength) {
  73078. const buffer = bytes instanceof ArrayBuffer ? bytes : bytes.buffer;
  73079. const byteOffset = bytes instanceof ArrayBuffer ? 0 : bytes.byteOffset;
  73080. transmuxer.postMessage({
  73081. action: "push",
  73082. data: buffer,
  73083. byteOffset,
  73084. byteLength: bytes.byteLength
  73085. }, [buffer]);
  73086. }
  73087. if (isEndOfTimeline) {
  73088. transmuxer.postMessage({
  73089. action: "endTimeline"
  73090. });
  73091. }
  73092. transmuxer.postMessage({
  73093. action: "flush"
  73094. });
  73095. };
  73096. const dequeue$1 = (transmuxer) => {
  73097. transmuxer.currentTransmux = null;
  73098. if (transmuxer.transmuxQueue.length) {
  73099. transmuxer.currentTransmux = transmuxer.transmuxQueue.shift();
  73100. if (typeof transmuxer.currentTransmux === "function") {
  73101. transmuxer.currentTransmux();
  73102. } else {
  73103. processTransmux$1(transmuxer.currentTransmux);
  73104. }
  73105. }
  73106. };
  73107. const processAction$1 = (transmuxer, action) => {
  73108. transmuxer.postMessage({
  73109. action
  73110. });
  73111. dequeue$1(transmuxer);
  73112. };
  73113. const enqueueAction$1 = (action, transmuxer) => {
  73114. if (!transmuxer.currentTransmux) {
  73115. transmuxer.currentTransmux = action;
  73116. processAction$1(transmuxer, action);
  73117. return;
  73118. }
  73119. transmuxer.transmuxQueue.push(processAction$1.bind(null, transmuxer, action));
  73120. };
  73121. const reset$1 = (transmuxer) => {
  73122. enqueueAction$1("reset", transmuxer);
  73123. };
  73124. const endTimeline$1 = (transmuxer) => {
  73125. enqueueAction$1("endTimeline", transmuxer);
  73126. };
  73127. const transmux$1 = (options2) => {
  73128. if (!options2.transmuxer.currentTransmux) {
  73129. options2.transmuxer.currentTransmux = options2;
  73130. processTransmux$1(options2);
  73131. return;
  73132. }
  73133. options2.transmuxer.transmuxQueue.push(options2);
  73134. };
  73135. const createTransmuxer$1 = (options2) => {
  73136. const transmuxer = new TransmuxWorker$1();
  73137. transmuxer.currentTransmux = null;
  73138. transmuxer.transmuxQueue = [];
  73139. const term = transmuxer.terminate;
  73140. transmuxer.terminate = () => {
  73141. transmuxer.currentTransmux = null;
  73142. transmuxer.transmuxQueue.length = 0;
  73143. return term.call(transmuxer);
  73144. };
  73145. transmuxer.postMessage({
  73146. action: "init",
  73147. options: options2
  73148. });
  73149. return transmuxer;
  73150. };
  73151. var segmentTransmuxer$1 = {
  73152. reset: reset$1,
  73153. endTimeline: endTimeline$1,
  73154. transmux: transmux$1,
  73155. createTransmuxer: createTransmuxer$1
  73156. };
  73157. const workerCallback$1 = function(options2) {
  73158. const transmuxer = options2.transmuxer;
  73159. const endAction = options2.endAction || options2.action;
  73160. const callback2 = options2.callback;
  73161. const message = _extends$2({}, options2, {
  73162. endAction: null,
  73163. transmuxer: null,
  73164. callback: null
  73165. });
  73166. const listenForEndEvent = (event2) => {
  73167. if (event2.data.action !== endAction) {
  73168. return;
  73169. }
  73170. transmuxer.removeEventListener("message", listenForEndEvent);
  73171. if (event2.data.data) {
  73172. event2.data.data = new Uint8Array(event2.data.data, options2.byteOffset || 0, options2.byteLength || event2.data.data.byteLength);
  73173. if (options2.data) {
  73174. options2.data = event2.data.data;
  73175. }
  73176. }
  73177. callback2(event2.data);
  73178. };
  73179. transmuxer.addEventListener("message", listenForEndEvent);
  73180. if (options2.data) {
  73181. const isArrayBuffer = options2.data instanceof ArrayBuffer;
  73182. message.byteOffset = isArrayBuffer ? 0 : options2.data.byteOffset;
  73183. message.byteLength = options2.data.byteLength;
  73184. const transfers = [isArrayBuffer ? options2.data : options2.data.buffer];
  73185. transmuxer.postMessage(message, transfers);
  73186. } else {
  73187. transmuxer.postMessage(message);
  73188. }
  73189. };
  73190. const REQUEST_ERRORS$1 = {
  73191. FAILURE: 2,
  73192. TIMEOUT: -101,
  73193. ABORTED: -102
  73194. };
  73195. const abortAll$1 = (activeXhrs) => {
  73196. activeXhrs.forEach((xhr) => {
  73197. xhr.abort();
  73198. });
  73199. };
  73200. const getRequestStats$1 = (request) => {
  73201. return {
  73202. bandwidth: request.bandwidth,
  73203. bytesReceived: request.bytesReceived || 0,
  73204. roundTripTime: request.roundTripTime || 0
  73205. };
  73206. };
  73207. const getProgressStats$1 = (progressEvent) => {
  73208. const request = progressEvent.target;
  73209. const roundTripTime = Date.now() - request.requestTime;
  73210. const stats = {
  73211. bandwidth: Infinity,
  73212. bytesReceived: 0,
  73213. roundTripTime: roundTripTime || 0
  73214. };
  73215. stats.bytesReceived = progressEvent.loaded;
  73216. stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1e3);
  73217. return stats;
  73218. };
  73219. const handleErrors$1 = (error, request) => {
  73220. if (request.timedout) {
  73221. return {
  73222. status: request.status,
  73223. message: "HLS request timed-out at URL: " + request.uri,
  73224. code: REQUEST_ERRORS$1.TIMEOUT,
  73225. xhr: request
  73226. };
  73227. }
  73228. if (request.aborted) {
  73229. return {
  73230. status: request.status,
  73231. message: "HLS request aborted at URL: " + request.uri,
  73232. code: REQUEST_ERRORS$1.ABORTED,
  73233. xhr: request
  73234. };
  73235. }
  73236. if (error) {
  73237. return {
  73238. status: request.status,
  73239. message: "HLS request errored at URL: " + request.uri,
  73240. code: REQUEST_ERRORS$1.FAILURE,
  73241. xhr: request
  73242. };
  73243. }
  73244. if (request.responseType === "arraybuffer" && request.response.byteLength === 0) {
  73245. return {
  73246. status: request.status,
  73247. message: "Empty HLS response at URL: " + request.uri,
  73248. code: REQUEST_ERRORS$1.FAILURE,
  73249. xhr: request
  73250. };
  73251. }
  73252. return null;
  73253. };
  73254. const handleKeyResponse$1 = (segment, objects, finishProcessingFn) => (error, request) => {
  73255. const response = request.response;
  73256. const errorObj = handleErrors$1(error, request);
  73257. if (errorObj) {
  73258. return finishProcessingFn(errorObj, segment);
  73259. }
  73260. if (response.byteLength !== 16) {
  73261. return finishProcessingFn({
  73262. status: request.status,
  73263. message: "Invalid HLS key at URL: " + request.uri,
  73264. code: REQUEST_ERRORS$1.FAILURE,
  73265. xhr: request
  73266. }, segment);
  73267. }
  73268. const view = new DataView(response);
  73269. const bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]);
  73270. for (let i2 = 0; i2 < objects.length; i2++) {
  73271. objects[i2].bytes = bytes;
  73272. }
  73273. return finishProcessingFn(null, segment);
  73274. };
  73275. const parseInitSegment$1 = (segment, callback2) => {
  73276. const type2 = detectContainerForBytes$1(segment.map.bytes);
  73277. if (type2 !== "mp4") {
  73278. const uri = segment.map.resolvedUri || segment.map.uri;
  73279. return callback2({
  73280. internal: true,
  73281. message: `Found unsupported ${type2 || "unknown"} container for initialization segment at URL: ${uri}`,
  73282. code: REQUEST_ERRORS$1.FAILURE
  73283. });
  73284. }
  73285. workerCallback$1({
  73286. action: "probeMp4Tracks",
  73287. data: segment.map.bytes,
  73288. transmuxer: segment.transmuxer,
  73289. callback: ({
  73290. tracks,
  73291. data
  73292. }) => {
  73293. segment.map.bytes = data;
  73294. tracks.forEach(function(track) {
  73295. segment.map.tracks = segment.map.tracks || {};
  73296. if (segment.map.tracks[track.type]) {
  73297. return;
  73298. }
  73299. segment.map.tracks[track.type] = track;
  73300. if (typeof track.id === "number" && track.timescale) {
  73301. segment.map.timescales = segment.map.timescales || {};
  73302. segment.map.timescales[track.id] = track.timescale;
  73303. }
  73304. });
  73305. return callback2(null);
  73306. }
  73307. });
  73308. };
  73309. const handleInitSegmentResponse$1 = ({
  73310. segment,
  73311. finishProcessingFn
  73312. }) => (error, request) => {
  73313. const errorObj = handleErrors$1(error, request);
  73314. if (errorObj) {
  73315. return finishProcessingFn(errorObj, segment);
  73316. }
  73317. const bytes = new Uint8Array(request.response);
  73318. if (segment.map.key) {
  73319. segment.map.encryptedBytes = bytes;
  73320. return finishProcessingFn(null, segment);
  73321. }
  73322. segment.map.bytes = bytes;
  73323. parseInitSegment$1(segment, function(parseError) {
  73324. if (parseError) {
  73325. parseError.xhr = request;
  73326. parseError.status = request.status;
  73327. return finishProcessingFn(parseError, segment);
  73328. }
  73329. finishProcessingFn(null, segment);
  73330. });
  73331. };
  73332. const handleSegmentResponse$1 = ({
  73333. segment,
  73334. finishProcessingFn,
  73335. responseType
  73336. }) => (error, request) => {
  73337. const errorObj = handleErrors$1(error, request);
  73338. if (errorObj) {
  73339. return finishProcessingFn(errorObj, segment);
  73340. }
  73341. const newBytes = responseType === "arraybuffer" || !request.responseText ? request.response : stringToArrayBuffer$1(request.responseText.substring(segment.lastReachedChar || 0));
  73342. segment.stats = getRequestStats$1(request);
  73343. if (segment.key) {
  73344. segment.encryptedBytes = new Uint8Array(newBytes);
  73345. } else {
  73346. segment.bytes = new Uint8Array(newBytes);
  73347. }
  73348. return finishProcessingFn(null, segment);
  73349. };
  73350. const transmuxAndNotify$1 = ({
  73351. segment,
  73352. bytes,
  73353. trackInfoFn,
  73354. timingInfoFn,
  73355. videoSegmentTimingInfoFn,
  73356. audioSegmentTimingInfoFn,
  73357. id3Fn,
  73358. captionsFn,
  73359. isEndOfTimeline,
  73360. endedTimelineFn,
  73361. dataFn,
  73362. doneFn,
  73363. onTransmuxerLog
  73364. }) => {
  73365. const fmp4Tracks = segment.map && segment.map.tracks || {};
  73366. const isMuxed3 = Boolean(fmp4Tracks.audio && fmp4Tracks.video);
  73367. let audioStartFn = timingInfoFn.bind(null, segment, "audio", "start");
  73368. const audioEndFn = timingInfoFn.bind(null, segment, "audio", "end");
  73369. let videoStartFn = timingInfoFn.bind(null, segment, "video", "start");
  73370. const videoEndFn = timingInfoFn.bind(null, segment, "video", "end");
  73371. const finish = () => transmux$1({
  73372. bytes,
  73373. transmuxer: segment.transmuxer,
  73374. audioAppendStart: segment.audioAppendStart,
  73375. gopsToAlignWith: segment.gopsToAlignWith,
  73376. remux: isMuxed3,
  73377. onData: (result) => {
  73378. result.type = result.type === "combined" ? "video" : result.type;
  73379. dataFn(segment, result);
  73380. },
  73381. onTrackInfo: (trackInfo) => {
  73382. if (trackInfoFn) {
  73383. if (isMuxed3) {
  73384. trackInfo.isMuxed = true;
  73385. }
  73386. trackInfoFn(segment, trackInfo);
  73387. }
  73388. },
  73389. onAudioTimingInfo: (audioTimingInfo) => {
  73390. if (audioStartFn && typeof audioTimingInfo.start !== "undefined") {
  73391. audioStartFn(audioTimingInfo.start);
  73392. audioStartFn = null;
  73393. }
  73394. if (audioEndFn && typeof audioTimingInfo.end !== "undefined") {
  73395. audioEndFn(audioTimingInfo.end);
  73396. }
  73397. },
  73398. onVideoTimingInfo: (videoTimingInfo) => {
  73399. if (videoStartFn && typeof videoTimingInfo.start !== "undefined") {
  73400. videoStartFn(videoTimingInfo.start);
  73401. videoStartFn = null;
  73402. }
  73403. if (videoEndFn && typeof videoTimingInfo.end !== "undefined") {
  73404. videoEndFn(videoTimingInfo.end);
  73405. }
  73406. },
  73407. onVideoSegmentTimingInfo: (videoSegmentTimingInfo) => {
  73408. videoSegmentTimingInfoFn(videoSegmentTimingInfo);
  73409. },
  73410. onAudioSegmentTimingInfo: (audioSegmentTimingInfo) => {
  73411. audioSegmentTimingInfoFn(audioSegmentTimingInfo);
  73412. },
  73413. onId3: (id3Frames, dispatchType) => {
  73414. id3Fn(segment, id3Frames, dispatchType);
  73415. },
  73416. onCaptions: (captions) => {
  73417. captionsFn(segment, [captions]);
  73418. },
  73419. isEndOfTimeline,
  73420. onEndedTimeline: () => {
  73421. endedTimelineFn();
  73422. },
  73423. onTransmuxerLog,
  73424. onDone: (result) => {
  73425. if (!doneFn) {
  73426. return;
  73427. }
  73428. result.type = result.type === "combined" ? "video" : result.type;
  73429. doneFn(null, segment, result);
  73430. }
  73431. });
  73432. workerCallback$1({
  73433. action: "probeTs",
  73434. transmuxer: segment.transmuxer,
  73435. data: bytes,
  73436. baseStartTime: segment.baseStartTime,
  73437. callback: (data) => {
  73438. segment.bytes = bytes = data.data;
  73439. const probeResult = data.result;
  73440. if (probeResult) {
  73441. trackInfoFn(segment, {
  73442. hasAudio: probeResult.hasAudio,
  73443. hasVideo: probeResult.hasVideo,
  73444. isMuxed: isMuxed3
  73445. });
  73446. trackInfoFn = null;
  73447. if (probeResult.hasAudio && !isMuxed3) {
  73448. audioStartFn(probeResult.audioStart);
  73449. }
  73450. if (probeResult.hasVideo) {
  73451. videoStartFn(probeResult.videoStart);
  73452. }
  73453. audioStartFn = null;
  73454. videoStartFn = null;
  73455. }
  73456. finish();
  73457. }
  73458. });
  73459. };
  73460. const handleSegmentBytes$1 = ({
  73461. segment,
  73462. bytes,
  73463. trackInfoFn,
  73464. timingInfoFn,
  73465. videoSegmentTimingInfoFn,
  73466. audioSegmentTimingInfoFn,
  73467. id3Fn,
  73468. captionsFn,
  73469. isEndOfTimeline,
  73470. endedTimelineFn,
  73471. dataFn,
  73472. doneFn,
  73473. onTransmuxerLog
  73474. }) => {
  73475. let bytesAsUint8Array = new Uint8Array(bytes);
  73476. if (isLikelyFmp4MediaSegment$1(bytesAsUint8Array)) {
  73477. segment.isFmp4 = true;
  73478. const {
  73479. tracks
  73480. } = segment.map;
  73481. const trackInfo = {
  73482. isFmp4: true,
  73483. hasVideo: !!tracks.video,
  73484. hasAudio: !!tracks.audio
  73485. };
  73486. if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== "enca") {
  73487. trackInfo.audioCodec = tracks.audio.codec;
  73488. }
  73489. if (tracks.video && tracks.video.codec && tracks.video.codec !== "encv") {
  73490. trackInfo.videoCodec = tracks.video.codec;
  73491. }
  73492. if (tracks.video && tracks.audio) {
  73493. trackInfo.isMuxed = true;
  73494. }
  73495. trackInfoFn(segment, trackInfo);
  73496. const finishLoading = (captions) => {
  73497. dataFn(segment, {
  73498. data: bytesAsUint8Array,
  73499. type: trackInfo.hasAudio && !trackInfo.isMuxed ? "audio" : "video"
  73500. });
  73501. if (captions && captions.length) {
  73502. captionsFn(segment, captions);
  73503. }
  73504. doneFn(null, segment, {});
  73505. };
  73506. workerCallback$1({
  73507. action: "probeMp4StartTime",
  73508. timescales: segment.map.timescales,
  73509. data: bytesAsUint8Array,
  73510. transmuxer: segment.transmuxer,
  73511. callback: ({
  73512. data,
  73513. startTime
  73514. }) => {
  73515. bytes = data.buffer;
  73516. segment.bytes = bytesAsUint8Array = data;
  73517. if (trackInfo.hasAudio && !trackInfo.isMuxed) {
  73518. timingInfoFn(segment, "audio", "start", startTime);
  73519. }
  73520. if (trackInfo.hasVideo) {
  73521. timingInfoFn(segment, "video", "start", startTime);
  73522. }
  73523. if (!tracks.video || !data.byteLength || !segment.transmuxer) {
  73524. finishLoading();
  73525. return;
  73526. }
  73527. workerCallback$1({
  73528. action: "pushMp4Captions",
  73529. endAction: "mp4Captions",
  73530. transmuxer: segment.transmuxer,
  73531. data: bytesAsUint8Array,
  73532. timescales: segment.map.timescales,
  73533. trackIds: [tracks.video.id],
  73534. callback: (message) => {
  73535. bytes = message.data.buffer;
  73536. segment.bytes = bytesAsUint8Array = message.data;
  73537. message.logs.forEach(function(log2) {
  73538. onTransmuxerLog(merge$2(log2, {
  73539. stream: "mp4CaptionParser"
  73540. }));
  73541. });
  73542. finishLoading(message.captions);
  73543. }
  73544. });
  73545. }
  73546. });
  73547. return;
  73548. }
  73549. if (!segment.transmuxer) {
  73550. doneFn(null, segment, {});
  73551. return;
  73552. }
  73553. if (typeof segment.container === "undefined") {
  73554. segment.container = detectContainerForBytes$1(bytesAsUint8Array);
  73555. }
  73556. if (segment.container !== "ts" && segment.container !== "aac") {
  73557. trackInfoFn(segment, {
  73558. hasAudio: false,
  73559. hasVideo: false
  73560. });
  73561. doneFn(null, segment, {});
  73562. return;
  73563. }
  73564. transmuxAndNotify$1({
  73565. segment,
  73566. bytes,
  73567. trackInfoFn,
  73568. timingInfoFn,
  73569. videoSegmentTimingInfoFn,
  73570. audioSegmentTimingInfoFn,
  73571. id3Fn,
  73572. captionsFn,
  73573. isEndOfTimeline,
  73574. endedTimelineFn,
  73575. dataFn,
  73576. doneFn,
  73577. onTransmuxerLog
  73578. });
  73579. };
  73580. const decrypt$1 = function({
  73581. id,
  73582. key,
  73583. encryptedBytes,
  73584. decryptionWorker
  73585. }, callback2) {
  73586. const decryptionHandler = (event2) => {
  73587. if (event2.data.source === id) {
  73588. decryptionWorker.removeEventListener("message", decryptionHandler);
  73589. const decrypted = event2.data.decrypted;
  73590. callback2(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength));
  73591. }
  73592. };
  73593. decryptionWorker.addEventListener("message", decryptionHandler);
  73594. let keyBytes;
  73595. if (key.bytes.slice) {
  73596. keyBytes = key.bytes.slice();
  73597. } else {
  73598. keyBytes = new Uint32Array(Array.prototype.slice.call(key.bytes));
  73599. }
  73600. decryptionWorker.postMessage(createTransferableMessage$1({
  73601. source: id,
  73602. encrypted: encryptedBytes,
  73603. key: keyBytes,
  73604. iv: key.iv
  73605. }), [encryptedBytes.buffer, keyBytes.buffer]);
  73606. };
  73607. const decryptSegment$1 = ({
  73608. decryptionWorker,
  73609. segment,
  73610. trackInfoFn,
  73611. timingInfoFn,
  73612. videoSegmentTimingInfoFn,
  73613. audioSegmentTimingInfoFn,
  73614. id3Fn,
  73615. captionsFn,
  73616. isEndOfTimeline,
  73617. endedTimelineFn,
  73618. dataFn,
  73619. doneFn,
  73620. onTransmuxerLog
  73621. }) => {
  73622. decrypt$1({
  73623. id: segment.requestId,
  73624. key: segment.key,
  73625. encryptedBytes: segment.encryptedBytes,
  73626. decryptionWorker
  73627. }, (decryptedBytes) => {
  73628. segment.bytes = decryptedBytes;
  73629. handleSegmentBytes$1({
  73630. segment,
  73631. bytes: segment.bytes,
  73632. trackInfoFn,
  73633. timingInfoFn,
  73634. videoSegmentTimingInfoFn,
  73635. audioSegmentTimingInfoFn,
  73636. id3Fn,
  73637. captionsFn,
  73638. isEndOfTimeline,
  73639. endedTimelineFn,
  73640. dataFn,
  73641. doneFn,
  73642. onTransmuxerLog
  73643. });
  73644. });
  73645. };
  73646. const waitForCompletion$1 = ({
  73647. activeXhrs,
  73648. decryptionWorker,
  73649. trackInfoFn,
  73650. timingInfoFn,
  73651. videoSegmentTimingInfoFn,
  73652. audioSegmentTimingInfoFn,
  73653. id3Fn,
  73654. captionsFn,
  73655. isEndOfTimeline,
  73656. endedTimelineFn,
  73657. dataFn,
  73658. doneFn,
  73659. onTransmuxerLog
  73660. }) => {
  73661. let count = 0;
  73662. let didError = false;
  73663. return (error, segment) => {
  73664. if (didError) {
  73665. return;
  73666. }
  73667. if (error) {
  73668. didError = true;
  73669. abortAll$1(activeXhrs);
  73670. return doneFn(error, segment);
  73671. }
  73672. count += 1;
  73673. if (count === activeXhrs.length) {
  73674. const segmentFinish = function() {
  73675. if (segment.encryptedBytes) {
  73676. return decryptSegment$1({
  73677. decryptionWorker,
  73678. segment,
  73679. trackInfoFn,
  73680. timingInfoFn,
  73681. videoSegmentTimingInfoFn,
  73682. audioSegmentTimingInfoFn,
  73683. id3Fn,
  73684. captionsFn,
  73685. isEndOfTimeline,
  73686. endedTimelineFn,
  73687. dataFn,
  73688. doneFn,
  73689. onTransmuxerLog
  73690. });
  73691. }
  73692. handleSegmentBytes$1({
  73693. segment,
  73694. bytes: segment.bytes,
  73695. trackInfoFn,
  73696. timingInfoFn,
  73697. videoSegmentTimingInfoFn,
  73698. audioSegmentTimingInfoFn,
  73699. id3Fn,
  73700. captionsFn,
  73701. isEndOfTimeline,
  73702. endedTimelineFn,
  73703. dataFn,
  73704. doneFn,
  73705. onTransmuxerLog
  73706. });
  73707. };
  73708. segment.endOfAllRequests = Date.now();
  73709. if (segment.map && segment.map.encryptedBytes && !segment.map.bytes) {
  73710. return decrypt$1({
  73711. decryptionWorker,
  73712. id: segment.requestId + "-init",
  73713. encryptedBytes: segment.map.encryptedBytes,
  73714. key: segment.map.key
  73715. }, (decryptedBytes) => {
  73716. segment.map.bytes = decryptedBytes;
  73717. parseInitSegment$1(segment, (parseError) => {
  73718. if (parseError) {
  73719. abortAll$1(activeXhrs);
  73720. return doneFn(parseError, segment);
  73721. }
  73722. segmentFinish();
  73723. });
  73724. });
  73725. }
  73726. segmentFinish();
  73727. }
  73728. };
  73729. };
  73730. const handleLoadEnd$1 = ({
  73731. loadendState,
  73732. abortFn
  73733. }) => (event2) => {
  73734. const request = event2.target;
  73735. if (request.aborted && abortFn && !loadendState.calledAbortFn) {
  73736. abortFn();
  73737. loadendState.calledAbortFn = true;
  73738. }
  73739. };
  73740. const handleProgress$1 = ({
  73741. segment,
  73742. progressFn,
  73743. trackInfoFn,
  73744. timingInfoFn,
  73745. videoSegmentTimingInfoFn,
  73746. audioSegmentTimingInfoFn,
  73747. id3Fn,
  73748. captionsFn,
  73749. isEndOfTimeline,
  73750. endedTimelineFn,
  73751. dataFn
  73752. }) => (event2) => {
  73753. const request = event2.target;
  73754. if (request.aborted) {
  73755. return;
  73756. }
  73757. segment.stats = merge$2(segment.stats, getProgressStats$1(event2));
  73758. if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) {
  73759. segment.stats.firstBytesReceivedAt = Date.now();
  73760. }
  73761. return progressFn(event2, segment);
  73762. };
  73763. const mediaSegmentRequest$1 = ({
  73764. xhr,
  73765. xhrOptions,
  73766. decryptionWorker,
  73767. segment,
  73768. abortFn,
  73769. progressFn,
  73770. trackInfoFn,
  73771. timingInfoFn,
  73772. videoSegmentTimingInfoFn,
  73773. audioSegmentTimingInfoFn,
  73774. id3Fn,
  73775. captionsFn,
  73776. isEndOfTimeline,
  73777. endedTimelineFn,
  73778. dataFn,
  73779. doneFn,
  73780. onTransmuxerLog
  73781. }) => {
  73782. const activeXhrs = [];
  73783. const finishProcessingFn = waitForCompletion$1({
  73784. activeXhrs,
  73785. decryptionWorker,
  73786. trackInfoFn,
  73787. timingInfoFn,
  73788. videoSegmentTimingInfoFn,
  73789. audioSegmentTimingInfoFn,
  73790. id3Fn,
  73791. captionsFn,
  73792. isEndOfTimeline,
  73793. endedTimelineFn,
  73794. dataFn,
  73795. doneFn,
  73796. onTransmuxerLog
  73797. });
  73798. if (segment.key && !segment.key.bytes) {
  73799. const objects = [segment.key];
  73800. if (segment.map && !segment.map.bytes && segment.map.key && segment.map.key.resolvedUri === segment.key.resolvedUri) {
  73801. objects.push(segment.map.key);
  73802. }
  73803. const keyRequestOptions = merge$2(xhrOptions, {
  73804. uri: segment.key.resolvedUri,
  73805. responseType: "arraybuffer"
  73806. });
  73807. const keyRequestCallback = handleKeyResponse$1(segment, objects, finishProcessingFn);
  73808. const keyXhr = xhr(keyRequestOptions, keyRequestCallback);
  73809. activeXhrs.push(keyXhr);
  73810. }
  73811. if (segment.map && !segment.map.bytes) {
  73812. const differentMapKey = segment.map.key && (!segment.key || segment.key.resolvedUri !== segment.map.key.resolvedUri);
  73813. if (differentMapKey) {
  73814. const mapKeyRequestOptions = merge$2(xhrOptions, {
  73815. uri: segment.map.key.resolvedUri,
  73816. responseType: "arraybuffer"
  73817. });
  73818. const mapKeyRequestCallback = handleKeyResponse$1(segment, [segment.map.key], finishProcessingFn);
  73819. const mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback);
  73820. activeXhrs.push(mapKeyXhr);
  73821. }
  73822. const initSegmentOptions = merge$2(xhrOptions, {
  73823. uri: segment.map.resolvedUri,
  73824. responseType: "arraybuffer",
  73825. headers: segmentXhrHeaders$1(segment.map)
  73826. });
  73827. const initSegmentRequestCallback = handleInitSegmentResponse$1({
  73828. segment,
  73829. finishProcessingFn
  73830. });
  73831. const initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback);
  73832. activeXhrs.push(initSegmentXhr);
  73833. }
  73834. const segmentRequestOptions = merge$2(xhrOptions, {
  73835. uri: segment.part && segment.part.resolvedUri || segment.resolvedUri,
  73836. responseType: "arraybuffer",
  73837. headers: segmentXhrHeaders$1(segment)
  73838. });
  73839. const segmentRequestCallback = handleSegmentResponse$1({
  73840. segment,
  73841. finishProcessingFn,
  73842. responseType: segmentRequestOptions.responseType
  73843. });
  73844. const segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback);
  73845. segmentXhr.addEventListener("progress", handleProgress$1({
  73846. segment,
  73847. progressFn,
  73848. trackInfoFn,
  73849. timingInfoFn,
  73850. videoSegmentTimingInfoFn,
  73851. audioSegmentTimingInfoFn,
  73852. id3Fn,
  73853. captionsFn,
  73854. isEndOfTimeline,
  73855. endedTimelineFn,
  73856. dataFn
  73857. }));
  73858. activeXhrs.push(segmentXhr);
  73859. const loadendState = {};
  73860. activeXhrs.forEach((activeXhr) => {
  73861. activeXhr.addEventListener("loadend", handleLoadEnd$1({
  73862. loadendState,
  73863. abortFn
  73864. }));
  73865. });
  73866. return () => abortAll$1(activeXhrs);
  73867. };
  73868. const logFn$1$1 = logger$1("CodecUtils");
  73869. const getCodecs$1 = function(media) {
  73870. const mediaAttributes = media.attributes || {};
  73871. if (mediaAttributes.CODECS) {
  73872. return parseCodecs$1(mediaAttributes.CODECS);
  73873. }
  73874. };
  73875. const isMaat$1 = (main, media) => {
  73876. const mediaAttributes = media.attributes || {};
  73877. return main && main.mediaGroups && main.mediaGroups.AUDIO && mediaAttributes.AUDIO && main.mediaGroups.AUDIO[mediaAttributes.AUDIO];
  73878. };
  73879. const isMuxed$1 = (main, media) => {
  73880. if (!isMaat$1(main, media)) {
  73881. return true;
  73882. }
  73883. const mediaAttributes = media.attributes || {};
  73884. const audioGroup = main.mediaGroups.AUDIO[mediaAttributes.AUDIO];
  73885. for (const groupId in audioGroup) {
  73886. if (!audioGroup[groupId].uri && !audioGroup[groupId].playlists) {
  73887. return true;
  73888. }
  73889. }
  73890. return false;
  73891. };
  73892. const unwrapCodecList$1 = function(codecList) {
  73893. const codecs = {};
  73894. codecList.forEach(({
  73895. mediaType,
  73896. type: type2,
  73897. details
  73898. }) => {
  73899. codecs[mediaType] = codecs[mediaType] || [];
  73900. codecs[mediaType].push(translateLegacyCodec$1(`${type2}${details}`));
  73901. });
  73902. Object.keys(codecs).forEach(function(mediaType) {
  73903. if (codecs[mediaType].length > 1) {
  73904. logFn$1$1(`multiple ${mediaType} codecs found as attributes: ${codecs[mediaType].join(", ")}. Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.`);
  73905. codecs[mediaType] = null;
  73906. return;
  73907. }
  73908. codecs[mediaType] = codecs[mediaType][0];
  73909. });
  73910. return codecs;
  73911. };
  73912. const codecCount$1 = function(codecObj) {
  73913. let count = 0;
  73914. if (codecObj.audio) {
  73915. count++;
  73916. }
  73917. if (codecObj.video) {
  73918. count++;
  73919. }
  73920. return count;
  73921. };
  73922. const codecsForPlaylist$1 = function(main, media) {
  73923. const mediaAttributes = media.attributes || {};
  73924. const codecInfo = unwrapCodecList$1(getCodecs$1(media) || []);
  73925. if (isMaat$1(main, media) && !codecInfo.audio) {
  73926. if (!isMuxed$1(main, media)) {
  73927. const defaultCodecs = unwrapCodecList$1(codecsFromDefault$1(main, mediaAttributes.AUDIO) || []);
  73928. if (defaultCodecs.audio) {
  73929. codecInfo.audio = defaultCodecs.audio;
  73930. }
  73931. }
  73932. }
  73933. return codecInfo;
  73934. };
  73935. const logFn$2 = logger$1("PlaylistSelector");
  73936. const representationToString$1 = function(representation) {
  73937. if (!representation || !representation.playlist) {
  73938. return;
  73939. }
  73940. const playlist = representation.playlist;
  73941. return JSON.stringify({
  73942. id: playlist.id,
  73943. bandwidth: representation.bandwidth,
  73944. width: representation.width,
  73945. height: representation.height,
  73946. codecs: playlist.attributes && playlist.attributes.CODECS || ""
  73947. });
  73948. };
  73949. const safeGetComputedStyle$1 = function(el, property) {
  73950. if (!el) {
  73951. return "";
  73952. }
  73953. const result = window_1.getComputedStyle(el);
  73954. if (!result) {
  73955. return "";
  73956. }
  73957. return result[property];
  73958. };
  73959. const stableSort$1 = function(array, sortFn) {
  73960. const newArray = array.slice();
  73961. array.sort(function(left, right) {
  73962. const cmp = sortFn(left, right);
  73963. if (cmp === 0) {
  73964. return newArray.indexOf(left) - newArray.indexOf(right);
  73965. }
  73966. return cmp;
  73967. });
  73968. };
  73969. const comparePlaylistBandwidth$1 = function(left, right) {
  73970. let leftBandwidth;
  73971. let rightBandwidth;
  73972. if (left.attributes.BANDWIDTH) {
  73973. leftBandwidth = left.attributes.BANDWIDTH;
  73974. }
  73975. leftBandwidth = leftBandwidth || window_1.Number.MAX_VALUE;
  73976. if (right.attributes.BANDWIDTH) {
  73977. rightBandwidth = right.attributes.BANDWIDTH;
  73978. }
  73979. rightBandwidth = rightBandwidth || window_1.Number.MAX_VALUE;
  73980. return leftBandwidth - rightBandwidth;
  73981. };
  73982. const comparePlaylistResolution$1 = function(left, right) {
  73983. let leftWidth;
  73984. let rightWidth;
  73985. if (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) {
  73986. leftWidth = left.attributes.RESOLUTION.width;
  73987. }
  73988. leftWidth = leftWidth || window_1.Number.MAX_VALUE;
  73989. if (right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) {
  73990. rightWidth = right.attributes.RESOLUTION.width;
  73991. }
  73992. rightWidth = rightWidth || window_1.Number.MAX_VALUE;
  73993. if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) {
  73994. return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH;
  73995. }
  73996. return leftWidth - rightWidth;
  73997. };
  73998. let simpleSelector$1 = function(main, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, playlistController) {
  73999. if (!main) {
  74000. return;
  74001. }
  74002. const options2 = {
  74003. bandwidth: playerBandwidth,
  74004. width: playerWidth,
  74005. height: playerHeight,
  74006. limitRenditionByPlayerDimensions
  74007. };
  74008. let playlists = main.playlists;
  74009. if (Playlist$1.isAudioOnly(main)) {
  74010. playlists = playlistController.getAudioTrackPlaylists_();
  74011. options2.audioOnly = true;
  74012. }
  74013. let sortedPlaylistReps = playlists.map((playlist) => {
  74014. let bandwidth2;
  74015. const width2 = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width;
  74016. const height2 = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height;
  74017. bandwidth2 = playlist.attributes && playlist.attributes.BANDWIDTH;
  74018. bandwidth2 = bandwidth2 || window_1.Number.MAX_VALUE;
  74019. return {
  74020. bandwidth: bandwidth2,
  74021. width: width2,
  74022. height: height2,
  74023. playlist
  74024. };
  74025. });
  74026. stableSort$1(sortedPlaylistReps, (left, right) => left.bandwidth - right.bandwidth);
  74027. sortedPlaylistReps = sortedPlaylistReps.filter((rep2) => !Playlist$1.isIncompatible(rep2.playlist));
  74028. let enabledPlaylistReps = sortedPlaylistReps.filter((rep2) => Playlist$1.isEnabled(rep2.playlist));
  74029. if (!enabledPlaylistReps.length) {
  74030. enabledPlaylistReps = sortedPlaylistReps.filter((rep2) => !Playlist$1.isDisabled(rep2.playlist));
  74031. }
  74032. const bandwidthPlaylistReps = enabledPlaylistReps.filter((rep2) => rep2.bandwidth * Config$1.BANDWIDTH_VARIANCE < playerBandwidth);
  74033. let highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1];
  74034. const bandwidthBestRep = bandwidthPlaylistReps.filter((rep2) => rep2.bandwidth === highestRemainingBandwidthRep.bandwidth)[0];
  74035. if (limitRenditionByPlayerDimensions === false) {
  74036. const chosenRep2 = bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];
  74037. if (chosenRep2 && chosenRep2.playlist) {
  74038. let type2 = "sortedPlaylistReps";
  74039. if (bandwidthBestRep) {
  74040. type2 = "bandwidthBestRep";
  74041. }
  74042. if (enabledPlaylistReps[0]) {
  74043. type2 = "enabledPlaylistReps";
  74044. }
  74045. logFn$2(`choosing ${representationToString$1(chosenRep2)} using ${type2} with options`, options2);
  74046. return chosenRep2.playlist;
  74047. }
  74048. logFn$2("could not choose a playlist with options", options2);
  74049. return null;
  74050. }
  74051. const haveResolution = bandwidthPlaylistReps.filter((rep2) => rep2.width && rep2.height);
  74052. stableSort$1(haveResolution, (left, right) => left.width - right.width);
  74053. const resolutionBestRepList = haveResolution.filter((rep2) => rep2.width === playerWidth && rep2.height === playerHeight);
  74054. highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1];
  74055. const resolutionBestRep = resolutionBestRepList.filter((rep2) => rep2.bandwidth === highestRemainingBandwidthRep.bandwidth)[0];
  74056. let resolutionPlusOneList;
  74057. let resolutionPlusOneSmallest;
  74058. let resolutionPlusOneRep;
  74059. if (!resolutionBestRep) {
  74060. resolutionPlusOneList = haveResolution.filter((rep2) => rep2.width > playerWidth || rep2.height > playerHeight);
  74061. resolutionPlusOneSmallest = resolutionPlusOneList.filter((rep2) => rep2.width === resolutionPlusOneList[0].width && rep2.height === resolutionPlusOneList[0].height);
  74062. highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1];
  74063. resolutionPlusOneRep = resolutionPlusOneSmallest.filter((rep2) => rep2.bandwidth === highestRemainingBandwidthRep.bandwidth)[0];
  74064. }
  74065. let leastPixelDiffRep;
  74066. if (playlistController.leastPixelDiffSelector) {
  74067. const leastPixelDiffList = haveResolution.map((rep2) => {
  74068. rep2.pixelDiff = Math.abs(rep2.width - playerWidth) + Math.abs(rep2.height - playerHeight);
  74069. return rep2;
  74070. });
  74071. stableSort$1(leastPixelDiffList, (left, right) => {
  74072. if (left.pixelDiff === right.pixelDiff) {
  74073. return right.bandwidth - left.bandwidth;
  74074. }
  74075. return left.pixelDiff - right.pixelDiff;
  74076. });
  74077. leastPixelDiffRep = leastPixelDiffList[0];
  74078. }
  74079. const chosenRep = leastPixelDiffRep || resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];
  74080. if (chosenRep && chosenRep.playlist) {
  74081. let type2 = "sortedPlaylistReps";
  74082. if (leastPixelDiffRep) {
  74083. type2 = "leastPixelDiffRep";
  74084. } else if (resolutionPlusOneRep) {
  74085. type2 = "resolutionPlusOneRep";
  74086. } else if (resolutionBestRep) {
  74087. type2 = "resolutionBestRep";
  74088. } else if (bandwidthBestRep) {
  74089. type2 = "bandwidthBestRep";
  74090. } else if (enabledPlaylistReps[0]) {
  74091. type2 = "enabledPlaylistReps";
  74092. }
  74093. logFn$2(`choosing ${representationToString$1(chosenRep)} using ${type2} with options`, options2);
  74094. return chosenRep.playlist;
  74095. }
  74096. logFn$2("could not choose a playlist with options", options2);
  74097. return null;
  74098. };
  74099. const lastBandwidthSelector$1 = function() {
  74100. const pixelRatio = this.useDevicePixelRatio ? window_1.devicePixelRatio || 1 : 1;
  74101. return simpleSelector$1(this.playlists.main, this.systemBandwidth, parseInt(safeGetComputedStyle$1(this.tech_.el(), "width"), 10) * pixelRatio, parseInt(safeGetComputedStyle$1(this.tech_.el(), "height"), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.playlistController_);
  74102. };
  74103. const movingAverageBandwidthSelector$1 = function(decay) {
  74104. let average = -1;
  74105. let lastSystemBandwidth = -1;
  74106. if (decay < 0 || decay > 1) {
  74107. throw new Error("Moving average bandwidth decay must be between 0 and 1.");
  74108. }
  74109. return function() {
  74110. const pixelRatio = this.useDevicePixelRatio ? window_1.devicePixelRatio || 1 : 1;
  74111. if (average < 0) {
  74112. average = this.systemBandwidth;
  74113. lastSystemBandwidth = this.systemBandwidth;
  74114. }
  74115. if (this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth) {
  74116. average = decay * this.systemBandwidth + (1 - decay) * average;
  74117. lastSystemBandwidth = this.systemBandwidth;
  74118. }
  74119. return simpleSelector$1(this.playlists.main, average, parseInt(safeGetComputedStyle$1(this.tech_.el(), "width"), 10) * pixelRatio, parseInt(safeGetComputedStyle$1(this.tech_.el(), "height"), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.playlistController_);
  74120. };
  74121. };
  74122. const minRebufferMaxBandwidthSelector$1 = function(settings) {
  74123. const {
  74124. main,
  74125. currentTime,
  74126. bandwidth: bandwidth2,
  74127. duration: duration5,
  74128. segmentDuration,
  74129. timeUntilRebuffer: timeUntilRebuffer3,
  74130. currentTimeline,
  74131. syncController
  74132. } = settings;
  74133. const compatiblePlaylists = main.playlists.filter((playlist) => !Playlist$1.isIncompatible(playlist));
  74134. let enabledPlaylists = compatiblePlaylists.filter(Playlist$1.isEnabled);
  74135. if (!enabledPlaylists.length) {
  74136. enabledPlaylists = compatiblePlaylists.filter((playlist) => !Playlist$1.isDisabled(playlist));
  74137. }
  74138. const bandwidthPlaylists = enabledPlaylists.filter(Playlist$1.hasAttribute.bind(null, "BANDWIDTH"));
  74139. const rebufferingEstimates = bandwidthPlaylists.map((playlist) => {
  74140. const syncPoint = syncController.getSyncPoint(playlist, duration5, currentTimeline, currentTime);
  74141. const numRequests = syncPoint ? 1 : 2;
  74142. const requestTimeEstimate = Playlist$1.estimateSegmentRequestTime(segmentDuration, bandwidth2, playlist);
  74143. const rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer3;
  74144. return {
  74145. playlist,
  74146. rebufferingImpact
  74147. };
  74148. });
  74149. const noRebufferingPlaylists = rebufferingEstimates.filter((estimate) => estimate.rebufferingImpact <= 0);
  74150. stableSort$1(noRebufferingPlaylists, (a, b) => comparePlaylistBandwidth$1(b.playlist, a.playlist));
  74151. if (noRebufferingPlaylists.length) {
  74152. return noRebufferingPlaylists[0];
  74153. }
  74154. stableSort$1(rebufferingEstimates, (a, b) => a.rebufferingImpact - b.rebufferingImpact);
  74155. return rebufferingEstimates[0] || null;
  74156. };
  74157. const lowestBitrateCompatibleVariantSelector$1 = function() {
  74158. const playlists = this.playlists.main.playlists.filter(Playlist$1.isEnabled);
  74159. stableSort$1(playlists, (a, b) => comparePlaylistBandwidth$1(a, b));
  74160. const playlistsWithVideo = playlists.filter((playlist) => !!codecsForPlaylist$1(this.playlists.main, playlist).video);
  74161. return playlistsWithVideo[0] || null;
  74162. };
  74163. const concatSegments$1 = (segmentObj) => {
  74164. let offset = 0;
  74165. let tempBuffer;
  74166. if (segmentObj.bytes) {
  74167. tempBuffer = new Uint8Array(segmentObj.bytes);
  74168. segmentObj.segments.forEach((segment) => {
  74169. tempBuffer.set(segment, offset);
  74170. offset += segment.byteLength;
  74171. });
  74172. }
  74173. return tempBuffer;
  74174. };
  74175. const createCaptionsTrackIfNotExists$1 = function(inbandTextTracks, tech, captionStream) {
  74176. if (!inbandTextTracks[captionStream]) {
  74177. tech.trigger({
  74178. type: "usage",
  74179. name: "vhs-608"
  74180. });
  74181. let instreamId = captionStream;
  74182. if (/^cc708_/.test(captionStream)) {
  74183. instreamId = "SERVICE" + captionStream.split("_")[1];
  74184. }
  74185. const track = tech.textTracks().getTrackById(instreamId);
  74186. if (track) {
  74187. inbandTextTracks[captionStream] = track;
  74188. } else {
  74189. const captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};
  74190. let label = captionStream;
  74191. let language = captionStream;
  74192. let def = false;
  74193. const captionService = captionServices[instreamId];
  74194. if (captionService) {
  74195. label = captionService.label;
  74196. language = captionService.language;
  74197. def = captionService.default;
  74198. }
  74199. inbandTextTracks[captionStream] = tech.addRemoteTextTrack({
  74200. kind: "captions",
  74201. id: instreamId,
  74202. default: def,
  74203. label,
  74204. language
  74205. }, false).track;
  74206. }
  74207. }
  74208. };
  74209. const addCaptionData$1 = function({
  74210. inbandTextTracks,
  74211. captionArray,
  74212. timestampOffset: timestampOffset2
  74213. }) {
  74214. if (!captionArray) {
  74215. return;
  74216. }
  74217. const Cue = window_1.WebKitDataCue || window_1.VTTCue;
  74218. captionArray.forEach((caption) => {
  74219. const track = caption.stream;
  74220. inbandTextTracks[track].addCue(new Cue(caption.startTime + timestampOffset2, caption.endTime + timestampOffset2, caption.text));
  74221. });
  74222. };
  74223. const deprecateOldCue$1 = function(cue) {
  74224. Object.defineProperties(cue.frame, {
  74225. id: {
  74226. get() {
  74227. videojs$2.log.warn("cue.frame.id is deprecated. Use cue.value.key instead.");
  74228. return cue.value.key;
  74229. }
  74230. },
  74231. value: {
  74232. get() {
  74233. videojs$2.log.warn("cue.frame.value is deprecated. Use cue.value.data instead.");
  74234. return cue.value.data;
  74235. }
  74236. },
  74237. privateData: {
  74238. get() {
  74239. videojs$2.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead.");
  74240. return cue.value.data;
  74241. }
  74242. }
  74243. });
  74244. };
  74245. const addMetadata$1 = ({
  74246. inbandTextTracks,
  74247. metadataArray,
  74248. timestampOffset: timestampOffset2,
  74249. videoDuration
  74250. }) => {
  74251. if (!metadataArray) {
  74252. return;
  74253. }
  74254. const Cue = window_1.WebKitDataCue || window_1.VTTCue;
  74255. const metadataTrack = inbandTextTracks.metadataTrack_;
  74256. if (!metadataTrack) {
  74257. return;
  74258. }
  74259. metadataArray.forEach((metadata) => {
  74260. const time = metadata.cueTime + timestampOffset2;
  74261. if (typeof time !== "number" || window_1.isNaN(time) || time < 0 || !(time < Infinity)) {
  74262. return;
  74263. }
  74264. metadata.frames.forEach((frame) => {
  74265. const cue = new Cue(time, time, frame.value || frame.url || frame.data || "");
  74266. cue.frame = frame;
  74267. cue.value = frame;
  74268. deprecateOldCue$1(cue);
  74269. metadataTrack.addCue(cue);
  74270. });
  74271. });
  74272. if (!metadataTrack.cues || !metadataTrack.cues.length) {
  74273. return;
  74274. }
  74275. const cues = metadataTrack.cues;
  74276. const cuesArray = [];
  74277. for (let i2 = 0; i2 < cues.length; i2++) {
  74278. if (cues[i2]) {
  74279. cuesArray.push(cues[i2]);
  74280. }
  74281. }
  74282. const cuesGroupedByStartTime = cuesArray.reduce((obj, cue) => {
  74283. const timeSlot = obj[cue.startTime] || [];
  74284. timeSlot.push(cue);
  74285. obj[cue.startTime] = timeSlot;
  74286. return obj;
  74287. }, {});
  74288. const sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort((a, b) => Number(a) - Number(b));
  74289. sortedStartTimes.forEach((startTime, idx) => {
  74290. const cueGroup = cuesGroupedByStartTime[startTime];
  74291. const nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration;
  74292. cueGroup.forEach((cue) => {
  74293. cue.endTime = nextTime;
  74294. });
  74295. });
  74296. };
  74297. const createMetadataTrackIfNotExists$1 = (inbandTextTracks, dispatchType, tech) => {
  74298. if (inbandTextTracks.metadataTrack_) {
  74299. return;
  74300. }
  74301. inbandTextTracks.metadataTrack_ = tech.addRemoteTextTrack({
  74302. kind: "metadata",
  74303. label: "Timed Metadata"
  74304. }, false).track;
  74305. inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType = dispatchType;
  74306. };
  74307. const removeCuesFromTrack$1 = function(start2, end, track) {
  74308. let i2;
  74309. let cue;
  74310. if (!track) {
  74311. return;
  74312. }
  74313. if (!track.cues) {
  74314. return;
  74315. }
  74316. i2 = track.cues.length;
  74317. while (i2--) {
  74318. cue = track.cues[i2];
  74319. if (cue.startTime >= start2 && cue.endTime <= end) {
  74320. track.removeCue(cue);
  74321. }
  74322. }
  74323. };
  74324. const removeDuplicateCuesFromTrack$1 = function(track) {
  74325. const cues = track.cues;
  74326. if (!cues) {
  74327. return;
  74328. }
  74329. for (let i2 = 0; i2 < cues.length; i2++) {
  74330. const duplicates = [];
  74331. let occurrences = 0;
  74332. for (let j = 0; j < cues.length; j++) {
  74333. if (cues[i2].startTime === cues[j].startTime && cues[i2].endTime === cues[j].endTime && cues[i2].text === cues[j].text) {
  74334. occurrences++;
  74335. if (occurrences > 1) {
  74336. duplicates.push(cues[j]);
  74337. }
  74338. }
  74339. }
  74340. if (duplicates.length) {
  74341. duplicates.forEach((dupe) => track.removeCue(dupe));
  74342. }
  74343. }
  74344. };
  74345. const gopsSafeToAlignWith$1 = (buffer, currentTime, mapping) => {
  74346. if (typeof currentTime === "undefined" || currentTime === null || !buffer.length) {
  74347. return [];
  74348. }
  74349. const currentTimePts = Math.ceil((currentTime - mapping + 3) * clock$1.ONE_SECOND_IN_TS);
  74350. let i2;
  74351. for (i2 = 0; i2 < buffer.length; i2++) {
  74352. if (buffer[i2].pts > currentTimePts) {
  74353. break;
  74354. }
  74355. }
  74356. return buffer.slice(i2);
  74357. };
  74358. const updateGopBuffer$1 = (buffer, gops, replace) => {
  74359. if (!gops.length) {
  74360. return buffer;
  74361. }
  74362. if (replace) {
  74363. return gops.slice();
  74364. }
  74365. const start2 = gops[0].pts;
  74366. let i2 = 0;
  74367. for (i2; i2 < buffer.length; i2++) {
  74368. if (buffer[i2].pts >= start2) {
  74369. break;
  74370. }
  74371. }
  74372. return buffer.slice(0, i2).concat(gops);
  74373. };
  74374. const removeGopBuffer$1 = (buffer, start2, end, mapping) => {
  74375. const startPts = Math.ceil((start2 - mapping) * clock$1.ONE_SECOND_IN_TS);
  74376. const endPts = Math.ceil((end - mapping) * clock$1.ONE_SECOND_IN_TS);
  74377. const updatedBuffer = buffer.slice();
  74378. let i2 = buffer.length;
  74379. while (i2--) {
  74380. if (buffer[i2].pts <= endPts) {
  74381. break;
  74382. }
  74383. }
  74384. if (i2 === -1) {
  74385. return updatedBuffer;
  74386. }
  74387. let j = i2 + 1;
  74388. while (j--) {
  74389. if (buffer[j].pts <= startPts) {
  74390. break;
  74391. }
  74392. }
  74393. j = Math.max(j, 0);
  74394. updatedBuffer.splice(j, i2 - j + 1);
  74395. return updatedBuffer;
  74396. };
  74397. const shallowEqual$1 = function(a, b) {
  74398. if (!a && !b || !a && b || a && !b) {
  74399. return false;
  74400. }
  74401. if (a === b) {
  74402. return true;
  74403. }
  74404. const akeys = Object.keys(a).sort();
  74405. const bkeys = Object.keys(b).sort();
  74406. if (akeys.length !== bkeys.length) {
  74407. return false;
  74408. }
  74409. for (let i2 = 0; i2 < akeys.length; i2++) {
  74410. const key = akeys[i2];
  74411. if (key !== bkeys[i2]) {
  74412. return false;
  74413. }
  74414. if (a[key] !== b[key]) {
  74415. return false;
  74416. }
  74417. }
  74418. return true;
  74419. };
  74420. const QUOTA_EXCEEDED_ERR$1 = 22;
  74421. const getSyncSegmentCandidate$1 = function(currentTimeline, segments, targetTime) {
  74422. segments = segments || [];
  74423. const timelineSegments = [];
  74424. let time = 0;
  74425. for (let i2 = 0; i2 < segments.length; i2++) {
  74426. const segment = segments[i2];
  74427. if (currentTimeline === segment.timeline) {
  74428. timelineSegments.push(i2);
  74429. time += segment.duration;
  74430. if (time > targetTime) {
  74431. return i2;
  74432. }
  74433. }
  74434. }
  74435. if (timelineSegments.length === 0) {
  74436. return 0;
  74437. }
  74438. return timelineSegments[timelineSegments.length - 1];
  74439. };
  74440. const MIN_BACK_BUFFER$1 = 1;
  74441. const CHECK_BUFFER_DELAY$1 = 500;
  74442. const finite$1 = (num) => typeof num === "number" && isFinite(num);
  74443. const MIN_SEGMENT_DURATION_TO_SAVE_STATS$1 = 1 / 60;
  74444. const illegalMediaSwitch$1 = (loaderType, startingMedia, trackInfo) => {
  74445. if (loaderType !== "main" || !startingMedia || !trackInfo) {
  74446. return null;
  74447. }
  74448. if (!trackInfo.hasAudio && !trackInfo.hasVideo) {
  74449. return "Neither audio nor video found in segment.";
  74450. }
  74451. if (startingMedia.hasVideo && !trackInfo.hasVideo) {
  74452. return "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.";
  74453. }
  74454. if (!startingMedia.hasVideo && trackInfo.hasVideo) {
  74455. return "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.";
  74456. }
  74457. return null;
  74458. };
  74459. const safeBackBufferTrimTime$1 = (seekable3, currentTime, targetDuration) => {
  74460. let trimTime = currentTime - Config$1.BACK_BUFFER_LENGTH;
  74461. if (seekable3.length) {
  74462. trimTime = Math.max(trimTime, seekable3.start(0));
  74463. }
  74464. const maxTrimTime = currentTime - targetDuration;
  74465. return Math.min(maxTrimTime, trimTime);
  74466. };
  74467. const segmentInfoString$1 = (segmentInfo) => {
  74468. const {
  74469. startOfSegment,
  74470. duration: duration5,
  74471. segment,
  74472. part,
  74473. playlist: {
  74474. mediaSequence: seq,
  74475. id,
  74476. segments = []
  74477. },
  74478. mediaIndex: index2,
  74479. partIndex,
  74480. timeline
  74481. } = segmentInfo;
  74482. const segmentLen = segments.length - 1;
  74483. let selection = "mediaIndex/partIndex increment";
  74484. if (segmentInfo.getMediaInfoForTime) {
  74485. selection = `getMediaInfoForTime (${segmentInfo.getMediaInfoForTime})`;
  74486. } else if (segmentInfo.isSyncRequest) {
  74487. selection = "getSyncSegmentCandidate (isSyncRequest)";
  74488. }
  74489. if (segmentInfo.independent) {
  74490. selection += ` with independent ${segmentInfo.independent}`;
  74491. }
  74492. const hasPartIndex = typeof partIndex === "number";
  74493. const name = segmentInfo.segment.uri ? "segment" : "pre-segment";
  74494. const zeroBasedPartCount = hasPartIndex ? getKnownPartCount$1({
  74495. preloadSegment: segment
  74496. }) - 1 : 0;
  74497. return `${name} [${seq + index2}/${seq + segmentLen}]` + (hasPartIndex ? ` part [${partIndex}/${zeroBasedPartCount}]` : "") + ` segment start/end [${segment.start} => ${segment.end}]` + (hasPartIndex ? ` part start/end [${part.start} => ${part.end}]` : "") + ` startOfSegment [${startOfSegment}] duration [${duration5}] timeline [${timeline}] selected by [${selection}] playlist [${id}]`;
  74498. };
  74499. const timingInfoPropertyForMedia$1 = (mediaType) => `${mediaType}TimingInfo`;
  74500. const timestampOffsetForSegment$1 = ({
  74501. segmentTimeline,
  74502. currentTimeline,
  74503. startOfSegment,
  74504. buffered,
  74505. overrideCheck
  74506. }) => {
  74507. if (!overrideCheck && segmentTimeline === currentTimeline) {
  74508. return null;
  74509. }
  74510. if (segmentTimeline < currentTimeline) {
  74511. return startOfSegment;
  74512. }
  74513. return buffered.length ? buffered.end(buffered.length - 1) : startOfSegment;
  74514. };
  74515. const shouldWaitForTimelineChange$1 = ({
  74516. timelineChangeController,
  74517. currentTimeline,
  74518. segmentTimeline,
  74519. loaderType,
  74520. audioDisabled
  74521. }) => {
  74522. if (currentTimeline === segmentTimeline) {
  74523. return false;
  74524. }
  74525. if (loaderType === "audio") {
  74526. const lastMainTimelineChange = timelineChangeController.lastTimelineChange({
  74527. type: "main"
  74528. });
  74529. return !lastMainTimelineChange || lastMainTimelineChange.to !== segmentTimeline;
  74530. }
  74531. if (loaderType === "main" && audioDisabled) {
  74532. const pendingAudioTimelineChange = timelineChangeController.pendingTimelineChange({
  74533. type: "audio"
  74534. });
  74535. if (pendingAudioTimelineChange && pendingAudioTimelineChange.to === segmentTimeline) {
  74536. return false;
  74537. }
  74538. return true;
  74539. }
  74540. return false;
  74541. };
  74542. const mediaDuration$1 = (timingInfos) => {
  74543. let maxDuration = 0;
  74544. ["video", "audio"].forEach(function(type2) {
  74545. const typeTimingInfo = timingInfos[`${type2}TimingInfo`];
  74546. if (!typeTimingInfo) {
  74547. return;
  74548. }
  74549. const {
  74550. start: start2,
  74551. end
  74552. } = typeTimingInfo;
  74553. let duration5;
  74554. if (typeof start2 === "bigint" || typeof end === "bigint") {
  74555. duration5 = window_1.BigInt(end) - window_1.BigInt(start2);
  74556. } else if (typeof start2 === "number" && typeof end === "number") {
  74557. duration5 = end - start2;
  74558. }
  74559. if (typeof duration5 !== "undefined" && duration5 > maxDuration) {
  74560. maxDuration = duration5;
  74561. }
  74562. });
  74563. if (typeof maxDuration === "bigint" && maxDuration < Number.MAX_SAFE_INTEGER) {
  74564. maxDuration = Number(maxDuration);
  74565. }
  74566. return maxDuration;
  74567. };
  74568. const segmentTooLong$1 = ({
  74569. segmentDuration,
  74570. maxDuration
  74571. }) => {
  74572. if (!segmentDuration) {
  74573. return false;
  74574. }
  74575. return Math.round(segmentDuration) > maxDuration + TIME_FUDGE_FACTOR$1;
  74576. };
  74577. const getTroublesomeSegmentDurationMessage$1 = (segmentInfo, sourceType) => {
  74578. if (sourceType !== "hls") {
  74579. return null;
  74580. }
  74581. const segmentDuration = mediaDuration$1({
  74582. audioTimingInfo: segmentInfo.audioTimingInfo,
  74583. videoTimingInfo: segmentInfo.videoTimingInfo
  74584. });
  74585. if (!segmentDuration) {
  74586. return null;
  74587. }
  74588. const targetDuration = segmentInfo.playlist.targetDuration;
  74589. const isSegmentWayTooLong = segmentTooLong$1({
  74590. segmentDuration,
  74591. maxDuration: targetDuration * 2
  74592. });
  74593. const isSegmentSlightlyTooLong = segmentTooLong$1({
  74594. segmentDuration,
  74595. maxDuration: targetDuration
  74596. });
  74597. const segmentTooLongMessage = `Segment with index ${segmentInfo.mediaIndex} from playlist ${segmentInfo.playlist.id} has a duration of ${segmentDuration} when the reported duration is ${segmentInfo.duration} and the target duration is ${targetDuration}. For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1`;
  74598. if (isSegmentWayTooLong || isSegmentSlightlyTooLong) {
  74599. return {
  74600. severity: isSegmentWayTooLong ? "warn" : "info",
  74601. message: segmentTooLongMessage
  74602. };
  74603. }
  74604. return null;
  74605. };
  74606. class SegmentLoader$1 extends videojs$2.EventTarget {
  74607. constructor(settings, options2 = {}) {
  74608. super();
  74609. if (!settings) {
  74610. throw new TypeError("Initialization settings are required");
  74611. }
  74612. if (typeof settings.currentTime !== "function") {
  74613. throw new TypeError("No currentTime getter specified");
  74614. }
  74615. if (!settings.mediaSource) {
  74616. throw new TypeError("No MediaSource specified");
  74617. }
  74618. this.bandwidth = settings.bandwidth;
  74619. this.throughput = {
  74620. rate: 0,
  74621. count: 0
  74622. };
  74623. this.roundTrip = NaN;
  74624. this.resetStats_();
  74625. this.mediaIndex = null;
  74626. this.partIndex = null;
  74627. this.hasPlayed_ = settings.hasPlayed;
  74628. this.currentTime_ = settings.currentTime;
  74629. this.seekable_ = settings.seekable;
  74630. this.seeking_ = settings.seeking;
  74631. this.duration_ = settings.duration;
  74632. this.mediaSource_ = settings.mediaSource;
  74633. this.vhs_ = settings.vhs;
  74634. this.loaderType_ = settings.loaderType;
  74635. this.currentMediaInfo_ = void 0;
  74636. this.startingMediaInfo_ = void 0;
  74637. this.segmentMetadataTrack_ = settings.segmentMetadataTrack;
  74638. this.goalBufferLength_ = settings.goalBufferLength;
  74639. this.sourceType_ = settings.sourceType;
  74640. this.sourceUpdater_ = settings.sourceUpdater;
  74641. this.inbandTextTracks_ = settings.inbandTextTracks;
  74642. this.state_ = "INIT";
  74643. this.timelineChangeController_ = settings.timelineChangeController;
  74644. this.shouldSaveSegmentTimingInfo_ = true;
  74645. this.parse708captions_ = settings.parse708captions;
  74646. this.useDtsForTimestampOffset_ = settings.useDtsForTimestampOffset;
  74647. this.captionServices_ = settings.captionServices;
  74648. this.exactManifestTimings = settings.exactManifestTimings;
  74649. this.checkBufferTimeout_ = null;
  74650. this.error_ = void 0;
  74651. this.currentTimeline_ = -1;
  74652. this.pendingSegment_ = null;
  74653. this.xhrOptions_ = null;
  74654. this.pendingSegments_ = [];
  74655. this.audioDisabled_ = false;
  74656. this.isPendingTimestampOffset_ = false;
  74657. this.gopBuffer_ = [];
  74658. this.timeMapping_ = 0;
  74659. this.safeAppend_ = videojs$2.browser.IE_VERSION >= 11;
  74660. this.appendInitSegment_ = {
  74661. audio: true,
  74662. video: true
  74663. };
  74664. this.playlistOfLastInitSegment_ = {
  74665. audio: null,
  74666. video: null
  74667. };
  74668. this.callQueue_ = [];
  74669. this.loadQueue_ = [];
  74670. this.metadataQueue_ = {
  74671. id3: [],
  74672. caption: []
  74673. };
  74674. this.waitingOnRemove_ = false;
  74675. this.quotaExceededErrorRetryTimeout_ = null;
  74676. this.activeInitSegmentId_ = null;
  74677. this.initSegments_ = {};
  74678. this.cacheEncryptionKeys_ = settings.cacheEncryptionKeys;
  74679. this.keyCache_ = {};
  74680. this.decrypter_ = settings.decrypter;
  74681. this.syncController_ = settings.syncController;
  74682. this.syncPoint_ = {
  74683. segmentIndex: 0,
  74684. time: 0
  74685. };
  74686. this.transmuxer_ = this.createTransmuxer_();
  74687. this.triggerSyncInfoUpdate_ = () => this.trigger("syncinfoupdate");
  74688. this.syncController_.on("syncinfoupdate", this.triggerSyncInfoUpdate_);
  74689. this.mediaSource_.addEventListener("sourceopen", () => {
  74690. if (!this.isEndOfStream_()) {
  74691. this.ended_ = false;
  74692. }
  74693. });
  74694. this.fetchAtBuffer_ = false;
  74695. this.logger_ = logger$1(`SegmentLoader[${this.loaderType_}]`);
  74696. Object.defineProperty(this, "state", {
  74697. get() {
  74698. return this.state_;
  74699. },
  74700. set(newState) {
  74701. if (newState !== this.state_) {
  74702. this.logger_(`${this.state_} -> ${newState}`);
  74703. this.state_ = newState;
  74704. this.trigger("statechange");
  74705. }
  74706. }
  74707. });
  74708. this.sourceUpdater_.on("ready", () => {
  74709. if (this.hasEnoughInfoToAppend_()) {
  74710. this.processCallQueue_();
  74711. }
  74712. });
  74713. if (this.loaderType_ === "main") {
  74714. this.timelineChangeController_.on("pendingtimelinechange", () => {
  74715. if (this.hasEnoughInfoToAppend_()) {
  74716. this.processCallQueue_();
  74717. }
  74718. });
  74719. }
  74720. if (this.loaderType_ === "audio") {
  74721. this.timelineChangeController_.on("timelinechange", () => {
  74722. if (this.hasEnoughInfoToLoad_()) {
  74723. this.processLoadQueue_();
  74724. }
  74725. if (this.hasEnoughInfoToAppend_()) {
  74726. this.processCallQueue_();
  74727. }
  74728. });
  74729. }
  74730. }
  74731. createTransmuxer_() {
  74732. return segmentTransmuxer$1.createTransmuxer({
  74733. remux: false,
  74734. alignGopsAtEnd: this.safeAppend_,
  74735. keepOriginalTimestamps: true,
  74736. parse708captions: this.parse708captions_,
  74737. captionServices: this.captionServices_
  74738. });
  74739. }
  74740. resetStats_() {
  74741. this.mediaBytesTransferred = 0;
  74742. this.mediaRequests = 0;
  74743. this.mediaRequestsAborted = 0;
  74744. this.mediaRequestsTimedout = 0;
  74745. this.mediaRequestsErrored = 0;
  74746. this.mediaTransferDuration = 0;
  74747. this.mediaSecondsLoaded = 0;
  74748. this.mediaAppends = 0;
  74749. }
  74750. dispose() {
  74751. this.trigger("dispose");
  74752. this.state = "DISPOSED";
  74753. this.pause();
  74754. this.abort_();
  74755. if (this.transmuxer_) {
  74756. this.transmuxer_.terminate();
  74757. }
  74758. this.resetStats_();
  74759. if (this.checkBufferTimeout_) {
  74760. window_1.clearTimeout(this.checkBufferTimeout_);
  74761. }
  74762. if (this.syncController_ && this.triggerSyncInfoUpdate_) {
  74763. this.syncController_.off("syncinfoupdate", this.triggerSyncInfoUpdate_);
  74764. }
  74765. this.off();
  74766. }
  74767. setAudio(enable) {
  74768. this.audioDisabled_ = !enable;
  74769. if (enable) {
  74770. this.appendInitSegment_.audio = true;
  74771. } else {
  74772. this.sourceUpdater_.removeAudio(0, this.duration_());
  74773. }
  74774. }
  74775. abort() {
  74776. if (this.state !== "WAITING") {
  74777. if (this.pendingSegment_) {
  74778. this.pendingSegment_ = null;
  74779. }
  74780. return;
  74781. }
  74782. this.abort_();
  74783. this.state = "READY";
  74784. if (!this.paused()) {
  74785. this.monitorBuffer_();
  74786. }
  74787. }
  74788. abort_() {
  74789. if (this.pendingSegment_ && this.pendingSegment_.abortRequests) {
  74790. this.pendingSegment_.abortRequests();
  74791. }
  74792. this.pendingSegment_ = null;
  74793. this.callQueue_ = [];
  74794. this.loadQueue_ = [];
  74795. this.metadataQueue_.id3 = [];
  74796. this.metadataQueue_.caption = [];
  74797. this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);
  74798. this.waitingOnRemove_ = false;
  74799. window_1.clearTimeout(this.quotaExceededErrorRetryTimeout_);
  74800. this.quotaExceededErrorRetryTimeout_ = null;
  74801. }
  74802. checkForAbort_(requestId) {
  74803. if (this.state === "APPENDING" && !this.pendingSegment_) {
  74804. this.state = "READY";
  74805. return true;
  74806. }
  74807. if (!this.pendingSegment_ || this.pendingSegment_.requestId !== requestId) {
  74808. return true;
  74809. }
  74810. return false;
  74811. }
  74812. error(error) {
  74813. if (typeof error !== "undefined") {
  74814. this.logger_("error occurred:", error);
  74815. this.error_ = error;
  74816. }
  74817. this.pendingSegment_ = null;
  74818. return this.error_;
  74819. }
  74820. endOfStream() {
  74821. this.ended_ = true;
  74822. if (this.transmuxer_) {
  74823. segmentTransmuxer$1.reset(this.transmuxer_);
  74824. }
  74825. this.gopBuffer_.length = 0;
  74826. this.pause();
  74827. this.trigger("ended");
  74828. }
  74829. buffered_() {
  74830. const trackInfo = this.getMediaInfo_();
  74831. if (!this.sourceUpdater_ || !trackInfo) {
  74832. return createTimeRanges$2();
  74833. }
  74834. if (this.loaderType_ === "main") {
  74835. const {
  74836. hasAudio,
  74837. hasVideo,
  74838. isMuxed: isMuxed3
  74839. } = trackInfo;
  74840. if (hasVideo && hasAudio && !this.audioDisabled_ && !isMuxed3) {
  74841. return this.sourceUpdater_.buffered();
  74842. }
  74843. if (hasVideo) {
  74844. return this.sourceUpdater_.videoBuffered();
  74845. }
  74846. }
  74847. return this.sourceUpdater_.audioBuffered();
  74848. }
  74849. initSegmentForMap(map, set4 = false) {
  74850. if (!map) {
  74851. return null;
  74852. }
  74853. const id = initSegmentId$1(map);
  74854. let storedMap = this.initSegments_[id];
  74855. if (set4 && !storedMap && map.bytes) {
  74856. this.initSegments_[id] = storedMap = {
  74857. resolvedUri: map.resolvedUri,
  74858. byterange: map.byterange,
  74859. bytes: map.bytes,
  74860. tracks: map.tracks,
  74861. timescales: map.timescales
  74862. };
  74863. }
  74864. return storedMap || map;
  74865. }
  74866. segmentKey(key, set4 = false) {
  74867. if (!key) {
  74868. return null;
  74869. }
  74870. const id = segmentKeyId$1(key);
  74871. let storedKey = this.keyCache_[id];
  74872. if (this.cacheEncryptionKeys_ && set4 && !storedKey && key.bytes) {
  74873. this.keyCache_[id] = storedKey = {
  74874. resolvedUri: key.resolvedUri,
  74875. bytes: key.bytes
  74876. };
  74877. }
  74878. const result = {
  74879. resolvedUri: (storedKey || key).resolvedUri
  74880. };
  74881. if (storedKey) {
  74882. result.bytes = storedKey.bytes;
  74883. }
  74884. return result;
  74885. }
  74886. couldBeginLoading_() {
  74887. return this.playlist_ && !this.paused();
  74888. }
  74889. load() {
  74890. this.monitorBuffer_();
  74891. if (!this.playlist_) {
  74892. return;
  74893. }
  74894. if (this.state === "INIT" && this.couldBeginLoading_()) {
  74895. return this.init_();
  74896. }
  74897. if (!this.couldBeginLoading_() || this.state !== "READY" && this.state !== "INIT") {
  74898. return;
  74899. }
  74900. this.state = "READY";
  74901. }
  74902. init_() {
  74903. this.state = "READY";
  74904. this.resetEverything();
  74905. return this.monitorBuffer_();
  74906. }
  74907. playlist(newPlaylist, options2 = {}) {
  74908. if (!newPlaylist) {
  74909. return;
  74910. }
  74911. const oldPlaylist = this.playlist_;
  74912. const segmentInfo = this.pendingSegment_;
  74913. this.playlist_ = newPlaylist;
  74914. this.xhrOptions_ = options2;
  74915. if (this.state === "INIT") {
  74916. newPlaylist.syncInfo = {
  74917. mediaSequence: newPlaylist.mediaSequence,
  74918. time: 0
  74919. };
  74920. if (this.loaderType_ === "main") {
  74921. this.syncController_.setDateTimeMappingForStart(newPlaylist);
  74922. }
  74923. }
  74924. let oldId = null;
  74925. if (oldPlaylist) {
  74926. if (oldPlaylist.id) {
  74927. oldId = oldPlaylist.id;
  74928. } else if (oldPlaylist.uri) {
  74929. oldId = oldPlaylist.uri;
  74930. }
  74931. }
  74932. this.logger_(`playlist update [${oldId} => ${newPlaylist.id || newPlaylist.uri}]`);
  74933. this.trigger("syncinfoupdate");
  74934. if (this.state === "INIT" && this.couldBeginLoading_()) {
  74935. return this.init_();
  74936. }
  74937. if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) {
  74938. if (this.mediaIndex !== null) {
  74939. if (!newPlaylist.endList) {
  74940. this.resetLoader();
  74941. } else {
  74942. this.resyncLoader();
  74943. }
  74944. }
  74945. this.currentMediaInfo_ = void 0;
  74946. this.trigger("playlistupdate");
  74947. return;
  74948. }
  74949. const mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;
  74950. this.logger_(`live window shift [${mediaSequenceDiff}]`);
  74951. if (this.mediaIndex !== null) {
  74952. this.mediaIndex -= mediaSequenceDiff;
  74953. if (this.mediaIndex < 0) {
  74954. this.mediaIndex = null;
  74955. this.partIndex = null;
  74956. } else {
  74957. const segment = this.playlist_.segments[this.mediaIndex];
  74958. if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) {
  74959. const mediaIndex = this.mediaIndex;
  74960. this.logger_(`currently processing part (index ${this.partIndex}) no longer exists.`);
  74961. this.resetLoader();
  74962. this.mediaIndex = mediaIndex;
  74963. }
  74964. }
  74965. }
  74966. if (segmentInfo) {
  74967. segmentInfo.mediaIndex -= mediaSequenceDiff;
  74968. if (segmentInfo.mediaIndex < 0) {
  74969. segmentInfo.mediaIndex = null;
  74970. segmentInfo.partIndex = null;
  74971. } else {
  74972. if (segmentInfo.mediaIndex >= 0) {
  74973. segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex];
  74974. }
  74975. if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) {
  74976. segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex];
  74977. }
  74978. }
  74979. }
  74980. this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist);
  74981. }
  74982. pause() {
  74983. if (this.checkBufferTimeout_) {
  74984. window_1.clearTimeout(this.checkBufferTimeout_);
  74985. this.checkBufferTimeout_ = null;
  74986. }
  74987. }
  74988. paused() {
  74989. return this.checkBufferTimeout_ === null;
  74990. }
  74991. resetEverything(done) {
  74992. this.ended_ = false;
  74993. this.activeInitSegmentId_ = null;
  74994. this.appendInitSegment_ = {
  74995. audio: true,
  74996. video: true
  74997. };
  74998. this.resetLoader();
  74999. this.remove(0, Infinity, done);
  75000. if (this.transmuxer_) {
  75001. this.transmuxer_.postMessage({
  75002. action: "clearAllMp4Captions"
  75003. });
  75004. this.transmuxer_.postMessage({
  75005. action: "reset"
  75006. });
  75007. }
  75008. }
  75009. resetLoader() {
  75010. this.fetchAtBuffer_ = false;
  75011. this.resyncLoader();
  75012. }
  75013. resyncLoader() {
  75014. if (this.transmuxer_) {
  75015. segmentTransmuxer$1.reset(this.transmuxer_);
  75016. }
  75017. this.mediaIndex = null;
  75018. this.partIndex = null;
  75019. this.syncPoint_ = null;
  75020. this.isPendingTimestampOffset_ = false;
  75021. this.callQueue_ = [];
  75022. this.loadQueue_ = [];
  75023. this.metadataQueue_.id3 = [];
  75024. this.metadataQueue_.caption = [];
  75025. this.abort();
  75026. if (this.transmuxer_) {
  75027. this.transmuxer_.postMessage({
  75028. action: "clearParsedMp4Captions"
  75029. });
  75030. }
  75031. }
  75032. remove(start2, end, done = () => {
  75033. }, force = false) {
  75034. if (end === Infinity) {
  75035. end = this.duration_();
  75036. }
  75037. if (end <= start2) {
  75038. this.logger_("skipping remove because end ${end} is <= start ${start}");
  75039. return;
  75040. }
  75041. if (!this.sourceUpdater_ || !this.getMediaInfo_()) {
  75042. this.logger_("skipping remove because no source updater or starting media info");
  75043. return;
  75044. }
  75045. let removesRemaining = 1;
  75046. const removeFinished = () => {
  75047. removesRemaining--;
  75048. if (removesRemaining === 0) {
  75049. done();
  75050. }
  75051. };
  75052. if (force || !this.audioDisabled_) {
  75053. removesRemaining++;
  75054. this.sourceUpdater_.removeAudio(start2, end, removeFinished);
  75055. }
  75056. if (force || this.loaderType_ === "main") {
  75057. this.gopBuffer_ = removeGopBuffer$1(this.gopBuffer_, start2, end, this.timeMapping_);
  75058. removesRemaining++;
  75059. this.sourceUpdater_.removeVideo(start2, end, removeFinished);
  75060. }
  75061. for (const track in this.inbandTextTracks_) {
  75062. removeCuesFromTrack$1(start2, end, this.inbandTextTracks_[track]);
  75063. }
  75064. removeCuesFromTrack$1(start2, end, this.segmentMetadataTrack_);
  75065. removeFinished();
  75066. }
  75067. monitorBuffer_() {
  75068. if (this.checkBufferTimeout_) {
  75069. window_1.clearTimeout(this.checkBufferTimeout_);
  75070. }
  75071. this.checkBufferTimeout_ = window_1.setTimeout(this.monitorBufferTick_.bind(this), 1);
  75072. }
  75073. monitorBufferTick_() {
  75074. if (this.state === "READY") {
  75075. this.fillBuffer_();
  75076. }
  75077. if (this.checkBufferTimeout_) {
  75078. window_1.clearTimeout(this.checkBufferTimeout_);
  75079. }
  75080. this.checkBufferTimeout_ = window_1.setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY$1);
  75081. }
  75082. fillBuffer_() {
  75083. if (this.sourceUpdater_.updating()) {
  75084. return;
  75085. }
  75086. const segmentInfo = this.chooseNextRequest_();
  75087. if (!segmentInfo) {
  75088. return;
  75089. }
  75090. if (typeof segmentInfo.timestampOffset === "number") {
  75091. this.isPendingTimestampOffset_ = false;
  75092. this.timelineChangeController_.pendingTimelineChange({
  75093. type: this.loaderType_,
  75094. from: this.currentTimeline_,
  75095. to: segmentInfo.timeline
  75096. });
  75097. }
  75098. this.loadSegment_(segmentInfo);
  75099. }
  75100. isEndOfStream_(mediaIndex = this.mediaIndex, playlist = this.playlist_, partIndex = this.partIndex) {
  75101. if (!playlist || !this.mediaSource_) {
  75102. return false;
  75103. }
  75104. const segment = typeof mediaIndex === "number" && playlist.segments[mediaIndex];
  75105. const appendedLastSegment = mediaIndex + 1 === playlist.segments.length;
  75106. const appendedLastPart = !segment || !segment.parts || partIndex + 1 === segment.parts.length;
  75107. return playlist.endList && this.mediaSource_.readyState === "open" && appendedLastSegment && appendedLastPart;
  75108. }
  75109. chooseNextRequest_() {
  75110. const buffered = this.buffered_();
  75111. const bufferedEnd = lastBufferedEnd$1(buffered) || 0;
  75112. const bufferedTime = timeAheadOf$1(buffered, this.currentTime_());
  75113. const preloaded = !this.hasPlayed_() && bufferedTime >= 1;
  75114. const haveEnoughBuffer = bufferedTime >= this.goalBufferLength_();
  75115. const segments = this.playlist_.segments;
  75116. if (!segments.length || preloaded || haveEnoughBuffer) {
  75117. return null;
  75118. }
  75119. this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_());
  75120. const next = {
  75121. partIndex: null,
  75122. mediaIndex: null,
  75123. startOfSegment: null,
  75124. playlist: this.playlist_,
  75125. isSyncRequest: Boolean(!this.syncPoint_)
  75126. };
  75127. if (next.isSyncRequest) {
  75128. next.mediaIndex = getSyncSegmentCandidate$1(this.currentTimeline_, segments, bufferedEnd);
  75129. } else if (this.mediaIndex !== null) {
  75130. const segment = segments[this.mediaIndex];
  75131. const partIndex = typeof this.partIndex === "number" ? this.partIndex : -1;
  75132. next.startOfSegment = segment.end ? segment.end : bufferedEnd;
  75133. if (segment.parts && segment.parts[partIndex + 1]) {
  75134. next.mediaIndex = this.mediaIndex;
  75135. next.partIndex = partIndex + 1;
  75136. } else {
  75137. next.mediaIndex = this.mediaIndex + 1;
  75138. }
  75139. } else {
  75140. const {
  75141. segmentIndex,
  75142. startTime,
  75143. partIndex
  75144. } = Playlist$1.getMediaInfoForTime({
  75145. exactManifestTimings: this.exactManifestTimings,
  75146. playlist: this.playlist_,
  75147. currentTime: this.fetchAtBuffer_ ? bufferedEnd : this.currentTime_(),
  75148. startingPartIndex: this.syncPoint_.partIndex,
  75149. startingSegmentIndex: this.syncPoint_.segmentIndex,
  75150. startTime: this.syncPoint_.time
  75151. });
  75152. next.getMediaInfoForTime = this.fetchAtBuffer_ ? `bufferedEnd ${bufferedEnd}` : `currentTime ${this.currentTime_()}`;
  75153. next.mediaIndex = segmentIndex;
  75154. next.startOfSegment = startTime;
  75155. next.partIndex = partIndex;
  75156. }
  75157. const nextSegment = segments[next.mediaIndex];
  75158. let nextPart = nextSegment && typeof next.partIndex === "number" && nextSegment.parts && nextSegment.parts[next.partIndex];
  75159. if (!nextSegment || typeof next.partIndex === "number" && !nextPart) {
  75160. return null;
  75161. }
  75162. if (typeof next.partIndex !== "number" && nextSegment.parts) {
  75163. next.partIndex = 0;
  75164. nextPart = nextSegment.parts[0];
  75165. }
  75166. if (!bufferedTime && nextPart && !nextPart.independent) {
  75167. if (next.partIndex === 0) {
  75168. const lastSegment = segments[next.mediaIndex - 1];
  75169. const lastSegmentLastPart = lastSegment.parts && lastSegment.parts.length && lastSegment.parts[lastSegment.parts.length - 1];
  75170. if (lastSegmentLastPart && lastSegmentLastPart.independent) {
  75171. next.mediaIndex -= 1;
  75172. next.partIndex = lastSegment.parts.length - 1;
  75173. next.independent = "previous segment";
  75174. }
  75175. } else if (nextSegment.parts[next.partIndex - 1].independent) {
  75176. next.partIndex -= 1;
  75177. next.independent = "previous part";
  75178. }
  75179. }
  75180. const ended = this.mediaSource_ && this.mediaSource_.readyState === "ended";
  75181. if (next.mediaIndex >= segments.length - 1 && ended && !this.seeking_()) {
  75182. return null;
  75183. }
  75184. return this.generateSegmentInfo_(next);
  75185. }
  75186. generateSegmentInfo_(options2) {
  75187. const {
  75188. independent,
  75189. playlist,
  75190. mediaIndex,
  75191. startOfSegment,
  75192. isSyncRequest,
  75193. partIndex,
  75194. forceTimestampOffset,
  75195. getMediaInfoForTime: getMediaInfoForTime3
  75196. } = options2;
  75197. const segment = playlist.segments[mediaIndex];
  75198. const part = typeof partIndex === "number" && segment.parts[partIndex];
  75199. const segmentInfo = {
  75200. requestId: "segment-loader-" + Math.random(),
  75201. uri: part && part.resolvedUri || segment.resolvedUri,
  75202. mediaIndex,
  75203. partIndex: part ? partIndex : null,
  75204. isSyncRequest,
  75205. startOfSegment,
  75206. playlist,
  75207. bytes: null,
  75208. encryptedBytes: null,
  75209. timestampOffset: null,
  75210. timeline: segment.timeline,
  75211. duration: part && part.duration || segment.duration,
  75212. segment,
  75213. part,
  75214. byteLength: 0,
  75215. transmuxer: this.transmuxer_,
  75216. getMediaInfoForTime: getMediaInfoForTime3,
  75217. independent
  75218. };
  75219. const overrideCheck = typeof forceTimestampOffset !== "undefined" ? forceTimestampOffset : this.isPendingTimestampOffset_;
  75220. segmentInfo.timestampOffset = this.timestampOffsetForSegment_({
  75221. segmentTimeline: segment.timeline,
  75222. currentTimeline: this.currentTimeline_,
  75223. startOfSegment,
  75224. buffered: this.buffered_(),
  75225. overrideCheck
  75226. });
  75227. const audioBufferedEnd = lastBufferedEnd$1(this.sourceUpdater_.audioBuffered());
  75228. if (typeof audioBufferedEnd === "number") {
  75229. segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset();
  75230. }
  75231. if (this.sourceUpdater_.videoBuffered().length) {
  75232. segmentInfo.gopsToAlignWith = gopsSafeToAlignWith$1(
  75233. this.gopBuffer_,
  75234. this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(),
  75235. this.timeMapping_
  75236. );
  75237. }
  75238. return segmentInfo;
  75239. }
  75240. timestampOffsetForSegment_(options2) {
  75241. return timestampOffsetForSegment$1(options2);
  75242. }
  75243. earlyAbortWhenNeeded_(stats) {
  75244. if (this.vhs_.tech_.paused() || !this.xhrOptions_.timeout || !this.playlist_.attributes.BANDWIDTH) {
  75245. return;
  75246. }
  75247. if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1e3) {
  75248. return;
  75249. }
  75250. const currentTime = this.currentTime_();
  75251. const measuredBandwidth = stats.bandwidth;
  75252. const segmentDuration = this.pendingSegment_.duration;
  75253. const requestTimeRemaining = Playlist$1.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived);
  75254. const timeUntilRebuffer$1$1 = timeUntilRebuffer$1(this.buffered_(), currentTime, this.vhs_.tech_.playbackRate()) - 1;
  75255. if (requestTimeRemaining <= timeUntilRebuffer$1$1) {
  75256. return;
  75257. }
  75258. const switchCandidate = minRebufferMaxBandwidthSelector$1({
  75259. main: this.vhs_.playlists.main,
  75260. currentTime,
  75261. bandwidth: measuredBandwidth,
  75262. duration: this.duration_(),
  75263. segmentDuration,
  75264. timeUntilRebuffer: timeUntilRebuffer$1$1,
  75265. currentTimeline: this.currentTimeline_,
  75266. syncController: this.syncController_
  75267. });
  75268. if (!switchCandidate) {
  75269. return;
  75270. }
  75271. const rebufferingImpact = requestTimeRemaining - timeUntilRebuffer$1$1;
  75272. const timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact;
  75273. let minimumTimeSaving = 0.5;
  75274. if (timeUntilRebuffer$1$1 <= TIME_FUDGE_FACTOR$1) {
  75275. minimumTimeSaving = 1;
  75276. }
  75277. if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) {
  75278. return;
  75279. }
  75280. this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * Config$1.BANDWIDTH_VARIANCE + 1;
  75281. this.trigger("earlyabort");
  75282. }
  75283. handleAbort_(segmentInfo) {
  75284. this.logger_(`Aborting ${segmentInfoString$1(segmentInfo)}`);
  75285. this.mediaRequestsAborted += 1;
  75286. }
  75287. handleProgress_(event2, simpleSegment) {
  75288. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75289. if (this.checkForAbort_(simpleSegment.requestId)) {
  75290. return;
  75291. }
  75292. this.trigger("progress");
  75293. }
  75294. handleTrackInfo_(simpleSegment, trackInfo) {
  75295. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75296. if (this.checkForAbort_(simpleSegment.requestId)) {
  75297. return;
  75298. }
  75299. if (this.checkForIllegalMediaSwitch(trackInfo)) {
  75300. return;
  75301. }
  75302. trackInfo = trackInfo || {};
  75303. if (!shallowEqual$1(this.currentMediaInfo_, trackInfo)) {
  75304. this.appendInitSegment_ = {
  75305. audio: true,
  75306. video: true
  75307. };
  75308. this.startingMediaInfo_ = trackInfo;
  75309. this.currentMediaInfo_ = trackInfo;
  75310. this.logger_("trackinfo update", trackInfo);
  75311. this.trigger("trackinfo");
  75312. }
  75313. if (this.checkForAbort_(simpleSegment.requestId)) {
  75314. return;
  75315. }
  75316. this.pendingSegment_.trackInfo = trackInfo;
  75317. if (this.hasEnoughInfoToAppend_()) {
  75318. this.processCallQueue_();
  75319. }
  75320. }
  75321. handleTimingInfo_(simpleSegment, mediaType, timeType, time) {
  75322. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75323. if (this.checkForAbort_(simpleSegment.requestId)) {
  75324. return;
  75325. }
  75326. const segmentInfo = this.pendingSegment_;
  75327. const timingInfoProperty = timingInfoPropertyForMedia$1(mediaType);
  75328. segmentInfo[timingInfoProperty] = segmentInfo[timingInfoProperty] || {};
  75329. segmentInfo[timingInfoProperty][timeType] = time;
  75330. this.logger_(`timinginfo: ${mediaType} - ${timeType} - ${time}`);
  75331. if (this.hasEnoughInfoToAppend_()) {
  75332. this.processCallQueue_();
  75333. }
  75334. }
  75335. handleCaptions_(simpleSegment, captionData) {
  75336. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75337. if (this.checkForAbort_(simpleSegment.requestId)) {
  75338. return;
  75339. }
  75340. if (captionData.length === 0) {
  75341. this.logger_("SegmentLoader received no captions from a caption event");
  75342. return;
  75343. }
  75344. const segmentInfo = this.pendingSegment_;
  75345. if (!segmentInfo.hasAppendedData_) {
  75346. this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, simpleSegment, captionData));
  75347. return;
  75348. }
  75349. const timestampOffset2 = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
  75350. const captionTracks = {};
  75351. captionData.forEach((caption) => {
  75352. captionTracks[caption.stream] = captionTracks[caption.stream] || {
  75353. startTime: Infinity,
  75354. captions: [],
  75355. endTime: 0
  75356. };
  75357. const captionTrack = captionTracks[caption.stream];
  75358. captionTrack.startTime = Math.min(captionTrack.startTime, caption.startTime + timestampOffset2);
  75359. captionTrack.endTime = Math.max(captionTrack.endTime, caption.endTime + timestampOffset2);
  75360. captionTrack.captions.push(caption);
  75361. });
  75362. Object.keys(captionTracks).forEach((trackName) => {
  75363. const {
  75364. startTime,
  75365. endTime,
  75366. captions
  75367. } = captionTracks[trackName];
  75368. const inbandTextTracks = this.inbandTextTracks_;
  75369. this.logger_(`adding cues from ${startTime} -> ${endTime} for ${trackName}`);
  75370. createCaptionsTrackIfNotExists$1(inbandTextTracks, this.vhs_.tech_, trackName);
  75371. removeCuesFromTrack$1(startTime, endTime, inbandTextTracks[trackName]);
  75372. addCaptionData$1({
  75373. captionArray: captions,
  75374. inbandTextTracks,
  75375. timestampOffset: timestampOffset2
  75376. });
  75377. });
  75378. if (this.transmuxer_) {
  75379. this.transmuxer_.postMessage({
  75380. action: "clearParsedMp4Captions"
  75381. });
  75382. }
  75383. }
  75384. handleId3_(simpleSegment, id3Frames, dispatchType) {
  75385. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75386. if (this.checkForAbort_(simpleSegment.requestId)) {
  75387. return;
  75388. }
  75389. const segmentInfo = this.pendingSegment_;
  75390. if (!segmentInfo.hasAppendedData_) {
  75391. this.metadataQueue_.id3.push(this.handleId3_.bind(this, simpleSegment, id3Frames, dispatchType));
  75392. return;
  75393. }
  75394. const timestampOffset2 = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
  75395. createMetadataTrackIfNotExists$1(this.inbandTextTracks_, dispatchType, this.vhs_.tech_);
  75396. addMetadata$1({
  75397. inbandTextTracks: this.inbandTextTracks_,
  75398. metadataArray: id3Frames,
  75399. timestampOffset: timestampOffset2,
  75400. videoDuration: this.duration_()
  75401. });
  75402. }
  75403. processMetadataQueue_() {
  75404. this.metadataQueue_.id3.forEach((fn2) => fn2());
  75405. this.metadataQueue_.caption.forEach((fn2) => fn2());
  75406. this.metadataQueue_.id3 = [];
  75407. this.metadataQueue_.caption = [];
  75408. }
  75409. processCallQueue_() {
  75410. const callQueue = this.callQueue_;
  75411. this.callQueue_ = [];
  75412. callQueue.forEach((fun) => fun());
  75413. }
  75414. processLoadQueue_() {
  75415. const loadQueue = this.loadQueue_;
  75416. this.loadQueue_ = [];
  75417. loadQueue.forEach((fun) => fun());
  75418. }
  75419. hasEnoughInfoToLoad_() {
  75420. if (this.loaderType_ !== "audio") {
  75421. return true;
  75422. }
  75423. const segmentInfo = this.pendingSegment_;
  75424. if (!segmentInfo) {
  75425. return false;
  75426. }
  75427. if (!this.getCurrentMediaInfo_()) {
  75428. return true;
  75429. }
  75430. if (shouldWaitForTimelineChange$1({
  75431. timelineChangeController: this.timelineChangeController_,
  75432. currentTimeline: this.currentTimeline_,
  75433. segmentTimeline: segmentInfo.timeline,
  75434. loaderType: this.loaderType_,
  75435. audioDisabled: this.audioDisabled_
  75436. })) {
  75437. return false;
  75438. }
  75439. return true;
  75440. }
  75441. getCurrentMediaInfo_(segmentInfo = this.pendingSegment_) {
  75442. return segmentInfo && segmentInfo.trackInfo || this.currentMediaInfo_;
  75443. }
  75444. getMediaInfo_(segmentInfo = this.pendingSegment_) {
  75445. return this.getCurrentMediaInfo_(segmentInfo) || this.startingMediaInfo_;
  75446. }
  75447. getPendingSegmentPlaylist() {
  75448. return this.pendingSegment_ ? this.pendingSegment_.playlist : null;
  75449. }
  75450. hasEnoughInfoToAppend_() {
  75451. if (!this.sourceUpdater_.ready()) {
  75452. return false;
  75453. }
  75454. if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) {
  75455. return false;
  75456. }
  75457. const segmentInfo = this.pendingSegment_;
  75458. const trackInfo = this.getCurrentMediaInfo_();
  75459. if (!segmentInfo || !trackInfo) {
  75460. return false;
  75461. }
  75462. const {
  75463. hasAudio,
  75464. hasVideo,
  75465. isMuxed: isMuxed3
  75466. } = trackInfo;
  75467. if (hasVideo && !segmentInfo.videoTimingInfo) {
  75468. return false;
  75469. }
  75470. if (hasAudio && !this.audioDisabled_ && !isMuxed3 && !segmentInfo.audioTimingInfo) {
  75471. return false;
  75472. }
  75473. if (shouldWaitForTimelineChange$1({
  75474. timelineChangeController: this.timelineChangeController_,
  75475. currentTimeline: this.currentTimeline_,
  75476. segmentTimeline: segmentInfo.timeline,
  75477. loaderType: this.loaderType_,
  75478. audioDisabled: this.audioDisabled_
  75479. })) {
  75480. return false;
  75481. }
  75482. return true;
  75483. }
  75484. handleData_(simpleSegment, result) {
  75485. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  75486. if (this.checkForAbort_(simpleSegment.requestId)) {
  75487. return;
  75488. }
  75489. if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) {
  75490. this.callQueue_.push(this.handleData_.bind(this, simpleSegment, result));
  75491. return;
  75492. }
  75493. const segmentInfo = this.pendingSegment_;
  75494. this.setTimeMapping_(segmentInfo.timeline);
  75495. this.updateMediaSecondsLoaded_(segmentInfo.part || segmentInfo.segment);
  75496. if (this.mediaSource_.readyState === "closed") {
  75497. return;
  75498. }
  75499. if (simpleSegment.map) {
  75500. simpleSegment.map = this.initSegmentForMap(simpleSegment.map, true);
  75501. segmentInfo.segment.map = simpleSegment.map;
  75502. }
  75503. if (simpleSegment.key) {
  75504. this.segmentKey(simpleSegment.key, true);
  75505. }
  75506. segmentInfo.isFmp4 = simpleSegment.isFmp4;
  75507. segmentInfo.timingInfo = segmentInfo.timingInfo || {};
  75508. if (segmentInfo.isFmp4) {
  75509. this.trigger("fmp4");
  75510. segmentInfo.timingInfo.start = segmentInfo[timingInfoPropertyForMedia$1(result.type)].start;
  75511. } else {
  75512. const trackInfo = this.getCurrentMediaInfo_();
  75513. const useVideoTimingInfo = this.loaderType_ === "main" && trackInfo && trackInfo.hasVideo;
  75514. let firstVideoFrameTimeForData;
  75515. if (useVideoTimingInfo) {
  75516. firstVideoFrameTimeForData = segmentInfo.videoTimingInfo.start;
  75517. }
  75518. segmentInfo.timingInfo.start = this.trueSegmentStart_({
  75519. currentStart: segmentInfo.timingInfo.start,
  75520. playlist: segmentInfo.playlist,
  75521. mediaIndex: segmentInfo.mediaIndex,
  75522. currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(),
  75523. useVideoTimingInfo,
  75524. firstVideoFrameTimeForData,
  75525. videoTimingInfo: segmentInfo.videoTimingInfo,
  75526. audioTimingInfo: segmentInfo.audioTimingInfo
  75527. });
  75528. }
  75529. this.updateAppendInitSegmentStatus(segmentInfo, result.type);
  75530. this.updateSourceBufferTimestampOffset_(segmentInfo);
  75531. if (segmentInfo.isSyncRequest) {
  75532. this.updateTimingInfoEnd_(segmentInfo);
  75533. this.syncController_.saveSegmentTimingInfo({
  75534. segmentInfo,
  75535. shouldSaveTimelineMapping: this.loaderType_ === "main"
  75536. });
  75537. const next = this.chooseNextRequest_();
  75538. if (next.mediaIndex !== segmentInfo.mediaIndex || next.partIndex !== segmentInfo.partIndex) {
  75539. this.logger_("sync segment was incorrect, not appending");
  75540. return;
  75541. }
  75542. this.logger_("sync segment was correct, appending");
  75543. }
  75544. segmentInfo.hasAppendedData_ = true;
  75545. this.processMetadataQueue_();
  75546. this.appendData_(segmentInfo, result);
  75547. }
  75548. updateAppendInitSegmentStatus(segmentInfo, type2) {
  75549. if (this.loaderType_ === "main" && typeof segmentInfo.timestampOffset === "number" && !segmentInfo.changedTimestampOffset) {
  75550. this.appendInitSegment_ = {
  75551. audio: true,
  75552. video: true
  75553. };
  75554. }
  75555. if (this.playlistOfLastInitSegment_[type2] !== segmentInfo.playlist) {
  75556. this.appendInitSegment_[type2] = true;
  75557. }
  75558. }
  75559. getInitSegmentAndUpdateState_({
  75560. type: type2,
  75561. initSegment,
  75562. map,
  75563. playlist
  75564. }) {
  75565. if (map) {
  75566. const id = initSegmentId$1(map);
  75567. if (this.activeInitSegmentId_ === id) {
  75568. return null;
  75569. }
  75570. initSegment = this.initSegmentForMap(map, true).bytes;
  75571. this.activeInitSegmentId_ = id;
  75572. }
  75573. if (initSegment && this.appendInitSegment_[type2]) {
  75574. this.playlistOfLastInitSegment_[type2] = playlist;
  75575. this.appendInitSegment_[type2] = false;
  75576. this.activeInitSegmentId_ = null;
  75577. return initSegment;
  75578. }
  75579. return null;
  75580. }
  75581. handleQuotaExceededError_({
  75582. segmentInfo,
  75583. type: type2,
  75584. bytes
  75585. }, error) {
  75586. const audioBuffered = this.sourceUpdater_.audioBuffered();
  75587. const videoBuffered = this.sourceUpdater_.videoBuffered();
  75588. if (audioBuffered.length > 1) {
  75589. this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: " + timeRangesToArray$1(audioBuffered).join(", "));
  75590. }
  75591. if (videoBuffered.length > 1) {
  75592. this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: " + timeRangesToArray$1(videoBuffered).join(", "));
  75593. }
  75594. const audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0;
  75595. const audioBufferEnd = audioBuffered.length ? audioBuffered.end(audioBuffered.length - 1) : 0;
  75596. const videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0;
  75597. const videoBufferEnd = videoBuffered.length ? videoBuffered.end(videoBuffered.length - 1) : 0;
  75598. if (audioBufferEnd - audioBufferStart <= MIN_BACK_BUFFER$1 && videoBufferEnd - videoBufferStart <= MIN_BACK_BUFFER$1) {
  75599. this.logger_(`On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. Appended byte length: ${bytes.byteLength}, audio buffer: ${timeRangesToArray$1(audioBuffered).join(", ")}, video buffer: ${timeRangesToArray$1(videoBuffered).join(", ")}, `);
  75600. this.error({
  75601. message: "Quota exceeded error with append of a single segment of content",
  75602. excludeUntil: Infinity
  75603. });
  75604. this.trigger("error");
  75605. return;
  75606. }
  75607. this.waitingOnRemove_ = true;
  75608. this.callQueue_.push(this.appendToSourceBuffer_.bind(this, {
  75609. segmentInfo,
  75610. type: type2,
  75611. bytes
  75612. }));
  75613. const currentTime = this.currentTime_();
  75614. const timeToRemoveUntil = currentTime - MIN_BACK_BUFFER$1;
  75615. this.logger_(`On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to ${timeToRemoveUntil}`);
  75616. this.remove(0, timeToRemoveUntil, () => {
  75617. this.logger_(`On QUOTA_EXCEEDED_ERR, retrying append in ${MIN_BACK_BUFFER$1}s`);
  75618. this.waitingOnRemove_ = false;
  75619. this.quotaExceededErrorRetryTimeout_ = window_1.setTimeout(() => {
  75620. this.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue");
  75621. this.quotaExceededErrorRetryTimeout_ = null;
  75622. this.processCallQueue_();
  75623. }, MIN_BACK_BUFFER$1 * 1e3);
  75624. }, true);
  75625. }
  75626. handleAppendError_({
  75627. segmentInfo,
  75628. type: type2,
  75629. bytes
  75630. }, error) {
  75631. if (!error) {
  75632. return;
  75633. }
  75634. if (error.code === QUOTA_EXCEEDED_ERR$1) {
  75635. this.handleQuotaExceededError_({
  75636. segmentInfo,
  75637. type: type2,
  75638. bytes
  75639. });
  75640. return;
  75641. }
  75642. this.logger_("Received non QUOTA_EXCEEDED_ERR on append", error);
  75643. this.error(`${type2} append of ${bytes.length}b failed for segment #${segmentInfo.mediaIndex} in playlist ${segmentInfo.playlist.id}`);
  75644. this.trigger("appenderror");
  75645. }
  75646. appendToSourceBuffer_({
  75647. segmentInfo,
  75648. type: type2,
  75649. initSegment,
  75650. data,
  75651. bytes
  75652. }) {
  75653. if (!bytes) {
  75654. const segments = [data];
  75655. let byteLength = data.byteLength;
  75656. if (initSegment) {
  75657. segments.unshift(initSegment);
  75658. byteLength += initSegment.byteLength;
  75659. }
  75660. bytes = concatSegments$1({
  75661. bytes: byteLength,
  75662. segments
  75663. });
  75664. }
  75665. this.sourceUpdater_.appendBuffer({
  75666. segmentInfo,
  75667. type: type2,
  75668. bytes
  75669. }, this.handleAppendError_.bind(this, {
  75670. segmentInfo,
  75671. type: type2,
  75672. bytes
  75673. }));
  75674. }
  75675. handleSegmentTimingInfo_(type2, requestId, segmentTimingInfo) {
  75676. if (!this.pendingSegment_ || requestId !== this.pendingSegment_.requestId) {
  75677. return;
  75678. }
  75679. const segment = this.pendingSegment_.segment;
  75680. const timingInfoProperty = `${type2}TimingInfo`;
  75681. if (!segment[timingInfoProperty]) {
  75682. segment[timingInfoProperty] = {};
  75683. }
  75684. segment[timingInfoProperty].transmuxerPrependedSeconds = segmentTimingInfo.prependedContentDuration || 0;
  75685. segment[timingInfoProperty].transmuxedPresentationStart = segmentTimingInfo.start.presentation;
  75686. segment[timingInfoProperty].transmuxedDecodeStart = segmentTimingInfo.start.decode;
  75687. segment[timingInfoProperty].transmuxedPresentationEnd = segmentTimingInfo.end.presentation;
  75688. segment[timingInfoProperty].transmuxedDecodeEnd = segmentTimingInfo.end.decode;
  75689. segment[timingInfoProperty].baseMediaDecodeTime = segmentTimingInfo.baseMediaDecodeTime;
  75690. }
  75691. appendData_(segmentInfo, result) {
  75692. const {
  75693. type: type2,
  75694. data
  75695. } = result;
  75696. if (!data || !data.byteLength) {
  75697. return;
  75698. }
  75699. if (type2 === "audio" && this.audioDisabled_) {
  75700. return;
  75701. }
  75702. const initSegment = this.getInitSegmentAndUpdateState_({
  75703. type: type2,
  75704. initSegment: result.initSegment,
  75705. playlist: segmentInfo.playlist,
  75706. map: segmentInfo.isFmp4 ? segmentInfo.segment.map : null
  75707. });
  75708. this.appendToSourceBuffer_({
  75709. segmentInfo,
  75710. type: type2,
  75711. initSegment,
  75712. data
  75713. });
  75714. }
  75715. loadSegment_(segmentInfo) {
  75716. this.state = "WAITING";
  75717. this.pendingSegment_ = segmentInfo;
  75718. this.trimBackBuffer_(segmentInfo);
  75719. if (typeof segmentInfo.timestampOffset === "number") {
  75720. if (this.transmuxer_) {
  75721. this.transmuxer_.postMessage({
  75722. action: "clearAllMp4Captions"
  75723. });
  75724. }
  75725. }
  75726. if (!this.hasEnoughInfoToLoad_()) {
  75727. this.loadQueue_.push(() => {
  75728. const options2 = _extends$2({}, segmentInfo, {
  75729. forceTimestampOffset: true
  75730. });
  75731. _extends$2(segmentInfo, this.generateSegmentInfo_(options2));
  75732. this.isPendingTimestampOffset_ = false;
  75733. this.updateTransmuxerAndRequestSegment_(segmentInfo);
  75734. });
  75735. return;
  75736. }
  75737. this.updateTransmuxerAndRequestSegment_(segmentInfo);
  75738. }
  75739. updateTransmuxerAndRequestSegment_(segmentInfo) {
  75740. if (this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)) {
  75741. this.gopBuffer_.length = 0;
  75742. segmentInfo.gopsToAlignWith = [];
  75743. this.timeMapping_ = 0;
  75744. this.transmuxer_.postMessage({
  75745. action: "reset"
  75746. });
  75747. this.transmuxer_.postMessage({
  75748. action: "setTimestampOffset",
  75749. timestampOffset: segmentInfo.timestampOffset
  75750. });
  75751. }
  75752. const simpleSegment = this.createSimplifiedSegmentObj_(segmentInfo);
  75753. const isEndOfStream = this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex);
  75754. const isWalkingForward = this.mediaIndex !== null;
  75755. const isDiscontinuity = segmentInfo.timeline !== this.currentTimeline_ && segmentInfo.timeline > 0;
  75756. const isEndOfTimeline = isEndOfStream || isWalkingForward && isDiscontinuity;
  75757. this.logger_(`Requesting ${segmentInfoString$1(segmentInfo)}`);
  75758. if (simpleSegment.map && !simpleSegment.map.bytes) {
  75759. this.logger_("going to request init segment.");
  75760. this.appendInitSegment_ = {
  75761. video: true,
  75762. audio: true
  75763. };
  75764. }
  75765. segmentInfo.abortRequests = mediaSegmentRequest$1({
  75766. xhr: this.vhs_.xhr,
  75767. xhrOptions: this.xhrOptions_,
  75768. decryptionWorker: this.decrypter_,
  75769. segment: simpleSegment,
  75770. abortFn: this.handleAbort_.bind(this, segmentInfo),
  75771. progressFn: this.handleProgress_.bind(this),
  75772. trackInfoFn: this.handleTrackInfo_.bind(this),
  75773. timingInfoFn: this.handleTimingInfo_.bind(this),
  75774. videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "video", segmentInfo.requestId),
  75775. audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "audio", segmentInfo.requestId),
  75776. captionsFn: this.handleCaptions_.bind(this),
  75777. isEndOfTimeline,
  75778. endedTimelineFn: () => {
  75779. this.logger_("received endedtimeline callback");
  75780. },
  75781. id3Fn: this.handleId3_.bind(this),
  75782. dataFn: this.handleData_.bind(this),
  75783. doneFn: this.segmentRequestFinished_.bind(this),
  75784. onTransmuxerLog: ({
  75785. message,
  75786. level,
  75787. stream
  75788. }) => {
  75789. this.logger_(`${segmentInfoString$1(segmentInfo)} logged from transmuxer stream ${stream} as a ${level}: ${message}`);
  75790. }
  75791. });
  75792. }
  75793. trimBackBuffer_(segmentInfo) {
  75794. const removeToTime = safeBackBufferTrimTime$1(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10);
  75795. if (removeToTime > 0) {
  75796. this.remove(0, removeToTime);
  75797. }
  75798. }
  75799. createSimplifiedSegmentObj_(segmentInfo) {
  75800. const segment = segmentInfo.segment;
  75801. const part = segmentInfo.part;
  75802. const simpleSegment = {
  75803. resolvedUri: part ? part.resolvedUri : segment.resolvedUri,
  75804. byterange: part ? part.byterange : segment.byterange,
  75805. requestId: segmentInfo.requestId,
  75806. transmuxer: segmentInfo.transmuxer,
  75807. audioAppendStart: segmentInfo.audioAppendStart,
  75808. gopsToAlignWith: segmentInfo.gopsToAlignWith,
  75809. part: segmentInfo.part
  75810. };
  75811. const previousSegment = segmentInfo.playlist.segments[segmentInfo.mediaIndex - 1];
  75812. if (previousSegment && previousSegment.timeline === segment.timeline) {
  75813. if (previousSegment.videoTimingInfo) {
  75814. simpleSegment.baseStartTime = previousSegment.videoTimingInfo.transmuxedDecodeEnd;
  75815. } else if (previousSegment.audioTimingInfo) {
  75816. simpleSegment.baseStartTime = previousSegment.audioTimingInfo.transmuxedDecodeEnd;
  75817. }
  75818. }
  75819. if (segment.key) {
  75820. const iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]);
  75821. simpleSegment.key = this.segmentKey(segment.key);
  75822. simpleSegment.key.iv = iv;
  75823. }
  75824. if (segment.map) {
  75825. simpleSegment.map = this.initSegmentForMap(segment.map);
  75826. }
  75827. return simpleSegment;
  75828. }
  75829. saveTransferStats_(stats) {
  75830. this.mediaRequests += 1;
  75831. if (stats) {
  75832. this.mediaBytesTransferred += stats.bytesReceived;
  75833. this.mediaTransferDuration += stats.roundTripTime;
  75834. }
  75835. }
  75836. saveBandwidthRelatedStats_(duration5, stats) {
  75837. this.pendingSegment_.byteLength = stats.bytesReceived;
  75838. if (duration5 < MIN_SEGMENT_DURATION_TO_SAVE_STATS$1) {
  75839. this.logger_(`Ignoring segment's bandwidth because its duration of ${duration5} is less than the min to record ${MIN_SEGMENT_DURATION_TO_SAVE_STATS$1}`);
  75840. return;
  75841. }
  75842. this.bandwidth = stats.bandwidth;
  75843. this.roundTrip = stats.roundTripTime;
  75844. }
  75845. handleTimeout_() {
  75846. this.mediaRequestsTimedout += 1;
  75847. this.bandwidth = 1;
  75848. this.roundTrip = NaN;
  75849. this.trigger("bandwidthupdate");
  75850. this.trigger("timeout");
  75851. }
  75852. segmentRequestFinished_(error, simpleSegment, result) {
  75853. if (this.callQueue_.length) {
  75854. this.callQueue_.push(this.segmentRequestFinished_.bind(this, error, simpleSegment, result));
  75855. return;
  75856. }
  75857. this.saveTransferStats_(simpleSegment.stats);
  75858. if (!this.pendingSegment_) {
  75859. return;
  75860. }
  75861. if (simpleSegment.requestId !== this.pendingSegment_.requestId) {
  75862. return;
  75863. }
  75864. if (error) {
  75865. this.pendingSegment_ = null;
  75866. this.state = "READY";
  75867. if (error.code === REQUEST_ERRORS$1.ABORTED) {
  75868. return;
  75869. }
  75870. this.pause();
  75871. if (error.code === REQUEST_ERRORS$1.TIMEOUT) {
  75872. this.handleTimeout_();
  75873. return;
  75874. }
  75875. this.mediaRequestsErrored += 1;
  75876. this.error(error);
  75877. this.trigger("error");
  75878. return;
  75879. }
  75880. const segmentInfo = this.pendingSegment_;
  75881. this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);
  75882. segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests;
  75883. if (result.gopInfo) {
  75884. this.gopBuffer_ = updateGopBuffer$1(this.gopBuffer_, result.gopInfo, this.safeAppend_);
  75885. }
  75886. this.state = "APPENDING";
  75887. this.trigger("appending");
  75888. this.waitForAppendsToComplete_(segmentInfo);
  75889. }
  75890. setTimeMapping_(timeline) {
  75891. const timelineMapping = this.syncController_.mappingForTimeline(timeline);
  75892. if (timelineMapping !== null) {
  75893. this.timeMapping_ = timelineMapping;
  75894. }
  75895. }
  75896. updateMediaSecondsLoaded_(segment) {
  75897. if (typeof segment.start === "number" && typeof segment.end === "number") {
  75898. this.mediaSecondsLoaded += segment.end - segment.start;
  75899. } else {
  75900. this.mediaSecondsLoaded += segment.duration;
  75901. }
  75902. }
  75903. shouldUpdateTransmuxerTimestampOffset_(timestampOffset2) {
  75904. if (timestampOffset2 === null) {
  75905. return false;
  75906. }
  75907. if (this.loaderType_ === "main" && timestampOffset2 !== this.sourceUpdater_.videoTimestampOffset()) {
  75908. return true;
  75909. }
  75910. if (!this.audioDisabled_ && timestampOffset2 !== this.sourceUpdater_.audioTimestampOffset()) {
  75911. return true;
  75912. }
  75913. return false;
  75914. }
  75915. trueSegmentStart_({
  75916. currentStart,
  75917. playlist,
  75918. mediaIndex,
  75919. firstVideoFrameTimeForData,
  75920. currentVideoTimestampOffset,
  75921. useVideoTimingInfo,
  75922. videoTimingInfo,
  75923. audioTimingInfo
  75924. }) {
  75925. if (typeof currentStart !== "undefined") {
  75926. return currentStart;
  75927. }
  75928. if (!useVideoTimingInfo) {
  75929. return audioTimingInfo.start;
  75930. }
  75931. const previousSegment = playlist.segments[mediaIndex - 1];
  75932. if (mediaIndex === 0 || !previousSegment || typeof previousSegment.start === "undefined" || previousSegment.end !== firstVideoFrameTimeForData + currentVideoTimestampOffset) {
  75933. return firstVideoFrameTimeForData;
  75934. }
  75935. return videoTimingInfo.start;
  75936. }
  75937. waitForAppendsToComplete_(segmentInfo) {
  75938. const trackInfo = this.getCurrentMediaInfo_(segmentInfo);
  75939. if (!trackInfo) {
  75940. this.error({
  75941. message: "No starting media returned, likely due to an unsupported media format.",
  75942. playlistExclusionDuration: Infinity
  75943. });
  75944. this.trigger("error");
  75945. return;
  75946. }
  75947. const {
  75948. hasAudio,
  75949. hasVideo,
  75950. isMuxed: isMuxed3
  75951. } = trackInfo;
  75952. const waitForVideo = this.loaderType_ === "main" && hasVideo;
  75953. const waitForAudio = !this.audioDisabled_ && hasAudio && !isMuxed3;
  75954. segmentInfo.waitingOnAppends = 0;
  75955. if (!segmentInfo.hasAppendedData_) {
  75956. if (!segmentInfo.timingInfo && typeof segmentInfo.timestampOffset === "number") {
  75957. this.isPendingTimestampOffset_ = true;
  75958. }
  75959. segmentInfo.timingInfo = {
  75960. start: 0
  75961. };
  75962. segmentInfo.waitingOnAppends++;
  75963. if (!this.isPendingTimestampOffset_) {
  75964. this.updateSourceBufferTimestampOffset_(segmentInfo);
  75965. this.processMetadataQueue_();
  75966. }
  75967. this.checkAppendsDone_(segmentInfo);
  75968. return;
  75969. }
  75970. if (waitForVideo) {
  75971. segmentInfo.waitingOnAppends++;
  75972. }
  75973. if (waitForAudio) {
  75974. segmentInfo.waitingOnAppends++;
  75975. }
  75976. if (waitForVideo) {
  75977. this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));
  75978. }
  75979. if (waitForAudio) {
  75980. this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));
  75981. }
  75982. }
  75983. checkAppendsDone_(segmentInfo) {
  75984. if (this.checkForAbort_(segmentInfo.requestId)) {
  75985. return;
  75986. }
  75987. segmentInfo.waitingOnAppends--;
  75988. if (segmentInfo.waitingOnAppends === 0) {
  75989. this.handleAppendsDone_();
  75990. }
  75991. }
  75992. checkForIllegalMediaSwitch(trackInfo) {
  75993. const illegalMediaSwitchError = illegalMediaSwitch$1(this.loaderType_, this.getCurrentMediaInfo_(), trackInfo);
  75994. if (illegalMediaSwitchError) {
  75995. this.error({
  75996. message: illegalMediaSwitchError,
  75997. playlistExclusionDuration: Infinity
  75998. });
  75999. this.trigger("error");
  76000. return true;
  76001. }
  76002. return false;
  76003. }
  76004. updateSourceBufferTimestampOffset_(segmentInfo) {
  76005. if (segmentInfo.timestampOffset === null || typeof segmentInfo.timingInfo.start !== "number" || segmentInfo.changedTimestampOffset || this.loaderType_ !== "main") {
  76006. return;
  76007. }
  76008. let didChange = false;
  76009. segmentInfo.timestampOffset -= this.getSegmentStartTimeForTimestampOffsetCalculation_({
  76010. videoTimingInfo: segmentInfo.segment.videoTimingInfo,
  76011. audioTimingInfo: segmentInfo.segment.audioTimingInfo,
  76012. timingInfo: segmentInfo.timingInfo
  76013. });
  76014. segmentInfo.changedTimestampOffset = true;
  76015. if (segmentInfo.timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) {
  76016. this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset);
  76017. didChange = true;
  76018. }
  76019. if (segmentInfo.timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) {
  76020. this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset);
  76021. didChange = true;
  76022. }
  76023. if (didChange) {
  76024. this.trigger("timestampoffset");
  76025. }
  76026. }
  76027. getSegmentStartTimeForTimestampOffsetCalculation_({
  76028. videoTimingInfo,
  76029. audioTimingInfo,
  76030. timingInfo
  76031. }) {
  76032. if (!this.useDtsForTimestampOffset_) {
  76033. return timingInfo.start;
  76034. }
  76035. if (videoTimingInfo && typeof videoTimingInfo.transmuxedDecodeStart === "number") {
  76036. return videoTimingInfo.transmuxedDecodeStart;
  76037. }
  76038. if (audioTimingInfo && typeof audioTimingInfo.transmuxedDecodeStart === "number") {
  76039. return audioTimingInfo.transmuxedDecodeStart;
  76040. }
  76041. return timingInfo.start;
  76042. }
  76043. updateTimingInfoEnd_(segmentInfo) {
  76044. segmentInfo.timingInfo = segmentInfo.timingInfo || {};
  76045. const trackInfo = this.getMediaInfo_();
  76046. const useVideoTimingInfo = this.loaderType_ === "main" && trackInfo && trackInfo.hasVideo;
  76047. const prioritizedTimingInfo = useVideoTimingInfo && segmentInfo.videoTimingInfo ? segmentInfo.videoTimingInfo : segmentInfo.audioTimingInfo;
  76048. if (!prioritizedTimingInfo) {
  76049. return;
  76050. }
  76051. segmentInfo.timingInfo.end = typeof prioritizedTimingInfo.end === "number" ? prioritizedTimingInfo.end : prioritizedTimingInfo.start + segmentInfo.duration;
  76052. }
  76053. handleAppendsDone_() {
  76054. if (this.pendingSegment_) {
  76055. this.trigger("appendsdone");
  76056. }
  76057. if (!this.pendingSegment_) {
  76058. this.state = "READY";
  76059. if (!this.paused()) {
  76060. this.monitorBuffer_();
  76061. }
  76062. return;
  76063. }
  76064. const segmentInfo = this.pendingSegment_;
  76065. this.updateTimingInfoEnd_(segmentInfo);
  76066. if (this.shouldSaveSegmentTimingInfo_) {
  76067. this.syncController_.saveSegmentTimingInfo({
  76068. segmentInfo,
  76069. shouldSaveTimelineMapping: this.loaderType_ === "main"
  76070. });
  76071. }
  76072. const segmentDurationMessage = getTroublesomeSegmentDurationMessage$1(segmentInfo, this.sourceType_);
  76073. if (segmentDurationMessage) {
  76074. if (segmentDurationMessage.severity === "warn") {
  76075. videojs$2.log.warn(segmentDurationMessage.message);
  76076. } else {
  76077. this.logger_(segmentDurationMessage.message);
  76078. }
  76079. }
  76080. this.recordThroughput_(segmentInfo);
  76081. this.pendingSegment_ = null;
  76082. this.state = "READY";
  76083. if (segmentInfo.isSyncRequest) {
  76084. this.trigger("syncinfoupdate");
  76085. if (!segmentInfo.hasAppendedData_) {
  76086. this.logger_(`Throwing away un-appended sync request ${segmentInfoString$1(segmentInfo)}`);
  76087. return;
  76088. }
  76089. }
  76090. this.logger_(`Appended ${segmentInfoString$1(segmentInfo)}`);
  76091. this.addSegmentMetadataCue_(segmentInfo);
  76092. this.fetchAtBuffer_ = true;
  76093. if (this.currentTimeline_ !== segmentInfo.timeline) {
  76094. this.timelineChangeController_.lastTimelineChange({
  76095. type: this.loaderType_,
  76096. from: this.currentTimeline_,
  76097. to: segmentInfo.timeline
  76098. });
  76099. if (this.loaderType_ === "main" && !this.audioDisabled_) {
  76100. this.timelineChangeController_.lastTimelineChange({
  76101. type: "audio",
  76102. from: this.currentTimeline_,
  76103. to: segmentInfo.timeline
  76104. });
  76105. }
  76106. }
  76107. this.currentTimeline_ = segmentInfo.timeline;
  76108. this.trigger("syncinfoupdate");
  76109. const segment = segmentInfo.segment;
  76110. const part = segmentInfo.part;
  76111. const badSegmentGuess = segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3;
  76112. const badPartGuess = part && part.end && this.currentTime_() - part.end > segmentInfo.playlist.partTargetDuration * 3;
  76113. if (badSegmentGuess || badPartGuess) {
  76114. this.logger_(`bad ${badSegmentGuess ? "segment" : "part"} ${segmentInfoString$1(segmentInfo)}`);
  76115. this.resetEverything();
  76116. return;
  76117. }
  76118. const isWalkingForward = this.mediaIndex !== null;
  76119. if (isWalkingForward) {
  76120. this.trigger("bandwidthupdate");
  76121. }
  76122. this.trigger("progress");
  76123. this.mediaIndex = segmentInfo.mediaIndex;
  76124. this.partIndex = segmentInfo.partIndex;
  76125. if (this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex)) {
  76126. this.endOfStream();
  76127. }
  76128. this.trigger("appended");
  76129. if (segmentInfo.hasAppendedData_) {
  76130. this.mediaAppends++;
  76131. }
  76132. if (!this.paused()) {
  76133. this.monitorBuffer_();
  76134. }
  76135. }
  76136. recordThroughput_(segmentInfo) {
  76137. if (segmentInfo.duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS$1) {
  76138. this.logger_(`Ignoring segment's throughput because its duration of ${segmentInfo.duration} is less than the min to record ${MIN_SEGMENT_DURATION_TO_SAVE_STATS$1}`);
  76139. return;
  76140. }
  76141. const rate = this.throughput.rate;
  76142. const segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1;
  76143. const segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1e3);
  76144. this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count;
  76145. }
  76146. addSegmentMetadataCue_(segmentInfo) {
  76147. if (!this.segmentMetadataTrack_) {
  76148. return;
  76149. }
  76150. const segment = segmentInfo.segment;
  76151. const start2 = segment.start;
  76152. const end = segment.end;
  76153. if (!finite$1(start2) || !finite$1(end)) {
  76154. return;
  76155. }
  76156. removeCuesFromTrack$1(start2, end, this.segmentMetadataTrack_);
  76157. const Cue = window_1.WebKitDataCue || window_1.VTTCue;
  76158. const value = {
  76159. custom: segment.custom,
  76160. dateTimeObject: segment.dateTimeObject,
  76161. dateTimeString: segment.dateTimeString,
  76162. bandwidth: segmentInfo.playlist.attributes.BANDWIDTH,
  76163. resolution: segmentInfo.playlist.attributes.RESOLUTION,
  76164. codecs: segmentInfo.playlist.attributes.CODECS,
  76165. byteLength: segmentInfo.byteLength,
  76166. uri: segmentInfo.uri,
  76167. timeline: segmentInfo.timeline,
  76168. playlist: segmentInfo.playlist.id,
  76169. start: start2,
  76170. end
  76171. };
  76172. const data = JSON.stringify(value);
  76173. const cue = new Cue(start2, end, data);
  76174. cue.value = value;
  76175. this.segmentMetadataTrack_.addCue(cue);
  76176. }
  76177. }
  76178. function noop$1() {
  76179. }
  76180. const toTitleCase$2 = function(string) {
  76181. if (typeof string !== "string") {
  76182. return string;
  76183. }
  76184. return string.replace(/./, (w) => w.toUpperCase());
  76185. };
  76186. const bufferTypes$1 = ["video", "audio"];
  76187. const updating = (type2, sourceUpdater) => {
  76188. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76189. return sourceBuffer && sourceBuffer.updating || sourceUpdater.queuePending[type2];
  76190. };
  76191. const nextQueueIndexOfType$1 = (type2, queue) => {
  76192. for (let i2 = 0; i2 < queue.length; i2++) {
  76193. const queueEntry = queue[i2];
  76194. if (queueEntry.type === "mediaSource") {
  76195. return null;
  76196. }
  76197. if (queueEntry.type === type2) {
  76198. return i2;
  76199. }
  76200. }
  76201. return null;
  76202. };
  76203. const shiftQueue$1 = (type2, sourceUpdater) => {
  76204. if (sourceUpdater.queue.length === 0) {
  76205. return;
  76206. }
  76207. let queueIndex = 0;
  76208. let queueEntry = sourceUpdater.queue[queueIndex];
  76209. if (queueEntry.type === "mediaSource") {
  76210. if (!sourceUpdater.updating() && sourceUpdater.mediaSource.readyState !== "closed") {
  76211. sourceUpdater.queue.shift();
  76212. queueEntry.action(sourceUpdater);
  76213. if (queueEntry.doneFn) {
  76214. queueEntry.doneFn();
  76215. }
  76216. shiftQueue$1("audio", sourceUpdater);
  76217. shiftQueue$1("video", sourceUpdater);
  76218. }
  76219. return;
  76220. }
  76221. if (type2 === "mediaSource") {
  76222. return;
  76223. }
  76224. if (!sourceUpdater.ready() || sourceUpdater.mediaSource.readyState === "closed" || updating(type2, sourceUpdater)) {
  76225. return;
  76226. }
  76227. if (queueEntry.type !== type2) {
  76228. queueIndex = nextQueueIndexOfType$1(type2, sourceUpdater.queue);
  76229. if (queueIndex === null) {
  76230. return;
  76231. }
  76232. queueEntry = sourceUpdater.queue[queueIndex];
  76233. }
  76234. sourceUpdater.queue.splice(queueIndex, 1);
  76235. sourceUpdater.queuePending[type2] = queueEntry;
  76236. queueEntry.action(type2, sourceUpdater);
  76237. if (!queueEntry.doneFn) {
  76238. sourceUpdater.queuePending[type2] = null;
  76239. shiftQueue$1(type2, sourceUpdater);
  76240. return;
  76241. }
  76242. };
  76243. const cleanupBuffer$1 = (type2, sourceUpdater) => {
  76244. const buffer = sourceUpdater[`${type2}Buffer`];
  76245. const titleType = toTitleCase$2(type2);
  76246. if (!buffer) {
  76247. return;
  76248. }
  76249. buffer.removeEventListener("updateend", sourceUpdater[`on${titleType}UpdateEnd_`]);
  76250. buffer.removeEventListener("error", sourceUpdater[`on${titleType}Error_`]);
  76251. sourceUpdater.codecs[type2] = null;
  76252. sourceUpdater[`${type2}Buffer`] = null;
  76253. };
  76254. const inSourceBuffers$1 = (mediaSource, sourceBuffer) => mediaSource && sourceBuffer && Array.prototype.indexOf.call(mediaSource.sourceBuffers, sourceBuffer) !== -1;
  76255. const actions$1 = {
  76256. appendBuffer: (bytes, segmentInfo, onError2) => (type2, sourceUpdater) => {
  76257. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76258. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76259. return;
  76260. }
  76261. sourceUpdater.logger_(`Appending segment ${segmentInfo.mediaIndex}'s ${bytes.length} bytes to ${type2}Buffer`);
  76262. try {
  76263. sourceBuffer.appendBuffer(bytes);
  76264. } catch (e) {
  76265. sourceUpdater.logger_(`Error with code ${e.code} ` + (e.code === QUOTA_EXCEEDED_ERR$1 ? "(QUOTA_EXCEEDED_ERR) " : "") + `when appending segment ${segmentInfo.mediaIndex} to ${type2}Buffer`);
  76266. sourceUpdater.queuePending[type2] = null;
  76267. onError2(e);
  76268. }
  76269. },
  76270. remove: (start2, end) => (type2, sourceUpdater) => {
  76271. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76272. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76273. return;
  76274. }
  76275. sourceUpdater.logger_(`Removing ${start2} to ${end} from ${type2}Buffer`);
  76276. try {
  76277. sourceBuffer.remove(start2, end);
  76278. } catch (e) {
  76279. sourceUpdater.logger_(`Remove ${start2} to ${end} from ${type2}Buffer failed`);
  76280. }
  76281. },
  76282. timestampOffset: (offset) => (type2, sourceUpdater) => {
  76283. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76284. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76285. return;
  76286. }
  76287. sourceUpdater.logger_(`Setting ${type2}timestampOffset to ${offset}`);
  76288. sourceBuffer.timestampOffset = offset;
  76289. },
  76290. callback: (callback2) => (type2, sourceUpdater) => {
  76291. callback2();
  76292. },
  76293. endOfStream: (error) => (sourceUpdater) => {
  76294. if (sourceUpdater.mediaSource.readyState !== "open") {
  76295. return;
  76296. }
  76297. sourceUpdater.logger_(`Calling mediaSource endOfStream(${error || ""})`);
  76298. try {
  76299. sourceUpdater.mediaSource.endOfStream(error);
  76300. } catch (e) {
  76301. videojs$2.log.warn("Failed to call media source endOfStream", e);
  76302. }
  76303. },
  76304. duration: (duration5) => (sourceUpdater) => {
  76305. sourceUpdater.logger_(`Setting mediaSource duration to ${duration5}`);
  76306. try {
  76307. sourceUpdater.mediaSource.duration = duration5;
  76308. } catch (e) {
  76309. videojs$2.log.warn("Failed to set media source duration", e);
  76310. }
  76311. },
  76312. abort: () => (type2, sourceUpdater) => {
  76313. if (sourceUpdater.mediaSource.readyState !== "open") {
  76314. return;
  76315. }
  76316. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76317. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76318. return;
  76319. }
  76320. sourceUpdater.logger_(`calling abort on ${type2}Buffer`);
  76321. try {
  76322. sourceBuffer.abort();
  76323. } catch (e) {
  76324. videojs$2.log.warn(`Failed to abort on ${type2}Buffer`, e);
  76325. }
  76326. },
  76327. addSourceBuffer: (type2, codec) => (sourceUpdater) => {
  76328. const titleType = toTitleCase$2(type2);
  76329. const mime = getMimeForCodec$1(codec);
  76330. sourceUpdater.logger_(`Adding ${type2}Buffer with codec ${codec} to mediaSource`);
  76331. const sourceBuffer = sourceUpdater.mediaSource.addSourceBuffer(mime);
  76332. sourceBuffer.addEventListener("updateend", sourceUpdater[`on${titleType}UpdateEnd_`]);
  76333. sourceBuffer.addEventListener("error", sourceUpdater[`on${titleType}Error_`]);
  76334. sourceUpdater.codecs[type2] = codec;
  76335. sourceUpdater[`${type2}Buffer`] = sourceBuffer;
  76336. },
  76337. removeSourceBuffer: (type2) => (sourceUpdater) => {
  76338. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76339. cleanupBuffer$1(type2, sourceUpdater);
  76340. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76341. return;
  76342. }
  76343. sourceUpdater.logger_(`Removing ${type2}Buffer with codec ${sourceUpdater.codecs[type2]} from mediaSource`);
  76344. try {
  76345. sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer);
  76346. } catch (e) {
  76347. videojs$2.log.warn(`Failed to removeSourceBuffer ${type2}Buffer`, e);
  76348. }
  76349. },
  76350. changeType: (codec) => (type2, sourceUpdater) => {
  76351. const sourceBuffer = sourceUpdater[`${type2}Buffer`];
  76352. const mime = getMimeForCodec$1(codec);
  76353. if (!inSourceBuffers$1(sourceUpdater.mediaSource, sourceBuffer)) {
  76354. return;
  76355. }
  76356. if (sourceUpdater.codecs[type2] === codec) {
  76357. return;
  76358. }
  76359. sourceUpdater.logger_(`changing ${type2}Buffer codec from ${sourceUpdater.codecs[type2]} to ${codec}`);
  76360. sourceBuffer.changeType(mime);
  76361. sourceUpdater.codecs[type2] = codec;
  76362. }
  76363. };
  76364. const pushQueue$1 = ({
  76365. type: type2,
  76366. sourceUpdater,
  76367. action,
  76368. doneFn,
  76369. name
  76370. }) => {
  76371. sourceUpdater.queue.push({
  76372. type: type2,
  76373. action,
  76374. doneFn,
  76375. name
  76376. });
  76377. shiftQueue$1(type2, sourceUpdater);
  76378. };
  76379. const onUpdateend$1 = (type2, sourceUpdater) => (e) => {
  76380. if (sourceUpdater.queuePending[type2]) {
  76381. const doneFn = sourceUpdater.queuePending[type2].doneFn;
  76382. sourceUpdater.queuePending[type2] = null;
  76383. if (doneFn) {
  76384. doneFn(sourceUpdater[`${type2}Error_`]);
  76385. }
  76386. }
  76387. shiftQueue$1(type2, sourceUpdater);
  76388. };
  76389. class SourceUpdater$1 extends videojs$2.EventTarget {
  76390. constructor(mediaSource) {
  76391. super();
  76392. this.mediaSource = mediaSource;
  76393. this.sourceopenListener_ = () => shiftQueue$1("mediaSource", this);
  76394. this.mediaSource.addEventListener("sourceopen", this.sourceopenListener_);
  76395. this.logger_ = logger$1("SourceUpdater");
  76396. this.audioTimestampOffset_ = 0;
  76397. this.videoTimestampOffset_ = 0;
  76398. this.queue = [];
  76399. this.queuePending = {
  76400. audio: null,
  76401. video: null
  76402. };
  76403. this.delayedAudioAppendQueue_ = [];
  76404. this.videoAppendQueued_ = false;
  76405. this.codecs = {};
  76406. this.onVideoUpdateEnd_ = onUpdateend$1("video", this);
  76407. this.onAudioUpdateEnd_ = onUpdateend$1("audio", this);
  76408. this.onVideoError_ = (e) => {
  76409. this.videoError_ = e;
  76410. };
  76411. this.onAudioError_ = (e) => {
  76412. this.audioError_ = e;
  76413. };
  76414. this.createdSourceBuffers_ = false;
  76415. this.initializedEme_ = false;
  76416. this.triggeredReady_ = false;
  76417. }
  76418. initializedEme() {
  76419. this.initializedEme_ = true;
  76420. this.triggerReady();
  76421. }
  76422. hasCreatedSourceBuffers() {
  76423. return this.createdSourceBuffers_;
  76424. }
  76425. hasInitializedAnyEme() {
  76426. return this.initializedEme_;
  76427. }
  76428. ready() {
  76429. return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme();
  76430. }
  76431. createSourceBuffers(codecs) {
  76432. if (this.hasCreatedSourceBuffers()) {
  76433. return;
  76434. }
  76435. this.addOrChangeSourceBuffers(codecs);
  76436. this.createdSourceBuffers_ = true;
  76437. this.trigger("createdsourcebuffers");
  76438. this.triggerReady();
  76439. }
  76440. triggerReady() {
  76441. if (this.ready() && !this.triggeredReady_) {
  76442. this.triggeredReady_ = true;
  76443. this.trigger("ready");
  76444. }
  76445. }
  76446. addSourceBuffer(type2, codec) {
  76447. pushQueue$1({
  76448. type: "mediaSource",
  76449. sourceUpdater: this,
  76450. action: actions$1.addSourceBuffer(type2, codec),
  76451. name: "addSourceBuffer"
  76452. });
  76453. }
  76454. abort(type2) {
  76455. pushQueue$1({
  76456. type: type2,
  76457. sourceUpdater: this,
  76458. action: actions$1.abort(type2),
  76459. name: "abort"
  76460. });
  76461. }
  76462. removeSourceBuffer(type2) {
  76463. if (!this.canRemoveSourceBuffer()) {
  76464. videojs$2.log.error("removeSourceBuffer is not supported!");
  76465. return;
  76466. }
  76467. pushQueue$1({
  76468. type: "mediaSource",
  76469. sourceUpdater: this,
  76470. action: actions$1.removeSourceBuffer(type2),
  76471. name: "removeSourceBuffer"
  76472. });
  76473. }
  76474. canRemoveSourceBuffer() {
  76475. return !videojs$2.browser.IE_VERSION && !videojs$2.browser.IS_FIREFOX && window_1.MediaSource && window_1.MediaSource.prototype && typeof window_1.MediaSource.prototype.removeSourceBuffer === "function";
  76476. }
  76477. static canChangeType() {
  76478. return window_1.SourceBuffer && window_1.SourceBuffer.prototype && typeof window_1.SourceBuffer.prototype.changeType === "function";
  76479. }
  76480. canChangeType() {
  76481. return this.constructor.canChangeType();
  76482. }
  76483. changeType(type2, codec) {
  76484. if (!this.canChangeType()) {
  76485. videojs$2.log.error("changeType is not supported!");
  76486. return;
  76487. }
  76488. pushQueue$1({
  76489. type: type2,
  76490. sourceUpdater: this,
  76491. action: actions$1.changeType(codec),
  76492. name: "changeType"
  76493. });
  76494. }
  76495. addOrChangeSourceBuffers(codecs) {
  76496. if (!codecs || typeof codecs !== "object" || Object.keys(codecs).length === 0) {
  76497. throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");
  76498. }
  76499. Object.keys(codecs).forEach((type2) => {
  76500. const codec = codecs[type2];
  76501. if (!this.hasCreatedSourceBuffers()) {
  76502. return this.addSourceBuffer(type2, codec);
  76503. }
  76504. if (this.canChangeType()) {
  76505. this.changeType(type2, codec);
  76506. }
  76507. });
  76508. }
  76509. appendBuffer(options2, doneFn) {
  76510. const {
  76511. segmentInfo,
  76512. type: type2,
  76513. bytes
  76514. } = options2;
  76515. this.processedAppend_ = true;
  76516. if (type2 === "audio" && this.videoBuffer && !this.videoAppendQueued_) {
  76517. this.delayedAudioAppendQueue_.push([options2, doneFn]);
  76518. this.logger_(`delayed audio append of ${bytes.length} until video append`);
  76519. return;
  76520. }
  76521. const onError2 = doneFn;
  76522. pushQueue$1({
  76523. type: type2,
  76524. sourceUpdater: this,
  76525. action: actions$1.appendBuffer(bytes, segmentInfo || {
  76526. mediaIndex: -1
  76527. }, onError2),
  76528. doneFn,
  76529. name: "appendBuffer"
  76530. });
  76531. if (type2 === "video") {
  76532. this.videoAppendQueued_ = true;
  76533. if (!this.delayedAudioAppendQueue_.length) {
  76534. return;
  76535. }
  76536. const queue = this.delayedAudioAppendQueue_.slice();
  76537. this.logger_(`queuing delayed audio ${queue.length} appendBuffers`);
  76538. this.delayedAudioAppendQueue_.length = 0;
  76539. queue.forEach((que) => {
  76540. this.appendBuffer.apply(this, que);
  76541. });
  76542. }
  76543. }
  76544. audioBuffered() {
  76545. if (!inSourceBuffers$1(this.mediaSource, this.audioBuffer)) {
  76546. return createTimeRanges$2();
  76547. }
  76548. return this.audioBuffer.buffered ? this.audioBuffer.buffered : createTimeRanges$2();
  76549. }
  76550. videoBuffered() {
  76551. if (!inSourceBuffers$1(this.mediaSource, this.videoBuffer)) {
  76552. return createTimeRanges$2();
  76553. }
  76554. return this.videoBuffer.buffered ? this.videoBuffer.buffered : createTimeRanges$2();
  76555. }
  76556. buffered() {
  76557. const video = inSourceBuffers$1(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null;
  76558. const audio = inSourceBuffers$1(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null;
  76559. if (audio && !video) {
  76560. return this.audioBuffered();
  76561. }
  76562. if (video && !audio) {
  76563. return this.videoBuffered();
  76564. }
  76565. return bufferIntersection$1(this.audioBuffered(), this.videoBuffered());
  76566. }
  76567. setDuration(duration5, doneFn = noop$1) {
  76568. pushQueue$1({
  76569. type: "mediaSource",
  76570. sourceUpdater: this,
  76571. action: actions$1.duration(duration5),
  76572. name: "duration",
  76573. doneFn
  76574. });
  76575. }
  76576. endOfStream(error = null, doneFn = noop$1) {
  76577. if (typeof error !== "string") {
  76578. error = void 0;
  76579. }
  76580. pushQueue$1({
  76581. type: "mediaSource",
  76582. sourceUpdater: this,
  76583. action: actions$1.endOfStream(error),
  76584. name: "endOfStream",
  76585. doneFn
  76586. });
  76587. }
  76588. removeAudio(start2, end, done = noop$1) {
  76589. if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) {
  76590. done();
  76591. return;
  76592. }
  76593. pushQueue$1({
  76594. type: "audio",
  76595. sourceUpdater: this,
  76596. action: actions$1.remove(start2, end),
  76597. doneFn: done,
  76598. name: "remove"
  76599. });
  76600. }
  76601. removeVideo(start2, end, done = noop$1) {
  76602. if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) {
  76603. done();
  76604. return;
  76605. }
  76606. pushQueue$1({
  76607. type: "video",
  76608. sourceUpdater: this,
  76609. action: actions$1.remove(start2, end),
  76610. doneFn: done,
  76611. name: "remove"
  76612. });
  76613. }
  76614. updating() {
  76615. if (updating("audio", this) || updating("video", this)) {
  76616. return true;
  76617. }
  76618. return false;
  76619. }
  76620. audioTimestampOffset(offset) {
  76621. if (typeof offset !== "undefined" && this.audioBuffer && this.audioTimestampOffset_ !== offset) {
  76622. pushQueue$1({
  76623. type: "audio",
  76624. sourceUpdater: this,
  76625. action: actions$1.timestampOffset(offset),
  76626. name: "timestampOffset"
  76627. });
  76628. this.audioTimestampOffset_ = offset;
  76629. }
  76630. return this.audioTimestampOffset_;
  76631. }
  76632. videoTimestampOffset(offset) {
  76633. if (typeof offset !== "undefined" && this.videoBuffer && this.videoTimestampOffset !== offset) {
  76634. pushQueue$1({
  76635. type: "video",
  76636. sourceUpdater: this,
  76637. action: actions$1.timestampOffset(offset),
  76638. name: "timestampOffset"
  76639. });
  76640. this.videoTimestampOffset_ = offset;
  76641. }
  76642. return this.videoTimestampOffset_;
  76643. }
  76644. audioQueueCallback(callback2) {
  76645. if (!this.audioBuffer) {
  76646. return;
  76647. }
  76648. pushQueue$1({
  76649. type: "audio",
  76650. sourceUpdater: this,
  76651. action: actions$1.callback(callback2),
  76652. name: "callback"
  76653. });
  76654. }
  76655. videoQueueCallback(callback2) {
  76656. if (!this.videoBuffer) {
  76657. return;
  76658. }
  76659. pushQueue$1({
  76660. type: "video",
  76661. sourceUpdater: this,
  76662. action: actions$1.callback(callback2),
  76663. name: "callback"
  76664. });
  76665. }
  76666. dispose() {
  76667. this.trigger("dispose");
  76668. bufferTypes$1.forEach((type2) => {
  76669. this.abort(type2);
  76670. if (this.canRemoveSourceBuffer()) {
  76671. this.removeSourceBuffer(type2);
  76672. } else {
  76673. this[`${type2}QueueCallback`](() => cleanupBuffer$1(type2, this));
  76674. }
  76675. });
  76676. this.videoAppendQueued_ = false;
  76677. this.delayedAudioAppendQueue_.length = 0;
  76678. if (this.sourceopenListener_) {
  76679. this.mediaSource.removeEventListener("sourceopen", this.sourceopenListener_);
  76680. }
  76681. this.off();
  76682. }
  76683. }
  76684. const uint8ToUtf8$1 = (uintArray) => decodeURIComponent(escape(String.fromCharCode.apply(null, uintArray)));
  76685. const VTT_LINE_TERMINATORS$1 = new Uint8Array("\n\n".split("").map((char) => char.charCodeAt(0)));
  76686. class NoVttJsError$1 extends Error {
  76687. constructor() {
  76688. super("Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.");
  76689. }
  76690. }
  76691. class VTTSegmentLoader$1 extends SegmentLoader$1 {
  76692. constructor(settings, options2 = {}) {
  76693. super(settings, options2);
  76694. this.mediaSource_ = null;
  76695. this.subtitlesTrack_ = null;
  76696. this.loaderType_ = "subtitle";
  76697. this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks;
  76698. this.loadVttJs = settings.loadVttJs;
  76699. this.shouldSaveSegmentTimingInfo_ = false;
  76700. }
  76701. createTransmuxer_() {
  76702. return null;
  76703. }
  76704. buffered_() {
  76705. if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) {
  76706. return createTimeRanges$2();
  76707. }
  76708. const cues = this.subtitlesTrack_.cues;
  76709. const start2 = cues[0].startTime;
  76710. const end = cues[cues.length - 1].startTime;
  76711. return createTimeRanges$2([[start2, end]]);
  76712. }
  76713. initSegmentForMap(map, set4 = false) {
  76714. if (!map) {
  76715. return null;
  76716. }
  76717. const id = initSegmentId$1(map);
  76718. let storedMap = this.initSegments_[id];
  76719. if (set4 && !storedMap && map.bytes) {
  76720. const combinedByteLength = VTT_LINE_TERMINATORS$1.byteLength + map.bytes.byteLength;
  76721. const combinedSegment = new Uint8Array(combinedByteLength);
  76722. combinedSegment.set(map.bytes);
  76723. combinedSegment.set(VTT_LINE_TERMINATORS$1, map.bytes.byteLength);
  76724. this.initSegments_[id] = storedMap = {
  76725. resolvedUri: map.resolvedUri,
  76726. byterange: map.byterange,
  76727. bytes: combinedSegment
  76728. };
  76729. }
  76730. return storedMap || map;
  76731. }
  76732. couldBeginLoading_() {
  76733. return this.playlist_ && this.subtitlesTrack_ && !this.paused();
  76734. }
  76735. init_() {
  76736. this.state = "READY";
  76737. this.resetEverything();
  76738. return this.monitorBuffer_();
  76739. }
  76740. track(track) {
  76741. if (typeof track === "undefined") {
  76742. return this.subtitlesTrack_;
  76743. }
  76744. this.subtitlesTrack_ = track;
  76745. if (this.state === "INIT" && this.couldBeginLoading_()) {
  76746. this.init_();
  76747. }
  76748. return this.subtitlesTrack_;
  76749. }
  76750. remove(start2, end) {
  76751. removeCuesFromTrack$1(start2, end, this.subtitlesTrack_);
  76752. }
  76753. fillBuffer_() {
  76754. const segmentInfo = this.chooseNextRequest_();
  76755. if (!segmentInfo) {
  76756. return;
  76757. }
  76758. if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) {
  76759. const checkTimestampOffset = () => {
  76760. this.state = "READY";
  76761. if (!this.paused()) {
  76762. this.monitorBuffer_();
  76763. }
  76764. };
  76765. this.syncController_.one("timestampoffset", checkTimestampOffset);
  76766. this.state = "WAITING_ON_TIMELINE";
  76767. return;
  76768. }
  76769. this.loadSegment_(segmentInfo);
  76770. }
  76771. timestampOffsetForSegment_() {
  76772. return null;
  76773. }
  76774. chooseNextRequest_() {
  76775. return this.skipEmptySegments_(super.chooseNextRequest_());
  76776. }
  76777. skipEmptySegments_(segmentInfo) {
  76778. while (segmentInfo && segmentInfo.segment.empty) {
  76779. if (segmentInfo.mediaIndex + 1 >= segmentInfo.playlist.segments.length) {
  76780. segmentInfo = null;
  76781. break;
  76782. }
  76783. segmentInfo = this.generateSegmentInfo_({
  76784. playlist: segmentInfo.playlist,
  76785. mediaIndex: segmentInfo.mediaIndex + 1,
  76786. startOfSegment: segmentInfo.startOfSegment + segmentInfo.duration,
  76787. isSyncRequest: segmentInfo.isSyncRequest
  76788. });
  76789. }
  76790. return segmentInfo;
  76791. }
  76792. stopForError(error) {
  76793. this.error(error);
  76794. this.state = "READY";
  76795. this.pause();
  76796. this.trigger("error");
  76797. }
  76798. segmentRequestFinished_(error, simpleSegment, result) {
  76799. if (!this.subtitlesTrack_) {
  76800. this.state = "READY";
  76801. return;
  76802. }
  76803. this.saveTransferStats_(simpleSegment.stats);
  76804. if (!this.pendingSegment_) {
  76805. this.state = "READY";
  76806. this.mediaRequestsAborted += 1;
  76807. return;
  76808. }
  76809. if (error) {
  76810. if (error.code === REQUEST_ERRORS$1.TIMEOUT) {
  76811. this.handleTimeout_();
  76812. }
  76813. if (error.code === REQUEST_ERRORS$1.ABORTED) {
  76814. this.mediaRequestsAborted += 1;
  76815. } else {
  76816. this.mediaRequestsErrored += 1;
  76817. }
  76818. this.stopForError(error);
  76819. return;
  76820. }
  76821. const segmentInfo = this.pendingSegment_;
  76822. this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);
  76823. if (simpleSegment.key) {
  76824. this.segmentKey(simpleSegment.key, true);
  76825. }
  76826. this.state = "APPENDING";
  76827. this.trigger("appending");
  76828. const segment = segmentInfo.segment;
  76829. if (segment.map) {
  76830. segment.map.bytes = simpleSegment.map.bytes;
  76831. }
  76832. segmentInfo.bytes = simpleSegment.bytes;
  76833. if (typeof window_1.WebVTT !== "function" && typeof this.loadVttJs === "function") {
  76834. this.state = "WAITING_ON_VTTJS";
  76835. this.loadVttJs().then(() => this.segmentRequestFinished_(error, simpleSegment, result), () => this.stopForError({
  76836. message: "Error loading vtt.js"
  76837. }));
  76838. return;
  76839. }
  76840. segment.requested = true;
  76841. try {
  76842. this.parseVTTCues_(segmentInfo);
  76843. } catch (e) {
  76844. this.stopForError({
  76845. message: e.message
  76846. });
  76847. return;
  76848. }
  76849. this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_);
  76850. if (segmentInfo.cues.length) {
  76851. segmentInfo.timingInfo = {
  76852. start: segmentInfo.cues[0].startTime,
  76853. end: segmentInfo.cues[segmentInfo.cues.length - 1].endTime
  76854. };
  76855. } else {
  76856. segmentInfo.timingInfo = {
  76857. start: segmentInfo.startOfSegment,
  76858. end: segmentInfo.startOfSegment + segmentInfo.duration
  76859. };
  76860. }
  76861. if (segmentInfo.isSyncRequest) {
  76862. this.trigger("syncinfoupdate");
  76863. this.pendingSegment_ = null;
  76864. this.state = "READY";
  76865. return;
  76866. }
  76867. segmentInfo.byteLength = segmentInfo.bytes.byteLength;
  76868. this.mediaSecondsLoaded += segment.duration;
  76869. segmentInfo.cues.forEach((cue) => {
  76870. this.subtitlesTrack_.addCue(this.featuresNativeTextTracks_ ? new window_1.VTTCue(cue.startTime, cue.endTime, cue.text) : cue);
  76871. });
  76872. removeDuplicateCuesFromTrack$1(this.subtitlesTrack_);
  76873. this.handleAppendsDone_();
  76874. }
  76875. handleData_() {
  76876. }
  76877. updateTimingInfoEnd_() {
  76878. }
  76879. parseVTTCues_(segmentInfo) {
  76880. let decoder;
  76881. let decodeBytesToString = false;
  76882. if (typeof window_1.WebVTT !== "function") {
  76883. throw new NoVttJsError$1();
  76884. }
  76885. if (typeof window_1.TextDecoder === "function") {
  76886. decoder = new window_1.TextDecoder("utf8");
  76887. } else {
  76888. decoder = window_1.WebVTT.StringDecoder();
  76889. decodeBytesToString = true;
  76890. }
  76891. const parser2 = new window_1.WebVTT.Parser(window_1, window_1.vttjs, decoder);
  76892. segmentInfo.cues = [];
  76893. segmentInfo.timestampmap = {
  76894. MPEGTS: 0,
  76895. LOCAL: 0
  76896. };
  76897. parser2.oncue = segmentInfo.cues.push.bind(segmentInfo.cues);
  76898. parser2.ontimestampmap = (map) => {
  76899. segmentInfo.timestampmap = map;
  76900. };
  76901. parser2.onparsingerror = (error) => {
  76902. videojs$2.log.warn("Error encountered when parsing cues: " + error.message);
  76903. };
  76904. if (segmentInfo.segment.map) {
  76905. let mapData = segmentInfo.segment.map.bytes;
  76906. if (decodeBytesToString) {
  76907. mapData = uint8ToUtf8$1(mapData);
  76908. }
  76909. parser2.parse(mapData);
  76910. }
  76911. let segmentData = segmentInfo.bytes;
  76912. if (decodeBytesToString) {
  76913. segmentData = uint8ToUtf8$1(segmentData);
  76914. }
  76915. parser2.parse(segmentData);
  76916. parser2.flush();
  76917. }
  76918. updateTimeMapping_(segmentInfo, mappingObj, playlist) {
  76919. const segment = segmentInfo.segment;
  76920. if (!mappingObj) {
  76921. return;
  76922. }
  76923. if (!segmentInfo.cues.length) {
  76924. segment.empty = true;
  76925. return;
  76926. }
  76927. const timestampmap = segmentInfo.timestampmap;
  76928. const diff = timestampmap.MPEGTS / clock$1.ONE_SECOND_IN_TS - timestampmap.LOCAL + mappingObj.mapping;
  76929. segmentInfo.cues.forEach((cue) => {
  76930. cue.startTime += diff;
  76931. cue.endTime += diff;
  76932. });
  76933. if (!playlist.syncInfo) {
  76934. const firstStart = segmentInfo.cues[0].startTime;
  76935. const lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime;
  76936. playlist.syncInfo = {
  76937. mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex,
  76938. time: Math.min(firstStart, lastStart - segment.duration)
  76939. };
  76940. }
  76941. }
  76942. }
  76943. const findAdCue$1 = function(track, mediaTime) {
  76944. const cues = track.cues;
  76945. for (let i2 = 0; i2 < cues.length; i2++) {
  76946. const cue = cues[i2];
  76947. if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) {
  76948. return cue;
  76949. }
  76950. }
  76951. return null;
  76952. };
  76953. const updateAdCues$1 = function(media, track, offset = 0) {
  76954. if (!media.segments) {
  76955. return;
  76956. }
  76957. let mediaTime = offset;
  76958. let cue;
  76959. for (let i2 = 0; i2 < media.segments.length; i2++) {
  76960. const segment = media.segments[i2];
  76961. if (!cue) {
  76962. cue = findAdCue$1(track, mediaTime + segment.duration / 2);
  76963. }
  76964. if (cue) {
  76965. if ("cueIn" in segment) {
  76966. cue.endTime = mediaTime;
  76967. cue.adEndTime = mediaTime;
  76968. mediaTime += segment.duration;
  76969. cue = null;
  76970. continue;
  76971. }
  76972. if (mediaTime < cue.endTime) {
  76973. mediaTime += segment.duration;
  76974. continue;
  76975. }
  76976. cue.endTime += segment.duration;
  76977. } else {
  76978. if ("cueOut" in segment) {
  76979. cue = new window_1.VTTCue(mediaTime, mediaTime + segment.duration, segment.cueOut);
  76980. cue.adStartTime = mediaTime;
  76981. cue.adEndTime = mediaTime + parseFloat(segment.cueOut);
  76982. track.addCue(cue);
  76983. }
  76984. if ("cueOutCont" in segment) {
  76985. const [adOffset, adTotal] = segment.cueOutCont.split("/").map(parseFloat);
  76986. cue = new window_1.VTTCue(mediaTime, mediaTime + segment.duration, "");
  76987. cue.adStartTime = mediaTime - adOffset;
  76988. cue.adEndTime = cue.adStartTime + adTotal;
  76989. track.addCue(cue);
  76990. }
  76991. }
  76992. mediaTime += segment.duration;
  76993. }
  76994. };
  76995. const MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC$1 = 86400;
  76996. const syncPointStrategies$1 = [
  76997. {
  76998. name: "VOD",
  76999. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77000. if (duration5 !== Infinity) {
  77001. const syncPoint = {
  77002. time: 0,
  77003. segmentIndex: 0,
  77004. partIndex: null
  77005. };
  77006. return syncPoint;
  77007. }
  77008. return null;
  77009. }
  77010. },
  77011. {
  77012. name: "ProgramDateTime",
  77013. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77014. if (!Object.keys(syncController.timelineToDatetimeMappings).length) {
  77015. return null;
  77016. }
  77017. let syncPoint = null;
  77018. let lastDistance = null;
  77019. const partsAndSegments = getPartsAndSegments$1(playlist);
  77020. currentTime = currentTime || 0;
  77021. for (let i2 = 0; i2 < partsAndSegments.length; i2++) {
  77022. const index2 = playlist.endList || currentTime === 0 ? i2 : partsAndSegments.length - (i2 + 1);
  77023. const partAndSegment = partsAndSegments[index2];
  77024. const segment = partAndSegment.segment;
  77025. const datetimeMapping = syncController.timelineToDatetimeMappings[segment.timeline];
  77026. if (!datetimeMapping || !segment.dateTimeObject) {
  77027. continue;
  77028. }
  77029. const segmentTime = segment.dateTimeObject.getTime() / 1e3;
  77030. let start2 = segmentTime + datetimeMapping;
  77031. if (segment.parts && typeof partAndSegment.partIndex === "number") {
  77032. for (let z = 0; z < partAndSegment.partIndex; z++) {
  77033. start2 += segment.parts[z].duration;
  77034. }
  77035. }
  77036. const distance2 = Math.abs(currentTime - start2);
  77037. if (lastDistance !== null && (distance2 === 0 || lastDistance < distance2)) {
  77038. break;
  77039. }
  77040. lastDistance = distance2;
  77041. syncPoint = {
  77042. time: start2,
  77043. segmentIndex: partAndSegment.segmentIndex,
  77044. partIndex: partAndSegment.partIndex
  77045. };
  77046. }
  77047. return syncPoint;
  77048. }
  77049. },
  77050. {
  77051. name: "Segment",
  77052. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77053. let syncPoint = null;
  77054. let lastDistance = null;
  77055. currentTime = currentTime || 0;
  77056. const partsAndSegments = getPartsAndSegments$1(playlist);
  77057. for (let i2 = 0; i2 < partsAndSegments.length; i2++) {
  77058. const index2 = playlist.endList || currentTime === 0 ? i2 : partsAndSegments.length - (i2 + 1);
  77059. const partAndSegment = partsAndSegments[index2];
  77060. const segment = partAndSegment.segment;
  77061. const start2 = partAndSegment.part && partAndSegment.part.start || segment && segment.start;
  77062. if (segment.timeline === currentTimeline && typeof start2 !== "undefined") {
  77063. const distance2 = Math.abs(currentTime - start2);
  77064. if (lastDistance !== null && lastDistance < distance2) {
  77065. break;
  77066. }
  77067. if (!syncPoint || lastDistance === null || lastDistance >= distance2) {
  77068. lastDistance = distance2;
  77069. syncPoint = {
  77070. time: start2,
  77071. segmentIndex: partAndSegment.segmentIndex,
  77072. partIndex: partAndSegment.partIndex
  77073. };
  77074. }
  77075. }
  77076. }
  77077. return syncPoint;
  77078. }
  77079. },
  77080. {
  77081. name: "Discontinuity",
  77082. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77083. let syncPoint = null;
  77084. currentTime = currentTime || 0;
  77085. if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
  77086. let lastDistance = null;
  77087. for (let i2 = 0; i2 < playlist.discontinuityStarts.length; i2++) {
  77088. const segmentIndex = playlist.discontinuityStarts[i2];
  77089. const discontinuity = playlist.discontinuitySequence + i2 + 1;
  77090. const discontinuitySync = syncController.discontinuities[discontinuity];
  77091. if (discontinuitySync) {
  77092. const distance2 = Math.abs(currentTime - discontinuitySync.time);
  77093. if (lastDistance !== null && lastDistance < distance2) {
  77094. break;
  77095. }
  77096. if (!syncPoint || lastDistance === null || lastDistance >= distance2) {
  77097. lastDistance = distance2;
  77098. syncPoint = {
  77099. time: discontinuitySync.time,
  77100. segmentIndex,
  77101. partIndex: null
  77102. };
  77103. }
  77104. }
  77105. }
  77106. }
  77107. return syncPoint;
  77108. }
  77109. },
  77110. {
  77111. name: "Playlist",
  77112. run: (syncController, playlist, duration5, currentTimeline, currentTime) => {
  77113. if (playlist.syncInfo) {
  77114. const syncPoint = {
  77115. time: playlist.syncInfo.time,
  77116. segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence,
  77117. partIndex: null
  77118. };
  77119. return syncPoint;
  77120. }
  77121. return null;
  77122. }
  77123. }
  77124. ];
  77125. class SyncController$1 extends videojs$2.EventTarget {
  77126. constructor(options2 = {}) {
  77127. super();
  77128. this.timelines = [];
  77129. this.discontinuities = [];
  77130. this.timelineToDatetimeMappings = {};
  77131. this.logger_ = logger$1("SyncController");
  77132. }
  77133. getSyncPoint(playlist, duration5, currentTimeline, currentTime) {
  77134. const syncPoints = this.runStrategies_(playlist, duration5, currentTimeline, currentTime);
  77135. if (!syncPoints.length) {
  77136. return null;
  77137. }
  77138. return this.selectSyncPoint_(syncPoints, {
  77139. key: "time",
  77140. value: currentTime
  77141. });
  77142. }
  77143. getExpiredTime(playlist, duration5) {
  77144. if (!playlist || !playlist.segments) {
  77145. return null;
  77146. }
  77147. const syncPoints = this.runStrategies_(playlist, duration5, playlist.discontinuitySequence, 0);
  77148. if (!syncPoints.length) {
  77149. return null;
  77150. }
  77151. const syncPoint = this.selectSyncPoint_(syncPoints, {
  77152. key: "segmentIndex",
  77153. value: 0
  77154. });
  77155. if (syncPoint.segmentIndex > 0) {
  77156. syncPoint.time *= -1;
  77157. }
  77158. return Math.abs(syncPoint.time + sumDurations$1({
  77159. defaultDuration: playlist.targetDuration,
  77160. durationList: playlist.segments,
  77161. startIndex: syncPoint.segmentIndex,
  77162. endIndex: 0
  77163. }));
  77164. }
  77165. runStrategies_(playlist, duration5, currentTimeline, currentTime) {
  77166. const syncPoints = [];
  77167. for (let i2 = 0; i2 < syncPointStrategies$1.length; i2++) {
  77168. const strategy = syncPointStrategies$1[i2];
  77169. const syncPoint = strategy.run(this, playlist, duration5, currentTimeline, currentTime);
  77170. if (syncPoint) {
  77171. syncPoint.strategy = strategy.name;
  77172. syncPoints.push({
  77173. strategy: strategy.name,
  77174. syncPoint
  77175. });
  77176. }
  77177. }
  77178. return syncPoints;
  77179. }
  77180. selectSyncPoint_(syncPoints, target) {
  77181. let bestSyncPoint = syncPoints[0].syncPoint;
  77182. let bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value);
  77183. let bestStrategy = syncPoints[0].strategy;
  77184. for (let i2 = 1; i2 < syncPoints.length; i2++) {
  77185. const newDistance = Math.abs(syncPoints[i2].syncPoint[target.key] - target.value);
  77186. if (newDistance < bestDistance) {
  77187. bestDistance = newDistance;
  77188. bestSyncPoint = syncPoints[i2].syncPoint;
  77189. bestStrategy = syncPoints[i2].strategy;
  77190. }
  77191. }
  77192. this.logger_(`syncPoint for [${target.key}: ${target.value}] chosen with strategy [${bestStrategy}]: [time:${bestSyncPoint.time}, segmentIndex:${bestSyncPoint.segmentIndex}` + (typeof bestSyncPoint.partIndex === "number" ? `,partIndex:${bestSyncPoint.partIndex}` : "") + "]");
  77193. return bestSyncPoint;
  77194. }
  77195. saveExpiredSegmentInfo(oldPlaylist, newPlaylist) {
  77196. const mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;
  77197. if (mediaSequenceDiff > MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC$1) {
  77198. videojs$2.log.warn(`Not saving expired segment info. Media sequence gap ${mediaSequenceDiff} is too large.`);
  77199. return;
  77200. }
  77201. for (let i2 = mediaSequenceDiff - 1; i2 >= 0; i2--) {
  77202. const lastRemovedSegment = oldPlaylist.segments[i2];
  77203. if (lastRemovedSegment && typeof lastRemovedSegment.start !== "undefined") {
  77204. newPlaylist.syncInfo = {
  77205. mediaSequence: oldPlaylist.mediaSequence + i2,
  77206. time: lastRemovedSegment.start
  77207. };
  77208. this.logger_(`playlist refresh sync: [time:${newPlaylist.syncInfo.time}, mediaSequence: ${newPlaylist.syncInfo.mediaSequence}]`);
  77209. this.trigger("syncinfoupdate");
  77210. break;
  77211. }
  77212. }
  77213. }
  77214. setDateTimeMappingForStart(playlist) {
  77215. this.timelineToDatetimeMappings = {};
  77216. if (playlist.segments && playlist.segments.length && playlist.segments[0].dateTimeObject) {
  77217. const firstSegment = playlist.segments[0];
  77218. const playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1e3;
  77219. this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp;
  77220. }
  77221. }
  77222. saveSegmentTimingInfo({
  77223. segmentInfo,
  77224. shouldSaveTimelineMapping
  77225. }) {
  77226. const didCalculateSegmentTimeMapping = this.calculateSegmentTimeMapping_(segmentInfo, segmentInfo.timingInfo, shouldSaveTimelineMapping);
  77227. const segment = segmentInfo.segment;
  77228. if (didCalculateSegmentTimeMapping) {
  77229. this.saveDiscontinuitySyncInfo_(segmentInfo);
  77230. if (!segmentInfo.playlist.syncInfo) {
  77231. segmentInfo.playlist.syncInfo = {
  77232. mediaSequence: segmentInfo.playlist.mediaSequence + segmentInfo.mediaIndex,
  77233. time: segment.start
  77234. };
  77235. }
  77236. }
  77237. const dateTime = segment.dateTimeObject;
  77238. if (segment.discontinuity && shouldSaveTimelineMapping && dateTime) {
  77239. this.timelineToDatetimeMappings[segment.timeline] = -(dateTime.getTime() / 1e3);
  77240. }
  77241. }
  77242. timestampOffsetForTimeline(timeline) {
  77243. if (typeof this.timelines[timeline] === "undefined") {
  77244. return null;
  77245. }
  77246. return this.timelines[timeline].time;
  77247. }
  77248. mappingForTimeline(timeline) {
  77249. if (typeof this.timelines[timeline] === "undefined") {
  77250. return null;
  77251. }
  77252. return this.timelines[timeline].mapping;
  77253. }
  77254. calculateSegmentTimeMapping_(segmentInfo, timingInfo, shouldSaveTimelineMapping) {
  77255. const segment = segmentInfo.segment;
  77256. const part = segmentInfo.part;
  77257. let mappingObj = this.timelines[segmentInfo.timeline];
  77258. let start2;
  77259. let end;
  77260. if (typeof segmentInfo.timestampOffset === "number") {
  77261. mappingObj = {
  77262. time: segmentInfo.startOfSegment,
  77263. mapping: segmentInfo.startOfSegment - timingInfo.start
  77264. };
  77265. if (shouldSaveTimelineMapping) {
  77266. this.timelines[segmentInfo.timeline] = mappingObj;
  77267. this.trigger("timestampoffset");
  77268. this.logger_(`time mapping for timeline ${segmentInfo.timeline}: [time: ${mappingObj.time}] [mapping: ${mappingObj.mapping}]`);
  77269. }
  77270. start2 = segmentInfo.startOfSegment;
  77271. end = timingInfo.end + mappingObj.mapping;
  77272. } else if (mappingObj) {
  77273. start2 = timingInfo.start + mappingObj.mapping;
  77274. end = timingInfo.end + mappingObj.mapping;
  77275. } else {
  77276. return false;
  77277. }
  77278. if (part) {
  77279. part.start = start2;
  77280. part.end = end;
  77281. }
  77282. if (!segment.start || start2 < segment.start) {
  77283. segment.start = start2;
  77284. }
  77285. segment.end = end;
  77286. return true;
  77287. }
  77288. saveDiscontinuitySyncInfo_(segmentInfo) {
  77289. const playlist = segmentInfo.playlist;
  77290. const segment = segmentInfo.segment;
  77291. if (segment.discontinuity) {
  77292. this.discontinuities[segment.timeline] = {
  77293. time: segment.start,
  77294. accuracy: 0
  77295. };
  77296. } else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
  77297. for (let i2 = 0; i2 < playlist.discontinuityStarts.length; i2++) {
  77298. const segmentIndex = playlist.discontinuityStarts[i2];
  77299. const discontinuity = playlist.discontinuitySequence + i2 + 1;
  77300. const mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex;
  77301. const accuracy = Math.abs(mediaIndexDiff);
  77302. if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) {
  77303. let time;
  77304. if (mediaIndexDiff < 0) {
  77305. time = segment.start - sumDurations$1({
  77306. defaultDuration: playlist.targetDuration,
  77307. durationList: playlist.segments,
  77308. startIndex: segmentInfo.mediaIndex,
  77309. endIndex: segmentIndex
  77310. });
  77311. } else {
  77312. time = segment.end + sumDurations$1({
  77313. defaultDuration: playlist.targetDuration,
  77314. durationList: playlist.segments,
  77315. startIndex: segmentInfo.mediaIndex + 1,
  77316. endIndex: segmentIndex
  77317. });
  77318. }
  77319. this.discontinuities[discontinuity] = {
  77320. time,
  77321. accuracy
  77322. };
  77323. }
  77324. }
  77325. }
  77326. }
  77327. dispose() {
  77328. this.trigger("dispose");
  77329. this.off();
  77330. }
  77331. }
  77332. class TimelineChangeController$1 extends videojs$2.EventTarget {
  77333. constructor() {
  77334. super();
  77335. this.pendingTimelineChanges_ = {};
  77336. this.lastTimelineChanges_ = {};
  77337. }
  77338. clearPendingTimelineChange(type2) {
  77339. this.pendingTimelineChanges_[type2] = null;
  77340. this.trigger("pendingtimelinechange");
  77341. }
  77342. pendingTimelineChange({
  77343. type: type2,
  77344. from: from3,
  77345. to
  77346. }) {
  77347. if (typeof from3 === "number" && typeof to === "number") {
  77348. this.pendingTimelineChanges_[type2] = {
  77349. type: type2,
  77350. from: from3,
  77351. to
  77352. };
  77353. this.trigger("pendingtimelinechange");
  77354. }
  77355. return this.pendingTimelineChanges_[type2];
  77356. }
  77357. lastTimelineChange({
  77358. type: type2,
  77359. from: from3,
  77360. to
  77361. }) {
  77362. if (typeof from3 === "number" && typeof to === "number") {
  77363. this.lastTimelineChanges_[type2] = {
  77364. type: type2,
  77365. from: from3,
  77366. to
  77367. };
  77368. delete this.pendingTimelineChanges_[type2];
  77369. this.trigger("timelinechange");
  77370. }
  77371. return this.lastTimelineChanges_[type2];
  77372. }
  77373. dispose() {
  77374. this.trigger("dispose");
  77375. this.pendingTimelineChanges_ = {};
  77376. this.lastTimelineChanges_ = {};
  77377. this.off();
  77378. }
  77379. }
  77380. const workerCode$2 = transform$1(getWorkerString$1(function() {
  77381. var Stream2 = /* @__PURE__ */ function() {
  77382. function Stream3() {
  77383. this.listeners = {};
  77384. }
  77385. var _proto = Stream3.prototype;
  77386. _proto.on = function on3(type2, listener) {
  77387. if (!this.listeners[type2]) {
  77388. this.listeners[type2] = [];
  77389. }
  77390. this.listeners[type2].push(listener);
  77391. };
  77392. _proto.off = function off2(type2, listener) {
  77393. if (!this.listeners[type2]) {
  77394. return false;
  77395. }
  77396. var index2 = this.listeners[type2].indexOf(listener);
  77397. this.listeners[type2] = this.listeners[type2].slice(0);
  77398. this.listeners[type2].splice(index2, 1);
  77399. return index2 > -1;
  77400. };
  77401. _proto.trigger = function trigger2(type2) {
  77402. var callbacks = this.listeners[type2];
  77403. if (!callbacks) {
  77404. return;
  77405. }
  77406. if (arguments.length === 2) {
  77407. var length = callbacks.length;
  77408. for (var i2 = 0; i2 < length; ++i2) {
  77409. callbacks[i2].call(this, arguments[1]);
  77410. }
  77411. } else {
  77412. var args = Array.prototype.slice.call(arguments, 1);
  77413. var _length = callbacks.length;
  77414. for (var _i = 0; _i < _length; ++_i) {
  77415. callbacks[_i].apply(this, args);
  77416. }
  77417. }
  77418. };
  77419. _proto.dispose = function dispose() {
  77420. this.listeners = {};
  77421. };
  77422. _proto.pipe = function pipe(destination2) {
  77423. this.on("data", function(data) {
  77424. destination2.push(data);
  77425. });
  77426. };
  77427. return Stream3;
  77428. }();
  77429. /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
  77430. function unpad(padded) {
  77431. return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);
  77432. }
  77433. /*! @name aes-decrypter @version 4.0.1 @license Apache-2.0 */
  77434. const precompute = function() {
  77435. const tables = [[[], [], [], [], []], [[], [], [], [], []]];
  77436. const encTable = tables[0];
  77437. const decTable = tables[1];
  77438. const sbox = encTable[4];
  77439. const sboxInv = decTable[4];
  77440. let i2;
  77441. let x;
  77442. let xInv;
  77443. const d2 = [];
  77444. const th = [];
  77445. let x2;
  77446. let x4;
  77447. let x8;
  77448. let s;
  77449. let tEnc;
  77450. let tDec;
  77451. for (i2 = 0; i2 < 256; i2++) {
  77452. th[(d2[i2] = i2 << 1 ^ (i2 >> 7) * 283) ^ i2] = i2;
  77453. }
  77454. for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {
  77455. s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;
  77456. s = s >> 8 ^ s & 255 ^ 99;
  77457. sbox[x] = s;
  77458. sboxInv[s] = x;
  77459. x8 = d2[x4 = d2[x2 = d2[x]]];
  77460. tDec = x8 * 16843009 ^ x4 * 65537 ^ x2 * 257 ^ x * 16843008;
  77461. tEnc = d2[s] * 257 ^ s * 16843008;
  77462. for (i2 = 0; i2 < 4; i2++) {
  77463. encTable[i2][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;
  77464. decTable[i2][s] = tDec = tDec << 24 ^ tDec >>> 8;
  77465. }
  77466. }
  77467. for (i2 = 0; i2 < 5; i2++) {
  77468. encTable[i2] = encTable[i2].slice(0);
  77469. decTable[i2] = decTable[i2].slice(0);
  77470. }
  77471. return tables;
  77472. };
  77473. let aesTables = null;
  77474. class AES {
  77475. constructor(key) {
  77476. if (!aesTables) {
  77477. aesTables = precompute();
  77478. }
  77479. this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]];
  77480. let i2;
  77481. let j;
  77482. let tmp;
  77483. const sbox = this._tables[0][4];
  77484. const decTable = this._tables[1];
  77485. const keyLen = key.length;
  77486. let rcon = 1;
  77487. if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {
  77488. throw new Error("Invalid aes key size");
  77489. }
  77490. const encKey = key.slice(0);
  77491. const decKey = [];
  77492. this._key = [encKey, decKey];
  77493. for (i2 = keyLen; i2 < 4 * keyLen + 28; i2++) {
  77494. tmp = encKey[i2 - 1];
  77495. if (i2 % keyLen === 0 || keyLen === 8 && i2 % keyLen === 4) {
  77496. tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255];
  77497. if (i2 % keyLen === 0) {
  77498. tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24;
  77499. rcon = rcon << 1 ^ (rcon >> 7) * 283;
  77500. }
  77501. }
  77502. encKey[i2] = encKey[i2 - keyLen] ^ tmp;
  77503. }
  77504. for (j = 0; i2; j++, i2--) {
  77505. tmp = encKey[j & 3 ? i2 : i2 - 4];
  77506. if (i2 <= 4 || j < 4) {
  77507. decKey[j] = tmp;
  77508. } else {
  77509. decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]];
  77510. }
  77511. }
  77512. }
  77513. decrypt(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {
  77514. const key = this._key[1];
  77515. let a = encrypted0 ^ key[0];
  77516. let b = encrypted3 ^ key[1];
  77517. let c = encrypted2 ^ key[2];
  77518. let d2 = encrypted1 ^ key[3];
  77519. let a2;
  77520. let b2;
  77521. let c2;
  77522. const nInnerRounds = key.length / 4 - 2;
  77523. let i2;
  77524. let kIndex = 4;
  77525. const table = this._tables[1];
  77526. const table0 = table[0];
  77527. const table1 = table[1];
  77528. const table2 = table[2];
  77529. const table3 = table[3];
  77530. const sbox = table[4];
  77531. for (i2 = 0; i2 < nInnerRounds; i2++) {
  77532. a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d2 & 255] ^ key[kIndex];
  77533. b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d2 >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1];
  77534. c2 = table0[c >>> 24] ^ table1[d2 >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2];
  77535. d2 = table0[d2 >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3];
  77536. kIndex += 4;
  77537. a = a2;
  77538. b = b2;
  77539. c = c2;
  77540. }
  77541. for (i2 = 0; i2 < 4; i2++) {
  77542. out[(3 & -i2) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d2 & 255] ^ key[kIndex++];
  77543. a2 = a;
  77544. a = b;
  77545. b = c;
  77546. c = d2;
  77547. d2 = a2;
  77548. }
  77549. }
  77550. }
  77551. class AsyncStream extends Stream2 {
  77552. constructor() {
  77553. super(Stream2);
  77554. this.jobs = [];
  77555. this.delay = 1;
  77556. this.timeout_ = null;
  77557. }
  77558. processJob_() {
  77559. this.jobs.shift()();
  77560. if (this.jobs.length) {
  77561. this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);
  77562. } else {
  77563. this.timeout_ = null;
  77564. }
  77565. }
  77566. push(job) {
  77567. this.jobs.push(job);
  77568. if (!this.timeout_) {
  77569. this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);
  77570. }
  77571. }
  77572. }
  77573. const ntoh = function(word) {
  77574. return word << 24 | (word & 65280) << 8 | (word & 16711680) >> 8 | word >>> 24;
  77575. };
  77576. const decrypt3 = function(encrypted, key, initVector) {
  77577. const encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);
  77578. const decipher = new AES(Array.prototype.slice.call(key));
  77579. const decrypted = new Uint8Array(encrypted.byteLength);
  77580. const decrypted32 = new Int32Array(decrypted.buffer);
  77581. let init0;
  77582. let init1;
  77583. let init2;
  77584. let init3;
  77585. let encrypted0;
  77586. let encrypted1;
  77587. let encrypted2;
  77588. let encrypted3;
  77589. let wordIx;
  77590. init0 = initVector[0];
  77591. init1 = initVector[1];
  77592. init2 = initVector[2];
  77593. init3 = initVector[3];
  77594. for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) {
  77595. encrypted0 = ntoh(encrypted32[wordIx]);
  77596. encrypted1 = ntoh(encrypted32[wordIx + 1]);
  77597. encrypted2 = ntoh(encrypted32[wordIx + 2]);
  77598. encrypted3 = ntoh(encrypted32[wordIx + 3]);
  77599. decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx);
  77600. decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0);
  77601. decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1);
  77602. decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2);
  77603. decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3);
  77604. init0 = encrypted0;
  77605. init1 = encrypted1;
  77606. init2 = encrypted2;
  77607. init3 = encrypted3;
  77608. }
  77609. return decrypted;
  77610. };
  77611. class Decrypter2 {
  77612. constructor(encrypted, key, initVector, done) {
  77613. const step = Decrypter2.STEP;
  77614. const encrypted32 = new Int32Array(encrypted.buffer);
  77615. const decrypted = new Uint8Array(encrypted.byteLength);
  77616. let i2 = 0;
  77617. this.asyncStream_ = new AsyncStream();
  77618. this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i2, i2 + step), key, initVector, decrypted));
  77619. for (i2 = step; i2 < encrypted32.length; i2 += step) {
  77620. initVector = new Uint32Array([ntoh(encrypted32[i2 - 4]), ntoh(encrypted32[i2 - 3]), ntoh(encrypted32[i2 - 2]), ntoh(encrypted32[i2 - 1])]);
  77621. this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i2, i2 + step), key, initVector, decrypted));
  77622. }
  77623. this.asyncStream_.push(function() {
  77624. done(null, unpad(decrypted));
  77625. });
  77626. }
  77627. static get STEP() {
  77628. return 32e3;
  77629. }
  77630. decryptChunk_(encrypted, key, initVector, decrypted) {
  77631. return function() {
  77632. const bytes = decrypt3(encrypted, key, initVector);
  77633. decrypted.set(bytes, encrypted.byteOffset);
  77634. };
  77635. }
  77636. }
  77637. var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  77638. var win2;
  77639. if (typeof window !== "undefined") {
  77640. win2 = window;
  77641. } else if (typeof commonjsGlobal2 !== "undefined") {
  77642. win2 = commonjsGlobal2;
  77643. } else if (typeof self !== "undefined") {
  77644. win2 = self;
  77645. } else {
  77646. win2 = {};
  77647. }
  77648. var window_12 = win2;
  77649. var isArrayBufferView4 = function isArrayBufferView5(obj) {
  77650. if (ArrayBuffer.isView === "function") {
  77651. return ArrayBuffer.isView(obj);
  77652. }
  77653. return obj && obj.buffer instanceof ArrayBuffer;
  77654. };
  77655. var BigInt2 = window_12.BigInt || Number;
  77656. [BigInt2("0x1"), BigInt2("0x100"), BigInt2("0x10000"), BigInt2("0x1000000"), BigInt2("0x100000000"), BigInt2("0x10000000000"), BigInt2("0x1000000000000"), BigInt2("0x100000000000000"), BigInt2("0x10000000000000000")];
  77657. (function() {
  77658. var a = new Uint16Array([65484]);
  77659. var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
  77660. if (b[0] === 255) {
  77661. return "big";
  77662. }
  77663. if (b[0] === 204) {
  77664. return "little";
  77665. }
  77666. return "unknown";
  77667. })();
  77668. const createTransferableMessage3 = function(message) {
  77669. const transferable = {};
  77670. Object.keys(message).forEach((key) => {
  77671. const value = message[key];
  77672. if (isArrayBufferView4(value)) {
  77673. transferable[key] = {
  77674. bytes: value.buffer,
  77675. byteOffset: value.byteOffset,
  77676. byteLength: value.byteLength
  77677. };
  77678. } else {
  77679. transferable[key] = value;
  77680. }
  77681. });
  77682. return transferable;
  77683. };
  77684. self.onmessage = function(event2) {
  77685. const data = event2.data;
  77686. const encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength);
  77687. const key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4);
  77688. const iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4);
  77689. new Decrypter2(encrypted, key, iv, function(err, bytes) {
  77690. self.postMessage(createTransferableMessage3({
  77691. source: data.source,
  77692. decrypted: bytes
  77693. }), [bytes.buffer]);
  77694. });
  77695. };
  77696. }));
  77697. var Decrypter$1 = factory$1(workerCode$2);
  77698. const audioTrackKind_$1 = (properties) => {
  77699. let kind = properties.default ? "main" : "alternative";
  77700. if (properties.characteristics && properties.characteristics.indexOf("public.accessibility.describes-video") >= 0) {
  77701. kind = "main-desc";
  77702. }
  77703. return kind;
  77704. };
  77705. const stopLoaders$1 = (segmentLoader, mediaType) => {
  77706. segmentLoader.abort();
  77707. segmentLoader.pause();
  77708. if (mediaType && mediaType.activePlaylistLoader) {
  77709. mediaType.activePlaylistLoader.pause();
  77710. mediaType.activePlaylistLoader = null;
  77711. }
  77712. };
  77713. const startLoaders$1 = (playlistLoader, mediaType) => {
  77714. mediaType.activePlaylistLoader = playlistLoader;
  77715. playlistLoader.load();
  77716. };
  77717. const onGroupChanged$1 = (type2, settings) => () => {
  77718. const {
  77719. segmentLoaders: {
  77720. [type2]: segmentLoader,
  77721. main: mainSegmentLoader
  77722. },
  77723. mediaTypes: {
  77724. [type2]: mediaType
  77725. }
  77726. } = settings;
  77727. const activeTrack2 = mediaType.activeTrack();
  77728. const activeGroup3 = mediaType.getActiveGroup();
  77729. const previousActiveLoader = mediaType.activePlaylistLoader;
  77730. const lastGroup = mediaType.lastGroup_;
  77731. if (activeGroup3 && lastGroup && activeGroup3.id === lastGroup.id) {
  77732. return;
  77733. }
  77734. mediaType.lastGroup_ = activeGroup3;
  77735. mediaType.lastTrack_ = activeTrack2;
  77736. stopLoaders$1(segmentLoader, mediaType);
  77737. if (!activeGroup3 || activeGroup3.isMainPlaylist) {
  77738. return;
  77739. }
  77740. if (!activeGroup3.playlistLoader) {
  77741. if (previousActiveLoader) {
  77742. mainSegmentLoader.resetEverything();
  77743. }
  77744. return;
  77745. }
  77746. segmentLoader.resyncLoader();
  77747. startLoaders$1(activeGroup3.playlistLoader, mediaType);
  77748. };
  77749. const onGroupChanging$1 = (type2, settings) => () => {
  77750. const {
  77751. segmentLoaders: {
  77752. [type2]: segmentLoader
  77753. },
  77754. mediaTypes: {
  77755. [type2]: mediaType
  77756. }
  77757. } = settings;
  77758. mediaType.lastGroup_ = null;
  77759. segmentLoader.abort();
  77760. segmentLoader.pause();
  77761. };
  77762. const onTrackChanged$1 = (type2, settings) => () => {
  77763. const {
  77764. mainPlaylistLoader,
  77765. segmentLoaders: {
  77766. [type2]: segmentLoader,
  77767. main: mainSegmentLoader
  77768. },
  77769. mediaTypes: {
  77770. [type2]: mediaType
  77771. }
  77772. } = settings;
  77773. const activeTrack2 = mediaType.activeTrack();
  77774. const activeGroup3 = mediaType.getActiveGroup();
  77775. const previousActiveLoader = mediaType.activePlaylistLoader;
  77776. const lastTrack = mediaType.lastTrack_;
  77777. if (lastTrack && activeTrack2 && lastTrack.id === activeTrack2.id) {
  77778. return;
  77779. }
  77780. mediaType.lastGroup_ = activeGroup3;
  77781. mediaType.lastTrack_ = activeTrack2;
  77782. stopLoaders$1(segmentLoader, mediaType);
  77783. if (!activeGroup3) {
  77784. return;
  77785. }
  77786. if (activeGroup3.isMainPlaylist) {
  77787. if (!activeTrack2 || !lastTrack || activeTrack2.id === lastTrack.id) {
  77788. return;
  77789. }
  77790. const pc = settings.vhs.playlistController_;
  77791. const newPlaylist = pc.selectPlaylist();
  77792. if (pc.media() === newPlaylist) {
  77793. return;
  77794. }
  77795. mediaType.logger_(`track change. Switching main audio from ${lastTrack.id} to ${activeTrack2.id}`);
  77796. mainPlaylistLoader.pause();
  77797. mainSegmentLoader.resetEverything();
  77798. pc.fastQualityChange_(newPlaylist);
  77799. return;
  77800. }
  77801. if (type2 === "AUDIO") {
  77802. if (!activeGroup3.playlistLoader) {
  77803. mainSegmentLoader.setAudio(true);
  77804. mainSegmentLoader.resetEverything();
  77805. return;
  77806. }
  77807. segmentLoader.setAudio(true);
  77808. mainSegmentLoader.setAudio(false);
  77809. }
  77810. if (previousActiveLoader === activeGroup3.playlistLoader) {
  77811. startLoaders$1(activeGroup3.playlistLoader, mediaType);
  77812. return;
  77813. }
  77814. if (segmentLoader.track) {
  77815. segmentLoader.track(activeTrack2);
  77816. }
  77817. segmentLoader.resetEverything();
  77818. startLoaders$1(activeGroup3.playlistLoader, mediaType);
  77819. };
  77820. const onError$1 = {
  77821. AUDIO: (type2, settings) => () => {
  77822. const {
  77823. segmentLoaders: {
  77824. [type2]: segmentLoader
  77825. },
  77826. mediaTypes: {
  77827. [type2]: mediaType
  77828. },
  77829. excludePlaylist
  77830. } = settings;
  77831. stopLoaders$1(segmentLoader, mediaType);
  77832. const activeTrack2 = mediaType.activeTrack();
  77833. const activeGroup3 = mediaType.activeGroup();
  77834. const id = (activeGroup3.filter((group) => group.default)[0] || activeGroup3[0]).id;
  77835. const defaultTrack = mediaType.tracks[id];
  77836. if (activeTrack2 === defaultTrack) {
  77837. excludePlaylist({
  77838. error: {
  77839. message: "Problem encountered loading the default audio track."
  77840. }
  77841. });
  77842. return;
  77843. }
  77844. videojs$2.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");
  77845. for (const trackId in mediaType.tracks) {
  77846. mediaType.tracks[trackId].enabled = mediaType.tracks[trackId] === defaultTrack;
  77847. }
  77848. mediaType.onTrackChanged();
  77849. },
  77850. SUBTITLES: (type2, settings) => () => {
  77851. const {
  77852. segmentLoaders: {
  77853. [type2]: segmentLoader
  77854. },
  77855. mediaTypes: {
  77856. [type2]: mediaType
  77857. }
  77858. } = settings;
  77859. videojs$2.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");
  77860. stopLoaders$1(segmentLoader, mediaType);
  77861. const track = mediaType.activeTrack();
  77862. if (track) {
  77863. track.mode = "disabled";
  77864. }
  77865. mediaType.onTrackChanged();
  77866. }
  77867. };
  77868. const setupListeners$1 = {
  77869. AUDIO: (type2, playlistLoader, settings) => {
  77870. if (!playlistLoader) {
  77871. return;
  77872. }
  77873. const {
  77874. tech,
  77875. requestOptions,
  77876. segmentLoaders: {
  77877. [type2]: segmentLoader
  77878. }
  77879. } = settings;
  77880. playlistLoader.on("loadedmetadata", () => {
  77881. const media = playlistLoader.media();
  77882. segmentLoader.playlist(media, requestOptions);
  77883. if (!tech.paused() || media.endList && tech.preload() !== "none") {
  77884. segmentLoader.load();
  77885. }
  77886. });
  77887. playlistLoader.on("loadedplaylist", () => {
  77888. segmentLoader.playlist(playlistLoader.media(), requestOptions);
  77889. if (!tech.paused()) {
  77890. segmentLoader.load();
  77891. }
  77892. });
  77893. playlistLoader.on("error", onError$1[type2](type2, settings));
  77894. },
  77895. SUBTITLES: (type2, playlistLoader, settings) => {
  77896. const {
  77897. tech,
  77898. requestOptions,
  77899. segmentLoaders: {
  77900. [type2]: segmentLoader
  77901. },
  77902. mediaTypes: {
  77903. [type2]: mediaType
  77904. }
  77905. } = settings;
  77906. playlistLoader.on("loadedmetadata", () => {
  77907. const media = playlistLoader.media();
  77908. segmentLoader.playlist(media, requestOptions);
  77909. segmentLoader.track(mediaType.activeTrack());
  77910. if (!tech.paused() || media.endList && tech.preload() !== "none") {
  77911. segmentLoader.load();
  77912. }
  77913. });
  77914. playlistLoader.on("loadedplaylist", () => {
  77915. segmentLoader.playlist(playlistLoader.media(), requestOptions);
  77916. if (!tech.paused()) {
  77917. segmentLoader.load();
  77918. }
  77919. });
  77920. playlistLoader.on("error", onError$1[type2](type2, settings));
  77921. }
  77922. };
  77923. const initialize$1 = {
  77924. "AUDIO": (type2, settings) => {
  77925. const {
  77926. vhs,
  77927. sourceType,
  77928. segmentLoaders: {
  77929. [type2]: segmentLoader
  77930. },
  77931. requestOptions,
  77932. main: {
  77933. mediaGroups
  77934. },
  77935. mediaTypes: {
  77936. [type2]: {
  77937. groups,
  77938. tracks,
  77939. logger_
  77940. }
  77941. },
  77942. mainPlaylistLoader
  77943. } = settings;
  77944. const audioOnlyMain = isAudioOnly$1(mainPlaylistLoader.main);
  77945. if (!mediaGroups[type2] || Object.keys(mediaGroups[type2]).length === 0) {
  77946. mediaGroups[type2] = {
  77947. main: {
  77948. default: {
  77949. default: true
  77950. }
  77951. }
  77952. };
  77953. if (audioOnlyMain) {
  77954. mediaGroups[type2].main.default.playlists = mainPlaylistLoader.main.playlists;
  77955. }
  77956. }
  77957. for (const groupId in mediaGroups[type2]) {
  77958. if (!groups[groupId]) {
  77959. groups[groupId] = [];
  77960. }
  77961. for (const variantLabel in mediaGroups[type2][groupId]) {
  77962. let properties = mediaGroups[type2][groupId][variantLabel];
  77963. let playlistLoader;
  77964. if (audioOnlyMain) {
  77965. logger_(`AUDIO group '${groupId}' label '${variantLabel}' is a main playlist`);
  77966. properties.isMainPlaylist = true;
  77967. playlistLoader = null;
  77968. } else if (sourceType === "vhs-json" && properties.playlists) {
  77969. playlistLoader = new PlaylistLoader$1(properties.playlists[0], vhs, requestOptions);
  77970. } else if (properties.resolvedUri) {
  77971. playlistLoader = new PlaylistLoader$1(properties.resolvedUri, vhs, requestOptions);
  77972. } else if (properties.playlists && sourceType === "dash") {
  77973. playlistLoader = new DashPlaylistLoader$1(properties.playlists[0], vhs, requestOptions, mainPlaylistLoader);
  77974. } else {
  77975. playlistLoader = null;
  77976. }
  77977. properties = merge$2({
  77978. id: variantLabel,
  77979. playlistLoader
  77980. }, properties);
  77981. setupListeners$1[type2](type2, properties.playlistLoader, settings);
  77982. groups[groupId].push(properties);
  77983. if (typeof tracks[variantLabel] === "undefined") {
  77984. const track = new videojs$2.AudioTrack({
  77985. id: variantLabel,
  77986. kind: audioTrackKind_$1(properties),
  77987. enabled: false,
  77988. language: properties.language,
  77989. default: properties.default,
  77990. label: variantLabel
  77991. });
  77992. tracks[variantLabel] = track;
  77993. }
  77994. }
  77995. }
  77996. segmentLoader.on("error", onError$1[type2](type2, settings));
  77997. },
  77998. "SUBTITLES": (type2, settings) => {
  77999. const {
  78000. tech,
  78001. vhs,
  78002. sourceType,
  78003. segmentLoaders: {
  78004. [type2]: segmentLoader
  78005. },
  78006. requestOptions,
  78007. main: {
  78008. mediaGroups
  78009. },
  78010. mediaTypes: {
  78011. [type2]: {
  78012. groups,
  78013. tracks
  78014. }
  78015. },
  78016. mainPlaylistLoader
  78017. } = settings;
  78018. for (const groupId in mediaGroups[type2]) {
  78019. if (!groups[groupId]) {
  78020. groups[groupId] = [];
  78021. }
  78022. for (const variantLabel in mediaGroups[type2][groupId]) {
  78023. if (mediaGroups[type2][groupId][variantLabel].forced) {
  78024. continue;
  78025. }
  78026. let properties = mediaGroups[type2][groupId][variantLabel];
  78027. let playlistLoader;
  78028. if (sourceType === "hls") {
  78029. playlistLoader = new PlaylistLoader$1(properties.resolvedUri, vhs, requestOptions);
  78030. } else if (sourceType === "dash") {
  78031. const playlists = properties.playlists.filter((p) => p.excludeUntil !== Infinity);
  78032. if (!playlists.length) {
  78033. return;
  78034. }
  78035. playlistLoader = new DashPlaylistLoader$1(properties.playlists[0], vhs, requestOptions, mainPlaylistLoader);
  78036. } else if (sourceType === "vhs-json") {
  78037. playlistLoader = new PlaylistLoader$1(
  78038. properties.playlists ? properties.playlists[0] : properties.resolvedUri,
  78039. vhs,
  78040. requestOptions
  78041. );
  78042. }
  78043. properties = merge$2({
  78044. id: variantLabel,
  78045. playlistLoader
  78046. }, properties);
  78047. setupListeners$1[type2](type2, properties.playlistLoader, settings);
  78048. groups[groupId].push(properties);
  78049. if (typeof tracks[variantLabel] === "undefined") {
  78050. const track = tech.addRemoteTextTrack({
  78051. id: variantLabel,
  78052. kind: "subtitles",
  78053. default: properties.default && properties.autoselect,
  78054. language: properties.language,
  78055. label: variantLabel
  78056. }, false).track;
  78057. tracks[variantLabel] = track;
  78058. }
  78059. }
  78060. }
  78061. segmentLoader.on("error", onError$1[type2](type2, settings));
  78062. },
  78063. "CLOSED-CAPTIONS": (type2, settings) => {
  78064. const {
  78065. tech,
  78066. main: {
  78067. mediaGroups
  78068. },
  78069. mediaTypes: {
  78070. [type2]: {
  78071. groups,
  78072. tracks
  78073. }
  78074. }
  78075. } = settings;
  78076. for (const groupId in mediaGroups[type2]) {
  78077. if (!groups[groupId]) {
  78078. groups[groupId] = [];
  78079. }
  78080. for (const variantLabel in mediaGroups[type2][groupId]) {
  78081. const properties = mediaGroups[type2][groupId][variantLabel];
  78082. if (!/^(?:CC|SERVICE)/.test(properties.instreamId)) {
  78083. continue;
  78084. }
  78085. const captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};
  78086. let newProps = {
  78087. label: variantLabel,
  78088. language: properties.language,
  78089. instreamId: properties.instreamId,
  78090. default: properties.default && properties.autoselect
  78091. };
  78092. if (captionServices[newProps.instreamId]) {
  78093. newProps = merge$2(newProps, captionServices[newProps.instreamId]);
  78094. }
  78095. if (newProps.default === void 0) {
  78096. delete newProps.default;
  78097. }
  78098. groups[groupId].push(merge$2({
  78099. id: variantLabel
  78100. }, properties));
  78101. if (typeof tracks[variantLabel] === "undefined") {
  78102. const track = tech.addRemoteTextTrack({
  78103. id: newProps.instreamId,
  78104. kind: "captions",
  78105. default: newProps.default,
  78106. language: newProps.language,
  78107. label: newProps.label
  78108. }, false).track;
  78109. tracks[variantLabel] = track;
  78110. }
  78111. }
  78112. }
  78113. }
  78114. };
  78115. const groupMatch$1 = (list, media) => {
  78116. for (let i2 = 0; i2 < list.length; i2++) {
  78117. if (playlistMatch$1(media, list[i2])) {
  78118. return true;
  78119. }
  78120. if (list[i2].playlists && groupMatch$1(list[i2].playlists, media)) {
  78121. return true;
  78122. }
  78123. }
  78124. return false;
  78125. };
  78126. const activeGroup$1 = (type2, settings) => (track) => {
  78127. const {
  78128. mainPlaylistLoader,
  78129. mediaTypes: {
  78130. [type2]: {
  78131. groups
  78132. }
  78133. }
  78134. } = settings;
  78135. const media = mainPlaylistLoader.media();
  78136. if (!media) {
  78137. return null;
  78138. }
  78139. let variants = null;
  78140. if (media.attributes[type2]) {
  78141. variants = groups[media.attributes[type2]];
  78142. }
  78143. const groupKeys = Object.keys(groups);
  78144. if (!variants) {
  78145. if (type2 === "AUDIO" && groupKeys.length > 1 && isAudioOnly$1(settings.main)) {
  78146. for (let i2 = 0; i2 < groupKeys.length; i2++) {
  78147. const groupPropertyList = groups[groupKeys[i2]];
  78148. if (groupMatch$1(groupPropertyList, media)) {
  78149. variants = groupPropertyList;
  78150. break;
  78151. }
  78152. }
  78153. } else if (groups.main) {
  78154. variants = groups.main;
  78155. } else if (groupKeys.length === 1) {
  78156. variants = groups[groupKeys[0]];
  78157. }
  78158. }
  78159. if (typeof track === "undefined") {
  78160. return variants;
  78161. }
  78162. if (track === null || !variants) {
  78163. return null;
  78164. }
  78165. return variants.filter((props) => props.id === track.id)[0] || null;
  78166. };
  78167. const activeTrack$1 = {
  78168. AUDIO: (type2, settings) => () => {
  78169. const {
  78170. mediaTypes: {
  78171. [type2]: {
  78172. tracks
  78173. }
  78174. }
  78175. } = settings;
  78176. for (const id in tracks) {
  78177. if (tracks[id].enabled) {
  78178. return tracks[id];
  78179. }
  78180. }
  78181. return null;
  78182. },
  78183. SUBTITLES: (type2, settings) => () => {
  78184. const {
  78185. mediaTypes: {
  78186. [type2]: {
  78187. tracks
  78188. }
  78189. }
  78190. } = settings;
  78191. for (const id in tracks) {
  78192. if (tracks[id].mode === "showing" || tracks[id].mode === "hidden") {
  78193. return tracks[id];
  78194. }
  78195. }
  78196. return null;
  78197. }
  78198. };
  78199. const getActiveGroup$1 = (type2, {
  78200. mediaTypes: mediaTypes2
  78201. }) => () => {
  78202. const activeTrack_ = mediaTypes2[type2].activeTrack();
  78203. if (!activeTrack_) {
  78204. return null;
  78205. }
  78206. return mediaTypes2[type2].activeGroup(activeTrack_);
  78207. };
  78208. const setupMediaGroups$1 = (settings) => {
  78209. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach((type2) => {
  78210. initialize$1[type2](type2, settings);
  78211. });
  78212. const {
  78213. mediaTypes: mediaTypes2,
  78214. mainPlaylistLoader,
  78215. tech,
  78216. vhs,
  78217. segmentLoaders: {
  78218. ["AUDIO"]: audioSegmentLoader,
  78219. main: mainSegmentLoader
  78220. }
  78221. } = settings;
  78222. ["AUDIO", "SUBTITLES"].forEach((type2) => {
  78223. mediaTypes2[type2].activeGroup = activeGroup$1(type2, settings);
  78224. mediaTypes2[type2].activeTrack = activeTrack$1[type2](type2, settings);
  78225. mediaTypes2[type2].onGroupChanged = onGroupChanged$1(type2, settings);
  78226. mediaTypes2[type2].onGroupChanging = onGroupChanging$1(type2, settings);
  78227. mediaTypes2[type2].onTrackChanged = onTrackChanged$1(type2, settings);
  78228. mediaTypes2[type2].getActiveGroup = getActiveGroup$1(type2, settings);
  78229. });
  78230. const audioGroup = mediaTypes2.AUDIO.activeGroup();
  78231. if (audioGroup) {
  78232. const groupId = (audioGroup.filter((group) => group.default)[0] || audioGroup[0]).id;
  78233. mediaTypes2.AUDIO.tracks[groupId].enabled = true;
  78234. mediaTypes2.AUDIO.onGroupChanged();
  78235. mediaTypes2.AUDIO.onTrackChanged();
  78236. const activeAudioGroup = mediaTypes2.AUDIO.getActiveGroup();
  78237. if (!activeAudioGroup.playlistLoader) {
  78238. mainSegmentLoader.setAudio(true);
  78239. } else {
  78240. mainSegmentLoader.setAudio(false);
  78241. audioSegmentLoader.setAudio(true);
  78242. }
  78243. }
  78244. mainPlaylistLoader.on("mediachange", () => {
  78245. ["AUDIO", "SUBTITLES"].forEach((type2) => mediaTypes2[type2].onGroupChanged());
  78246. });
  78247. mainPlaylistLoader.on("mediachanging", () => {
  78248. ["AUDIO", "SUBTITLES"].forEach((type2) => mediaTypes2[type2].onGroupChanging());
  78249. });
  78250. const onAudioTrackChanged = () => {
  78251. mediaTypes2.AUDIO.onTrackChanged();
  78252. tech.trigger({
  78253. type: "usage",
  78254. name: "vhs-audio-change"
  78255. });
  78256. };
  78257. tech.audioTracks().addEventListener("change", onAudioTrackChanged);
  78258. tech.remoteTextTracks().addEventListener("change", mediaTypes2.SUBTITLES.onTrackChanged);
  78259. vhs.on("dispose", () => {
  78260. tech.audioTracks().removeEventListener("change", onAudioTrackChanged);
  78261. tech.remoteTextTracks().removeEventListener("change", mediaTypes2.SUBTITLES.onTrackChanged);
  78262. });
  78263. tech.clearTracks("audio");
  78264. for (const id in mediaTypes2.AUDIO.tracks) {
  78265. tech.audioTracks().addTrack(mediaTypes2.AUDIO.tracks[id]);
  78266. }
  78267. };
  78268. const createMediaTypes$1 = () => {
  78269. const mediaTypes2 = {};
  78270. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach((type2) => {
  78271. mediaTypes2[type2] = {
  78272. groups: {},
  78273. tracks: {},
  78274. activePlaylistLoader: null,
  78275. activeGroup: noop$1,
  78276. activeTrack: noop$1,
  78277. getActiveGroup: noop$1,
  78278. onGroupChanged: noop$1,
  78279. onTrackChanged: noop$1,
  78280. lastTrack_: null,
  78281. logger_: logger$1(`MediaGroups[${type2}]`)
  78282. };
  78283. });
  78284. return mediaTypes2;
  78285. };
  78286. const ABORT_EARLY_EXCLUSION_SECONDS = 60 * 2;
  78287. let Vhs$1$1;
  78288. const loaderStats$1 = ["mediaRequests", "mediaRequestsAborted", "mediaRequestsTimedout", "mediaRequestsErrored", "mediaTransferDuration", "mediaBytesTransferred", "mediaAppends"];
  78289. const sumLoaderStat$1 = function(stat) {
  78290. return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat];
  78291. };
  78292. const shouldSwitchToMedia$1 = function({
  78293. currentPlaylist,
  78294. buffered,
  78295. currentTime,
  78296. nextPlaylist,
  78297. bufferLowWaterLine,
  78298. bufferHighWaterLine,
  78299. duration: duration5,
  78300. bufferBasedABR,
  78301. log: log2
  78302. }) {
  78303. if (!nextPlaylist) {
  78304. videojs$2.log.warn("We received no playlist to switch to. Please check your stream.");
  78305. return false;
  78306. }
  78307. const sharedLogLine = `allowing switch ${currentPlaylist && currentPlaylist.id || "null"} -> ${nextPlaylist.id}`;
  78308. if (!currentPlaylist) {
  78309. log2(`${sharedLogLine} as current playlist is not set`);
  78310. return true;
  78311. }
  78312. if (nextPlaylist.id === currentPlaylist.id) {
  78313. return false;
  78314. }
  78315. const isBuffered = Boolean(findRange$1(buffered, currentTime).length);
  78316. if (!currentPlaylist.endList) {
  78317. if (!isBuffered && typeof currentPlaylist.partTargetDuration === "number") {
  78318. log2(`not ${sharedLogLine} as current playlist is live llhls, but currentTime isn't in buffered.`);
  78319. return false;
  78320. }
  78321. log2(`${sharedLogLine} as current playlist is live`);
  78322. return true;
  78323. }
  78324. const forwardBuffer = timeAheadOf$1(buffered, currentTime);
  78325. const maxBufferLowWaterLine = bufferBasedABR ? Config$1.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config$1.MAX_BUFFER_LOW_WATER_LINE;
  78326. if (duration5 < maxBufferLowWaterLine) {
  78327. log2(`${sharedLogLine} as duration < max low water line (${duration5} < ${maxBufferLowWaterLine})`);
  78328. return true;
  78329. }
  78330. const nextBandwidth = nextPlaylist.attributes.BANDWIDTH;
  78331. const currBandwidth = currentPlaylist.attributes.BANDWIDTH;
  78332. if (nextBandwidth < currBandwidth && (!bufferBasedABR || forwardBuffer < bufferHighWaterLine)) {
  78333. let logLine = `${sharedLogLine} as next bandwidth < current bandwidth (${nextBandwidth} < ${currBandwidth})`;
  78334. if (bufferBasedABR) {
  78335. logLine += ` and forwardBuffer < bufferHighWaterLine (${forwardBuffer} < ${bufferHighWaterLine})`;
  78336. }
  78337. log2(logLine);
  78338. return true;
  78339. }
  78340. if ((!bufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) {
  78341. let logLine = `${sharedLogLine} as forwardBuffer >= bufferLowWaterLine (${forwardBuffer} >= ${bufferLowWaterLine})`;
  78342. if (bufferBasedABR) {
  78343. logLine += ` and next bandwidth > current bandwidth (${nextBandwidth} > ${currBandwidth})`;
  78344. }
  78345. log2(logLine);
  78346. return true;
  78347. }
  78348. log2(`not ${sharedLogLine} as no switching criteria met`);
  78349. return false;
  78350. };
  78351. class PlaylistController extends videojs$2.EventTarget {
  78352. constructor(options2) {
  78353. super();
  78354. const {
  78355. src,
  78356. withCredentials,
  78357. tech,
  78358. bandwidth: bandwidth2,
  78359. externVhs,
  78360. useCueTags,
  78361. playlistExclusionDuration,
  78362. enableLowInitialPlaylist,
  78363. sourceType,
  78364. cacheEncryptionKeys,
  78365. bufferBasedABR,
  78366. leastPixelDiffSelector,
  78367. captionServices
  78368. } = options2;
  78369. if (!src) {
  78370. throw new Error("A non-empty playlist URL or JSON manifest string is required");
  78371. }
  78372. let {
  78373. maxPlaylistRetries
  78374. } = options2;
  78375. if (maxPlaylistRetries === null || typeof maxPlaylistRetries === "undefined") {
  78376. maxPlaylistRetries = Infinity;
  78377. }
  78378. Vhs$1$1 = externVhs;
  78379. this.bufferBasedABR = Boolean(bufferBasedABR);
  78380. this.leastPixelDiffSelector = Boolean(leastPixelDiffSelector);
  78381. this.withCredentials = withCredentials;
  78382. this.tech_ = tech;
  78383. this.vhs_ = tech.vhs;
  78384. this.sourceType_ = sourceType;
  78385. this.useCueTags_ = useCueTags;
  78386. this.playlistExclusionDuration = playlistExclusionDuration;
  78387. this.maxPlaylistRetries = maxPlaylistRetries;
  78388. this.enableLowInitialPlaylist = enableLowInitialPlaylist;
  78389. if (this.useCueTags_) {
  78390. this.cueTagsTrack_ = this.tech_.addTextTrack("metadata", "ad-cues");
  78391. this.cueTagsTrack_.inBandMetadataTrackDispatchType = "";
  78392. }
  78393. this.requestOptions_ = {
  78394. withCredentials,
  78395. maxPlaylistRetries,
  78396. timeout: null
  78397. };
  78398. this.on("error", this.pauseLoading);
  78399. this.mediaTypes_ = createMediaTypes$1();
  78400. this.mediaSource = new window_1.MediaSource();
  78401. this.handleDurationChange_ = this.handleDurationChange_.bind(this);
  78402. this.handleSourceOpen_ = this.handleSourceOpen_.bind(this);
  78403. this.handleSourceEnded_ = this.handleSourceEnded_.bind(this);
  78404. this.mediaSource.addEventListener("durationchange", this.handleDurationChange_);
  78405. this.mediaSource.addEventListener("sourceopen", this.handleSourceOpen_);
  78406. this.mediaSource.addEventListener("sourceended", this.handleSourceEnded_);
  78407. this.seekable_ = createTimeRanges$2();
  78408. this.hasPlayed_ = false;
  78409. this.syncController_ = new SyncController$1(options2);
  78410. this.segmentMetadataTrack_ = tech.addRemoteTextTrack({
  78411. kind: "metadata",
  78412. label: "segment-metadata"
  78413. }, false).track;
  78414. this.decrypter_ = new Decrypter$1();
  78415. this.sourceUpdater_ = new SourceUpdater$1(this.mediaSource);
  78416. this.inbandTextTracks_ = {};
  78417. this.timelineChangeController_ = new TimelineChangeController$1();
  78418. const segmentLoaderSettings = {
  78419. vhs: this.vhs_,
  78420. parse708captions: options2.parse708captions,
  78421. useDtsForTimestampOffset: options2.useDtsForTimestampOffset,
  78422. captionServices,
  78423. mediaSource: this.mediaSource,
  78424. currentTime: this.tech_.currentTime.bind(this.tech_),
  78425. seekable: () => this.seekable(),
  78426. seeking: () => this.tech_.seeking(),
  78427. duration: () => this.duration(),
  78428. hasPlayed: () => this.hasPlayed_,
  78429. goalBufferLength: () => this.goalBufferLength(),
  78430. bandwidth: bandwidth2,
  78431. syncController: this.syncController_,
  78432. decrypter: this.decrypter_,
  78433. sourceType: this.sourceType_,
  78434. inbandTextTracks: this.inbandTextTracks_,
  78435. cacheEncryptionKeys,
  78436. sourceUpdater: this.sourceUpdater_,
  78437. timelineChangeController: this.timelineChangeController_,
  78438. exactManifestTimings: options2.exactManifestTimings
  78439. };
  78440. this.mainPlaylistLoader_ = this.sourceType_ === "dash" ? new DashPlaylistLoader$1(src, this.vhs_, this.requestOptions_) : new PlaylistLoader$1(src, this.vhs_, this.requestOptions_);
  78441. this.setupMainPlaylistLoaderListeners_();
  78442. this.mainSegmentLoader_ = new SegmentLoader$1(merge$2(segmentLoaderSettings, {
  78443. segmentMetadataTrack: this.segmentMetadataTrack_,
  78444. loaderType: "main"
  78445. }), options2);
  78446. this.audioSegmentLoader_ = new SegmentLoader$1(merge$2(segmentLoaderSettings, {
  78447. loaderType: "audio"
  78448. }), options2);
  78449. this.subtitleSegmentLoader_ = new VTTSegmentLoader$1(merge$2(segmentLoaderSettings, {
  78450. loaderType: "vtt",
  78451. featuresNativeTextTracks: this.tech_.featuresNativeTextTracks,
  78452. loadVttJs: () => new Promise((resolve2, reject2) => {
  78453. function onLoad() {
  78454. tech.off("vttjserror", onError2);
  78455. resolve2();
  78456. }
  78457. function onError2() {
  78458. tech.off("vttjsloaded", onLoad);
  78459. reject2();
  78460. }
  78461. tech.one("vttjsloaded", onLoad);
  78462. tech.one("vttjserror", onError2);
  78463. tech.addWebVttScript_();
  78464. })
  78465. }), options2);
  78466. this.setupSegmentLoaderListeners_();
  78467. if (this.bufferBasedABR) {
  78468. this.mainPlaylistLoader_.one("loadedplaylist", () => this.startABRTimer_());
  78469. this.tech_.on("pause", () => this.stopABRTimer_());
  78470. this.tech_.on("play", () => this.startABRTimer_());
  78471. }
  78472. loaderStats$1.forEach((stat) => {
  78473. this[stat + "_"] = sumLoaderStat$1.bind(this, stat);
  78474. });
  78475. this.logger_ = logger$1("pc");
  78476. this.triggeredFmp4Usage = false;
  78477. if (this.tech_.preload() === "none") {
  78478. this.loadOnPlay_ = () => {
  78479. this.loadOnPlay_ = null;
  78480. this.mainPlaylistLoader_.load();
  78481. };
  78482. this.tech_.one("play", this.loadOnPlay_);
  78483. } else {
  78484. this.mainPlaylistLoader_.load();
  78485. }
  78486. this.timeToLoadedData__ = -1;
  78487. this.mainAppendsToLoadedData__ = -1;
  78488. this.audioAppendsToLoadedData__ = -1;
  78489. const event2 = this.tech_.preload() === "none" ? "play" : "loadstart";
  78490. this.tech_.one(event2, () => {
  78491. const timeToLoadedDataStart = Date.now();
  78492. this.tech_.one("loadeddata", () => {
  78493. this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart;
  78494. this.mainAppendsToLoadedData__ = this.mainSegmentLoader_.mediaAppends;
  78495. this.audioAppendsToLoadedData__ = this.audioSegmentLoader_.mediaAppends;
  78496. });
  78497. });
  78498. }
  78499. mainAppendsToLoadedData_() {
  78500. return this.mainAppendsToLoadedData__;
  78501. }
  78502. audioAppendsToLoadedData_() {
  78503. return this.audioAppendsToLoadedData__;
  78504. }
  78505. appendsToLoadedData_() {
  78506. const main = this.mainAppendsToLoadedData_();
  78507. const audio = this.audioAppendsToLoadedData_();
  78508. if (main === -1 || audio === -1) {
  78509. return -1;
  78510. }
  78511. return main + audio;
  78512. }
  78513. timeToLoadedData_() {
  78514. return this.timeToLoadedData__;
  78515. }
  78516. checkABR_(reason = "abr") {
  78517. const nextPlaylist = this.selectPlaylist();
  78518. if (nextPlaylist && this.shouldSwitchToMedia_(nextPlaylist)) {
  78519. this.switchMedia_(nextPlaylist, reason);
  78520. }
  78521. }
  78522. switchMedia_(playlist, cause, delay) {
  78523. const oldMedia = this.media();
  78524. const oldId = oldMedia && (oldMedia.id || oldMedia.uri);
  78525. const newId = playlist.id || playlist.uri;
  78526. if (oldId && oldId !== newId) {
  78527. this.logger_(`switch media ${oldId} -> ${newId} from ${cause}`);
  78528. this.tech_.trigger({
  78529. type: "usage",
  78530. name: `vhs-rendition-change-${cause}`
  78531. });
  78532. }
  78533. this.mainPlaylistLoader_.media(playlist, delay);
  78534. }
  78535. startABRTimer_() {
  78536. this.stopABRTimer_();
  78537. this.abrTimer_ = window_1.setInterval(() => this.checkABR_(), 250);
  78538. }
  78539. stopABRTimer_() {
  78540. if (this.tech_.scrubbing && this.tech_.scrubbing()) {
  78541. return;
  78542. }
  78543. window_1.clearInterval(this.abrTimer_);
  78544. this.abrTimer_ = null;
  78545. }
  78546. getAudioTrackPlaylists_() {
  78547. const main = this.main();
  78548. const defaultPlaylists = main && main.playlists || [];
  78549. if (!main || !main.mediaGroups || !main.mediaGroups.AUDIO) {
  78550. return defaultPlaylists;
  78551. }
  78552. const AUDIO5 = main.mediaGroups.AUDIO;
  78553. const groupKeys = Object.keys(AUDIO5);
  78554. let track;
  78555. if (Object.keys(this.mediaTypes_.AUDIO.groups).length) {
  78556. track = this.mediaTypes_.AUDIO.activeTrack();
  78557. } else {
  78558. const defaultGroup = AUDIO5.main || groupKeys.length && AUDIO5[groupKeys[0]];
  78559. for (const label in defaultGroup) {
  78560. if (defaultGroup[label].default) {
  78561. track = {
  78562. label
  78563. };
  78564. break;
  78565. }
  78566. }
  78567. }
  78568. if (!track) {
  78569. return defaultPlaylists;
  78570. }
  78571. const playlists = [];
  78572. for (const group in AUDIO5) {
  78573. if (AUDIO5[group][track.label]) {
  78574. const properties = AUDIO5[group][track.label];
  78575. if (properties.playlists && properties.playlists.length) {
  78576. playlists.push.apply(playlists, properties.playlists);
  78577. } else if (properties.uri) {
  78578. playlists.push(properties);
  78579. } else if (main.playlists.length) {
  78580. for (let i2 = 0; i2 < main.playlists.length; i2++) {
  78581. const playlist = main.playlists[i2];
  78582. if (playlist.attributes && playlist.attributes.AUDIO && playlist.attributes.AUDIO === group) {
  78583. playlists.push(playlist);
  78584. }
  78585. }
  78586. }
  78587. }
  78588. }
  78589. if (!playlists.length) {
  78590. return defaultPlaylists;
  78591. }
  78592. return playlists;
  78593. }
  78594. setupMainPlaylistLoaderListeners_() {
  78595. this.mainPlaylistLoader_.on("loadedmetadata", () => {
  78596. const media = this.mainPlaylistLoader_.media();
  78597. const requestTimeout = media.targetDuration * 1.5 * 1e3;
  78598. if (isLowestEnabledRendition$1(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.media())) {
  78599. this.requestOptions_.timeout = 0;
  78600. } else {
  78601. this.requestOptions_.timeout = requestTimeout;
  78602. }
  78603. if (media.endList && this.tech_.preload() !== "none") {
  78604. this.mainSegmentLoader_.playlist(media, this.requestOptions_);
  78605. this.mainSegmentLoader_.load();
  78606. }
  78607. setupMediaGroups$1({
  78608. sourceType: this.sourceType_,
  78609. segmentLoaders: {
  78610. AUDIO: this.audioSegmentLoader_,
  78611. SUBTITLES: this.subtitleSegmentLoader_,
  78612. main: this.mainSegmentLoader_
  78613. },
  78614. tech: this.tech_,
  78615. requestOptions: this.requestOptions_,
  78616. mainPlaylistLoader: this.mainPlaylistLoader_,
  78617. vhs: this.vhs_,
  78618. main: this.main(),
  78619. mediaTypes: this.mediaTypes_,
  78620. excludePlaylist: this.excludePlaylist.bind(this)
  78621. });
  78622. this.triggerPresenceUsage_(this.main(), media);
  78623. this.setupFirstPlay();
  78624. if (!this.mediaTypes_.AUDIO.activePlaylistLoader || this.mediaTypes_.AUDIO.activePlaylistLoader.media()) {
  78625. this.trigger("selectedinitialmedia");
  78626. } else {
  78627. this.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata", () => {
  78628. this.trigger("selectedinitialmedia");
  78629. });
  78630. }
  78631. });
  78632. this.mainPlaylistLoader_.on("loadedplaylist", () => {
  78633. if (this.loadOnPlay_) {
  78634. this.tech_.off("play", this.loadOnPlay_);
  78635. }
  78636. let updatedPlaylist = this.mainPlaylistLoader_.media();
  78637. if (!updatedPlaylist) {
  78638. this.excludeUnsupportedVariants_();
  78639. let selectedMedia;
  78640. if (this.enableLowInitialPlaylist) {
  78641. selectedMedia = this.selectInitialPlaylist();
  78642. }
  78643. if (!selectedMedia) {
  78644. selectedMedia = this.selectPlaylist();
  78645. }
  78646. if (!selectedMedia || !this.shouldSwitchToMedia_(selectedMedia)) {
  78647. return;
  78648. }
  78649. this.initialMedia_ = selectedMedia;
  78650. this.switchMedia_(this.initialMedia_, "initial");
  78651. const haveJsonSource = this.sourceType_ === "vhs-json" && this.initialMedia_.segments;
  78652. if (!haveJsonSource) {
  78653. return;
  78654. }
  78655. updatedPlaylist = this.initialMedia_;
  78656. }
  78657. this.handleUpdatedMediaPlaylist(updatedPlaylist);
  78658. });
  78659. this.mainPlaylistLoader_.on("error", () => {
  78660. const error = this.mainPlaylistLoader_.error;
  78661. this.excludePlaylist({
  78662. playlistToExclude: error.playlist,
  78663. error
  78664. });
  78665. });
  78666. this.mainPlaylistLoader_.on("mediachanging", () => {
  78667. this.mainSegmentLoader_.abort();
  78668. this.mainSegmentLoader_.pause();
  78669. });
  78670. this.mainPlaylistLoader_.on("mediachange", () => {
  78671. const media = this.mainPlaylistLoader_.media();
  78672. const requestTimeout = media.targetDuration * 1.5 * 1e3;
  78673. if (isLowestEnabledRendition$1(this.mainPlaylistLoader_.main, this.mainPlaylistLoader_.media())) {
  78674. this.requestOptions_.timeout = 0;
  78675. } else {
  78676. this.requestOptions_.timeout = requestTimeout;
  78677. }
  78678. this.mainPlaylistLoader_.load();
  78679. this.mainSegmentLoader_.playlist(media, this.requestOptions_);
  78680. this.mainSegmentLoader_.load();
  78681. this.tech_.trigger({
  78682. type: "mediachange",
  78683. bubbles: true
  78684. });
  78685. });
  78686. this.mainPlaylistLoader_.on("playlistunchanged", () => {
  78687. const updatedPlaylist = this.mainPlaylistLoader_.media();
  78688. if (updatedPlaylist.lastExcludeReason_ === "playlist-unchanged") {
  78689. return;
  78690. }
  78691. const playlistOutdated = this.stuckAtPlaylistEnd_(updatedPlaylist);
  78692. if (playlistOutdated) {
  78693. this.excludePlaylist({
  78694. error: {
  78695. message: "Playlist no longer updating.",
  78696. reason: "playlist-unchanged"
  78697. }
  78698. });
  78699. this.tech_.trigger("playliststuck");
  78700. }
  78701. });
  78702. this.mainPlaylistLoader_.on("renditiondisabled", () => {
  78703. this.tech_.trigger({
  78704. type: "usage",
  78705. name: "vhs-rendition-disabled"
  78706. });
  78707. });
  78708. this.mainPlaylistLoader_.on("renditionenabled", () => {
  78709. this.tech_.trigger({
  78710. type: "usage",
  78711. name: "vhs-rendition-enabled"
  78712. });
  78713. });
  78714. }
  78715. handleUpdatedMediaPlaylist(updatedPlaylist) {
  78716. if (this.useCueTags_) {
  78717. this.updateAdCues_(updatedPlaylist);
  78718. }
  78719. this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_);
  78720. this.updateDuration(!updatedPlaylist.endList);
  78721. if (!this.tech_.paused()) {
  78722. this.mainSegmentLoader_.load();
  78723. if (this.audioSegmentLoader_) {
  78724. this.audioSegmentLoader_.load();
  78725. }
  78726. }
  78727. }
  78728. triggerPresenceUsage_(main, media) {
  78729. const mediaGroups = main.mediaGroups || {};
  78730. let defaultDemuxed = true;
  78731. const audioGroupKeys = Object.keys(mediaGroups.AUDIO);
  78732. for (const mediaGroup in mediaGroups.AUDIO) {
  78733. for (const label in mediaGroups.AUDIO[mediaGroup]) {
  78734. const properties = mediaGroups.AUDIO[mediaGroup][label];
  78735. if (!properties.uri) {
  78736. defaultDemuxed = false;
  78737. }
  78738. }
  78739. }
  78740. if (defaultDemuxed) {
  78741. this.tech_.trigger({
  78742. type: "usage",
  78743. name: "vhs-demuxed"
  78744. });
  78745. }
  78746. if (Object.keys(mediaGroups.SUBTITLES).length) {
  78747. this.tech_.trigger({
  78748. type: "usage",
  78749. name: "vhs-webvtt"
  78750. });
  78751. }
  78752. if (Vhs$1$1.Playlist.isAes(media)) {
  78753. this.tech_.trigger({
  78754. type: "usage",
  78755. name: "vhs-aes"
  78756. });
  78757. }
  78758. if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) {
  78759. this.tech_.trigger({
  78760. type: "usage",
  78761. name: "vhs-alternate-audio"
  78762. });
  78763. }
  78764. if (this.useCueTags_) {
  78765. this.tech_.trigger({
  78766. type: "usage",
  78767. name: "vhs-playlist-cue-tags"
  78768. });
  78769. }
  78770. }
  78771. shouldSwitchToMedia_(nextPlaylist) {
  78772. const currentPlaylist = this.mainPlaylistLoader_.media() || this.mainPlaylistLoader_.pendingMedia_;
  78773. const currentTime = this.tech_.currentTime();
  78774. const bufferLowWaterLine = this.bufferLowWaterLine();
  78775. const bufferHighWaterLine = this.bufferHighWaterLine();
  78776. const buffered = this.tech_.buffered();
  78777. return shouldSwitchToMedia$1({
  78778. buffered,
  78779. currentTime,
  78780. currentPlaylist,
  78781. nextPlaylist,
  78782. bufferLowWaterLine,
  78783. bufferHighWaterLine,
  78784. duration: this.duration(),
  78785. bufferBasedABR: this.bufferBasedABR,
  78786. log: this.logger_
  78787. });
  78788. }
  78789. setupSegmentLoaderListeners_() {
  78790. this.mainSegmentLoader_.on("bandwidthupdate", () => {
  78791. this.checkABR_("bandwidthupdate");
  78792. this.tech_.trigger("bandwidthupdate");
  78793. });
  78794. this.mainSegmentLoader_.on("timeout", () => {
  78795. if (this.bufferBasedABR) {
  78796. this.mainSegmentLoader_.load();
  78797. }
  78798. });
  78799. if (!this.bufferBasedABR) {
  78800. this.mainSegmentLoader_.on("progress", () => {
  78801. this.trigger("progress");
  78802. });
  78803. }
  78804. this.mainSegmentLoader_.on("error", () => {
  78805. const error = this.mainSegmentLoader_.error();
  78806. this.excludePlaylist({
  78807. playlistToExclude: error.playlist,
  78808. error
  78809. });
  78810. });
  78811. this.mainSegmentLoader_.on("appenderror", () => {
  78812. this.error = this.mainSegmentLoader_.error_;
  78813. this.trigger("error");
  78814. });
  78815. this.mainSegmentLoader_.on("syncinfoupdate", () => {
  78816. this.onSyncInfoUpdate_();
  78817. });
  78818. this.mainSegmentLoader_.on("timestampoffset", () => {
  78819. this.tech_.trigger({
  78820. type: "usage",
  78821. name: "vhs-timestamp-offset"
  78822. });
  78823. });
  78824. this.audioSegmentLoader_.on("syncinfoupdate", () => {
  78825. this.onSyncInfoUpdate_();
  78826. });
  78827. this.audioSegmentLoader_.on("appenderror", () => {
  78828. this.error = this.audioSegmentLoader_.error_;
  78829. this.trigger("error");
  78830. });
  78831. this.mainSegmentLoader_.on("ended", () => {
  78832. this.logger_("main segment loader ended");
  78833. this.onEndOfStream();
  78834. });
  78835. this.mainSegmentLoader_.on("earlyabort", (event2) => {
  78836. if (this.bufferBasedABR) {
  78837. return;
  78838. }
  78839. this.delegateLoaders_("all", ["abort"]);
  78840. this.excludePlaylist({
  78841. error: {
  78842. message: "Aborted early because there isn't enough bandwidth to complete the request without rebuffering."
  78843. },
  78844. playlistExclusionDuration: ABORT_EARLY_EXCLUSION_SECONDS
  78845. });
  78846. });
  78847. const updateCodecs = () => {
  78848. if (!this.sourceUpdater_.hasCreatedSourceBuffers()) {
  78849. return this.tryToCreateSourceBuffers_();
  78850. }
  78851. const codecs = this.getCodecsOrExclude_();
  78852. if (!codecs) {
  78853. return;
  78854. }
  78855. this.sourceUpdater_.addOrChangeSourceBuffers(codecs);
  78856. };
  78857. this.mainSegmentLoader_.on("trackinfo", updateCodecs);
  78858. this.audioSegmentLoader_.on("trackinfo", updateCodecs);
  78859. this.mainSegmentLoader_.on("fmp4", () => {
  78860. if (!this.triggeredFmp4Usage) {
  78861. this.tech_.trigger({
  78862. type: "usage",
  78863. name: "vhs-fmp4"
  78864. });
  78865. this.triggeredFmp4Usage = true;
  78866. }
  78867. });
  78868. this.audioSegmentLoader_.on("fmp4", () => {
  78869. if (!this.triggeredFmp4Usage) {
  78870. this.tech_.trigger({
  78871. type: "usage",
  78872. name: "vhs-fmp4"
  78873. });
  78874. this.triggeredFmp4Usage = true;
  78875. }
  78876. });
  78877. this.audioSegmentLoader_.on("ended", () => {
  78878. this.logger_("audioSegmentLoader ended");
  78879. this.onEndOfStream();
  78880. });
  78881. }
  78882. mediaSecondsLoaded_() {
  78883. return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded);
  78884. }
  78885. load() {
  78886. this.mainSegmentLoader_.load();
  78887. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  78888. this.audioSegmentLoader_.load();
  78889. }
  78890. if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
  78891. this.subtitleSegmentLoader_.load();
  78892. }
  78893. }
  78894. fastQualityChange_(media = this.selectPlaylist()) {
  78895. if (media === this.mainPlaylistLoader_.media()) {
  78896. this.logger_("skipping fastQualityChange because new media is same as old");
  78897. return;
  78898. }
  78899. this.switchMedia_(media, "fast-quality");
  78900. this.mainSegmentLoader_.resetEverything(() => {
  78901. if (videojs$2.browser.IE_VERSION || videojs$2.browser.IS_EDGE) {
  78902. this.tech_.setCurrentTime(this.tech_.currentTime() + 0.04);
  78903. } else {
  78904. this.tech_.setCurrentTime(this.tech_.currentTime());
  78905. }
  78906. });
  78907. }
  78908. play() {
  78909. if (this.setupFirstPlay()) {
  78910. return;
  78911. }
  78912. if (this.tech_.ended()) {
  78913. this.tech_.setCurrentTime(0);
  78914. }
  78915. if (this.hasPlayed_) {
  78916. this.load();
  78917. }
  78918. const seekable3 = this.tech_.seekable();
  78919. if (this.tech_.duration() === Infinity) {
  78920. if (this.tech_.currentTime() < seekable3.start(0)) {
  78921. return this.tech_.setCurrentTime(seekable3.end(seekable3.length - 1));
  78922. }
  78923. }
  78924. }
  78925. setupFirstPlay() {
  78926. const media = this.mainPlaylistLoader_.media();
  78927. if (!media || this.tech_.paused() || this.hasPlayed_) {
  78928. return false;
  78929. }
  78930. if (!media.endList) {
  78931. const seekable3 = this.seekable();
  78932. if (!seekable3.length) {
  78933. return false;
  78934. }
  78935. if (videojs$2.browser.IE_VERSION && this.tech_.readyState() === 0) {
  78936. this.tech_.one("loadedmetadata", () => {
  78937. this.trigger("firstplay");
  78938. this.tech_.setCurrentTime(seekable3.end(0));
  78939. this.hasPlayed_ = true;
  78940. });
  78941. return false;
  78942. }
  78943. this.trigger("firstplay");
  78944. this.tech_.setCurrentTime(seekable3.end(0));
  78945. }
  78946. this.hasPlayed_ = true;
  78947. this.load();
  78948. return true;
  78949. }
  78950. handleSourceOpen_() {
  78951. this.tryToCreateSourceBuffers_();
  78952. if (this.tech_.autoplay()) {
  78953. const playPromise = this.tech_.play();
  78954. if (typeof playPromise !== "undefined" && typeof playPromise.then === "function") {
  78955. playPromise.then(null, (e) => {
  78956. });
  78957. }
  78958. }
  78959. this.trigger("sourceopen");
  78960. }
  78961. handleSourceEnded_() {
  78962. if (!this.inbandTextTracks_.metadataTrack_) {
  78963. return;
  78964. }
  78965. const cues = this.inbandTextTracks_.metadataTrack_.cues;
  78966. if (!cues || !cues.length) {
  78967. return;
  78968. }
  78969. const duration5 = this.duration();
  78970. cues[cues.length - 1].endTime = isNaN(duration5) || Math.abs(duration5) === Infinity ? Number.MAX_VALUE : duration5;
  78971. }
  78972. handleDurationChange_() {
  78973. this.tech_.trigger("durationchange");
  78974. }
  78975. onEndOfStream() {
  78976. let isEndOfStream = this.mainSegmentLoader_.ended_;
  78977. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  78978. const mainMediaInfo = this.mainSegmentLoader_.getCurrentMediaInfo_();
  78979. if (!mainMediaInfo || mainMediaInfo.hasVideo) {
  78980. isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_;
  78981. } else {
  78982. isEndOfStream = this.audioSegmentLoader_.ended_;
  78983. }
  78984. }
  78985. if (!isEndOfStream) {
  78986. return;
  78987. }
  78988. this.stopABRTimer_();
  78989. this.sourceUpdater_.endOfStream();
  78990. }
  78991. stuckAtPlaylistEnd_(playlist) {
  78992. const seekable3 = this.seekable();
  78993. if (!seekable3.length) {
  78994. return false;
  78995. }
  78996. const expired = this.syncController_.getExpiredTime(playlist, this.duration());
  78997. if (expired === null) {
  78998. return false;
  78999. }
  79000. const absolutePlaylistEnd = Vhs$1$1.Playlist.playlistEnd(playlist, expired);
  79001. const currentTime = this.tech_.currentTime();
  79002. const buffered = this.tech_.buffered();
  79003. if (!buffered.length) {
  79004. return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA$1;
  79005. }
  79006. const bufferedEnd = buffered.end(buffered.length - 1);
  79007. return bufferedEnd - currentTime <= SAFE_TIME_DELTA$1 && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA$1;
  79008. }
  79009. excludePlaylist({
  79010. playlistToExclude = this.mainPlaylistLoader_.media(),
  79011. error = {},
  79012. playlistExclusionDuration
  79013. }) {
  79014. playlistToExclude = playlistToExclude || this.mainPlaylistLoader_.media();
  79015. playlistExclusionDuration = playlistExclusionDuration || error.playlistExclusionDuration || this.playlistExclusionDuration;
  79016. if (!playlistToExclude) {
  79017. this.error = error;
  79018. if (this.mediaSource.readyState !== "open") {
  79019. this.trigger("error");
  79020. } else {
  79021. this.sourceUpdater_.endOfStream("network");
  79022. }
  79023. return;
  79024. }
  79025. playlistToExclude.playlistErrors_++;
  79026. const playlists = this.mainPlaylistLoader_.main.playlists;
  79027. const enabledPlaylists = playlists.filter(isEnabled$1);
  79028. const isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === playlistToExclude;
  79029. if (playlists.length === 1 && playlistExclusionDuration !== Infinity) {
  79030. videojs$2.log.warn(`Problem encountered with playlist ${playlistToExclude.id}. Trying again since it is the only playlist.`);
  79031. this.tech_.trigger("retryplaylist");
  79032. return this.mainPlaylistLoader_.load(isFinalRendition);
  79033. }
  79034. if (isFinalRendition) {
  79035. let reincluded = false;
  79036. playlists.forEach((playlist) => {
  79037. if (playlist === playlistToExclude) {
  79038. return;
  79039. }
  79040. const excludeUntil2 = playlist.excludeUntil;
  79041. if (typeof excludeUntil2 !== "undefined" && excludeUntil2 !== Infinity) {
  79042. reincluded = true;
  79043. delete playlist.excludeUntil;
  79044. }
  79045. });
  79046. if (reincluded) {
  79047. videojs$2.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded.");
  79048. this.tech_.trigger("retryplaylist");
  79049. }
  79050. }
  79051. let excludeUntil;
  79052. if (playlistToExclude.playlistErrors_ > this.maxPlaylistRetries) {
  79053. excludeUntil = Infinity;
  79054. } else {
  79055. excludeUntil = Date.now() + playlistExclusionDuration * 1e3;
  79056. }
  79057. playlistToExclude.excludeUntil = excludeUntil;
  79058. if (error.reason) {
  79059. playlistToExclude.lastExcludeReason_ = error.reason;
  79060. }
  79061. this.tech_.trigger("excludeplaylist");
  79062. this.tech_.trigger({
  79063. type: "usage",
  79064. name: "vhs-rendition-excluded"
  79065. });
  79066. const nextPlaylist = this.selectPlaylist();
  79067. if (!nextPlaylist) {
  79068. this.error = "Playback cannot continue. No available working or supported playlists.";
  79069. this.trigger("error");
  79070. return;
  79071. }
  79072. const logFn2 = error.internal ? this.logger_ : videojs$2.log.warn;
  79073. const errorMessage = error.message ? " " + error.message : "";
  79074. logFn2(`${error.internal ? "Internal problem" : "Problem"} encountered with playlist ${playlistToExclude.id}.${errorMessage} Switching to playlist ${nextPlaylist.id}.`);
  79075. if (nextPlaylist.attributes.AUDIO !== playlistToExclude.attributes.AUDIO) {
  79076. this.delegateLoaders_("audio", ["abort", "pause"]);
  79077. }
  79078. if (nextPlaylist.attributes.SUBTITLES !== playlistToExclude.attributes.SUBTITLES) {
  79079. this.delegateLoaders_("subtitle", ["abort", "pause"]);
  79080. }
  79081. this.delegateLoaders_("main", ["abort", "pause"]);
  79082. const delayDuration = nextPlaylist.targetDuration / 2 * 1e3 || 5 * 1e3;
  79083. const shouldDelay = typeof nextPlaylist.lastRequest === "number" && Date.now() - nextPlaylist.lastRequest <= delayDuration;
  79084. return this.switchMedia_(nextPlaylist, "exclude", isFinalRendition || shouldDelay);
  79085. }
  79086. pauseLoading() {
  79087. this.delegateLoaders_("all", ["abort", "pause"]);
  79088. this.stopABRTimer_();
  79089. }
  79090. delegateLoaders_(filter, fnNames) {
  79091. const loaders = [];
  79092. const dontFilterPlaylist = filter === "all";
  79093. if (dontFilterPlaylist || filter === "main") {
  79094. loaders.push(this.mainPlaylistLoader_);
  79095. }
  79096. const mediaTypes2 = [];
  79097. if (dontFilterPlaylist || filter === "audio") {
  79098. mediaTypes2.push("AUDIO");
  79099. }
  79100. if (dontFilterPlaylist || filter === "subtitle") {
  79101. mediaTypes2.push("CLOSED-CAPTIONS");
  79102. mediaTypes2.push("SUBTITLES");
  79103. }
  79104. mediaTypes2.forEach((mediaType) => {
  79105. const loader = this.mediaTypes_[mediaType] && this.mediaTypes_[mediaType].activePlaylistLoader;
  79106. if (loader) {
  79107. loaders.push(loader);
  79108. }
  79109. });
  79110. ["main", "audio", "subtitle"].forEach((name) => {
  79111. const loader = this[`${name}SegmentLoader_`];
  79112. if (loader && (filter === name || filter === "all")) {
  79113. loaders.push(loader);
  79114. }
  79115. });
  79116. loaders.forEach((loader) => fnNames.forEach((fnName) => {
  79117. if (typeof loader[fnName] === "function") {
  79118. loader[fnName]();
  79119. }
  79120. }));
  79121. }
  79122. setCurrentTime(currentTime) {
  79123. const buffered = findRange$1(this.tech_.buffered(), currentTime);
  79124. if (!(this.mainPlaylistLoader_ && this.mainPlaylistLoader_.media())) {
  79125. return 0;
  79126. }
  79127. if (!this.mainPlaylistLoader_.media().segments) {
  79128. return 0;
  79129. }
  79130. if (buffered && buffered.length) {
  79131. return currentTime;
  79132. }
  79133. this.mainSegmentLoader_.resetEverything();
  79134. this.mainSegmentLoader_.abort();
  79135. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  79136. this.audioSegmentLoader_.resetEverything();
  79137. this.audioSegmentLoader_.abort();
  79138. }
  79139. if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
  79140. this.subtitleSegmentLoader_.resetEverything();
  79141. this.subtitleSegmentLoader_.abort();
  79142. }
  79143. this.load();
  79144. }
  79145. duration() {
  79146. if (!this.mainPlaylistLoader_) {
  79147. return 0;
  79148. }
  79149. const media = this.mainPlaylistLoader_.media();
  79150. if (!media) {
  79151. return 0;
  79152. }
  79153. if (!media.endList) {
  79154. return Infinity;
  79155. }
  79156. if (this.mediaSource) {
  79157. return this.mediaSource.duration;
  79158. }
  79159. return Vhs$1$1.Playlist.duration(media);
  79160. }
  79161. seekable() {
  79162. return this.seekable_;
  79163. }
  79164. onSyncInfoUpdate_() {
  79165. let audioSeekable;
  79166. if (!this.mainPlaylistLoader_) {
  79167. return;
  79168. }
  79169. let media = this.mainPlaylistLoader_.media();
  79170. if (!media) {
  79171. return;
  79172. }
  79173. let expired = this.syncController_.getExpiredTime(media, this.duration());
  79174. if (expired === null) {
  79175. return;
  79176. }
  79177. const main = this.mainPlaylistLoader_.main;
  79178. const mainSeekable = Vhs$1$1.Playlist.seekable(media, expired, Vhs$1$1.Playlist.liveEdgeDelay(main, media));
  79179. if (mainSeekable.length === 0) {
  79180. return;
  79181. }
  79182. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  79183. media = this.mediaTypes_.AUDIO.activePlaylistLoader.media();
  79184. expired = this.syncController_.getExpiredTime(media, this.duration());
  79185. if (expired === null) {
  79186. return;
  79187. }
  79188. audioSeekable = Vhs$1$1.Playlist.seekable(media, expired, Vhs$1$1.Playlist.liveEdgeDelay(main, media));
  79189. if (audioSeekable.length === 0) {
  79190. return;
  79191. }
  79192. }
  79193. let oldEnd;
  79194. let oldStart;
  79195. if (this.seekable_ && this.seekable_.length) {
  79196. oldEnd = this.seekable_.end(0);
  79197. oldStart = this.seekable_.start(0);
  79198. }
  79199. if (!audioSeekable) {
  79200. this.seekable_ = mainSeekable;
  79201. } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) {
  79202. this.seekable_ = mainSeekable;
  79203. } else {
  79204. this.seekable_ = createTimeRanges$2([[audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0)]]);
  79205. }
  79206. if (this.seekable_ && this.seekable_.length) {
  79207. if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) {
  79208. return;
  79209. }
  79210. }
  79211. this.logger_(`seekable updated [${printableRange$1(this.seekable_)}]`);
  79212. this.tech_.trigger("seekablechanged");
  79213. }
  79214. updateDuration(isLive) {
  79215. if (this.updateDuration_) {
  79216. this.mediaSource.removeEventListener("sourceopen", this.updateDuration_);
  79217. this.updateDuration_ = null;
  79218. }
  79219. if (this.mediaSource.readyState !== "open") {
  79220. this.updateDuration_ = this.updateDuration.bind(this, isLive);
  79221. this.mediaSource.addEventListener("sourceopen", this.updateDuration_);
  79222. return;
  79223. }
  79224. if (isLive) {
  79225. const seekable3 = this.seekable();
  79226. if (!seekable3.length) {
  79227. return;
  79228. }
  79229. if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable3.end(seekable3.length - 1)) {
  79230. this.sourceUpdater_.setDuration(seekable3.end(seekable3.length - 1));
  79231. }
  79232. return;
  79233. }
  79234. const buffered = this.tech_.buffered();
  79235. let duration5 = Vhs$1$1.Playlist.duration(this.mainPlaylistLoader_.media());
  79236. if (buffered.length > 0) {
  79237. duration5 = Math.max(duration5, buffered.end(buffered.length - 1));
  79238. }
  79239. if (this.mediaSource.duration !== duration5) {
  79240. this.sourceUpdater_.setDuration(duration5);
  79241. }
  79242. }
  79243. dispose() {
  79244. this.trigger("dispose");
  79245. this.decrypter_.terminate();
  79246. this.mainPlaylistLoader_.dispose();
  79247. this.mainSegmentLoader_.dispose();
  79248. if (this.loadOnPlay_) {
  79249. this.tech_.off("play", this.loadOnPlay_);
  79250. }
  79251. ["AUDIO", "SUBTITLES"].forEach((type2) => {
  79252. const groups = this.mediaTypes_[type2].groups;
  79253. for (const id in groups) {
  79254. groups[id].forEach((group) => {
  79255. if (group.playlistLoader) {
  79256. group.playlistLoader.dispose();
  79257. }
  79258. });
  79259. }
  79260. });
  79261. this.audioSegmentLoader_.dispose();
  79262. this.subtitleSegmentLoader_.dispose();
  79263. this.sourceUpdater_.dispose();
  79264. this.timelineChangeController_.dispose();
  79265. this.stopABRTimer_();
  79266. if (this.updateDuration_) {
  79267. this.mediaSource.removeEventListener("sourceopen", this.updateDuration_);
  79268. }
  79269. this.mediaSource.removeEventListener("durationchange", this.handleDurationChange_);
  79270. this.mediaSource.removeEventListener("sourceopen", this.handleSourceOpen_);
  79271. this.mediaSource.removeEventListener("sourceended", this.handleSourceEnded_);
  79272. this.off();
  79273. }
  79274. main() {
  79275. return this.mainPlaylistLoader_.main;
  79276. }
  79277. media() {
  79278. return this.mainPlaylistLoader_.media() || this.initialMedia_;
  79279. }
  79280. areMediaTypesKnown_() {
  79281. const usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
  79282. const hasMainMediaInfo = !!this.mainSegmentLoader_.getCurrentMediaInfo_();
  79283. const hasAudioMediaInfo = !usingAudioLoader ? true : !!this.audioSegmentLoader_.getCurrentMediaInfo_();
  79284. if (!hasMainMediaInfo || !hasAudioMediaInfo) {
  79285. return false;
  79286. }
  79287. return true;
  79288. }
  79289. getCodecsOrExclude_() {
  79290. const media = {
  79291. main: this.mainSegmentLoader_.getCurrentMediaInfo_() || {},
  79292. audio: this.audioSegmentLoader_.getCurrentMediaInfo_() || {}
  79293. };
  79294. const playlist = this.mainSegmentLoader_.getPendingSegmentPlaylist() || this.media();
  79295. media.video = media.main;
  79296. const playlistCodecs = codecsForPlaylist$1(this.main(), playlist);
  79297. const codecs = {};
  79298. const usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
  79299. if (media.main.hasVideo) {
  79300. codecs.video = playlistCodecs.video || media.main.videoCodec || DEFAULT_VIDEO_CODEC$1;
  79301. }
  79302. if (media.main.isMuxed) {
  79303. codecs.video += `,${playlistCodecs.audio || media.main.audioCodec || DEFAULT_AUDIO_CODEC$1}`;
  79304. }
  79305. if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) {
  79306. codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || DEFAULT_AUDIO_CODEC$1;
  79307. media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4;
  79308. }
  79309. if (!codecs.audio && !codecs.video) {
  79310. this.excludePlaylist({
  79311. playlistToExclude: playlist,
  79312. error: {
  79313. message: "Could not determine codecs for playlist."
  79314. },
  79315. playlistExclusionDuration: Infinity
  79316. });
  79317. return;
  79318. }
  79319. const supportFunction = (isFmp4, codec) => isFmp4 ? browserSupportsCodec$1(codec) : muxerSupportsCodec$1(codec);
  79320. const unsupportedCodecs = {};
  79321. let unsupportedAudio;
  79322. ["video", "audio"].forEach(function(type2) {
  79323. if (codecs.hasOwnProperty(type2) && !supportFunction(media[type2].isFmp4, codecs[type2])) {
  79324. const supporter = media[type2].isFmp4 ? "browser" : "muxer";
  79325. unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || [];
  79326. unsupportedCodecs[supporter].push(codecs[type2]);
  79327. if (type2 === "audio") {
  79328. unsupportedAudio = supporter;
  79329. }
  79330. }
  79331. });
  79332. if (usingAudioLoader && unsupportedAudio && playlist.attributes.AUDIO) {
  79333. const audioGroup = playlist.attributes.AUDIO;
  79334. this.main().playlists.forEach((variant) => {
  79335. const variantAudioGroup = variant.attributes && variant.attributes.AUDIO;
  79336. if (variantAudioGroup === audioGroup && variant !== playlist) {
  79337. variant.excludeUntil = Infinity;
  79338. }
  79339. });
  79340. this.logger_(`excluding audio group ${audioGroup} as ${unsupportedAudio} does not support codec(s): "${codecs.audio}"`);
  79341. }
  79342. if (Object.keys(unsupportedCodecs).length) {
  79343. const message = Object.keys(unsupportedCodecs).reduce((acc, supporter) => {
  79344. if (acc) {
  79345. acc += ", ";
  79346. }
  79347. acc += `${supporter} does not support codec(s): "${unsupportedCodecs[supporter].join(",")}"`;
  79348. return acc;
  79349. }, "") + ".";
  79350. this.excludePlaylist({
  79351. playlistToExclude: playlist,
  79352. error: {
  79353. internal: true,
  79354. message
  79355. },
  79356. playlistExclusionDuration: Infinity
  79357. });
  79358. return;
  79359. }
  79360. if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) {
  79361. const switchMessages = [];
  79362. ["video", "audio"].forEach((type2) => {
  79363. const newCodec = (parseCodecs$1(this.sourceUpdater_.codecs[type2] || "")[0] || {}).type;
  79364. const oldCodec = (parseCodecs$1(codecs[type2] || "")[0] || {}).type;
  79365. if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) {
  79366. switchMessages.push(`"${this.sourceUpdater_.codecs[type2]}" -> "${codecs[type2]}"`);
  79367. }
  79368. });
  79369. if (switchMessages.length) {
  79370. this.excludePlaylist({
  79371. playlistToExclude: playlist,
  79372. error: {
  79373. message: `Codec switching not supported: ${switchMessages.join(", ")}.`,
  79374. internal: true
  79375. },
  79376. playlistExclusionDuration: Infinity
  79377. });
  79378. return;
  79379. }
  79380. }
  79381. return codecs;
  79382. }
  79383. tryToCreateSourceBuffers_() {
  79384. if (this.mediaSource.readyState !== "open" || this.sourceUpdater_.hasCreatedSourceBuffers()) {
  79385. return;
  79386. }
  79387. if (!this.areMediaTypesKnown_()) {
  79388. return;
  79389. }
  79390. const codecs = this.getCodecsOrExclude_();
  79391. if (!codecs) {
  79392. return;
  79393. }
  79394. this.sourceUpdater_.createSourceBuffers(codecs);
  79395. const codecString = [codecs.video, codecs.audio].filter(Boolean).join(",");
  79396. this.excludeIncompatibleVariants_(codecString);
  79397. }
  79398. excludeUnsupportedVariants_() {
  79399. const playlists = this.main().playlists;
  79400. const ids = [];
  79401. Object.keys(playlists).forEach((key) => {
  79402. const variant = playlists[key];
  79403. if (ids.indexOf(variant.id) !== -1) {
  79404. return;
  79405. }
  79406. ids.push(variant.id);
  79407. const codecs = codecsForPlaylist$1(this.main, variant);
  79408. const unsupported = [];
  79409. if (codecs.audio && !muxerSupportsCodec$1(codecs.audio) && !browserSupportsCodec$1(codecs.audio)) {
  79410. unsupported.push(`audio codec ${codecs.audio}`);
  79411. }
  79412. if (codecs.video && !muxerSupportsCodec$1(codecs.video) && !browserSupportsCodec$1(codecs.video)) {
  79413. unsupported.push(`video codec ${codecs.video}`);
  79414. }
  79415. if (codecs.text && codecs.text === "stpp.ttml.im1t") {
  79416. unsupported.push(`text codec ${codecs.text}`);
  79417. }
  79418. if (unsupported.length) {
  79419. variant.excludeUntil = Infinity;
  79420. this.logger_(`excluding ${variant.id} for unsupported: ${unsupported.join(", ")}`);
  79421. }
  79422. });
  79423. }
  79424. excludeIncompatibleVariants_(codecString) {
  79425. const ids = [];
  79426. const playlists = this.main().playlists;
  79427. const codecs = unwrapCodecList$1(parseCodecs$1(codecString));
  79428. const codecCount_ = codecCount$1(codecs);
  79429. const videoDetails = codecs.video && parseCodecs$1(codecs.video)[0] || null;
  79430. const audioDetails = codecs.audio && parseCodecs$1(codecs.audio)[0] || null;
  79431. Object.keys(playlists).forEach((key) => {
  79432. const variant = playlists[key];
  79433. if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) {
  79434. return;
  79435. }
  79436. ids.push(variant.id);
  79437. const exclusionReasons = [];
  79438. const variantCodecs = codecsForPlaylist$1(this.mainPlaylistLoader_.main, variant);
  79439. const variantCodecCount = codecCount$1(variantCodecs);
  79440. if (!variantCodecs.audio && !variantCodecs.video) {
  79441. return;
  79442. }
  79443. if (variantCodecCount !== codecCount_) {
  79444. exclusionReasons.push(`codec count "${variantCodecCount}" !== "${codecCount_}"`);
  79445. }
  79446. if (!this.sourceUpdater_.canChangeType()) {
  79447. const variantVideoDetails = variantCodecs.video && parseCodecs$1(variantCodecs.video)[0] || null;
  79448. const variantAudioDetails = variantCodecs.audio && parseCodecs$1(variantCodecs.audio)[0] || null;
  79449. if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) {
  79450. exclusionReasons.push(`video codec "${variantVideoDetails.type}" !== "${videoDetails.type}"`);
  79451. }
  79452. if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) {
  79453. exclusionReasons.push(`audio codec "${variantAudioDetails.type}" !== "${audioDetails.type}"`);
  79454. }
  79455. }
  79456. if (exclusionReasons.length) {
  79457. variant.excludeUntil = Infinity;
  79458. this.logger_(`excluding ${variant.id}: ${exclusionReasons.join(" && ")}`);
  79459. }
  79460. });
  79461. }
  79462. updateAdCues_(media) {
  79463. let offset = 0;
  79464. const seekable3 = this.seekable();
  79465. if (seekable3.length) {
  79466. offset = seekable3.start(0);
  79467. }
  79468. updateAdCues$1(media, this.cueTagsTrack_, offset);
  79469. }
  79470. goalBufferLength() {
  79471. const currentTime = this.tech_.currentTime();
  79472. const initial = Config$1.GOAL_BUFFER_LENGTH;
  79473. const rate = Config$1.GOAL_BUFFER_LENGTH_RATE;
  79474. const max2 = Math.max(initial, Config$1.MAX_GOAL_BUFFER_LENGTH);
  79475. return Math.min(initial + currentTime * rate, max2);
  79476. }
  79477. bufferLowWaterLine() {
  79478. const currentTime = this.tech_.currentTime();
  79479. const initial = Config$1.BUFFER_LOW_WATER_LINE;
  79480. const rate = Config$1.BUFFER_LOW_WATER_LINE_RATE;
  79481. const max2 = Math.max(initial, Config$1.MAX_BUFFER_LOW_WATER_LINE);
  79482. const newMax = Math.max(initial, Config$1.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);
  79483. return Math.min(initial + currentTime * rate, this.bufferBasedABR ? newMax : max2);
  79484. }
  79485. bufferHighWaterLine() {
  79486. return Config$1.BUFFER_HIGH_WATER_LINE;
  79487. }
  79488. }
  79489. const enableFunction$1 = (loader, playlistID, changePlaylistFn) => (enable) => {
  79490. const playlist = loader.main.playlists[playlistID];
  79491. const incompatible = isIncompatible$1(playlist);
  79492. const currentlyEnabled = isEnabled$1(playlist);
  79493. if (typeof enable === "undefined") {
  79494. return currentlyEnabled;
  79495. }
  79496. if (enable) {
  79497. delete playlist.disabled;
  79498. } else {
  79499. playlist.disabled = true;
  79500. }
  79501. if (enable !== currentlyEnabled && !incompatible) {
  79502. changePlaylistFn();
  79503. if (enable) {
  79504. loader.trigger("renditionenabled");
  79505. } else {
  79506. loader.trigger("renditiondisabled");
  79507. }
  79508. }
  79509. return enable;
  79510. };
  79511. class Representation$1 {
  79512. constructor(vhsHandler, playlist, id) {
  79513. const {
  79514. playlistController_: pc
  79515. } = vhsHandler;
  79516. const qualityChangeFunction = pc.fastQualityChange_.bind(pc);
  79517. if (playlist.attributes) {
  79518. const resolution = playlist.attributes.RESOLUTION;
  79519. this.width = resolution && resolution.width;
  79520. this.height = resolution && resolution.height;
  79521. this.bandwidth = playlist.attributes.BANDWIDTH;
  79522. this.frameRate = playlist.attributes["FRAME-RATE"];
  79523. }
  79524. this.codecs = codecsForPlaylist$1(pc.main(), playlist);
  79525. this.playlist = playlist;
  79526. this.id = id;
  79527. this.enabled = enableFunction$1(vhsHandler.playlists, playlist.id, qualityChangeFunction);
  79528. }
  79529. }
  79530. const renditionSelectionMixin$1 = function(vhsHandler) {
  79531. vhsHandler.representations = () => {
  79532. const main = vhsHandler.playlistController_.main();
  79533. const playlists = isAudioOnly$1(main) ? vhsHandler.playlistController_.getAudioTrackPlaylists_() : main.playlists;
  79534. if (!playlists) {
  79535. return [];
  79536. }
  79537. return playlists.filter((media) => !isIncompatible$1(media)).map((e, i2) => new Representation$1(vhsHandler, e, e.id));
  79538. };
  79539. };
  79540. const timerCancelEvents$1 = ["seeking", "seeked", "pause", "playing", "error"];
  79541. class PlaybackWatcher$1 {
  79542. constructor(options2) {
  79543. this.playlistController_ = options2.playlistController;
  79544. this.tech_ = options2.tech;
  79545. this.seekable = options2.seekable;
  79546. this.allowSeeksWithinUnsafeLiveWindow = options2.allowSeeksWithinUnsafeLiveWindow;
  79547. this.liveRangeSafeTimeDelta = options2.liveRangeSafeTimeDelta;
  79548. this.media = options2.media;
  79549. this.consecutiveUpdates = 0;
  79550. this.lastRecordedTime = null;
  79551. this.checkCurrentTimeTimeout_ = null;
  79552. this.logger_ = logger$1("PlaybackWatcher");
  79553. this.logger_("initialize");
  79554. const playHandler = () => this.monitorCurrentTime_();
  79555. const canPlayHandler = () => this.monitorCurrentTime_();
  79556. const waitingHandler = () => this.techWaiting_();
  79557. const cancelTimerHandler = () => this.resetTimeUpdate_();
  79558. const pc = this.playlistController_;
  79559. const loaderTypes = ["main", "subtitle", "audio"];
  79560. const loaderChecks = {};
  79561. loaderTypes.forEach((type2) => {
  79562. loaderChecks[type2] = {
  79563. reset: () => this.resetSegmentDownloads_(type2),
  79564. updateend: () => this.checkSegmentDownloads_(type2)
  79565. };
  79566. pc[`${type2}SegmentLoader_`].on("appendsdone", loaderChecks[type2].updateend);
  79567. pc[`${type2}SegmentLoader_`].on("playlistupdate", loaderChecks[type2].reset);
  79568. this.tech_.on(["seeked", "seeking"], loaderChecks[type2].reset);
  79569. });
  79570. const setSeekingHandlers = (fn2) => {
  79571. ["main", "audio"].forEach((type2) => {
  79572. pc[`${type2}SegmentLoader_`][fn2]("appended", this.seekingAppendCheck_);
  79573. });
  79574. };
  79575. this.seekingAppendCheck_ = () => {
  79576. if (this.fixesBadSeeks_()) {
  79577. this.consecutiveUpdates = 0;
  79578. this.lastRecordedTime = this.tech_.currentTime();
  79579. setSeekingHandlers("off");
  79580. }
  79581. };
  79582. this.clearSeekingAppendCheck_ = () => setSeekingHandlers("off");
  79583. this.watchForBadSeeking_ = () => {
  79584. this.clearSeekingAppendCheck_();
  79585. setSeekingHandlers("on");
  79586. };
  79587. this.tech_.on("seeked", this.clearSeekingAppendCheck_);
  79588. this.tech_.on("seeking", this.watchForBadSeeking_);
  79589. this.tech_.on("waiting", waitingHandler);
  79590. this.tech_.on(timerCancelEvents$1, cancelTimerHandler);
  79591. this.tech_.on("canplay", canPlayHandler);
  79592. this.tech_.one("play", playHandler);
  79593. this.dispose = () => {
  79594. this.clearSeekingAppendCheck_();
  79595. this.logger_("dispose");
  79596. this.tech_.off("waiting", waitingHandler);
  79597. this.tech_.off(timerCancelEvents$1, cancelTimerHandler);
  79598. this.tech_.off("canplay", canPlayHandler);
  79599. this.tech_.off("play", playHandler);
  79600. this.tech_.off("seeking", this.watchForBadSeeking_);
  79601. this.tech_.off("seeked", this.clearSeekingAppendCheck_);
  79602. loaderTypes.forEach((type2) => {
  79603. pc[`${type2}SegmentLoader_`].off("appendsdone", loaderChecks[type2].updateend);
  79604. pc[`${type2}SegmentLoader_`].off("playlistupdate", loaderChecks[type2].reset);
  79605. this.tech_.off(["seeked", "seeking"], loaderChecks[type2].reset);
  79606. });
  79607. if (this.checkCurrentTimeTimeout_) {
  79608. window_1.clearTimeout(this.checkCurrentTimeTimeout_);
  79609. }
  79610. this.resetTimeUpdate_();
  79611. };
  79612. }
  79613. monitorCurrentTime_() {
  79614. this.checkCurrentTime_();
  79615. if (this.checkCurrentTimeTimeout_) {
  79616. window_1.clearTimeout(this.checkCurrentTimeTimeout_);
  79617. }
  79618. this.checkCurrentTimeTimeout_ = window_1.setTimeout(this.monitorCurrentTime_.bind(this), 250);
  79619. }
  79620. resetSegmentDownloads_(type2) {
  79621. const loader = this.playlistController_[`${type2}SegmentLoader_`];
  79622. if (this[`${type2}StalledDownloads_`] > 0) {
  79623. this.logger_(`resetting possible stalled download count for ${type2} loader`);
  79624. }
  79625. this[`${type2}StalledDownloads_`] = 0;
  79626. this[`${type2}Buffered_`] = loader.buffered_();
  79627. }
  79628. checkSegmentDownloads_(type2) {
  79629. const pc = this.playlistController_;
  79630. const loader = pc[`${type2}SegmentLoader_`];
  79631. const buffered = loader.buffered_();
  79632. const isBufferedDifferent = isRangeDifferent$1(this[`${type2}Buffered_`], buffered);
  79633. this[`${type2}Buffered_`] = buffered;
  79634. if (isBufferedDifferent) {
  79635. this.resetSegmentDownloads_(type2);
  79636. return;
  79637. }
  79638. this[`${type2}StalledDownloads_`]++;
  79639. this.logger_(`found #${this[`${type2}StalledDownloads_`]} ${type2} appends that did not increase buffer (possible stalled download)`, {
  79640. playlistId: loader.playlist_ && loader.playlist_.id,
  79641. buffered: timeRangesToArray$1(buffered)
  79642. });
  79643. if (this[`${type2}StalledDownloads_`] < 10) {
  79644. return;
  79645. }
  79646. this.logger_(`${type2} loader stalled download exclusion`);
  79647. this.resetSegmentDownloads_(type2);
  79648. this.tech_.trigger({
  79649. type: "usage",
  79650. name: `vhs-${type2}-download-exclusion`
  79651. });
  79652. if (type2 === "subtitle") {
  79653. return;
  79654. }
  79655. pc.excludePlaylist({
  79656. error: {
  79657. message: `Excessive ${type2} segment downloading detected.`
  79658. },
  79659. playlistExclusionDuration: Infinity
  79660. });
  79661. }
  79662. checkCurrentTime_() {
  79663. if (this.tech_.paused() || this.tech_.seeking()) {
  79664. return;
  79665. }
  79666. const currentTime = this.tech_.currentTime();
  79667. const buffered = this.tech_.buffered();
  79668. if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA$1 >= buffered.end(buffered.length - 1))) {
  79669. return this.techWaiting_();
  79670. }
  79671. if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) {
  79672. this.consecutiveUpdates++;
  79673. this.waiting_();
  79674. } else if (currentTime === this.lastRecordedTime) {
  79675. this.consecutiveUpdates++;
  79676. } else {
  79677. this.consecutiveUpdates = 0;
  79678. this.lastRecordedTime = currentTime;
  79679. }
  79680. }
  79681. resetTimeUpdate_() {
  79682. this.consecutiveUpdates = 0;
  79683. }
  79684. fixesBadSeeks_() {
  79685. const seeking = this.tech_.seeking();
  79686. if (!seeking) {
  79687. return false;
  79688. }
  79689. const seekable3 = this.seekable();
  79690. const currentTime = this.tech_.currentTime();
  79691. const isAfterSeekableRange = this.afterSeekableWindow_(seekable3, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow);
  79692. let seekTo;
  79693. if (isAfterSeekableRange) {
  79694. const seekableEnd = seekable3.end(seekable3.length - 1);
  79695. seekTo = seekableEnd;
  79696. }
  79697. if (this.beforeSeekableWindow_(seekable3, currentTime)) {
  79698. const seekableStart = seekable3.start(0);
  79699. seekTo = seekableStart + (seekableStart === seekable3.end(0) ? 0 : SAFE_TIME_DELTA$1);
  79700. }
  79701. if (typeof seekTo !== "undefined") {
  79702. this.logger_(`Trying to seek outside of seekable at time ${currentTime} with seekable range ${printableRange$1(seekable3)}. Seeking to ${seekTo}.`);
  79703. this.tech_.setCurrentTime(seekTo);
  79704. return true;
  79705. }
  79706. const sourceUpdater = this.playlistController_.sourceUpdater_;
  79707. const buffered = this.tech_.buffered();
  79708. const audioBuffered = sourceUpdater.audioBuffer ? sourceUpdater.audioBuffered() : null;
  79709. const videoBuffered = sourceUpdater.videoBuffer ? sourceUpdater.videoBuffered() : null;
  79710. const media = this.media();
  79711. const minAppendedDuration = media.partTargetDuration ? media.partTargetDuration : (media.targetDuration - TIME_FUDGE_FACTOR$1) * 2;
  79712. const bufferedToCheck = [audioBuffered, videoBuffered];
  79713. for (let i2 = 0; i2 < bufferedToCheck.length; i2++) {
  79714. if (!bufferedToCheck[i2]) {
  79715. continue;
  79716. }
  79717. const timeAhead = timeAheadOf$1(bufferedToCheck[i2], currentTime);
  79718. if (timeAhead < minAppendedDuration) {
  79719. return false;
  79720. }
  79721. }
  79722. const nextRange = findNextRange$1(buffered, currentTime);
  79723. if (nextRange.length === 0) {
  79724. return false;
  79725. }
  79726. seekTo = nextRange.start(0) + SAFE_TIME_DELTA$1;
  79727. this.logger_(`Buffered region starts (${nextRange.start(0)}) just beyond seek point (${currentTime}). Seeking to ${seekTo}.`);
  79728. this.tech_.setCurrentTime(seekTo);
  79729. return true;
  79730. }
  79731. waiting_() {
  79732. if (this.techWaiting_()) {
  79733. return;
  79734. }
  79735. const currentTime = this.tech_.currentTime();
  79736. const buffered = this.tech_.buffered();
  79737. const currentRange = findRange$1(buffered, currentTime);
  79738. if (currentRange.length && currentTime + 3 <= currentRange.end(0)) {
  79739. this.resetTimeUpdate_();
  79740. this.tech_.setCurrentTime(currentTime);
  79741. this.logger_(`Stopped at ${currentTime} while inside a buffered region [${currentRange.start(0)} -> ${currentRange.end(0)}]. Attempting to resume playback by seeking to the current time.`);
  79742. this.tech_.trigger({
  79743. type: "usage",
  79744. name: "vhs-unknown-waiting"
  79745. });
  79746. return;
  79747. }
  79748. }
  79749. techWaiting_() {
  79750. const seekable3 = this.seekable();
  79751. const currentTime = this.tech_.currentTime();
  79752. if (this.tech_.seeking()) {
  79753. return true;
  79754. }
  79755. if (this.beforeSeekableWindow_(seekable3, currentTime)) {
  79756. const livePoint = seekable3.end(seekable3.length - 1);
  79757. this.logger_(`Fell out of live window at time ${currentTime}. Seeking to live point (seekable end) ${livePoint}`);
  79758. this.resetTimeUpdate_();
  79759. this.tech_.setCurrentTime(livePoint);
  79760. this.tech_.trigger({
  79761. type: "usage",
  79762. name: "vhs-live-resync"
  79763. });
  79764. return true;
  79765. }
  79766. const sourceUpdater = this.tech_.vhs.playlistController_.sourceUpdater_;
  79767. const buffered = this.tech_.buffered();
  79768. const videoUnderflow = this.videoUnderflow_({
  79769. audioBuffered: sourceUpdater.audioBuffered(),
  79770. videoBuffered: sourceUpdater.videoBuffered(),
  79771. currentTime
  79772. });
  79773. if (videoUnderflow) {
  79774. this.resetTimeUpdate_();
  79775. this.tech_.setCurrentTime(currentTime);
  79776. this.tech_.trigger({
  79777. type: "usage",
  79778. name: "vhs-video-underflow"
  79779. });
  79780. return true;
  79781. }
  79782. const nextRange = findNextRange$1(buffered, currentTime);
  79783. if (nextRange.length > 0) {
  79784. this.logger_(`Stopped at ${currentTime} and seeking to ${nextRange.start(0)}`);
  79785. this.resetTimeUpdate_();
  79786. this.skipTheGap_(currentTime);
  79787. return true;
  79788. }
  79789. return false;
  79790. }
  79791. afterSeekableWindow_(seekable3, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow = false) {
  79792. if (!seekable3.length) {
  79793. return false;
  79794. }
  79795. let allowedEnd = seekable3.end(seekable3.length - 1) + SAFE_TIME_DELTA$1;
  79796. const isLive = !playlist.endList;
  79797. if (isLive && allowSeeksWithinUnsafeLiveWindow) {
  79798. allowedEnd = seekable3.end(seekable3.length - 1) + playlist.targetDuration * 3;
  79799. }
  79800. if (currentTime > allowedEnd) {
  79801. return true;
  79802. }
  79803. return false;
  79804. }
  79805. beforeSeekableWindow_(seekable3, currentTime) {
  79806. if (seekable3.length && seekable3.start(0) > 0 && currentTime < seekable3.start(0) - this.liveRangeSafeTimeDelta) {
  79807. return true;
  79808. }
  79809. return false;
  79810. }
  79811. videoUnderflow_({
  79812. videoBuffered,
  79813. audioBuffered,
  79814. currentTime
  79815. }) {
  79816. if (!videoBuffered) {
  79817. return;
  79818. }
  79819. let gap;
  79820. if (videoBuffered.length && audioBuffered.length) {
  79821. const lastVideoRange = findRange$1(videoBuffered, currentTime - 3);
  79822. const videoRange = findRange$1(videoBuffered, currentTime);
  79823. const audioRange = findRange$1(audioBuffered, currentTime);
  79824. if (audioRange.length && !videoRange.length && lastVideoRange.length) {
  79825. gap = {
  79826. start: lastVideoRange.end(0),
  79827. end: audioRange.end(0)
  79828. };
  79829. }
  79830. } else {
  79831. const nextRange = findNextRange$1(videoBuffered, currentTime);
  79832. if (!nextRange.length) {
  79833. gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime);
  79834. }
  79835. }
  79836. if (gap) {
  79837. this.logger_(`Encountered a gap in video from ${gap.start} to ${gap.end}. Seeking to current time ${currentTime}`);
  79838. return true;
  79839. }
  79840. return false;
  79841. }
  79842. skipTheGap_(scheduledCurrentTime) {
  79843. const buffered = this.tech_.buffered();
  79844. const currentTime = this.tech_.currentTime();
  79845. const nextRange = findNextRange$1(buffered, currentTime);
  79846. this.resetTimeUpdate_();
  79847. if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) {
  79848. return;
  79849. }
  79850. this.logger_("skipTheGap_:", "currentTime:", currentTime, "scheduled currentTime:", scheduledCurrentTime, "nextRange start:", nextRange.start(0));
  79851. this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR$1);
  79852. this.tech_.trigger({
  79853. type: "usage",
  79854. name: "vhs-gap-skip"
  79855. });
  79856. }
  79857. gapFromVideoUnderflow_(buffered, currentTime) {
  79858. const gaps = findGaps$1(buffered);
  79859. for (let i2 = 0; i2 < gaps.length; i2++) {
  79860. const start2 = gaps.start(i2);
  79861. const end = gaps.end(i2);
  79862. if (currentTime - start2 < 4 && currentTime - start2 > 2) {
  79863. return {
  79864. start: start2,
  79865. end
  79866. };
  79867. }
  79868. }
  79869. return null;
  79870. }
  79871. }
  79872. const defaultOptions$1 = {
  79873. errorInterval: 30,
  79874. getSource(next) {
  79875. const tech = this.tech({
  79876. IWillNotUseThisInPlugins: true
  79877. });
  79878. const sourceObj = tech.currentSource_ || this.currentSource();
  79879. return next(sourceObj);
  79880. }
  79881. };
  79882. const initPlugin$2 = function(player, options2) {
  79883. let lastCalled = 0;
  79884. let seekTo = 0;
  79885. const localOptions = merge$2(defaultOptions$1, options2);
  79886. player.ready(() => {
  79887. player.trigger({
  79888. type: "usage",
  79889. name: "vhs-error-reload-initialized"
  79890. });
  79891. });
  79892. const loadedMetadataHandler = function() {
  79893. if (seekTo) {
  79894. player.currentTime(seekTo);
  79895. }
  79896. };
  79897. const setSource2 = function(sourceObj) {
  79898. if (sourceObj === null || sourceObj === void 0) {
  79899. return;
  79900. }
  79901. seekTo = player.duration() !== Infinity && player.currentTime() || 0;
  79902. player.one("loadedmetadata", loadedMetadataHandler);
  79903. player.src(sourceObj);
  79904. player.trigger({
  79905. type: "usage",
  79906. name: "vhs-error-reload"
  79907. });
  79908. player.play();
  79909. };
  79910. const errorHandler = function() {
  79911. if (Date.now() - lastCalled < localOptions.errorInterval * 1e3) {
  79912. player.trigger({
  79913. type: "usage",
  79914. name: "vhs-error-reload-canceled"
  79915. });
  79916. return;
  79917. }
  79918. if (!localOptions.getSource || typeof localOptions.getSource !== "function") {
  79919. videojs$2.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");
  79920. return;
  79921. }
  79922. lastCalled = Date.now();
  79923. return localOptions.getSource.call(player, setSource2);
  79924. };
  79925. const cleanupEvents = function() {
  79926. player.off("loadedmetadata", loadedMetadataHandler);
  79927. player.off("error", errorHandler);
  79928. player.off("dispose", cleanupEvents);
  79929. };
  79930. const reinitPlugin = function(newOptions) {
  79931. cleanupEvents();
  79932. initPlugin$2(player, newOptions);
  79933. };
  79934. player.on("error", errorHandler);
  79935. player.on("dispose", cleanupEvents);
  79936. player.reloadSourceOnError = reinitPlugin;
  79937. };
  79938. const reloadSourceOnError$1 = function(options2) {
  79939. initPlugin$2(this, options2);
  79940. };
  79941. var version$4$1 = "3.0.2";
  79942. var version$3$1 = "6.3.0";
  79943. var version$2$1 = "1.0.1";
  79944. var version$1$2 = "6.0.0";
  79945. var version$7 = "4.0.1";
  79946. const Vhs$2 = {
  79947. PlaylistLoader: PlaylistLoader$1,
  79948. Playlist: Playlist$1,
  79949. utils: utils$1,
  79950. STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector$1,
  79951. INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector$1,
  79952. lastBandwidthSelector: lastBandwidthSelector$1,
  79953. movingAverageBandwidthSelector: movingAverageBandwidthSelector$1,
  79954. comparePlaylistBandwidth: comparePlaylistBandwidth$1,
  79955. comparePlaylistResolution: comparePlaylistResolution$1,
  79956. xhr: xhrFactory$1()
  79957. };
  79958. Object.keys(Config$1).forEach((prop) => {
  79959. Object.defineProperty(Vhs$2, prop, {
  79960. get() {
  79961. videojs$2.log.warn(`using Vhs.${prop} is UNSAFE be sure you know what you are doing`);
  79962. return Config$1[prop];
  79963. },
  79964. set(value) {
  79965. videojs$2.log.warn(`using Vhs.${prop} is UNSAFE be sure you know what you are doing`);
  79966. if (typeof value !== "number" || value < 0) {
  79967. videojs$2.log.warn(`value of Vhs.${prop} must be greater than or equal to 0`);
  79968. return;
  79969. }
  79970. Config$1[prop] = value;
  79971. }
  79972. });
  79973. });
  79974. const LOCAL_STORAGE_KEY$2 = "videojs-vhs";
  79975. const handleVhsMediaChange$1 = function(qualityLevels2, playlistLoader) {
  79976. const newPlaylist = playlistLoader.media();
  79977. let selectedIndex = -1;
  79978. for (let i2 = 0; i2 < qualityLevels2.length; i2++) {
  79979. if (qualityLevels2[i2].id === newPlaylist.id) {
  79980. selectedIndex = i2;
  79981. break;
  79982. }
  79983. }
  79984. qualityLevels2.selectedIndex_ = selectedIndex;
  79985. qualityLevels2.trigger({
  79986. selectedIndex,
  79987. type: "change"
  79988. });
  79989. };
  79990. const handleVhsLoadedMetadata$1 = function(qualityLevels2, vhs) {
  79991. vhs.representations().forEach((rep2) => {
  79992. qualityLevels2.addQualityLevel(rep2);
  79993. });
  79994. handleVhsMediaChange$1(qualityLevels2, vhs.playlists);
  79995. };
  79996. Vhs$2.canPlaySource = function() {
  79997. return videojs$2.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.");
  79998. };
  79999. const emeKeySystems$1 = (keySystemOptions, mainPlaylist, audioPlaylist) => {
  80000. if (!keySystemOptions) {
  80001. return keySystemOptions;
  80002. }
  80003. let codecs = {};
  80004. if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) {
  80005. codecs = unwrapCodecList$1(parseCodecs$1(mainPlaylist.attributes.CODECS));
  80006. }
  80007. if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) {
  80008. codecs.audio = audioPlaylist.attributes.CODECS;
  80009. }
  80010. const videoContentType = getMimeForCodec$1(codecs.video);
  80011. const audioContentType = getMimeForCodec$1(codecs.audio);
  80012. const keySystemContentTypes = {};
  80013. for (const keySystem in keySystemOptions) {
  80014. keySystemContentTypes[keySystem] = {};
  80015. if (audioContentType) {
  80016. keySystemContentTypes[keySystem].audioContentType = audioContentType;
  80017. }
  80018. if (videoContentType) {
  80019. keySystemContentTypes[keySystem].videoContentType = videoContentType;
  80020. }
  80021. if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) {
  80022. keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh;
  80023. }
  80024. if (typeof keySystemOptions[keySystem] === "string") {
  80025. keySystemContentTypes[keySystem].url = keySystemOptions[keySystem];
  80026. }
  80027. }
  80028. return merge$2(keySystemOptions, keySystemContentTypes);
  80029. };
  80030. const getAllPsshKeySystemsOptions$1 = (playlists, keySystems) => {
  80031. return playlists.reduce((keySystemsArr, playlist) => {
  80032. if (!playlist.contentProtection) {
  80033. return keySystemsArr;
  80034. }
  80035. const keySystemsOptions = keySystems.reduce((keySystemsObj, keySystem) => {
  80036. const keySystemOptions = playlist.contentProtection[keySystem];
  80037. if (keySystemOptions && keySystemOptions.pssh) {
  80038. keySystemsObj[keySystem] = {
  80039. pssh: keySystemOptions.pssh
  80040. };
  80041. }
  80042. return keySystemsObj;
  80043. }, {});
  80044. if (Object.keys(keySystemsOptions).length) {
  80045. keySystemsArr.push(keySystemsOptions);
  80046. }
  80047. return keySystemsArr;
  80048. }, []);
  80049. };
  80050. const waitForKeySessionCreation$1 = ({
  80051. player,
  80052. sourceKeySystems,
  80053. audioMedia,
  80054. mainPlaylists
  80055. }) => {
  80056. if (!player.eme.initializeMediaKeys) {
  80057. return Promise.resolve();
  80058. }
  80059. const playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists;
  80060. const keySystemsOptionsArr = getAllPsshKeySystemsOptions$1(playlists, Object.keys(sourceKeySystems));
  80061. const initializationFinishedPromises = [];
  80062. const keySessionCreatedPromises = [];
  80063. keySystemsOptionsArr.forEach((keySystemsOptions) => {
  80064. keySessionCreatedPromises.push(new Promise((resolve2, reject2) => {
  80065. player.tech_.one("keysessioncreated", resolve2);
  80066. }));
  80067. initializationFinishedPromises.push(new Promise((resolve2, reject2) => {
  80068. player.eme.initializeMediaKeys({
  80069. keySystems: keySystemsOptions
  80070. }, (err) => {
  80071. if (err) {
  80072. reject2(err);
  80073. return;
  80074. }
  80075. resolve2();
  80076. });
  80077. }));
  80078. });
  80079. return Promise.race([
  80080. Promise.all(initializationFinishedPromises),
  80081. Promise.race(keySessionCreatedPromises)
  80082. ]);
  80083. };
  80084. const setupEmeOptions$1 = ({
  80085. player,
  80086. sourceKeySystems,
  80087. media,
  80088. audioMedia
  80089. }) => {
  80090. const sourceOptions = emeKeySystems$1(sourceKeySystems, media, audioMedia);
  80091. if (!sourceOptions) {
  80092. return false;
  80093. }
  80094. player.currentSource().keySystems = sourceOptions;
  80095. if (sourceOptions && !player.eme) {
  80096. videojs$2.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin");
  80097. return false;
  80098. }
  80099. return true;
  80100. };
  80101. const getVhsLocalStorage$1 = () => {
  80102. if (!window_1.localStorage) {
  80103. return null;
  80104. }
  80105. const storedObject = window_1.localStorage.getItem(LOCAL_STORAGE_KEY$2);
  80106. if (!storedObject) {
  80107. return null;
  80108. }
  80109. try {
  80110. return JSON.parse(storedObject);
  80111. } catch (e) {
  80112. return null;
  80113. }
  80114. };
  80115. const updateVhsLocalStorage$1 = (options2) => {
  80116. if (!window_1.localStorage) {
  80117. return false;
  80118. }
  80119. let objectToStore = getVhsLocalStorage$1();
  80120. objectToStore = objectToStore ? merge$2(objectToStore, options2) : options2;
  80121. try {
  80122. window_1.localStorage.setItem(LOCAL_STORAGE_KEY$2, JSON.stringify(objectToStore));
  80123. } catch (e) {
  80124. return false;
  80125. }
  80126. return objectToStore;
  80127. };
  80128. const expandDataUri$1 = (dataUri) => {
  80129. if (dataUri.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,") === 0) {
  80130. return JSON.parse(dataUri.substring(dataUri.indexOf(",") + 1));
  80131. }
  80132. return dataUri;
  80133. };
  80134. Vhs$2.supportsNativeHls = function() {
  80135. if (!document_1 || !document_1.createElement) {
  80136. return false;
  80137. }
  80138. const video = document_1.createElement("video");
  80139. if (!videojs$2.getTech("Html5").isSupported()) {
  80140. return false;
  80141. }
  80142. const canPlay = [
  80143. "application/vnd.apple.mpegurl",
  80144. "audio/mpegurl",
  80145. "audio/x-mpegurl",
  80146. "application/x-mpegurl",
  80147. "video/x-mpegurl",
  80148. "video/mpegurl",
  80149. "application/mpegurl"
  80150. ];
  80151. return canPlay.some(function(canItPlay) {
  80152. return /maybe|probably/i.test(video.canPlayType(canItPlay));
  80153. });
  80154. }();
  80155. Vhs$2.supportsNativeDash = function() {
  80156. if (!document_1 || !document_1.createElement || !videojs$2.getTech("Html5").isSupported()) {
  80157. return false;
  80158. }
  80159. return /maybe|probably/i.test(document_1.createElement("video").canPlayType("application/dash+xml"));
  80160. }();
  80161. Vhs$2.supportsTypeNatively = (type2) => {
  80162. if (type2 === "hls") {
  80163. return Vhs$2.supportsNativeHls;
  80164. }
  80165. if (type2 === "dash") {
  80166. return Vhs$2.supportsNativeDash;
  80167. }
  80168. return false;
  80169. };
  80170. Vhs$2.isSupported = function() {
  80171. return videojs$2.log.warn("VHS is no longer a tech. Please remove it from your player's techOrder.");
  80172. };
  80173. const Component$2 = videojs$2.getComponent("Component");
  80174. class VhsHandler$1 extends Component$2 {
  80175. constructor(source, tech, options2) {
  80176. super(tech, options2.vhs);
  80177. if (typeof options2.initialBandwidth === "number") {
  80178. this.options_.bandwidth = options2.initialBandwidth;
  80179. }
  80180. this.logger_ = logger$1("VhsHandler");
  80181. if (tech.options_ && tech.options_.playerId) {
  80182. const _player = videojs$2.getPlayer(tech.options_.playerId);
  80183. this.player_ = _player;
  80184. }
  80185. this.tech_ = tech;
  80186. this.source_ = source;
  80187. this.stats = {};
  80188. this.ignoreNextSeekingEvent_ = false;
  80189. this.setOptions_();
  80190. if (this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) {
  80191. tech.overrideNativeAudioTracks(true);
  80192. tech.overrideNativeVideoTracks(true);
  80193. } else if (this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) {
  80194. throw new Error("Overriding native VHS requires emulated tracks. See https://git.io/vMpjB");
  80195. }
  80196. this.on(document_1, ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"], (event2) => {
  80197. const fullscreenElement = document_1.fullscreenElement || document_1.webkitFullscreenElement || document_1.mozFullScreenElement || document_1.msFullscreenElement;
  80198. if (fullscreenElement && fullscreenElement.contains(this.tech_.el())) {
  80199. this.playlistController_.fastQualityChange_();
  80200. } else {
  80201. this.playlistController_.checkABR_();
  80202. }
  80203. });
  80204. this.on(this.tech_, "seeking", function() {
  80205. if (this.ignoreNextSeekingEvent_) {
  80206. this.ignoreNextSeekingEvent_ = false;
  80207. return;
  80208. }
  80209. this.setCurrentTime(this.tech_.currentTime());
  80210. });
  80211. this.on(this.tech_, "error", function() {
  80212. if (this.tech_.error() && this.playlistController_) {
  80213. this.playlistController_.pauseLoading();
  80214. }
  80215. });
  80216. this.on(this.tech_, "play", this.play);
  80217. }
  80218. setOptions_() {
  80219. this.options_.withCredentials = this.options_.withCredentials || false;
  80220. this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true;
  80221. this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false;
  80222. this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== "undefined" ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false;
  80223. this.options_.useNetworkInformationApi = this.options_.useNetworkInformationApi || false;
  80224. this.options_.useDtsForTimestampOffset = this.options_.useDtsForTimestampOffset || false;
  80225. this.options_.customTagParsers = this.options_.customTagParsers || [];
  80226. this.options_.customTagMappers = this.options_.customTagMappers || [];
  80227. this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false;
  80228. this.options_.llhls = this.options_.llhls === false ? false : true;
  80229. this.options_.bufferBasedABR = this.options_.bufferBasedABR || false;
  80230. if (typeof this.options_.playlistExclusionDuration !== "number") {
  80231. this.options_.playlistExclusionDuration = 5 * 60;
  80232. }
  80233. if (typeof this.options_.bandwidth !== "number") {
  80234. if (this.options_.useBandwidthFromLocalStorage) {
  80235. const storedObject = getVhsLocalStorage$1();
  80236. if (storedObject && storedObject.bandwidth) {
  80237. this.options_.bandwidth = storedObject.bandwidth;
  80238. this.tech_.trigger({
  80239. type: "usage",
  80240. name: "vhs-bandwidth-from-local-storage"
  80241. });
  80242. }
  80243. if (storedObject && storedObject.throughput) {
  80244. this.options_.throughput = storedObject.throughput;
  80245. this.tech_.trigger({
  80246. type: "usage",
  80247. name: "vhs-throughput-from-local-storage"
  80248. });
  80249. }
  80250. }
  80251. }
  80252. if (typeof this.options_.bandwidth !== "number") {
  80253. this.options_.bandwidth = Config$1.INITIAL_BANDWIDTH;
  80254. }
  80255. this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config$1.INITIAL_BANDWIDTH;
  80256. ["withCredentials", "useDevicePixelRatio", "limitRenditionByPlayerDimensions", "bandwidth", "customTagParsers", "customTagMappers", "cacheEncryptionKeys", "playlistSelector", "initialPlaylistSelector", "bufferBasedABR", "liveRangeSafeTimeDelta", "llhls", "useNetworkInformationApi", "useDtsForTimestampOffset", "exactManifestTimings", "leastPixelDiffSelector"].forEach((option) => {
  80257. if (typeof this.source_[option] !== "undefined") {
  80258. this.options_[option] = this.source_[option];
  80259. }
  80260. });
  80261. this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions;
  80262. this.useDevicePixelRatio = this.options_.useDevicePixelRatio;
  80263. }
  80264. src(src, type2) {
  80265. if (!src) {
  80266. return;
  80267. }
  80268. this.setOptions_();
  80269. this.options_.src = expandDataUri$1(this.source_.src);
  80270. this.options_.tech = this.tech_;
  80271. this.options_.externVhs = Vhs$2;
  80272. this.options_.sourceType = simpleTypeFromSourceType$1(type2);
  80273. this.options_.seekTo = (time) => {
  80274. this.tech_.setCurrentTime(time);
  80275. };
  80276. this.playlistController_ = new PlaylistController(this.options_);
  80277. const playbackWatcherOptions = merge$2({
  80278. liveRangeSafeTimeDelta: SAFE_TIME_DELTA$1
  80279. }, this.options_, {
  80280. seekable: () => this.seekable(),
  80281. media: () => this.playlistController_.media(),
  80282. playlistController: this.playlistController_
  80283. });
  80284. this.playbackWatcher_ = new PlaybackWatcher$1(playbackWatcherOptions);
  80285. this.playlistController_.on("error", () => {
  80286. const player = videojs$2.players[this.tech_.options_.playerId];
  80287. let error = this.playlistController_.error;
  80288. if (typeof error === "object" && !error.code) {
  80289. error.code = 3;
  80290. } else if (typeof error === "string") {
  80291. error = {
  80292. message: error,
  80293. code: 3
  80294. };
  80295. }
  80296. player.error(error);
  80297. });
  80298. const defaultSelector = this.options_.bufferBasedABR ? Vhs$2.movingAverageBandwidthSelector(0.55) : Vhs$2.STANDARD_PLAYLIST_SELECTOR;
  80299. this.playlistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this);
  80300. this.playlistController_.selectInitialPlaylist = Vhs$2.INITIAL_PLAYLIST_SELECTOR.bind(this);
  80301. this.playlists = this.playlistController_.mainPlaylistLoader_;
  80302. this.mediaSource = this.playlistController_.mediaSource;
  80303. Object.defineProperties(this, {
  80304. selectPlaylist: {
  80305. get() {
  80306. return this.playlistController_.selectPlaylist;
  80307. },
  80308. set(selectPlaylist) {
  80309. this.playlistController_.selectPlaylist = selectPlaylist.bind(this);
  80310. }
  80311. },
  80312. throughput: {
  80313. get() {
  80314. return this.playlistController_.mainSegmentLoader_.throughput.rate;
  80315. },
  80316. set(throughput) {
  80317. this.playlistController_.mainSegmentLoader_.throughput.rate = throughput;
  80318. this.playlistController_.mainSegmentLoader_.throughput.count = 1;
  80319. }
  80320. },
  80321. bandwidth: {
  80322. get() {
  80323. let playerBandwidthEst = this.playlistController_.mainSegmentLoader_.bandwidth;
  80324. const networkInformation = window_1.navigator.connection || window_1.navigator.mozConnection || window_1.navigator.webkitConnection;
  80325. const tenMbpsAsBitsPerSecond = 1e7;
  80326. if (this.options_.useNetworkInformationApi && networkInformation) {
  80327. const networkInfoBandwidthEstBitsPerSec = networkInformation.downlink * 1e3 * 1e3;
  80328. if (networkInfoBandwidthEstBitsPerSec >= tenMbpsAsBitsPerSecond && playerBandwidthEst >= tenMbpsAsBitsPerSecond) {
  80329. playerBandwidthEst = Math.max(playerBandwidthEst, networkInfoBandwidthEstBitsPerSec);
  80330. } else {
  80331. playerBandwidthEst = networkInfoBandwidthEstBitsPerSec;
  80332. }
  80333. }
  80334. return playerBandwidthEst;
  80335. },
  80336. set(bandwidth2) {
  80337. this.playlistController_.mainSegmentLoader_.bandwidth = bandwidth2;
  80338. this.playlistController_.mainSegmentLoader_.throughput = {
  80339. rate: 0,
  80340. count: 0
  80341. };
  80342. }
  80343. },
  80344. systemBandwidth: {
  80345. get() {
  80346. const invBandwidth = 1 / (this.bandwidth || 1);
  80347. let invThroughput;
  80348. if (this.throughput > 0) {
  80349. invThroughput = 1 / this.throughput;
  80350. } else {
  80351. invThroughput = 0;
  80352. }
  80353. const systemBitrate = Math.floor(1 / (invBandwidth + invThroughput));
  80354. return systemBitrate;
  80355. },
  80356. set() {
  80357. videojs$2.log.error('The "systemBandwidth" property is read-only');
  80358. }
  80359. }
  80360. });
  80361. if (this.options_.bandwidth) {
  80362. this.bandwidth = this.options_.bandwidth;
  80363. }
  80364. if (this.options_.throughput) {
  80365. this.throughput = this.options_.throughput;
  80366. }
  80367. Object.defineProperties(this.stats, {
  80368. bandwidth: {
  80369. get: () => this.bandwidth || 0,
  80370. enumerable: true
  80371. },
  80372. mediaRequests: {
  80373. get: () => this.playlistController_.mediaRequests_() || 0,
  80374. enumerable: true
  80375. },
  80376. mediaRequestsAborted: {
  80377. get: () => this.playlistController_.mediaRequestsAborted_() || 0,
  80378. enumerable: true
  80379. },
  80380. mediaRequestsTimedout: {
  80381. get: () => this.playlistController_.mediaRequestsTimedout_() || 0,
  80382. enumerable: true
  80383. },
  80384. mediaRequestsErrored: {
  80385. get: () => this.playlistController_.mediaRequestsErrored_() || 0,
  80386. enumerable: true
  80387. },
  80388. mediaTransferDuration: {
  80389. get: () => this.playlistController_.mediaTransferDuration_() || 0,
  80390. enumerable: true
  80391. },
  80392. mediaBytesTransferred: {
  80393. get: () => this.playlistController_.mediaBytesTransferred_() || 0,
  80394. enumerable: true
  80395. },
  80396. mediaSecondsLoaded: {
  80397. get: () => this.playlistController_.mediaSecondsLoaded_() || 0,
  80398. enumerable: true
  80399. },
  80400. mediaAppends: {
  80401. get: () => this.playlistController_.mediaAppends_() || 0,
  80402. enumerable: true
  80403. },
  80404. mainAppendsToLoadedData: {
  80405. get: () => this.playlistController_.mainAppendsToLoadedData_() || 0,
  80406. enumerable: true
  80407. },
  80408. audioAppendsToLoadedData: {
  80409. get: () => this.playlistController_.audioAppendsToLoadedData_() || 0,
  80410. enumerable: true
  80411. },
  80412. appendsToLoadedData: {
  80413. get: () => this.playlistController_.appendsToLoadedData_() || 0,
  80414. enumerable: true
  80415. },
  80416. timeToLoadedData: {
  80417. get: () => this.playlistController_.timeToLoadedData_() || 0,
  80418. enumerable: true
  80419. },
  80420. buffered: {
  80421. get: () => timeRangesToArray$1(this.tech_.buffered()),
  80422. enumerable: true
  80423. },
  80424. currentTime: {
  80425. get: () => this.tech_.currentTime(),
  80426. enumerable: true
  80427. },
  80428. currentSource: {
  80429. get: () => this.tech_.currentSource_,
  80430. enumerable: true
  80431. },
  80432. currentTech: {
  80433. get: () => this.tech_.name_,
  80434. enumerable: true
  80435. },
  80436. duration: {
  80437. get: () => this.tech_.duration(),
  80438. enumerable: true
  80439. },
  80440. main: {
  80441. get: () => this.playlists.main,
  80442. enumerable: true
  80443. },
  80444. playerDimensions: {
  80445. get: () => this.tech_.currentDimensions(),
  80446. enumerable: true
  80447. },
  80448. seekable: {
  80449. get: () => timeRangesToArray$1(this.tech_.seekable()),
  80450. enumerable: true
  80451. },
  80452. timestamp: {
  80453. get: () => Date.now(),
  80454. enumerable: true
  80455. },
  80456. videoPlaybackQuality: {
  80457. get: () => this.tech_.getVideoPlaybackQuality(),
  80458. enumerable: true
  80459. }
  80460. });
  80461. this.tech_.one("canplay", this.playlistController_.setupFirstPlay.bind(this.playlistController_));
  80462. this.tech_.on("bandwidthupdate", () => {
  80463. if (this.options_.useBandwidthFromLocalStorage) {
  80464. updateVhsLocalStorage$1({
  80465. bandwidth: this.bandwidth,
  80466. throughput: Math.round(this.throughput)
  80467. });
  80468. }
  80469. });
  80470. this.playlistController_.on("selectedinitialmedia", () => {
  80471. renditionSelectionMixin$1(this);
  80472. });
  80473. this.playlistController_.sourceUpdater_.on("createdsourcebuffers", () => {
  80474. this.setupEme_();
  80475. });
  80476. this.on(this.playlistController_, "progress", function() {
  80477. this.tech_.trigger("progress");
  80478. });
  80479. this.on(this.playlistController_, "firstplay", function() {
  80480. this.ignoreNextSeekingEvent_ = true;
  80481. });
  80482. this.setupQualityLevels_();
  80483. if (!this.tech_.el()) {
  80484. return;
  80485. }
  80486. this.mediaSourceUrl_ = window_1.URL.createObjectURL(this.playlistController_.mediaSource);
  80487. this.tech_.src(this.mediaSourceUrl_);
  80488. }
  80489. createKeySessions_() {
  80490. const audioPlaylistLoader = this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;
  80491. this.logger_("waiting for EME key session creation");
  80492. waitForKeySessionCreation$1({
  80493. player: this.player_,
  80494. sourceKeySystems: this.source_.keySystems,
  80495. audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(),
  80496. mainPlaylists: this.playlists.main.playlists
  80497. }).then(() => {
  80498. this.logger_("created EME key session");
  80499. this.playlistController_.sourceUpdater_.initializedEme();
  80500. }).catch((err) => {
  80501. this.logger_("error while creating EME key session", err);
  80502. this.player_.error({
  80503. message: "Failed to initialize media keys for EME",
  80504. code: 3
  80505. });
  80506. });
  80507. }
  80508. handleWaitingForKey_() {
  80509. this.logger_("waitingforkey fired, attempting to create any new key sessions");
  80510. this.createKeySessions_();
  80511. }
  80512. setupEme_() {
  80513. const audioPlaylistLoader = this.playlistController_.mediaTypes_.AUDIO.activePlaylistLoader;
  80514. const didSetupEmeOptions = setupEmeOptions$1({
  80515. player: this.player_,
  80516. sourceKeySystems: this.source_.keySystems,
  80517. media: this.playlists.media(),
  80518. audioMedia: audioPlaylistLoader && audioPlaylistLoader.media()
  80519. });
  80520. this.player_.tech_.on("keystatuschange", (e) => {
  80521. if (e.status !== "output-restricted") {
  80522. return;
  80523. }
  80524. const mainPlaylist = this.playlistController_.main();
  80525. if (!mainPlaylist || !mainPlaylist.playlists) {
  80526. return;
  80527. }
  80528. const excludedHDPlaylists = [];
  80529. mainPlaylist.playlists.forEach((playlist) => {
  80530. if (playlist && playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height >= 720) {
  80531. if (!playlist.excludeUntil || playlist.excludeUntil < Infinity) {
  80532. playlist.excludeUntil = Infinity;
  80533. excludedHDPlaylists.push(playlist);
  80534. }
  80535. }
  80536. });
  80537. if (excludedHDPlaylists.length) {
  80538. videojs$2.log.warn('DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.', ...excludedHDPlaylists);
  80539. this.playlistController_.fastQualityChange_();
  80540. }
  80541. });
  80542. this.handleWaitingForKey_ = this.handleWaitingForKey_.bind(this);
  80543. this.player_.tech_.on("waitingforkey", this.handleWaitingForKey_);
  80544. if (videojs$2.browser.IE_VERSION === 11 || !didSetupEmeOptions) {
  80545. this.playlistController_.sourceUpdater_.initializedEme();
  80546. return;
  80547. }
  80548. this.createKeySessions_();
  80549. }
  80550. setupQualityLevels_() {
  80551. const player = videojs$2.players[this.tech_.options_.playerId];
  80552. if (!player || !player.qualityLevels || this.qualityLevels_) {
  80553. return;
  80554. }
  80555. this.qualityLevels_ = player.qualityLevels();
  80556. this.playlistController_.on("selectedinitialmedia", () => {
  80557. handleVhsLoadedMetadata$1(this.qualityLevels_, this);
  80558. });
  80559. this.playlists.on("mediachange", () => {
  80560. handleVhsMediaChange$1(this.qualityLevels_, this.playlists);
  80561. });
  80562. }
  80563. static version() {
  80564. return {
  80565. "@videojs/http-streaming": version$4$1,
  80566. "mux.js": version$3$1,
  80567. "mpd-parser": version$2$1,
  80568. "m3u8-parser": version$1$2,
  80569. "aes-decrypter": version$7
  80570. };
  80571. }
  80572. version() {
  80573. return this.constructor.version();
  80574. }
  80575. canChangeType() {
  80576. return SourceUpdater$1.canChangeType();
  80577. }
  80578. play() {
  80579. this.playlistController_.play();
  80580. }
  80581. setCurrentTime(currentTime) {
  80582. this.playlistController_.setCurrentTime(currentTime);
  80583. }
  80584. duration() {
  80585. return this.playlistController_.duration();
  80586. }
  80587. seekable() {
  80588. return this.playlistController_.seekable();
  80589. }
  80590. dispose() {
  80591. if (this.playbackWatcher_) {
  80592. this.playbackWatcher_.dispose();
  80593. }
  80594. if (this.playlistController_) {
  80595. this.playlistController_.dispose();
  80596. }
  80597. if (this.qualityLevels_) {
  80598. this.qualityLevels_.dispose();
  80599. }
  80600. if (this.tech_ && this.tech_.vhs) {
  80601. delete this.tech_.vhs;
  80602. }
  80603. if (this.mediaSourceUrl_ && window_1.URL.revokeObjectURL) {
  80604. window_1.URL.revokeObjectURL(this.mediaSourceUrl_);
  80605. this.mediaSourceUrl_ = null;
  80606. }
  80607. if (this.tech_) {
  80608. this.tech_.off("waitingforkey", this.handleWaitingForKey_);
  80609. }
  80610. super.dispose();
  80611. }
  80612. convertToProgramTime(time, callback2) {
  80613. return getProgramTime$1({
  80614. playlist: this.playlistController_.media(),
  80615. time,
  80616. callback: callback2
  80617. });
  80618. }
  80619. seekToProgramTime(programTime, callback2, pauseAfterSeek = true, retryCount = 2) {
  80620. return seekToProgramTime$1({
  80621. programTime,
  80622. playlist: this.playlistController_.media(),
  80623. retryCount,
  80624. pauseAfterSeek,
  80625. seekTo: this.options_.seekTo,
  80626. tech: this.options_.tech,
  80627. callback: callback2
  80628. });
  80629. }
  80630. }
  80631. const VhsSourceHandler$1 = {
  80632. name: "videojs-http-streaming",
  80633. VERSION: version$4$1,
  80634. canHandleSource(srcObj, options2 = {}) {
  80635. const localOptions = merge$2(videojs$2.options, options2);
  80636. return VhsSourceHandler$1.canPlayType(srcObj.type, localOptions);
  80637. },
  80638. handleSource(source, tech, options2 = {}) {
  80639. const localOptions = merge$2(videojs$2.options, options2);
  80640. tech.vhs = new VhsHandler$1(source, tech, localOptions);
  80641. tech.vhs.xhr = xhrFactory$1();
  80642. tech.vhs.src(source.src, source.type);
  80643. return tech.vhs;
  80644. },
  80645. canPlayType(type2, options2) {
  80646. const simpleType = simpleTypeFromSourceType$1(type2);
  80647. if (!simpleType) {
  80648. return "";
  80649. }
  80650. const overrideNative = VhsSourceHandler$1.getOverrideNative(options2);
  80651. const supportsTypeNatively = Vhs$2.supportsTypeNatively(simpleType);
  80652. const canUseMsePlayback = !supportsTypeNatively || overrideNative;
  80653. return canUseMsePlayback ? "maybe" : "";
  80654. },
  80655. getOverrideNative(options2 = {}) {
  80656. const {
  80657. vhs = {}
  80658. } = options2;
  80659. const defaultOverrideNative = !(videojs$2.browser.IS_ANY_SAFARI || videojs$2.browser.IS_IOS);
  80660. const {
  80661. overrideNative = defaultOverrideNative
  80662. } = vhs;
  80663. return overrideNative;
  80664. }
  80665. };
  80666. const supportsNativeMediaSources$1 = () => {
  80667. return browserSupportsCodec$1("avc1.4d400d,mp4a.40.2");
  80668. };
  80669. if (supportsNativeMediaSources$1()) {
  80670. videojs$2.getTech("Html5").registerSourceHandler(VhsSourceHandler$1, 0);
  80671. }
  80672. videojs$2.VhsHandler = VhsHandler$1;
  80673. videojs$2.VhsSourceHandler = VhsSourceHandler$1;
  80674. videojs$2.Vhs = Vhs$2;
  80675. if (!videojs$2.use) {
  80676. videojs$2.registerComponent("Vhs", Vhs$2);
  80677. }
  80678. videojs$2.options.vhs = videojs$2.options.vhs || {};
  80679. if (!videojs$2.getPlugin || !videojs$2.getPlugin("reloadSourceOnError")) {
  80680. videojs$2.registerPlugin("reloadSourceOnError", reloadSourceOnError$1);
  80681. }
  80682. var videoJs = "";
  80683. function _assertThisInitialized(self2) {
  80684. if (self2 === void 0) {
  80685. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  80686. }
  80687. return self2;
  80688. }
  80689. function _setPrototypeOf(o, p) {
  80690. _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
  80691. o2.__proto__ = p2;
  80692. return o2;
  80693. };
  80694. return _setPrototypeOf(o, p);
  80695. }
  80696. function _inheritsLoose(subClass, superClass) {
  80697. subClass.prototype = Object.create(superClass.prototype);
  80698. subClass.prototype.constructor = subClass;
  80699. _setPrototypeOf(subClass, superClass);
  80700. }
  80701. function _isNativeReflectConstruct() {
  80702. if (typeof Reflect === "undefined" || !Reflect.construct)
  80703. return false;
  80704. if (Reflect.construct.sham)
  80705. return false;
  80706. if (typeof Proxy === "function")
  80707. return true;
  80708. try {
  80709. Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
  80710. }));
  80711. return true;
  80712. } catch (e) {
  80713. return false;
  80714. }
  80715. }
  80716. function _construct(Parent, args, Class) {
  80717. if (_isNativeReflectConstruct()) {
  80718. _construct = Reflect.construct.bind();
  80719. } else {
  80720. _construct = function _construct2(Parent2, args2, Class2) {
  80721. var a = [null];
  80722. a.push.apply(a, args2);
  80723. var Constructor = Function.bind.apply(Parent2, a);
  80724. var instance = new Constructor();
  80725. if (Class2)
  80726. _setPrototypeOf(instance, Class2.prototype);
  80727. return instance;
  80728. };
  80729. }
  80730. return _construct.apply(null, arguments);
  80731. }
  80732. function _inherits(subClass, superClass) {
  80733. if (typeof superClass !== "function" && superClass !== null) {
  80734. throw new TypeError("Super expression must either be null or a function");
  80735. }
  80736. subClass.prototype = Object.create(superClass && superClass.prototype, {
  80737. constructor: {
  80738. value: subClass,
  80739. writable: true,
  80740. configurable: true
  80741. }
  80742. });
  80743. Object.defineProperty(subClass, "prototype", {
  80744. writable: false
  80745. });
  80746. if (superClass)
  80747. _setPrototypeOf(subClass, superClass);
  80748. }
  80749. var DEFAULT_LOCATION = "http://example.com";
  80750. var resolveUrl$1 = function resolveUrl3(baseUrl, relativeUrl) {
  80751. if (/^[a-z]+:/i.test(relativeUrl)) {
  80752. return relativeUrl;
  80753. }
  80754. if (/^data:/.test(baseUrl)) {
  80755. baseUrl = window_1.location && window_1.location.href || "";
  80756. }
  80757. var nativeURL = typeof window_1.URL === "function";
  80758. var protocolLess = /^\/\//.test(baseUrl);
  80759. var removeLocation = !window_1.location && !/\/\//i.test(baseUrl);
  80760. if (nativeURL) {
  80761. baseUrl = new window_1.URL(baseUrl, window_1.location || DEFAULT_LOCATION);
  80762. } else if (!/\/\//i.test(baseUrl)) {
  80763. baseUrl = URLToolkit.buildAbsoluteURL(window_1.location && window_1.location.href || "", baseUrl);
  80764. }
  80765. if (nativeURL) {
  80766. var newUrl = new URL(relativeUrl, baseUrl);
  80767. if (removeLocation) {
  80768. return newUrl.href.slice(DEFAULT_LOCATION.length);
  80769. } else if (protocolLess) {
  80770. return newUrl.href.slice(newUrl.protocol.length);
  80771. }
  80772. return newUrl.href;
  80773. }
  80774. return URLToolkit.buildAbsoluteURL(baseUrl, relativeUrl);
  80775. };
  80776. var Stream = /* @__PURE__ */ function() {
  80777. function Stream2() {
  80778. this.listeners = {};
  80779. }
  80780. var _proto = Stream2.prototype;
  80781. _proto.on = function on3(type2, listener) {
  80782. if (!this.listeners[type2]) {
  80783. this.listeners[type2] = [];
  80784. }
  80785. this.listeners[type2].push(listener);
  80786. };
  80787. _proto.off = function off2(type2, listener) {
  80788. if (!this.listeners[type2]) {
  80789. return false;
  80790. }
  80791. var index2 = this.listeners[type2].indexOf(listener);
  80792. this.listeners[type2] = this.listeners[type2].slice(0);
  80793. this.listeners[type2].splice(index2, 1);
  80794. return index2 > -1;
  80795. };
  80796. _proto.trigger = function trigger2(type2) {
  80797. var callbacks = this.listeners[type2];
  80798. if (!callbacks) {
  80799. return;
  80800. }
  80801. if (arguments.length === 2) {
  80802. var length = callbacks.length;
  80803. for (var i2 = 0; i2 < length; ++i2) {
  80804. callbacks[i2].call(this, arguments[1]);
  80805. }
  80806. } else {
  80807. var args = Array.prototype.slice.call(arguments, 1);
  80808. var _length = callbacks.length;
  80809. for (var _i = 0; _i < _length; ++_i) {
  80810. callbacks[_i].apply(this, args);
  80811. }
  80812. }
  80813. };
  80814. _proto.dispose = function dispose() {
  80815. this.listeners = {};
  80816. };
  80817. _proto.pipe = function pipe(destination2) {
  80818. this.on("data", function(data) {
  80819. destination2.push(data);
  80820. });
  80821. };
  80822. return Stream2;
  80823. }();
  80824. var atob3 = function atob4(s) {
  80825. return window_1.atob ? window_1.atob(s) : Buffer.from(s, "base64").toString("binary");
  80826. };
  80827. function decodeB64ToUint8Array(b64Text) {
  80828. var decodedString = atob3(b64Text);
  80829. var array = new Uint8Array(decodedString.length);
  80830. for (var i2 = 0; i2 < decodedString.length; i2++) {
  80831. array[i2] = decodedString.charCodeAt(i2);
  80832. }
  80833. return array;
  80834. }
  80835. /*! @name m3u8-parser @version 4.8.0 @license Apache-2.0 */
  80836. var LineStream = /* @__PURE__ */ function(_Stream) {
  80837. _inheritsLoose(LineStream2, _Stream);
  80838. function LineStream2() {
  80839. var _this;
  80840. _this = _Stream.call(this) || this;
  80841. _this.buffer = "";
  80842. return _this;
  80843. }
  80844. var _proto = LineStream2.prototype;
  80845. _proto.push = function push(data) {
  80846. var nextNewline;
  80847. this.buffer += data;
  80848. nextNewline = this.buffer.indexOf("\n");
  80849. for (; nextNewline > -1; nextNewline = this.buffer.indexOf("\n")) {
  80850. this.trigger("data", this.buffer.substring(0, nextNewline));
  80851. this.buffer = this.buffer.substring(nextNewline + 1);
  80852. }
  80853. };
  80854. return LineStream2;
  80855. }(Stream);
  80856. var TAB = String.fromCharCode(9);
  80857. var parseByterange = function parseByterange2(byterangeString) {
  80858. var match = /([0-9.]*)?@?([0-9.]*)?/.exec(byterangeString || "");
  80859. var result = {};
  80860. if (match[1]) {
  80861. result.length = parseInt(match[1], 10);
  80862. }
  80863. if (match[2]) {
  80864. result.offset = parseInt(match[2], 10);
  80865. }
  80866. return result;
  80867. };
  80868. var attributeSeparator = function attributeSeparator2() {
  80869. var key = "[^=]*";
  80870. var value = '"[^"]*"|[^,]*';
  80871. var keyvalue = "(?:" + key + ")=(?:" + value + ")";
  80872. return new RegExp("(?:^|,)(" + keyvalue + ")");
  80873. };
  80874. var parseAttributes$1 = function parseAttributes(attributes) {
  80875. var attrs = attributes.split(attributeSeparator());
  80876. var result = {};
  80877. var i2 = attrs.length;
  80878. var attr;
  80879. while (i2--) {
  80880. if (attrs[i2] === "") {
  80881. continue;
  80882. }
  80883. attr = /([^=]*)=(.*)/.exec(attrs[i2]).slice(1);
  80884. attr[0] = attr[0].replace(/^\s+|\s+$/g, "");
  80885. attr[1] = attr[1].replace(/^\s+|\s+$/g, "");
  80886. attr[1] = attr[1].replace(/^['"](.*)['"]$/g, "$1");
  80887. result[attr[0]] = attr[1];
  80888. }
  80889. return result;
  80890. };
  80891. var ParseStream = /* @__PURE__ */ function(_Stream) {
  80892. _inheritsLoose(ParseStream2, _Stream);
  80893. function ParseStream2() {
  80894. var _this;
  80895. _this = _Stream.call(this) || this;
  80896. _this.customParsers = [];
  80897. _this.tagMappers = [];
  80898. return _this;
  80899. }
  80900. var _proto = ParseStream2.prototype;
  80901. _proto.push = function push(line) {
  80902. var _this2 = this;
  80903. var match;
  80904. var event2;
  80905. line = line.trim();
  80906. if (line.length === 0) {
  80907. return;
  80908. }
  80909. if (line[0] !== "#") {
  80910. this.trigger("data", {
  80911. type: "uri",
  80912. uri: line
  80913. });
  80914. return;
  80915. }
  80916. var newLines = this.tagMappers.reduce(function(acc, mapper) {
  80917. var mappedLine = mapper(line);
  80918. if (mappedLine === line) {
  80919. return acc;
  80920. }
  80921. return acc.concat([mappedLine]);
  80922. }, [line]);
  80923. newLines.forEach(function(newLine) {
  80924. for (var i2 = 0; i2 < _this2.customParsers.length; i2++) {
  80925. if (_this2.customParsers[i2].call(_this2, newLine)) {
  80926. return;
  80927. }
  80928. }
  80929. if (newLine.indexOf("#EXT") !== 0) {
  80930. _this2.trigger("data", {
  80931. type: "comment",
  80932. text: newLine.slice(1)
  80933. });
  80934. return;
  80935. }
  80936. newLine = newLine.replace("\r", "");
  80937. match = /^#EXTM3U/.exec(newLine);
  80938. if (match) {
  80939. _this2.trigger("data", {
  80940. type: "tag",
  80941. tagType: "m3u"
  80942. });
  80943. return;
  80944. }
  80945. match = /^#EXTINF:?([0-9\.]*)?,?(.*)?$/.exec(newLine);
  80946. if (match) {
  80947. event2 = {
  80948. type: "tag",
  80949. tagType: "inf"
  80950. };
  80951. if (match[1]) {
  80952. event2.duration = parseFloat(match[1]);
  80953. }
  80954. if (match[2]) {
  80955. event2.title = match[2];
  80956. }
  80957. _this2.trigger("data", event2);
  80958. return;
  80959. }
  80960. match = /^#EXT-X-TARGETDURATION:?([0-9.]*)?/.exec(newLine);
  80961. if (match) {
  80962. event2 = {
  80963. type: "tag",
  80964. tagType: "targetduration"
  80965. };
  80966. if (match[1]) {
  80967. event2.duration = parseInt(match[1], 10);
  80968. }
  80969. _this2.trigger("data", event2);
  80970. return;
  80971. }
  80972. match = /^#EXT-X-VERSION:?([0-9.]*)?/.exec(newLine);
  80973. if (match) {
  80974. event2 = {
  80975. type: "tag",
  80976. tagType: "version"
  80977. };
  80978. if (match[1]) {
  80979. event2.version = parseInt(match[1], 10);
  80980. }
  80981. _this2.trigger("data", event2);
  80982. return;
  80983. }
  80984. match = /^#EXT-X-MEDIA-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine);
  80985. if (match) {
  80986. event2 = {
  80987. type: "tag",
  80988. tagType: "media-sequence"
  80989. };
  80990. if (match[1]) {
  80991. event2.number = parseInt(match[1], 10);
  80992. }
  80993. _this2.trigger("data", event2);
  80994. return;
  80995. }
  80996. match = /^#EXT-X-DISCONTINUITY-SEQUENCE:?(\-?[0-9.]*)?/.exec(newLine);
  80997. if (match) {
  80998. event2 = {
  80999. type: "tag",
  81000. tagType: "discontinuity-sequence"
  81001. };
  81002. if (match[1]) {
  81003. event2.number = parseInt(match[1], 10);
  81004. }
  81005. _this2.trigger("data", event2);
  81006. return;
  81007. }
  81008. match = /^#EXT-X-PLAYLIST-TYPE:?(.*)?$/.exec(newLine);
  81009. if (match) {
  81010. event2 = {
  81011. type: "tag",
  81012. tagType: "playlist-type"
  81013. };
  81014. if (match[1]) {
  81015. event2.playlistType = match[1];
  81016. }
  81017. _this2.trigger("data", event2);
  81018. return;
  81019. }
  81020. match = /^#EXT-X-BYTERANGE:?(.*)?$/.exec(newLine);
  81021. if (match) {
  81022. event2 = _extends$2(parseByterange(match[1]), {
  81023. type: "tag",
  81024. tagType: "byterange"
  81025. });
  81026. _this2.trigger("data", event2);
  81027. return;
  81028. }
  81029. match = /^#EXT-X-ALLOW-CACHE:?(YES|NO)?/.exec(newLine);
  81030. if (match) {
  81031. event2 = {
  81032. type: "tag",
  81033. tagType: "allow-cache"
  81034. };
  81035. if (match[1]) {
  81036. event2.allowed = !/NO/.test(match[1]);
  81037. }
  81038. _this2.trigger("data", event2);
  81039. return;
  81040. }
  81041. match = /^#EXT-X-MAP:?(.*)$/.exec(newLine);
  81042. if (match) {
  81043. event2 = {
  81044. type: "tag",
  81045. tagType: "map"
  81046. };
  81047. if (match[1]) {
  81048. var attributes = parseAttributes$1(match[1]);
  81049. if (attributes.URI) {
  81050. event2.uri = attributes.URI;
  81051. }
  81052. if (attributes.BYTERANGE) {
  81053. event2.byterange = parseByterange(attributes.BYTERANGE);
  81054. }
  81055. }
  81056. _this2.trigger("data", event2);
  81057. return;
  81058. }
  81059. match = /^#EXT-X-STREAM-INF:?(.*)$/.exec(newLine);
  81060. if (match) {
  81061. event2 = {
  81062. type: "tag",
  81063. tagType: "stream-inf"
  81064. };
  81065. if (match[1]) {
  81066. event2.attributes = parseAttributes$1(match[1]);
  81067. if (event2.attributes.RESOLUTION) {
  81068. var split2 = event2.attributes.RESOLUTION.split("x");
  81069. var resolution = {};
  81070. if (split2[0]) {
  81071. resolution.width = parseInt(split2[0], 10);
  81072. }
  81073. if (split2[1]) {
  81074. resolution.height = parseInt(split2[1], 10);
  81075. }
  81076. event2.attributes.RESOLUTION = resolution;
  81077. }
  81078. if (event2.attributes.BANDWIDTH) {
  81079. event2.attributes.BANDWIDTH = parseInt(event2.attributes.BANDWIDTH, 10);
  81080. }
  81081. if (event2.attributes["FRAME-RATE"]) {
  81082. event2.attributes["FRAME-RATE"] = parseFloat(event2.attributes["FRAME-RATE"]);
  81083. }
  81084. if (event2.attributes["PROGRAM-ID"]) {
  81085. event2.attributes["PROGRAM-ID"] = parseInt(event2.attributes["PROGRAM-ID"], 10);
  81086. }
  81087. }
  81088. _this2.trigger("data", event2);
  81089. return;
  81090. }
  81091. match = /^#EXT-X-MEDIA:?(.*)$/.exec(newLine);
  81092. if (match) {
  81093. event2 = {
  81094. type: "tag",
  81095. tagType: "media"
  81096. };
  81097. if (match[1]) {
  81098. event2.attributes = parseAttributes$1(match[1]);
  81099. }
  81100. _this2.trigger("data", event2);
  81101. return;
  81102. }
  81103. match = /^#EXT-X-ENDLIST/.exec(newLine);
  81104. if (match) {
  81105. _this2.trigger("data", {
  81106. type: "tag",
  81107. tagType: "endlist"
  81108. });
  81109. return;
  81110. }
  81111. match = /^#EXT-X-DISCONTINUITY/.exec(newLine);
  81112. if (match) {
  81113. _this2.trigger("data", {
  81114. type: "tag",
  81115. tagType: "discontinuity"
  81116. });
  81117. return;
  81118. }
  81119. match = /^#EXT-X-PROGRAM-DATE-TIME:?(.*)$/.exec(newLine);
  81120. if (match) {
  81121. event2 = {
  81122. type: "tag",
  81123. tagType: "program-date-time"
  81124. };
  81125. if (match[1]) {
  81126. event2.dateTimeString = match[1];
  81127. event2.dateTimeObject = new Date(match[1]);
  81128. }
  81129. _this2.trigger("data", event2);
  81130. return;
  81131. }
  81132. match = /^#EXT-X-KEY:?(.*)$/.exec(newLine);
  81133. if (match) {
  81134. event2 = {
  81135. type: "tag",
  81136. tagType: "key"
  81137. };
  81138. if (match[1]) {
  81139. event2.attributes = parseAttributes$1(match[1]);
  81140. if (event2.attributes.IV) {
  81141. if (event2.attributes.IV.substring(0, 2).toLowerCase() === "0x") {
  81142. event2.attributes.IV = event2.attributes.IV.substring(2);
  81143. }
  81144. event2.attributes.IV = event2.attributes.IV.match(/.{8}/g);
  81145. event2.attributes.IV[0] = parseInt(event2.attributes.IV[0], 16);
  81146. event2.attributes.IV[1] = parseInt(event2.attributes.IV[1], 16);
  81147. event2.attributes.IV[2] = parseInt(event2.attributes.IV[2], 16);
  81148. event2.attributes.IV[3] = parseInt(event2.attributes.IV[3], 16);
  81149. event2.attributes.IV = new Uint32Array(event2.attributes.IV);
  81150. }
  81151. }
  81152. _this2.trigger("data", event2);
  81153. return;
  81154. }
  81155. match = /^#EXT-X-START:?(.*)$/.exec(newLine);
  81156. if (match) {
  81157. event2 = {
  81158. type: "tag",
  81159. tagType: "start"
  81160. };
  81161. if (match[1]) {
  81162. event2.attributes = parseAttributes$1(match[1]);
  81163. event2.attributes["TIME-OFFSET"] = parseFloat(event2.attributes["TIME-OFFSET"]);
  81164. event2.attributes.PRECISE = /YES/.test(event2.attributes.PRECISE);
  81165. }
  81166. _this2.trigger("data", event2);
  81167. return;
  81168. }
  81169. match = /^#EXT-X-CUE-OUT-CONT:?(.*)?$/.exec(newLine);
  81170. if (match) {
  81171. event2 = {
  81172. type: "tag",
  81173. tagType: "cue-out-cont"
  81174. };
  81175. if (match[1]) {
  81176. event2.data = match[1];
  81177. } else {
  81178. event2.data = "";
  81179. }
  81180. _this2.trigger("data", event2);
  81181. return;
  81182. }
  81183. match = /^#EXT-X-CUE-OUT:?(.*)?$/.exec(newLine);
  81184. if (match) {
  81185. event2 = {
  81186. type: "tag",
  81187. tagType: "cue-out"
  81188. };
  81189. if (match[1]) {
  81190. event2.data = match[1];
  81191. } else {
  81192. event2.data = "";
  81193. }
  81194. _this2.trigger("data", event2);
  81195. return;
  81196. }
  81197. match = /^#EXT-X-CUE-IN:?(.*)?$/.exec(newLine);
  81198. if (match) {
  81199. event2 = {
  81200. type: "tag",
  81201. tagType: "cue-in"
  81202. };
  81203. if (match[1]) {
  81204. event2.data = match[1];
  81205. } else {
  81206. event2.data = "";
  81207. }
  81208. _this2.trigger("data", event2);
  81209. return;
  81210. }
  81211. match = /^#EXT-X-SKIP:(.*)$/.exec(newLine);
  81212. if (match && match[1]) {
  81213. event2 = {
  81214. type: "tag",
  81215. tagType: "skip"
  81216. };
  81217. event2.attributes = parseAttributes$1(match[1]);
  81218. if (event2.attributes.hasOwnProperty("SKIPPED-SEGMENTS")) {
  81219. event2.attributes["SKIPPED-SEGMENTS"] = parseInt(event2.attributes["SKIPPED-SEGMENTS"], 10);
  81220. }
  81221. if (event2.attributes.hasOwnProperty("RECENTLY-REMOVED-DATERANGES")) {
  81222. event2.attributes["RECENTLY-REMOVED-DATERANGES"] = event2.attributes["RECENTLY-REMOVED-DATERANGES"].split(TAB);
  81223. }
  81224. _this2.trigger("data", event2);
  81225. return;
  81226. }
  81227. match = /^#EXT-X-PART:(.*)$/.exec(newLine);
  81228. if (match && match[1]) {
  81229. event2 = {
  81230. type: "tag",
  81231. tagType: "part"
  81232. };
  81233. event2.attributes = parseAttributes$1(match[1]);
  81234. ["DURATION"].forEach(function(key) {
  81235. if (event2.attributes.hasOwnProperty(key)) {
  81236. event2.attributes[key] = parseFloat(event2.attributes[key]);
  81237. }
  81238. });
  81239. ["INDEPENDENT", "GAP"].forEach(function(key) {
  81240. if (event2.attributes.hasOwnProperty(key)) {
  81241. event2.attributes[key] = /YES/.test(event2.attributes[key]);
  81242. }
  81243. });
  81244. if (event2.attributes.hasOwnProperty("BYTERANGE")) {
  81245. event2.attributes.byterange = parseByterange(event2.attributes.BYTERANGE);
  81246. }
  81247. _this2.trigger("data", event2);
  81248. return;
  81249. }
  81250. match = /^#EXT-X-SERVER-CONTROL:(.*)$/.exec(newLine);
  81251. if (match && match[1]) {
  81252. event2 = {
  81253. type: "tag",
  81254. tagType: "server-control"
  81255. };
  81256. event2.attributes = parseAttributes$1(match[1]);
  81257. ["CAN-SKIP-UNTIL", "PART-HOLD-BACK", "HOLD-BACK"].forEach(function(key) {
  81258. if (event2.attributes.hasOwnProperty(key)) {
  81259. event2.attributes[key] = parseFloat(event2.attributes[key]);
  81260. }
  81261. });
  81262. ["CAN-SKIP-DATERANGES", "CAN-BLOCK-RELOAD"].forEach(function(key) {
  81263. if (event2.attributes.hasOwnProperty(key)) {
  81264. event2.attributes[key] = /YES/.test(event2.attributes[key]);
  81265. }
  81266. });
  81267. _this2.trigger("data", event2);
  81268. return;
  81269. }
  81270. match = /^#EXT-X-PART-INF:(.*)$/.exec(newLine);
  81271. if (match && match[1]) {
  81272. event2 = {
  81273. type: "tag",
  81274. tagType: "part-inf"
  81275. };
  81276. event2.attributes = parseAttributes$1(match[1]);
  81277. ["PART-TARGET"].forEach(function(key) {
  81278. if (event2.attributes.hasOwnProperty(key)) {
  81279. event2.attributes[key] = parseFloat(event2.attributes[key]);
  81280. }
  81281. });
  81282. _this2.trigger("data", event2);
  81283. return;
  81284. }
  81285. match = /^#EXT-X-PRELOAD-HINT:(.*)$/.exec(newLine);
  81286. if (match && match[1]) {
  81287. event2 = {
  81288. type: "tag",
  81289. tagType: "preload-hint"
  81290. };
  81291. event2.attributes = parseAttributes$1(match[1]);
  81292. ["BYTERANGE-START", "BYTERANGE-LENGTH"].forEach(function(key) {
  81293. if (event2.attributes.hasOwnProperty(key)) {
  81294. event2.attributes[key] = parseInt(event2.attributes[key], 10);
  81295. var subkey = key === "BYTERANGE-LENGTH" ? "length" : "offset";
  81296. event2.attributes.byterange = event2.attributes.byterange || {};
  81297. event2.attributes.byterange[subkey] = event2.attributes[key];
  81298. delete event2.attributes[key];
  81299. }
  81300. });
  81301. _this2.trigger("data", event2);
  81302. return;
  81303. }
  81304. match = /^#EXT-X-RENDITION-REPORT:(.*)$/.exec(newLine);
  81305. if (match && match[1]) {
  81306. event2 = {
  81307. type: "tag",
  81308. tagType: "rendition-report"
  81309. };
  81310. event2.attributes = parseAttributes$1(match[1]);
  81311. ["LAST-MSN", "LAST-PART"].forEach(function(key) {
  81312. if (event2.attributes.hasOwnProperty(key)) {
  81313. event2.attributes[key] = parseInt(event2.attributes[key], 10);
  81314. }
  81315. });
  81316. _this2.trigger("data", event2);
  81317. return;
  81318. }
  81319. _this2.trigger("data", {
  81320. type: "tag",
  81321. data: newLine.slice(4)
  81322. });
  81323. });
  81324. };
  81325. _proto.addParser = function addParser(_ref) {
  81326. var _this3 = this;
  81327. var expression = _ref.expression, customType = _ref.customType, dataParser = _ref.dataParser, segment = _ref.segment;
  81328. if (typeof dataParser !== "function") {
  81329. dataParser = function dataParser2(line) {
  81330. return line;
  81331. };
  81332. }
  81333. this.customParsers.push(function(line) {
  81334. var match = expression.exec(line);
  81335. if (match) {
  81336. _this3.trigger("data", {
  81337. type: "custom",
  81338. data: dataParser(line),
  81339. customType,
  81340. segment
  81341. });
  81342. return true;
  81343. }
  81344. });
  81345. };
  81346. _proto.addTagMapper = function addTagMapper(_ref2) {
  81347. var expression = _ref2.expression, map = _ref2.map;
  81348. var mapFn = function mapFn2(line) {
  81349. if (expression.test(line)) {
  81350. return map(line);
  81351. }
  81352. return line;
  81353. };
  81354. this.tagMappers.push(mapFn);
  81355. };
  81356. return ParseStream2;
  81357. }(Stream);
  81358. var camelCase = function camelCase2(str) {
  81359. return str.toLowerCase().replace(/-(\w)/g, function(a) {
  81360. return a[1].toUpperCase();
  81361. });
  81362. };
  81363. var camelCaseKeys = function camelCaseKeys2(attributes) {
  81364. var result = {};
  81365. Object.keys(attributes).forEach(function(key) {
  81366. result[camelCase(key)] = attributes[key];
  81367. });
  81368. return result;
  81369. };
  81370. var setHoldBack = function setHoldBack2(manifest) {
  81371. var serverControl = manifest.serverControl, targetDuration = manifest.targetDuration, partTargetDuration = manifest.partTargetDuration;
  81372. if (!serverControl) {
  81373. return;
  81374. }
  81375. var tag = "#EXT-X-SERVER-CONTROL";
  81376. var hb = "holdBack";
  81377. var phb = "partHoldBack";
  81378. var minTargetDuration = targetDuration && targetDuration * 3;
  81379. var minPartDuration = partTargetDuration && partTargetDuration * 2;
  81380. if (targetDuration && !serverControl.hasOwnProperty(hb)) {
  81381. serverControl[hb] = minTargetDuration;
  81382. this.trigger("info", {
  81383. message: tag + " defaulting HOLD-BACK to targetDuration * 3 (" + minTargetDuration + ")."
  81384. });
  81385. }
  81386. if (minTargetDuration && serverControl[hb] < minTargetDuration) {
  81387. this.trigger("warn", {
  81388. message: tag + " clamping HOLD-BACK (" + serverControl[hb] + ") to targetDuration * 3 (" + minTargetDuration + ")"
  81389. });
  81390. serverControl[hb] = minTargetDuration;
  81391. }
  81392. if (partTargetDuration && !serverControl.hasOwnProperty(phb)) {
  81393. serverControl[phb] = partTargetDuration * 3;
  81394. this.trigger("info", {
  81395. message: tag + " defaulting PART-HOLD-BACK to partTargetDuration * 3 (" + serverControl[phb] + ")."
  81396. });
  81397. }
  81398. if (partTargetDuration && serverControl[phb] < minPartDuration) {
  81399. this.trigger("warn", {
  81400. message: tag + " clamping PART-HOLD-BACK (" + serverControl[phb] + ") to partTargetDuration * 2 (" + minPartDuration + ")."
  81401. });
  81402. serverControl[phb] = minPartDuration;
  81403. }
  81404. };
  81405. var Parser = /* @__PURE__ */ function(_Stream) {
  81406. _inheritsLoose(Parser2, _Stream);
  81407. function Parser2() {
  81408. var _this;
  81409. _this = _Stream.call(this) || this;
  81410. _this.lineStream = new LineStream();
  81411. _this.parseStream = new ParseStream();
  81412. _this.lineStream.pipe(_this.parseStream);
  81413. var self2 = _assertThisInitialized(_this);
  81414. var uris = [];
  81415. var currentUri = {};
  81416. var currentMap;
  81417. var _key;
  81418. var hasParts = false;
  81419. var noop2 = function noop3() {
  81420. };
  81421. var defaultMediaGroups = {
  81422. "AUDIO": {},
  81423. "VIDEO": {},
  81424. "CLOSED-CAPTIONS": {},
  81425. "SUBTITLES": {}
  81426. };
  81427. var widevineUuid = "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed";
  81428. var currentTimeline = 0;
  81429. _this.manifest = {
  81430. allowCache: true,
  81431. discontinuityStarts: [],
  81432. segments: []
  81433. };
  81434. var lastByterangeEnd = 0;
  81435. var lastPartByterangeEnd = 0;
  81436. _this.on("end", function() {
  81437. if (currentUri.uri || !currentUri.parts && !currentUri.preloadHints) {
  81438. return;
  81439. }
  81440. if (!currentUri.map && currentMap) {
  81441. currentUri.map = currentMap;
  81442. }
  81443. if (!currentUri.key && _key) {
  81444. currentUri.key = _key;
  81445. }
  81446. if (!currentUri.timeline && typeof currentTimeline === "number") {
  81447. currentUri.timeline = currentTimeline;
  81448. }
  81449. _this.manifest.preloadSegment = currentUri;
  81450. });
  81451. _this.parseStream.on("data", function(entry) {
  81452. var mediaGroup;
  81453. var rendition;
  81454. ({
  81455. tag: function tag() {
  81456. ({
  81457. version: function version2() {
  81458. if (entry.version) {
  81459. this.manifest.version = entry.version;
  81460. }
  81461. },
  81462. "allow-cache": function allowCache() {
  81463. this.manifest.allowCache = entry.allowed;
  81464. if (!("allowed" in entry)) {
  81465. this.trigger("info", {
  81466. message: "defaulting allowCache to YES"
  81467. });
  81468. this.manifest.allowCache = true;
  81469. }
  81470. },
  81471. byterange: function byterange() {
  81472. var byterange2 = {};
  81473. if ("length" in entry) {
  81474. currentUri.byterange = byterange2;
  81475. byterange2.length = entry.length;
  81476. if (!("offset" in entry)) {
  81477. entry.offset = lastByterangeEnd;
  81478. }
  81479. }
  81480. if ("offset" in entry) {
  81481. currentUri.byterange = byterange2;
  81482. byterange2.offset = entry.offset;
  81483. }
  81484. lastByterangeEnd = byterange2.offset + byterange2.length;
  81485. },
  81486. endlist: function endlist() {
  81487. this.manifest.endList = true;
  81488. },
  81489. inf: function inf() {
  81490. if (!("mediaSequence" in this.manifest)) {
  81491. this.manifest.mediaSequence = 0;
  81492. this.trigger("info", {
  81493. message: "defaulting media sequence to zero"
  81494. });
  81495. }
  81496. if (!("discontinuitySequence" in this.manifest)) {
  81497. this.manifest.discontinuitySequence = 0;
  81498. this.trigger("info", {
  81499. message: "defaulting discontinuity sequence to zero"
  81500. });
  81501. }
  81502. if (entry.duration > 0) {
  81503. currentUri.duration = entry.duration;
  81504. }
  81505. if (entry.duration === 0) {
  81506. currentUri.duration = 0.01;
  81507. this.trigger("info", {
  81508. message: "updating zero segment duration to a small value"
  81509. });
  81510. }
  81511. this.manifest.segments = uris;
  81512. },
  81513. key: function key() {
  81514. if (!entry.attributes) {
  81515. this.trigger("warn", {
  81516. message: "ignoring key declaration without attribute list"
  81517. });
  81518. return;
  81519. }
  81520. if (entry.attributes.METHOD === "NONE") {
  81521. _key = null;
  81522. return;
  81523. }
  81524. if (!entry.attributes.URI) {
  81525. this.trigger("warn", {
  81526. message: "ignoring key declaration without URI"
  81527. });
  81528. return;
  81529. }
  81530. if (entry.attributes.KEYFORMAT === "com.apple.streamingkeydelivery") {
  81531. this.manifest.contentProtection = this.manifest.contentProtection || {};
  81532. this.manifest.contentProtection["com.apple.fps.1_0"] = {
  81533. attributes: entry.attributes
  81534. };
  81535. return;
  81536. }
  81537. if (entry.attributes.KEYFORMAT === "com.microsoft.playready") {
  81538. this.manifest.contentProtection = this.manifest.contentProtection || {};
  81539. this.manifest.contentProtection["com.microsoft.playready"] = {
  81540. uri: entry.attributes.URI
  81541. };
  81542. return;
  81543. }
  81544. if (entry.attributes.KEYFORMAT === widevineUuid) {
  81545. var VALID_METHODS = ["SAMPLE-AES", "SAMPLE-AES-CTR", "SAMPLE-AES-CENC"];
  81546. if (VALID_METHODS.indexOf(entry.attributes.METHOD) === -1) {
  81547. this.trigger("warn", {
  81548. message: "invalid key method provided for Widevine"
  81549. });
  81550. return;
  81551. }
  81552. if (entry.attributes.METHOD === "SAMPLE-AES-CENC") {
  81553. this.trigger("warn", {
  81554. message: "SAMPLE-AES-CENC is deprecated, please use SAMPLE-AES-CTR instead"
  81555. });
  81556. }
  81557. if (entry.attributes.URI.substring(0, 23) !== "data:text/plain;base64,") {
  81558. this.trigger("warn", {
  81559. message: "invalid key URI provided for Widevine"
  81560. });
  81561. return;
  81562. }
  81563. if (!(entry.attributes.KEYID && entry.attributes.KEYID.substring(0, 2) === "0x")) {
  81564. this.trigger("warn", {
  81565. message: "invalid key ID provided for Widevine"
  81566. });
  81567. return;
  81568. }
  81569. this.manifest.contentProtection = this.manifest.contentProtection || {};
  81570. this.manifest.contentProtection["com.widevine.alpha"] = {
  81571. attributes: {
  81572. schemeIdUri: entry.attributes.KEYFORMAT,
  81573. keyId: entry.attributes.KEYID.substring(2)
  81574. },
  81575. pssh: decodeB64ToUint8Array(entry.attributes.URI.split(",")[1])
  81576. };
  81577. return;
  81578. }
  81579. if (!entry.attributes.METHOD) {
  81580. this.trigger("warn", {
  81581. message: "defaulting key method to AES-128"
  81582. });
  81583. }
  81584. _key = {
  81585. method: entry.attributes.METHOD || "AES-128",
  81586. uri: entry.attributes.URI
  81587. };
  81588. if (typeof entry.attributes.IV !== "undefined") {
  81589. _key.iv = entry.attributes.IV;
  81590. }
  81591. },
  81592. "media-sequence": function mediaSequence() {
  81593. if (!isFinite(entry.number)) {
  81594. this.trigger("warn", {
  81595. message: "ignoring invalid media sequence: " + entry.number
  81596. });
  81597. return;
  81598. }
  81599. this.manifest.mediaSequence = entry.number;
  81600. },
  81601. "discontinuity-sequence": function discontinuitySequence() {
  81602. if (!isFinite(entry.number)) {
  81603. this.trigger("warn", {
  81604. message: "ignoring invalid discontinuity sequence: " + entry.number
  81605. });
  81606. return;
  81607. }
  81608. this.manifest.discontinuitySequence = entry.number;
  81609. currentTimeline = entry.number;
  81610. },
  81611. "playlist-type": function playlistType() {
  81612. if (!/VOD|EVENT/.test(entry.playlistType)) {
  81613. this.trigger("warn", {
  81614. message: "ignoring unknown playlist type: " + entry.playlist
  81615. });
  81616. return;
  81617. }
  81618. this.manifest.playlistType = entry.playlistType;
  81619. },
  81620. map: function map() {
  81621. currentMap = {};
  81622. if (entry.uri) {
  81623. currentMap.uri = entry.uri;
  81624. }
  81625. if (entry.byterange) {
  81626. currentMap.byterange = entry.byterange;
  81627. }
  81628. if (_key) {
  81629. currentMap.key = _key;
  81630. }
  81631. },
  81632. "stream-inf": function streamInf() {
  81633. this.manifest.playlists = uris;
  81634. this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;
  81635. if (!entry.attributes) {
  81636. this.trigger("warn", {
  81637. message: "ignoring empty stream-inf attributes"
  81638. });
  81639. return;
  81640. }
  81641. if (!currentUri.attributes) {
  81642. currentUri.attributes = {};
  81643. }
  81644. _extends$2(currentUri.attributes, entry.attributes);
  81645. },
  81646. media: function media() {
  81647. this.manifest.mediaGroups = this.manifest.mediaGroups || defaultMediaGroups;
  81648. if (!(entry.attributes && entry.attributes.TYPE && entry.attributes["GROUP-ID"] && entry.attributes.NAME)) {
  81649. this.trigger("warn", {
  81650. message: "ignoring incomplete or missing media group"
  81651. });
  81652. return;
  81653. }
  81654. var mediaGroupType = this.manifest.mediaGroups[entry.attributes.TYPE];
  81655. mediaGroupType[entry.attributes["GROUP-ID"]] = mediaGroupType[entry.attributes["GROUP-ID"]] || {};
  81656. mediaGroup = mediaGroupType[entry.attributes["GROUP-ID"]];
  81657. rendition = {
  81658. default: /yes/i.test(entry.attributes.DEFAULT)
  81659. };
  81660. if (rendition.default) {
  81661. rendition.autoselect = true;
  81662. } else {
  81663. rendition.autoselect = /yes/i.test(entry.attributes.AUTOSELECT);
  81664. }
  81665. if (entry.attributes.LANGUAGE) {
  81666. rendition.language = entry.attributes.LANGUAGE;
  81667. }
  81668. if (entry.attributes.URI) {
  81669. rendition.uri = entry.attributes.URI;
  81670. }
  81671. if (entry.attributes["INSTREAM-ID"]) {
  81672. rendition.instreamId = entry.attributes["INSTREAM-ID"];
  81673. }
  81674. if (entry.attributes.CHARACTERISTICS) {
  81675. rendition.characteristics = entry.attributes.CHARACTERISTICS;
  81676. }
  81677. if (entry.attributes.FORCED) {
  81678. rendition.forced = /yes/i.test(entry.attributes.FORCED);
  81679. }
  81680. mediaGroup[entry.attributes.NAME] = rendition;
  81681. },
  81682. discontinuity: function discontinuity() {
  81683. currentTimeline += 1;
  81684. currentUri.discontinuity = true;
  81685. this.manifest.discontinuityStarts.push(uris.length);
  81686. },
  81687. "program-date-time": function programDateTime() {
  81688. if (typeof this.manifest.dateTimeString === "undefined") {
  81689. this.manifest.dateTimeString = entry.dateTimeString;
  81690. this.manifest.dateTimeObject = entry.dateTimeObject;
  81691. }
  81692. currentUri.dateTimeString = entry.dateTimeString;
  81693. currentUri.dateTimeObject = entry.dateTimeObject;
  81694. },
  81695. targetduration: function targetduration() {
  81696. if (!isFinite(entry.duration) || entry.duration < 0) {
  81697. this.trigger("warn", {
  81698. message: "ignoring invalid target duration: " + entry.duration
  81699. });
  81700. return;
  81701. }
  81702. this.manifest.targetDuration = entry.duration;
  81703. setHoldBack.call(this, this.manifest);
  81704. },
  81705. start: function start2() {
  81706. if (!entry.attributes || isNaN(entry.attributes["TIME-OFFSET"])) {
  81707. this.trigger("warn", {
  81708. message: "ignoring start declaration without appropriate attribute list"
  81709. });
  81710. return;
  81711. }
  81712. this.manifest.start = {
  81713. timeOffset: entry.attributes["TIME-OFFSET"],
  81714. precise: entry.attributes.PRECISE
  81715. };
  81716. },
  81717. "cue-out": function cueOut() {
  81718. currentUri.cueOut = entry.data;
  81719. },
  81720. "cue-out-cont": function cueOutCont() {
  81721. currentUri.cueOutCont = entry.data;
  81722. },
  81723. "cue-in": function cueIn() {
  81724. currentUri.cueIn = entry.data;
  81725. },
  81726. "skip": function skip() {
  81727. this.manifest.skip = camelCaseKeys(entry.attributes);
  81728. this.warnOnMissingAttributes_("#EXT-X-SKIP", entry.attributes, ["SKIPPED-SEGMENTS"]);
  81729. },
  81730. "part": function part() {
  81731. var _this2 = this;
  81732. hasParts = true;
  81733. var segmentIndex = this.manifest.segments.length;
  81734. var part2 = camelCaseKeys(entry.attributes);
  81735. currentUri.parts = currentUri.parts || [];
  81736. currentUri.parts.push(part2);
  81737. if (part2.byterange) {
  81738. if (!part2.byterange.hasOwnProperty("offset")) {
  81739. part2.byterange.offset = lastPartByterangeEnd;
  81740. }
  81741. lastPartByterangeEnd = part2.byterange.offset + part2.byterange.length;
  81742. }
  81743. var partIndex = currentUri.parts.length - 1;
  81744. this.warnOnMissingAttributes_("#EXT-X-PART #" + partIndex + " for segment #" + segmentIndex, entry.attributes, ["URI", "DURATION"]);
  81745. if (this.manifest.renditionReports) {
  81746. this.manifest.renditionReports.forEach(function(r2, i2) {
  81747. if (!r2.hasOwnProperty("lastPart")) {
  81748. _this2.trigger("warn", {
  81749. message: "#EXT-X-RENDITION-REPORT #" + i2 + " lacks required attribute(s): LAST-PART"
  81750. });
  81751. }
  81752. });
  81753. }
  81754. },
  81755. "server-control": function serverControl() {
  81756. var attrs = this.manifest.serverControl = camelCaseKeys(entry.attributes);
  81757. if (!attrs.hasOwnProperty("canBlockReload")) {
  81758. attrs.canBlockReload = false;
  81759. this.trigger("info", {
  81760. message: "#EXT-X-SERVER-CONTROL defaulting CAN-BLOCK-RELOAD to false"
  81761. });
  81762. }
  81763. setHoldBack.call(this, this.manifest);
  81764. if (attrs.canSkipDateranges && !attrs.hasOwnProperty("canSkipUntil")) {
  81765. this.trigger("warn", {
  81766. message: "#EXT-X-SERVER-CONTROL lacks required attribute CAN-SKIP-UNTIL which is required when CAN-SKIP-DATERANGES is set"
  81767. });
  81768. }
  81769. },
  81770. "preload-hint": function preloadHint() {
  81771. var segmentIndex = this.manifest.segments.length;
  81772. var hint = camelCaseKeys(entry.attributes);
  81773. var isPart = hint.type && hint.type === "PART";
  81774. currentUri.preloadHints = currentUri.preloadHints || [];
  81775. currentUri.preloadHints.push(hint);
  81776. if (hint.byterange) {
  81777. if (!hint.byterange.hasOwnProperty("offset")) {
  81778. hint.byterange.offset = isPart ? lastPartByterangeEnd : 0;
  81779. if (isPart) {
  81780. lastPartByterangeEnd = hint.byterange.offset + hint.byterange.length;
  81781. }
  81782. }
  81783. }
  81784. var index2 = currentUri.preloadHints.length - 1;
  81785. this.warnOnMissingAttributes_("#EXT-X-PRELOAD-HINT #" + index2 + " for segment #" + segmentIndex, entry.attributes, ["TYPE", "URI"]);
  81786. if (!hint.type) {
  81787. return;
  81788. }
  81789. for (var i2 = 0; i2 < currentUri.preloadHints.length - 1; i2++) {
  81790. var otherHint = currentUri.preloadHints[i2];
  81791. if (!otherHint.type) {
  81792. continue;
  81793. }
  81794. if (otherHint.type === hint.type) {
  81795. this.trigger("warn", {
  81796. message: "#EXT-X-PRELOAD-HINT #" + index2 + " for segment #" + segmentIndex + " has the same TYPE " + hint.type + " as preload hint #" + i2
  81797. });
  81798. }
  81799. }
  81800. },
  81801. "rendition-report": function renditionReport() {
  81802. var report = camelCaseKeys(entry.attributes);
  81803. this.manifest.renditionReports = this.manifest.renditionReports || [];
  81804. this.manifest.renditionReports.push(report);
  81805. var index2 = this.manifest.renditionReports.length - 1;
  81806. var required = ["LAST-MSN", "URI"];
  81807. if (hasParts) {
  81808. required.push("LAST-PART");
  81809. }
  81810. this.warnOnMissingAttributes_("#EXT-X-RENDITION-REPORT #" + index2, entry.attributes, required);
  81811. },
  81812. "part-inf": function partInf() {
  81813. this.manifest.partInf = camelCaseKeys(entry.attributes);
  81814. this.warnOnMissingAttributes_("#EXT-X-PART-INF", entry.attributes, ["PART-TARGET"]);
  81815. if (this.manifest.partInf.partTarget) {
  81816. this.manifest.partTargetDuration = this.manifest.partInf.partTarget;
  81817. }
  81818. setHoldBack.call(this, this.manifest);
  81819. }
  81820. }[entry.tagType] || noop2).call(self2);
  81821. },
  81822. uri: function uri() {
  81823. currentUri.uri = entry.uri;
  81824. uris.push(currentUri);
  81825. if (this.manifest.targetDuration && !("duration" in currentUri)) {
  81826. this.trigger("warn", {
  81827. message: "defaulting segment duration to the target duration"
  81828. });
  81829. currentUri.duration = this.manifest.targetDuration;
  81830. }
  81831. if (_key) {
  81832. currentUri.key = _key;
  81833. }
  81834. currentUri.timeline = currentTimeline;
  81835. if (currentMap) {
  81836. currentUri.map = currentMap;
  81837. }
  81838. lastPartByterangeEnd = 0;
  81839. currentUri = {};
  81840. },
  81841. comment: function comment() {
  81842. },
  81843. custom: function custom() {
  81844. if (entry.segment) {
  81845. currentUri.custom = currentUri.custom || {};
  81846. currentUri.custom[entry.customType] = entry.data;
  81847. } else {
  81848. this.manifest.custom = this.manifest.custom || {};
  81849. this.manifest.custom[entry.customType] = entry.data;
  81850. }
  81851. }
  81852. })[entry.type].call(self2);
  81853. });
  81854. return _this;
  81855. }
  81856. var _proto = Parser2.prototype;
  81857. _proto.warnOnMissingAttributes_ = function warnOnMissingAttributes_(identifier, attributes, required) {
  81858. var missing = [];
  81859. required.forEach(function(key) {
  81860. if (!attributes.hasOwnProperty(key)) {
  81861. missing.push(key);
  81862. }
  81863. });
  81864. if (missing.length) {
  81865. this.trigger("warn", {
  81866. message: identifier + " lacks required attribute(s): " + missing.join(", ")
  81867. });
  81868. }
  81869. };
  81870. _proto.push = function push(chunk) {
  81871. this.lineStream.push(chunk);
  81872. };
  81873. _proto.end = function end() {
  81874. this.lineStream.push("\n");
  81875. this.trigger("end");
  81876. };
  81877. _proto.addParser = function addParser(options2) {
  81878. this.parseStream.addParser(options2);
  81879. };
  81880. _proto.addTagMapper = function addTagMapper(options2) {
  81881. this.parseStream.addTagMapper(options2);
  81882. };
  81883. return Parser2;
  81884. }(Stream);
  81885. var regexs = {
  81886. mp4: /^(av0?1|avc0?[1234]|vp0?9|flac|opus|mp3|mp4a|mp4v|stpp.ttml.im1t)/,
  81887. webm: /^(vp0?[89]|av0?1|opus|vorbis)/,
  81888. ogg: /^(vp0?[89]|theora|flac|opus|vorbis)/,
  81889. video: /^(av0?1|avc0?[1234]|vp0?[89]|hvc1|hev1|theora|mp4v)/,
  81890. audio: /^(mp4a|flac|vorbis|opus|ac-[34]|ec-3|alac|mp3|speex|aac)/,
  81891. text: /^(stpp.ttml.im1t)/,
  81892. muxerVideo: /^(avc0?1)/,
  81893. muxerAudio: /^(mp4a)/,
  81894. muxerText: /a^/
  81895. };
  81896. var mediaTypes = ["video", "audio", "text"];
  81897. var upperMediaTypes = ["Video", "Audio", "Text"];
  81898. var translateLegacyCodec2 = function translateLegacyCodec3(codec) {
  81899. if (!codec) {
  81900. return codec;
  81901. }
  81902. return codec.replace(/avc1\.(\d+)\.(\d+)/i, function(orig, profile, avcLevel) {
  81903. var profileHex = ("00" + Number(profile).toString(16)).slice(-2);
  81904. var avcLevelHex = ("00" + Number(avcLevel).toString(16)).slice(-2);
  81905. return "avc1." + profileHex + "00" + avcLevelHex;
  81906. });
  81907. };
  81908. var parseCodecs2 = function parseCodecs3(codecString) {
  81909. if (codecString === void 0) {
  81910. codecString = "";
  81911. }
  81912. var codecs = codecString.split(",");
  81913. var result = [];
  81914. codecs.forEach(function(codec) {
  81915. codec = codec.trim();
  81916. var codecType;
  81917. mediaTypes.forEach(function(name) {
  81918. var match = regexs[name].exec(codec.toLowerCase());
  81919. if (!match || match.length <= 1) {
  81920. return;
  81921. }
  81922. codecType = name;
  81923. var type2 = codec.substring(0, match[1].length);
  81924. var details = codec.replace(type2, "");
  81925. result.push({
  81926. type: type2,
  81927. details,
  81928. mediaType: name
  81929. });
  81930. });
  81931. if (!codecType) {
  81932. result.push({
  81933. type: codec,
  81934. details: "",
  81935. mediaType: "unknown"
  81936. });
  81937. }
  81938. });
  81939. return result;
  81940. };
  81941. var codecsFromDefault2 = function codecsFromDefault3(master, audioGroupId) {
  81942. if (!master.mediaGroups.AUDIO || !audioGroupId) {
  81943. return null;
  81944. }
  81945. var audioGroup = master.mediaGroups.AUDIO[audioGroupId];
  81946. if (!audioGroup) {
  81947. return null;
  81948. }
  81949. for (var name in audioGroup) {
  81950. var audioType = audioGroup[name];
  81951. if (audioType.default && audioType.playlists) {
  81952. return parseCodecs2(audioType.playlists[0].attributes.CODECS);
  81953. }
  81954. }
  81955. return null;
  81956. };
  81957. var isAudioCodec2 = function isAudioCodec3(codec) {
  81958. if (codec === void 0) {
  81959. codec = "";
  81960. }
  81961. return regexs.audio.test(codec.trim().toLowerCase());
  81962. };
  81963. var isTextCodec2 = function isTextCodec3(codec) {
  81964. if (codec === void 0) {
  81965. codec = "";
  81966. }
  81967. return regexs.text.test(codec.trim().toLowerCase());
  81968. };
  81969. var getMimeForCodec2 = function getMimeForCodec3(codecString) {
  81970. if (!codecString || typeof codecString !== "string") {
  81971. return;
  81972. }
  81973. var codecs = codecString.toLowerCase().split(",").map(function(c) {
  81974. return translateLegacyCodec2(c.trim());
  81975. });
  81976. var type2 = "video";
  81977. if (codecs.length === 1 && isAudioCodec2(codecs[0])) {
  81978. type2 = "audio";
  81979. } else if (codecs.length === 1 && isTextCodec2(codecs[0])) {
  81980. type2 = "application";
  81981. }
  81982. var container = "mp4";
  81983. if (codecs.every(function(c) {
  81984. return regexs.mp4.test(c);
  81985. })) {
  81986. container = "mp4";
  81987. } else if (codecs.every(function(c) {
  81988. return regexs.webm.test(c);
  81989. })) {
  81990. container = "webm";
  81991. } else if (codecs.every(function(c) {
  81992. return regexs.ogg.test(c);
  81993. })) {
  81994. container = "ogg";
  81995. }
  81996. return type2 + "/" + container + ';codecs="' + codecString + '"';
  81997. };
  81998. var browserSupportsCodec2 = function browserSupportsCodec3(codecString) {
  81999. if (codecString === void 0) {
  82000. codecString = "";
  82001. }
  82002. return window_1.MediaSource && window_1.MediaSource.isTypeSupported && window_1.MediaSource.isTypeSupported(getMimeForCodec2(codecString)) || false;
  82003. };
  82004. var muxerSupportsCodec2 = function muxerSupportsCodec3(codecString) {
  82005. if (codecString === void 0) {
  82006. codecString = "";
  82007. }
  82008. return codecString.toLowerCase().split(",").every(function(codec) {
  82009. codec = codec.trim();
  82010. for (var i2 = 0; i2 < upperMediaTypes.length; i2++) {
  82011. var type2 = upperMediaTypes[i2];
  82012. if (regexs["muxer" + type2].test(codec)) {
  82013. return true;
  82014. }
  82015. }
  82016. return false;
  82017. });
  82018. };
  82019. var DEFAULT_AUDIO_CODEC = "mp4a.40.2";
  82020. var DEFAULT_VIDEO_CODEC = "avc1.4d400d";
  82021. var MPEGURL_REGEX = /^(audio|video|application)\/(x-|vnd\.apple\.)?mpegurl/i;
  82022. var DASH_REGEX = /^application\/dash\+xml/i;
  82023. var simpleTypeFromSourceType2 = function simpleTypeFromSourceType3(type2) {
  82024. if (MPEGURL_REGEX.test(type2)) {
  82025. return "hls";
  82026. }
  82027. if (DASH_REGEX.test(type2)) {
  82028. return "dash";
  82029. }
  82030. if (type2 === "application/vnd.videojs.vhs+json") {
  82031. return "vhs-json";
  82032. }
  82033. return null;
  82034. };
  82035. var countBits2 = function countBits3(x) {
  82036. return x.toString(2).length;
  82037. };
  82038. var countBytes2 = function countBytes3(x) {
  82039. return Math.ceil(countBits2(x) / 8);
  82040. };
  82041. var isArrayBufferView2 = function isArrayBufferView3(obj) {
  82042. if (ArrayBuffer.isView === "function") {
  82043. return ArrayBuffer.isView(obj);
  82044. }
  82045. return obj && obj.buffer instanceof ArrayBuffer;
  82046. };
  82047. var isTypedArray2 = function isTypedArray3(obj) {
  82048. return isArrayBufferView2(obj);
  82049. };
  82050. var toUint82 = function toUint83(bytes) {
  82051. if (bytes instanceof Uint8Array) {
  82052. return bytes;
  82053. }
  82054. if (!Array.isArray(bytes) && !isTypedArray2(bytes) && !(bytes instanceof ArrayBuffer)) {
  82055. if (typeof bytes !== "number" || typeof bytes === "number" && bytes !== bytes) {
  82056. bytes = 0;
  82057. } else {
  82058. bytes = [bytes];
  82059. }
  82060. }
  82061. return new Uint8Array(bytes && bytes.buffer || bytes, bytes && bytes.byteOffset || 0, bytes && bytes.byteLength || 0);
  82062. };
  82063. var BigInt = window_1.BigInt || Number;
  82064. var BYTE_TABLE = [BigInt("0x1"), BigInt("0x100"), BigInt("0x10000"), BigInt("0x1000000"), BigInt("0x100000000"), BigInt("0x10000000000"), BigInt("0x1000000000000"), BigInt("0x100000000000000"), BigInt("0x10000000000000000")];
  82065. (function() {
  82066. var a = new Uint16Array([65484]);
  82067. var b = new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
  82068. if (b[0] === 255) {
  82069. return "big";
  82070. }
  82071. if (b[0] === 204) {
  82072. return "little";
  82073. }
  82074. return "unknown";
  82075. })();
  82076. var bytesToNumber2 = function bytesToNumber3(bytes, _temp) {
  82077. var _ref = _temp === void 0 ? {} : _temp, _ref$signed = _ref.signed, signed = _ref$signed === void 0 ? false : _ref$signed, _ref$le = _ref.le, le = _ref$le === void 0 ? false : _ref$le;
  82078. bytes = toUint82(bytes);
  82079. var fn2 = le ? "reduce" : "reduceRight";
  82080. var obj = bytes[fn2] ? bytes[fn2] : Array.prototype[fn2];
  82081. var number = obj.call(bytes, function(total, byte, i2) {
  82082. var exponent = le ? i2 : Math.abs(i2 + 1 - bytes.length);
  82083. return total + BigInt(byte) * BYTE_TABLE[exponent];
  82084. }, BigInt(0));
  82085. if (signed) {
  82086. var max2 = BYTE_TABLE[bytes.length] / BigInt(2) - BigInt(1);
  82087. number = BigInt(number);
  82088. if (number > max2) {
  82089. number -= max2;
  82090. number -= max2;
  82091. number -= BigInt(2);
  82092. }
  82093. }
  82094. return Number(number);
  82095. };
  82096. var numberToBytes2 = function numberToBytes3(number, _temp2) {
  82097. var _ref2 = _temp2 === void 0 ? {} : _temp2, _ref2$le = _ref2.le, le = _ref2$le === void 0 ? false : _ref2$le;
  82098. if (typeof number !== "bigint" && typeof number !== "number" || typeof number === "number" && number !== number) {
  82099. number = 0;
  82100. }
  82101. number = BigInt(number);
  82102. var byteCount = countBytes2(number);
  82103. var bytes = new Uint8Array(new ArrayBuffer(byteCount));
  82104. for (var i2 = 0; i2 < byteCount; i2++) {
  82105. var byteIndex = le ? i2 : Math.abs(i2 + 1 - bytes.length);
  82106. bytes[byteIndex] = Number(number / BYTE_TABLE[i2] & BigInt(255));
  82107. if (number < 0) {
  82108. bytes[byteIndex] = Math.abs(~bytes[byteIndex]);
  82109. bytes[byteIndex] -= i2 === 0 ? 1 : 2;
  82110. }
  82111. }
  82112. return bytes;
  82113. };
  82114. var stringToBytes2 = function stringToBytes3(string, stringIsBytes) {
  82115. if (typeof string !== "string" && string && typeof string.toString === "function") {
  82116. string = string.toString();
  82117. }
  82118. if (typeof string !== "string") {
  82119. return new Uint8Array();
  82120. }
  82121. if (!stringIsBytes) {
  82122. string = unescape(encodeURIComponent(string));
  82123. }
  82124. var view = new Uint8Array(string.length);
  82125. for (var i2 = 0; i2 < string.length; i2++) {
  82126. view[i2] = string.charCodeAt(i2);
  82127. }
  82128. return view;
  82129. };
  82130. var concatTypedArrays2 = function concatTypedArrays3() {
  82131. for (var _len = arguments.length, buffers = new Array(_len), _key = 0; _key < _len; _key++) {
  82132. buffers[_key] = arguments[_key];
  82133. }
  82134. buffers = buffers.filter(function(b) {
  82135. return b && (b.byteLength || b.length) && typeof b !== "string";
  82136. });
  82137. if (buffers.length <= 1) {
  82138. return toUint82(buffers[0]);
  82139. }
  82140. var totalLen = buffers.reduce(function(total, buf, i2) {
  82141. return total + (buf.byteLength || buf.length);
  82142. }, 0);
  82143. var tempBuffer = new Uint8Array(totalLen);
  82144. var offset = 0;
  82145. buffers.forEach(function(buf) {
  82146. buf = toUint82(buf);
  82147. tempBuffer.set(buf, offset);
  82148. offset += buf.byteLength;
  82149. });
  82150. return tempBuffer;
  82151. };
  82152. var bytesMatch2 = function bytesMatch3(a, b, _temp3) {
  82153. var _ref3 = _temp3 === void 0 ? {} : _temp3, _ref3$offset = _ref3.offset, offset = _ref3$offset === void 0 ? 0 : _ref3$offset, _ref3$mask = _ref3.mask, mask = _ref3$mask === void 0 ? [] : _ref3$mask;
  82154. a = toUint82(a);
  82155. b = toUint82(b);
  82156. var fn2 = b.every ? b.every : Array.prototype.every;
  82157. return b.length && a.length - offset >= b.length && fn2.call(b, function(bByte, i2) {
  82158. var aByte = mask[i2] ? mask[i2] & a[offset + i2] : a[offset + i2];
  82159. return bByte === aByte;
  82160. });
  82161. };
  82162. var forEachMediaGroup$1 = function forEachMediaGroup2(master, groups, callback2) {
  82163. groups.forEach(function(mediaType) {
  82164. for (var groupKey in master.mediaGroups[mediaType]) {
  82165. for (var labelKey in master.mediaGroups[mediaType][groupKey]) {
  82166. var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];
  82167. callback2(mediaProperties, mediaType, groupKey, labelKey);
  82168. }
  82169. }
  82170. });
  82171. };
  82172. /*! @name mpd-parser @version 0.22.1 @license Apache-2.0 */
  82173. var isObject$1 = function isObject(obj) {
  82174. return !!obj && typeof obj === "object";
  82175. };
  82176. var merge = function merge2() {
  82177. for (var _len = arguments.length, objects = new Array(_len), _key = 0; _key < _len; _key++) {
  82178. objects[_key] = arguments[_key];
  82179. }
  82180. return objects.reduce(function(result, source) {
  82181. if (typeof source !== "object") {
  82182. return result;
  82183. }
  82184. Object.keys(source).forEach(function(key) {
  82185. if (Array.isArray(result[key]) && Array.isArray(source[key])) {
  82186. result[key] = result[key].concat(source[key]);
  82187. } else if (isObject$1(result[key]) && isObject$1(source[key])) {
  82188. result[key] = merge2(result[key], source[key]);
  82189. } else {
  82190. result[key] = source[key];
  82191. }
  82192. });
  82193. return result;
  82194. }, {});
  82195. };
  82196. var values = function values2(o) {
  82197. return Object.keys(o).map(function(k) {
  82198. return o[k];
  82199. });
  82200. };
  82201. var range = function range2(start2, end) {
  82202. var result = [];
  82203. for (var i2 = start2; i2 < end; i2++) {
  82204. result.push(i2);
  82205. }
  82206. return result;
  82207. };
  82208. var flatten = function flatten2(lists) {
  82209. return lists.reduce(function(x, y) {
  82210. return x.concat(y);
  82211. }, []);
  82212. };
  82213. var from = function from2(list) {
  82214. if (!list.length) {
  82215. return [];
  82216. }
  82217. var result = [];
  82218. for (var i2 = 0; i2 < list.length; i2++) {
  82219. result.push(list[i2]);
  82220. }
  82221. return result;
  82222. };
  82223. var findIndexes = function findIndexes2(l, key) {
  82224. return l.reduce(function(a, e, i2) {
  82225. if (e[key]) {
  82226. a.push(i2);
  82227. }
  82228. return a;
  82229. }, []);
  82230. };
  82231. var findIndex = function findIndex2(list, matchingFunction) {
  82232. for (var i2 = 0; i2 < list.length; i2++) {
  82233. if (matchingFunction(list[i2])) {
  82234. return i2;
  82235. }
  82236. }
  82237. return -1;
  82238. };
  82239. var union = function union2(lists, keyFunction) {
  82240. return values(lists.reduce(function(acc, list) {
  82241. list.forEach(function(el) {
  82242. acc[keyFunction(el)] = el;
  82243. });
  82244. return acc;
  82245. }, {}));
  82246. };
  82247. var errors = {
  82248. INVALID_NUMBER_OF_PERIOD: "INVALID_NUMBER_OF_PERIOD",
  82249. DASH_EMPTY_MANIFEST: "DASH_EMPTY_MANIFEST",
  82250. DASH_INVALID_XML: "DASH_INVALID_XML",
  82251. NO_BASE_URL: "NO_BASE_URL",
  82252. MISSING_SEGMENT_INFORMATION: "MISSING_SEGMENT_INFORMATION",
  82253. SEGMENT_TIME_UNSPECIFIED: "SEGMENT_TIME_UNSPECIFIED",
  82254. UNSUPPORTED_UTC_TIMING_SCHEME: "UNSUPPORTED_UTC_TIMING_SCHEME"
  82255. };
  82256. var urlTypeToSegment = function urlTypeToSegment2(_ref) {
  82257. var _ref$baseUrl = _ref.baseUrl, baseUrl = _ref$baseUrl === void 0 ? "" : _ref$baseUrl, _ref$source = _ref.source, source = _ref$source === void 0 ? "" : _ref$source, _ref$range = _ref.range, range3 = _ref$range === void 0 ? "" : _ref$range, _ref$indexRange = _ref.indexRange, indexRange = _ref$indexRange === void 0 ? "" : _ref$indexRange;
  82258. var segment = {
  82259. uri: source,
  82260. resolvedUri: resolveUrl$1(baseUrl || "", source)
  82261. };
  82262. if (range3 || indexRange) {
  82263. var rangeStr = range3 ? range3 : indexRange;
  82264. var ranges = rangeStr.split("-");
  82265. var startRange = window_1.BigInt ? window_1.BigInt(ranges[0]) : parseInt(ranges[0], 10);
  82266. var endRange = window_1.BigInt ? window_1.BigInt(ranges[1]) : parseInt(ranges[1], 10);
  82267. if (startRange < Number.MAX_SAFE_INTEGER && typeof startRange === "bigint") {
  82268. startRange = Number(startRange);
  82269. }
  82270. if (endRange < Number.MAX_SAFE_INTEGER && typeof endRange === "bigint") {
  82271. endRange = Number(endRange);
  82272. }
  82273. var length;
  82274. if (typeof endRange === "bigint" || typeof startRange === "bigint") {
  82275. length = window_1.BigInt(endRange) - window_1.BigInt(startRange) + window_1.BigInt(1);
  82276. } else {
  82277. length = endRange - startRange + 1;
  82278. }
  82279. if (typeof length === "bigint" && length < Number.MAX_SAFE_INTEGER) {
  82280. length = Number(length);
  82281. }
  82282. segment.byterange = {
  82283. length,
  82284. offset: startRange
  82285. };
  82286. }
  82287. return segment;
  82288. };
  82289. var byteRangeToString = function byteRangeToString2(byterange) {
  82290. var endRange;
  82291. if (typeof byterange.offset === "bigint" || typeof byterange.length === "bigint") {
  82292. endRange = window_1.BigInt(byterange.offset) + window_1.BigInt(byterange.length) - window_1.BigInt(1);
  82293. } else {
  82294. endRange = byterange.offset + byterange.length - 1;
  82295. }
  82296. return byterange.offset + "-" + endRange;
  82297. };
  82298. var parseEndNumber = function parseEndNumber2(endNumber) {
  82299. if (endNumber && typeof endNumber !== "number") {
  82300. endNumber = parseInt(endNumber, 10);
  82301. }
  82302. if (isNaN(endNumber)) {
  82303. return null;
  82304. }
  82305. return endNumber;
  82306. };
  82307. var segmentRange = {
  82308. static: function _static(attributes) {
  82309. var duration5 = attributes.duration, _attributes$timescale = attributes.timescale, timescale2 = _attributes$timescale === void 0 ? 1 : _attributes$timescale, sourceDuration = attributes.sourceDuration, periodDuration = attributes.periodDuration;
  82310. var endNumber = parseEndNumber(attributes.endNumber);
  82311. var segmentDuration = duration5 / timescale2;
  82312. if (typeof endNumber === "number") {
  82313. return {
  82314. start: 0,
  82315. end: endNumber
  82316. };
  82317. }
  82318. if (typeof periodDuration === "number") {
  82319. return {
  82320. start: 0,
  82321. end: periodDuration / segmentDuration
  82322. };
  82323. }
  82324. return {
  82325. start: 0,
  82326. end: sourceDuration / segmentDuration
  82327. };
  82328. },
  82329. dynamic: function dynamic(attributes) {
  82330. var NOW = attributes.NOW, clientOffset = attributes.clientOffset, availabilityStartTime2 = attributes.availabilityStartTime, _attributes$timescale2 = attributes.timescale, timescale2 = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, duration5 = attributes.duration, _attributes$periodSta = attributes.periodStart, periodStart = _attributes$periodSta === void 0 ? 0 : _attributes$periodSta, _attributes$minimumUp = attributes.minimumUpdatePeriod, minimumUpdatePeriod2 = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp, _attributes$timeShift = attributes.timeShiftBufferDepth, timeShiftBufferDepth2 = _attributes$timeShift === void 0 ? Infinity : _attributes$timeShift;
  82331. var endNumber = parseEndNumber(attributes.endNumber);
  82332. var now2 = (NOW + clientOffset) / 1e3;
  82333. var periodStartWC = availabilityStartTime2 + periodStart;
  82334. var periodEndWC = now2 + minimumUpdatePeriod2;
  82335. var periodDuration = periodEndWC - periodStartWC;
  82336. var segmentCount = Math.ceil(periodDuration * timescale2 / duration5);
  82337. var availableStart = Math.floor((now2 - periodStartWC - timeShiftBufferDepth2) * timescale2 / duration5);
  82338. var availableEnd = Math.floor((now2 - periodStartWC) * timescale2 / duration5);
  82339. return {
  82340. start: Math.max(0, availableStart),
  82341. end: typeof endNumber === "number" ? endNumber : Math.min(segmentCount, availableEnd)
  82342. };
  82343. }
  82344. };
  82345. var toSegments = function toSegments2(attributes) {
  82346. return function(number) {
  82347. var duration5 = attributes.duration, _attributes$timescale3 = attributes.timescale, timescale2 = _attributes$timescale3 === void 0 ? 1 : _attributes$timescale3, periodStart = attributes.periodStart, _attributes$startNumb = attributes.startNumber, startNumber2 = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb;
  82348. return {
  82349. number: startNumber2 + number,
  82350. duration: duration5 / timescale2,
  82351. timeline: periodStart,
  82352. time: number * duration5
  82353. };
  82354. };
  82355. };
  82356. var parseByDuration = function parseByDuration2(attributes) {
  82357. var type2 = attributes.type, duration5 = attributes.duration, _attributes$timescale4 = attributes.timescale, timescale2 = _attributes$timescale4 === void 0 ? 1 : _attributes$timescale4, periodDuration = attributes.periodDuration, sourceDuration = attributes.sourceDuration;
  82358. var _segmentRange$type = segmentRange[type2](attributes), start2 = _segmentRange$type.start, end = _segmentRange$type.end;
  82359. var segments = range(start2, end).map(toSegments(attributes));
  82360. if (type2 === "static") {
  82361. var index2 = segments.length - 1;
  82362. var sectionDuration = typeof periodDuration === "number" ? periodDuration : sourceDuration;
  82363. segments[index2].duration = sectionDuration - duration5 / timescale2 * index2;
  82364. }
  82365. return segments;
  82366. };
  82367. var segmentsFromBase = function segmentsFromBase2(attributes) {
  82368. var baseUrl = attributes.baseUrl, _attributes$initializ = attributes.initialization, initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ, sourceDuration = attributes.sourceDuration, _attributes$indexRang = attributes.indexRange, indexRange = _attributes$indexRang === void 0 ? "" : _attributes$indexRang, periodStart = attributes.periodStart, presentationTime = attributes.presentationTime, _attributes$number = attributes.number, number = _attributes$number === void 0 ? 0 : _attributes$number, duration5 = attributes.duration;
  82369. if (!baseUrl) {
  82370. throw new Error(errors.NO_BASE_URL);
  82371. }
  82372. var initSegment = urlTypeToSegment({
  82373. baseUrl,
  82374. source: initialization.sourceURL,
  82375. range: initialization.range
  82376. });
  82377. var segment = urlTypeToSegment({
  82378. baseUrl,
  82379. source: baseUrl,
  82380. indexRange
  82381. });
  82382. segment.map = initSegment;
  82383. if (duration5) {
  82384. var segmentTimeInfo = parseByDuration(attributes);
  82385. if (segmentTimeInfo.length) {
  82386. segment.duration = segmentTimeInfo[0].duration;
  82387. segment.timeline = segmentTimeInfo[0].timeline;
  82388. }
  82389. } else if (sourceDuration) {
  82390. segment.duration = sourceDuration;
  82391. segment.timeline = periodStart;
  82392. }
  82393. segment.presentationTime = presentationTime || periodStart;
  82394. segment.number = number;
  82395. return [segment];
  82396. };
  82397. var addSidxSegmentsToPlaylist$1 = function addSidxSegmentsToPlaylist(playlist, sidx, baseUrl) {
  82398. var initSegment = playlist.sidx.map ? playlist.sidx.map : null;
  82399. var sourceDuration = playlist.sidx.duration;
  82400. var timeline = playlist.timeline || 0;
  82401. var sidxByteRange = playlist.sidx.byterange;
  82402. var sidxEnd = sidxByteRange.offset + sidxByteRange.length;
  82403. var timescale2 = sidx.timescale;
  82404. var mediaReferences = sidx.references.filter(function(r2) {
  82405. return r2.referenceType !== 1;
  82406. });
  82407. var segments = [];
  82408. var type2 = playlist.endList ? "static" : "dynamic";
  82409. var periodStart = playlist.sidx.timeline;
  82410. var presentationTime = periodStart;
  82411. var number = playlist.mediaSequence || 0;
  82412. var startIndex;
  82413. if (typeof sidx.firstOffset === "bigint") {
  82414. startIndex = window_1.BigInt(sidxEnd) + sidx.firstOffset;
  82415. } else {
  82416. startIndex = sidxEnd + sidx.firstOffset;
  82417. }
  82418. for (var i2 = 0; i2 < mediaReferences.length; i2++) {
  82419. var reference = sidx.references[i2];
  82420. var size = reference.referencedSize;
  82421. var duration5 = reference.subsegmentDuration;
  82422. var endIndex = void 0;
  82423. if (typeof startIndex === "bigint") {
  82424. endIndex = startIndex + window_1.BigInt(size) - window_1.BigInt(1);
  82425. } else {
  82426. endIndex = startIndex + size - 1;
  82427. }
  82428. var indexRange = startIndex + "-" + endIndex;
  82429. var attributes = {
  82430. baseUrl,
  82431. timescale: timescale2,
  82432. timeline,
  82433. periodStart,
  82434. presentationTime,
  82435. number,
  82436. duration: duration5,
  82437. sourceDuration,
  82438. indexRange,
  82439. type: type2
  82440. };
  82441. var segment = segmentsFromBase(attributes)[0];
  82442. if (initSegment) {
  82443. segment.map = initSegment;
  82444. }
  82445. segments.push(segment);
  82446. if (typeof startIndex === "bigint") {
  82447. startIndex += window_1.BigInt(size);
  82448. } else {
  82449. startIndex += size;
  82450. }
  82451. presentationTime += duration5 / timescale2;
  82452. number++;
  82453. }
  82454. playlist.segments = segments;
  82455. return playlist;
  82456. };
  82457. var SUPPORTED_MEDIA_TYPES = ["AUDIO", "SUBTITLES"];
  82458. var TIME_FUDGE = 1 / 60;
  82459. var getUniqueTimelineStarts = function getUniqueTimelineStarts2(timelineStarts) {
  82460. return union(timelineStarts, function(_ref) {
  82461. var timeline = _ref.timeline;
  82462. return timeline;
  82463. }).sort(function(a, b) {
  82464. return a.timeline > b.timeline ? 1 : -1;
  82465. });
  82466. };
  82467. var findPlaylistWithName = function findPlaylistWithName2(playlists, name) {
  82468. for (var i2 = 0; i2 < playlists.length; i2++) {
  82469. if (playlists[i2].attributes.NAME === name) {
  82470. return playlists[i2];
  82471. }
  82472. }
  82473. return null;
  82474. };
  82475. var getMediaGroupPlaylists = function getMediaGroupPlaylists2(manifest) {
  82476. var mediaGroupPlaylists = [];
  82477. forEachMediaGroup$1(manifest, SUPPORTED_MEDIA_TYPES, function(properties, type2, group, label) {
  82478. mediaGroupPlaylists = mediaGroupPlaylists.concat(properties.playlists || []);
  82479. });
  82480. return mediaGroupPlaylists;
  82481. };
  82482. var updateMediaSequenceForPlaylist = function updateMediaSequenceForPlaylist2(_ref2) {
  82483. var playlist = _ref2.playlist, mediaSequence = _ref2.mediaSequence;
  82484. playlist.mediaSequence = mediaSequence;
  82485. playlist.segments.forEach(function(segment, index2) {
  82486. segment.number = playlist.mediaSequence + index2;
  82487. });
  82488. };
  82489. var updateSequenceNumbers = function updateSequenceNumbers2(_ref3) {
  82490. var oldPlaylists = _ref3.oldPlaylists, newPlaylists = _ref3.newPlaylists, timelineStarts = _ref3.timelineStarts;
  82491. newPlaylists.forEach(function(playlist) {
  82492. playlist.discontinuitySequence = findIndex(timelineStarts, function(_ref4) {
  82493. var timeline = _ref4.timeline;
  82494. return timeline === playlist.timeline;
  82495. });
  82496. var oldPlaylist = findPlaylistWithName(oldPlaylists, playlist.attributes.NAME);
  82497. if (!oldPlaylist) {
  82498. return;
  82499. }
  82500. if (playlist.sidx) {
  82501. return;
  82502. }
  82503. var firstNewSegment = playlist.segments[0];
  82504. var oldMatchingSegmentIndex = findIndex(oldPlaylist.segments, function(oldSegment) {
  82505. return Math.abs(oldSegment.presentationTime - firstNewSegment.presentationTime) < TIME_FUDGE;
  82506. });
  82507. if (oldMatchingSegmentIndex === -1) {
  82508. updateMediaSequenceForPlaylist({
  82509. playlist,
  82510. mediaSequence: oldPlaylist.mediaSequence + oldPlaylist.segments.length
  82511. });
  82512. playlist.segments[0].discontinuity = true;
  82513. playlist.discontinuityStarts.unshift(0);
  82514. if (!oldPlaylist.segments.length && playlist.timeline > oldPlaylist.timeline || oldPlaylist.segments.length && playlist.timeline > oldPlaylist.segments[oldPlaylist.segments.length - 1].timeline) {
  82515. playlist.discontinuitySequence--;
  82516. }
  82517. return;
  82518. }
  82519. var oldMatchingSegment = oldPlaylist.segments[oldMatchingSegmentIndex];
  82520. if (oldMatchingSegment.discontinuity && !firstNewSegment.discontinuity) {
  82521. firstNewSegment.discontinuity = true;
  82522. playlist.discontinuityStarts.unshift(0);
  82523. playlist.discontinuitySequence--;
  82524. }
  82525. updateMediaSequenceForPlaylist({
  82526. playlist,
  82527. mediaSequence: oldPlaylist.segments[oldMatchingSegmentIndex].number
  82528. });
  82529. });
  82530. };
  82531. var positionManifestOnTimeline = function positionManifestOnTimeline2(_ref5) {
  82532. var oldManifest = _ref5.oldManifest, newManifest = _ref5.newManifest;
  82533. var oldPlaylists = oldManifest.playlists.concat(getMediaGroupPlaylists(oldManifest));
  82534. var newPlaylists = newManifest.playlists.concat(getMediaGroupPlaylists(newManifest));
  82535. newManifest.timelineStarts = getUniqueTimelineStarts([oldManifest.timelineStarts, newManifest.timelineStarts]);
  82536. updateSequenceNumbers({
  82537. oldPlaylists,
  82538. newPlaylists,
  82539. timelineStarts: newManifest.timelineStarts
  82540. });
  82541. return newManifest;
  82542. };
  82543. var generateSidxKey = function generateSidxKey2(sidx) {
  82544. return sidx && sidx.uri + "-" + byteRangeToString(sidx.byterange);
  82545. };
  82546. var mergeDiscontiguousPlaylists = function mergeDiscontiguousPlaylists2(playlists) {
  82547. var mergedPlaylists = values(playlists.reduce(function(acc, playlist) {
  82548. var name = playlist.attributes.id + (playlist.attributes.lang || "");
  82549. if (!acc[name]) {
  82550. acc[name] = playlist;
  82551. acc[name].attributes.timelineStarts = [];
  82552. } else {
  82553. if (playlist.segments) {
  82554. var _acc$name$segments;
  82555. if (playlist.segments[0]) {
  82556. playlist.segments[0].discontinuity = true;
  82557. }
  82558. (_acc$name$segments = acc[name].segments).push.apply(_acc$name$segments, playlist.segments);
  82559. }
  82560. if (playlist.attributes.contentProtection) {
  82561. acc[name].attributes.contentProtection = playlist.attributes.contentProtection;
  82562. }
  82563. }
  82564. acc[name].attributes.timelineStarts.push({
  82565. start: playlist.attributes.periodStart,
  82566. timeline: playlist.attributes.periodStart
  82567. });
  82568. return acc;
  82569. }, {}));
  82570. return mergedPlaylists.map(function(playlist) {
  82571. playlist.discontinuityStarts = findIndexes(playlist.segments || [], "discontinuity");
  82572. return playlist;
  82573. });
  82574. };
  82575. var addSidxSegmentsToPlaylist2 = function addSidxSegmentsToPlaylist3(playlist, sidxMapping) {
  82576. var sidxKey = generateSidxKey(playlist.sidx);
  82577. var sidxMatch = sidxKey && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx;
  82578. if (sidxMatch) {
  82579. addSidxSegmentsToPlaylist$1(playlist, sidxMatch, playlist.sidx.resolvedUri);
  82580. }
  82581. return playlist;
  82582. };
  82583. var addSidxSegmentsToPlaylists = function addSidxSegmentsToPlaylists2(playlists, sidxMapping) {
  82584. if (sidxMapping === void 0) {
  82585. sidxMapping = {};
  82586. }
  82587. if (!Object.keys(sidxMapping).length) {
  82588. return playlists;
  82589. }
  82590. for (var i2 in playlists) {
  82591. playlists[i2] = addSidxSegmentsToPlaylist2(playlists[i2], sidxMapping);
  82592. }
  82593. return playlists;
  82594. };
  82595. var formatAudioPlaylist = function formatAudioPlaylist2(_ref, isAudioOnly3) {
  82596. var _attributes;
  82597. var attributes = _ref.attributes, segments = _ref.segments, sidx = _ref.sidx, mediaSequence = _ref.mediaSequence, discontinuitySequence = _ref.discontinuitySequence, discontinuityStarts = _ref.discontinuityStarts;
  82598. var playlist = {
  82599. attributes: (_attributes = {
  82600. NAME: attributes.id,
  82601. BANDWIDTH: attributes.bandwidth,
  82602. CODECS: attributes.codecs
  82603. }, _attributes["PROGRAM-ID"] = 1, _attributes),
  82604. uri: "",
  82605. endList: attributes.type === "static",
  82606. timeline: attributes.periodStart,
  82607. resolvedUri: "",
  82608. targetDuration: attributes.duration,
  82609. discontinuitySequence,
  82610. discontinuityStarts,
  82611. timelineStarts: attributes.timelineStarts,
  82612. mediaSequence,
  82613. segments
  82614. };
  82615. if (attributes.contentProtection) {
  82616. playlist.contentProtection = attributes.contentProtection;
  82617. }
  82618. if (sidx) {
  82619. playlist.sidx = sidx;
  82620. }
  82621. if (isAudioOnly3) {
  82622. playlist.attributes.AUDIO = "audio";
  82623. playlist.attributes.SUBTITLES = "subs";
  82624. }
  82625. return playlist;
  82626. };
  82627. var formatVttPlaylist = function formatVttPlaylist2(_ref2) {
  82628. var _m3u8Attributes;
  82629. var attributes = _ref2.attributes, segments = _ref2.segments, mediaSequence = _ref2.mediaSequence, discontinuityStarts = _ref2.discontinuityStarts, discontinuitySequence = _ref2.discontinuitySequence;
  82630. if (typeof segments === "undefined") {
  82631. segments = [{
  82632. uri: attributes.baseUrl,
  82633. timeline: attributes.periodStart,
  82634. resolvedUri: attributes.baseUrl || "",
  82635. duration: attributes.sourceDuration,
  82636. number: 0
  82637. }];
  82638. attributes.duration = attributes.sourceDuration;
  82639. }
  82640. var m3u8Attributes = (_m3u8Attributes = {
  82641. NAME: attributes.id,
  82642. BANDWIDTH: attributes.bandwidth
  82643. }, _m3u8Attributes["PROGRAM-ID"] = 1, _m3u8Attributes);
  82644. if (attributes.codecs) {
  82645. m3u8Attributes.CODECS = attributes.codecs;
  82646. }
  82647. return {
  82648. attributes: m3u8Attributes,
  82649. uri: "",
  82650. endList: attributes.type === "static",
  82651. timeline: attributes.periodStart,
  82652. resolvedUri: attributes.baseUrl || "",
  82653. targetDuration: attributes.duration,
  82654. timelineStarts: attributes.timelineStarts,
  82655. discontinuityStarts,
  82656. discontinuitySequence,
  82657. mediaSequence,
  82658. segments
  82659. };
  82660. };
  82661. var organizeAudioPlaylists = function organizeAudioPlaylists2(playlists, sidxMapping, isAudioOnly3) {
  82662. if (sidxMapping === void 0) {
  82663. sidxMapping = {};
  82664. }
  82665. if (isAudioOnly3 === void 0) {
  82666. isAudioOnly3 = false;
  82667. }
  82668. var mainPlaylist;
  82669. var formattedPlaylists = playlists.reduce(function(a, playlist) {
  82670. var role = playlist.attributes.role && playlist.attributes.role.value || "";
  82671. var language = playlist.attributes.lang || "";
  82672. var label = playlist.attributes.label || "main";
  82673. if (language && !playlist.attributes.label) {
  82674. var roleLabel = role ? " (" + role + ")" : "";
  82675. label = "" + playlist.attributes.lang + roleLabel;
  82676. }
  82677. if (!a[label]) {
  82678. a[label] = {
  82679. language,
  82680. autoselect: true,
  82681. default: role === "main",
  82682. playlists: [],
  82683. uri: ""
  82684. };
  82685. }
  82686. var formatted = addSidxSegmentsToPlaylist2(formatAudioPlaylist(playlist, isAudioOnly3), sidxMapping);
  82687. a[label].playlists.push(formatted);
  82688. if (typeof mainPlaylist === "undefined" && role === "main") {
  82689. mainPlaylist = playlist;
  82690. mainPlaylist.default = true;
  82691. }
  82692. return a;
  82693. }, {});
  82694. if (!mainPlaylist) {
  82695. var firstLabel = Object.keys(formattedPlaylists)[0];
  82696. formattedPlaylists[firstLabel].default = true;
  82697. }
  82698. return formattedPlaylists;
  82699. };
  82700. var organizeVttPlaylists = function organizeVttPlaylists2(playlists, sidxMapping) {
  82701. if (sidxMapping === void 0) {
  82702. sidxMapping = {};
  82703. }
  82704. return playlists.reduce(function(a, playlist) {
  82705. var label = playlist.attributes.lang || "text";
  82706. if (!a[label]) {
  82707. a[label] = {
  82708. language: label,
  82709. default: false,
  82710. autoselect: false,
  82711. playlists: [],
  82712. uri: ""
  82713. };
  82714. }
  82715. a[label].playlists.push(addSidxSegmentsToPlaylist2(formatVttPlaylist(playlist), sidxMapping));
  82716. return a;
  82717. }, {});
  82718. };
  82719. var organizeCaptionServices = function organizeCaptionServices2(captionServices) {
  82720. return captionServices.reduce(function(svcObj, svc) {
  82721. if (!svc) {
  82722. return svcObj;
  82723. }
  82724. svc.forEach(function(service) {
  82725. var channel = service.channel, language = service.language;
  82726. svcObj[language] = {
  82727. autoselect: false,
  82728. default: false,
  82729. instreamId: channel,
  82730. language
  82731. };
  82732. if (service.hasOwnProperty("aspectRatio")) {
  82733. svcObj[language].aspectRatio = service.aspectRatio;
  82734. }
  82735. if (service.hasOwnProperty("easyReader")) {
  82736. svcObj[language].easyReader = service.easyReader;
  82737. }
  82738. if (service.hasOwnProperty("3D")) {
  82739. svcObj[language]["3D"] = service["3D"];
  82740. }
  82741. });
  82742. return svcObj;
  82743. }, {});
  82744. };
  82745. var formatVideoPlaylist = function formatVideoPlaylist2(_ref3) {
  82746. var _attributes2;
  82747. var attributes = _ref3.attributes, segments = _ref3.segments, sidx = _ref3.sidx, discontinuityStarts = _ref3.discontinuityStarts;
  82748. var playlist = {
  82749. attributes: (_attributes2 = {
  82750. NAME: attributes.id,
  82751. AUDIO: "audio",
  82752. SUBTITLES: "subs",
  82753. RESOLUTION: {
  82754. width: attributes.width,
  82755. height: attributes.height
  82756. },
  82757. CODECS: attributes.codecs,
  82758. BANDWIDTH: attributes.bandwidth
  82759. }, _attributes2["PROGRAM-ID"] = 1, _attributes2),
  82760. uri: "",
  82761. endList: attributes.type === "static",
  82762. timeline: attributes.periodStart,
  82763. resolvedUri: "",
  82764. targetDuration: attributes.duration,
  82765. discontinuityStarts,
  82766. timelineStarts: attributes.timelineStarts,
  82767. segments
  82768. };
  82769. if (attributes.frameRate) {
  82770. playlist.attributes["FRAME-RATE"] = attributes.frameRate;
  82771. }
  82772. if (attributes.contentProtection) {
  82773. playlist.contentProtection = attributes.contentProtection;
  82774. }
  82775. if (sidx) {
  82776. playlist.sidx = sidx;
  82777. }
  82778. return playlist;
  82779. };
  82780. var videoOnly = function videoOnly2(_ref4) {
  82781. var attributes = _ref4.attributes;
  82782. return attributes.mimeType === "video/mp4" || attributes.mimeType === "video/webm" || attributes.contentType === "video";
  82783. };
  82784. var audioOnly = function audioOnly2(_ref5) {
  82785. var attributes = _ref5.attributes;
  82786. return attributes.mimeType === "audio/mp4" || attributes.mimeType === "audio/webm" || attributes.contentType === "audio";
  82787. };
  82788. var vttOnly = function vttOnly2(_ref6) {
  82789. var attributes = _ref6.attributes;
  82790. return attributes.mimeType === "text/vtt" || attributes.contentType === "text";
  82791. };
  82792. var addMediaSequenceValues = function addMediaSequenceValues2(playlists, timelineStarts) {
  82793. playlists.forEach(function(playlist) {
  82794. playlist.mediaSequence = 0;
  82795. playlist.discontinuitySequence = findIndex(timelineStarts, function(_ref7) {
  82796. var timeline = _ref7.timeline;
  82797. return timeline === playlist.timeline;
  82798. });
  82799. if (!playlist.segments) {
  82800. return;
  82801. }
  82802. playlist.segments.forEach(function(segment, index2) {
  82803. segment.number = index2;
  82804. });
  82805. });
  82806. };
  82807. var flattenMediaGroupPlaylists = function flattenMediaGroupPlaylists2(mediaGroupObject) {
  82808. if (!mediaGroupObject) {
  82809. return [];
  82810. }
  82811. return Object.keys(mediaGroupObject).reduce(function(acc, label) {
  82812. var labelContents = mediaGroupObject[label];
  82813. return acc.concat(labelContents.playlists);
  82814. }, []);
  82815. };
  82816. var toM3u8 = function toM3u82(_ref8) {
  82817. var _mediaGroups;
  82818. var dashPlaylists = _ref8.dashPlaylists, locations = _ref8.locations, _ref8$sidxMapping = _ref8.sidxMapping, sidxMapping = _ref8$sidxMapping === void 0 ? {} : _ref8$sidxMapping, previousManifest = _ref8.previousManifest;
  82819. if (!dashPlaylists.length) {
  82820. return {};
  82821. }
  82822. var _dashPlaylists$0$attr = dashPlaylists[0].attributes, duration5 = _dashPlaylists$0$attr.sourceDuration, type2 = _dashPlaylists$0$attr.type, suggestedPresentationDelay2 = _dashPlaylists$0$attr.suggestedPresentationDelay, minimumUpdatePeriod2 = _dashPlaylists$0$attr.minimumUpdatePeriod;
  82823. var videoPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(videoOnly)).map(formatVideoPlaylist);
  82824. var audioPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(audioOnly));
  82825. var vttPlaylists = mergeDiscontiguousPlaylists(dashPlaylists.filter(vttOnly));
  82826. var captions = dashPlaylists.map(function(playlist) {
  82827. return playlist.attributes.captionServices;
  82828. }).filter(Boolean);
  82829. var manifest = {
  82830. allowCache: true,
  82831. discontinuityStarts: [],
  82832. segments: [],
  82833. endList: true,
  82834. mediaGroups: (_mediaGroups = {
  82835. AUDIO: {},
  82836. VIDEO: {}
  82837. }, _mediaGroups["CLOSED-CAPTIONS"] = {}, _mediaGroups.SUBTITLES = {}, _mediaGroups),
  82838. uri: "",
  82839. duration: duration5,
  82840. playlists: addSidxSegmentsToPlaylists(videoPlaylists, sidxMapping)
  82841. };
  82842. if (minimumUpdatePeriod2 >= 0) {
  82843. manifest.minimumUpdatePeriod = minimumUpdatePeriod2 * 1e3;
  82844. }
  82845. if (locations) {
  82846. manifest.locations = locations;
  82847. }
  82848. if (type2 === "dynamic") {
  82849. manifest.suggestedPresentationDelay = suggestedPresentationDelay2;
  82850. }
  82851. var isAudioOnly3 = manifest.playlists.length === 0;
  82852. var organizedAudioGroup = audioPlaylists.length ? organizeAudioPlaylists(audioPlaylists, sidxMapping, isAudioOnly3) : null;
  82853. var organizedVttGroup = vttPlaylists.length ? organizeVttPlaylists(vttPlaylists, sidxMapping) : null;
  82854. var formattedPlaylists = videoPlaylists.concat(flattenMediaGroupPlaylists(organizedAudioGroup), flattenMediaGroupPlaylists(organizedVttGroup));
  82855. var playlistTimelineStarts = formattedPlaylists.map(function(_ref9) {
  82856. var timelineStarts = _ref9.timelineStarts;
  82857. return timelineStarts;
  82858. });
  82859. manifest.timelineStarts = getUniqueTimelineStarts(playlistTimelineStarts);
  82860. addMediaSequenceValues(formattedPlaylists, manifest.timelineStarts);
  82861. if (organizedAudioGroup) {
  82862. manifest.mediaGroups.AUDIO.audio = organizedAudioGroup;
  82863. }
  82864. if (organizedVttGroup) {
  82865. manifest.mediaGroups.SUBTITLES.subs = organizedVttGroup;
  82866. }
  82867. if (captions.length) {
  82868. manifest.mediaGroups["CLOSED-CAPTIONS"].cc = organizeCaptionServices(captions);
  82869. }
  82870. if (previousManifest) {
  82871. return positionManifestOnTimeline({
  82872. oldManifest: previousManifest,
  82873. newManifest: manifest
  82874. });
  82875. }
  82876. return manifest;
  82877. };
  82878. var getLiveRValue = function getLiveRValue2(attributes, time, duration5) {
  82879. var NOW = attributes.NOW, clientOffset = attributes.clientOffset, availabilityStartTime2 = attributes.availabilityStartTime, _attributes$timescale = attributes.timescale, timescale2 = _attributes$timescale === void 0 ? 1 : _attributes$timescale, _attributes$periodSta = attributes.periodStart, periodStart = _attributes$periodSta === void 0 ? 0 : _attributes$periodSta, _attributes$minimumUp = attributes.minimumUpdatePeriod, minimumUpdatePeriod2 = _attributes$minimumUp === void 0 ? 0 : _attributes$minimumUp;
  82880. var now2 = (NOW + clientOffset) / 1e3;
  82881. var periodStartWC = availabilityStartTime2 + periodStart;
  82882. var periodEndWC = now2 + minimumUpdatePeriod2;
  82883. var periodDuration = periodEndWC - periodStartWC;
  82884. return Math.ceil((periodDuration * timescale2 - time) / duration5);
  82885. };
  82886. var parseByTimeline = function parseByTimeline2(attributes, segmentTimeline) {
  82887. var type2 = attributes.type, _attributes$minimumUp2 = attributes.minimumUpdatePeriod, minimumUpdatePeriod2 = _attributes$minimumUp2 === void 0 ? 0 : _attributes$minimumUp2, _attributes$media = attributes.media, media = _attributes$media === void 0 ? "" : _attributes$media, sourceDuration = attributes.sourceDuration, _attributes$timescale2 = attributes.timescale, timescale2 = _attributes$timescale2 === void 0 ? 1 : _attributes$timescale2, _attributes$startNumb = attributes.startNumber, startNumber2 = _attributes$startNumb === void 0 ? 1 : _attributes$startNumb, timeline = attributes.periodStart;
  82888. var segments = [];
  82889. var time = -1;
  82890. for (var sIndex = 0; sIndex < segmentTimeline.length; sIndex++) {
  82891. var S = segmentTimeline[sIndex];
  82892. var duration5 = S.d;
  82893. var repeat = S.r || 0;
  82894. var segmentTime = S.t || 0;
  82895. if (time < 0) {
  82896. time = segmentTime;
  82897. }
  82898. if (segmentTime && segmentTime > time) {
  82899. time = segmentTime;
  82900. }
  82901. var count = void 0;
  82902. if (repeat < 0) {
  82903. var nextS = sIndex + 1;
  82904. if (nextS === segmentTimeline.length) {
  82905. if (type2 === "dynamic" && minimumUpdatePeriod2 > 0 && media.indexOf("$Number$") > 0) {
  82906. count = getLiveRValue(attributes, time, duration5);
  82907. } else {
  82908. count = (sourceDuration * timescale2 - time) / duration5;
  82909. }
  82910. } else {
  82911. count = (segmentTimeline[nextS].t - time) / duration5;
  82912. }
  82913. } else {
  82914. count = repeat + 1;
  82915. }
  82916. var end = startNumber2 + segments.length + count;
  82917. var number = startNumber2 + segments.length;
  82918. while (number < end) {
  82919. segments.push({
  82920. number,
  82921. duration: duration5 / timescale2,
  82922. time,
  82923. timeline
  82924. });
  82925. time += duration5;
  82926. number++;
  82927. }
  82928. }
  82929. return segments;
  82930. };
  82931. var identifierPattern = /\$([A-z]*)(?:(%0)([0-9]+)d)?\$/g;
  82932. var identifierReplacement = function identifierReplacement2(values3) {
  82933. return function(match, identifier, format, width2) {
  82934. if (match === "$$") {
  82935. return "$";
  82936. }
  82937. if (typeof values3[identifier] === "undefined") {
  82938. return match;
  82939. }
  82940. var value = "" + values3[identifier];
  82941. if (identifier === "RepresentationID") {
  82942. return value;
  82943. }
  82944. if (!format) {
  82945. width2 = 1;
  82946. } else {
  82947. width2 = parseInt(width2, 10);
  82948. }
  82949. if (value.length >= width2) {
  82950. return value;
  82951. }
  82952. return "" + new Array(width2 - value.length + 1).join("0") + value;
  82953. };
  82954. };
  82955. var constructTemplateUrl = function constructTemplateUrl2(url, values3) {
  82956. return url.replace(identifierPattern, identifierReplacement(values3));
  82957. };
  82958. var parseTemplateInfo = function parseTemplateInfo2(attributes, segmentTimeline) {
  82959. if (!attributes.duration && !segmentTimeline) {
  82960. return [{
  82961. number: attributes.startNumber || 1,
  82962. duration: attributes.sourceDuration,
  82963. time: 0,
  82964. timeline: attributes.periodStart
  82965. }];
  82966. }
  82967. if (attributes.duration) {
  82968. return parseByDuration(attributes);
  82969. }
  82970. return parseByTimeline(attributes, segmentTimeline);
  82971. };
  82972. var segmentsFromTemplate = function segmentsFromTemplate2(attributes, segmentTimeline) {
  82973. var templateValues = {
  82974. RepresentationID: attributes.id,
  82975. Bandwidth: attributes.bandwidth || 0
  82976. };
  82977. var _attributes$initializ = attributes.initialization, initialization = _attributes$initializ === void 0 ? {
  82978. sourceURL: "",
  82979. range: ""
  82980. } : _attributes$initializ;
  82981. var mapSegment = urlTypeToSegment({
  82982. baseUrl: attributes.baseUrl,
  82983. source: constructTemplateUrl(initialization.sourceURL, templateValues),
  82984. range: initialization.range
  82985. });
  82986. var segments = parseTemplateInfo(attributes, segmentTimeline);
  82987. return segments.map(function(segment) {
  82988. templateValues.Number = segment.number;
  82989. templateValues.Time = segment.time;
  82990. var uri = constructTemplateUrl(attributes.media || "", templateValues);
  82991. var timescale2 = attributes.timescale || 1;
  82992. var presentationTimeOffset2 = attributes.presentationTimeOffset || 0;
  82993. var presentationTime = attributes.periodStart + (segment.time - presentationTimeOffset2) / timescale2;
  82994. var map = {
  82995. uri,
  82996. timeline: segment.timeline,
  82997. duration: segment.duration,
  82998. resolvedUri: resolveUrl$1(attributes.baseUrl || "", uri),
  82999. map: mapSegment,
  83000. number: segment.number,
  83001. presentationTime
  83002. };
  83003. return map;
  83004. });
  83005. };
  83006. var SegmentURLToSegmentObject = function SegmentURLToSegmentObject2(attributes, segmentUrl) {
  83007. var baseUrl = attributes.baseUrl, _attributes$initializ = attributes.initialization, initialization = _attributes$initializ === void 0 ? {} : _attributes$initializ;
  83008. var initSegment = urlTypeToSegment({
  83009. baseUrl,
  83010. source: initialization.sourceURL,
  83011. range: initialization.range
  83012. });
  83013. var segment = urlTypeToSegment({
  83014. baseUrl,
  83015. source: segmentUrl.media,
  83016. range: segmentUrl.mediaRange
  83017. });
  83018. segment.map = initSegment;
  83019. return segment;
  83020. };
  83021. var segmentsFromList = function segmentsFromList2(attributes, segmentTimeline) {
  83022. var duration5 = attributes.duration, _attributes$segmentUr = attributes.segmentUrls, segmentUrls = _attributes$segmentUr === void 0 ? [] : _attributes$segmentUr, periodStart = attributes.periodStart;
  83023. if (!duration5 && !segmentTimeline || duration5 && segmentTimeline) {
  83024. throw new Error(errors.SEGMENT_TIME_UNSPECIFIED);
  83025. }
  83026. var segmentUrlMap = segmentUrls.map(function(segmentUrlObject) {
  83027. return SegmentURLToSegmentObject(attributes, segmentUrlObject);
  83028. });
  83029. var segmentTimeInfo;
  83030. if (duration5) {
  83031. segmentTimeInfo = parseByDuration(attributes);
  83032. }
  83033. if (segmentTimeline) {
  83034. segmentTimeInfo = parseByTimeline(attributes, segmentTimeline);
  83035. }
  83036. var segments = segmentTimeInfo.map(function(segmentTime, index2) {
  83037. if (segmentUrlMap[index2]) {
  83038. var segment = segmentUrlMap[index2];
  83039. var timescale2 = attributes.timescale || 1;
  83040. var presentationTimeOffset2 = attributes.presentationTimeOffset || 0;
  83041. segment.timeline = segmentTime.timeline;
  83042. segment.duration = segmentTime.duration;
  83043. segment.number = segmentTime.number;
  83044. segment.presentationTime = periodStart + (segmentTime.time - presentationTimeOffset2) / timescale2;
  83045. return segment;
  83046. }
  83047. }).filter(function(segment) {
  83048. return segment;
  83049. });
  83050. return segments;
  83051. };
  83052. var generateSegments = function generateSegments2(_ref) {
  83053. var attributes = _ref.attributes, segmentInfo = _ref.segmentInfo;
  83054. var segmentAttributes;
  83055. var segmentsFn;
  83056. if (segmentInfo.template) {
  83057. segmentsFn = segmentsFromTemplate;
  83058. segmentAttributes = merge(attributes, segmentInfo.template);
  83059. } else if (segmentInfo.base) {
  83060. segmentsFn = segmentsFromBase;
  83061. segmentAttributes = merge(attributes, segmentInfo.base);
  83062. } else if (segmentInfo.list) {
  83063. segmentsFn = segmentsFromList;
  83064. segmentAttributes = merge(attributes, segmentInfo.list);
  83065. }
  83066. var segmentsInfo = {
  83067. attributes
  83068. };
  83069. if (!segmentsFn) {
  83070. return segmentsInfo;
  83071. }
  83072. var segments = segmentsFn(segmentAttributes, segmentInfo.segmentTimeline);
  83073. if (segmentAttributes.duration) {
  83074. var _segmentAttributes = segmentAttributes, duration5 = _segmentAttributes.duration, _segmentAttributes$ti = _segmentAttributes.timescale, timescale2 = _segmentAttributes$ti === void 0 ? 1 : _segmentAttributes$ti;
  83075. segmentAttributes.duration = duration5 / timescale2;
  83076. } else if (segments.length) {
  83077. segmentAttributes.duration = segments.reduce(function(max2, segment) {
  83078. return Math.max(max2, Math.ceil(segment.duration));
  83079. }, 0);
  83080. } else {
  83081. segmentAttributes.duration = 0;
  83082. }
  83083. segmentsInfo.attributes = segmentAttributes;
  83084. segmentsInfo.segments = segments;
  83085. if (segmentInfo.base && segmentAttributes.indexRange) {
  83086. segmentsInfo.sidx = segments[0];
  83087. segmentsInfo.segments = [];
  83088. }
  83089. return segmentsInfo;
  83090. };
  83091. var toPlaylists = function toPlaylists2(representations) {
  83092. return representations.map(generateSegments);
  83093. };
  83094. var findChildren = function findChildren2(element, name) {
  83095. return from(element.childNodes).filter(function(_ref) {
  83096. var tagName = _ref.tagName;
  83097. return tagName === name;
  83098. });
  83099. };
  83100. var getContent = function getContent2(element) {
  83101. return element.textContent.trim();
  83102. };
  83103. var parseDivisionValue = function parseDivisionValue2(value) {
  83104. return parseFloat(value.split("/").reduce(function(prev, current) {
  83105. return prev / current;
  83106. }));
  83107. };
  83108. var parseDuration = function parseDuration2(str) {
  83109. var SECONDS_IN_YEAR = 365 * 24 * 60 * 60;
  83110. var SECONDS_IN_MONTH = 30 * 24 * 60 * 60;
  83111. var SECONDS_IN_DAY = 24 * 60 * 60;
  83112. var SECONDS_IN_HOUR = 60 * 60;
  83113. var SECONDS_IN_MIN = 60;
  83114. var durationRegex = /P(?:(\d*)Y)?(?:(\d*)M)?(?:(\d*)D)?(?:T(?:(\d*)H)?(?:(\d*)M)?(?:([\d.]*)S)?)?/;
  83115. var match = durationRegex.exec(str);
  83116. if (!match) {
  83117. return 0;
  83118. }
  83119. var _match$slice = match.slice(1), year = _match$slice[0], month = _match$slice[1], day = _match$slice[2], hour = _match$slice[3], minute = _match$slice[4], second = _match$slice[5];
  83120. return parseFloat(year || 0) * SECONDS_IN_YEAR + parseFloat(month || 0) * SECONDS_IN_MONTH + parseFloat(day || 0) * SECONDS_IN_DAY + parseFloat(hour || 0) * SECONDS_IN_HOUR + parseFloat(minute || 0) * SECONDS_IN_MIN + parseFloat(second || 0);
  83121. };
  83122. var parseDate = function parseDate2(str) {
  83123. var dateRegex = /^\d+-\d+-\d+T\d+:\d+:\d+(\.\d+)?$/;
  83124. if (dateRegex.test(str)) {
  83125. str += "Z";
  83126. }
  83127. return Date.parse(str);
  83128. };
  83129. var parsers = {
  83130. mediaPresentationDuration: function mediaPresentationDuration(value) {
  83131. return parseDuration(value);
  83132. },
  83133. availabilityStartTime: function availabilityStartTime(value) {
  83134. return parseDate(value) / 1e3;
  83135. },
  83136. minimumUpdatePeriod: function minimumUpdatePeriod(value) {
  83137. return parseDuration(value);
  83138. },
  83139. suggestedPresentationDelay: function suggestedPresentationDelay(value) {
  83140. return parseDuration(value);
  83141. },
  83142. type: function type(value) {
  83143. return value;
  83144. },
  83145. timeShiftBufferDepth: function timeShiftBufferDepth(value) {
  83146. return parseDuration(value);
  83147. },
  83148. start: function start(value) {
  83149. return parseDuration(value);
  83150. },
  83151. width: function width(value) {
  83152. return parseInt(value, 10);
  83153. },
  83154. height: function height(value) {
  83155. return parseInt(value, 10);
  83156. },
  83157. bandwidth: function bandwidth(value) {
  83158. return parseInt(value, 10);
  83159. },
  83160. frameRate: function frameRate(value) {
  83161. return parseDivisionValue(value);
  83162. },
  83163. startNumber: function startNumber(value) {
  83164. return parseInt(value, 10);
  83165. },
  83166. timescale: function timescale(value) {
  83167. return parseInt(value, 10);
  83168. },
  83169. presentationTimeOffset: function presentationTimeOffset(value) {
  83170. return parseInt(value, 10);
  83171. },
  83172. duration: function duration(value) {
  83173. var parsedValue = parseInt(value, 10);
  83174. if (isNaN(parsedValue)) {
  83175. return parseDuration(value);
  83176. }
  83177. return parsedValue;
  83178. },
  83179. d: function d(value) {
  83180. return parseInt(value, 10);
  83181. },
  83182. t: function t(value) {
  83183. return parseInt(value, 10);
  83184. },
  83185. r: function r(value) {
  83186. return parseInt(value, 10);
  83187. },
  83188. DEFAULT: function DEFAULT(value) {
  83189. return value;
  83190. }
  83191. };
  83192. var parseAttributes2 = function parseAttributes3(el) {
  83193. if (!(el && el.attributes)) {
  83194. return {};
  83195. }
  83196. return from(el.attributes).reduce(function(a, e) {
  83197. var parseFn = parsers[e.name] || parsers.DEFAULT;
  83198. a[e.name] = parseFn(e.value);
  83199. return a;
  83200. }, {});
  83201. };
  83202. var keySystemsMap = {
  83203. "urn:uuid:1077efec-c0b2-4d02-ace3-3c1e52e2fb4b": "org.w3.clearkey",
  83204. "urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed": "com.widevine.alpha",
  83205. "urn:uuid:9a04f079-9840-4286-ab92-e65be0885f95": "com.microsoft.playready",
  83206. "urn:uuid:f239e769-efa3-4850-9c16-a903c6932efb": "com.adobe.primetime"
  83207. };
  83208. var buildBaseUrls = function buildBaseUrls2(referenceUrls, baseUrlElements) {
  83209. if (!baseUrlElements.length) {
  83210. return referenceUrls;
  83211. }
  83212. return flatten(referenceUrls.map(function(reference) {
  83213. return baseUrlElements.map(function(baseUrlElement) {
  83214. return resolveUrl$1(reference, getContent(baseUrlElement));
  83215. });
  83216. }));
  83217. };
  83218. var getSegmentInformation = function getSegmentInformation2(adaptationSet) {
  83219. var segmentTemplate = findChildren(adaptationSet, "SegmentTemplate")[0];
  83220. var segmentList = findChildren(adaptationSet, "SegmentList")[0];
  83221. var segmentUrls = segmentList && findChildren(segmentList, "SegmentURL").map(function(s) {
  83222. return merge({
  83223. tag: "SegmentURL"
  83224. }, parseAttributes2(s));
  83225. });
  83226. var segmentBase = findChildren(adaptationSet, "SegmentBase")[0];
  83227. var segmentTimelineParentNode = segmentList || segmentTemplate;
  83228. var segmentTimeline = segmentTimelineParentNode && findChildren(segmentTimelineParentNode, "SegmentTimeline")[0];
  83229. var segmentInitializationParentNode = segmentList || segmentBase || segmentTemplate;
  83230. var segmentInitialization = segmentInitializationParentNode && findChildren(segmentInitializationParentNode, "Initialization")[0];
  83231. var template = segmentTemplate && parseAttributes2(segmentTemplate);
  83232. if (template && segmentInitialization) {
  83233. template.initialization = segmentInitialization && parseAttributes2(segmentInitialization);
  83234. } else if (template && template.initialization) {
  83235. template.initialization = {
  83236. sourceURL: template.initialization
  83237. };
  83238. }
  83239. var segmentInfo = {
  83240. template,
  83241. segmentTimeline: segmentTimeline && findChildren(segmentTimeline, "S").map(function(s) {
  83242. return parseAttributes2(s);
  83243. }),
  83244. list: segmentList && merge(parseAttributes2(segmentList), {
  83245. segmentUrls,
  83246. initialization: parseAttributes2(segmentInitialization)
  83247. }),
  83248. base: segmentBase && merge(parseAttributes2(segmentBase), {
  83249. initialization: parseAttributes2(segmentInitialization)
  83250. })
  83251. };
  83252. Object.keys(segmentInfo).forEach(function(key) {
  83253. if (!segmentInfo[key]) {
  83254. delete segmentInfo[key];
  83255. }
  83256. });
  83257. return segmentInfo;
  83258. };
  83259. var inheritBaseUrls = function inheritBaseUrls2(adaptationSetAttributes, adaptationSetBaseUrls, adaptationSetSegmentInfo) {
  83260. return function(representation) {
  83261. var repBaseUrlElements = findChildren(representation, "BaseURL");
  83262. var repBaseUrls = buildBaseUrls(adaptationSetBaseUrls, repBaseUrlElements);
  83263. var attributes = merge(adaptationSetAttributes, parseAttributes2(representation));
  83264. var representationSegmentInfo = getSegmentInformation(representation);
  83265. return repBaseUrls.map(function(baseUrl) {
  83266. return {
  83267. segmentInfo: merge(adaptationSetSegmentInfo, representationSegmentInfo),
  83268. attributes: merge(attributes, {
  83269. baseUrl
  83270. })
  83271. };
  83272. });
  83273. };
  83274. };
  83275. var generateKeySystemInformation = function generateKeySystemInformation2(contentProtectionNodes) {
  83276. return contentProtectionNodes.reduce(function(acc, node) {
  83277. var attributes = parseAttributes2(node);
  83278. if (attributes.schemeIdUri) {
  83279. attributes.schemeIdUri = attributes.schemeIdUri.toLowerCase();
  83280. }
  83281. var keySystem = keySystemsMap[attributes.schemeIdUri];
  83282. if (keySystem) {
  83283. acc[keySystem] = {
  83284. attributes
  83285. };
  83286. var psshNode = findChildren(node, "cenc:pssh")[0];
  83287. if (psshNode) {
  83288. var pssh = getContent(psshNode);
  83289. acc[keySystem].pssh = pssh && decodeB64ToUint8Array(pssh);
  83290. }
  83291. }
  83292. return acc;
  83293. }, {});
  83294. };
  83295. var parseCaptionServiceMetadata = function parseCaptionServiceMetadata2(service) {
  83296. if (service.schemeIdUri === "urn:scte:dash:cc:cea-608:2015") {
  83297. var values3 = typeof service.value !== "string" ? [] : service.value.split(";");
  83298. return values3.map(function(value) {
  83299. var channel;
  83300. var language;
  83301. language = value;
  83302. if (/^CC\d=/.test(value)) {
  83303. var _value$split = value.split("=");
  83304. channel = _value$split[0];
  83305. language = _value$split[1];
  83306. } else if (/^CC\d$/.test(value)) {
  83307. channel = value;
  83308. }
  83309. return {
  83310. channel,
  83311. language
  83312. };
  83313. });
  83314. } else if (service.schemeIdUri === "urn:scte:dash:cc:cea-708:2015") {
  83315. var _values = typeof service.value !== "string" ? [] : service.value.split(";");
  83316. return _values.map(function(value) {
  83317. var flags = {
  83318. "channel": void 0,
  83319. "language": void 0,
  83320. "aspectRatio": 1,
  83321. "easyReader": 0,
  83322. "3D": 0
  83323. };
  83324. if (/=/.test(value)) {
  83325. var _value$split2 = value.split("="), channel = _value$split2[0], _value$split2$ = _value$split2[1], opts = _value$split2$ === void 0 ? "" : _value$split2$;
  83326. flags.channel = channel;
  83327. flags.language = value;
  83328. opts.split(",").forEach(function(opt) {
  83329. var _opt$split = opt.split(":"), name = _opt$split[0], val = _opt$split[1];
  83330. if (name === "lang") {
  83331. flags.language = val;
  83332. } else if (name === "er") {
  83333. flags.easyReader = Number(val);
  83334. } else if (name === "war") {
  83335. flags.aspectRatio = Number(val);
  83336. } else if (name === "3D") {
  83337. flags["3D"] = Number(val);
  83338. }
  83339. });
  83340. } else {
  83341. flags.language = value;
  83342. }
  83343. if (flags.channel) {
  83344. flags.channel = "SERVICE" + flags.channel;
  83345. }
  83346. return flags;
  83347. });
  83348. }
  83349. };
  83350. var toRepresentations = function toRepresentations2(periodAttributes, periodBaseUrls, periodSegmentInfo) {
  83351. return function(adaptationSet) {
  83352. var adaptationSetAttributes = parseAttributes2(adaptationSet);
  83353. var adaptationSetBaseUrls = buildBaseUrls(periodBaseUrls, findChildren(adaptationSet, "BaseURL"));
  83354. var role = findChildren(adaptationSet, "Role")[0];
  83355. var roleAttributes = {
  83356. role: parseAttributes2(role)
  83357. };
  83358. var attrs = merge(periodAttributes, adaptationSetAttributes, roleAttributes);
  83359. var accessibility = findChildren(adaptationSet, "Accessibility")[0];
  83360. var captionServices = parseCaptionServiceMetadata(parseAttributes2(accessibility));
  83361. if (captionServices) {
  83362. attrs = merge(attrs, {
  83363. captionServices
  83364. });
  83365. }
  83366. var label = findChildren(adaptationSet, "Label")[0];
  83367. if (label && label.childNodes.length) {
  83368. var labelVal = label.childNodes[0].nodeValue.trim();
  83369. attrs = merge(attrs, {
  83370. label: labelVal
  83371. });
  83372. }
  83373. var contentProtection = generateKeySystemInformation(findChildren(adaptationSet, "ContentProtection"));
  83374. if (Object.keys(contentProtection).length) {
  83375. attrs = merge(attrs, {
  83376. contentProtection
  83377. });
  83378. }
  83379. var segmentInfo = getSegmentInformation(adaptationSet);
  83380. var representations = findChildren(adaptationSet, "Representation");
  83381. var adaptationSetSegmentInfo = merge(periodSegmentInfo, segmentInfo);
  83382. return flatten(representations.map(inheritBaseUrls(attrs, adaptationSetBaseUrls, adaptationSetSegmentInfo)));
  83383. };
  83384. };
  83385. var toAdaptationSets = function toAdaptationSets2(mpdAttributes, mpdBaseUrls) {
  83386. return function(period, index2) {
  83387. var periodBaseUrls = buildBaseUrls(mpdBaseUrls, findChildren(period.node, "BaseURL"));
  83388. var periodAttributes = merge(mpdAttributes, {
  83389. periodStart: period.attributes.start
  83390. });
  83391. if (typeof period.attributes.duration === "number") {
  83392. periodAttributes.periodDuration = period.attributes.duration;
  83393. }
  83394. var adaptationSets = findChildren(period.node, "AdaptationSet");
  83395. var periodSegmentInfo = getSegmentInformation(period.node);
  83396. return flatten(adaptationSets.map(toRepresentations(periodAttributes, periodBaseUrls, periodSegmentInfo)));
  83397. };
  83398. };
  83399. var getPeriodStart = function getPeriodStart2(_ref) {
  83400. var attributes = _ref.attributes, priorPeriodAttributes = _ref.priorPeriodAttributes, mpdType = _ref.mpdType;
  83401. if (typeof attributes.start === "number") {
  83402. return attributes.start;
  83403. }
  83404. if (priorPeriodAttributes && typeof priorPeriodAttributes.start === "number" && typeof priorPeriodAttributes.duration === "number") {
  83405. return priorPeriodAttributes.start + priorPeriodAttributes.duration;
  83406. }
  83407. if (!priorPeriodAttributes && mpdType === "static") {
  83408. return 0;
  83409. }
  83410. return null;
  83411. };
  83412. var inheritAttributes = function inheritAttributes2(mpd, options2) {
  83413. if (options2 === void 0) {
  83414. options2 = {};
  83415. }
  83416. var _options = options2, _options$manifestUri = _options.manifestUri, manifestUri = _options$manifestUri === void 0 ? "" : _options$manifestUri, _options$NOW = _options.NOW, NOW = _options$NOW === void 0 ? Date.now() : _options$NOW, _options$clientOffset = _options.clientOffset, clientOffset = _options$clientOffset === void 0 ? 0 : _options$clientOffset;
  83417. var periodNodes = findChildren(mpd, "Period");
  83418. if (!periodNodes.length) {
  83419. throw new Error(errors.INVALID_NUMBER_OF_PERIOD);
  83420. }
  83421. var locations = findChildren(mpd, "Location");
  83422. var mpdAttributes = parseAttributes2(mpd);
  83423. var mpdBaseUrls = buildBaseUrls([manifestUri], findChildren(mpd, "BaseURL"));
  83424. mpdAttributes.type = mpdAttributes.type || "static";
  83425. mpdAttributes.sourceDuration = mpdAttributes.mediaPresentationDuration || 0;
  83426. mpdAttributes.NOW = NOW;
  83427. mpdAttributes.clientOffset = clientOffset;
  83428. if (locations.length) {
  83429. mpdAttributes.locations = locations.map(getContent);
  83430. }
  83431. var periods = [];
  83432. periodNodes.forEach(function(node, index2) {
  83433. var attributes = parseAttributes2(node);
  83434. var priorPeriod = periods[index2 - 1];
  83435. attributes.start = getPeriodStart({
  83436. attributes,
  83437. priorPeriodAttributes: priorPeriod ? priorPeriod.attributes : null,
  83438. mpdType: mpdAttributes.type
  83439. });
  83440. periods.push({
  83441. node,
  83442. attributes
  83443. });
  83444. });
  83445. return {
  83446. locations: mpdAttributes.locations,
  83447. representationInfo: flatten(periods.map(toAdaptationSets(mpdAttributes, mpdBaseUrls)))
  83448. };
  83449. };
  83450. var stringToMpdXml = function stringToMpdXml2(manifestString) {
  83451. if (manifestString === "") {
  83452. throw new Error(errors.DASH_EMPTY_MANIFEST);
  83453. }
  83454. var parser2 = new DOMParser();
  83455. var xml;
  83456. var mpd;
  83457. try {
  83458. xml = parser2.parseFromString(manifestString, "application/xml");
  83459. mpd = xml && xml.documentElement.tagName === "MPD" ? xml.documentElement : null;
  83460. } catch (e) {
  83461. }
  83462. if (!mpd || mpd && mpd.getElementsByTagName("parsererror").length > 0) {
  83463. throw new Error(errors.DASH_INVALID_XML);
  83464. }
  83465. return mpd;
  83466. };
  83467. var parseUTCTimingScheme = function parseUTCTimingScheme2(mpd) {
  83468. var UTCTimingNode = findChildren(mpd, "UTCTiming")[0];
  83469. if (!UTCTimingNode) {
  83470. return null;
  83471. }
  83472. var attributes = parseAttributes2(UTCTimingNode);
  83473. switch (attributes.schemeIdUri) {
  83474. case "urn:mpeg:dash:utc:http-head:2014":
  83475. case "urn:mpeg:dash:utc:http-head:2012":
  83476. attributes.method = "HEAD";
  83477. break;
  83478. case "urn:mpeg:dash:utc:http-xsdate:2014":
  83479. case "urn:mpeg:dash:utc:http-iso:2014":
  83480. case "urn:mpeg:dash:utc:http-xsdate:2012":
  83481. case "urn:mpeg:dash:utc:http-iso:2012":
  83482. attributes.method = "GET";
  83483. break;
  83484. case "urn:mpeg:dash:utc:direct:2014":
  83485. case "urn:mpeg:dash:utc:direct:2012":
  83486. attributes.method = "DIRECT";
  83487. attributes.value = Date.parse(attributes.value);
  83488. break;
  83489. case "urn:mpeg:dash:utc:http-ntp:2014":
  83490. case "urn:mpeg:dash:utc:ntp:2014":
  83491. case "urn:mpeg:dash:utc:sntp:2014":
  83492. default:
  83493. throw new Error(errors.UNSUPPORTED_UTC_TIMING_SCHEME);
  83494. }
  83495. return attributes;
  83496. };
  83497. var parse = function parse2(manifestString, options2) {
  83498. if (options2 === void 0) {
  83499. options2 = {};
  83500. }
  83501. var parsedManifestInfo = inheritAttributes(stringToMpdXml(manifestString), options2);
  83502. var playlists = toPlaylists(parsedManifestInfo.representationInfo);
  83503. return toM3u8({
  83504. dashPlaylists: playlists,
  83505. locations: parsedManifestInfo.locations,
  83506. sidxMapping: options2.sidxMapping,
  83507. previousManifest: options2.previousManifest
  83508. });
  83509. };
  83510. var parseUTCTiming = function parseUTCTiming2(manifestString) {
  83511. return parseUTCTimingScheme(stringToMpdXml(manifestString));
  83512. };
  83513. var MAX_UINT32 = Math.pow(2, 32);
  83514. var getUint64$1 = function(uint8) {
  83515. var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
  83516. var value;
  83517. if (dv.getBigUint64) {
  83518. value = dv.getBigUint64(0);
  83519. if (value < Number.MAX_SAFE_INTEGER) {
  83520. return Number(value);
  83521. }
  83522. return value;
  83523. }
  83524. return dv.getUint32(0) * MAX_UINT32 + dv.getUint32(4);
  83525. };
  83526. var numbers = {
  83527. getUint64: getUint64$1,
  83528. MAX_UINT32
  83529. };
  83530. var getUint64 = numbers.getUint64;
  83531. var parseSidx = function(data) {
  83532. var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = {
  83533. version: data[0],
  83534. flags: new Uint8Array(data.subarray(1, 4)),
  83535. references: [],
  83536. referenceId: view.getUint32(4),
  83537. timescale: view.getUint32(8)
  83538. }, i2 = 12;
  83539. if (result.version === 0) {
  83540. result.earliestPresentationTime = view.getUint32(i2);
  83541. result.firstOffset = view.getUint32(i2 + 4);
  83542. i2 += 8;
  83543. } else {
  83544. result.earliestPresentationTime = getUint64(data.subarray(i2));
  83545. result.firstOffset = getUint64(data.subarray(i2 + 8));
  83546. i2 += 16;
  83547. }
  83548. i2 += 2;
  83549. var referenceCount = view.getUint16(i2);
  83550. i2 += 2;
  83551. for (; referenceCount > 0; i2 += 12, referenceCount--) {
  83552. result.references.push({
  83553. referenceType: (data[i2] & 128) >>> 7,
  83554. referencedSize: view.getUint32(i2) & 2147483647,
  83555. subsegmentDuration: view.getUint32(i2 + 4),
  83556. startsWithSap: !!(data[i2 + 8] & 128),
  83557. sapType: (data[i2 + 8] & 112) >>> 4,
  83558. sapDeltaTime: view.getUint32(i2 + 8) & 268435455
  83559. });
  83560. }
  83561. return result;
  83562. };
  83563. var parseSidx_1 = parseSidx;
  83564. var ID3 = toUint82([73, 68, 51]);
  83565. var getId3Size2 = function getId3Size3(bytes, offset) {
  83566. if (offset === void 0) {
  83567. offset = 0;
  83568. }
  83569. bytes = toUint82(bytes);
  83570. var flags = bytes[offset + 5];
  83571. var returnSize = bytes[offset + 6] << 21 | bytes[offset + 7] << 14 | bytes[offset + 8] << 7 | bytes[offset + 9];
  83572. var footerPresent = (flags & 16) >> 4;
  83573. if (footerPresent) {
  83574. return returnSize + 20;
  83575. }
  83576. return returnSize + 10;
  83577. };
  83578. var getId3Offset2 = function getId3Offset3(bytes, offset) {
  83579. if (offset === void 0) {
  83580. offset = 0;
  83581. }
  83582. bytes = toUint82(bytes);
  83583. if (bytes.length - offset < 10 || !bytesMatch2(bytes, ID3, {
  83584. offset
  83585. })) {
  83586. return offset;
  83587. }
  83588. offset += getId3Size2(bytes, offset);
  83589. return getId3Offset3(bytes, offset);
  83590. };
  83591. var normalizePath$1 = function normalizePath3(path) {
  83592. if (typeof path === "string") {
  83593. return stringToBytes2(path);
  83594. }
  83595. if (typeof path === "number") {
  83596. return path;
  83597. }
  83598. return path;
  83599. };
  83600. var normalizePaths$1 = function normalizePaths3(paths) {
  83601. if (!Array.isArray(paths)) {
  83602. return [normalizePath$1(paths)];
  83603. }
  83604. return paths.map(function(p) {
  83605. return normalizePath$1(p);
  83606. });
  83607. };
  83608. var findBox2 = function findBox3(bytes, paths, complete) {
  83609. if (complete === void 0) {
  83610. complete = false;
  83611. }
  83612. paths = normalizePaths$1(paths);
  83613. bytes = toUint82(bytes);
  83614. var results = [];
  83615. if (!paths.length) {
  83616. return results;
  83617. }
  83618. var i2 = 0;
  83619. while (i2 < bytes.length) {
  83620. var size = (bytes[i2] << 24 | bytes[i2 + 1] << 16 | bytes[i2 + 2] << 8 | bytes[i2 + 3]) >>> 0;
  83621. var type2 = bytes.subarray(i2 + 4, i2 + 8);
  83622. if (size === 0) {
  83623. break;
  83624. }
  83625. var end = i2 + size;
  83626. if (end > bytes.length) {
  83627. if (complete) {
  83628. break;
  83629. }
  83630. end = bytes.length;
  83631. }
  83632. var data = bytes.subarray(i2 + 8, end);
  83633. if (bytesMatch2(type2, paths[0])) {
  83634. if (paths.length === 1) {
  83635. results.push(data);
  83636. } else {
  83637. results.push.apply(results, findBox3(data, paths.slice(1), complete));
  83638. }
  83639. }
  83640. i2 = end;
  83641. }
  83642. return results;
  83643. };
  83644. var EBML_TAGS = {
  83645. EBML: toUint82([26, 69, 223, 163]),
  83646. DocType: toUint82([66, 130]),
  83647. Segment: toUint82([24, 83, 128, 103]),
  83648. SegmentInfo: toUint82([21, 73, 169, 102]),
  83649. Tracks: toUint82([22, 84, 174, 107]),
  83650. Track: toUint82([174]),
  83651. TrackNumber: toUint82([215]),
  83652. DefaultDuration: toUint82([35, 227, 131]),
  83653. TrackEntry: toUint82([174]),
  83654. TrackType: toUint82([131]),
  83655. FlagDefault: toUint82([136]),
  83656. CodecID: toUint82([134]),
  83657. CodecPrivate: toUint82([99, 162]),
  83658. VideoTrack: toUint82([224]),
  83659. AudioTrack: toUint82([225]),
  83660. Cluster: toUint82([31, 67, 182, 117]),
  83661. Timestamp: toUint82([231]),
  83662. TimestampScale: toUint82([42, 215, 177]),
  83663. BlockGroup: toUint82([160]),
  83664. BlockDuration: toUint82([155]),
  83665. Block: toUint82([161]),
  83666. SimpleBlock: toUint82([163])
  83667. };
  83668. var LENGTH_TABLE = [128, 64, 32, 16, 8, 4, 2, 1];
  83669. var getLength2 = function getLength3(byte) {
  83670. var len = 1;
  83671. for (var i2 = 0; i2 < LENGTH_TABLE.length; i2++) {
  83672. if (byte & LENGTH_TABLE[i2]) {
  83673. break;
  83674. }
  83675. len++;
  83676. }
  83677. return len;
  83678. };
  83679. var getvint2 = function getvint3(bytes, offset, removeLength, signed) {
  83680. if (removeLength === void 0) {
  83681. removeLength = true;
  83682. }
  83683. if (signed === void 0) {
  83684. signed = false;
  83685. }
  83686. var length = getLength2(bytes[offset]);
  83687. var valueBytes = bytes.subarray(offset, offset + length);
  83688. if (removeLength) {
  83689. valueBytes = Array.prototype.slice.call(bytes, offset, offset + length);
  83690. valueBytes[0] ^= LENGTH_TABLE[length - 1];
  83691. }
  83692. return {
  83693. length,
  83694. value: bytesToNumber2(valueBytes, {
  83695. signed
  83696. }),
  83697. bytes: valueBytes
  83698. };
  83699. };
  83700. var normalizePath4 = function normalizePath5(path) {
  83701. if (typeof path === "string") {
  83702. return path.match(/.{1,2}/g).map(function(p) {
  83703. return normalizePath5(p);
  83704. });
  83705. }
  83706. if (typeof path === "number") {
  83707. return numberToBytes2(path);
  83708. }
  83709. return path;
  83710. };
  83711. var normalizePaths4 = function normalizePaths5(paths) {
  83712. if (!Array.isArray(paths)) {
  83713. return [normalizePath4(paths)];
  83714. }
  83715. return paths.map(function(p) {
  83716. return normalizePath4(p);
  83717. });
  83718. };
  83719. var getInfinityDataSize2 = function getInfinityDataSize3(id, bytes, offset) {
  83720. if (offset >= bytes.length) {
  83721. return bytes.length;
  83722. }
  83723. var innerid = getvint2(bytes, offset, false);
  83724. if (bytesMatch2(id.bytes, innerid.bytes)) {
  83725. return offset;
  83726. }
  83727. var dataHeader = getvint2(bytes, offset + innerid.length);
  83728. return getInfinityDataSize3(id, bytes, offset + dataHeader.length + dataHeader.value + innerid.length);
  83729. };
  83730. var findEbml2 = function findEbml3(bytes, paths) {
  83731. paths = normalizePaths4(paths);
  83732. bytes = toUint82(bytes);
  83733. var results = [];
  83734. if (!paths.length) {
  83735. return results;
  83736. }
  83737. var i2 = 0;
  83738. while (i2 < bytes.length) {
  83739. var id = getvint2(bytes, i2, false);
  83740. var dataHeader = getvint2(bytes, i2 + id.length);
  83741. var dataStart = i2 + id.length + dataHeader.length;
  83742. if (dataHeader.value === 127) {
  83743. dataHeader.value = getInfinityDataSize2(id, bytes, dataStart);
  83744. if (dataHeader.value !== bytes.length) {
  83745. dataHeader.value -= dataStart;
  83746. }
  83747. }
  83748. var dataEnd = dataStart + dataHeader.value > bytes.length ? bytes.length : dataStart + dataHeader.value;
  83749. var data = bytes.subarray(dataStart, dataEnd);
  83750. if (bytesMatch2(paths[0], id.bytes)) {
  83751. if (paths.length === 1) {
  83752. results.push(data);
  83753. } else {
  83754. results = results.concat(findEbml3(data, paths.slice(1)));
  83755. }
  83756. }
  83757. var totalLength = id.length + dataHeader.length + data.length;
  83758. i2 += totalLength;
  83759. }
  83760. return results;
  83761. };
  83762. var NAL_TYPE_ONE = toUint82([0, 0, 0, 1]);
  83763. var NAL_TYPE_TWO = toUint82([0, 0, 1]);
  83764. var EMULATION_PREVENTION = toUint82([0, 0, 3]);
  83765. var discardEmulationPreventionBytes2 = function discardEmulationPreventionBytes3(bytes) {
  83766. var positions = [];
  83767. var i2 = 1;
  83768. while (i2 < bytes.length - 2) {
  83769. if (bytesMatch2(bytes.subarray(i2, i2 + 3), EMULATION_PREVENTION)) {
  83770. positions.push(i2 + 2);
  83771. i2++;
  83772. }
  83773. i2++;
  83774. }
  83775. if (positions.length === 0) {
  83776. return bytes;
  83777. }
  83778. var newLength = bytes.length - positions.length;
  83779. var newData = new Uint8Array(newLength);
  83780. var sourceIndex = 0;
  83781. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  83782. if (sourceIndex === positions[0]) {
  83783. sourceIndex++;
  83784. positions.shift();
  83785. }
  83786. newData[i2] = bytes[sourceIndex];
  83787. }
  83788. return newData;
  83789. };
  83790. var findNal2 = function findNal3(bytes, dataType, types, nalLimit) {
  83791. if (nalLimit === void 0) {
  83792. nalLimit = Infinity;
  83793. }
  83794. bytes = toUint82(bytes);
  83795. types = [].concat(types);
  83796. var i2 = 0;
  83797. var nalStart;
  83798. var nalsFound = 0;
  83799. while (i2 < bytes.length && (nalsFound < nalLimit || nalStart)) {
  83800. var nalOffset = void 0;
  83801. if (bytesMatch2(bytes.subarray(i2), NAL_TYPE_ONE)) {
  83802. nalOffset = 4;
  83803. } else if (bytesMatch2(bytes.subarray(i2), NAL_TYPE_TWO)) {
  83804. nalOffset = 3;
  83805. }
  83806. if (!nalOffset) {
  83807. i2++;
  83808. continue;
  83809. }
  83810. nalsFound++;
  83811. if (nalStart) {
  83812. return discardEmulationPreventionBytes2(bytes.subarray(nalStart, i2));
  83813. }
  83814. var nalType = void 0;
  83815. if (dataType === "h264") {
  83816. nalType = bytes[i2 + nalOffset] & 31;
  83817. } else if (dataType === "h265") {
  83818. nalType = bytes[i2 + nalOffset] >> 1 & 63;
  83819. }
  83820. if (types.indexOf(nalType) !== -1) {
  83821. nalStart = i2 + nalOffset;
  83822. }
  83823. i2 += nalOffset + (dataType === "h264" ? 1 : 2);
  83824. }
  83825. return bytes.subarray(0, 0);
  83826. };
  83827. var findH264Nal2 = function findH264Nal3(bytes, type2, nalLimit) {
  83828. return findNal2(bytes, "h264", type2, nalLimit);
  83829. };
  83830. var findH265Nal2 = function findH265Nal3(bytes, type2, nalLimit) {
  83831. return findNal2(bytes, "h265", type2, nalLimit);
  83832. };
  83833. var CONSTANTS = {
  83834. "webm": toUint82([119, 101, 98, 109]),
  83835. "matroska": toUint82([109, 97, 116, 114, 111, 115, 107, 97]),
  83836. "flac": toUint82([102, 76, 97, 67]),
  83837. "ogg": toUint82([79, 103, 103, 83]),
  83838. "ac3": toUint82([11, 119]),
  83839. "riff": toUint82([82, 73, 70, 70]),
  83840. "avi": toUint82([65, 86, 73]),
  83841. "wav": toUint82([87, 65, 86, 69]),
  83842. "3gp": toUint82([102, 116, 121, 112, 51, 103]),
  83843. "mp4": toUint82([102, 116, 121, 112]),
  83844. "fmp4": toUint82([115, 116, 121, 112]),
  83845. "mov": toUint82([102, 116, 121, 112, 113, 116]),
  83846. "moov": toUint82([109, 111, 111, 118]),
  83847. "moof": toUint82([109, 111, 111, 102])
  83848. };
  83849. var _isLikely = {
  83850. aac: function aac2(bytes) {
  83851. var offset = getId3Offset2(bytes);
  83852. return bytesMatch2(bytes, [255, 16], {
  83853. offset,
  83854. mask: [255, 22]
  83855. });
  83856. },
  83857. mp3: function mp32(bytes) {
  83858. var offset = getId3Offset2(bytes);
  83859. return bytesMatch2(bytes, [255, 2], {
  83860. offset,
  83861. mask: [255, 6]
  83862. });
  83863. },
  83864. webm: function webm2(bytes) {
  83865. var docType = findEbml2(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0];
  83866. return bytesMatch2(docType, CONSTANTS.webm);
  83867. },
  83868. mkv: function mkv2(bytes) {
  83869. var docType = findEbml2(bytes, [EBML_TAGS.EBML, EBML_TAGS.DocType])[0];
  83870. return bytesMatch2(docType, CONSTANTS.matroska);
  83871. },
  83872. mp4: function mp42(bytes) {
  83873. if (_isLikely["3gp"](bytes) || _isLikely.mov(bytes)) {
  83874. return false;
  83875. }
  83876. if (bytesMatch2(bytes, CONSTANTS.mp4, {
  83877. offset: 4
  83878. }) || bytesMatch2(bytes, CONSTANTS.fmp4, {
  83879. offset: 4
  83880. })) {
  83881. return true;
  83882. }
  83883. if (bytesMatch2(bytes, CONSTANTS.moof, {
  83884. offset: 4
  83885. }) || bytesMatch2(bytes, CONSTANTS.moov, {
  83886. offset: 4
  83887. })) {
  83888. return true;
  83889. }
  83890. },
  83891. mov: function mov2(bytes) {
  83892. return bytesMatch2(bytes, CONSTANTS.mov, {
  83893. offset: 4
  83894. });
  83895. },
  83896. "3gp": function gp2(bytes) {
  83897. return bytesMatch2(bytes, CONSTANTS["3gp"], {
  83898. offset: 4
  83899. });
  83900. },
  83901. ac3: function ac32(bytes) {
  83902. var offset = getId3Offset2(bytes);
  83903. return bytesMatch2(bytes, CONSTANTS.ac3, {
  83904. offset
  83905. });
  83906. },
  83907. ts: function ts2(bytes) {
  83908. if (bytes.length < 189 && bytes.length >= 1) {
  83909. return bytes[0] === 71;
  83910. }
  83911. var i2 = 0;
  83912. while (i2 + 188 < bytes.length && i2 < 188) {
  83913. if (bytes[i2] === 71 && bytes[i2 + 188] === 71) {
  83914. return true;
  83915. }
  83916. i2 += 1;
  83917. }
  83918. return false;
  83919. },
  83920. flac: function flac2(bytes) {
  83921. var offset = getId3Offset2(bytes);
  83922. return bytesMatch2(bytes, CONSTANTS.flac, {
  83923. offset
  83924. });
  83925. },
  83926. ogg: function ogg2(bytes) {
  83927. return bytesMatch2(bytes, CONSTANTS.ogg);
  83928. },
  83929. avi: function avi2(bytes) {
  83930. return bytesMatch2(bytes, CONSTANTS.riff) && bytesMatch2(bytes, CONSTANTS.avi, {
  83931. offset: 8
  83932. });
  83933. },
  83934. wav: function wav2(bytes) {
  83935. return bytesMatch2(bytes, CONSTANTS.riff) && bytesMatch2(bytes, CONSTANTS.wav, {
  83936. offset: 8
  83937. });
  83938. },
  83939. "h264": function h2642(bytes) {
  83940. return findH264Nal2(bytes, 7, 3).length;
  83941. },
  83942. "h265": function h2652(bytes) {
  83943. return findH265Nal2(bytes, [32, 33], 3).length;
  83944. }
  83945. };
  83946. var isLikelyTypes = Object.keys(_isLikely).filter(function(t2) {
  83947. return t2 !== "ts" && t2 !== "h264" && t2 !== "h265";
  83948. }).concat(["ts", "h264", "h265"]);
  83949. isLikelyTypes.forEach(function(type2) {
  83950. var isLikelyFn = _isLikely[type2];
  83951. _isLikely[type2] = function(bytes) {
  83952. return isLikelyFn(toUint82(bytes));
  83953. };
  83954. });
  83955. var isLikely = _isLikely;
  83956. var detectContainerForBytes2 = function detectContainerForBytes3(bytes) {
  83957. bytes = toUint82(bytes);
  83958. for (var i2 = 0; i2 < isLikelyTypes.length; i2++) {
  83959. var type2 = isLikelyTypes[i2];
  83960. if (isLikely[type2](bytes)) {
  83961. return type2;
  83962. }
  83963. }
  83964. return "";
  83965. };
  83966. var isLikelyFmp4MediaSegment2 = function isLikelyFmp4MediaSegment3(bytes) {
  83967. return findBox2(bytes, ["moof"]).length > 0;
  83968. };
  83969. var ONE_SECOND_IN_TS = 9e4, secondsToVideoTs, secondsToAudioTs, videoTsToSeconds, audioTsToSeconds, audioTsToVideoTs, videoTsToAudioTs, metadataTsToSeconds;
  83970. secondsToVideoTs = function(seconds) {
  83971. return seconds * ONE_SECOND_IN_TS;
  83972. };
  83973. secondsToAudioTs = function(seconds, sampleRate) {
  83974. return seconds * sampleRate;
  83975. };
  83976. videoTsToSeconds = function(timestamp) {
  83977. return timestamp / ONE_SECOND_IN_TS;
  83978. };
  83979. audioTsToSeconds = function(timestamp, sampleRate) {
  83980. return timestamp / sampleRate;
  83981. };
  83982. audioTsToVideoTs = function(timestamp, sampleRate) {
  83983. return secondsToVideoTs(audioTsToSeconds(timestamp, sampleRate));
  83984. };
  83985. videoTsToAudioTs = function(timestamp, sampleRate) {
  83986. return secondsToAudioTs(videoTsToSeconds(timestamp), sampleRate);
  83987. };
  83988. metadataTsToSeconds = function(timestamp, timelineStartPts, keepOriginalTimestamps) {
  83989. return videoTsToSeconds(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);
  83990. };
  83991. var clock = {
  83992. ONE_SECOND_IN_TS,
  83993. secondsToVideoTs,
  83994. secondsToAudioTs,
  83995. videoTsToSeconds,
  83996. audioTsToSeconds,
  83997. audioTsToVideoTs,
  83998. videoTsToAudioTs,
  83999. metadataTsToSeconds
  84000. };
  84001. function _getPrototypeOf(o) {
  84002. _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
  84003. return o2.__proto__ || Object.getPrototypeOf(o2);
  84004. };
  84005. return _getPrototypeOf(o);
  84006. }
  84007. function _isNativeFunction(fn2) {
  84008. return Function.toString.call(fn2).indexOf("[native code]") !== -1;
  84009. }
  84010. function _wrapNativeSuper(Class) {
  84011. var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
  84012. _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
  84013. if (Class2 === null || !_isNativeFunction(Class2))
  84014. return Class2;
  84015. if (typeof Class2 !== "function") {
  84016. throw new TypeError("Super expression must either be null or a function");
  84017. }
  84018. if (typeof _cache !== "undefined") {
  84019. if (_cache.has(Class2))
  84020. return _cache.get(Class2);
  84021. _cache.set(Class2, Wrapper);
  84022. }
  84023. function Wrapper() {
  84024. return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
  84025. }
  84026. Wrapper.prototype = Object.create(Class2.prototype, {
  84027. constructor: {
  84028. value: Wrapper,
  84029. enumerable: false,
  84030. writable: true,
  84031. configurable: true
  84032. }
  84033. });
  84034. return _setPrototypeOf(Wrapper, Class2);
  84035. };
  84036. return _wrapNativeSuper(Class);
  84037. }
  84038. /**
  84039. * @license
  84040. * Video.js 7.21.4 <http://videojs.com/>
  84041. * Copyright Brightcove, Inc. <https://www.brightcove.com/>
  84042. * Available under Apache License Version 2.0
  84043. * <https://github.com/videojs/video.js/blob/main/LICENSE>
  84044. *
  84045. * Includes vtt.js <https://github.com/mozilla/vtt.js>
  84046. * Available under Apache License Version 2.0
  84047. * <https://github.com/mozilla/vtt.js/blob/main/LICENSE>
  84048. */
  84049. var version$5 = "7.21.4";
  84050. var hooks_ = {};
  84051. var hooks = function hooks2(type2, fn2) {
  84052. hooks_[type2] = hooks_[type2] || [];
  84053. if (fn2) {
  84054. hooks_[type2] = hooks_[type2].concat(fn2);
  84055. }
  84056. return hooks_[type2];
  84057. };
  84058. var hook = function hook2(type2, fn2) {
  84059. hooks(type2, fn2);
  84060. };
  84061. var removeHook = function removeHook2(type2, fn2) {
  84062. var index2 = hooks(type2).indexOf(fn2);
  84063. if (index2 <= -1) {
  84064. return false;
  84065. }
  84066. hooks_[type2] = hooks_[type2].slice();
  84067. hooks_[type2].splice(index2, 1);
  84068. return true;
  84069. };
  84070. var hookOnce = function hookOnce2(type2, fn2) {
  84071. hooks(type2, [].concat(fn2).map(function(original) {
  84072. var wrapper = function wrapper2() {
  84073. removeHook(type2, wrapper2);
  84074. return original.apply(void 0, arguments);
  84075. };
  84076. return wrapper;
  84077. }));
  84078. };
  84079. var FullscreenApi = {
  84080. prefixed: true
  84081. };
  84082. var apiMap = [
  84083. ["requestFullscreen", "exitFullscreen", "fullscreenElement", "fullscreenEnabled", "fullscreenchange", "fullscreenerror", "fullscreen"],
  84084. ["webkitRequestFullscreen", "webkitExitFullscreen", "webkitFullscreenElement", "webkitFullscreenEnabled", "webkitfullscreenchange", "webkitfullscreenerror", "-webkit-full-screen"],
  84085. ["mozRequestFullScreen", "mozCancelFullScreen", "mozFullScreenElement", "mozFullScreenEnabled", "mozfullscreenchange", "mozfullscreenerror", "-moz-full-screen"],
  84086. ["msRequestFullscreen", "msExitFullscreen", "msFullscreenElement", "msFullscreenEnabled", "MSFullscreenChange", "MSFullscreenError", "-ms-fullscreen"]
  84087. ];
  84088. var specApi = apiMap[0];
  84089. var browserApi;
  84090. for (var i$2 = 0; i$2 < apiMap.length; i$2++) {
  84091. if (apiMap[i$2][1] in document_1) {
  84092. browserApi = apiMap[i$2];
  84093. break;
  84094. }
  84095. }
  84096. if (browserApi) {
  84097. for (var _i$1 = 0; _i$1 < browserApi.length; _i$1++) {
  84098. FullscreenApi[specApi[_i$1]] = browserApi[_i$1];
  84099. }
  84100. FullscreenApi.prefixed = browserApi[0] !== specApi[0];
  84101. }
  84102. var history = [];
  84103. var LogByTypeFactory = function LogByTypeFactory2(name, log2) {
  84104. return function(type2, level, args) {
  84105. var lvl = log2.levels[level];
  84106. var lvlRegExp = new RegExp("^(" + lvl + ")$");
  84107. if (type2 !== "log") {
  84108. args.unshift(type2.toUpperCase() + ":");
  84109. }
  84110. args.unshift(name + ":");
  84111. if (history) {
  84112. history.push([].concat(args));
  84113. var splice2 = history.length - 1e3;
  84114. history.splice(0, splice2 > 0 ? splice2 : 0);
  84115. }
  84116. if (!window_1.console) {
  84117. return;
  84118. }
  84119. var fn2 = window_1.console[type2];
  84120. if (!fn2 && type2 === "debug") {
  84121. fn2 = window_1.console.info || window_1.console.log;
  84122. }
  84123. if (!fn2 || !lvl || !lvlRegExp.test(type2)) {
  84124. return;
  84125. }
  84126. fn2[Array.isArray(args) ? "apply" : "call"](window_1.console, args);
  84127. };
  84128. };
  84129. function createLogger$1(name) {
  84130. var level = "info";
  84131. var logByType;
  84132. var log2 = function log3() {
  84133. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  84134. args[_key] = arguments[_key];
  84135. }
  84136. logByType("log", level, args);
  84137. };
  84138. logByType = LogByTypeFactory(name, log2);
  84139. log2.createLogger = function(subname) {
  84140. return createLogger$1(name + ": " + subname);
  84141. };
  84142. log2.levels = {
  84143. all: "debug|log|warn|error",
  84144. off: "",
  84145. debug: "debug|log|warn|error",
  84146. info: "log|warn|error",
  84147. warn: "warn|error",
  84148. error: "error",
  84149. DEFAULT: level
  84150. };
  84151. log2.level = function(lvl) {
  84152. if (typeof lvl === "string") {
  84153. if (!log2.levels.hasOwnProperty(lvl)) {
  84154. throw new Error('"' + lvl + '" in not a valid log level');
  84155. }
  84156. level = lvl;
  84157. }
  84158. return level;
  84159. };
  84160. log2.history = function() {
  84161. return history ? [].concat(history) : [];
  84162. };
  84163. log2.history.filter = function(fname) {
  84164. return (history || []).filter(function(historyItem) {
  84165. return new RegExp(".*" + fname + ".*").test(historyItem[0]);
  84166. });
  84167. };
  84168. log2.history.clear = function() {
  84169. if (history) {
  84170. history.length = 0;
  84171. }
  84172. };
  84173. log2.history.disable = function() {
  84174. if (history !== null) {
  84175. history.length = 0;
  84176. history = null;
  84177. }
  84178. };
  84179. log2.history.enable = function() {
  84180. if (history === null) {
  84181. history = [];
  84182. }
  84183. };
  84184. log2.error = function() {
  84185. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  84186. args[_key2] = arguments[_key2];
  84187. }
  84188. return logByType("error", level, args);
  84189. };
  84190. log2.warn = function() {
  84191. for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  84192. args[_key3] = arguments[_key3];
  84193. }
  84194. return logByType("warn", level, args);
  84195. };
  84196. log2.debug = function() {
  84197. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  84198. args[_key4] = arguments[_key4];
  84199. }
  84200. return logByType("debug", level, args);
  84201. };
  84202. return log2;
  84203. }
  84204. var log$1 = createLogger$1("VIDEOJS");
  84205. var createLogger = log$1.createLogger;
  84206. var toString = Object.prototype.toString;
  84207. var keys = function keys2(object) {
  84208. return isObject2(object) ? Object.keys(object) : [];
  84209. };
  84210. function each(object, fn2) {
  84211. keys(object).forEach(function(key) {
  84212. return fn2(object[key], key);
  84213. });
  84214. }
  84215. function reduce(object, fn2, initial) {
  84216. if (initial === void 0) {
  84217. initial = 0;
  84218. }
  84219. return keys(object).reduce(function(accum, key) {
  84220. return fn2(accum, object[key], key);
  84221. }, initial);
  84222. }
  84223. function assign(target) {
  84224. for (var _len = arguments.length, sources = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  84225. sources[_key - 1] = arguments[_key];
  84226. }
  84227. if (Object.assign) {
  84228. return _extends$2.apply(void 0, [target].concat(sources));
  84229. }
  84230. sources.forEach(function(source) {
  84231. if (!source) {
  84232. return;
  84233. }
  84234. each(source, function(value, key) {
  84235. target[key] = value;
  84236. });
  84237. });
  84238. return target;
  84239. }
  84240. function isObject2(value) {
  84241. return !!value && typeof value === "object";
  84242. }
  84243. function isPlain(value) {
  84244. return isObject2(value) && toString.call(value) === "[object Object]" && value.constructor === Object;
  84245. }
  84246. function computedStyle(el, prop) {
  84247. if (!el || !prop) {
  84248. return "";
  84249. }
  84250. if (typeof window_1.getComputedStyle === "function") {
  84251. var computedStyleValue;
  84252. try {
  84253. computedStyleValue = window_1.getComputedStyle(el);
  84254. } catch (e) {
  84255. return "";
  84256. }
  84257. return computedStyleValue ? computedStyleValue.getPropertyValue(prop) || computedStyleValue[prop] : "";
  84258. }
  84259. return "";
  84260. }
  84261. var USER_AGENT = window_1.navigator && window_1.navigator.userAgent || "";
  84262. var webkitVersionMap = /AppleWebKit\/([\d.]+)/i.exec(USER_AGENT);
  84263. var appleWebkitVersion = webkitVersionMap ? parseFloat(webkitVersionMap.pop()) : null;
  84264. var IS_IPOD = /iPod/i.test(USER_AGENT);
  84265. var IOS_VERSION = function() {
  84266. var match = USER_AGENT.match(/OS (\d+)_/i);
  84267. if (match && match[1]) {
  84268. return match[1];
  84269. }
  84270. return null;
  84271. }();
  84272. var IS_ANDROID = /Android/i.test(USER_AGENT);
  84273. var ANDROID_VERSION = function() {
  84274. var match = USER_AGENT.match(/Android (\d+)(?:\.(\d+))?(?:\.(\d+))*/i);
  84275. if (!match) {
  84276. return null;
  84277. }
  84278. var major = match[1] && parseFloat(match[1]);
  84279. var minor = match[2] && parseFloat(match[2]);
  84280. if (major && minor) {
  84281. return parseFloat(match[1] + "." + match[2]);
  84282. } else if (major) {
  84283. return major;
  84284. }
  84285. return null;
  84286. }();
  84287. var IS_NATIVE_ANDROID = IS_ANDROID && ANDROID_VERSION < 5 && appleWebkitVersion < 537;
  84288. var IS_FIREFOX = /Firefox/i.test(USER_AGENT);
  84289. var IS_EDGE = /Edg/i.test(USER_AGENT);
  84290. var IS_CHROME = !IS_EDGE && (/Chrome/i.test(USER_AGENT) || /CriOS/i.test(USER_AGENT));
  84291. var CHROME_VERSION = function() {
  84292. var match = USER_AGENT.match(/(Chrome|CriOS)\/(\d+)/);
  84293. if (match && match[2]) {
  84294. return parseFloat(match[2]);
  84295. }
  84296. return null;
  84297. }();
  84298. var IE_VERSION = function() {
  84299. var result = /MSIE\s(\d+)\.\d/.exec(USER_AGENT);
  84300. var version2 = result && parseFloat(result[1]);
  84301. if (!version2 && /Trident\/7.0/i.test(USER_AGENT) && /rv:11.0/.test(USER_AGENT)) {
  84302. version2 = 11;
  84303. }
  84304. return version2;
  84305. }();
  84306. var IS_SAFARI = /Safari/i.test(USER_AGENT) && !IS_CHROME && !IS_ANDROID && !IS_EDGE;
  84307. var IS_WINDOWS = /Windows/i.test(USER_AGENT);
  84308. var TOUCH_ENABLED = Boolean(isReal() && ("ontouchstart" in window_1 || window_1.navigator.maxTouchPoints || window_1.DocumentTouch && window_1.document instanceof window_1.DocumentTouch));
  84309. var IS_IPAD = /iPad/i.test(USER_AGENT) || IS_SAFARI && TOUCH_ENABLED && !/iPhone/i.test(USER_AGENT);
  84310. var IS_IPHONE = /iPhone/i.test(USER_AGENT) && !IS_IPAD;
  84311. var IS_IOS = IS_IPHONE || IS_IPAD || IS_IPOD;
  84312. var IS_ANY_SAFARI = (IS_SAFARI || IS_IOS) && !IS_CHROME;
  84313. var browser = /* @__PURE__ */ Object.freeze({
  84314. __proto__: null,
  84315. IS_IPOD,
  84316. IOS_VERSION,
  84317. IS_ANDROID,
  84318. ANDROID_VERSION,
  84319. IS_NATIVE_ANDROID,
  84320. IS_FIREFOX,
  84321. IS_EDGE,
  84322. IS_CHROME,
  84323. CHROME_VERSION,
  84324. IE_VERSION,
  84325. IS_SAFARI,
  84326. IS_WINDOWS,
  84327. TOUCH_ENABLED,
  84328. IS_IPAD,
  84329. IS_IPHONE,
  84330. IS_IOS,
  84331. IS_ANY_SAFARI
  84332. });
  84333. function isNonBlankString(str) {
  84334. return typeof str === "string" && Boolean(str.trim());
  84335. }
  84336. function throwIfWhitespace(str) {
  84337. if (str.indexOf(" ") >= 0) {
  84338. throw new Error("class has illegal whitespace characters");
  84339. }
  84340. }
  84341. function classRegExp(className) {
  84342. return new RegExp("(^|\\s)" + className + "($|\\s)");
  84343. }
  84344. function isReal() {
  84345. return document_1 === window_1.document;
  84346. }
  84347. function isEl(value) {
  84348. return isObject2(value) && value.nodeType === 1;
  84349. }
  84350. function isInFrame() {
  84351. try {
  84352. return window_1.parent !== window_1.self;
  84353. } catch (x) {
  84354. return true;
  84355. }
  84356. }
  84357. function createQuerier(method) {
  84358. return function(selector, context) {
  84359. if (!isNonBlankString(selector)) {
  84360. return document_1[method](null);
  84361. }
  84362. if (isNonBlankString(context)) {
  84363. context = document_1.querySelector(context);
  84364. }
  84365. var ctx = isEl(context) ? context : document_1;
  84366. return ctx[method] && ctx[method](selector);
  84367. };
  84368. }
  84369. function createEl(tagName, properties, attributes, content) {
  84370. if (tagName === void 0) {
  84371. tagName = "div";
  84372. }
  84373. if (properties === void 0) {
  84374. properties = {};
  84375. }
  84376. if (attributes === void 0) {
  84377. attributes = {};
  84378. }
  84379. var el = document_1.createElement(tagName);
  84380. Object.getOwnPropertyNames(properties).forEach(function(propName) {
  84381. var val = properties[propName];
  84382. if (propName.indexOf("aria-") !== -1 || propName === "role" || propName === "type") {
  84383. log$1.warn("Setting attributes in the second argument of createEl()\nhas been deprecated. Use the third argument instead.\n" + ("createEl(type, properties, attributes). Attempting to set " + propName + " to " + val + "."));
  84384. el.setAttribute(propName, val);
  84385. } else if (propName === "textContent") {
  84386. textContent(el, val);
  84387. } else if (el[propName] !== val || propName === "tabIndex") {
  84388. el[propName] = val;
  84389. }
  84390. });
  84391. Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
  84392. el.setAttribute(attrName, attributes[attrName]);
  84393. });
  84394. if (content) {
  84395. appendContent(el, content);
  84396. }
  84397. return el;
  84398. }
  84399. function textContent(el, text) {
  84400. if (typeof el.textContent === "undefined") {
  84401. el.innerText = text;
  84402. } else {
  84403. el.textContent = text;
  84404. }
  84405. return el;
  84406. }
  84407. function prependTo(child, parent) {
  84408. if (parent.firstChild) {
  84409. parent.insertBefore(child, parent.firstChild);
  84410. } else {
  84411. parent.appendChild(child);
  84412. }
  84413. }
  84414. function hasClass(element, classToCheck) {
  84415. throwIfWhitespace(classToCheck);
  84416. if (element.classList) {
  84417. return element.classList.contains(classToCheck);
  84418. }
  84419. return classRegExp(classToCheck).test(element.className);
  84420. }
  84421. function addClass(element, classToAdd) {
  84422. if (element.classList) {
  84423. element.classList.add(classToAdd);
  84424. } else if (!hasClass(element, classToAdd)) {
  84425. element.className = (element.className + " " + classToAdd).trim();
  84426. }
  84427. return element;
  84428. }
  84429. function removeClass(element, classToRemove) {
  84430. if (!element) {
  84431. log$1.warn("removeClass was called with an element that doesn't exist");
  84432. return null;
  84433. }
  84434. if (element.classList) {
  84435. element.classList.remove(classToRemove);
  84436. } else {
  84437. throwIfWhitespace(classToRemove);
  84438. element.className = element.className.split(/\s+/).filter(function(c) {
  84439. return c !== classToRemove;
  84440. }).join(" ");
  84441. }
  84442. return element;
  84443. }
  84444. function toggleClass(element, classToToggle, predicate) {
  84445. var has = hasClass(element, classToToggle);
  84446. if (typeof predicate === "function") {
  84447. predicate = predicate(element, classToToggle);
  84448. }
  84449. if (typeof predicate !== "boolean") {
  84450. predicate = !has;
  84451. }
  84452. if (predicate === has) {
  84453. return;
  84454. }
  84455. if (predicate) {
  84456. addClass(element, classToToggle);
  84457. } else {
  84458. removeClass(element, classToToggle);
  84459. }
  84460. return element;
  84461. }
  84462. function setAttributes(el, attributes) {
  84463. Object.getOwnPropertyNames(attributes).forEach(function(attrName) {
  84464. var attrValue = attributes[attrName];
  84465. if (attrValue === null || typeof attrValue === "undefined" || attrValue === false) {
  84466. el.removeAttribute(attrName);
  84467. } else {
  84468. el.setAttribute(attrName, attrValue === true ? "" : attrValue);
  84469. }
  84470. });
  84471. }
  84472. function getAttributes(tag) {
  84473. var obj = {};
  84474. var knownBooleans = ",autoplay,controls,playsinline,loop,muted,default,defaultMuted,";
  84475. if (tag && tag.attributes && tag.attributes.length > 0) {
  84476. var attrs = tag.attributes;
  84477. for (var i2 = attrs.length - 1; i2 >= 0; i2--) {
  84478. var attrName = attrs[i2].name;
  84479. var attrVal = attrs[i2].value;
  84480. if (typeof tag[attrName] === "boolean" || knownBooleans.indexOf("," + attrName + ",") !== -1) {
  84481. attrVal = attrVal !== null ? true : false;
  84482. }
  84483. obj[attrName] = attrVal;
  84484. }
  84485. }
  84486. return obj;
  84487. }
  84488. function getAttribute(el, attribute) {
  84489. return el.getAttribute(attribute);
  84490. }
  84491. function setAttribute(el, attribute, value) {
  84492. el.setAttribute(attribute, value);
  84493. }
  84494. function removeAttribute(el, attribute) {
  84495. el.removeAttribute(attribute);
  84496. }
  84497. function blockTextSelection() {
  84498. document_1.body.focus();
  84499. document_1.onselectstart = function() {
  84500. return false;
  84501. };
  84502. }
  84503. function unblockTextSelection() {
  84504. document_1.onselectstart = function() {
  84505. return true;
  84506. };
  84507. }
  84508. function getBoundingClientRect(el) {
  84509. if (el && el.getBoundingClientRect && el.parentNode) {
  84510. var rect = el.getBoundingClientRect();
  84511. var result = {};
  84512. ["bottom", "height", "left", "right", "top", "width"].forEach(function(k) {
  84513. if (rect[k] !== void 0) {
  84514. result[k] = rect[k];
  84515. }
  84516. });
  84517. if (!result.height) {
  84518. result.height = parseFloat(computedStyle(el, "height"));
  84519. }
  84520. if (!result.width) {
  84521. result.width = parseFloat(computedStyle(el, "width"));
  84522. }
  84523. return result;
  84524. }
  84525. }
  84526. function findPosition(el) {
  84527. if (!el || el && !el.offsetParent) {
  84528. return {
  84529. left: 0,
  84530. top: 0,
  84531. width: 0,
  84532. height: 0
  84533. };
  84534. }
  84535. var width2 = el.offsetWidth;
  84536. var height2 = el.offsetHeight;
  84537. var left = 0;
  84538. var top = 0;
  84539. while (el.offsetParent && el !== document_1[FullscreenApi.fullscreenElement]) {
  84540. left += el.offsetLeft;
  84541. top += el.offsetTop;
  84542. el = el.offsetParent;
  84543. }
  84544. return {
  84545. left,
  84546. top,
  84547. width: width2,
  84548. height: height2
  84549. };
  84550. }
  84551. function getPointerPosition(el, event2) {
  84552. var translated = {
  84553. x: 0,
  84554. y: 0
  84555. };
  84556. if (IS_IOS) {
  84557. var item = el;
  84558. while (item && item.nodeName.toLowerCase() !== "html") {
  84559. var transform3 = computedStyle(item, "transform");
  84560. if (/^matrix/.test(transform3)) {
  84561. var values3 = transform3.slice(7, -1).split(/,\s/).map(Number);
  84562. translated.x += values3[4];
  84563. translated.y += values3[5];
  84564. } else if (/^matrix3d/.test(transform3)) {
  84565. var _values = transform3.slice(9, -1).split(/,\s/).map(Number);
  84566. translated.x += _values[12];
  84567. translated.y += _values[13];
  84568. }
  84569. item = item.parentNode;
  84570. }
  84571. }
  84572. var position2 = {};
  84573. var boxTarget = findPosition(event2.target);
  84574. var box = findPosition(el);
  84575. var boxW = box.width;
  84576. var boxH = box.height;
  84577. var offsetY = event2.offsetY - (box.top - boxTarget.top);
  84578. var offsetX = event2.offsetX - (box.left - boxTarget.left);
  84579. if (event2.changedTouches) {
  84580. offsetX = event2.changedTouches[0].pageX - box.left;
  84581. offsetY = event2.changedTouches[0].pageY + box.top;
  84582. if (IS_IOS) {
  84583. offsetX -= translated.x;
  84584. offsetY -= translated.y;
  84585. }
  84586. }
  84587. position2.y = 1 - Math.max(0, Math.min(1, offsetY / boxH));
  84588. position2.x = Math.max(0, Math.min(1, offsetX / boxW));
  84589. return position2;
  84590. }
  84591. function isTextNode(value) {
  84592. return isObject2(value) && value.nodeType === 3;
  84593. }
  84594. function emptyEl(el) {
  84595. while (el.firstChild) {
  84596. el.removeChild(el.firstChild);
  84597. }
  84598. return el;
  84599. }
  84600. function normalizeContent(content) {
  84601. if (typeof content === "function") {
  84602. content = content();
  84603. }
  84604. return (Array.isArray(content) ? content : [content]).map(function(value) {
  84605. if (typeof value === "function") {
  84606. value = value();
  84607. }
  84608. if (isEl(value) || isTextNode(value)) {
  84609. return value;
  84610. }
  84611. if (typeof value === "string" && /\S/.test(value)) {
  84612. return document_1.createTextNode(value);
  84613. }
  84614. }).filter(function(value) {
  84615. return value;
  84616. });
  84617. }
  84618. function appendContent(el, content) {
  84619. normalizeContent(content).forEach(function(node) {
  84620. return el.appendChild(node);
  84621. });
  84622. return el;
  84623. }
  84624. function insertContent(el, content) {
  84625. return appendContent(emptyEl(el), content);
  84626. }
  84627. function isSingleLeftClick(event2) {
  84628. if (event2.button === void 0 && event2.buttons === void 0) {
  84629. return true;
  84630. }
  84631. if (event2.button === 0 && event2.buttons === void 0) {
  84632. return true;
  84633. }
  84634. if (event2.type === "mouseup" && event2.button === 0 && event2.buttons === 0) {
  84635. return true;
  84636. }
  84637. if (event2.button !== 0 || event2.buttons !== 1) {
  84638. return false;
  84639. }
  84640. return true;
  84641. }
  84642. var $ = createQuerier("querySelector");
  84643. var $$ = createQuerier("querySelectorAll");
  84644. var Dom$1 = /* @__PURE__ */ Object.freeze({
  84645. __proto__: null,
  84646. isReal,
  84647. isEl,
  84648. isInFrame,
  84649. createEl,
  84650. textContent,
  84651. prependTo,
  84652. hasClass,
  84653. addClass,
  84654. removeClass,
  84655. toggleClass,
  84656. setAttributes,
  84657. getAttributes,
  84658. getAttribute,
  84659. setAttribute,
  84660. removeAttribute,
  84661. blockTextSelection,
  84662. unblockTextSelection,
  84663. getBoundingClientRect,
  84664. findPosition,
  84665. getPointerPosition,
  84666. isTextNode,
  84667. emptyEl,
  84668. normalizeContent,
  84669. appendContent,
  84670. insertContent,
  84671. isSingleLeftClick,
  84672. $,
  84673. $$
  84674. });
  84675. var _windowLoaded = false;
  84676. var videojs$1;
  84677. var autoSetup = function autoSetup2() {
  84678. if (videojs$1.options.autoSetup === false) {
  84679. return;
  84680. }
  84681. var vids = Array.prototype.slice.call(document_1.getElementsByTagName("video"));
  84682. var audios = Array.prototype.slice.call(document_1.getElementsByTagName("audio"));
  84683. var divs = Array.prototype.slice.call(document_1.getElementsByTagName("video-js"));
  84684. var mediaEls = vids.concat(audios, divs);
  84685. if (mediaEls && mediaEls.length > 0) {
  84686. for (var i2 = 0, e = mediaEls.length; i2 < e; i2++) {
  84687. var mediaEl = mediaEls[i2];
  84688. if (mediaEl && mediaEl.getAttribute) {
  84689. if (mediaEl.player === void 0) {
  84690. var options2 = mediaEl.getAttribute("data-setup");
  84691. if (options2 !== null) {
  84692. videojs$1(mediaEl);
  84693. }
  84694. }
  84695. } else {
  84696. autoSetupTimeout(1);
  84697. break;
  84698. }
  84699. }
  84700. } else if (!_windowLoaded) {
  84701. autoSetupTimeout(1);
  84702. }
  84703. };
  84704. function autoSetupTimeout(wait, vjs) {
  84705. if (!isReal()) {
  84706. return;
  84707. }
  84708. if (vjs) {
  84709. videojs$1 = vjs;
  84710. }
  84711. window_1.setTimeout(autoSetup, wait);
  84712. }
  84713. function setWindowLoaded() {
  84714. _windowLoaded = true;
  84715. window_1.removeEventListener("load", setWindowLoaded);
  84716. }
  84717. if (isReal()) {
  84718. if (document_1.readyState === "complete") {
  84719. setWindowLoaded();
  84720. } else {
  84721. window_1.addEventListener("load", setWindowLoaded);
  84722. }
  84723. }
  84724. var createStyleElement = function createStyleElement2(className) {
  84725. var style = document_1.createElement("style");
  84726. style.className = className;
  84727. return style;
  84728. };
  84729. var setTextContent = function setTextContent2(el, content) {
  84730. if (el.styleSheet) {
  84731. el.styleSheet.cssText = content;
  84732. } else {
  84733. el.textContent = content;
  84734. }
  84735. };
  84736. var _initialGuid = 3;
  84737. var _guid = _initialGuid;
  84738. function newGUID() {
  84739. return _guid++;
  84740. }
  84741. var FakeWeakMap;
  84742. if (!window_1.WeakMap) {
  84743. FakeWeakMap = /* @__PURE__ */ function() {
  84744. function FakeWeakMap2() {
  84745. this.vdata = "vdata" + Math.floor(window_1.performance && window_1.performance.now() || Date.now());
  84746. this.data = {};
  84747. }
  84748. var _proto = FakeWeakMap2.prototype;
  84749. _proto.set = function set4(key, value) {
  84750. var access = key[this.vdata] || newGUID();
  84751. if (!key[this.vdata]) {
  84752. key[this.vdata] = access;
  84753. }
  84754. this.data[access] = value;
  84755. return this;
  84756. };
  84757. _proto.get = function get7(key) {
  84758. var access = key[this.vdata];
  84759. if (access) {
  84760. return this.data[access];
  84761. }
  84762. log$1("We have no data for this element", key);
  84763. return void 0;
  84764. };
  84765. _proto.has = function has(key) {
  84766. var access = key[this.vdata];
  84767. return access in this.data;
  84768. };
  84769. _proto["delete"] = function _delete(key) {
  84770. var access = key[this.vdata];
  84771. if (access) {
  84772. delete this.data[access];
  84773. delete key[this.vdata];
  84774. }
  84775. };
  84776. return FakeWeakMap2;
  84777. }();
  84778. }
  84779. var DomData = window_1.WeakMap ? /* @__PURE__ */ new WeakMap() : new FakeWeakMap();
  84780. function _cleanUpEvents(elem, type2) {
  84781. if (!DomData.has(elem)) {
  84782. return;
  84783. }
  84784. var data = DomData.get(elem);
  84785. if (data.handlers[type2].length === 0) {
  84786. delete data.handlers[type2];
  84787. if (elem.removeEventListener) {
  84788. elem.removeEventListener(type2, data.dispatcher, false);
  84789. } else if (elem.detachEvent) {
  84790. elem.detachEvent("on" + type2, data.dispatcher);
  84791. }
  84792. }
  84793. if (Object.getOwnPropertyNames(data.handlers).length <= 0) {
  84794. delete data.handlers;
  84795. delete data.dispatcher;
  84796. delete data.disabled;
  84797. }
  84798. if (Object.getOwnPropertyNames(data).length === 0) {
  84799. DomData["delete"](elem);
  84800. }
  84801. }
  84802. function _handleMultipleEvents(fn2, elem, types, callback2) {
  84803. types.forEach(function(type2) {
  84804. fn2(elem, type2, callback2);
  84805. });
  84806. }
  84807. function fixEvent(event2) {
  84808. if (event2.fixed_) {
  84809. return event2;
  84810. }
  84811. function returnTrue() {
  84812. return true;
  84813. }
  84814. function returnFalse() {
  84815. return false;
  84816. }
  84817. if (!event2 || !event2.isPropagationStopped || !event2.isImmediatePropagationStopped) {
  84818. var old = event2 || window_1.event;
  84819. event2 = {};
  84820. for (var key in old) {
  84821. if (key !== "layerX" && key !== "layerY" && key !== "keyLocation" && key !== "webkitMovementX" && key !== "webkitMovementY" && key !== "path") {
  84822. if (!(key === "returnValue" && old.preventDefault)) {
  84823. event2[key] = old[key];
  84824. }
  84825. }
  84826. }
  84827. if (!event2.target) {
  84828. event2.target = event2.srcElement || document_1;
  84829. }
  84830. if (!event2.relatedTarget) {
  84831. event2.relatedTarget = event2.fromElement === event2.target ? event2.toElement : event2.fromElement;
  84832. }
  84833. event2.preventDefault = function() {
  84834. if (old.preventDefault) {
  84835. old.preventDefault();
  84836. }
  84837. event2.returnValue = false;
  84838. old.returnValue = false;
  84839. event2.defaultPrevented = true;
  84840. };
  84841. event2.defaultPrevented = false;
  84842. event2.stopPropagation = function() {
  84843. if (old.stopPropagation) {
  84844. old.stopPropagation();
  84845. }
  84846. event2.cancelBubble = true;
  84847. old.cancelBubble = true;
  84848. event2.isPropagationStopped = returnTrue;
  84849. };
  84850. event2.isPropagationStopped = returnFalse;
  84851. event2.stopImmediatePropagation = function() {
  84852. if (old.stopImmediatePropagation) {
  84853. old.stopImmediatePropagation();
  84854. }
  84855. event2.isImmediatePropagationStopped = returnTrue;
  84856. event2.stopPropagation();
  84857. };
  84858. event2.isImmediatePropagationStopped = returnFalse;
  84859. if (event2.clientX !== null && event2.clientX !== void 0) {
  84860. var doc = document_1.documentElement;
  84861. var body = document_1.body;
  84862. event2.pageX = event2.clientX + (doc && doc.scrollLeft || body && body.scrollLeft || 0) - (doc && doc.clientLeft || body && body.clientLeft || 0);
  84863. event2.pageY = event2.clientY + (doc && doc.scrollTop || body && body.scrollTop || 0) - (doc && doc.clientTop || body && body.clientTop || 0);
  84864. }
  84865. event2.which = event2.charCode || event2.keyCode;
  84866. if (event2.button !== null && event2.button !== void 0) {
  84867. event2.button = event2.button & 1 ? 0 : event2.button & 4 ? 1 : event2.button & 2 ? 2 : 0;
  84868. }
  84869. }
  84870. event2.fixed_ = true;
  84871. return event2;
  84872. }
  84873. var _supportsPassive;
  84874. var supportsPassive = function supportsPassive2() {
  84875. if (typeof _supportsPassive !== "boolean") {
  84876. _supportsPassive = false;
  84877. try {
  84878. var opts = Object.defineProperty({}, "passive", {
  84879. get: function get7() {
  84880. _supportsPassive = true;
  84881. }
  84882. });
  84883. window_1.addEventListener("test", null, opts);
  84884. window_1.removeEventListener("test", null, opts);
  84885. } catch (e) {
  84886. }
  84887. }
  84888. return _supportsPassive;
  84889. };
  84890. var passiveEvents = ["touchstart", "touchmove"];
  84891. function on(elem, type2, fn2) {
  84892. if (Array.isArray(type2)) {
  84893. return _handleMultipleEvents(on, elem, type2, fn2);
  84894. }
  84895. if (!DomData.has(elem)) {
  84896. DomData.set(elem, {});
  84897. }
  84898. var data = DomData.get(elem);
  84899. if (!data.handlers) {
  84900. data.handlers = {};
  84901. }
  84902. if (!data.handlers[type2]) {
  84903. data.handlers[type2] = [];
  84904. }
  84905. if (!fn2.guid) {
  84906. fn2.guid = newGUID();
  84907. }
  84908. data.handlers[type2].push(fn2);
  84909. if (!data.dispatcher) {
  84910. data.disabled = false;
  84911. data.dispatcher = function(event2, hash) {
  84912. if (data.disabled) {
  84913. return;
  84914. }
  84915. event2 = fixEvent(event2);
  84916. var handlers = data.handlers[event2.type];
  84917. if (handlers) {
  84918. var handlersCopy = handlers.slice(0);
  84919. for (var m = 0, n = handlersCopy.length; m < n; m++) {
  84920. if (event2.isImmediatePropagationStopped()) {
  84921. break;
  84922. } else {
  84923. try {
  84924. handlersCopy[m].call(elem, event2, hash);
  84925. } catch (e) {
  84926. log$1.error(e);
  84927. }
  84928. }
  84929. }
  84930. }
  84931. };
  84932. }
  84933. if (data.handlers[type2].length === 1) {
  84934. if (elem.addEventListener) {
  84935. var options2 = false;
  84936. if (supportsPassive() && passiveEvents.indexOf(type2) > -1) {
  84937. options2 = {
  84938. passive: true
  84939. };
  84940. }
  84941. elem.addEventListener(type2, data.dispatcher, options2);
  84942. } else if (elem.attachEvent) {
  84943. elem.attachEvent("on" + type2, data.dispatcher);
  84944. }
  84945. }
  84946. }
  84947. function off(elem, type2, fn2) {
  84948. if (!DomData.has(elem)) {
  84949. return;
  84950. }
  84951. var data = DomData.get(elem);
  84952. if (!data.handlers) {
  84953. return;
  84954. }
  84955. if (Array.isArray(type2)) {
  84956. return _handleMultipleEvents(off, elem, type2, fn2);
  84957. }
  84958. var removeType = function removeType2(el, t3) {
  84959. data.handlers[t3] = [];
  84960. _cleanUpEvents(el, t3);
  84961. };
  84962. if (type2 === void 0) {
  84963. for (var t2 in data.handlers) {
  84964. if (Object.prototype.hasOwnProperty.call(data.handlers || {}, t2)) {
  84965. removeType(elem, t2);
  84966. }
  84967. }
  84968. return;
  84969. }
  84970. var handlers = data.handlers[type2];
  84971. if (!handlers) {
  84972. return;
  84973. }
  84974. if (!fn2) {
  84975. removeType(elem, type2);
  84976. return;
  84977. }
  84978. if (fn2.guid) {
  84979. for (var n = 0; n < handlers.length; n++) {
  84980. if (handlers[n].guid === fn2.guid) {
  84981. handlers.splice(n--, 1);
  84982. }
  84983. }
  84984. }
  84985. _cleanUpEvents(elem, type2);
  84986. }
  84987. function trigger(elem, event2, hash) {
  84988. var elemData = DomData.has(elem) ? DomData.get(elem) : {};
  84989. var parent = elem.parentNode || elem.ownerDocument;
  84990. if (typeof event2 === "string") {
  84991. event2 = {
  84992. type: event2,
  84993. target: elem
  84994. };
  84995. } else if (!event2.target) {
  84996. event2.target = elem;
  84997. }
  84998. event2 = fixEvent(event2);
  84999. if (elemData.dispatcher) {
  85000. elemData.dispatcher.call(elem, event2, hash);
  85001. }
  85002. if (parent && !event2.isPropagationStopped() && event2.bubbles === true) {
  85003. trigger.call(null, parent, event2, hash);
  85004. } else if (!parent && !event2.defaultPrevented && event2.target && event2.target[event2.type]) {
  85005. if (!DomData.has(event2.target)) {
  85006. DomData.set(event2.target, {});
  85007. }
  85008. var targetData = DomData.get(event2.target);
  85009. if (event2.target[event2.type]) {
  85010. targetData.disabled = true;
  85011. if (typeof event2.target[event2.type] === "function") {
  85012. event2.target[event2.type]();
  85013. }
  85014. targetData.disabled = false;
  85015. }
  85016. }
  85017. return !event2.defaultPrevented;
  85018. }
  85019. function one(elem, type2, fn2) {
  85020. if (Array.isArray(type2)) {
  85021. return _handleMultipleEvents(one, elem, type2, fn2);
  85022. }
  85023. var func = function func2() {
  85024. off(elem, type2, func2);
  85025. fn2.apply(this, arguments);
  85026. };
  85027. func.guid = fn2.guid = fn2.guid || newGUID();
  85028. on(elem, type2, func);
  85029. }
  85030. function any(elem, type2, fn2) {
  85031. var func = function func2() {
  85032. off(elem, type2, func2);
  85033. fn2.apply(this, arguments);
  85034. };
  85035. func.guid = fn2.guid = fn2.guid || newGUID();
  85036. on(elem, type2, func);
  85037. }
  85038. var Events = /* @__PURE__ */ Object.freeze({
  85039. __proto__: null,
  85040. fixEvent,
  85041. on,
  85042. off,
  85043. trigger,
  85044. one,
  85045. any
  85046. });
  85047. var UPDATE_REFRESH_INTERVAL = 30;
  85048. var bind = function bind2(context, fn2, uid) {
  85049. if (!fn2.guid) {
  85050. fn2.guid = newGUID();
  85051. }
  85052. var bound = fn2.bind(context);
  85053. bound.guid = uid ? uid + "_" + fn2.guid : fn2.guid;
  85054. return bound;
  85055. };
  85056. var throttle = function throttle2(fn2, wait) {
  85057. var last = window_1.performance.now();
  85058. var throttled = function throttled2() {
  85059. var now2 = window_1.performance.now();
  85060. if (now2 - last >= wait) {
  85061. fn2.apply(void 0, arguments);
  85062. last = now2;
  85063. }
  85064. };
  85065. return throttled;
  85066. };
  85067. var debounce = function debounce2(func, wait, immediate, context) {
  85068. if (context === void 0) {
  85069. context = window_1;
  85070. }
  85071. var timeout;
  85072. var cancel = function cancel2() {
  85073. context.clearTimeout(timeout);
  85074. timeout = null;
  85075. };
  85076. var debounced = function debounced2() {
  85077. var self2 = this;
  85078. var args = arguments;
  85079. var _later = function later() {
  85080. timeout = null;
  85081. _later = null;
  85082. if (!immediate) {
  85083. func.apply(self2, args);
  85084. }
  85085. };
  85086. if (!timeout && immediate) {
  85087. func.apply(self2, args);
  85088. }
  85089. context.clearTimeout(timeout);
  85090. timeout = context.setTimeout(_later, wait);
  85091. };
  85092. debounced.cancel = cancel;
  85093. return debounced;
  85094. };
  85095. var EventTarget$2 = function EventTarget() {
  85096. };
  85097. EventTarget$2.prototype.allowedEvents_ = {};
  85098. EventTarget$2.prototype.on = function(type2, fn2) {
  85099. var ael = this.addEventListener;
  85100. this.addEventListener = function() {
  85101. };
  85102. on(this, type2, fn2);
  85103. this.addEventListener = ael;
  85104. };
  85105. EventTarget$2.prototype.addEventListener = EventTarget$2.prototype.on;
  85106. EventTarget$2.prototype.off = function(type2, fn2) {
  85107. off(this, type2, fn2);
  85108. };
  85109. EventTarget$2.prototype.removeEventListener = EventTarget$2.prototype.off;
  85110. EventTarget$2.prototype.one = function(type2, fn2) {
  85111. var ael = this.addEventListener;
  85112. this.addEventListener = function() {
  85113. };
  85114. one(this, type2, fn2);
  85115. this.addEventListener = ael;
  85116. };
  85117. EventTarget$2.prototype.any = function(type2, fn2) {
  85118. var ael = this.addEventListener;
  85119. this.addEventListener = function() {
  85120. };
  85121. any(this, type2, fn2);
  85122. this.addEventListener = ael;
  85123. };
  85124. EventTarget$2.prototype.trigger = function(event2) {
  85125. var type2 = event2.type || event2;
  85126. if (typeof event2 === "string") {
  85127. event2 = {
  85128. type: type2
  85129. };
  85130. }
  85131. event2 = fixEvent(event2);
  85132. if (this.allowedEvents_[type2] && this["on" + type2]) {
  85133. this["on" + type2](event2);
  85134. }
  85135. trigger(this, event2);
  85136. };
  85137. EventTarget$2.prototype.dispatchEvent = EventTarget$2.prototype.trigger;
  85138. var EVENT_MAP;
  85139. EventTarget$2.prototype.queueTrigger = function(event2) {
  85140. var _this = this;
  85141. if (!EVENT_MAP) {
  85142. EVENT_MAP = /* @__PURE__ */ new Map();
  85143. }
  85144. var type2 = event2.type || event2;
  85145. var map = EVENT_MAP.get(this);
  85146. if (!map) {
  85147. map = /* @__PURE__ */ new Map();
  85148. EVENT_MAP.set(this, map);
  85149. }
  85150. var oldTimeout = map.get(type2);
  85151. map["delete"](type2);
  85152. window_1.clearTimeout(oldTimeout);
  85153. var timeout = window_1.setTimeout(function() {
  85154. map["delete"](type2);
  85155. if (map.size === 0) {
  85156. map = null;
  85157. EVENT_MAP["delete"](_this);
  85158. }
  85159. _this.trigger(event2);
  85160. }, 0);
  85161. map.set(type2, timeout);
  85162. };
  85163. var objName = function objName2(obj) {
  85164. if (typeof obj.name === "function") {
  85165. return obj.name();
  85166. }
  85167. if (typeof obj.name === "string") {
  85168. return obj.name;
  85169. }
  85170. if (obj.name_) {
  85171. return obj.name_;
  85172. }
  85173. if (obj.constructor && obj.constructor.name) {
  85174. return obj.constructor.name;
  85175. }
  85176. return typeof obj;
  85177. };
  85178. var isEvented = function isEvented2(object) {
  85179. return object instanceof EventTarget$2 || !!object.eventBusEl_ && ["on", "one", "off", "trigger"].every(function(k) {
  85180. return typeof object[k] === "function";
  85181. });
  85182. };
  85183. var addEventedCallback = function addEventedCallback2(target, callback2) {
  85184. if (isEvented(target)) {
  85185. callback2();
  85186. } else {
  85187. if (!target.eventedCallbacks) {
  85188. target.eventedCallbacks = [];
  85189. }
  85190. target.eventedCallbacks.push(callback2);
  85191. }
  85192. };
  85193. var isValidEventType = function isValidEventType2(type2) {
  85194. return typeof type2 === "string" && /\S/.test(type2) || Array.isArray(type2) && !!type2.length;
  85195. };
  85196. var validateTarget = function validateTarget2(target, obj, fnName) {
  85197. if (!target || !target.nodeName && !isEvented(target)) {
  85198. throw new Error("Invalid target for " + objName(obj) + "#" + fnName + "; must be a DOM node or evented object.");
  85199. }
  85200. };
  85201. var validateEventType = function validateEventType2(type2, obj, fnName) {
  85202. if (!isValidEventType(type2)) {
  85203. throw new Error("Invalid event type for " + objName(obj) + "#" + fnName + "; must be a non-empty string or array.");
  85204. }
  85205. };
  85206. var validateListener = function validateListener2(listener, obj, fnName) {
  85207. if (typeof listener !== "function") {
  85208. throw new Error("Invalid listener for " + objName(obj) + "#" + fnName + "; must be a function.");
  85209. }
  85210. };
  85211. var normalizeListenArgs = function normalizeListenArgs2(self2, args, fnName) {
  85212. var isTargetingSelf = args.length < 3 || args[0] === self2 || args[0] === self2.eventBusEl_;
  85213. var target;
  85214. var type2;
  85215. var listener;
  85216. if (isTargetingSelf) {
  85217. target = self2.eventBusEl_;
  85218. if (args.length >= 3) {
  85219. args.shift();
  85220. }
  85221. type2 = args[0];
  85222. listener = args[1];
  85223. } else {
  85224. target = args[0];
  85225. type2 = args[1];
  85226. listener = args[2];
  85227. }
  85228. validateTarget(target, self2, fnName);
  85229. validateEventType(type2, self2, fnName);
  85230. validateListener(listener, self2, fnName);
  85231. listener = bind(self2, listener);
  85232. return {
  85233. isTargetingSelf,
  85234. target,
  85235. type: type2,
  85236. listener
  85237. };
  85238. };
  85239. var listen = function listen2(target, method, type2, listener) {
  85240. validateTarget(target, target, method);
  85241. if (target.nodeName) {
  85242. Events[method](target, type2, listener);
  85243. } else {
  85244. target[method](type2, listener);
  85245. }
  85246. };
  85247. var EventedMixin = {
  85248. on: function on2() {
  85249. var _this = this;
  85250. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  85251. args[_key] = arguments[_key];
  85252. }
  85253. var _normalizeListenArgs = normalizeListenArgs(this, args, "on"), isTargetingSelf = _normalizeListenArgs.isTargetingSelf, target = _normalizeListenArgs.target, type2 = _normalizeListenArgs.type, listener = _normalizeListenArgs.listener;
  85254. listen(target, "on", type2, listener);
  85255. if (!isTargetingSelf) {
  85256. var removeListenerOnDispose = function removeListenerOnDispose2() {
  85257. return _this.off(target, type2, listener);
  85258. };
  85259. removeListenerOnDispose.guid = listener.guid;
  85260. var removeRemoverOnTargetDispose = function removeRemoverOnTargetDispose2() {
  85261. return _this.off("dispose", removeListenerOnDispose);
  85262. };
  85263. removeRemoverOnTargetDispose.guid = listener.guid;
  85264. listen(this, "on", "dispose", removeListenerOnDispose);
  85265. listen(target, "on", "dispose", removeRemoverOnTargetDispose);
  85266. }
  85267. },
  85268. one: function one2() {
  85269. var _this2 = this;
  85270. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  85271. args[_key2] = arguments[_key2];
  85272. }
  85273. var _normalizeListenArgs2 = normalizeListenArgs(this, args, "one"), isTargetingSelf = _normalizeListenArgs2.isTargetingSelf, target = _normalizeListenArgs2.target, type2 = _normalizeListenArgs2.type, listener = _normalizeListenArgs2.listener;
  85274. if (isTargetingSelf) {
  85275. listen(target, "one", type2, listener);
  85276. } else {
  85277. var wrapper = function wrapper2() {
  85278. _this2.off(target, type2, wrapper2);
  85279. for (var _len3 = arguments.length, largs = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
  85280. largs[_key3] = arguments[_key3];
  85281. }
  85282. listener.apply(null, largs);
  85283. };
  85284. wrapper.guid = listener.guid;
  85285. listen(target, "one", type2, wrapper);
  85286. }
  85287. },
  85288. any: function any2() {
  85289. var _this3 = this;
  85290. for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
  85291. args[_key4] = arguments[_key4];
  85292. }
  85293. var _normalizeListenArgs3 = normalizeListenArgs(this, args, "any"), isTargetingSelf = _normalizeListenArgs3.isTargetingSelf, target = _normalizeListenArgs3.target, type2 = _normalizeListenArgs3.type, listener = _normalizeListenArgs3.listener;
  85294. if (isTargetingSelf) {
  85295. listen(target, "any", type2, listener);
  85296. } else {
  85297. var wrapper = function wrapper2() {
  85298. _this3.off(target, type2, wrapper2);
  85299. for (var _len5 = arguments.length, largs = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
  85300. largs[_key5] = arguments[_key5];
  85301. }
  85302. listener.apply(null, largs);
  85303. };
  85304. wrapper.guid = listener.guid;
  85305. listen(target, "any", type2, wrapper);
  85306. }
  85307. },
  85308. off: function off$12(targetOrType, typeOrListener, listener) {
  85309. if (!targetOrType || isValidEventType(targetOrType)) {
  85310. off(this.eventBusEl_, targetOrType, typeOrListener);
  85311. } else {
  85312. var target = targetOrType;
  85313. var type2 = typeOrListener;
  85314. validateTarget(target, this, "off");
  85315. validateEventType(type2, this, "off");
  85316. validateListener(listener, this, "off");
  85317. listener = bind(this, listener);
  85318. this.off("dispose", listener);
  85319. if (target.nodeName) {
  85320. off(target, type2, listener);
  85321. off(target, "dispose", listener);
  85322. } else if (isEvented(target)) {
  85323. target.off(type2, listener);
  85324. target.off("dispose", listener);
  85325. }
  85326. }
  85327. },
  85328. trigger: function trigger$12(event2, hash) {
  85329. validateTarget(this.eventBusEl_, this, "trigger");
  85330. var type2 = event2 && typeof event2 !== "string" ? event2.type : event2;
  85331. if (!isValidEventType(type2)) {
  85332. var error = "Invalid event type for " + objName(this) + "#trigger; must be a non-empty string or object with a type key that has a non-empty value.";
  85333. if (event2) {
  85334. (this.log || log$1).error(error);
  85335. } else {
  85336. throw new Error(error);
  85337. }
  85338. }
  85339. return trigger(this.eventBusEl_, event2, hash);
  85340. }
  85341. };
  85342. function evented(target, options2) {
  85343. if (options2 === void 0) {
  85344. options2 = {};
  85345. }
  85346. var _options = options2, eventBusKey = _options.eventBusKey;
  85347. if (eventBusKey) {
  85348. if (!target[eventBusKey].nodeName) {
  85349. throw new Error('The eventBusKey "' + eventBusKey + '" does not refer to an element.');
  85350. }
  85351. target.eventBusEl_ = target[eventBusKey];
  85352. } else {
  85353. target.eventBusEl_ = createEl("span", {
  85354. className: "vjs-event-bus"
  85355. });
  85356. }
  85357. assign(target, EventedMixin);
  85358. if (target.eventedCallbacks) {
  85359. target.eventedCallbacks.forEach(function(callback2) {
  85360. callback2();
  85361. });
  85362. }
  85363. target.on("dispose", function() {
  85364. target.off();
  85365. [target, target.el_, target.eventBusEl_].forEach(function(val) {
  85366. if (val && DomData.has(val)) {
  85367. DomData["delete"](val);
  85368. }
  85369. });
  85370. window_1.setTimeout(function() {
  85371. target.eventBusEl_ = null;
  85372. }, 0);
  85373. });
  85374. return target;
  85375. }
  85376. var StatefulMixin = {
  85377. state: {},
  85378. setState: function setState(stateUpdates) {
  85379. var _this = this;
  85380. if (typeof stateUpdates === "function") {
  85381. stateUpdates = stateUpdates();
  85382. }
  85383. var changes;
  85384. each(stateUpdates, function(value, key) {
  85385. if (_this.state[key] !== value) {
  85386. changes = changes || {};
  85387. changes[key] = {
  85388. from: _this.state[key],
  85389. to: value
  85390. };
  85391. }
  85392. _this.state[key] = value;
  85393. });
  85394. if (changes && isEvented(this)) {
  85395. this.trigger({
  85396. changes,
  85397. type: "statechanged"
  85398. });
  85399. }
  85400. return changes;
  85401. }
  85402. };
  85403. function stateful(target, defaultState) {
  85404. assign(target, StatefulMixin);
  85405. target.state = assign({}, target.state, defaultState);
  85406. if (typeof target.handleStateChanged === "function" && isEvented(target)) {
  85407. target.on("statechanged", target.handleStateChanged);
  85408. }
  85409. return target;
  85410. }
  85411. var toLowerCase = function toLowerCase2(string) {
  85412. if (typeof string !== "string") {
  85413. return string;
  85414. }
  85415. return string.replace(/./, function(w) {
  85416. return w.toLowerCase();
  85417. });
  85418. };
  85419. var toTitleCase$1 = function toTitleCase(string) {
  85420. if (typeof string !== "string") {
  85421. return string;
  85422. }
  85423. return string.replace(/./, function(w) {
  85424. return w.toUpperCase();
  85425. });
  85426. };
  85427. var titleCaseEquals = function titleCaseEquals2(str1, str2) {
  85428. return toTitleCase$1(str1) === toTitleCase$1(str2);
  85429. };
  85430. function mergeOptions$3() {
  85431. var result = {};
  85432. for (var _len = arguments.length, sources = new Array(_len), _key = 0; _key < _len; _key++) {
  85433. sources[_key] = arguments[_key];
  85434. }
  85435. sources.forEach(function(source) {
  85436. if (!source) {
  85437. return;
  85438. }
  85439. each(source, function(value, key) {
  85440. if (!isPlain(value)) {
  85441. result[key] = value;
  85442. return;
  85443. }
  85444. if (!isPlain(result[key])) {
  85445. result[key] = {};
  85446. }
  85447. result[key] = mergeOptions$3(result[key], value);
  85448. });
  85449. });
  85450. return result;
  85451. }
  85452. var MapSham = /* @__PURE__ */ function() {
  85453. function MapSham2() {
  85454. this.map_ = {};
  85455. }
  85456. var _proto = MapSham2.prototype;
  85457. _proto.has = function has(key) {
  85458. return key in this.map_;
  85459. };
  85460. _proto["delete"] = function _delete(key) {
  85461. var has = this.has(key);
  85462. delete this.map_[key];
  85463. return has;
  85464. };
  85465. _proto.set = function set4(key, value) {
  85466. this.map_[key] = value;
  85467. return this;
  85468. };
  85469. _proto.forEach = function forEach(callback2, thisArg) {
  85470. for (var key in this.map_) {
  85471. callback2.call(thisArg, this.map_[key], key, this);
  85472. }
  85473. };
  85474. return MapSham2;
  85475. }();
  85476. var Map$1 = window_1.Map ? window_1.Map : MapSham;
  85477. var SetSham = /* @__PURE__ */ function() {
  85478. function SetSham2() {
  85479. this.set_ = {};
  85480. }
  85481. var _proto = SetSham2.prototype;
  85482. _proto.has = function has(key) {
  85483. return key in this.set_;
  85484. };
  85485. _proto["delete"] = function _delete(key) {
  85486. var has = this.has(key);
  85487. delete this.set_[key];
  85488. return has;
  85489. };
  85490. _proto.add = function add(key) {
  85491. this.set_[key] = 1;
  85492. return this;
  85493. };
  85494. _proto.forEach = function forEach(callback2, thisArg) {
  85495. for (var key in this.set_) {
  85496. callback2.call(thisArg, key, key, this);
  85497. }
  85498. };
  85499. return SetSham2;
  85500. }();
  85501. var Set$1 = window_1.Set ? window_1.Set : SetSham;
  85502. var Component$1 = /* @__PURE__ */ function() {
  85503. function Component2(player, options2, ready) {
  85504. var _this = this;
  85505. if (!player && this.play) {
  85506. this.player_ = player = this;
  85507. } else {
  85508. this.player_ = player;
  85509. }
  85510. this.isDisposed_ = false;
  85511. this.parentComponent_ = null;
  85512. this.options_ = mergeOptions$3({}, this.options_);
  85513. options2 = this.options_ = mergeOptions$3(this.options_, options2);
  85514. this.id_ = options2.id || options2.el && options2.el.id;
  85515. if (!this.id_) {
  85516. var id = player && player.id && player.id() || "no_player";
  85517. this.id_ = id + "_component_" + newGUID();
  85518. }
  85519. this.name_ = options2.name || null;
  85520. if (options2.el) {
  85521. this.el_ = options2.el;
  85522. } else if (options2.createEl !== false) {
  85523. this.el_ = this.createEl();
  85524. }
  85525. if (options2.className && this.el_) {
  85526. options2.className.split(" ").forEach(function(c) {
  85527. return _this.addClass(c);
  85528. });
  85529. }
  85530. if (options2.evented !== false) {
  85531. evented(this, {
  85532. eventBusKey: this.el_ ? "el_" : null
  85533. });
  85534. this.handleLanguagechange = this.handleLanguagechange.bind(this);
  85535. this.on(this.player_, "languagechange", this.handleLanguagechange);
  85536. }
  85537. stateful(this, this.constructor.defaultState);
  85538. this.children_ = [];
  85539. this.childIndex_ = {};
  85540. this.childNameIndex_ = {};
  85541. this.setTimeoutIds_ = new Set$1();
  85542. this.setIntervalIds_ = new Set$1();
  85543. this.rafIds_ = new Set$1();
  85544. this.namedRafs_ = new Map$1();
  85545. this.clearingTimersOnDispose_ = false;
  85546. if (options2.initChildren !== false) {
  85547. this.initChildren();
  85548. }
  85549. this.ready(ready);
  85550. if (options2.reportTouchActivity !== false) {
  85551. this.enableTouchActivity();
  85552. }
  85553. }
  85554. var _proto = Component2.prototype;
  85555. _proto.dispose = function dispose(options2) {
  85556. if (options2 === void 0) {
  85557. options2 = {};
  85558. }
  85559. if (this.isDisposed_) {
  85560. return;
  85561. }
  85562. if (this.readyQueue_) {
  85563. this.readyQueue_.length = 0;
  85564. }
  85565. this.trigger({
  85566. type: "dispose",
  85567. bubbles: false
  85568. });
  85569. this.isDisposed_ = true;
  85570. if (this.children_) {
  85571. for (var i2 = this.children_.length - 1; i2 >= 0; i2--) {
  85572. if (this.children_[i2].dispose) {
  85573. this.children_[i2].dispose();
  85574. }
  85575. }
  85576. }
  85577. this.children_ = null;
  85578. this.childIndex_ = null;
  85579. this.childNameIndex_ = null;
  85580. this.parentComponent_ = null;
  85581. if (this.el_) {
  85582. if (this.el_.parentNode) {
  85583. if (options2.restoreEl) {
  85584. this.el_.parentNode.replaceChild(options2.restoreEl, this.el_);
  85585. } else {
  85586. this.el_.parentNode.removeChild(this.el_);
  85587. }
  85588. }
  85589. this.el_ = null;
  85590. }
  85591. this.player_ = null;
  85592. };
  85593. _proto.isDisposed = function isDisposed() {
  85594. return Boolean(this.isDisposed_);
  85595. };
  85596. _proto.player = function player() {
  85597. return this.player_;
  85598. };
  85599. _proto.options = function options2(obj) {
  85600. if (!obj) {
  85601. return this.options_;
  85602. }
  85603. this.options_ = mergeOptions$3(this.options_, obj);
  85604. return this.options_;
  85605. };
  85606. _proto.el = function el() {
  85607. return this.el_;
  85608. };
  85609. _proto.createEl = function createEl$12(tagName, properties, attributes) {
  85610. return createEl(tagName, properties, attributes);
  85611. };
  85612. _proto.localize = function localize(string, tokens, defaultValue2) {
  85613. if (defaultValue2 === void 0) {
  85614. defaultValue2 = string;
  85615. }
  85616. var code = this.player_.language && this.player_.language();
  85617. var languages = this.player_.languages && this.player_.languages();
  85618. var language = languages && languages[code];
  85619. var primaryCode = code && code.split("-")[0];
  85620. var primaryLang = languages && languages[primaryCode];
  85621. var localizedString = defaultValue2;
  85622. if (language && language[string]) {
  85623. localizedString = language[string];
  85624. } else if (primaryLang && primaryLang[string]) {
  85625. localizedString = primaryLang[string];
  85626. }
  85627. if (tokens) {
  85628. localizedString = localizedString.replace(/\{(\d+)\}/g, function(match, index2) {
  85629. var value = tokens[index2 - 1];
  85630. var ret = value;
  85631. if (typeof value === "undefined") {
  85632. ret = match;
  85633. }
  85634. return ret;
  85635. });
  85636. }
  85637. return localizedString;
  85638. };
  85639. _proto.handleLanguagechange = function handleLanguagechange() {
  85640. };
  85641. _proto.contentEl = function contentEl() {
  85642. return this.contentEl_ || this.el_;
  85643. };
  85644. _proto.id = function id() {
  85645. return this.id_;
  85646. };
  85647. _proto.name = function name() {
  85648. return this.name_;
  85649. };
  85650. _proto.children = function children() {
  85651. return this.children_;
  85652. };
  85653. _proto.getChildById = function getChildById(id) {
  85654. return this.childIndex_[id];
  85655. };
  85656. _proto.getChild = function getChild(name) {
  85657. if (!name) {
  85658. return;
  85659. }
  85660. return this.childNameIndex_[name];
  85661. };
  85662. _proto.getDescendant = function getDescendant() {
  85663. for (var _len = arguments.length, names2 = new Array(_len), _key = 0; _key < _len; _key++) {
  85664. names2[_key] = arguments[_key];
  85665. }
  85666. names2 = names2.reduce(function(acc, n) {
  85667. return acc.concat(n);
  85668. }, []);
  85669. var currentChild = this;
  85670. for (var i2 = 0; i2 < names2.length; i2++) {
  85671. currentChild = currentChild.getChild(names2[i2]);
  85672. if (!currentChild || !currentChild.getChild) {
  85673. return;
  85674. }
  85675. }
  85676. return currentChild;
  85677. };
  85678. _proto.addChild = function addChild(child, options2, index2) {
  85679. if (options2 === void 0) {
  85680. options2 = {};
  85681. }
  85682. if (index2 === void 0) {
  85683. index2 = this.children_.length;
  85684. }
  85685. var component;
  85686. var componentName;
  85687. if (typeof child === "string") {
  85688. componentName = toTitleCase$1(child);
  85689. var componentClassName = options2.componentClass || componentName;
  85690. options2.name = componentName;
  85691. var ComponentClass = Component2.getComponent(componentClassName);
  85692. if (!ComponentClass) {
  85693. throw new Error("Component " + componentClassName + " does not exist");
  85694. }
  85695. if (typeof ComponentClass !== "function") {
  85696. return null;
  85697. }
  85698. component = new ComponentClass(this.player_ || this, options2);
  85699. } else {
  85700. component = child;
  85701. }
  85702. if (component.parentComponent_) {
  85703. component.parentComponent_.removeChild(component);
  85704. }
  85705. this.children_.splice(index2, 0, component);
  85706. component.parentComponent_ = this;
  85707. if (typeof component.id === "function") {
  85708. this.childIndex_[component.id()] = component;
  85709. }
  85710. componentName = componentName || component.name && toTitleCase$1(component.name());
  85711. if (componentName) {
  85712. this.childNameIndex_[componentName] = component;
  85713. this.childNameIndex_[toLowerCase(componentName)] = component;
  85714. }
  85715. if (typeof component.el === "function" && component.el()) {
  85716. var refNode = null;
  85717. if (this.children_[index2 + 1]) {
  85718. if (this.children_[index2 + 1].el_) {
  85719. refNode = this.children_[index2 + 1].el_;
  85720. } else if (isEl(this.children_[index2 + 1])) {
  85721. refNode = this.children_[index2 + 1];
  85722. }
  85723. }
  85724. this.contentEl().insertBefore(component.el(), refNode);
  85725. }
  85726. return component;
  85727. };
  85728. _proto.removeChild = function removeChild(component) {
  85729. if (typeof component === "string") {
  85730. component = this.getChild(component);
  85731. }
  85732. if (!component || !this.children_) {
  85733. return;
  85734. }
  85735. var childFound = false;
  85736. for (var i2 = this.children_.length - 1; i2 >= 0; i2--) {
  85737. if (this.children_[i2] === component) {
  85738. childFound = true;
  85739. this.children_.splice(i2, 1);
  85740. break;
  85741. }
  85742. }
  85743. if (!childFound) {
  85744. return;
  85745. }
  85746. component.parentComponent_ = null;
  85747. this.childIndex_[component.id()] = null;
  85748. this.childNameIndex_[toTitleCase$1(component.name())] = null;
  85749. this.childNameIndex_[toLowerCase(component.name())] = null;
  85750. var compEl = component.el();
  85751. if (compEl && compEl.parentNode === this.contentEl()) {
  85752. this.contentEl().removeChild(component.el());
  85753. }
  85754. };
  85755. _proto.initChildren = function initChildren() {
  85756. var _this2 = this;
  85757. var children = this.options_.children;
  85758. if (children) {
  85759. var parentOptions = this.options_;
  85760. var handleAdd = function handleAdd2(child) {
  85761. var name = child.name;
  85762. var opts = child.opts;
  85763. if (parentOptions[name] !== void 0) {
  85764. opts = parentOptions[name];
  85765. }
  85766. if (opts === false) {
  85767. return;
  85768. }
  85769. if (opts === true) {
  85770. opts = {};
  85771. }
  85772. opts.playerOptions = _this2.options_.playerOptions;
  85773. var newChild = _this2.addChild(name, opts);
  85774. if (newChild) {
  85775. _this2[name] = newChild;
  85776. }
  85777. };
  85778. var workingChildren;
  85779. var Tech2 = Component2.getComponent("Tech");
  85780. if (Array.isArray(children)) {
  85781. workingChildren = children;
  85782. } else {
  85783. workingChildren = Object.keys(children);
  85784. }
  85785. workingChildren.concat(Object.keys(this.options_).filter(function(child) {
  85786. return !workingChildren.some(function(wchild) {
  85787. if (typeof wchild === "string") {
  85788. return child === wchild;
  85789. }
  85790. return child === wchild.name;
  85791. });
  85792. })).map(function(child) {
  85793. var name;
  85794. var opts;
  85795. if (typeof child === "string") {
  85796. name = child;
  85797. opts = children[name] || _this2.options_[name] || {};
  85798. } else {
  85799. name = child.name;
  85800. opts = child;
  85801. }
  85802. return {
  85803. name,
  85804. opts
  85805. };
  85806. }).filter(function(child) {
  85807. var c = Component2.getComponent(child.opts.componentClass || toTitleCase$1(child.name));
  85808. return c && !Tech2.isTech(c);
  85809. }).forEach(handleAdd);
  85810. }
  85811. };
  85812. _proto.buildCSSClass = function buildCSSClass() {
  85813. return "";
  85814. };
  85815. _proto.ready = function ready(fn2, sync) {
  85816. if (sync === void 0) {
  85817. sync = false;
  85818. }
  85819. if (!fn2) {
  85820. return;
  85821. }
  85822. if (!this.isReady_) {
  85823. this.readyQueue_ = this.readyQueue_ || [];
  85824. this.readyQueue_.push(fn2);
  85825. return;
  85826. }
  85827. if (sync) {
  85828. fn2.call(this);
  85829. } else {
  85830. this.setTimeout(fn2, 1);
  85831. }
  85832. };
  85833. _proto.triggerReady = function triggerReady() {
  85834. this.isReady_ = true;
  85835. this.setTimeout(function() {
  85836. var readyQueue = this.readyQueue_;
  85837. this.readyQueue_ = [];
  85838. if (readyQueue && readyQueue.length > 0) {
  85839. readyQueue.forEach(function(fn2) {
  85840. fn2.call(this);
  85841. }, this);
  85842. }
  85843. this.trigger("ready");
  85844. }, 1);
  85845. };
  85846. _proto.$ = function $$12(selector, context) {
  85847. return $(selector, context || this.contentEl());
  85848. };
  85849. _proto.$$ = function $$$12(selector, context) {
  85850. return $$(selector, context || this.contentEl());
  85851. };
  85852. _proto.hasClass = function hasClass$12(classToCheck) {
  85853. return hasClass(this.el_, classToCheck);
  85854. };
  85855. _proto.addClass = function addClass$12(classToAdd) {
  85856. addClass(this.el_, classToAdd);
  85857. };
  85858. _proto.removeClass = function removeClass$12(classToRemove) {
  85859. removeClass(this.el_, classToRemove);
  85860. };
  85861. _proto.toggleClass = function toggleClass$12(classToToggle, predicate) {
  85862. toggleClass(this.el_, classToToggle, predicate);
  85863. };
  85864. _proto.show = function show() {
  85865. this.removeClass("vjs-hidden");
  85866. };
  85867. _proto.hide = function hide() {
  85868. this.addClass("vjs-hidden");
  85869. };
  85870. _proto.lockShowing = function lockShowing() {
  85871. this.addClass("vjs-lock-showing");
  85872. };
  85873. _proto.unlockShowing = function unlockShowing() {
  85874. this.removeClass("vjs-lock-showing");
  85875. };
  85876. _proto.getAttribute = function getAttribute$12(attribute) {
  85877. return getAttribute(this.el_, attribute);
  85878. };
  85879. _proto.setAttribute = function setAttribute$12(attribute, value) {
  85880. setAttribute(this.el_, attribute, value);
  85881. };
  85882. _proto.removeAttribute = function removeAttribute$12(attribute) {
  85883. removeAttribute(this.el_, attribute);
  85884. };
  85885. _proto.width = function width2(num, skipListeners) {
  85886. return this.dimension("width", num, skipListeners);
  85887. };
  85888. _proto.height = function height2(num, skipListeners) {
  85889. return this.dimension("height", num, skipListeners);
  85890. };
  85891. _proto.dimensions = function dimensions(width2, height2) {
  85892. this.width(width2, true);
  85893. this.height(height2);
  85894. };
  85895. _proto.dimension = function dimension(widthOrHeight, num, skipListeners) {
  85896. if (num !== void 0) {
  85897. if (num === null || num !== num) {
  85898. num = 0;
  85899. }
  85900. if (("" + num).indexOf("%") !== -1 || ("" + num).indexOf("px") !== -1) {
  85901. this.el_.style[widthOrHeight] = num;
  85902. } else if (num === "auto") {
  85903. this.el_.style[widthOrHeight] = "";
  85904. } else {
  85905. this.el_.style[widthOrHeight] = num + "px";
  85906. }
  85907. if (!skipListeners) {
  85908. this.trigger("componentresize");
  85909. }
  85910. return;
  85911. }
  85912. if (!this.el_) {
  85913. return 0;
  85914. }
  85915. var val = this.el_.style[widthOrHeight];
  85916. var pxIndex = val.indexOf("px");
  85917. if (pxIndex !== -1) {
  85918. return parseInt(val.slice(0, pxIndex), 10);
  85919. }
  85920. return parseInt(this.el_["offset" + toTitleCase$1(widthOrHeight)], 10);
  85921. };
  85922. _proto.currentDimension = function currentDimension(widthOrHeight) {
  85923. var computedWidthOrHeight = 0;
  85924. if (widthOrHeight !== "width" && widthOrHeight !== "height") {
  85925. throw new Error("currentDimension only accepts width or height value");
  85926. }
  85927. computedWidthOrHeight = computedStyle(this.el_, widthOrHeight);
  85928. computedWidthOrHeight = parseFloat(computedWidthOrHeight);
  85929. if (computedWidthOrHeight === 0 || isNaN(computedWidthOrHeight)) {
  85930. var rule = "offset" + toTitleCase$1(widthOrHeight);
  85931. computedWidthOrHeight = this.el_[rule];
  85932. }
  85933. return computedWidthOrHeight;
  85934. };
  85935. _proto.currentDimensions = function currentDimensions() {
  85936. return {
  85937. width: this.currentDimension("width"),
  85938. height: this.currentDimension("height")
  85939. };
  85940. };
  85941. _proto.currentWidth = function currentWidth() {
  85942. return this.currentDimension("width");
  85943. };
  85944. _proto.currentHeight = function currentHeight() {
  85945. return this.currentDimension("height");
  85946. };
  85947. _proto.focus = function focus() {
  85948. this.el_.focus();
  85949. };
  85950. _proto.blur = function blur() {
  85951. this.el_.blur();
  85952. };
  85953. _proto.handleKeyDown = function handleKeyDown(event2) {
  85954. if (this.player_) {
  85955. if (!keycode.isEventKey(event2, "Tab")) {
  85956. event2.stopPropagation();
  85957. }
  85958. this.player_.handleKeyDown(event2);
  85959. }
  85960. };
  85961. _proto.handleKeyPress = function handleKeyPress(event2) {
  85962. this.handleKeyDown(event2);
  85963. };
  85964. _proto.emitTapEvents = function emitTapEvents() {
  85965. var touchStart = 0;
  85966. var firstTouch = null;
  85967. var tapMovementThreshold = 10;
  85968. var touchTimeThreshold = 200;
  85969. var couldBeTap;
  85970. this.on("touchstart", function(event2) {
  85971. if (event2.touches.length === 1) {
  85972. firstTouch = {
  85973. pageX: event2.touches[0].pageX,
  85974. pageY: event2.touches[0].pageY
  85975. };
  85976. touchStart = window_1.performance.now();
  85977. couldBeTap = true;
  85978. }
  85979. });
  85980. this.on("touchmove", function(event2) {
  85981. if (event2.touches.length > 1) {
  85982. couldBeTap = false;
  85983. } else if (firstTouch) {
  85984. var xdiff = event2.touches[0].pageX - firstTouch.pageX;
  85985. var ydiff = event2.touches[0].pageY - firstTouch.pageY;
  85986. var touchDistance = Math.sqrt(xdiff * xdiff + ydiff * ydiff);
  85987. if (touchDistance > tapMovementThreshold) {
  85988. couldBeTap = false;
  85989. }
  85990. }
  85991. });
  85992. var noTap = function noTap2() {
  85993. couldBeTap = false;
  85994. };
  85995. this.on("touchleave", noTap);
  85996. this.on("touchcancel", noTap);
  85997. this.on("touchend", function(event2) {
  85998. firstTouch = null;
  85999. if (couldBeTap === true) {
  86000. var touchTime = window_1.performance.now() - touchStart;
  86001. if (touchTime < touchTimeThreshold) {
  86002. event2.preventDefault();
  86003. this.trigger("tap");
  86004. }
  86005. }
  86006. });
  86007. };
  86008. _proto.enableTouchActivity = function enableTouchActivity() {
  86009. if (!this.player() || !this.player().reportUserActivity) {
  86010. return;
  86011. }
  86012. var report = bind(this.player(), this.player().reportUserActivity);
  86013. var touchHolding;
  86014. this.on("touchstart", function() {
  86015. report();
  86016. this.clearInterval(touchHolding);
  86017. touchHolding = this.setInterval(report, 250);
  86018. });
  86019. var touchEnd = function touchEnd2(event2) {
  86020. report();
  86021. this.clearInterval(touchHolding);
  86022. };
  86023. this.on("touchmove", report);
  86024. this.on("touchend", touchEnd);
  86025. this.on("touchcancel", touchEnd);
  86026. };
  86027. _proto.setTimeout = function setTimeout2(fn2, timeout) {
  86028. var _this3 = this;
  86029. var timeoutId;
  86030. fn2 = bind(this, fn2);
  86031. this.clearTimersOnDispose_();
  86032. timeoutId = window_1.setTimeout(function() {
  86033. if (_this3.setTimeoutIds_.has(timeoutId)) {
  86034. _this3.setTimeoutIds_["delete"](timeoutId);
  86035. }
  86036. fn2();
  86037. }, timeout);
  86038. this.setTimeoutIds_.add(timeoutId);
  86039. return timeoutId;
  86040. };
  86041. _proto.clearTimeout = function clearTimeout2(timeoutId) {
  86042. if (this.setTimeoutIds_.has(timeoutId)) {
  86043. this.setTimeoutIds_["delete"](timeoutId);
  86044. window_1.clearTimeout(timeoutId);
  86045. }
  86046. return timeoutId;
  86047. };
  86048. _proto.setInterval = function setInterval2(fn2, interval) {
  86049. fn2 = bind(this, fn2);
  86050. this.clearTimersOnDispose_();
  86051. var intervalId = window_1.setInterval(fn2, interval);
  86052. this.setIntervalIds_.add(intervalId);
  86053. return intervalId;
  86054. };
  86055. _proto.clearInterval = function clearInterval2(intervalId) {
  86056. if (this.setIntervalIds_.has(intervalId)) {
  86057. this.setIntervalIds_["delete"](intervalId);
  86058. window_1.clearInterval(intervalId);
  86059. }
  86060. return intervalId;
  86061. };
  86062. _proto.requestAnimationFrame = function requestAnimationFrame(fn2) {
  86063. var _this4 = this;
  86064. if (!this.supportsRaf_) {
  86065. return this.setTimeout(fn2, 1e3 / 60);
  86066. }
  86067. this.clearTimersOnDispose_();
  86068. var id;
  86069. fn2 = bind(this, fn2);
  86070. id = window_1.requestAnimationFrame(function() {
  86071. if (_this4.rafIds_.has(id)) {
  86072. _this4.rafIds_["delete"](id);
  86073. }
  86074. fn2();
  86075. });
  86076. this.rafIds_.add(id);
  86077. return id;
  86078. };
  86079. _proto.requestNamedAnimationFrame = function requestNamedAnimationFrame(name, fn2) {
  86080. var _this5 = this;
  86081. if (this.namedRafs_.has(name)) {
  86082. return;
  86083. }
  86084. this.clearTimersOnDispose_();
  86085. fn2 = bind(this, fn2);
  86086. var id = this.requestAnimationFrame(function() {
  86087. fn2();
  86088. if (_this5.namedRafs_.has(name)) {
  86089. _this5.namedRafs_["delete"](name);
  86090. }
  86091. });
  86092. this.namedRafs_.set(name, id);
  86093. return name;
  86094. };
  86095. _proto.cancelNamedAnimationFrame = function cancelNamedAnimationFrame(name) {
  86096. if (!this.namedRafs_.has(name)) {
  86097. return;
  86098. }
  86099. this.cancelAnimationFrame(this.namedRafs_.get(name));
  86100. this.namedRafs_["delete"](name);
  86101. };
  86102. _proto.cancelAnimationFrame = function cancelAnimationFrame(id) {
  86103. if (!this.supportsRaf_) {
  86104. return this.clearTimeout(id);
  86105. }
  86106. if (this.rafIds_.has(id)) {
  86107. this.rafIds_["delete"](id);
  86108. window_1.cancelAnimationFrame(id);
  86109. }
  86110. return id;
  86111. };
  86112. _proto.clearTimersOnDispose_ = function clearTimersOnDispose_() {
  86113. var _this6 = this;
  86114. if (this.clearingTimersOnDispose_) {
  86115. return;
  86116. }
  86117. this.clearingTimersOnDispose_ = true;
  86118. this.one("dispose", function() {
  86119. [["namedRafs_", "cancelNamedAnimationFrame"], ["rafIds_", "cancelAnimationFrame"], ["setTimeoutIds_", "clearTimeout"], ["setIntervalIds_", "clearInterval"]].forEach(function(_ref) {
  86120. var idName = _ref[0], cancelName = _ref[1];
  86121. _this6[idName].forEach(function(val, key) {
  86122. return _this6[cancelName](key);
  86123. });
  86124. });
  86125. _this6.clearingTimersOnDispose_ = false;
  86126. });
  86127. };
  86128. Component2.registerComponent = function registerComponent(name, ComponentToRegister) {
  86129. if (typeof name !== "string" || !name) {
  86130. throw new Error('Illegal component name, "' + name + '"; must be a non-empty string.');
  86131. }
  86132. var Tech2 = Component2.getComponent("Tech");
  86133. var isTech = Tech2 && Tech2.isTech(ComponentToRegister);
  86134. var isComp = Component2 === ComponentToRegister || Component2.prototype.isPrototypeOf(ComponentToRegister.prototype);
  86135. if (isTech || !isComp) {
  86136. var reason;
  86137. if (isTech) {
  86138. reason = "techs must be registered using Tech.registerTech()";
  86139. } else {
  86140. reason = "must be a Component subclass";
  86141. }
  86142. throw new Error('Illegal component, "' + name + '"; ' + reason + ".");
  86143. }
  86144. name = toTitleCase$1(name);
  86145. if (!Component2.components_) {
  86146. Component2.components_ = {};
  86147. }
  86148. var Player2 = Component2.getComponent("Player");
  86149. if (name === "Player" && Player2 && Player2.players) {
  86150. var players = Player2.players;
  86151. var playerNames = Object.keys(players);
  86152. if (players && playerNames.length > 0 && playerNames.map(function(pname) {
  86153. return players[pname];
  86154. }).every(Boolean)) {
  86155. throw new Error("Can not register Player component after player has been created.");
  86156. }
  86157. }
  86158. Component2.components_[name] = ComponentToRegister;
  86159. Component2.components_[toLowerCase(name)] = ComponentToRegister;
  86160. return ComponentToRegister;
  86161. };
  86162. Component2.getComponent = function getComponent(name) {
  86163. if (!name || !Component2.components_) {
  86164. return;
  86165. }
  86166. return Component2.components_[name];
  86167. };
  86168. return Component2;
  86169. }();
  86170. Component$1.prototype.supportsRaf_ = typeof window_1.requestAnimationFrame === "function" && typeof window_1.cancelAnimationFrame === "function";
  86171. Component$1.registerComponent("Component", Component$1);
  86172. function rangeCheck(fnName, index2, maxIndex) {
  86173. if (typeof index2 !== "number" || index2 < 0 || index2 > maxIndex) {
  86174. throw new Error("Failed to execute '" + fnName + "' on 'TimeRanges': The index provided (" + index2 + ") is non-numeric or out of bounds (0-" + maxIndex + ").");
  86175. }
  86176. }
  86177. function getRange(fnName, valueIndex, ranges, rangeIndex) {
  86178. rangeCheck(fnName, rangeIndex, ranges.length - 1);
  86179. return ranges[rangeIndex][valueIndex];
  86180. }
  86181. function createTimeRangesObj(ranges) {
  86182. var timeRangesObj;
  86183. if (ranges === void 0 || ranges.length === 0) {
  86184. timeRangesObj = {
  86185. length: 0,
  86186. start: function start2() {
  86187. throw new Error("This TimeRanges object is empty");
  86188. },
  86189. end: function end() {
  86190. throw new Error("This TimeRanges object is empty");
  86191. }
  86192. };
  86193. } else {
  86194. timeRangesObj = {
  86195. length: ranges.length,
  86196. start: getRange.bind(null, "start", 0, ranges),
  86197. end: getRange.bind(null, "end", 1, ranges)
  86198. };
  86199. }
  86200. if (window_1.Symbol && window_1.Symbol.iterator) {
  86201. timeRangesObj[window_1.Symbol.iterator] = function() {
  86202. return (ranges || []).values();
  86203. };
  86204. }
  86205. return timeRangesObj;
  86206. }
  86207. function createTimeRanges(start2, end) {
  86208. if (Array.isArray(start2)) {
  86209. return createTimeRangesObj(start2);
  86210. } else if (start2 === void 0 || end === void 0) {
  86211. return createTimeRangesObj();
  86212. }
  86213. return createTimeRangesObj([[start2, end]]);
  86214. }
  86215. function bufferedPercent(buffered, duration5) {
  86216. var bufferedDuration = 0;
  86217. var start2;
  86218. var end;
  86219. if (!duration5) {
  86220. return 0;
  86221. }
  86222. if (!buffered || !buffered.length) {
  86223. buffered = createTimeRanges(0, 0);
  86224. }
  86225. for (var i2 = 0; i2 < buffered.length; i2++) {
  86226. start2 = buffered.start(i2);
  86227. end = buffered.end(i2);
  86228. if (end > duration5) {
  86229. end = duration5;
  86230. }
  86231. bufferedDuration += end - start2;
  86232. }
  86233. return bufferedDuration / duration5;
  86234. }
  86235. function MediaError(value) {
  86236. if (value instanceof MediaError) {
  86237. return value;
  86238. }
  86239. if (typeof value === "number") {
  86240. this.code = value;
  86241. } else if (typeof value === "string") {
  86242. this.message = value;
  86243. } else if (isObject2(value)) {
  86244. if (typeof value.code === "number") {
  86245. this.code = value.code;
  86246. }
  86247. assign(this, value);
  86248. }
  86249. if (!this.message) {
  86250. this.message = MediaError.defaultMessages[this.code] || "";
  86251. }
  86252. }
  86253. MediaError.prototype.code = 0;
  86254. MediaError.prototype.message = "";
  86255. MediaError.prototype.status = null;
  86256. MediaError.errorTypes = ["MEDIA_ERR_CUSTOM", "MEDIA_ERR_ABORTED", "MEDIA_ERR_NETWORK", "MEDIA_ERR_DECODE", "MEDIA_ERR_SRC_NOT_SUPPORTED", "MEDIA_ERR_ENCRYPTED"];
  86257. MediaError.defaultMessages = {
  86258. 1: "You aborted the media playback",
  86259. 2: "A network error caused the media download to fail part-way.",
  86260. 3: "The media playback was aborted due to a corruption problem or because the media used features your browser did not support.",
  86261. 4: "The media could not be loaded, either because the server or network failed or because the format is not supported.",
  86262. 5: "The media is encrypted and we do not have the keys to decrypt it."
  86263. };
  86264. for (var errNum = 0; errNum < MediaError.errorTypes.length; errNum++) {
  86265. MediaError[MediaError.errorTypes[errNum]] = errNum;
  86266. MediaError.prototype[MediaError.errorTypes[errNum]] = errNum;
  86267. }
  86268. function isPromise(value) {
  86269. return value !== void 0 && value !== null && typeof value.then === "function";
  86270. }
  86271. function silencePromise(value) {
  86272. if (isPromise(value)) {
  86273. value.then(null, function(e) {
  86274. });
  86275. }
  86276. }
  86277. var trackToJson_ = function trackToJson_2(track) {
  86278. var ret = ["kind", "label", "language", "id", "inBandMetadataTrackDispatchType", "mode", "src"].reduce(function(acc, prop, i2) {
  86279. if (track[prop]) {
  86280. acc[prop] = track[prop];
  86281. }
  86282. return acc;
  86283. }, {
  86284. cues: track.cues && Array.prototype.map.call(track.cues, function(cue) {
  86285. return {
  86286. startTime: cue.startTime,
  86287. endTime: cue.endTime,
  86288. text: cue.text,
  86289. id: cue.id
  86290. };
  86291. })
  86292. });
  86293. return ret;
  86294. };
  86295. var textTracksToJson = function textTracksToJson2(tech) {
  86296. var trackEls = tech.$$("track");
  86297. var trackObjs = Array.prototype.map.call(trackEls, function(t2) {
  86298. return t2.track;
  86299. });
  86300. var tracks = Array.prototype.map.call(trackEls, function(trackEl) {
  86301. var json = trackToJson_(trackEl.track);
  86302. if (trackEl.src) {
  86303. json.src = trackEl.src;
  86304. }
  86305. return json;
  86306. });
  86307. return tracks.concat(Array.prototype.filter.call(tech.textTracks(), function(track) {
  86308. return trackObjs.indexOf(track) === -1;
  86309. }).map(trackToJson_));
  86310. };
  86311. var jsonToTextTracks = function jsonToTextTracks2(json, tech) {
  86312. json.forEach(function(track) {
  86313. var addedTrack = tech.addRemoteTextTrack(track).track;
  86314. if (!track.src && track.cues) {
  86315. track.cues.forEach(function(cue) {
  86316. return addedTrack.addCue(cue);
  86317. });
  86318. }
  86319. });
  86320. return tech.textTracks();
  86321. };
  86322. var textTrackConverter = {
  86323. textTracksToJson,
  86324. jsonToTextTracks,
  86325. trackToJson_
  86326. };
  86327. var MODAL_CLASS_NAME = "vjs-modal-dialog";
  86328. var ModalDialog = /* @__PURE__ */ function(_Component) {
  86329. _inheritsLoose(ModalDialog2, _Component);
  86330. function ModalDialog2(player, options2) {
  86331. var _this;
  86332. _this = _Component.call(this, player, options2) || this;
  86333. _this.handleKeyDown_ = function(e) {
  86334. return _this.handleKeyDown(e);
  86335. };
  86336. _this.close_ = function(e) {
  86337. return _this.close(e);
  86338. };
  86339. _this.opened_ = _this.hasBeenOpened_ = _this.hasBeenFilled_ = false;
  86340. _this.closeable(!_this.options_.uncloseable);
  86341. _this.content(_this.options_.content);
  86342. _this.contentEl_ = createEl("div", {
  86343. className: MODAL_CLASS_NAME + "-content"
  86344. }, {
  86345. role: "document"
  86346. });
  86347. _this.descEl_ = createEl("p", {
  86348. className: MODAL_CLASS_NAME + "-description vjs-control-text",
  86349. id: _this.el().getAttribute("aria-describedby")
  86350. });
  86351. textContent(_this.descEl_, _this.description());
  86352. _this.el_.appendChild(_this.descEl_);
  86353. _this.el_.appendChild(_this.contentEl_);
  86354. return _this;
  86355. }
  86356. var _proto = ModalDialog2.prototype;
  86357. _proto.createEl = function createEl2() {
  86358. return _Component.prototype.createEl.call(this, "div", {
  86359. className: this.buildCSSClass(),
  86360. tabIndex: -1
  86361. }, {
  86362. "aria-describedby": this.id() + "_description",
  86363. "aria-hidden": "true",
  86364. "aria-label": this.label(),
  86365. "role": "dialog"
  86366. });
  86367. };
  86368. _proto.dispose = function dispose() {
  86369. this.contentEl_ = null;
  86370. this.descEl_ = null;
  86371. this.previouslyActiveEl_ = null;
  86372. _Component.prototype.dispose.call(this);
  86373. };
  86374. _proto.buildCSSClass = function buildCSSClass() {
  86375. return MODAL_CLASS_NAME + " vjs-hidden " + _Component.prototype.buildCSSClass.call(this);
  86376. };
  86377. _proto.label = function label() {
  86378. return this.localize(this.options_.label || "Modal Window");
  86379. };
  86380. _proto.description = function description() {
  86381. var desc = this.options_.description || this.localize("This is a modal window.");
  86382. if (this.closeable()) {
  86383. desc += " " + this.localize("This modal can be closed by pressing the Escape key or activating the close button.");
  86384. }
  86385. return desc;
  86386. };
  86387. _proto.open = function open() {
  86388. if (!this.opened_) {
  86389. var player = this.player();
  86390. this.trigger("beforemodalopen");
  86391. this.opened_ = true;
  86392. if (this.options_.fillAlways || !this.hasBeenOpened_ && !this.hasBeenFilled_) {
  86393. this.fill();
  86394. }
  86395. this.wasPlaying_ = !player.paused();
  86396. if (this.options_.pauseOnOpen && this.wasPlaying_) {
  86397. player.pause();
  86398. }
  86399. this.on("keydown", this.handleKeyDown_);
  86400. this.hadControls_ = player.controls();
  86401. player.controls(false);
  86402. this.show();
  86403. this.conditionalFocus_();
  86404. this.el().setAttribute("aria-hidden", "false");
  86405. this.trigger("modalopen");
  86406. this.hasBeenOpened_ = true;
  86407. }
  86408. };
  86409. _proto.opened = function opened(value) {
  86410. if (typeof value === "boolean") {
  86411. this[value ? "open" : "close"]();
  86412. }
  86413. return this.opened_;
  86414. };
  86415. _proto.close = function close() {
  86416. if (!this.opened_) {
  86417. return;
  86418. }
  86419. var player = this.player();
  86420. this.trigger("beforemodalclose");
  86421. this.opened_ = false;
  86422. if (this.wasPlaying_ && this.options_.pauseOnOpen) {
  86423. player.play();
  86424. }
  86425. this.off("keydown", this.handleKeyDown_);
  86426. if (this.hadControls_) {
  86427. player.controls(true);
  86428. }
  86429. this.hide();
  86430. this.el().setAttribute("aria-hidden", "true");
  86431. this.trigger("modalclose");
  86432. this.conditionalBlur_();
  86433. if (this.options_.temporary) {
  86434. this.dispose();
  86435. }
  86436. };
  86437. _proto.closeable = function closeable(value) {
  86438. if (typeof value === "boolean") {
  86439. var closeable2 = this.closeable_ = !!value;
  86440. var close = this.getChild("closeButton");
  86441. if (closeable2 && !close) {
  86442. var temp = this.contentEl_;
  86443. this.contentEl_ = this.el_;
  86444. close = this.addChild("closeButton", {
  86445. controlText: "Close Modal Dialog"
  86446. });
  86447. this.contentEl_ = temp;
  86448. this.on(close, "close", this.close_);
  86449. }
  86450. if (!closeable2 && close) {
  86451. this.off(close, "close", this.close_);
  86452. this.removeChild(close);
  86453. close.dispose();
  86454. }
  86455. }
  86456. return this.closeable_;
  86457. };
  86458. _proto.fill = function fill() {
  86459. this.fillWith(this.content());
  86460. };
  86461. _proto.fillWith = function fillWith(content) {
  86462. var contentEl = this.contentEl();
  86463. var parentEl = contentEl.parentNode;
  86464. var nextSiblingEl = contentEl.nextSibling;
  86465. this.trigger("beforemodalfill");
  86466. this.hasBeenFilled_ = true;
  86467. parentEl.removeChild(contentEl);
  86468. this.empty();
  86469. insertContent(contentEl, content);
  86470. this.trigger("modalfill");
  86471. if (nextSiblingEl) {
  86472. parentEl.insertBefore(contentEl, nextSiblingEl);
  86473. } else {
  86474. parentEl.appendChild(contentEl);
  86475. }
  86476. var closeButton = this.getChild("closeButton");
  86477. if (closeButton) {
  86478. parentEl.appendChild(closeButton.el_);
  86479. }
  86480. };
  86481. _proto.empty = function empty() {
  86482. this.trigger("beforemodalempty");
  86483. emptyEl(this.contentEl());
  86484. this.trigger("modalempty");
  86485. };
  86486. _proto.content = function content(value) {
  86487. if (typeof value !== "undefined") {
  86488. this.content_ = value;
  86489. }
  86490. return this.content_;
  86491. };
  86492. _proto.conditionalFocus_ = function conditionalFocus_() {
  86493. var activeEl = document_1.activeElement;
  86494. var playerEl = this.player_.el_;
  86495. this.previouslyActiveEl_ = null;
  86496. if (playerEl.contains(activeEl) || playerEl === activeEl) {
  86497. this.previouslyActiveEl_ = activeEl;
  86498. this.focus();
  86499. }
  86500. };
  86501. _proto.conditionalBlur_ = function conditionalBlur_() {
  86502. if (this.previouslyActiveEl_) {
  86503. this.previouslyActiveEl_.focus();
  86504. this.previouslyActiveEl_ = null;
  86505. }
  86506. };
  86507. _proto.handleKeyDown = function handleKeyDown(event2) {
  86508. event2.stopPropagation();
  86509. if (keycode.isEventKey(event2, "Escape") && this.closeable()) {
  86510. event2.preventDefault();
  86511. this.close();
  86512. return;
  86513. }
  86514. if (!keycode.isEventKey(event2, "Tab")) {
  86515. return;
  86516. }
  86517. var focusableEls = this.focusableEls_();
  86518. var activeEl = this.el_.querySelector(":focus");
  86519. var focusIndex;
  86520. for (var i2 = 0; i2 < focusableEls.length; i2++) {
  86521. if (activeEl === focusableEls[i2]) {
  86522. focusIndex = i2;
  86523. break;
  86524. }
  86525. }
  86526. if (document_1.activeElement === this.el_) {
  86527. focusIndex = 0;
  86528. }
  86529. if (event2.shiftKey && focusIndex === 0) {
  86530. focusableEls[focusableEls.length - 1].focus();
  86531. event2.preventDefault();
  86532. } else if (!event2.shiftKey && focusIndex === focusableEls.length - 1) {
  86533. focusableEls[0].focus();
  86534. event2.preventDefault();
  86535. }
  86536. };
  86537. _proto.focusableEls_ = function focusableEls_() {
  86538. var allChildren = this.el_.querySelectorAll("*");
  86539. return Array.prototype.filter.call(allChildren, function(child) {
  86540. return (child instanceof window_1.HTMLAnchorElement || child instanceof window_1.HTMLAreaElement) && child.hasAttribute("href") || (child instanceof window_1.HTMLInputElement || child instanceof window_1.HTMLSelectElement || child instanceof window_1.HTMLTextAreaElement || child instanceof window_1.HTMLButtonElement) && !child.hasAttribute("disabled") || child instanceof window_1.HTMLIFrameElement || child instanceof window_1.HTMLObjectElement || child instanceof window_1.HTMLEmbedElement || child.hasAttribute("tabindex") && child.getAttribute("tabindex") !== -1 || child.hasAttribute("contenteditable");
  86541. });
  86542. };
  86543. return ModalDialog2;
  86544. }(Component$1);
  86545. ModalDialog.prototype.options_ = {
  86546. pauseOnOpen: true,
  86547. temporary: true
  86548. };
  86549. Component$1.registerComponent("ModalDialog", ModalDialog);
  86550. var TrackList = /* @__PURE__ */ function(_EventTarget) {
  86551. _inheritsLoose(TrackList2, _EventTarget);
  86552. function TrackList2(tracks) {
  86553. var _this;
  86554. if (tracks === void 0) {
  86555. tracks = [];
  86556. }
  86557. _this = _EventTarget.call(this) || this;
  86558. _this.tracks_ = [];
  86559. Object.defineProperty(_assertThisInitialized(_this), "length", {
  86560. get: function get7() {
  86561. return this.tracks_.length;
  86562. }
  86563. });
  86564. for (var i2 = 0; i2 < tracks.length; i2++) {
  86565. _this.addTrack(tracks[i2]);
  86566. }
  86567. return _this;
  86568. }
  86569. var _proto = TrackList2.prototype;
  86570. _proto.addTrack = function addTrack(track) {
  86571. var _this2 = this;
  86572. var index2 = this.tracks_.length;
  86573. if (!("" + index2 in this)) {
  86574. Object.defineProperty(this, index2, {
  86575. get: function get7() {
  86576. return this.tracks_[index2];
  86577. }
  86578. });
  86579. }
  86580. if (this.tracks_.indexOf(track) === -1) {
  86581. this.tracks_.push(track);
  86582. this.trigger({
  86583. track,
  86584. type: "addtrack",
  86585. target: this
  86586. });
  86587. }
  86588. track.labelchange_ = function() {
  86589. _this2.trigger({
  86590. track,
  86591. type: "labelchange",
  86592. target: _this2
  86593. });
  86594. };
  86595. if (isEvented(track)) {
  86596. track.addEventListener("labelchange", track.labelchange_);
  86597. }
  86598. };
  86599. _proto.removeTrack = function removeTrack(rtrack) {
  86600. var track;
  86601. for (var i2 = 0, l = this.length; i2 < l; i2++) {
  86602. if (this[i2] === rtrack) {
  86603. track = this[i2];
  86604. if (track.off) {
  86605. track.off();
  86606. }
  86607. this.tracks_.splice(i2, 1);
  86608. break;
  86609. }
  86610. }
  86611. if (!track) {
  86612. return;
  86613. }
  86614. this.trigger({
  86615. track,
  86616. type: "removetrack",
  86617. target: this
  86618. });
  86619. };
  86620. _proto.getTrackById = function getTrackById(id) {
  86621. var result = null;
  86622. for (var i2 = 0, l = this.length; i2 < l; i2++) {
  86623. var track = this[i2];
  86624. if (track.id === id) {
  86625. result = track;
  86626. break;
  86627. }
  86628. }
  86629. return result;
  86630. };
  86631. return TrackList2;
  86632. }(EventTarget$2);
  86633. TrackList.prototype.allowedEvents_ = {
  86634. change: "change",
  86635. addtrack: "addtrack",
  86636. removetrack: "removetrack",
  86637. labelchange: "labelchange"
  86638. };
  86639. for (var event$1 in TrackList.prototype.allowedEvents_) {
  86640. TrackList.prototype["on" + event$1] = null;
  86641. }
  86642. var disableOthers$1 = function disableOthers(list, track) {
  86643. for (var i2 = 0; i2 < list.length; i2++) {
  86644. if (!Object.keys(list[i2]).length || track.id === list[i2].id) {
  86645. continue;
  86646. }
  86647. list[i2].enabled = false;
  86648. }
  86649. };
  86650. var AudioTrackList = /* @__PURE__ */ function(_TrackList) {
  86651. _inheritsLoose(AudioTrackList2, _TrackList);
  86652. function AudioTrackList2(tracks) {
  86653. var _this;
  86654. if (tracks === void 0) {
  86655. tracks = [];
  86656. }
  86657. for (var i2 = tracks.length - 1; i2 >= 0; i2--) {
  86658. if (tracks[i2].enabled) {
  86659. disableOthers$1(tracks, tracks[i2]);
  86660. break;
  86661. }
  86662. }
  86663. _this = _TrackList.call(this, tracks) || this;
  86664. _this.changing_ = false;
  86665. return _this;
  86666. }
  86667. var _proto = AudioTrackList2.prototype;
  86668. _proto.addTrack = function addTrack(track) {
  86669. var _this2 = this;
  86670. if (track.enabled) {
  86671. disableOthers$1(this, track);
  86672. }
  86673. _TrackList.prototype.addTrack.call(this, track);
  86674. if (!track.addEventListener) {
  86675. return;
  86676. }
  86677. track.enabledChange_ = function() {
  86678. if (_this2.changing_) {
  86679. return;
  86680. }
  86681. _this2.changing_ = true;
  86682. disableOthers$1(_this2, track);
  86683. _this2.changing_ = false;
  86684. _this2.trigger("change");
  86685. };
  86686. track.addEventListener("enabledchange", track.enabledChange_);
  86687. };
  86688. _proto.removeTrack = function removeTrack(rtrack) {
  86689. _TrackList.prototype.removeTrack.call(this, rtrack);
  86690. if (rtrack.removeEventListener && rtrack.enabledChange_) {
  86691. rtrack.removeEventListener("enabledchange", rtrack.enabledChange_);
  86692. rtrack.enabledChange_ = null;
  86693. }
  86694. };
  86695. return AudioTrackList2;
  86696. }(TrackList);
  86697. var disableOthers2 = function disableOthers3(list, track) {
  86698. for (var i2 = 0; i2 < list.length; i2++) {
  86699. if (!Object.keys(list[i2]).length || track.id === list[i2].id) {
  86700. continue;
  86701. }
  86702. list[i2].selected = false;
  86703. }
  86704. };
  86705. var VideoTrackList = /* @__PURE__ */ function(_TrackList) {
  86706. _inheritsLoose(VideoTrackList2, _TrackList);
  86707. function VideoTrackList2(tracks) {
  86708. var _this;
  86709. if (tracks === void 0) {
  86710. tracks = [];
  86711. }
  86712. for (var i2 = tracks.length - 1; i2 >= 0; i2--) {
  86713. if (tracks[i2].selected) {
  86714. disableOthers2(tracks, tracks[i2]);
  86715. break;
  86716. }
  86717. }
  86718. _this = _TrackList.call(this, tracks) || this;
  86719. _this.changing_ = false;
  86720. Object.defineProperty(_assertThisInitialized(_this), "selectedIndex", {
  86721. get: function get7() {
  86722. for (var _i = 0; _i < this.length; _i++) {
  86723. if (this[_i].selected) {
  86724. return _i;
  86725. }
  86726. }
  86727. return -1;
  86728. },
  86729. set: function set4() {
  86730. }
  86731. });
  86732. return _this;
  86733. }
  86734. var _proto = VideoTrackList2.prototype;
  86735. _proto.addTrack = function addTrack(track) {
  86736. var _this2 = this;
  86737. if (track.selected) {
  86738. disableOthers2(this, track);
  86739. }
  86740. _TrackList.prototype.addTrack.call(this, track);
  86741. if (!track.addEventListener) {
  86742. return;
  86743. }
  86744. track.selectedChange_ = function() {
  86745. if (_this2.changing_) {
  86746. return;
  86747. }
  86748. _this2.changing_ = true;
  86749. disableOthers2(_this2, track);
  86750. _this2.changing_ = false;
  86751. _this2.trigger("change");
  86752. };
  86753. track.addEventListener("selectedchange", track.selectedChange_);
  86754. };
  86755. _proto.removeTrack = function removeTrack(rtrack) {
  86756. _TrackList.prototype.removeTrack.call(this, rtrack);
  86757. if (rtrack.removeEventListener && rtrack.selectedChange_) {
  86758. rtrack.removeEventListener("selectedchange", rtrack.selectedChange_);
  86759. rtrack.selectedChange_ = null;
  86760. }
  86761. };
  86762. return VideoTrackList2;
  86763. }(TrackList);
  86764. var TextTrackList = /* @__PURE__ */ function(_TrackList) {
  86765. _inheritsLoose(TextTrackList2, _TrackList);
  86766. function TextTrackList2() {
  86767. return _TrackList.apply(this, arguments) || this;
  86768. }
  86769. var _proto = TextTrackList2.prototype;
  86770. _proto.addTrack = function addTrack(track) {
  86771. var _this = this;
  86772. _TrackList.prototype.addTrack.call(this, track);
  86773. if (!this.queueChange_) {
  86774. this.queueChange_ = function() {
  86775. return _this.queueTrigger("change");
  86776. };
  86777. }
  86778. if (!this.triggerSelectedlanguagechange) {
  86779. this.triggerSelectedlanguagechange_ = function() {
  86780. return _this.trigger("selectedlanguagechange");
  86781. };
  86782. }
  86783. track.addEventListener("modechange", this.queueChange_);
  86784. var nonLanguageTextTrackKind = ["metadata", "chapters"];
  86785. if (nonLanguageTextTrackKind.indexOf(track.kind) === -1) {
  86786. track.addEventListener("modechange", this.triggerSelectedlanguagechange_);
  86787. }
  86788. };
  86789. _proto.removeTrack = function removeTrack(rtrack) {
  86790. _TrackList.prototype.removeTrack.call(this, rtrack);
  86791. if (rtrack.removeEventListener) {
  86792. if (this.queueChange_) {
  86793. rtrack.removeEventListener("modechange", this.queueChange_);
  86794. }
  86795. if (this.selectedlanguagechange_) {
  86796. rtrack.removeEventListener("modechange", this.triggerSelectedlanguagechange_);
  86797. }
  86798. }
  86799. };
  86800. return TextTrackList2;
  86801. }(TrackList);
  86802. var HtmlTrackElementList = /* @__PURE__ */ function() {
  86803. function HtmlTrackElementList2(trackElements) {
  86804. if (trackElements === void 0) {
  86805. trackElements = [];
  86806. }
  86807. this.trackElements_ = [];
  86808. Object.defineProperty(this, "length", {
  86809. get: function get7() {
  86810. return this.trackElements_.length;
  86811. }
  86812. });
  86813. for (var i2 = 0, length = trackElements.length; i2 < length; i2++) {
  86814. this.addTrackElement_(trackElements[i2]);
  86815. }
  86816. }
  86817. var _proto = HtmlTrackElementList2.prototype;
  86818. _proto.addTrackElement_ = function addTrackElement_(trackElement) {
  86819. var index2 = this.trackElements_.length;
  86820. if (!("" + index2 in this)) {
  86821. Object.defineProperty(this, index2, {
  86822. get: function get7() {
  86823. return this.trackElements_[index2];
  86824. }
  86825. });
  86826. }
  86827. if (this.trackElements_.indexOf(trackElement) === -1) {
  86828. this.trackElements_.push(trackElement);
  86829. }
  86830. };
  86831. _proto.getTrackElementByTrack_ = function getTrackElementByTrack_(track) {
  86832. var trackElement_;
  86833. for (var i2 = 0, length = this.trackElements_.length; i2 < length; i2++) {
  86834. if (track === this.trackElements_[i2].track) {
  86835. trackElement_ = this.trackElements_[i2];
  86836. break;
  86837. }
  86838. }
  86839. return trackElement_;
  86840. };
  86841. _proto.removeTrackElement_ = function removeTrackElement_(trackElement) {
  86842. for (var i2 = 0, length = this.trackElements_.length; i2 < length; i2++) {
  86843. if (trackElement === this.trackElements_[i2]) {
  86844. if (this.trackElements_[i2].track && typeof this.trackElements_[i2].track.off === "function") {
  86845. this.trackElements_[i2].track.off();
  86846. }
  86847. if (typeof this.trackElements_[i2].off === "function") {
  86848. this.trackElements_[i2].off();
  86849. }
  86850. this.trackElements_.splice(i2, 1);
  86851. break;
  86852. }
  86853. }
  86854. };
  86855. return HtmlTrackElementList2;
  86856. }();
  86857. var TextTrackCueList = /* @__PURE__ */ function() {
  86858. function TextTrackCueList2(cues) {
  86859. TextTrackCueList2.prototype.setCues_.call(this, cues);
  86860. Object.defineProperty(this, "length", {
  86861. get: function get7() {
  86862. return this.length_;
  86863. }
  86864. });
  86865. }
  86866. var _proto = TextTrackCueList2.prototype;
  86867. _proto.setCues_ = function setCues_(cues) {
  86868. var oldLength = this.length || 0;
  86869. var i2 = 0;
  86870. var l = cues.length;
  86871. this.cues_ = cues;
  86872. this.length_ = cues.length;
  86873. var defineProp = function defineProp2(index2) {
  86874. if (!("" + index2 in this)) {
  86875. Object.defineProperty(this, "" + index2, {
  86876. get: function get7() {
  86877. return this.cues_[index2];
  86878. }
  86879. });
  86880. }
  86881. };
  86882. if (oldLength < l) {
  86883. i2 = oldLength;
  86884. for (; i2 < l; i2++) {
  86885. defineProp.call(this, i2);
  86886. }
  86887. }
  86888. };
  86889. _proto.getCueById = function getCueById(id) {
  86890. var result = null;
  86891. for (var i2 = 0, l = this.length; i2 < l; i2++) {
  86892. var cue = this[i2];
  86893. if (cue.id === id) {
  86894. result = cue;
  86895. break;
  86896. }
  86897. }
  86898. return result;
  86899. };
  86900. return TextTrackCueList2;
  86901. }();
  86902. var VideoTrackKind = {
  86903. alternative: "alternative",
  86904. captions: "captions",
  86905. main: "main",
  86906. sign: "sign",
  86907. subtitles: "subtitles",
  86908. commentary: "commentary"
  86909. };
  86910. var AudioTrackKind = {
  86911. "alternative": "alternative",
  86912. "descriptions": "descriptions",
  86913. "main": "main",
  86914. "main-desc": "main-desc",
  86915. "translation": "translation",
  86916. "commentary": "commentary"
  86917. };
  86918. var TextTrackKind = {
  86919. subtitles: "subtitles",
  86920. captions: "captions",
  86921. descriptions: "descriptions",
  86922. chapters: "chapters",
  86923. metadata: "metadata"
  86924. };
  86925. var TextTrackMode = {
  86926. disabled: "disabled",
  86927. hidden: "hidden",
  86928. showing: "showing"
  86929. };
  86930. var Track = /* @__PURE__ */ function(_EventTarget) {
  86931. _inheritsLoose(Track2, _EventTarget);
  86932. function Track2(options2) {
  86933. var _this;
  86934. if (options2 === void 0) {
  86935. options2 = {};
  86936. }
  86937. _this = _EventTarget.call(this) || this;
  86938. var trackProps = {
  86939. id: options2.id || "vjs_track_" + newGUID(),
  86940. kind: options2.kind || "",
  86941. language: options2.language || ""
  86942. };
  86943. var label = options2.label || "";
  86944. var _loop = function _loop2(key2) {
  86945. Object.defineProperty(_assertThisInitialized(_this), key2, {
  86946. get: function get7() {
  86947. return trackProps[key2];
  86948. },
  86949. set: function set4() {
  86950. }
  86951. });
  86952. };
  86953. for (var key in trackProps) {
  86954. _loop(key);
  86955. }
  86956. Object.defineProperty(_assertThisInitialized(_this), "label", {
  86957. get: function get7() {
  86958. return label;
  86959. },
  86960. set: function set4(newLabel) {
  86961. if (newLabel !== label) {
  86962. label = newLabel;
  86963. this.trigger("labelchange");
  86964. }
  86965. }
  86966. });
  86967. return _this;
  86968. }
  86969. return Track2;
  86970. }(EventTarget$2);
  86971. var parseUrl = function parseUrl2(url) {
  86972. var props = ["protocol", "hostname", "port", "pathname", "search", "hash", "host"];
  86973. var a = document_1.createElement("a");
  86974. a.href = url;
  86975. var details = {};
  86976. for (var i2 = 0; i2 < props.length; i2++) {
  86977. details[props[i2]] = a[props[i2]];
  86978. }
  86979. if (details.protocol === "http:") {
  86980. details.host = details.host.replace(/:80$/, "");
  86981. }
  86982. if (details.protocol === "https:") {
  86983. details.host = details.host.replace(/:443$/, "");
  86984. }
  86985. if (!details.protocol) {
  86986. details.protocol = window_1.location.protocol;
  86987. }
  86988. if (!details.host) {
  86989. details.host = window_1.location.host;
  86990. }
  86991. return details;
  86992. };
  86993. var getAbsoluteURL = function getAbsoluteURL2(url) {
  86994. if (!url.match(/^https?:\/\//)) {
  86995. var a = document_1.createElement("a");
  86996. a.href = url;
  86997. url = a.href;
  86998. }
  86999. return url;
  87000. };
  87001. var getFileExtension = function getFileExtension2(path) {
  87002. if (typeof path === "string") {
  87003. var splitPathRe = /^(\/?)([\s\S]*?)((?:\.{1,2}|[^\/]+?)(\.([^\.\/\?]+)))(?:[\/]*|[\?].*)$/;
  87004. var pathParts = splitPathRe.exec(path);
  87005. if (pathParts) {
  87006. return pathParts.pop().toLowerCase();
  87007. }
  87008. }
  87009. return "";
  87010. };
  87011. var isCrossOrigin = function isCrossOrigin2(url, winLoc) {
  87012. if (winLoc === void 0) {
  87013. winLoc = window_1.location;
  87014. }
  87015. var urlInfo = parseUrl(url);
  87016. var srcProtocol = urlInfo.protocol === ":" ? winLoc.protocol : urlInfo.protocol;
  87017. var crossOrigin = srcProtocol + urlInfo.host !== winLoc.protocol + winLoc.host;
  87018. return crossOrigin;
  87019. };
  87020. var Url$1 = /* @__PURE__ */ Object.freeze({
  87021. __proto__: null,
  87022. parseUrl,
  87023. getAbsoluteURL,
  87024. getFileExtension,
  87025. isCrossOrigin
  87026. });
  87027. var parseCues = function parseCues2(srcContent, track) {
  87028. var parser2 = new window_1.WebVTT.Parser(window_1, window_1.vttjs, window_1.WebVTT.StringDecoder());
  87029. var errors2 = [];
  87030. parser2.oncue = function(cue) {
  87031. track.addCue(cue);
  87032. };
  87033. parser2.onparsingerror = function(error) {
  87034. errors2.push(error);
  87035. };
  87036. parser2.onflush = function() {
  87037. track.trigger({
  87038. type: "loadeddata",
  87039. target: track
  87040. });
  87041. };
  87042. parser2.parse(srcContent);
  87043. if (errors2.length > 0) {
  87044. if (window_1.console && window_1.console.groupCollapsed) {
  87045. window_1.console.groupCollapsed("Text Track parsing errors for " + track.src);
  87046. }
  87047. errors2.forEach(function(error) {
  87048. return log$1.error(error);
  87049. });
  87050. if (window_1.console && window_1.console.groupEnd) {
  87051. window_1.console.groupEnd();
  87052. }
  87053. }
  87054. parser2.flush();
  87055. };
  87056. var loadTrack = function loadTrack2(src, track) {
  87057. var opts = {
  87058. uri: src
  87059. };
  87060. var crossOrigin = isCrossOrigin(src);
  87061. if (crossOrigin) {
  87062. opts.cors = crossOrigin;
  87063. }
  87064. var withCredentials = track.tech_.crossOrigin() === "use-credentials";
  87065. if (withCredentials) {
  87066. opts.withCredentials = withCredentials;
  87067. }
  87068. XHR(opts, bind(this, function(err, response, responseBody) {
  87069. if (err) {
  87070. return log$1.error(err, response);
  87071. }
  87072. track.loaded_ = true;
  87073. if (typeof window_1.WebVTT !== "function") {
  87074. if (track.tech_) {
  87075. track.tech_.any(["vttjsloaded", "vttjserror"], function(event2) {
  87076. if (event2.type === "vttjserror") {
  87077. log$1.error("vttjs failed to load, stopping trying to process " + track.src);
  87078. return;
  87079. }
  87080. return parseCues(responseBody, track);
  87081. });
  87082. }
  87083. } else {
  87084. parseCues(responseBody, track);
  87085. }
  87086. }));
  87087. };
  87088. var TextTrack = /* @__PURE__ */ function(_Track) {
  87089. _inheritsLoose(TextTrack2, _Track);
  87090. function TextTrack2(options2) {
  87091. var _this;
  87092. if (options2 === void 0) {
  87093. options2 = {};
  87094. }
  87095. if (!options2.tech) {
  87096. throw new Error("A tech was not provided.");
  87097. }
  87098. var settings = mergeOptions$3(options2, {
  87099. kind: TextTrackKind[options2.kind] || "subtitles",
  87100. language: options2.language || options2.srclang || ""
  87101. });
  87102. var mode = TextTrackMode[settings.mode] || "disabled";
  87103. var default_ = settings["default"];
  87104. if (settings.kind === "metadata" || settings.kind === "chapters") {
  87105. mode = "hidden";
  87106. }
  87107. _this = _Track.call(this, settings) || this;
  87108. _this.tech_ = settings.tech;
  87109. _this.cues_ = [];
  87110. _this.activeCues_ = [];
  87111. _this.preload_ = _this.tech_.preloadTextTracks !== false;
  87112. var cues = new TextTrackCueList(_this.cues_);
  87113. var activeCues = new TextTrackCueList(_this.activeCues_);
  87114. var changed = false;
  87115. _this.timeupdateHandler = bind(_assertThisInitialized(_this), function(event2) {
  87116. if (event2 === void 0) {
  87117. event2 = {};
  87118. }
  87119. if (this.tech_.isDisposed()) {
  87120. return;
  87121. }
  87122. if (!this.tech_.isReady_) {
  87123. if (event2.type !== "timeupdate") {
  87124. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  87125. }
  87126. return;
  87127. }
  87128. this.activeCues = this.activeCues;
  87129. if (changed) {
  87130. this.trigger("cuechange");
  87131. changed = false;
  87132. }
  87133. if (event2.type !== "timeupdate") {
  87134. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  87135. }
  87136. });
  87137. var disposeHandler = function disposeHandler2() {
  87138. _this.stopTracking();
  87139. };
  87140. _this.tech_.one("dispose", disposeHandler);
  87141. if (mode !== "disabled") {
  87142. _this.startTracking();
  87143. }
  87144. Object.defineProperties(_assertThisInitialized(_this), {
  87145. "default": {
  87146. get: function get7() {
  87147. return default_;
  87148. },
  87149. set: function set4() {
  87150. }
  87151. },
  87152. mode: {
  87153. get: function get7() {
  87154. return mode;
  87155. },
  87156. set: function set4(newMode) {
  87157. if (!TextTrackMode[newMode]) {
  87158. return;
  87159. }
  87160. if (mode === newMode) {
  87161. return;
  87162. }
  87163. mode = newMode;
  87164. if (!this.preload_ && mode !== "disabled" && this.cues.length === 0) {
  87165. loadTrack(this.src, this);
  87166. }
  87167. this.stopTracking();
  87168. if (mode !== "disabled") {
  87169. this.startTracking();
  87170. }
  87171. this.trigger("modechange");
  87172. }
  87173. },
  87174. cues: {
  87175. get: function get7() {
  87176. if (!this.loaded_) {
  87177. return null;
  87178. }
  87179. return cues;
  87180. },
  87181. set: function set4() {
  87182. }
  87183. },
  87184. activeCues: {
  87185. get: function get7() {
  87186. if (!this.loaded_) {
  87187. return null;
  87188. }
  87189. if (this.cues.length === 0) {
  87190. return activeCues;
  87191. }
  87192. var ct2 = this.tech_.currentTime();
  87193. var active = [];
  87194. for (var i2 = 0, l = this.cues.length; i2 < l; i2++) {
  87195. var cue = this.cues[i2];
  87196. if (cue.startTime <= ct2 && cue.endTime >= ct2) {
  87197. active.push(cue);
  87198. } else if (cue.startTime === cue.endTime && cue.startTime <= ct2 && cue.startTime + 0.5 >= ct2) {
  87199. active.push(cue);
  87200. }
  87201. }
  87202. changed = false;
  87203. if (active.length !== this.activeCues_.length) {
  87204. changed = true;
  87205. } else {
  87206. for (var _i = 0; _i < active.length; _i++) {
  87207. if (this.activeCues_.indexOf(active[_i]) === -1) {
  87208. changed = true;
  87209. }
  87210. }
  87211. }
  87212. this.activeCues_ = active;
  87213. activeCues.setCues_(this.activeCues_);
  87214. return activeCues;
  87215. },
  87216. set: function set4() {
  87217. }
  87218. }
  87219. });
  87220. if (settings.src) {
  87221. _this.src = settings.src;
  87222. if (!_this.preload_) {
  87223. _this.loaded_ = true;
  87224. }
  87225. if (_this.preload_ || settings.kind !== "subtitles" && settings.kind !== "captions") {
  87226. loadTrack(_this.src, _assertThisInitialized(_this));
  87227. }
  87228. } else {
  87229. _this.loaded_ = true;
  87230. }
  87231. return _this;
  87232. }
  87233. var _proto = TextTrack2.prototype;
  87234. _proto.startTracking = function startTracking() {
  87235. this.rvf_ = this.tech_.requestVideoFrameCallback(this.timeupdateHandler);
  87236. this.tech_.on("timeupdate", this.timeupdateHandler);
  87237. };
  87238. _proto.stopTracking = function stopTracking() {
  87239. if (this.rvf_) {
  87240. this.tech_.cancelVideoFrameCallback(this.rvf_);
  87241. this.rvf_ = void 0;
  87242. }
  87243. this.tech_.off("timeupdate", this.timeupdateHandler);
  87244. };
  87245. _proto.addCue = function addCue(originalCue) {
  87246. var cue = originalCue;
  87247. if (window_1.vttjs && !(originalCue instanceof window_1.vttjs.VTTCue)) {
  87248. cue = new window_1.vttjs.VTTCue(originalCue.startTime, originalCue.endTime, originalCue.text);
  87249. for (var prop in originalCue) {
  87250. if (!(prop in cue)) {
  87251. cue[prop] = originalCue[prop];
  87252. }
  87253. }
  87254. cue.id = originalCue.id;
  87255. cue.originalCue_ = originalCue;
  87256. }
  87257. var tracks = this.tech_.textTracks();
  87258. for (var i2 = 0; i2 < tracks.length; i2++) {
  87259. if (tracks[i2] !== this) {
  87260. tracks[i2].removeCue(cue);
  87261. }
  87262. }
  87263. this.cues_.push(cue);
  87264. this.cues.setCues_(this.cues_);
  87265. };
  87266. _proto.removeCue = function removeCue(_removeCue) {
  87267. var i2 = this.cues_.length;
  87268. while (i2--) {
  87269. var cue = this.cues_[i2];
  87270. if (cue === _removeCue || cue.originalCue_ && cue.originalCue_ === _removeCue) {
  87271. this.cues_.splice(i2, 1);
  87272. this.cues.setCues_(this.cues_);
  87273. break;
  87274. }
  87275. }
  87276. };
  87277. return TextTrack2;
  87278. }(Track);
  87279. TextTrack.prototype.allowedEvents_ = {
  87280. cuechange: "cuechange"
  87281. };
  87282. var AudioTrack = /* @__PURE__ */ function(_Track) {
  87283. _inheritsLoose(AudioTrack2, _Track);
  87284. function AudioTrack2(options2) {
  87285. var _this;
  87286. if (options2 === void 0) {
  87287. options2 = {};
  87288. }
  87289. var settings = mergeOptions$3(options2, {
  87290. kind: AudioTrackKind[options2.kind] || ""
  87291. });
  87292. _this = _Track.call(this, settings) || this;
  87293. var enabled = false;
  87294. Object.defineProperty(_assertThisInitialized(_this), "enabled", {
  87295. get: function get7() {
  87296. return enabled;
  87297. },
  87298. set: function set4(newEnabled) {
  87299. if (typeof newEnabled !== "boolean" || newEnabled === enabled) {
  87300. return;
  87301. }
  87302. enabled = newEnabled;
  87303. this.trigger("enabledchange");
  87304. }
  87305. });
  87306. if (settings.enabled) {
  87307. _this.enabled = settings.enabled;
  87308. }
  87309. _this.loaded_ = true;
  87310. return _this;
  87311. }
  87312. return AudioTrack2;
  87313. }(Track);
  87314. var VideoTrack = /* @__PURE__ */ function(_Track) {
  87315. _inheritsLoose(VideoTrack2, _Track);
  87316. function VideoTrack2(options2) {
  87317. var _this;
  87318. if (options2 === void 0) {
  87319. options2 = {};
  87320. }
  87321. var settings = mergeOptions$3(options2, {
  87322. kind: VideoTrackKind[options2.kind] || ""
  87323. });
  87324. _this = _Track.call(this, settings) || this;
  87325. var selected = false;
  87326. Object.defineProperty(_assertThisInitialized(_this), "selected", {
  87327. get: function get7() {
  87328. return selected;
  87329. },
  87330. set: function set4(newSelected) {
  87331. if (typeof newSelected !== "boolean" || newSelected === selected) {
  87332. return;
  87333. }
  87334. selected = newSelected;
  87335. this.trigger("selectedchange");
  87336. }
  87337. });
  87338. if (settings.selected) {
  87339. _this.selected = settings.selected;
  87340. }
  87341. return _this;
  87342. }
  87343. return VideoTrack2;
  87344. }(Track);
  87345. var NONE = 0;
  87346. var LOADING = 1;
  87347. var LOADED = 2;
  87348. var ERROR = 3;
  87349. var HTMLTrackElement = /* @__PURE__ */ function(_EventTarget) {
  87350. _inheritsLoose(HTMLTrackElement2, _EventTarget);
  87351. function HTMLTrackElement2(options2) {
  87352. var _this;
  87353. if (options2 === void 0) {
  87354. options2 = {};
  87355. }
  87356. _this = _EventTarget.call(this) || this;
  87357. var readyState;
  87358. var track = new TextTrack(options2);
  87359. _this.kind = track.kind;
  87360. _this.src = track.src;
  87361. _this.srclang = track.language;
  87362. _this.label = track.label;
  87363. _this["default"] = track["default"];
  87364. Object.defineProperties(_assertThisInitialized(_this), {
  87365. readyState: {
  87366. get: function get7() {
  87367. return readyState;
  87368. }
  87369. },
  87370. track: {
  87371. get: function get7() {
  87372. return track;
  87373. }
  87374. }
  87375. });
  87376. readyState = NONE;
  87377. track.addEventListener("loadeddata", function() {
  87378. readyState = LOADED;
  87379. _this.trigger({
  87380. type: "load",
  87381. target: _assertThisInitialized(_this)
  87382. });
  87383. });
  87384. return _this;
  87385. }
  87386. return HTMLTrackElement2;
  87387. }(EventTarget$2);
  87388. HTMLTrackElement.prototype.allowedEvents_ = {
  87389. load: "load"
  87390. };
  87391. HTMLTrackElement.NONE = NONE;
  87392. HTMLTrackElement.LOADING = LOADING;
  87393. HTMLTrackElement.LOADED = LOADED;
  87394. HTMLTrackElement.ERROR = ERROR;
  87395. var NORMAL = {
  87396. audio: {
  87397. ListClass: AudioTrackList,
  87398. TrackClass: AudioTrack,
  87399. capitalName: "Audio"
  87400. },
  87401. video: {
  87402. ListClass: VideoTrackList,
  87403. TrackClass: VideoTrack,
  87404. capitalName: "Video"
  87405. },
  87406. text: {
  87407. ListClass: TextTrackList,
  87408. TrackClass: TextTrack,
  87409. capitalName: "Text"
  87410. }
  87411. };
  87412. Object.keys(NORMAL).forEach(function(type2) {
  87413. NORMAL[type2].getterName = type2 + "Tracks";
  87414. NORMAL[type2].privateName = type2 + "Tracks_";
  87415. });
  87416. var REMOTE = {
  87417. remoteText: {
  87418. ListClass: TextTrackList,
  87419. TrackClass: TextTrack,
  87420. capitalName: "RemoteText",
  87421. getterName: "remoteTextTracks",
  87422. privateName: "remoteTextTracks_"
  87423. },
  87424. remoteTextEl: {
  87425. ListClass: HtmlTrackElementList,
  87426. TrackClass: HTMLTrackElement,
  87427. capitalName: "RemoteTextTrackEls",
  87428. getterName: "remoteTextTrackEls",
  87429. privateName: "remoteTextTrackEls_"
  87430. }
  87431. };
  87432. var ALL = _extends$2({}, NORMAL, REMOTE);
  87433. REMOTE.names = Object.keys(REMOTE);
  87434. NORMAL.names = Object.keys(NORMAL);
  87435. ALL.names = [].concat(REMOTE.names).concat(NORMAL.names);
  87436. function createTrackHelper(self2, kind, label, language, options2) {
  87437. if (options2 === void 0) {
  87438. options2 = {};
  87439. }
  87440. var tracks = self2.textTracks();
  87441. options2.kind = kind;
  87442. if (label) {
  87443. options2.label = label;
  87444. }
  87445. if (language) {
  87446. options2.language = language;
  87447. }
  87448. options2.tech = self2;
  87449. var track = new ALL.text.TrackClass(options2);
  87450. tracks.addTrack(track);
  87451. return track;
  87452. }
  87453. var Tech$1 = /* @__PURE__ */ function(_Component) {
  87454. _inheritsLoose(Tech2, _Component);
  87455. function Tech2(options2, ready) {
  87456. var _this;
  87457. if (options2 === void 0) {
  87458. options2 = {};
  87459. }
  87460. if (ready === void 0) {
  87461. ready = function ready2() {
  87462. };
  87463. }
  87464. options2.reportTouchActivity = false;
  87465. _this = _Component.call(this, null, options2, ready) || this;
  87466. _this.onDurationChange_ = function(e) {
  87467. return _this.onDurationChange(e);
  87468. };
  87469. _this.trackProgress_ = function(e) {
  87470. return _this.trackProgress(e);
  87471. };
  87472. _this.trackCurrentTime_ = function(e) {
  87473. return _this.trackCurrentTime(e);
  87474. };
  87475. _this.stopTrackingCurrentTime_ = function(e) {
  87476. return _this.stopTrackingCurrentTime(e);
  87477. };
  87478. _this.disposeSourceHandler_ = function(e) {
  87479. return _this.disposeSourceHandler(e);
  87480. };
  87481. _this.queuedHanders_ = /* @__PURE__ */ new Set();
  87482. _this.hasStarted_ = false;
  87483. _this.on("playing", function() {
  87484. this.hasStarted_ = true;
  87485. });
  87486. _this.on("loadstart", function() {
  87487. this.hasStarted_ = false;
  87488. });
  87489. ALL.names.forEach(function(name) {
  87490. var props = ALL[name];
  87491. if (options2 && options2[props.getterName]) {
  87492. _this[props.privateName] = options2[props.getterName];
  87493. }
  87494. });
  87495. if (!_this.featuresProgressEvents) {
  87496. _this.manualProgressOn();
  87497. }
  87498. if (!_this.featuresTimeupdateEvents) {
  87499. _this.manualTimeUpdatesOn();
  87500. }
  87501. ["Text", "Audio", "Video"].forEach(function(track) {
  87502. if (options2["native" + track + "Tracks"] === false) {
  87503. _this["featuresNative" + track + "Tracks"] = false;
  87504. }
  87505. });
  87506. if (options2.nativeCaptions === false || options2.nativeTextTracks === false) {
  87507. _this.featuresNativeTextTracks = false;
  87508. } else if (options2.nativeCaptions === true || options2.nativeTextTracks === true) {
  87509. _this.featuresNativeTextTracks = true;
  87510. }
  87511. if (!_this.featuresNativeTextTracks) {
  87512. _this.emulateTextTracks();
  87513. }
  87514. _this.preloadTextTracks = options2.preloadTextTracks !== false;
  87515. _this.autoRemoteTextTracks_ = new ALL.text.ListClass();
  87516. _this.initTrackListeners();
  87517. if (!options2.nativeControlsForTouch) {
  87518. _this.emitTapEvents();
  87519. }
  87520. if (_this.constructor) {
  87521. _this.name_ = _this.constructor.name || "Unknown Tech";
  87522. }
  87523. return _this;
  87524. }
  87525. var _proto = Tech2.prototype;
  87526. _proto.triggerSourceset = function triggerSourceset(src) {
  87527. var _this2 = this;
  87528. if (!this.isReady_) {
  87529. this.one("ready", function() {
  87530. return _this2.setTimeout(function() {
  87531. return _this2.triggerSourceset(src);
  87532. }, 1);
  87533. });
  87534. }
  87535. this.trigger({
  87536. src,
  87537. type: "sourceset"
  87538. });
  87539. };
  87540. _proto.manualProgressOn = function manualProgressOn() {
  87541. this.on("durationchange", this.onDurationChange_);
  87542. this.manualProgress = true;
  87543. this.one("ready", this.trackProgress_);
  87544. };
  87545. _proto.manualProgressOff = function manualProgressOff() {
  87546. this.manualProgress = false;
  87547. this.stopTrackingProgress();
  87548. this.off("durationchange", this.onDurationChange_);
  87549. };
  87550. _proto.trackProgress = function trackProgress(event2) {
  87551. this.stopTrackingProgress();
  87552. this.progressInterval = this.setInterval(bind(this, function() {
  87553. var numBufferedPercent = this.bufferedPercent();
  87554. if (this.bufferedPercent_ !== numBufferedPercent) {
  87555. this.trigger("progress");
  87556. }
  87557. this.bufferedPercent_ = numBufferedPercent;
  87558. if (numBufferedPercent === 1) {
  87559. this.stopTrackingProgress();
  87560. }
  87561. }), 500);
  87562. };
  87563. _proto.onDurationChange = function onDurationChange(event2) {
  87564. this.duration_ = this.duration();
  87565. };
  87566. _proto.buffered = function buffered() {
  87567. return createTimeRanges(0, 0);
  87568. };
  87569. _proto.bufferedPercent = function bufferedPercent$12() {
  87570. return bufferedPercent(this.buffered(), this.duration_);
  87571. };
  87572. _proto.stopTrackingProgress = function stopTrackingProgress() {
  87573. this.clearInterval(this.progressInterval);
  87574. };
  87575. _proto.manualTimeUpdatesOn = function manualTimeUpdatesOn() {
  87576. this.manualTimeUpdates = true;
  87577. this.on("play", this.trackCurrentTime_);
  87578. this.on("pause", this.stopTrackingCurrentTime_);
  87579. };
  87580. _proto.manualTimeUpdatesOff = function manualTimeUpdatesOff() {
  87581. this.manualTimeUpdates = false;
  87582. this.stopTrackingCurrentTime();
  87583. this.off("play", this.trackCurrentTime_);
  87584. this.off("pause", this.stopTrackingCurrentTime_);
  87585. };
  87586. _proto.trackCurrentTime = function trackCurrentTime() {
  87587. if (this.currentTimeInterval) {
  87588. this.stopTrackingCurrentTime();
  87589. }
  87590. this.currentTimeInterval = this.setInterval(function() {
  87591. this.trigger({
  87592. type: "timeupdate",
  87593. target: this,
  87594. manuallyTriggered: true
  87595. });
  87596. }, 250);
  87597. };
  87598. _proto.stopTrackingCurrentTime = function stopTrackingCurrentTime() {
  87599. this.clearInterval(this.currentTimeInterval);
  87600. this.trigger({
  87601. type: "timeupdate",
  87602. target: this,
  87603. manuallyTriggered: true
  87604. });
  87605. };
  87606. _proto.dispose = function dispose() {
  87607. this.clearTracks(NORMAL.names);
  87608. if (this.manualProgress) {
  87609. this.manualProgressOff();
  87610. }
  87611. if (this.manualTimeUpdates) {
  87612. this.manualTimeUpdatesOff();
  87613. }
  87614. _Component.prototype.dispose.call(this);
  87615. };
  87616. _proto.clearTracks = function clearTracks(types) {
  87617. var _this3 = this;
  87618. types = [].concat(types);
  87619. types.forEach(function(type2) {
  87620. var list = _this3[type2 + "Tracks"]() || [];
  87621. var i2 = list.length;
  87622. while (i2--) {
  87623. var track = list[i2];
  87624. if (type2 === "text") {
  87625. _this3.removeRemoteTextTrack(track);
  87626. }
  87627. list.removeTrack(track);
  87628. }
  87629. });
  87630. };
  87631. _proto.cleanupAutoTextTracks = function cleanupAutoTextTracks() {
  87632. var list = this.autoRemoteTextTracks_ || [];
  87633. var i2 = list.length;
  87634. while (i2--) {
  87635. var track = list[i2];
  87636. this.removeRemoteTextTrack(track);
  87637. }
  87638. };
  87639. _proto.reset = function reset3() {
  87640. };
  87641. _proto.crossOrigin = function crossOrigin() {
  87642. };
  87643. _proto.setCrossOrigin = function setCrossOrigin() {
  87644. };
  87645. _proto.error = function error(err) {
  87646. if (err !== void 0) {
  87647. this.error_ = new MediaError(err);
  87648. this.trigger("error");
  87649. }
  87650. return this.error_;
  87651. };
  87652. _proto.played = function played() {
  87653. if (this.hasStarted_) {
  87654. return createTimeRanges(0, 0);
  87655. }
  87656. return createTimeRanges();
  87657. };
  87658. _proto.play = function play() {
  87659. };
  87660. _proto.setScrubbing = function setScrubbing() {
  87661. };
  87662. _proto.scrubbing = function scrubbing() {
  87663. };
  87664. _proto.setCurrentTime = function setCurrentTime() {
  87665. if (this.manualTimeUpdates) {
  87666. this.trigger({
  87667. type: "timeupdate",
  87668. target: this,
  87669. manuallyTriggered: true
  87670. });
  87671. }
  87672. };
  87673. _proto.initTrackListeners = function initTrackListeners() {
  87674. var _this4 = this;
  87675. NORMAL.names.forEach(function(name) {
  87676. var props = NORMAL[name];
  87677. var trackListChanges = function trackListChanges2() {
  87678. _this4.trigger(name + "trackchange");
  87679. };
  87680. var tracks = _this4[props.getterName]();
  87681. tracks.addEventListener("removetrack", trackListChanges);
  87682. tracks.addEventListener("addtrack", trackListChanges);
  87683. _this4.on("dispose", function() {
  87684. tracks.removeEventListener("removetrack", trackListChanges);
  87685. tracks.removeEventListener("addtrack", trackListChanges);
  87686. });
  87687. });
  87688. };
  87689. _proto.addWebVttScript_ = function addWebVttScript_() {
  87690. var _this5 = this;
  87691. if (window_1.WebVTT) {
  87692. return;
  87693. }
  87694. if (document_1.body.contains(this.el())) {
  87695. if (!this.options_["vtt.js"] && isPlain(vtt) && Object.keys(vtt).length > 0) {
  87696. this.trigger("vttjsloaded");
  87697. return;
  87698. }
  87699. var script = document_1.createElement("script");
  87700. script.src = this.options_["vtt.js"] || "https://vjs.zencdn.net/vttjs/0.14.1/vtt.min.js";
  87701. script.onload = function() {
  87702. _this5.trigger("vttjsloaded");
  87703. };
  87704. script.onerror = function() {
  87705. _this5.trigger("vttjserror");
  87706. };
  87707. this.on("dispose", function() {
  87708. script.onload = null;
  87709. script.onerror = null;
  87710. });
  87711. window_1.WebVTT = true;
  87712. this.el().parentNode.appendChild(script);
  87713. } else {
  87714. this.ready(this.addWebVttScript_);
  87715. }
  87716. };
  87717. _proto.emulateTextTracks = function emulateTextTracks() {
  87718. var _this6 = this;
  87719. var tracks = this.textTracks();
  87720. var remoteTracks = this.remoteTextTracks();
  87721. var handleAddTrack = function handleAddTrack2(e) {
  87722. return tracks.addTrack(e.track);
  87723. };
  87724. var handleRemoveTrack = function handleRemoveTrack2(e) {
  87725. return tracks.removeTrack(e.track);
  87726. };
  87727. remoteTracks.on("addtrack", handleAddTrack);
  87728. remoteTracks.on("removetrack", handleRemoveTrack);
  87729. this.addWebVttScript_();
  87730. var updateDisplay = function updateDisplay2() {
  87731. return _this6.trigger("texttrackchange");
  87732. };
  87733. var textTracksChanges = function textTracksChanges2() {
  87734. updateDisplay();
  87735. for (var i2 = 0; i2 < tracks.length; i2++) {
  87736. var track = tracks[i2];
  87737. track.removeEventListener("cuechange", updateDisplay);
  87738. if (track.mode === "showing") {
  87739. track.addEventListener("cuechange", updateDisplay);
  87740. }
  87741. }
  87742. };
  87743. textTracksChanges();
  87744. tracks.addEventListener("change", textTracksChanges);
  87745. tracks.addEventListener("addtrack", textTracksChanges);
  87746. tracks.addEventListener("removetrack", textTracksChanges);
  87747. this.on("dispose", function() {
  87748. remoteTracks.off("addtrack", handleAddTrack);
  87749. remoteTracks.off("removetrack", handleRemoveTrack);
  87750. tracks.removeEventListener("change", textTracksChanges);
  87751. tracks.removeEventListener("addtrack", textTracksChanges);
  87752. tracks.removeEventListener("removetrack", textTracksChanges);
  87753. for (var i2 = 0; i2 < tracks.length; i2++) {
  87754. var track = tracks[i2];
  87755. track.removeEventListener("cuechange", updateDisplay);
  87756. }
  87757. });
  87758. };
  87759. _proto.addTextTrack = function addTextTrack(kind, label, language) {
  87760. if (!kind) {
  87761. throw new Error("TextTrack kind is required but was not provided");
  87762. }
  87763. return createTrackHelper(this, kind, label, language);
  87764. };
  87765. _proto.createRemoteTextTrack = function createRemoteTextTrack(options2) {
  87766. var track = mergeOptions$3(options2, {
  87767. tech: this
  87768. });
  87769. return new REMOTE.remoteTextEl.TrackClass(track);
  87770. };
  87771. _proto.addRemoteTextTrack = function addRemoteTextTrack(options2, manualCleanup) {
  87772. var _this7 = this;
  87773. if (options2 === void 0) {
  87774. options2 = {};
  87775. }
  87776. var htmlTrackElement = this.createRemoteTextTrack(options2);
  87777. if (manualCleanup !== true && manualCleanup !== false) {
  87778. log$1.warn('Calling addRemoteTextTrack without explicitly setting the "manualCleanup" parameter to `true` is deprecated and default to `false` in future version of video.js');
  87779. manualCleanup = true;
  87780. }
  87781. this.remoteTextTrackEls().addTrackElement_(htmlTrackElement);
  87782. this.remoteTextTracks().addTrack(htmlTrackElement.track);
  87783. if (manualCleanup !== true) {
  87784. this.ready(function() {
  87785. return _this7.autoRemoteTextTracks_.addTrack(htmlTrackElement.track);
  87786. });
  87787. }
  87788. return htmlTrackElement;
  87789. };
  87790. _proto.removeRemoteTextTrack = function removeRemoteTextTrack(track) {
  87791. var trackElement = this.remoteTextTrackEls().getTrackElementByTrack_(track);
  87792. this.remoteTextTrackEls().removeTrackElement_(trackElement);
  87793. this.remoteTextTracks().removeTrack(track);
  87794. this.autoRemoteTextTracks_.removeTrack(track);
  87795. };
  87796. _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
  87797. return {};
  87798. };
  87799. _proto.requestPictureInPicture = function requestPictureInPicture() {
  87800. var PromiseClass = this.options_.Promise || window_1.Promise;
  87801. if (PromiseClass) {
  87802. return PromiseClass.reject();
  87803. }
  87804. };
  87805. _proto.disablePictureInPicture = function disablePictureInPicture() {
  87806. return true;
  87807. };
  87808. _proto.setDisablePictureInPicture = function setDisablePictureInPicture() {
  87809. };
  87810. _proto.requestVideoFrameCallback = function requestVideoFrameCallback(cb) {
  87811. var _this8 = this;
  87812. var id = newGUID();
  87813. if (!this.isReady_ || this.paused()) {
  87814. this.queuedHanders_.add(id);
  87815. this.one("playing", function() {
  87816. if (_this8.queuedHanders_.has(id)) {
  87817. _this8.queuedHanders_["delete"](id);
  87818. cb();
  87819. }
  87820. });
  87821. } else {
  87822. this.requestNamedAnimationFrame(id, cb);
  87823. }
  87824. return id;
  87825. };
  87826. _proto.cancelVideoFrameCallback = function cancelVideoFrameCallback(id) {
  87827. if (this.queuedHanders_.has(id)) {
  87828. this.queuedHanders_["delete"](id);
  87829. } else {
  87830. this.cancelNamedAnimationFrame(id);
  87831. }
  87832. };
  87833. _proto.setPoster = function setPoster() {
  87834. };
  87835. _proto.playsinline = function playsinline() {
  87836. };
  87837. _proto.setPlaysinline = function setPlaysinline() {
  87838. };
  87839. _proto.overrideNativeAudioTracks = function overrideNativeAudioTracks() {
  87840. };
  87841. _proto.overrideNativeVideoTracks = function overrideNativeVideoTracks() {
  87842. };
  87843. _proto.canPlayType = function canPlayType3() {
  87844. return "";
  87845. };
  87846. Tech2.canPlayType = function canPlayType3() {
  87847. return "";
  87848. };
  87849. Tech2.canPlaySource = function canPlaySource(srcObj, options2) {
  87850. return Tech2.canPlayType(srcObj.type);
  87851. };
  87852. Tech2.isTech = function isTech(component) {
  87853. return component.prototype instanceof Tech2 || component instanceof Tech2 || component === Tech2;
  87854. };
  87855. Tech2.registerTech = function registerTech(name, tech) {
  87856. if (!Tech2.techs_) {
  87857. Tech2.techs_ = {};
  87858. }
  87859. if (!Tech2.isTech(tech)) {
  87860. throw new Error("Tech " + name + " must be a Tech");
  87861. }
  87862. if (!Tech2.canPlayType) {
  87863. throw new Error("Techs must have a static canPlayType method on them");
  87864. }
  87865. if (!Tech2.canPlaySource) {
  87866. throw new Error("Techs must have a static canPlaySource method on them");
  87867. }
  87868. name = toTitleCase$1(name);
  87869. Tech2.techs_[name] = tech;
  87870. Tech2.techs_[toLowerCase(name)] = tech;
  87871. if (name !== "Tech") {
  87872. Tech2.defaultTechOrder_.push(name);
  87873. }
  87874. return tech;
  87875. };
  87876. Tech2.getTech = function getTech(name) {
  87877. if (!name) {
  87878. return;
  87879. }
  87880. if (Tech2.techs_ && Tech2.techs_[name]) {
  87881. return Tech2.techs_[name];
  87882. }
  87883. name = toTitleCase$1(name);
  87884. if (window_1 && window_1.videojs && window_1.videojs[name]) {
  87885. log$1.warn("The " + name + " tech was added to the videojs object when it should be registered using videojs.registerTech(name, tech)");
  87886. return window_1.videojs[name];
  87887. }
  87888. };
  87889. return Tech2;
  87890. }(Component$1);
  87891. ALL.names.forEach(function(name) {
  87892. var props = ALL[name];
  87893. Tech$1.prototype[props.getterName] = function() {
  87894. this[props.privateName] = this[props.privateName] || new props.ListClass();
  87895. return this[props.privateName];
  87896. };
  87897. });
  87898. Tech$1.prototype.featuresVolumeControl = true;
  87899. Tech$1.prototype.featuresMuteControl = true;
  87900. Tech$1.prototype.featuresFullscreenResize = false;
  87901. Tech$1.prototype.featuresPlaybackRate = false;
  87902. Tech$1.prototype.featuresProgressEvents = false;
  87903. Tech$1.prototype.featuresSourceset = false;
  87904. Tech$1.prototype.featuresTimeupdateEvents = false;
  87905. Tech$1.prototype.featuresNativeTextTracks = false;
  87906. Tech$1.prototype.featuresVideoFrameCallback = false;
  87907. Tech$1.withSourceHandlers = function(_Tech) {
  87908. _Tech.registerSourceHandler = function(handler, index2) {
  87909. var handlers = _Tech.sourceHandlers;
  87910. if (!handlers) {
  87911. handlers = _Tech.sourceHandlers = [];
  87912. }
  87913. if (index2 === void 0) {
  87914. index2 = handlers.length;
  87915. }
  87916. handlers.splice(index2, 0, handler);
  87917. };
  87918. _Tech.canPlayType = function(type2) {
  87919. var handlers = _Tech.sourceHandlers || [];
  87920. var can;
  87921. for (var i2 = 0; i2 < handlers.length; i2++) {
  87922. can = handlers[i2].canPlayType(type2);
  87923. if (can) {
  87924. return can;
  87925. }
  87926. }
  87927. return "";
  87928. };
  87929. _Tech.selectSourceHandler = function(source, options2) {
  87930. var handlers = _Tech.sourceHandlers || [];
  87931. var can;
  87932. for (var i2 = 0; i2 < handlers.length; i2++) {
  87933. can = handlers[i2].canHandleSource(source, options2);
  87934. if (can) {
  87935. return handlers[i2];
  87936. }
  87937. }
  87938. return null;
  87939. };
  87940. _Tech.canPlaySource = function(srcObj, options2) {
  87941. var sh = _Tech.selectSourceHandler(srcObj, options2);
  87942. if (sh) {
  87943. return sh.canHandleSource(srcObj, options2);
  87944. }
  87945. return "";
  87946. };
  87947. var deferrable = ["seekable", "seeking", "duration"];
  87948. deferrable.forEach(function(fnName) {
  87949. var originalFn = this[fnName];
  87950. if (typeof originalFn !== "function") {
  87951. return;
  87952. }
  87953. this[fnName] = function() {
  87954. if (this.sourceHandler_ && this.sourceHandler_[fnName]) {
  87955. return this.sourceHandler_[fnName].apply(this.sourceHandler_, arguments);
  87956. }
  87957. return originalFn.apply(this, arguments);
  87958. };
  87959. }, _Tech.prototype);
  87960. _Tech.prototype.setSource = function(source) {
  87961. var sh = _Tech.selectSourceHandler(source, this.options_);
  87962. if (!sh) {
  87963. if (_Tech.nativeSourceHandler) {
  87964. sh = _Tech.nativeSourceHandler;
  87965. } else {
  87966. log$1.error("No source handler found for the current source.");
  87967. }
  87968. }
  87969. this.disposeSourceHandler();
  87970. this.off("dispose", this.disposeSourceHandler_);
  87971. if (sh !== _Tech.nativeSourceHandler) {
  87972. this.currentSource_ = source;
  87973. }
  87974. this.sourceHandler_ = sh.handleSource(source, this, this.options_);
  87975. this.one("dispose", this.disposeSourceHandler_);
  87976. };
  87977. _Tech.prototype.disposeSourceHandler = function() {
  87978. if (this.currentSource_) {
  87979. this.clearTracks(["audio", "video"]);
  87980. this.currentSource_ = null;
  87981. }
  87982. this.cleanupAutoTextTracks();
  87983. if (this.sourceHandler_) {
  87984. if (this.sourceHandler_.dispose) {
  87985. this.sourceHandler_.dispose();
  87986. }
  87987. this.sourceHandler_ = null;
  87988. }
  87989. };
  87990. };
  87991. Component$1.registerComponent("Tech", Tech$1);
  87992. Tech$1.registerTech("Tech", Tech$1);
  87993. Tech$1.defaultTechOrder_ = [];
  87994. var middlewares = {};
  87995. var middlewareInstances = {};
  87996. var TERMINATOR = {};
  87997. function use(type2, middleware) {
  87998. middlewares[type2] = middlewares[type2] || [];
  87999. middlewares[type2].push(middleware);
  88000. }
  88001. function setSource(player, src, next) {
  88002. player.setTimeout(function() {
  88003. return setSourceHelper(src, middlewares[src.type], next, player);
  88004. }, 1);
  88005. }
  88006. function setTech(middleware, tech) {
  88007. middleware.forEach(function(mw) {
  88008. return mw.setTech && mw.setTech(tech);
  88009. });
  88010. }
  88011. function get(middleware, tech, method) {
  88012. return middleware.reduceRight(middlewareIterator(method), tech[method]());
  88013. }
  88014. function set(middleware, tech, method, arg) {
  88015. return tech[method](middleware.reduce(middlewareIterator(method), arg));
  88016. }
  88017. function mediate(middleware, tech, method, arg) {
  88018. if (arg === void 0) {
  88019. arg = null;
  88020. }
  88021. var callMethod = "call" + toTitleCase$1(method);
  88022. var middlewareValue = middleware.reduce(middlewareIterator(callMethod), arg);
  88023. var terminated = middlewareValue === TERMINATOR;
  88024. var returnValue = terminated ? null : tech[method](middlewareValue);
  88025. executeRight(middleware, method, returnValue, terminated);
  88026. return returnValue;
  88027. }
  88028. var allowedGetters = {
  88029. buffered: 1,
  88030. currentTime: 1,
  88031. duration: 1,
  88032. muted: 1,
  88033. played: 1,
  88034. paused: 1,
  88035. seekable: 1,
  88036. volume: 1,
  88037. ended: 1
  88038. };
  88039. var allowedSetters = {
  88040. setCurrentTime: 1,
  88041. setMuted: 1,
  88042. setVolume: 1
  88043. };
  88044. var allowedMediators = {
  88045. play: 1,
  88046. pause: 1
  88047. };
  88048. function middlewareIterator(method) {
  88049. return function(value, mw) {
  88050. if (value === TERMINATOR) {
  88051. return TERMINATOR;
  88052. }
  88053. if (mw[method]) {
  88054. return mw[method](value);
  88055. }
  88056. return value;
  88057. };
  88058. }
  88059. function executeRight(mws, method, value, terminated) {
  88060. for (var i2 = mws.length - 1; i2 >= 0; i2--) {
  88061. var mw = mws[i2];
  88062. if (mw[method]) {
  88063. mw[method](terminated, value);
  88064. }
  88065. }
  88066. }
  88067. function clearCacheForPlayer(player) {
  88068. middlewareInstances[player.id()] = null;
  88069. }
  88070. function getOrCreateFactory(player, mwFactory) {
  88071. var mws = middlewareInstances[player.id()];
  88072. var mw = null;
  88073. if (mws === void 0 || mws === null) {
  88074. mw = mwFactory(player);
  88075. middlewareInstances[player.id()] = [[mwFactory, mw]];
  88076. return mw;
  88077. }
  88078. for (var i2 = 0; i2 < mws.length; i2++) {
  88079. var _mws$i = mws[i2], mwf = _mws$i[0], mwi = _mws$i[1];
  88080. if (mwf !== mwFactory) {
  88081. continue;
  88082. }
  88083. mw = mwi;
  88084. }
  88085. if (mw === null) {
  88086. mw = mwFactory(player);
  88087. mws.push([mwFactory, mw]);
  88088. }
  88089. return mw;
  88090. }
  88091. function setSourceHelper(src, middleware, next, player, acc, lastRun) {
  88092. if (src === void 0) {
  88093. src = {};
  88094. }
  88095. if (middleware === void 0) {
  88096. middleware = [];
  88097. }
  88098. if (acc === void 0) {
  88099. acc = [];
  88100. }
  88101. if (lastRun === void 0) {
  88102. lastRun = false;
  88103. }
  88104. var _middleware = middleware, mwFactory = _middleware[0], mwrest = _middleware.slice(1);
  88105. if (typeof mwFactory === "string") {
  88106. setSourceHelper(src, middlewares[mwFactory], next, player, acc, lastRun);
  88107. } else if (mwFactory) {
  88108. var mw = getOrCreateFactory(player, mwFactory);
  88109. if (!mw.setSource) {
  88110. acc.push(mw);
  88111. return setSourceHelper(src, mwrest, next, player, acc, lastRun);
  88112. }
  88113. mw.setSource(assign({}, src), function(err, _src) {
  88114. if (err) {
  88115. return setSourceHelper(src, mwrest, next, player, acc, lastRun);
  88116. }
  88117. acc.push(mw);
  88118. setSourceHelper(_src, src.type === _src.type ? mwrest : middlewares[_src.type], next, player, acc, lastRun);
  88119. });
  88120. } else if (mwrest.length) {
  88121. setSourceHelper(src, mwrest, next, player, acc, lastRun);
  88122. } else if (lastRun) {
  88123. next(src, acc);
  88124. } else {
  88125. setSourceHelper(src, middlewares["*"], next, player, acc, true);
  88126. }
  88127. }
  88128. var MimetypesKind = {
  88129. opus: "video/ogg",
  88130. ogv: "video/ogg",
  88131. mp4: "video/mp4",
  88132. mov: "video/mp4",
  88133. m4v: "video/mp4",
  88134. mkv: "video/x-matroska",
  88135. m4a: "audio/mp4",
  88136. mp3: "audio/mpeg",
  88137. aac: "audio/aac",
  88138. caf: "audio/x-caf",
  88139. flac: "audio/flac",
  88140. oga: "audio/ogg",
  88141. wav: "audio/wav",
  88142. m3u8: "application/x-mpegURL",
  88143. mpd: "application/dash+xml",
  88144. jpg: "image/jpeg",
  88145. jpeg: "image/jpeg",
  88146. gif: "image/gif",
  88147. png: "image/png",
  88148. svg: "image/svg+xml",
  88149. webp: "image/webp"
  88150. };
  88151. var getMimetype = function getMimetype2(src) {
  88152. if (src === void 0) {
  88153. src = "";
  88154. }
  88155. var ext = getFileExtension(src);
  88156. var mimetype = MimetypesKind[ext.toLowerCase()];
  88157. return mimetype || "";
  88158. };
  88159. var findMimetype = function findMimetype2(player, src) {
  88160. if (!src) {
  88161. return "";
  88162. }
  88163. if (player.cache_.source.src === src && player.cache_.source.type) {
  88164. return player.cache_.source.type;
  88165. }
  88166. var matchingSources = player.cache_.sources.filter(function(s2) {
  88167. return s2.src === src;
  88168. });
  88169. if (matchingSources.length) {
  88170. return matchingSources[0].type;
  88171. }
  88172. var sources = player.$$("source");
  88173. for (var i2 = 0; i2 < sources.length; i2++) {
  88174. var s = sources[i2];
  88175. if (s.type && s.src && s.src === src) {
  88176. return s.type;
  88177. }
  88178. }
  88179. return getMimetype(src);
  88180. };
  88181. var filterSource = function filterSource2(src) {
  88182. if (Array.isArray(src)) {
  88183. var newsrc = [];
  88184. src.forEach(function(srcobj) {
  88185. srcobj = filterSource2(srcobj);
  88186. if (Array.isArray(srcobj)) {
  88187. newsrc = newsrc.concat(srcobj);
  88188. } else if (isObject2(srcobj)) {
  88189. newsrc.push(srcobj);
  88190. }
  88191. });
  88192. src = newsrc;
  88193. } else if (typeof src === "string" && src.trim()) {
  88194. src = [fixSource({
  88195. src
  88196. })];
  88197. } else if (isObject2(src) && typeof src.src === "string" && src.src && src.src.trim()) {
  88198. src = [fixSource(src)];
  88199. } else {
  88200. src = [];
  88201. }
  88202. return src;
  88203. };
  88204. function fixSource(src) {
  88205. if (!src.type) {
  88206. var mimetype = getMimetype(src.src);
  88207. if (mimetype) {
  88208. src.type = mimetype;
  88209. }
  88210. }
  88211. return src;
  88212. }
  88213. var MediaLoader = /* @__PURE__ */ function(_Component) {
  88214. _inheritsLoose(MediaLoader2, _Component);
  88215. function MediaLoader2(player, options2, ready) {
  88216. var _this;
  88217. var options_ = mergeOptions$3({
  88218. createEl: false
  88219. }, options2);
  88220. _this = _Component.call(this, player, options_, ready) || this;
  88221. if (!options2.playerOptions.sources || options2.playerOptions.sources.length === 0) {
  88222. for (var i2 = 0, j = options2.playerOptions.techOrder; i2 < j.length; i2++) {
  88223. var techName = toTitleCase$1(j[i2]);
  88224. var tech = Tech$1.getTech(techName);
  88225. if (!techName) {
  88226. tech = Component$1.getComponent(techName);
  88227. }
  88228. if (tech && tech.isSupported()) {
  88229. player.loadTech_(techName);
  88230. break;
  88231. }
  88232. }
  88233. } else {
  88234. player.src(options2.playerOptions.sources);
  88235. }
  88236. return _this;
  88237. }
  88238. return MediaLoader2;
  88239. }(Component$1);
  88240. Component$1.registerComponent("MediaLoader", MediaLoader);
  88241. var ClickableComponent = /* @__PURE__ */ function(_Component) {
  88242. _inheritsLoose(ClickableComponent2, _Component);
  88243. function ClickableComponent2(player, options2) {
  88244. var _this;
  88245. _this = _Component.call(this, player, options2) || this;
  88246. if (_this.options_.controlText) {
  88247. _this.controlText(_this.options_.controlText);
  88248. }
  88249. _this.handleMouseOver_ = function(e) {
  88250. return _this.handleMouseOver(e);
  88251. };
  88252. _this.handleMouseOut_ = function(e) {
  88253. return _this.handleMouseOut(e);
  88254. };
  88255. _this.handleClick_ = function(e) {
  88256. return _this.handleClick(e);
  88257. };
  88258. _this.handleKeyDown_ = function(e) {
  88259. return _this.handleKeyDown(e);
  88260. };
  88261. _this.emitTapEvents();
  88262. _this.enable();
  88263. return _this;
  88264. }
  88265. var _proto = ClickableComponent2.prototype;
  88266. _proto.createEl = function createEl$12(tag, props, attributes) {
  88267. if (tag === void 0) {
  88268. tag = "div";
  88269. }
  88270. if (props === void 0) {
  88271. props = {};
  88272. }
  88273. if (attributes === void 0) {
  88274. attributes = {};
  88275. }
  88276. props = assign({
  88277. className: this.buildCSSClass(),
  88278. tabIndex: 0
  88279. }, props);
  88280. if (tag === "button") {
  88281. log$1.error("Creating a ClickableComponent with an HTML element of " + tag + " is not supported; use a Button instead.");
  88282. }
  88283. attributes = assign({
  88284. role: "button"
  88285. }, attributes);
  88286. this.tabIndex_ = props.tabIndex;
  88287. var el = createEl(tag, props, attributes);
  88288. el.appendChild(createEl("span", {
  88289. className: "vjs-icon-placeholder"
  88290. }, {
  88291. "aria-hidden": true
  88292. }));
  88293. this.createControlTextEl(el);
  88294. return el;
  88295. };
  88296. _proto.dispose = function dispose() {
  88297. this.controlTextEl_ = null;
  88298. _Component.prototype.dispose.call(this);
  88299. };
  88300. _proto.createControlTextEl = function createControlTextEl(el) {
  88301. this.controlTextEl_ = createEl("span", {
  88302. className: "vjs-control-text"
  88303. }, {
  88304. "aria-live": "polite"
  88305. });
  88306. if (el) {
  88307. el.appendChild(this.controlTextEl_);
  88308. }
  88309. this.controlText(this.controlText_, el);
  88310. return this.controlTextEl_;
  88311. };
  88312. _proto.controlText = function controlText(text, el) {
  88313. if (el === void 0) {
  88314. el = this.el();
  88315. }
  88316. if (text === void 0) {
  88317. return this.controlText_ || "Need Text";
  88318. }
  88319. var localizedText = this.localize(text);
  88320. this.controlText_ = text;
  88321. textContent(this.controlTextEl_, localizedText);
  88322. if (!this.nonIconControl && !this.player_.options_.noUITitleAttributes) {
  88323. el.setAttribute("title", localizedText);
  88324. }
  88325. };
  88326. _proto.buildCSSClass = function buildCSSClass() {
  88327. return "vjs-control vjs-button " + _Component.prototype.buildCSSClass.call(this);
  88328. };
  88329. _proto.enable = function enable() {
  88330. if (!this.enabled_) {
  88331. this.enabled_ = true;
  88332. this.removeClass("vjs-disabled");
  88333. this.el_.setAttribute("aria-disabled", "false");
  88334. if (typeof this.tabIndex_ !== "undefined") {
  88335. this.el_.setAttribute("tabIndex", this.tabIndex_);
  88336. }
  88337. this.on(["tap", "click"], this.handleClick_);
  88338. this.on("keydown", this.handleKeyDown_);
  88339. }
  88340. };
  88341. _proto.disable = function disable() {
  88342. this.enabled_ = false;
  88343. this.addClass("vjs-disabled");
  88344. this.el_.setAttribute("aria-disabled", "true");
  88345. if (typeof this.tabIndex_ !== "undefined") {
  88346. this.el_.removeAttribute("tabIndex");
  88347. }
  88348. this.off("mouseover", this.handleMouseOver_);
  88349. this.off("mouseout", this.handleMouseOut_);
  88350. this.off(["tap", "click"], this.handleClick_);
  88351. this.off("keydown", this.handleKeyDown_);
  88352. };
  88353. _proto.handleLanguagechange = function handleLanguagechange() {
  88354. this.controlText(this.controlText_);
  88355. };
  88356. _proto.handleClick = function handleClick(event2) {
  88357. if (this.options_.clickHandler) {
  88358. this.options_.clickHandler.call(this, arguments);
  88359. }
  88360. };
  88361. _proto.handleKeyDown = function handleKeyDown(event2) {
  88362. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  88363. event2.preventDefault();
  88364. event2.stopPropagation();
  88365. this.trigger("click");
  88366. } else {
  88367. _Component.prototype.handleKeyDown.call(this, event2);
  88368. }
  88369. };
  88370. return ClickableComponent2;
  88371. }(Component$1);
  88372. Component$1.registerComponent("ClickableComponent", ClickableComponent);
  88373. var PosterImage = /* @__PURE__ */ function(_ClickableComponent) {
  88374. _inheritsLoose(PosterImage2, _ClickableComponent);
  88375. function PosterImage2(player, options2) {
  88376. var _this;
  88377. _this = _ClickableComponent.call(this, player, options2) || this;
  88378. _this.update();
  88379. _this.update_ = function(e) {
  88380. return _this.update(e);
  88381. };
  88382. player.on("posterchange", _this.update_);
  88383. return _this;
  88384. }
  88385. var _proto = PosterImage2.prototype;
  88386. _proto.dispose = function dispose() {
  88387. this.player().off("posterchange", this.update_);
  88388. _ClickableComponent.prototype.dispose.call(this);
  88389. };
  88390. _proto.createEl = function createEl$12() {
  88391. var el = createEl("div", {
  88392. className: "vjs-poster",
  88393. tabIndex: -1
  88394. });
  88395. return el;
  88396. };
  88397. _proto.update = function update(event2) {
  88398. var url = this.player().poster();
  88399. this.setSrc(url);
  88400. if (url) {
  88401. this.show();
  88402. } else {
  88403. this.hide();
  88404. }
  88405. };
  88406. _proto.setSrc = function setSrc(url) {
  88407. var backgroundImage = "";
  88408. if (url) {
  88409. backgroundImage = 'url("' + url + '")';
  88410. }
  88411. this.el_.style.backgroundImage = backgroundImage;
  88412. };
  88413. _proto.handleClick = function handleClick(event2) {
  88414. if (!this.player_.controls()) {
  88415. return;
  88416. }
  88417. var sourceIsEncrypted = this.player_.usingPlugin("eme") && this.player_.eme.sessions && this.player_.eme.sessions.length > 0;
  88418. if (this.player_.tech(true) && !((IE_VERSION || IS_EDGE) && sourceIsEncrypted)) {
  88419. this.player_.tech(true).focus();
  88420. }
  88421. if (this.player_.paused()) {
  88422. silencePromise(this.player_.play());
  88423. } else {
  88424. this.player_.pause();
  88425. }
  88426. };
  88427. return PosterImage2;
  88428. }(ClickableComponent);
  88429. Component$1.registerComponent("PosterImage", PosterImage);
  88430. var darkGray = "#222";
  88431. var lightGray = "#ccc";
  88432. var fontMap = {
  88433. monospace: "monospace",
  88434. sansSerif: "sans-serif",
  88435. serif: "serif",
  88436. monospaceSansSerif: '"Andale Mono", "Lucida Console", monospace',
  88437. monospaceSerif: '"Courier New", monospace',
  88438. proportionalSansSerif: "sans-serif",
  88439. proportionalSerif: "serif",
  88440. casual: '"Comic Sans MS", Impact, fantasy',
  88441. script: '"Monotype Corsiva", cursive',
  88442. smallcaps: '"Andale Mono", "Lucida Console", monospace, sans-serif'
  88443. };
  88444. function constructColor(color2, opacity) {
  88445. var hex;
  88446. if (color2.length === 4) {
  88447. hex = color2[1] + color2[1] + color2[2] + color2[2] + color2[3] + color2[3];
  88448. } else if (color2.length === 7) {
  88449. hex = color2.slice(1);
  88450. } else {
  88451. throw new Error("Invalid color code provided, " + color2 + "; must be formatted as e.g. #f0e or #f604e2.");
  88452. }
  88453. return "rgba(" + parseInt(hex.slice(0, 2), 16) + "," + parseInt(hex.slice(2, 4), 16) + "," + parseInt(hex.slice(4, 6), 16) + "," + opacity + ")";
  88454. }
  88455. function tryUpdateStyle(el, style, rule) {
  88456. try {
  88457. el.style[style] = rule;
  88458. } catch (e) {
  88459. return;
  88460. }
  88461. }
  88462. var TextTrackDisplay = /* @__PURE__ */ function(_Component) {
  88463. _inheritsLoose(TextTrackDisplay2, _Component);
  88464. function TextTrackDisplay2(player, options2, ready) {
  88465. var _this;
  88466. _this = _Component.call(this, player, options2, ready) || this;
  88467. var updateDisplayHandler = function updateDisplayHandler2(e) {
  88468. return _this.updateDisplay(e);
  88469. };
  88470. player.on("loadstart", function(e) {
  88471. return _this.toggleDisplay(e);
  88472. });
  88473. player.on("texttrackchange", updateDisplayHandler);
  88474. player.on("loadedmetadata", function(e) {
  88475. return _this.preselectTrack(e);
  88476. });
  88477. player.ready(bind(_assertThisInitialized(_this), function() {
  88478. if (player.tech_ && player.tech_.featuresNativeTextTracks) {
  88479. this.hide();
  88480. return;
  88481. }
  88482. player.on("fullscreenchange", updateDisplayHandler);
  88483. player.on("playerresize", updateDisplayHandler);
  88484. window_1.addEventListener("orientationchange", updateDisplayHandler);
  88485. player.on("dispose", function() {
  88486. return window_1.removeEventListener("orientationchange", updateDisplayHandler);
  88487. });
  88488. var tracks = this.options_.playerOptions.tracks || [];
  88489. for (var i2 = 0; i2 < tracks.length; i2++) {
  88490. this.player_.addRemoteTextTrack(tracks[i2], true);
  88491. }
  88492. this.preselectTrack();
  88493. }));
  88494. return _this;
  88495. }
  88496. var _proto = TextTrackDisplay2.prototype;
  88497. _proto.preselectTrack = function preselectTrack() {
  88498. var modes = {
  88499. captions: 1,
  88500. subtitles: 1
  88501. };
  88502. var trackList = this.player_.textTracks();
  88503. var userPref = this.player_.cache_.selectedLanguage;
  88504. var firstDesc;
  88505. var firstCaptions;
  88506. var preferredTrack;
  88507. for (var i2 = 0; i2 < trackList.length; i2++) {
  88508. var track = trackList[i2];
  88509. if (userPref && userPref.enabled && userPref.language && userPref.language === track.language && track.kind in modes) {
  88510. if (track.kind === userPref.kind) {
  88511. preferredTrack = track;
  88512. } else if (!preferredTrack) {
  88513. preferredTrack = track;
  88514. }
  88515. } else if (userPref && !userPref.enabled) {
  88516. preferredTrack = null;
  88517. firstDesc = null;
  88518. firstCaptions = null;
  88519. } else if (track["default"]) {
  88520. if (track.kind === "descriptions" && !firstDesc) {
  88521. firstDesc = track;
  88522. } else if (track.kind in modes && !firstCaptions) {
  88523. firstCaptions = track;
  88524. }
  88525. }
  88526. }
  88527. if (preferredTrack) {
  88528. preferredTrack.mode = "showing";
  88529. } else if (firstCaptions) {
  88530. firstCaptions.mode = "showing";
  88531. } else if (firstDesc) {
  88532. firstDesc.mode = "showing";
  88533. }
  88534. };
  88535. _proto.toggleDisplay = function toggleDisplay() {
  88536. if (this.player_.tech_ && this.player_.tech_.featuresNativeTextTracks) {
  88537. this.hide();
  88538. } else {
  88539. this.show();
  88540. }
  88541. };
  88542. _proto.createEl = function createEl2() {
  88543. return _Component.prototype.createEl.call(this, "div", {
  88544. className: "vjs-text-track-display"
  88545. }, {
  88546. "translate": "yes",
  88547. "aria-live": "off",
  88548. "aria-atomic": "true"
  88549. });
  88550. };
  88551. _proto.clearDisplay = function clearDisplay() {
  88552. if (typeof window_1.WebVTT === "function") {
  88553. window_1.WebVTT.processCues(window_1, [], this.el_);
  88554. }
  88555. };
  88556. _proto.updateDisplay = function updateDisplay() {
  88557. var tracks = this.player_.textTracks();
  88558. var allowMultipleShowingTracks = this.options_.allowMultipleShowingTracks;
  88559. this.clearDisplay();
  88560. if (allowMultipleShowingTracks) {
  88561. var showingTracks = [];
  88562. for (var _i = 0; _i < tracks.length; ++_i) {
  88563. var track = tracks[_i];
  88564. if (track.mode !== "showing") {
  88565. continue;
  88566. }
  88567. showingTracks.push(track);
  88568. }
  88569. this.updateForTrack(showingTracks);
  88570. return;
  88571. }
  88572. var descriptionsTrack = null;
  88573. var captionsSubtitlesTrack = null;
  88574. var i2 = tracks.length;
  88575. while (i2--) {
  88576. var _track = tracks[i2];
  88577. if (_track.mode === "showing") {
  88578. if (_track.kind === "descriptions") {
  88579. descriptionsTrack = _track;
  88580. } else {
  88581. captionsSubtitlesTrack = _track;
  88582. }
  88583. }
  88584. }
  88585. if (captionsSubtitlesTrack) {
  88586. if (this.getAttribute("aria-live") !== "off") {
  88587. this.setAttribute("aria-live", "off");
  88588. }
  88589. this.updateForTrack(captionsSubtitlesTrack);
  88590. } else if (descriptionsTrack) {
  88591. if (this.getAttribute("aria-live") !== "assertive") {
  88592. this.setAttribute("aria-live", "assertive");
  88593. }
  88594. this.updateForTrack(descriptionsTrack);
  88595. }
  88596. };
  88597. _proto.updateDisplayState = function updateDisplayState(track) {
  88598. var overrides = this.player_.textTrackSettings.getValues();
  88599. var cues = track.activeCues;
  88600. var i2 = cues.length;
  88601. while (i2--) {
  88602. var cue = cues[i2];
  88603. if (!cue) {
  88604. continue;
  88605. }
  88606. var cueDiv = cue.displayState;
  88607. if (overrides.color) {
  88608. cueDiv.firstChild.style.color = overrides.color;
  88609. }
  88610. if (overrides.textOpacity) {
  88611. tryUpdateStyle(cueDiv.firstChild, "color", constructColor(overrides.color || "#fff", overrides.textOpacity));
  88612. }
  88613. if (overrides.backgroundColor) {
  88614. cueDiv.firstChild.style.backgroundColor = overrides.backgroundColor;
  88615. }
  88616. if (overrides.backgroundOpacity) {
  88617. tryUpdateStyle(cueDiv.firstChild, "backgroundColor", constructColor(overrides.backgroundColor || "#000", overrides.backgroundOpacity));
  88618. }
  88619. if (overrides.windowColor) {
  88620. if (overrides.windowOpacity) {
  88621. tryUpdateStyle(cueDiv, "backgroundColor", constructColor(overrides.windowColor, overrides.windowOpacity));
  88622. } else {
  88623. cueDiv.style.backgroundColor = overrides.windowColor;
  88624. }
  88625. }
  88626. if (overrides.edgeStyle) {
  88627. if (overrides.edgeStyle === "dropshadow") {
  88628. cueDiv.firstChild.style.textShadow = "2px 2px 3px " + darkGray + ", 2px 2px 4px " + darkGray + ", 2px 2px 5px " + darkGray;
  88629. } else if (overrides.edgeStyle === "raised") {
  88630. cueDiv.firstChild.style.textShadow = "1px 1px " + darkGray + ", 2px 2px " + darkGray + ", 3px 3px " + darkGray;
  88631. } else if (overrides.edgeStyle === "depressed") {
  88632. cueDiv.firstChild.style.textShadow = "1px 1px " + lightGray + ", 0 1px " + lightGray + ", -1px -1px " + darkGray + ", 0 -1px " + darkGray;
  88633. } else if (overrides.edgeStyle === "uniform") {
  88634. cueDiv.firstChild.style.textShadow = "0 0 4px " + darkGray + ", 0 0 4px " + darkGray + ", 0 0 4px " + darkGray + ", 0 0 4px " + darkGray;
  88635. }
  88636. }
  88637. if (overrides.fontPercent && overrides.fontPercent !== 1) {
  88638. var fontSize = window_1.parseFloat(cueDiv.style.fontSize);
  88639. cueDiv.style.fontSize = fontSize * overrides.fontPercent + "px";
  88640. cueDiv.style.height = "auto";
  88641. cueDiv.style.top = "auto";
  88642. }
  88643. if (overrides.fontFamily && overrides.fontFamily !== "default") {
  88644. if (overrides.fontFamily === "small-caps") {
  88645. cueDiv.firstChild.style.fontVariant = "small-caps";
  88646. } else {
  88647. cueDiv.firstChild.style.fontFamily = fontMap[overrides.fontFamily];
  88648. }
  88649. }
  88650. }
  88651. };
  88652. _proto.updateForTrack = function updateForTrack(tracks) {
  88653. if (!Array.isArray(tracks)) {
  88654. tracks = [tracks];
  88655. }
  88656. if (typeof window_1.WebVTT !== "function" || tracks.every(function(track2) {
  88657. return !track2.activeCues;
  88658. })) {
  88659. return;
  88660. }
  88661. var cues = [];
  88662. for (var i2 = 0; i2 < tracks.length; ++i2) {
  88663. var track = tracks[i2];
  88664. for (var j = 0; j < track.activeCues.length; ++j) {
  88665. cues.push(track.activeCues[j]);
  88666. }
  88667. }
  88668. window_1.WebVTT.processCues(window_1, cues, this.el_);
  88669. for (var _i2 = 0; _i2 < tracks.length; ++_i2) {
  88670. var _track2 = tracks[_i2];
  88671. for (var _j = 0; _j < _track2.activeCues.length; ++_j) {
  88672. var cueEl = _track2.activeCues[_j].displayState;
  88673. addClass(cueEl, "vjs-text-track-cue");
  88674. addClass(cueEl, "vjs-text-track-cue-" + (_track2.language ? _track2.language : _i2));
  88675. if (_track2.language) {
  88676. setAttribute(cueEl, "lang", _track2.language);
  88677. }
  88678. }
  88679. if (this.player_.textTrackSettings) {
  88680. this.updateDisplayState(_track2);
  88681. }
  88682. }
  88683. };
  88684. return TextTrackDisplay2;
  88685. }(Component$1);
  88686. Component$1.registerComponent("TextTrackDisplay", TextTrackDisplay);
  88687. var LoadingSpinner = /* @__PURE__ */ function(_Component) {
  88688. _inheritsLoose(LoadingSpinner2, _Component);
  88689. function LoadingSpinner2() {
  88690. return _Component.apply(this, arguments) || this;
  88691. }
  88692. var _proto = LoadingSpinner2.prototype;
  88693. _proto.createEl = function createEl$12() {
  88694. var isAudio = this.player_.isAudio();
  88695. var playerType = this.localize(isAudio ? "Audio Player" : "Video Player");
  88696. var controlText = createEl("span", {
  88697. className: "vjs-control-text",
  88698. textContent: this.localize("{1} is loading.", [playerType])
  88699. });
  88700. var el = _Component.prototype.createEl.call(this, "div", {
  88701. className: "vjs-loading-spinner",
  88702. dir: "ltr"
  88703. });
  88704. el.appendChild(controlText);
  88705. return el;
  88706. };
  88707. return LoadingSpinner2;
  88708. }(Component$1);
  88709. Component$1.registerComponent("LoadingSpinner", LoadingSpinner);
  88710. var Button = /* @__PURE__ */ function(_ClickableComponent) {
  88711. _inheritsLoose(Button2, _ClickableComponent);
  88712. function Button2() {
  88713. return _ClickableComponent.apply(this, arguments) || this;
  88714. }
  88715. var _proto = Button2.prototype;
  88716. _proto.createEl = function createEl$12(tag, props, attributes) {
  88717. if (props === void 0) {
  88718. props = {};
  88719. }
  88720. if (attributes === void 0) {
  88721. attributes = {};
  88722. }
  88723. tag = "button";
  88724. props = assign({
  88725. className: this.buildCSSClass()
  88726. }, props);
  88727. attributes = assign({
  88728. type: "button"
  88729. }, attributes);
  88730. var el = createEl(tag, props, attributes);
  88731. el.appendChild(createEl("span", {
  88732. className: "vjs-icon-placeholder"
  88733. }, {
  88734. "aria-hidden": true
  88735. }));
  88736. this.createControlTextEl(el);
  88737. return el;
  88738. };
  88739. _proto.addChild = function addChild(child, options2) {
  88740. if (options2 === void 0) {
  88741. options2 = {};
  88742. }
  88743. var className = this.constructor.name;
  88744. log$1.warn("Adding an actionable (user controllable) child to a Button (" + className + ") is not supported; use a ClickableComponent instead.");
  88745. return Component$1.prototype.addChild.call(this, child, options2);
  88746. };
  88747. _proto.enable = function enable() {
  88748. _ClickableComponent.prototype.enable.call(this);
  88749. this.el_.removeAttribute("disabled");
  88750. };
  88751. _proto.disable = function disable() {
  88752. _ClickableComponent.prototype.disable.call(this);
  88753. this.el_.setAttribute("disabled", "disabled");
  88754. };
  88755. _proto.handleKeyDown = function handleKeyDown(event2) {
  88756. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  88757. event2.stopPropagation();
  88758. return;
  88759. }
  88760. _ClickableComponent.prototype.handleKeyDown.call(this, event2);
  88761. };
  88762. return Button2;
  88763. }(ClickableComponent);
  88764. Component$1.registerComponent("Button", Button);
  88765. var BigPlayButton = /* @__PURE__ */ function(_Button) {
  88766. _inheritsLoose(BigPlayButton2, _Button);
  88767. function BigPlayButton2(player, options2) {
  88768. var _this;
  88769. _this = _Button.call(this, player, options2) || this;
  88770. _this.mouseused_ = false;
  88771. _this.on("mousedown", function(e) {
  88772. return _this.handleMouseDown(e);
  88773. });
  88774. return _this;
  88775. }
  88776. var _proto = BigPlayButton2.prototype;
  88777. _proto.buildCSSClass = function buildCSSClass() {
  88778. return "vjs-big-play-button";
  88779. };
  88780. _proto.handleClick = function handleClick(event2) {
  88781. var playPromise = this.player_.play();
  88782. if (this.mouseused_ && event2.clientX && event2.clientY) {
  88783. var sourceIsEncrypted = this.player_.usingPlugin("eme") && this.player_.eme.sessions && this.player_.eme.sessions.length > 0;
  88784. silencePromise(playPromise);
  88785. if (this.player_.tech(true) && !((IE_VERSION || IS_EDGE) && sourceIsEncrypted)) {
  88786. this.player_.tech(true).focus();
  88787. }
  88788. return;
  88789. }
  88790. var cb = this.player_.getChild("controlBar");
  88791. var playToggle = cb && cb.getChild("playToggle");
  88792. if (!playToggle) {
  88793. this.player_.tech(true).focus();
  88794. return;
  88795. }
  88796. var playFocus = function playFocus2() {
  88797. return playToggle.focus();
  88798. };
  88799. if (isPromise(playPromise)) {
  88800. playPromise.then(playFocus, function() {
  88801. });
  88802. } else {
  88803. this.setTimeout(playFocus, 1);
  88804. }
  88805. };
  88806. _proto.handleKeyDown = function handleKeyDown(event2) {
  88807. this.mouseused_ = false;
  88808. _Button.prototype.handleKeyDown.call(this, event2);
  88809. };
  88810. _proto.handleMouseDown = function handleMouseDown(event2) {
  88811. this.mouseused_ = true;
  88812. };
  88813. return BigPlayButton2;
  88814. }(Button);
  88815. BigPlayButton.prototype.controlText_ = "Play Video";
  88816. Component$1.registerComponent("BigPlayButton", BigPlayButton);
  88817. var CloseButton = /* @__PURE__ */ function(_Button) {
  88818. _inheritsLoose(CloseButton2, _Button);
  88819. function CloseButton2(player, options2) {
  88820. var _this;
  88821. _this = _Button.call(this, player, options2) || this;
  88822. _this.controlText(options2 && options2.controlText || _this.localize("Close"));
  88823. return _this;
  88824. }
  88825. var _proto = CloseButton2.prototype;
  88826. _proto.buildCSSClass = function buildCSSClass() {
  88827. return "vjs-close-button " + _Button.prototype.buildCSSClass.call(this);
  88828. };
  88829. _proto.handleClick = function handleClick(event2) {
  88830. this.trigger({
  88831. type: "close",
  88832. bubbles: false
  88833. });
  88834. };
  88835. _proto.handleKeyDown = function handleKeyDown(event2) {
  88836. if (keycode.isEventKey(event2, "Esc")) {
  88837. event2.preventDefault();
  88838. event2.stopPropagation();
  88839. this.trigger("click");
  88840. } else {
  88841. _Button.prototype.handleKeyDown.call(this, event2);
  88842. }
  88843. };
  88844. return CloseButton2;
  88845. }(Button);
  88846. Component$1.registerComponent("CloseButton", CloseButton);
  88847. var PlayToggle = /* @__PURE__ */ function(_Button) {
  88848. _inheritsLoose(PlayToggle2, _Button);
  88849. function PlayToggle2(player, options2) {
  88850. var _this;
  88851. if (options2 === void 0) {
  88852. options2 = {};
  88853. }
  88854. _this = _Button.call(this, player, options2) || this;
  88855. options2.replay = options2.replay === void 0 || options2.replay;
  88856. _this.on(player, "play", function(e) {
  88857. return _this.handlePlay(e);
  88858. });
  88859. _this.on(player, "pause", function(e) {
  88860. return _this.handlePause(e);
  88861. });
  88862. if (options2.replay) {
  88863. _this.on(player, "ended", function(e) {
  88864. return _this.handleEnded(e);
  88865. });
  88866. }
  88867. return _this;
  88868. }
  88869. var _proto = PlayToggle2.prototype;
  88870. _proto.buildCSSClass = function buildCSSClass() {
  88871. return "vjs-play-control " + _Button.prototype.buildCSSClass.call(this);
  88872. };
  88873. _proto.handleClick = function handleClick(event2) {
  88874. if (this.player_.paused()) {
  88875. silencePromise(this.player_.play());
  88876. } else {
  88877. this.player_.pause();
  88878. }
  88879. };
  88880. _proto.handleSeeked = function handleSeeked(event2) {
  88881. this.removeClass("vjs-ended");
  88882. if (this.player_.paused()) {
  88883. this.handlePause(event2);
  88884. } else {
  88885. this.handlePlay(event2);
  88886. }
  88887. };
  88888. _proto.handlePlay = function handlePlay(event2) {
  88889. this.removeClass("vjs-ended");
  88890. this.removeClass("vjs-paused");
  88891. this.addClass("vjs-playing");
  88892. this.controlText("Pause");
  88893. };
  88894. _proto.handlePause = function handlePause(event2) {
  88895. this.removeClass("vjs-playing");
  88896. this.addClass("vjs-paused");
  88897. this.controlText("Play");
  88898. };
  88899. _proto.handleEnded = function handleEnded(event2) {
  88900. var _this2 = this;
  88901. this.removeClass("vjs-playing");
  88902. this.addClass("vjs-ended");
  88903. this.controlText("Replay");
  88904. this.one(this.player_, "seeked", function(e) {
  88905. return _this2.handleSeeked(e);
  88906. });
  88907. };
  88908. return PlayToggle2;
  88909. }(Button);
  88910. PlayToggle.prototype.controlText_ = "Play";
  88911. Component$1.registerComponent("PlayToggle", PlayToggle);
  88912. var defaultImplementation = function defaultImplementation2(seconds, guide) {
  88913. seconds = seconds < 0 ? 0 : seconds;
  88914. var s = Math.floor(seconds % 60);
  88915. var m = Math.floor(seconds / 60 % 60);
  88916. var h2 = Math.floor(seconds / 3600);
  88917. var gm = Math.floor(guide / 60 % 60);
  88918. var gh = Math.floor(guide / 3600);
  88919. if (isNaN(seconds) || seconds === Infinity) {
  88920. h2 = m = s = "-";
  88921. }
  88922. h2 = h2 > 0 || gh > 0 ? h2 + ":" : "";
  88923. m = ((h2 || gm >= 10) && m < 10 ? "0" + m : m) + ":";
  88924. s = s < 10 ? "0" + s : s;
  88925. return h2 + m + s;
  88926. };
  88927. var implementation = defaultImplementation;
  88928. function setFormatTime(customImplementation) {
  88929. implementation = customImplementation;
  88930. }
  88931. function resetFormatTime() {
  88932. implementation = defaultImplementation;
  88933. }
  88934. function formatTime(seconds, guide) {
  88935. if (guide === void 0) {
  88936. guide = seconds;
  88937. }
  88938. return implementation(seconds, guide);
  88939. }
  88940. var TimeDisplay = /* @__PURE__ */ function(_Component) {
  88941. _inheritsLoose(TimeDisplay2, _Component);
  88942. function TimeDisplay2(player, options2) {
  88943. var _this;
  88944. _this = _Component.call(this, player, options2) || this;
  88945. _this.on(player, ["timeupdate", "ended"], function(e) {
  88946. return _this.updateContent(e);
  88947. });
  88948. _this.updateTextNode_();
  88949. return _this;
  88950. }
  88951. var _proto = TimeDisplay2.prototype;
  88952. _proto.createEl = function createEl$12() {
  88953. var className = this.buildCSSClass();
  88954. var el = _Component.prototype.createEl.call(this, "div", {
  88955. className: className + " vjs-time-control vjs-control"
  88956. });
  88957. var span = createEl("span", {
  88958. className: "vjs-control-text",
  88959. textContent: this.localize(this.labelText_) + "\xA0"
  88960. }, {
  88961. role: "presentation"
  88962. });
  88963. el.appendChild(span);
  88964. this.contentEl_ = createEl("span", {
  88965. className: className + "-display"
  88966. }, {
  88967. "aria-live": "off",
  88968. "role": "presentation"
  88969. });
  88970. el.appendChild(this.contentEl_);
  88971. return el;
  88972. };
  88973. _proto.dispose = function dispose() {
  88974. this.contentEl_ = null;
  88975. this.textNode_ = null;
  88976. _Component.prototype.dispose.call(this);
  88977. };
  88978. _proto.updateTextNode_ = function updateTextNode_(time) {
  88979. var _this2 = this;
  88980. if (time === void 0) {
  88981. time = 0;
  88982. }
  88983. time = formatTime(time);
  88984. if (this.formattedTime_ === time) {
  88985. return;
  88986. }
  88987. this.formattedTime_ = time;
  88988. this.requestNamedAnimationFrame("TimeDisplay#updateTextNode_", function() {
  88989. if (!_this2.contentEl_) {
  88990. return;
  88991. }
  88992. var oldNode = _this2.textNode_;
  88993. if (oldNode && _this2.contentEl_.firstChild !== oldNode) {
  88994. oldNode = null;
  88995. log$1.warn("TimeDisplay#updateTextnode_: Prevented replacement of text node element since it was no longer a child of this node. Appending a new node instead.");
  88996. }
  88997. _this2.textNode_ = document_1.createTextNode(_this2.formattedTime_);
  88998. if (!_this2.textNode_) {
  88999. return;
  89000. }
  89001. if (oldNode) {
  89002. _this2.contentEl_.replaceChild(_this2.textNode_, oldNode);
  89003. } else {
  89004. _this2.contentEl_.appendChild(_this2.textNode_);
  89005. }
  89006. });
  89007. };
  89008. _proto.updateContent = function updateContent(event2) {
  89009. };
  89010. return TimeDisplay2;
  89011. }(Component$1);
  89012. TimeDisplay.prototype.labelText_ = "Time";
  89013. TimeDisplay.prototype.controlText_ = "Time";
  89014. Component$1.registerComponent("TimeDisplay", TimeDisplay);
  89015. var CurrentTimeDisplay = /* @__PURE__ */ function(_TimeDisplay) {
  89016. _inheritsLoose(CurrentTimeDisplay2, _TimeDisplay);
  89017. function CurrentTimeDisplay2() {
  89018. return _TimeDisplay.apply(this, arguments) || this;
  89019. }
  89020. var _proto = CurrentTimeDisplay2.prototype;
  89021. _proto.buildCSSClass = function buildCSSClass() {
  89022. return "vjs-current-time";
  89023. };
  89024. _proto.updateContent = function updateContent(event2) {
  89025. var time;
  89026. if (this.player_.ended()) {
  89027. time = this.player_.duration();
  89028. } else {
  89029. time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  89030. }
  89031. this.updateTextNode_(time);
  89032. };
  89033. return CurrentTimeDisplay2;
  89034. }(TimeDisplay);
  89035. CurrentTimeDisplay.prototype.labelText_ = "Current Time";
  89036. CurrentTimeDisplay.prototype.controlText_ = "Current Time";
  89037. Component$1.registerComponent("CurrentTimeDisplay", CurrentTimeDisplay);
  89038. var DurationDisplay = /* @__PURE__ */ function(_TimeDisplay) {
  89039. _inheritsLoose(DurationDisplay2, _TimeDisplay);
  89040. function DurationDisplay2(player, options2) {
  89041. var _this;
  89042. _this = _TimeDisplay.call(this, player, options2) || this;
  89043. var updateContent = function updateContent2(e) {
  89044. return _this.updateContent(e);
  89045. };
  89046. _this.on(player, "durationchange", updateContent);
  89047. _this.on(player, "loadstart", updateContent);
  89048. _this.on(player, "loadedmetadata", updateContent);
  89049. return _this;
  89050. }
  89051. var _proto = DurationDisplay2.prototype;
  89052. _proto.buildCSSClass = function buildCSSClass() {
  89053. return "vjs-duration";
  89054. };
  89055. _proto.updateContent = function updateContent(event2) {
  89056. var duration5 = this.player_.duration();
  89057. this.updateTextNode_(duration5);
  89058. };
  89059. return DurationDisplay2;
  89060. }(TimeDisplay);
  89061. DurationDisplay.prototype.labelText_ = "Duration";
  89062. DurationDisplay.prototype.controlText_ = "Duration";
  89063. Component$1.registerComponent("DurationDisplay", DurationDisplay);
  89064. var TimeDivider = /* @__PURE__ */ function(_Component) {
  89065. _inheritsLoose(TimeDivider2, _Component);
  89066. function TimeDivider2() {
  89067. return _Component.apply(this, arguments) || this;
  89068. }
  89069. var _proto = TimeDivider2.prototype;
  89070. _proto.createEl = function createEl2() {
  89071. var el = _Component.prototype.createEl.call(this, "div", {
  89072. className: "vjs-time-control vjs-time-divider"
  89073. }, {
  89074. "aria-hidden": true
  89075. });
  89076. var div = _Component.prototype.createEl.call(this, "div");
  89077. var span = _Component.prototype.createEl.call(this, "span", {
  89078. textContent: "/"
  89079. });
  89080. div.appendChild(span);
  89081. el.appendChild(div);
  89082. return el;
  89083. };
  89084. return TimeDivider2;
  89085. }(Component$1);
  89086. Component$1.registerComponent("TimeDivider", TimeDivider);
  89087. var RemainingTimeDisplay = /* @__PURE__ */ function(_TimeDisplay) {
  89088. _inheritsLoose(RemainingTimeDisplay2, _TimeDisplay);
  89089. function RemainingTimeDisplay2(player, options2) {
  89090. var _this;
  89091. _this = _TimeDisplay.call(this, player, options2) || this;
  89092. _this.on(player, "durationchange", function(e) {
  89093. return _this.updateContent(e);
  89094. });
  89095. return _this;
  89096. }
  89097. var _proto = RemainingTimeDisplay2.prototype;
  89098. _proto.buildCSSClass = function buildCSSClass() {
  89099. return "vjs-remaining-time";
  89100. };
  89101. _proto.createEl = function createEl$12() {
  89102. var el = _TimeDisplay.prototype.createEl.call(this);
  89103. if (this.options_.displayNegative !== false) {
  89104. el.insertBefore(createEl("span", {}, {
  89105. "aria-hidden": true
  89106. }, "-"), this.contentEl_);
  89107. }
  89108. return el;
  89109. };
  89110. _proto.updateContent = function updateContent(event2) {
  89111. if (typeof this.player_.duration() !== "number") {
  89112. return;
  89113. }
  89114. var time;
  89115. if (this.player_.ended()) {
  89116. time = 0;
  89117. } else if (this.player_.remainingTimeDisplay) {
  89118. time = this.player_.remainingTimeDisplay();
  89119. } else {
  89120. time = this.player_.remainingTime();
  89121. }
  89122. this.updateTextNode_(time);
  89123. };
  89124. return RemainingTimeDisplay2;
  89125. }(TimeDisplay);
  89126. RemainingTimeDisplay.prototype.labelText_ = "Remaining Time";
  89127. RemainingTimeDisplay.prototype.controlText_ = "Remaining Time";
  89128. Component$1.registerComponent("RemainingTimeDisplay", RemainingTimeDisplay);
  89129. var LiveDisplay = /* @__PURE__ */ function(_Component) {
  89130. _inheritsLoose(LiveDisplay2, _Component);
  89131. function LiveDisplay2(player, options2) {
  89132. var _this;
  89133. _this = _Component.call(this, player, options2) || this;
  89134. _this.updateShowing();
  89135. _this.on(_this.player(), "durationchange", function(e) {
  89136. return _this.updateShowing(e);
  89137. });
  89138. return _this;
  89139. }
  89140. var _proto = LiveDisplay2.prototype;
  89141. _proto.createEl = function createEl$12() {
  89142. var el = _Component.prototype.createEl.call(this, "div", {
  89143. className: "vjs-live-control vjs-control"
  89144. });
  89145. this.contentEl_ = createEl("div", {
  89146. className: "vjs-live-display"
  89147. }, {
  89148. "aria-live": "off"
  89149. });
  89150. this.contentEl_.appendChild(createEl("span", {
  89151. className: "vjs-control-text",
  89152. textContent: this.localize("Stream Type") + "\xA0"
  89153. }));
  89154. this.contentEl_.appendChild(document_1.createTextNode(this.localize("LIVE")));
  89155. el.appendChild(this.contentEl_);
  89156. return el;
  89157. };
  89158. _proto.dispose = function dispose() {
  89159. this.contentEl_ = null;
  89160. _Component.prototype.dispose.call(this);
  89161. };
  89162. _proto.updateShowing = function updateShowing(event2) {
  89163. if (this.player().duration() === Infinity) {
  89164. this.show();
  89165. } else {
  89166. this.hide();
  89167. }
  89168. };
  89169. return LiveDisplay2;
  89170. }(Component$1);
  89171. Component$1.registerComponent("LiveDisplay", LiveDisplay);
  89172. var SeekToLive = /* @__PURE__ */ function(_Button) {
  89173. _inheritsLoose(SeekToLive2, _Button);
  89174. function SeekToLive2(player, options2) {
  89175. var _this;
  89176. _this = _Button.call(this, player, options2) || this;
  89177. _this.updateLiveEdgeStatus();
  89178. if (_this.player_.liveTracker) {
  89179. _this.updateLiveEdgeStatusHandler_ = function(e) {
  89180. return _this.updateLiveEdgeStatus(e);
  89181. };
  89182. _this.on(_this.player_.liveTracker, "liveedgechange", _this.updateLiveEdgeStatusHandler_);
  89183. }
  89184. return _this;
  89185. }
  89186. var _proto = SeekToLive2.prototype;
  89187. _proto.createEl = function createEl$12() {
  89188. var el = _Button.prototype.createEl.call(this, "button", {
  89189. className: "vjs-seek-to-live-control vjs-control"
  89190. });
  89191. this.textEl_ = createEl("span", {
  89192. className: "vjs-seek-to-live-text",
  89193. textContent: this.localize("LIVE")
  89194. }, {
  89195. "aria-hidden": "true"
  89196. });
  89197. el.appendChild(this.textEl_);
  89198. return el;
  89199. };
  89200. _proto.updateLiveEdgeStatus = function updateLiveEdgeStatus() {
  89201. if (!this.player_.liveTracker || this.player_.liveTracker.atLiveEdge()) {
  89202. this.setAttribute("aria-disabled", true);
  89203. this.addClass("vjs-at-live-edge");
  89204. this.controlText("Seek to live, currently playing live");
  89205. } else {
  89206. this.setAttribute("aria-disabled", false);
  89207. this.removeClass("vjs-at-live-edge");
  89208. this.controlText("Seek to live, currently behind live");
  89209. }
  89210. };
  89211. _proto.handleClick = function handleClick() {
  89212. this.player_.liveTracker.seekToLiveEdge();
  89213. };
  89214. _proto.dispose = function dispose() {
  89215. if (this.player_.liveTracker) {
  89216. this.off(this.player_.liveTracker, "liveedgechange", this.updateLiveEdgeStatusHandler_);
  89217. }
  89218. this.textEl_ = null;
  89219. _Button.prototype.dispose.call(this);
  89220. };
  89221. return SeekToLive2;
  89222. }(Button);
  89223. SeekToLive.prototype.controlText_ = "Seek to live, currently playing live";
  89224. Component$1.registerComponent("SeekToLive", SeekToLive);
  89225. var clamp = function clamp2(number, min2, max2) {
  89226. number = Number(number);
  89227. return Math.min(max2, Math.max(min2, isNaN(number) ? min2 : number));
  89228. };
  89229. var Slider = /* @__PURE__ */ function(_Component) {
  89230. _inheritsLoose(Slider2, _Component);
  89231. function Slider2(player, options2) {
  89232. var _this;
  89233. _this = _Component.call(this, player, options2) || this;
  89234. _this.handleMouseDown_ = function(e) {
  89235. return _this.handleMouseDown(e);
  89236. };
  89237. _this.handleMouseUp_ = function(e) {
  89238. return _this.handleMouseUp(e);
  89239. };
  89240. _this.handleKeyDown_ = function(e) {
  89241. return _this.handleKeyDown(e);
  89242. };
  89243. _this.handleClick_ = function(e) {
  89244. return _this.handleClick(e);
  89245. };
  89246. _this.handleMouseMove_ = function(e) {
  89247. return _this.handleMouseMove(e);
  89248. };
  89249. _this.update_ = function(e) {
  89250. return _this.update(e);
  89251. };
  89252. _this.bar = _this.getChild(_this.options_.barName);
  89253. _this.vertical(!!_this.options_.vertical);
  89254. _this.enable();
  89255. return _this;
  89256. }
  89257. var _proto = Slider2.prototype;
  89258. _proto.enabled = function enabled() {
  89259. return this.enabled_;
  89260. };
  89261. _proto.enable = function enable() {
  89262. if (this.enabled()) {
  89263. return;
  89264. }
  89265. this.on("mousedown", this.handleMouseDown_);
  89266. this.on("touchstart", this.handleMouseDown_);
  89267. this.on("keydown", this.handleKeyDown_);
  89268. this.on("click", this.handleClick_);
  89269. this.on(this.player_, "controlsvisible", this.update);
  89270. if (this.playerEvent) {
  89271. this.on(this.player_, this.playerEvent, this.update);
  89272. }
  89273. this.removeClass("disabled");
  89274. this.setAttribute("tabindex", 0);
  89275. this.enabled_ = true;
  89276. };
  89277. _proto.disable = function disable() {
  89278. if (!this.enabled()) {
  89279. return;
  89280. }
  89281. var doc = this.bar.el_.ownerDocument;
  89282. this.off("mousedown", this.handleMouseDown_);
  89283. this.off("touchstart", this.handleMouseDown_);
  89284. this.off("keydown", this.handleKeyDown_);
  89285. this.off("click", this.handleClick_);
  89286. this.off(this.player_, "controlsvisible", this.update_);
  89287. this.off(doc, "mousemove", this.handleMouseMove_);
  89288. this.off(doc, "mouseup", this.handleMouseUp_);
  89289. this.off(doc, "touchmove", this.handleMouseMove_);
  89290. this.off(doc, "touchend", this.handleMouseUp_);
  89291. this.removeAttribute("tabindex");
  89292. this.addClass("disabled");
  89293. if (this.playerEvent) {
  89294. this.off(this.player_, this.playerEvent, this.update);
  89295. }
  89296. this.enabled_ = false;
  89297. };
  89298. _proto.createEl = function createEl2(type2, props, attributes) {
  89299. if (props === void 0) {
  89300. props = {};
  89301. }
  89302. if (attributes === void 0) {
  89303. attributes = {};
  89304. }
  89305. props.className = props.className + " vjs-slider";
  89306. props = assign({
  89307. tabIndex: 0
  89308. }, props);
  89309. attributes = assign({
  89310. "role": "slider",
  89311. "aria-valuenow": 0,
  89312. "aria-valuemin": 0,
  89313. "aria-valuemax": 100,
  89314. "tabIndex": 0
  89315. }, attributes);
  89316. return _Component.prototype.createEl.call(this, type2, props, attributes);
  89317. };
  89318. _proto.handleMouseDown = function handleMouseDown(event2) {
  89319. var doc = this.bar.el_.ownerDocument;
  89320. if (event2.type === "mousedown") {
  89321. event2.preventDefault();
  89322. }
  89323. if (event2.type === "touchstart" && !IS_CHROME) {
  89324. event2.preventDefault();
  89325. }
  89326. blockTextSelection();
  89327. this.addClass("vjs-sliding");
  89328. this.trigger("slideractive");
  89329. this.on(doc, "mousemove", this.handleMouseMove_);
  89330. this.on(doc, "mouseup", this.handleMouseUp_);
  89331. this.on(doc, "touchmove", this.handleMouseMove_);
  89332. this.on(doc, "touchend", this.handleMouseUp_);
  89333. this.handleMouseMove(event2, true);
  89334. };
  89335. _proto.handleMouseMove = function handleMouseMove(event2) {
  89336. };
  89337. _proto.handleMouseUp = function handleMouseUp() {
  89338. var doc = this.bar.el_.ownerDocument;
  89339. unblockTextSelection();
  89340. this.removeClass("vjs-sliding");
  89341. this.trigger("sliderinactive");
  89342. this.off(doc, "mousemove", this.handleMouseMove_);
  89343. this.off(doc, "mouseup", this.handleMouseUp_);
  89344. this.off(doc, "touchmove", this.handleMouseMove_);
  89345. this.off(doc, "touchend", this.handleMouseUp_);
  89346. this.update();
  89347. };
  89348. _proto.update = function update() {
  89349. var _this2 = this;
  89350. if (!this.el_ || !this.bar) {
  89351. return;
  89352. }
  89353. var progress = this.getProgress();
  89354. if (progress === this.progress_) {
  89355. return progress;
  89356. }
  89357. this.progress_ = progress;
  89358. this.requestNamedAnimationFrame("Slider#update", function() {
  89359. var sizeKey = _this2.vertical() ? "height" : "width";
  89360. _this2.bar.el().style[sizeKey] = (progress * 100).toFixed(2) + "%";
  89361. });
  89362. return progress;
  89363. };
  89364. _proto.getProgress = function getProgress() {
  89365. return Number(clamp(this.getPercent(), 0, 1).toFixed(4));
  89366. };
  89367. _proto.calculateDistance = function calculateDistance(event2) {
  89368. var position2 = getPointerPosition(this.el_, event2);
  89369. if (this.vertical()) {
  89370. return position2.y;
  89371. }
  89372. return position2.x;
  89373. };
  89374. _proto.handleKeyDown = function handleKeyDown(event2) {
  89375. if (keycode.isEventKey(event2, "Left") || keycode.isEventKey(event2, "Down")) {
  89376. event2.preventDefault();
  89377. event2.stopPropagation();
  89378. this.stepBack();
  89379. } else if (keycode.isEventKey(event2, "Right") || keycode.isEventKey(event2, "Up")) {
  89380. event2.preventDefault();
  89381. event2.stopPropagation();
  89382. this.stepForward();
  89383. } else {
  89384. _Component.prototype.handleKeyDown.call(this, event2);
  89385. }
  89386. };
  89387. _proto.handleClick = function handleClick(event2) {
  89388. event2.stopPropagation();
  89389. event2.preventDefault();
  89390. };
  89391. _proto.vertical = function vertical(bool) {
  89392. if (bool === void 0) {
  89393. return this.vertical_ || false;
  89394. }
  89395. this.vertical_ = !!bool;
  89396. if (this.vertical_) {
  89397. this.addClass("vjs-slider-vertical");
  89398. } else {
  89399. this.addClass("vjs-slider-horizontal");
  89400. }
  89401. };
  89402. return Slider2;
  89403. }(Component$1);
  89404. Component$1.registerComponent("Slider", Slider);
  89405. var percentify = function percentify2(time, end) {
  89406. return clamp(time / end * 100, 0, 100).toFixed(2) + "%";
  89407. };
  89408. var LoadProgressBar = /* @__PURE__ */ function(_Component) {
  89409. _inheritsLoose(LoadProgressBar2, _Component);
  89410. function LoadProgressBar2(player, options2) {
  89411. var _this;
  89412. _this = _Component.call(this, player, options2) || this;
  89413. _this.partEls_ = [];
  89414. _this.on(player, "progress", function(e) {
  89415. return _this.update(e);
  89416. });
  89417. return _this;
  89418. }
  89419. var _proto = LoadProgressBar2.prototype;
  89420. _proto.createEl = function createEl$12() {
  89421. var el = _Component.prototype.createEl.call(this, "div", {
  89422. className: "vjs-load-progress"
  89423. });
  89424. var wrapper = createEl("span", {
  89425. className: "vjs-control-text"
  89426. });
  89427. var loadedText = createEl("span", {
  89428. textContent: this.localize("Loaded")
  89429. });
  89430. var separator = document_1.createTextNode(": ");
  89431. this.percentageEl_ = createEl("span", {
  89432. className: "vjs-control-text-loaded-percentage",
  89433. textContent: "0%"
  89434. });
  89435. el.appendChild(wrapper);
  89436. wrapper.appendChild(loadedText);
  89437. wrapper.appendChild(separator);
  89438. wrapper.appendChild(this.percentageEl_);
  89439. return el;
  89440. };
  89441. _proto.dispose = function dispose() {
  89442. this.partEls_ = null;
  89443. this.percentageEl_ = null;
  89444. _Component.prototype.dispose.call(this);
  89445. };
  89446. _proto.update = function update(event2) {
  89447. var _this2 = this;
  89448. this.requestNamedAnimationFrame("LoadProgressBar#update", function() {
  89449. var liveTracker = _this2.player_.liveTracker;
  89450. var buffered = _this2.player_.buffered();
  89451. var duration5 = liveTracker && liveTracker.isLive() ? liveTracker.seekableEnd() : _this2.player_.duration();
  89452. var bufferedEnd = _this2.player_.bufferedEnd();
  89453. var children = _this2.partEls_;
  89454. var percent = percentify(bufferedEnd, duration5);
  89455. if (_this2.percent_ !== percent) {
  89456. _this2.el_.style.width = percent;
  89457. textContent(_this2.percentageEl_, percent);
  89458. _this2.percent_ = percent;
  89459. }
  89460. for (var i2 = 0; i2 < buffered.length; i2++) {
  89461. var start2 = buffered.start(i2);
  89462. var end = buffered.end(i2);
  89463. var part = children[i2];
  89464. if (!part) {
  89465. part = _this2.el_.appendChild(createEl());
  89466. children[i2] = part;
  89467. }
  89468. if (part.dataset.start === start2 && part.dataset.end === end) {
  89469. continue;
  89470. }
  89471. part.dataset.start = start2;
  89472. part.dataset.end = end;
  89473. part.style.left = percentify(start2, bufferedEnd);
  89474. part.style.width = percentify(end - start2, bufferedEnd);
  89475. }
  89476. for (var _i = children.length; _i > buffered.length; _i--) {
  89477. _this2.el_.removeChild(children[_i - 1]);
  89478. }
  89479. children.length = buffered.length;
  89480. });
  89481. };
  89482. return LoadProgressBar2;
  89483. }(Component$1);
  89484. Component$1.registerComponent("LoadProgressBar", LoadProgressBar);
  89485. var TimeTooltip = /* @__PURE__ */ function(_Component) {
  89486. _inheritsLoose(TimeTooltip2, _Component);
  89487. function TimeTooltip2(player, options2) {
  89488. var _this;
  89489. _this = _Component.call(this, player, options2) || this;
  89490. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  89491. return _this;
  89492. }
  89493. var _proto = TimeTooltip2.prototype;
  89494. _proto.createEl = function createEl2() {
  89495. return _Component.prototype.createEl.call(this, "div", {
  89496. className: "vjs-time-tooltip"
  89497. }, {
  89498. "aria-hidden": "true"
  89499. });
  89500. };
  89501. _proto.update = function update(seekBarRect, seekBarPoint, content) {
  89502. var tooltipRect = findPosition(this.el_);
  89503. var playerRect = getBoundingClientRect(this.player_.el());
  89504. var seekBarPointPx = seekBarRect.width * seekBarPoint;
  89505. if (!playerRect || !tooltipRect) {
  89506. return;
  89507. }
  89508. var spaceLeftOfPoint = seekBarRect.left - playerRect.left + seekBarPointPx;
  89509. var spaceRightOfPoint = seekBarRect.width - seekBarPointPx + (playerRect.right - seekBarRect.right);
  89510. var pullTooltipBy = tooltipRect.width / 2;
  89511. if (spaceLeftOfPoint < pullTooltipBy) {
  89512. pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;
  89513. } else if (spaceRightOfPoint < pullTooltipBy) {
  89514. pullTooltipBy = spaceRightOfPoint;
  89515. }
  89516. if (pullTooltipBy < 0) {
  89517. pullTooltipBy = 0;
  89518. } else if (pullTooltipBy > tooltipRect.width) {
  89519. pullTooltipBy = tooltipRect.width;
  89520. }
  89521. pullTooltipBy = Math.round(pullTooltipBy);
  89522. this.el_.style.right = "-" + pullTooltipBy + "px";
  89523. this.write(content);
  89524. };
  89525. _proto.write = function write(content) {
  89526. textContent(this.el_, content);
  89527. };
  89528. _proto.updateTime = function updateTime(seekBarRect, seekBarPoint, time, cb) {
  89529. var _this2 = this;
  89530. this.requestNamedAnimationFrame("TimeTooltip#updateTime", function() {
  89531. var content;
  89532. var duration5 = _this2.player_.duration();
  89533. if (_this2.player_.liveTracker && _this2.player_.liveTracker.isLive()) {
  89534. var liveWindow = _this2.player_.liveTracker.liveWindow();
  89535. var secondsBehind = liveWindow - seekBarPoint * liveWindow;
  89536. content = (secondsBehind < 1 ? "" : "-") + formatTime(secondsBehind, liveWindow);
  89537. } else {
  89538. content = formatTime(time, duration5);
  89539. }
  89540. _this2.update(seekBarRect, seekBarPoint, content);
  89541. if (cb) {
  89542. cb();
  89543. }
  89544. });
  89545. };
  89546. return TimeTooltip2;
  89547. }(Component$1);
  89548. Component$1.registerComponent("TimeTooltip", TimeTooltip);
  89549. var PlayProgressBar = /* @__PURE__ */ function(_Component) {
  89550. _inheritsLoose(PlayProgressBar2, _Component);
  89551. function PlayProgressBar2(player, options2) {
  89552. var _this;
  89553. _this = _Component.call(this, player, options2) || this;
  89554. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  89555. return _this;
  89556. }
  89557. var _proto = PlayProgressBar2.prototype;
  89558. _proto.createEl = function createEl2() {
  89559. return _Component.prototype.createEl.call(this, "div", {
  89560. className: "vjs-play-progress vjs-slider-bar"
  89561. }, {
  89562. "aria-hidden": "true"
  89563. });
  89564. };
  89565. _proto.update = function update(seekBarRect, seekBarPoint) {
  89566. var timeTooltip = this.getChild("timeTooltip");
  89567. if (!timeTooltip) {
  89568. return;
  89569. }
  89570. var time = this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  89571. timeTooltip.updateTime(seekBarRect, seekBarPoint, time);
  89572. };
  89573. return PlayProgressBar2;
  89574. }(Component$1);
  89575. PlayProgressBar.prototype.options_ = {
  89576. children: []
  89577. };
  89578. if (!IS_IOS && !IS_ANDROID) {
  89579. PlayProgressBar.prototype.options_.children.push("timeTooltip");
  89580. }
  89581. Component$1.registerComponent("PlayProgressBar", PlayProgressBar);
  89582. var MouseTimeDisplay = /* @__PURE__ */ function(_Component) {
  89583. _inheritsLoose(MouseTimeDisplay2, _Component);
  89584. function MouseTimeDisplay2(player, options2) {
  89585. var _this;
  89586. _this = _Component.call(this, player, options2) || this;
  89587. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  89588. return _this;
  89589. }
  89590. var _proto = MouseTimeDisplay2.prototype;
  89591. _proto.createEl = function createEl2() {
  89592. return _Component.prototype.createEl.call(this, "div", {
  89593. className: "vjs-mouse-display"
  89594. });
  89595. };
  89596. _proto.update = function update(seekBarRect, seekBarPoint) {
  89597. var _this2 = this;
  89598. var time = seekBarPoint * this.player_.duration();
  89599. this.getChild("timeTooltip").updateTime(seekBarRect, seekBarPoint, time, function() {
  89600. _this2.el_.style.left = seekBarRect.width * seekBarPoint + "px";
  89601. });
  89602. };
  89603. return MouseTimeDisplay2;
  89604. }(Component$1);
  89605. MouseTimeDisplay.prototype.options_ = {
  89606. children: ["timeTooltip"]
  89607. };
  89608. Component$1.registerComponent("MouseTimeDisplay", MouseTimeDisplay);
  89609. var STEP_SECONDS = 5;
  89610. var PAGE_KEY_MULTIPLIER = 12;
  89611. var SeekBar = /* @__PURE__ */ function(_Slider) {
  89612. _inheritsLoose(SeekBar2, _Slider);
  89613. function SeekBar2(player, options2) {
  89614. var _this;
  89615. _this = _Slider.call(this, player, options2) || this;
  89616. _this.setEventHandlers_();
  89617. return _this;
  89618. }
  89619. var _proto = SeekBar2.prototype;
  89620. _proto.setEventHandlers_ = function setEventHandlers_() {
  89621. var _this2 = this;
  89622. this.update_ = bind(this, this.update);
  89623. this.update = throttle(this.update_, UPDATE_REFRESH_INTERVAL);
  89624. this.on(this.player_, ["ended", "durationchange", "timeupdate"], this.update);
  89625. if (this.player_.liveTracker) {
  89626. this.on(this.player_.liveTracker, "liveedgechange", this.update);
  89627. }
  89628. this.updateInterval = null;
  89629. this.enableIntervalHandler_ = function(e) {
  89630. return _this2.enableInterval_(e);
  89631. };
  89632. this.disableIntervalHandler_ = function(e) {
  89633. return _this2.disableInterval_(e);
  89634. };
  89635. this.on(this.player_, ["playing"], this.enableIntervalHandler_);
  89636. this.on(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_);
  89637. if ("hidden" in document_1 && "visibilityState" in document_1) {
  89638. this.on(document_1, "visibilitychange", this.toggleVisibility_);
  89639. }
  89640. };
  89641. _proto.toggleVisibility_ = function toggleVisibility_(e) {
  89642. if (document_1.visibilityState === "hidden") {
  89643. this.cancelNamedAnimationFrame("SeekBar#update");
  89644. this.cancelNamedAnimationFrame("Slider#update");
  89645. this.disableInterval_(e);
  89646. } else {
  89647. if (!this.player_.ended() && !this.player_.paused()) {
  89648. this.enableInterval_();
  89649. }
  89650. this.update();
  89651. }
  89652. };
  89653. _proto.enableInterval_ = function enableInterval_() {
  89654. if (this.updateInterval) {
  89655. return;
  89656. }
  89657. this.updateInterval = this.setInterval(this.update, UPDATE_REFRESH_INTERVAL);
  89658. };
  89659. _proto.disableInterval_ = function disableInterval_(e) {
  89660. if (this.player_.liveTracker && this.player_.liveTracker.isLive() && e && e.type !== "ended") {
  89661. return;
  89662. }
  89663. if (!this.updateInterval) {
  89664. return;
  89665. }
  89666. this.clearInterval(this.updateInterval);
  89667. this.updateInterval = null;
  89668. };
  89669. _proto.createEl = function createEl2() {
  89670. return _Slider.prototype.createEl.call(this, "div", {
  89671. className: "vjs-progress-holder"
  89672. }, {
  89673. "aria-label": this.localize("Progress Bar")
  89674. });
  89675. };
  89676. _proto.update = function update(event2) {
  89677. var _this3 = this;
  89678. if (document_1.visibilityState === "hidden") {
  89679. return;
  89680. }
  89681. var percent = _Slider.prototype.update.call(this);
  89682. this.requestNamedAnimationFrame("SeekBar#update", function() {
  89683. var currentTime = _this3.player_.ended() ? _this3.player_.duration() : _this3.getCurrentTime_();
  89684. var liveTracker = _this3.player_.liveTracker;
  89685. var duration5 = _this3.player_.duration();
  89686. if (liveTracker && liveTracker.isLive()) {
  89687. duration5 = _this3.player_.liveTracker.liveCurrentTime();
  89688. }
  89689. if (_this3.percent_ !== percent) {
  89690. _this3.el_.setAttribute("aria-valuenow", (percent * 100).toFixed(2));
  89691. _this3.percent_ = percent;
  89692. }
  89693. if (_this3.currentTime_ !== currentTime || _this3.duration_ !== duration5) {
  89694. _this3.el_.setAttribute("aria-valuetext", _this3.localize("progress bar timing: currentTime={1} duration={2}", [formatTime(currentTime, duration5), formatTime(duration5, duration5)], "{1} of {2}"));
  89695. _this3.currentTime_ = currentTime;
  89696. _this3.duration_ = duration5;
  89697. }
  89698. if (_this3.bar) {
  89699. _this3.bar.update(getBoundingClientRect(_this3.el()), _this3.getProgress());
  89700. }
  89701. });
  89702. return percent;
  89703. };
  89704. _proto.userSeek_ = function userSeek_(ct2) {
  89705. if (this.player_.liveTracker && this.player_.liveTracker.isLive()) {
  89706. this.player_.liveTracker.nextSeekedFromUser();
  89707. }
  89708. this.player_.currentTime(ct2);
  89709. };
  89710. _proto.getCurrentTime_ = function getCurrentTime_() {
  89711. return this.player_.scrubbing() ? this.player_.getCache().currentTime : this.player_.currentTime();
  89712. };
  89713. _proto.getPercent = function getPercent() {
  89714. var currentTime = this.getCurrentTime_();
  89715. var percent;
  89716. var liveTracker = this.player_.liveTracker;
  89717. if (liveTracker && liveTracker.isLive()) {
  89718. percent = (currentTime - liveTracker.seekableStart()) / liveTracker.liveWindow();
  89719. if (liveTracker.atLiveEdge()) {
  89720. percent = 1;
  89721. }
  89722. } else {
  89723. percent = currentTime / this.player_.duration();
  89724. }
  89725. return percent;
  89726. };
  89727. _proto.handleMouseDown = function handleMouseDown(event2) {
  89728. if (!isSingleLeftClick(event2)) {
  89729. return;
  89730. }
  89731. event2.stopPropagation();
  89732. this.videoWasPlaying = !this.player_.paused();
  89733. this.player_.pause();
  89734. _Slider.prototype.handleMouseDown.call(this, event2);
  89735. };
  89736. _proto.handleMouseMove = function handleMouseMove(event2, mouseDown) {
  89737. if (mouseDown === void 0) {
  89738. mouseDown = false;
  89739. }
  89740. if (!isSingleLeftClick(event2)) {
  89741. return;
  89742. }
  89743. if (!mouseDown && !this.player_.scrubbing()) {
  89744. this.player_.scrubbing(true);
  89745. }
  89746. var newTime;
  89747. var distance2 = this.calculateDistance(event2);
  89748. var liveTracker = this.player_.liveTracker;
  89749. if (!liveTracker || !liveTracker.isLive()) {
  89750. newTime = distance2 * this.player_.duration();
  89751. if (newTime === this.player_.duration()) {
  89752. newTime = newTime - 0.1;
  89753. }
  89754. } else {
  89755. if (distance2 >= 0.99) {
  89756. liveTracker.seekToLiveEdge();
  89757. return;
  89758. }
  89759. var seekableStart = liveTracker.seekableStart();
  89760. var seekableEnd = liveTracker.liveCurrentTime();
  89761. newTime = seekableStart + distance2 * liveTracker.liveWindow();
  89762. if (newTime >= seekableEnd) {
  89763. newTime = seekableEnd;
  89764. }
  89765. if (newTime <= seekableStart) {
  89766. newTime = seekableStart + 0.1;
  89767. }
  89768. if (newTime === Infinity) {
  89769. return;
  89770. }
  89771. }
  89772. this.userSeek_(newTime);
  89773. };
  89774. _proto.enable = function enable() {
  89775. _Slider.prototype.enable.call(this);
  89776. var mouseTimeDisplay = this.getChild("mouseTimeDisplay");
  89777. if (!mouseTimeDisplay) {
  89778. return;
  89779. }
  89780. mouseTimeDisplay.show();
  89781. };
  89782. _proto.disable = function disable() {
  89783. _Slider.prototype.disable.call(this);
  89784. var mouseTimeDisplay = this.getChild("mouseTimeDisplay");
  89785. if (!mouseTimeDisplay) {
  89786. return;
  89787. }
  89788. mouseTimeDisplay.hide();
  89789. };
  89790. _proto.handleMouseUp = function handleMouseUp(event2) {
  89791. _Slider.prototype.handleMouseUp.call(this, event2);
  89792. if (event2) {
  89793. event2.stopPropagation();
  89794. }
  89795. this.player_.scrubbing(false);
  89796. this.player_.trigger({
  89797. type: "timeupdate",
  89798. target: this,
  89799. manuallyTriggered: true
  89800. });
  89801. if (this.videoWasPlaying) {
  89802. silencePromise(this.player_.play());
  89803. } else {
  89804. this.update_();
  89805. }
  89806. };
  89807. _proto.stepForward = function stepForward() {
  89808. this.userSeek_(this.player_.currentTime() + STEP_SECONDS);
  89809. };
  89810. _proto.stepBack = function stepBack() {
  89811. this.userSeek_(this.player_.currentTime() - STEP_SECONDS);
  89812. };
  89813. _proto.handleAction = function handleAction(event2) {
  89814. if (this.player_.paused()) {
  89815. this.player_.play();
  89816. } else {
  89817. this.player_.pause();
  89818. }
  89819. };
  89820. _proto.handleKeyDown = function handleKeyDown(event2) {
  89821. var liveTracker = this.player_.liveTracker;
  89822. if (keycode.isEventKey(event2, "Space") || keycode.isEventKey(event2, "Enter")) {
  89823. event2.preventDefault();
  89824. event2.stopPropagation();
  89825. this.handleAction(event2);
  89826. } else if (keycode.isEventKey(event2, "Home")) {
  89827. event2.preventDefault();
  89828. event2.stopPropagation();
  89829. this.userSeek_(0);
  89830. } else if (keycode.isEventKey(event2, "End")) {
  89831. event2.preventDefault();
  89832. event2.stopPropagation();
  89833. if (liveTracker && liveTracker.isLive()) {
  89834. this.userSeek_(liveTracker.liveCurrentTime());
  89835. } else {
  89836. this.userSeek_(this.player_.duration());
  89837. }
  89838. } else if (/^[0-9]$/.test(keycode(event2))) {
  89839. event2.preventDefault();
  89840. event2.stopPropagation();
  89841. var gotoFraction = (keycode.codes[keycode(event2)] - keycode.codes["0"]) * 10 / 100;
  89842. if (liveTracker && liveTracker.isLive()) {
  89843. this.userSeek_(liveTracker.seekableStart() + liveTracker.liveWindow() * gotoFraction);
  89844. } else {
  89845. this.userSeek_(this.player_.duration() * gotoFraction);
  89846. }
  89847. } else if (keycode.isEventKey(event2, "PgDn")) {
  89848. event2.preventDefault();
  89849. event2.stopPropagation();
  89850. this.userSeek_(this.player_.currentTime() - STEP_SECONDS * PAGE_KEY_MULTIPLIER);
  89851. } else if (keycode.isEventKey(event2, "PgUp")) {
  89852. event2.preventDefault();
  89853. event2.stopPropagation();
  89854. this.userSeek_(this.player_.currentTime() + STEP_SECONDS * PAGE_KEY_MULTIPLIER);
  89855. } else {
  89856. _Slider.prototype.handleKeyDown.call(this, event2);
  89857. }
  89858. };
  89859. _proto.dispose = function dispose() {
  89860. this.disableInterval_();
  89861. this.off(this.player_, ["ended", "durationchange", "timeupdate"], this.update);
  89862. if (this.player_.liveTracker) {
  89863. this.off(this.player_.liveTracker, "liveedgechange", this.update);
  89864. }
  89865. this.off(this.player_, ["playing"], this.enableIntervalHandler_);
  89866. this.off(this.player_, ["ended", "pause", "waiting"], this.disableIntervalHandler_);
  89867. if ("hidden" in document_1 && "visibilityState" in document_1) {
  89868. this.off(document_1, "visibilitychange", this.toggleVisibility_);
  89869. }
  89870. _Slider.prototype.dispose.call(this);
  89871. };
  89872. return SeekBar2;
  89873. }(Slider);
  89874. SeekBar.prototype.options_ = {
  89875. children: ["loadProgressBar", "playProgressBar"],
  89876. barName: "playProgressBar"
  89877. };
  89878. if (!IS_IOS && !IS_ANDROID) {
  89879. SeekBar.prototype.options_.children.splice(1, 0, "mouseTimeDisplay");
  89880. }
  89881. Component$1.registerComponent("SeekBar", SeekBar);
  89882. var ProgressControl = /* @__PURE__ */ function(_Component) {
  89883. _inheritsLoose(ProgressControl2, _Component);
  89884. function ProgressControl2(player, options2) {
  89885. var _this;
  89886. _this = _Component.call(this, player, options2) || this;
  89887. _this.handleMouseMove = throttle(bind(_assertThisInitialized(_this), _this.handleMouseMove), UPDATE_REFRESH_INTERVAL);
  89888. _this.throttledHandleMouseSeek = throttle(bind(_assertThisInitialized(_this), _this.handleMouseSeek), UPDATE_REFRESH_INTERVAL);
  89889. _this.handleMouseUpHandler_ = function(e) {
  89890. return _this.handleMouseUp(e);
  89891. };
  89892. _this.handleMouseDownHandler_ = function(e) {
  89893. return _this.handleMouseDown(e);
  89894. };
  89895. _this.enable();
  89896. return _this;
  89897. }
  89898. var _proto = ProgressControl2.prototype;
  89899. _proto.createEl = function createEl2() {
  89900. return _Component.prototype.createEl.call(this, "div", {
  89901. className: "vjs-progress-control vjs-control"
  89902. });
  89903. };
  89904. _proto.handleMouseMove = function handleMouseMove(event2) {
  89905. var seekBar = this.getChild("seekBar");
  89906. if (!seekBar) {
  89907. return;
  89908. }
  89909. var playProgressBar = seekBar.getChild("playProgressBar");
  89910. var mouseTimeDisplay = seekBar.getChild("mouseTimeDisplay");
  89911. if (!playProgressBar && !mouseTimeDisplay) {
  89912. return;
  89913. }
  89914. var seekBarEl = seekBar.el();
  89915. var seekBarRect = findPosition(seekBarEl);
  89916. var seekBarPoint = getPointerPosition(seekBarEl, event2).x;
  89917. seekBarPoint = clamp(seekBarPoint, 0, 1);
  89918. if (mouseTimeDisplay) {
  89919. mouseTimeDisplay.update(seekBarRect, seekBarPoint);
  89920. }
  89921. if (playProgressBar) {
  89922. playProgressBar.update(seekBarRect, seekBar.getProgress());
  89923. }
  89924. };
  89925. _proto.handleMouseSeek = function handleMouseSeek(event2) {
  89926. var seekBar = this.getChild("seekBar");
  89927. if (seekBar) {
  89928. seekBar.handleMouseMove(event2);
  89929. }
  89930. };
  89931. _proto.enabled = function enabled() {
  89932. return this.enabled_;
  89933. };
  89934. _proto.disable = function disable() {
  89935. this.children().forEach(function(child) {
  89936. return child.disable && child.disable();
  89937. });
  89938. if (!this.enabled()) {
  89939. return;
  89940. }
  89941. this.off(["mousedown", "touchstart"], this.handleMouseDownHandler_);
  89942. this.off(this.el_, "mousemove", this.handleMouseMove);
  89943. this.removeListenersAddedOnMousedownAndTouchstart();
  89944. this.addClass("disabled");
  89945. this.enabled_ = false;
  89946. if (this.player_.scrubbing()) {
  89947. var seekBar = this.getChild("seekBar");
  89948. this.player_.scrubbing(false);
  89949. if (seekBar.videoWasPlaying) {
  89950. silencePromise(this.player_.play());
  89951. }
  89952. }
  89953. };
  89954. _proto.enable = function enable() {
  89955. this.children().forEach(function(child) {
  89956. return child.enable && child.enable();
  89957. });
  89958. if (this.enabled()) {
  89959. return;
  89960. }
  89961. this.on(["mousedown", "touchstart"], this.handleMouseDownHandler_);
  89962. this.on(this.el_, "mousemove", this.handleMouseMove);
  89963. this.removeClass("disabled");
  89964. this.enabled_ = true;
  89965. };
  89966. _proto.removeListenersAddedOnMousedownAndTouchstart = function removeListenersAddedOnMousedownAndTouchstart() {
  89967. var doc = this.el_.ownerDocument;
  89968. this.off(doc, "mousemove", this.throttledHandleMouseSeek);
  89969. this.off(doc, "touchmove", this.throttledHandleMouseSeek);
  89970. this.off(doc, "mouseup", this.handleMouseUpHandler_);
  89971. this.off(doc, "touchend", this.handleMouseUpHandler_);
  89972. };
  89973. _proto.handleMouseDown = function handleMouseDown(event2) {
  89974. var doc = this.el_.ownerDocument;
  89975. var seekBar = this.getChild("seekBar");
  89976. if (seekBar) {
  89977. seekBar.handleMouseDown(event2);
  89978. }
  89979. this.on(doc, "mousemove", this.throttledHandleMouseSeek);
  89980. this.on(doc, "touchmove", this.throttledHandleMouseSeek);
  89981. this.on(doc, "mouseup", this.handleMouseUpHandler_);
  89982. this.on(doc, "touchend", this.handleMouseUpHandler_);
  89983. };
  89984. _proto.handleMouseUp = function handleMouseUp(event2) {
  89985. var seekBar = this.getChild("seekBar");
  89986. if (seekBar) {
  89987. seekBar.handleMouseUp(event2);
  89988. }
  89989. this.removeListenersAddedOnMousedownAndTouchstart();
  89990. };
  89991. return ProgressControl2;
  89992. }(Component$1);
  89993. ProgressControl.prototype.options_ = {
  89994. children: ["seekBar"]
  89995. };
  89996. Component$1.registerComponent("ProgressControl", ProgressControl);
  89997. var PictureInPictureToggle = /* @__PURE__ */ function(_Button) {
  89998. _inheritsLoose(PictureInPictureToggle2, _Button);
  89999. function PictureInPictureToggle2(player, options2) {
  90000. var _this;
  90001. _this = _Button.call(this, player, options2) || this;
  90002. _this.on(player, ["enterpictureinpicture", "leavepictureinpicture"], function(e) {
  90003. return _this.handlePictureInPictureChange(e);
  90004. });
  90005. _this.on(player, ["disablepictureinpicturechanged", "loadedmetadata"], function(e) {
  90006. return _this.handlePictureInPictureEnabledChange(e);
  90007. });
  90008. _this.on(player, ["loadedmetadata", "audioonlymodechange", "audiopostermodechange"], function() {
  90009. var isSourceAudio = player.currentType().substring(0, 5) === "audio";
  90010. if (isSourceAudio || player.audioPosterMode() || player.audioOnlyMode()) {
  90011. if (player.isInPictureInPicture()) {
  90012. player.exitPictureInPicture();
  90013. }
  90014. _this.hide();
  90015. } else {
  90016. _this.show();
  90017. }
  90018. });
  90019. _this.disable();
  90020. return _this;
  90021. }
  90022. var _proto = PictureInPictureToggle2.prototype;
  90023. _proto.buildCSSClass = function buildCSSClass() {
  90024. return "vjs-picture-in-picture-control " + _Button.prototype.buildCSSClass.call(this);
  90025. };
  90026. _proto.handlePictureInPictureEnabledChange = function handlePictureInPictureEnabledChange() {
  90027. if (document_1.pictureInPictureEnabled && this.player_.disablePictureInPicture() === false) {
  90028. this.enable();
  90029. } else {
  90030. this.disable();
  90031. }
  90032. };
  90033. _proto.handlePictureInPictureChange = function handlePictureInPictureChange(event2) {
  90034. if (this.player_.isInPictureInPicture()) {
  90035. this.controlText("Exit Picture-in-Picture");
  90036. } else {
  90037. this.controlText("Picture-in-Picture");
  90038. }
  90039. this.handlePictureInPictureEnabledChange();
  90040. };
  90041. _proto.handleClick = function handleClick(event2) {
  90042. if (!this.player_.isInPictureInPicture()) {
  90043. this.player_.requestPictureInPicture();
  90044. } else {
  90045. this.player_.exitPictureInPicture();
  90046. }
  90047. };
  90048. return PictureInPictureToggle2;
  90049. }(Button);
  90050. PictureInPictureToggle.prototype.controlText_ = "Picture-in-Picture";
  90051. Component$1.registerComponent("PictureInPictureToggle", PictureInPictureToggle);
  90052. var FullscreenToggle = /* @__PURE__ */ function(_Button) {
  90053. _inheritsLoose(FullscreenToggle2, _Button);
  90054. function FullscreenToggle2(player, options2) {
  90055. var _this;
  90056. _this = _Button.call(this, player, options2) || this;
  90057. _this.on(player, "fullscreenchange", function(e) {
  90058. return _this.handleFullscreenChange(e);
  90059. });
  90060. if (document_1[player.fsApi_.fullscreenEnabled] === false) {
  90061. _this.disable();
  90062. }
  90063. return _this;
  90064. }
  90065. var _proto = FullscreenToggle2.prototype;
  90066. _proto.buildCSSClass = function buildCSSClass() {
  90067. return "vjs-fullscreen-control " + _Button.prototype.buildCSSClass.call(this);
  90068. };
  90069. _proto.handleFullscreenChange = function handleFullscreenChange(event2) {
  90070. if (this.player_.isFullscreen()) {
  90071. this.controlText("Non-Fullscreen");
  90072. } else {
  90073. this.controlText("Fullscreen");
  90074. }
  90075. };
  90076. _proto.handleClick = function handleClick(event2) {
  90077. if (!this.player_.isFullscreen()) {
  90078. this.player_.requestFullscreen();
  90079. } else {
  90080. this.player_.exitFullscreen();
  90081. }
  90082. };
  90083. return FullscreenToggle2;
  90084. }(Button);
  90085. FullscreenToggle.prototype.controlText_ = "Fullscreen";
  90086. Component$1.registerComponent("FullscreenToggle", FullscreenToggle);
  90087. var checkVolumeSupport = function checkVolumeSupport2(self2, player) {
  90088. if (player.tech_ && !player.tech_.featuresVolumeControl) {
  90089. self2.addClass("vjs-hidden");
  90090. }
  90091. self2.on(player, "loadstart", function() {
  90092. if (!player.tech_.featuresVolumeControl) {
  90093. self2.addClass("vjs-hidden");
  90094. } else {
  90095. self2.removeClass("vjs-hidden");
  90096. }
  90097. });
  90098. };
  90099. var VolumeLevel = /* @__PURE__ */ function(_Component) {
  90100. _inheritsLoose(VolumeLevel2, _Component);
  90101. function VolumeLevel2() {
  90102. return _Component.apply(this, arguments) || this;
  90103. }
  90104. var _proto = VolumeLevel2.prototype;
  90105. _proto.createEl = function createEl2() {
  90106. var el = _Component.prototype.createEl.call(this, "div", {
  90107. className: "vjs-volume-level"
  90108. });
  90109. el.appendChild(_Component.prototype.createEl.call(this, "span", {
  90110. className: "vjs-control-text"
  90111. }));
  90112. return el;
  90113. };
  90114. return VolumeLevel2;
  90115. }(Component$1);
  90116. Component$1.registerComponent("VolumeLevel", VolumeLevel);
  90117. var VolumeLevelTooltip = /* @__PURE__ */ function(_Component) {
  90118. _inheritsLoose(VolumeLevelTooltip2, _Component);
  90119. function VolumeLevelTooltip2(player, options2) {
  90120. var _this;
  90121. _this = _Component.call(this, player, options2) || this;
  90122. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  90123. return _this;
  90124. }
  90125. var _proto = VolumeLevelTooltip2.prototype;
  90126. _proto.createEl = function createEl2() {
  90127. return _Component.prototype.createEl.call(this, "div", {
  90128. className: "vjs-volume-tooltip"
  90129. }, {
  90130. "aria-hidden": "true"
  90131. });
  90132. };
  90133. _proto.update = function update(rangeBarRect, rangeBarPoint, vertical, content) {
  90134. if (!vertical) {
  90135. var tooltipRect = getBoundingClientRect(this.el_);
  90136. var playerRect = getBoundingClientRect(this.player_.el());
  90137. var volumeBarPointPx = rangeBarRect.width * rangeBarPoint;
  90138. if (!playerRect || !tooltipRect) {
  90139. return;
  90140. }
  90141. var spaceLeftOfPoint = rangeBarRect.left - playerRect.left + volumeBarPointPx;
  90142. var spaceRightOfPoint = rangeBarRect.width - volumeBarPointPx + (playerRect.right - rangeBarRect.right);
  90143. var pullTooltipBy = tooltipRect.width / 2;
  90144. if (spaceLeftOfPoint < pullTooltipBy) {
  90145. pullTooltipBy += pullTooltipBy - spaceLeftOfPoint;
  90146. } else if (spaceRightOfPoint < pullTooltipBy) {
  90147. pullTooltipBy = spaceRightOfPoint;
  90148. }
  90149. if (pullTooltipBy < 0) {
  90150. pullTooltipBy = 0;
  90151. } else if (pullTooltipBy > tooltipRect.width) {
  90152. pullTooltipBy = tooltipRect.width;
  90153. }
  90154. this.el_.style.right = "-" + pullTooltipBy + "px";
  90155. }
  90156. this.write(content + "%");
  90157. };
  90158. _proto.write = function write(content) {
  90159. textContent(this.el_, content);
  90160. };
  90161. _proto.updateVolume = function updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, cb) {
  90162. var _this2 = this;
  90163. this.requestNamedAnimationFrame("VolumeLevelTooltip#updateVolume", function() {
  90164. _this2.update(rangeBarRect, rangeBarPoint, vertical, volume.toFixed(0));
  90165. if (cb) {
  90166. cb();
  90167. }
  90168. });
  90169. };
  90170. return VolumeLevelTooltip2;
  90171. }(Component$1);
  90172. Component$1.registerComponent("VolumeLevelTooltip", VolumeLevelTooltip);
  90173. var MouseVolumeLevelDisplay = /* @__PURE__ */ function(_Component) {
  90174. _inheritsLoose(MouseVolumeLevelDisplay2, _Component);
  90175. function MouseVolumeLevelDisplay2(player, options2) {
  90176. var _this;
  90177. _this = _Component.call(this, player, options2) || this;
  90178. _this.update = throttle(bind(_assertThisInitialized(_this), _this.update), UPDATE_REFRESH_INTERVAL);
  90179. return _this;
  90180. }
  90181. var _proto = MouseVolumeLevelDisplay2.prototype;
  90182. _proto.createEl = function createEl2() {
  90183. return _Component.prototype.createEl.call(this, "div", {
  90184. className: "vjs-mouse-display"
  90185. });
  90186. };
  90187. _proto.update = function update(rangeBarRect, rangeBarPoint, vertical) {
  90188. var _this2 = this;
  90189. var volume = 100 * rangeBarPoint;
  90190. this.getChild("volumeLevelTooltip").updateVolume(rangeBarRect, rangeBarPoint, vertical, volume, function() {
  90191. if (vertical) {
  90192. _this2.el_.style.bottom = rangeBarRect.height * rangeBarPoint + "px";
  90193. } else {
  90194. _this2.el_.style.left = rangeBarRect.width * rangeBarPoint + "px";
  90195. }
  90196. });
  90197. };
  90198. return MouseVolumeLevelDisplay2;
  90199. }(Component$1);
  90200. MouseVolumeLevelDisplay.prototype.options_ = {
  90201. children: ["volumeLevelTooltip"]
  90202. };
  90203. Component$1.registerComponent("MouseVolumeLevelDisplay", MouseVolumeLevelDisplay);
  90204. var VolumeBar = /* @__PURE__ */ function(_Slider) {
  90205. _inheritsLoose(VolumeBar2, _Slider);
  90206. function VolumeBar2(player, options2) {
  90207. var _this;
  90208. _this = _Slider.call(this, player, options2) || this;
  90209. _this.on("slideractive", function(e) {
  90210. return _this.updateLastVolume_(e);
  90211. });
  90212. _this.on(player, "volumechange", function(e) {
  90213. return _this.updateARIAAttributes(e);
  90214. });
  90215. player.ready(function() {
  90216. return _this.updateARIAAttributes();
  90217. });
  90218. return _this;
  90219. }
  90220. var _proto = VolumeBar2.prototype;
  90221. _proto.createEl = function createEl2() {
  90222. return _Slider.prototype.createEl.call(this, "div", {
  90223. className: "vjs-volume-bar vjs-slider-bar"
  90224. }, {
  90225. "aria-label": this.localize("Volume Level"),
  90226. "aria-live": "polite"
  90227. });
  90228. };
  90229. _proto.handleMouseDown = function handleMouseDown(event2) {
  90230. if (!isSingleLeftClick(event2)) {
  90231. return;
  90232. }
  90233. _Slider.prototype.handleMouseDown.call(this, event2);
  90234. };
  90235. _proto.handleMouseMove = function handleMouseMove(event2) {
  90236. var mouseVolumeLevelDisplay = this.getChild("mouseVolumeLevelDisplay");
  90237. if (mouseVolumeLevelDisplay) {
  90238. var volumeBarEl = this.el();
  90239. var volumeBarRect = getBoundingClientRect(volumeBarEl);
  90240. var vertical = this.vertical();
  90241. var volumeBarPoint = getPointerPosition(volumeBarEl, event2);
  90242. volumeBarPoint = vertical ? volumeBarPoint.y : volumeBarPoint.x;
  90243. volumeBarPoint = clamp(volumeBarPoint, 0, 1);
  90244. mouseVolumeLevelDisplay.update(volumeBarRect, volumeBarPoint, vertical);
  90245. }
  90246. if (!isSingleLeftClick(event2)) {
  90247. return;
  90248. }
  90249. this.checkMuted();
  90250. this.player_.volume(this.calculateDistance(event2));
  90251. };
  90252. _proto.checkMuted = function checkMuted() {
  90253. if (this.player_.muted()) {
  90254. this.player_.muted(false);
  90255. }
  90256. };
  90257. _proto.getPercent = function getPercent() {
  90258. if (this.player_.muted()) {
  90259. return 0;
  90260. }
  90261. return this.player_.volume();
  90262. };
  90263. _proto.stepForward = function stepForward() {
  90264. this.checkMuted();
  90265. this.player_.volume(this.player_.volume() + 0.1);
  90266. };
  90267. _proto.stepBack = function stepBack() {
  90268. this.checkMuted();
  90269. this.player_.volume(this.player_.volume() - 0.1);
  90270. };
  90271. _proto.updateARIAAttributes = function updateARIAAttributes(event2) {
  90272. var ariaValue = this.player_.muted() ? 0 : this.volumeAsPercentage_();
  90273. this.el_.setAttribute("aria-valuenow", ariaValue);
  90274. this.el_.setAttribute("aria-valuetext", ariaValue + "%");
  90275. };
  90276. _proto.volumeAsPercentage_ = function volumeAsPercentage_() {
  90277. return Math.round(this.player_.volume() * 100);
  90278. };
  90279. _proto.updateLastVolume_ = function updateLastVolume_() {
  90280. var _this2 = this;
  90281. var volumeBeforeDrag = this.player_.volume();
  90282. this.one("sliderinactive", function() {
  90283. if (_this2.player_.volume() === 0) {
  90284. _this2.player_.lastVolume_(volumeBeforeDrag);
  90285. }
  90286. });
  90287. };
  90288. return VolumeBar2;
  90289. }(Slider);
  90290. VolumeBar.prototype.options_ = {
  90291. children: ["volumeLevel"],
  90292. barName: "volumeLevel"
  90293. };
  90294. if (!IS_IOS && !IS_ANDROID) {
  90295. VolumeBar.prototype.options_.children.splice(0, 0, "mouseVolumeLevelDisplay");
  90296. }
  90297. VolumeBar.prototype.playerEvent = "volumechange";
  90298. Component$1.registerComponent("VolumeBar", VolumeBar);
  90299. var VolumeControl = /* @__PURE__ */ function(_Component) {
  90300. _inheritsLoose(VolumeControl2, _Component);
  90301. function VolumeControl2(player, options2) {
  90302. var _this;
  90303. if (options2 === void 0) {
  90304. options2 = {};
  90305. }
  90306. options2.vertical = options2.vertical || false;
  90307. if (typeof options2.volumeBar === "undefined" || isPlain(options2.volumeBar)) {
  90308. options2.volumeBar = options2.volumeBar || {};
  90309. options2.volumeBar.vertical = options2.vertical;
  90310. }
  90311. _this = _Component.call(this, player, options2) || this;
  90312. checkVolumeSupport(_assertThisInitialized(_this), player);
  90313. _this.throttledHandleMouseMove = throttle(bind(_assertThisInitialized(_this), _this.handleMouseMove), UPDATE_REFRESH_INTERVAL);
  90314. _this.handleMouseUpHandler_ = function(e) {
  90315. return _this.handleMouseUp(e);
  90316. };
  90317. _this.on("mousedown", function(e) {
  90318. return _this.handleMouseDown(e);
  90319. });
  90320. _this.on("touchstart", function(e) {
  90321. return _this.handleMouseDown(e);
  90322. });
  90323. _this.on("mousemove", function(e) {
  90324. return _this.handleMouseMove(e);
  90325. });
  90326. _this.on(_this.volumeBar, ["focus", "slideractive"], function() {
  90327. _this.volumeBar.addClass("vjs-slider-active");
  90328. _this.addClass("vjs-slider-active");
  90329. _this.trigger("slideractive");
  90330. });
  90331. _this.on(_this.volumeBar, ["blur", "sliderinactive"], function() {
  90332. _this.volumeBar.removeClass("vjs-slider-active");
  90333. _this.removeClass("vjs-slider-active");
  90334. _this.trigger("sliderinactive");
  90335. });
  90336. return _this;
  90337. }
  90338. var _proto = VolumeControl2.prototype;
  90339. _proto.createEl = function createEl2() {
  90340. var orientationClass = "vjs-volume-horizontal";
  90341. if (this.options_.vertical) {
  90342. orientationClass = "vjs-volume-vertical";
  90343. }
  90344. return _Component.prototype.createEl.call(this, "div", {
  90345. className: "vjs-volume-control vjs-control " + orientationClass
  90346. });
  90347. };
  90348. _proto.handleMouseDown = function handleMouseDown(event2) {
  90349. var doc = this.el_.ownerDocument;
  90350. this.on(doc, "mousemove", this.throttledHandleMouseMove);
  90351. this.on(doc, "touchmove", this.throttledHandleMouseMove);
  90352. this.on(doc, "mouseup", this.handleMouseUpHandler_);
  90353. this.on(doc, "touchend", this.handleMouseUpHandler_);
  90354. };
  90355. _proto.handleMouseUp = function handleMouseUp(event2) {
  90356. var doc = this.el_.ownerDocument;
  90357. this.off(doc, "mousemove", this.throttledHandleMouseMove);
  90358. this.off(doc, "touchmove", this.throttledHandleMouseMove);
  90359. this.off(doc, "mouseup", this.handleMouseUpHandler_);
  90360. this.off(doc, "touchend", this.handleMouseUpHandler_);
  90361. };
  90362. _proto.handleMouseMove = function handleMouseMove(event2) {
  90363. this.volumeBar.handleMouseMove(event2);
  90364. };
  90365. return VolumeControl2;
  90366. }(Component$1);
  90367. VolumeControl.prototype.options_ = {
  90368. children: ["volumeBar"]
  90369. };
  90370. Component$1.registerComponent("VolumeControl", VolumeControl);
  90371. var checkMuteSupport = function checkMuteSupport2(self2, player) {
  90372. if (player.tech_ && !player.tech_.featuresMuteControl) {
  90373. self2.addClass("vjs-hidden");
  90374. }
  90375. self2.on(player, "loadstart", function() {
  90376. if (!player.tech_.featuresMuteControl) {
  90377. self2.addClass("vjs-hidden");
  90378. } else {
  90379. self2.removeClass("vjs-hidden");
  90380. }
  90381. });
  90382. };
  90383. var MuteToggle = /* @__PURE__ */ function(_Button) {
  90384. _inheritsLoose(MuteToggle2, _Button);
  90385. function MuteToggle2(player, options2) {
  90386. var _this;
  90387. _this = _Button.call(this, player, options2) || this;
  90388. checkMuteSupport(_assertThisInitialized(_this), player);
  90389. _this.on(player, ["loadstart", "volumechange"], function(e) {
  90390. return _this.update(e);
  90391. });
  90392. return _this;
  90393. }
  90394. var _proto = MuteToggle2.prototype;
  90395. _proto.buildCSSClass = function buildCSSClass() {
  90396. return "vjs-mute-control " + _Button.prototype.buildCSSClass.call(this);
  90397. };
  90398. _proto.handleClick = function handleClick(event2) {
  90399. var vol = this.player_.volume();
  90400. var lastVolume = this.player_.lastVolume_();
  90401. if (vol === 0) {
  90402. var volumeToSet = lastVolume < 0.1 ? 0.1 : lastVolume;
  90403. this.player_.volume(volumeToSet);
  90404. this.player_.muted(false);
  90405. } else {
  90406. this.player_.muted(this.player_.muted() ? false : true);
  90407. }
  90408. };
  90409. _proto.update = function update(event2) {
  90410. this.updateIcon_();
  90411. this.updateControlText_();
  90412. };
  90413. _proto.updateIcon_ = function updateIcon_() {
  90414. var vol = this.player_.volume();
  90415. var level = 3;
  90416. if (IS_IOS && this.player_.tech_ && this.player_.tech_.el_) {
  90417. this.player_.muted(this.player_.tech_.el_.muted);
  90418. }
  90419. if (vol === 0 || this.player_.muted()) {
  90420. level = 0;
  90421. } else if (vol < 0.33) {
  90422. level = 1;
  90423. } else if (vol < 0.67) {
  90424. level = 2;
  90425. }
  90426. for (var i2 = 0; i2 < 4; i2++) {
  90427. removeClass(this.el_, "vjs-vol-" + i2);
  90428. }
  90429. addClass(this.el_, "vjs-vol-" + level);
  90430. };
  90431. _proto.updateControlText_ = function updateControlText_() {
  90432. var soundOff = this.player_.muted() || this.player_.volume() === 0;
  90433. var text = soundOff ? "Unmute" : "Mute";
  90434. if (this.controlText() !== text) {
  90435. this.controlText(text);
  90436. }
  90437. };
  90438. return MuteToggle2;
  90439. }(Button);
  90440. MuteToggle.prototype.controlText_ = "Mute";
  90441. Component$1.registerComponent("MuteToggle", MuteToggle);
  90442. var VolumePanel = /* @__PURE__ */ function(_Component) {
  90443. _inheritsLoose(VolumePanel2, _Component);
  90444. function VolumePanel2(player, options2) {
  90445. var _this;
  90446. if (options2 === void 0) {
  90447. options2 = {};
  90448. }
  90449. if (typeof options2.inline !== "undefined") {
  90450. options2.inline = options2.inline;
  90451. } else {
  90452. options2.inline = true;
  90453. }
  90454. if (typeof options2.volumeControl === "undefined" || isPlain(options2.volumeControl)) {
  90455. options2.volumeControl = options2.volumeControl || {};
  90456. options2.volumeControl.vertical = !options2.inline;
  90457. }
  90458. _this = _Component.call(this, player, options2) || this;
  90459. _this.handleKeyPressHandler_ = function(e) {
  90460. return _this.handleKeyPress(e);
  90461. };
  90462. _this.on(player, ["loadstart"], function(e) {
  90463. return _this.volumePanelState_(e);
  90464. });
  90465. _this.on(_this.muteToggle, "keyup", function(e) {
  90466. return _this.handleKeyPress(e);
  90467. });
  90468. _this.on(_this.volumeControl, "keyup", function(e) {
  90469. return _this.handleVolumeControlKeyUp(e);
  90470. });
  90471. _this.on("keydown", function(e) {
  90472. return _this.handleKeyPress(e);
  90473. });
  90474. _this.on("mouseover", function(e) {
  90475. return _this.handleMouseOver(e);
  90476. });
  90477. _this.on("mouseout", function(e) {
  90478. return _this.handleMouseOut(e);
  90479. });
  90480. _this.on(_this.volumeControl, ["slideractive"], _this.sliderActive_);
  90481. _this.on(_this.volumeControl, ["sliderinactive"], _this.sliderInactive_);
  90482. return _this;
  90483. }
  90484. var _proto = VolumePanel2.prototype;
  90485. _proto.sliderActive_ = function sliderActive_() {
  90486. this.addClass("vjs-slider-active");
  90487. };
  90488. _proto.sliderInactive_ = function sliderInactive_() {
  90489. this.removeClass("vjs-slider-active");
  90490. };
  90491. _proto.volumePanelState_ = function volumePanelState_() {
  90492. if (this.volumeControl.hasClass("vjs-hidden") && this.muteToggle.hasClass("vjs-hidden")) {
  90493. this.addClass("vjs-hidden");
  90494. }
  90495. if (this.volumeControl.hasClass("vjs-hidden") && !this.muteToggle.hasClass("vjs-hidden")) {
  90496. this.addClass("vjs-mute-toggle-only");
  90497. }
  90498. };
  90499. _proto.createEl = function createEl2() {
  90500. var orientationClass = "vjs-volume-panel-horizontal";
  90501. if (!this.options_.inline) {
  90502. orientationClass = "vjs-volume-panel-vertical";
  90503. }
  90504. return _Component.prototype.createEl.call(this, "div", {
  90505. className: "vjs-volume-panel vjs-control " + orientationClass
  90506. });
  90507. };
  90508. _proto.dispose = function dispose() {
  90509. this.handleMouseOut();
  90510. _Component.prototype.dispose.call(this);
  90511. };
  90512. _proto.handleVolumeControlKeyUp = function handleVolumeControlKeyUp(event2) {
  90513. if (keycode.isEventKey(event2, "Esc")) {
  90514. this.muteToggle.focus();
  90515. }
  90516. };
  90517. _proto.handleMouseOver = function handleMouseOver(event2) {
  90518. this.addClass("vjs-hover");
  90519. on(document_1, "keyup", this.handleKeyPressHandler_);
  90520. };
  90521. _proto.handleMouseOut = function handleMouseOut(event2) {
  90522. this.removeClass("vjs-hover");
  90523. off(document_1, "keyup", this.handleKeyPressHandler_);
  90524. };
  90525. _proto.handleKeyPress = function handleKeyPress(event2) {
  90526. if (keycode.isEventKey(event2, "Esc")) {
  90527. this.handleMouseOut();
  90528. }
  90529. };
  90530. return VolumePanel2;
  90531. }(Component$1);
  90532. VolumePanel.prototype.options_ = {
  90533. children: ["muteToggle", "volumeControl"]
  90534. };
  90535. Component$1.registerComponent("VolumePanel", VolumePanel);
  90536. var Menu = /* @__PURE__ */ function(_Component) {
  90537. _inheritsLoose(Menu2, _Component);
  90538. function Menu2(player, options2) {
  90539. var _this;
  90540. _this = _Component.call(this, player, options2) || this;
  90541. if (options2) {
  90542. _this.menuButton_ = options2.menuButton;
  90543. }
  90544. _this.focusedChild_ = -1;
  90545. _this.on("keydown", function(e) {
  90546. return _this.handleKeyDown(e);
  90547. });
  90548. _this.boundHandleBlur_ = function(e) {
  90549. return _this.handleBlur(e);
  90550. };
  90551. _this.boundHandleTapClick_ = function(e) {
  90552. return _this.handleTapClick(e);
  90553. };
  90554. return _this;
  90555. }
  90556. var _proto = Menu2.prototype;
  90557. _proto.addEventListenerForItem = function addEventListenerForItem(component) {
  90558. if (!(component instanceof Component$1)) {
  90559. return;
  90560. }
  90561. this.on(component, "blur", this.boundHandleBlur_);
  90562. this.on(component, ["tap", "click"], this.boundHandleTapClick_);
  90563. };
  90564. _proto.removeEventListenerForItem = function removeEventListenerForItem(component) {
  90565. if (!(component instanceof Component$1)) {
  90566. return;
  90567. }
  90568. this.off(component, "blur", this.boundHandleBlur_);
  90569. this.off(component, ["tap", "click"], this.boundHandleTapClick_);
  90570. };
  90571. _proto.removeChild = function removeChild(component) {
  90572. if (typeof component === "string") {
  90573. component = this.getChild(component);
  90574. }
  90575. this.removeEventListenerForItem(component);
  90576. _Component.prototype.removeChild.call(this, component);
  90577. };
  90578. _proto.addItem = function addItem(component) {
  90579. var childComponent = this.addChild(component);
  90580. if (childComponent) {
  90581. this.addEventListenerForItem(childComponent);
  90582. }
  90583. };
  90584. _proto.createEl = function createEl$12() {
  90585. var contentElType = this.options_.contentElType || "ul";
  90586. this.contentEl_ = createEl(contentElType, {
  90587. className: "vjs-menu-content"
  90588. });
  90589. this.contentEl_.setAttribute("role", "menu");
  90590. var el = _Component.prototype.createEl.call(this, "div", {
  90591. append: this.contentEl_,
  90592. className: "vjs-menu"
  90593. });
  90594. el.appendChild(this.contentEl_);
  90595. on(el, "click", function(event2) {
  90596. event2.preventDefault();
  90597. event2.stopImmediatePropagation();
  90598. });
  90599. return el;
  90600. };
  90601. _proto.dispose = function dispose() {
  90602. this.contentEl_ = null;
  90603. this.boundHandleBlur_ = null;
  90604. this.boundHandleTapClick_ = null;
  90605. _Component.prototype.dispose.call(this);
  90606. };
  90607. _proto.handleBlur = function handleBlur(event2) {
  90608. var relatedTarget = event2.relatedTarget || document_1.activeElement;
  90609. if (!this.children().some(function(element) {
  90610. return element.el() === relatedTarget;
  90611. })) {
  90612. var btn = this.menuButton_;
  90613. if (btn && btn.buttonPressed_ && relatedTarget !== btn.el().firstChild) {
  90614. btn.unpressButton();
  90615. }
  90616. }
  90617. };
  90618. _proto.handleTapClick = function handleTapClick(event2) {
  90619. if (this.menuButton_) {
  90620. this.menuButton_.unpressButton();
  90621. var childComponents = this.children();
  90622. if (!Array.isArray(childComponents)) {
  90623. return;
  90624. }
  90625. var foundComponent = childComponents.filter(function(component) {
  90626. return component.el() === event2.target;
  90627. })[0];
  90628. if (!foundComponent) {
  90629. return;
  90630. }
  90631. if (foundComponent.name() !== "CaptionSettingsMenuItem") {
  90632. this.menuButton_.focus();
  90633. }
  90634. }
  90635. };
  90636. _proto.handleKeyDown = function handleKeyDown(event2) {
  90637. if (keycode.isEventKey(event2, "Left") || keycode.isEventKey(event2, "Down")) {
  90638. event2.preventDefault();
  90639. event2.stopPropagation();
  90640. this.stepForward();
  90641. } else if (keycode.isEventKey(event2, "Right") || keycode.isEventKey(event2, "Up")) {
  90642. event2.preventDefault();
  90643. event2.stopPropagation();
  90644. this.stepBack();
  90645. }
  90646. };
  90647. _proto.stepForward = function stepForward() {
  90648. var stepChild = 0;
  90649. if (this.focusedChild_ !== void 0) {
  90650. stepChild = this.focusedChild_ + 1;
  90651. }
  90652. this.focus(stepChild);
  90653. };
  90654. _proto.stepBack = function stepBack() {
  90655. var stepChild = 0;
  90656. if (this.focusedChild_ !== void 0) {
  90657. stepChild = this.focusedChild_ - 1;
  90658. }
  90659. this.focus(stepChild);
  90660. };
  90661. _proto.focus = function focus(item) {
  90662. if (item === void 0) {
  90663. item = 0;
  90664. }
  90665. var children = this.children().slice();
  90666. var haveTitle = children.length && children[0].hasClass("vjs-menu-title");
  90667. if (haveTitle) {
  90668. children.shift();
  90669. }
  90670. if (children.length > 0) {
  90671. if (item < 0) {
  90672. item = 0;
  90673. } else if (item >= children.length) {
  90674. item = children.length - 1;
  90675. }
  90676. this.focusedChild_ = item;
  90677. children[item].el_.focus();
  90678. }
  90679. };
  90680. return Menu2;
  90681. }(Component$1);
  90682. Component$1.registerComponent("Menu", Menu);
  90683. var MenuButton = /* @__PURE__ */ function(_Component) {
  90684. _inheritsLoose(MenuButton2, _Component);
  90685. function MenuButton2(player, options2) {
  90686. var _this;
  90687. if (options2 === void 0) {
  90688. options2 = {};
  90689. }
  90690. _this = _Component.call(this, player, options2) || this;
  90691. _this.menuButton_ = new Button(player, options2);
  90692. _this.menuButton_.controlText(_this.controlText_);
  90693. _this.menuButton_.el_.setAttribute("aria-haspopup", "true");
  90694. var buttonClass = Button.prototype.buildCSSClass();
  90695. _this.menuButton_.el_.className = _this.buildCSSClass() + " " + buttonClass;
  90696. _this.menuButton_.removeClass("vjs-control");
  90697. _this.addChild(_this.menuButton_);
  90698. _this.update();
  90699. _this.enabled_ = true;
  90700. var handleClick = function handleClick2(e) {
  90701. return _this.handleClick(e);
  90702. };
  90703. _this.handleMenuKeyUp_ = function(e) {
  90704. return _this.handleMenuKeyUp(e);
  90705. };
  90706. _this.on(_this.menuButton_, "tap", handleClick);
  90707. _this.on(_this.menuButton_, "click", handleClick);
  90708. _this.on(_this.menuButton_, "keydown", function(e) {
  90709. return _this.handleKeyDown(e);
  90710. });
  90711. _this.on(_this.menuButton_, "mouseenter", function() {
  90712. _this.addClass("vjs-hover");
  90713. _this.menu.show();
  90714. on(document_1, "keyup", _this.handleMenuKeyUp_);
  90715. });
  90716. _this.on("mouseleave", function(e) {
  90717. return _this.handleMouseLeave(e);
  90718. });
  90719. _this.on("keydown", function(e) {
  90720. return _this.handleSubmenuKeyDown(e);
  90721. });
  90722. return _this;
  90723. }
  90724. var _proto = MenuButton2.prototype;
  90725. _proto.update = function update() {
  90726. var menu = this.createMenu();
  90727. if (this.menu) {
  90728. this.menu.dispose();
  90729. this.removeChild(this.menu);
  90730. }
  90731. this.menu = menu;
  90732. this.addChild(menu);
  90733. this.buttonPressed_ = false;
  90734. this.menuButton_.el_.setAttribute("aria-expanded", "false");
  90735. if (this.items && this.items.length <= this.hideThreshold_) {
  90736. this.hide();
  90737. this.menu.contentEl_.removeAttribute("role");
  90738. } else {
  90739. this.show();
  90740. this.menu.contentEl_.setAttribute("role", "menu");
  90741. }
  90742. };
  90743. _proto.createMenu = function createMenu() {
  90744. var menu = new Menu(this.player_, {
  90745. menuButton: this
  90746. });
  90747. this.hideThreshold_ = 0;
  90748. if (this.options_.title) {
  90749. var titleEl = createEl("li", {
  90750. className: "vjs-menu-title",
  90751. textContent: toTitleCase$1(this.options_.title),
  90752. tabIndex: -1
  90753. });
  90754. var titleComponent = new Component$1(this.player_, {
  90755. el: titleEl
  90756. });
  90757. menu.addItem(titleComponent);
  90758. }
  90759. this.items = this.createItems();
  90760. if (this.items) {
  90761. for (var i2 = 0; i2 < this.items.length; i2++) {
  90762. menu.addItem(this.items[i2]);
  90763. }
  90764. }
  90765. return menu;
  90766. };
  90767. _proto.createItems = function createItems() {
  90768. };
  90769. _proto.createEl = function createEl2() {
  90770. return _Component.prototype.createEl.call(this, "div", {
  90771. className: this.buildWrapperCSSClass()
  90772. }, {});
  90773. };
  90774. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  90775. var menuButtonClass = "vjs-menu-button";
  90776. if (this.options_.inline === true) {
  90777. menuButtonClass += "-inline";
  90778. } else {
  90779. menuButtonClass += "-popup";
  90780. }
  90781. var buttonClass = Button.prototype.buildCSSClass();
  90782. return "vjs-menu-button " + menuButtonClass + " " + buttonClass + " " + _Component.prototype.buildCSSClass.call(this);
  90783. };
  90784. _proto.buildCSSClass = function buildCSSClass() {
  90785. var menuButtonClass = "vjs-menu-button";
  90786. if (this.options_.inline === true) {
  90787. menuButtonClass += "-inline";
  90788. } else {
  90789. menuButtonClass += "-popup";
  90790. }
  90791. return "vjs-menu-button " + menuButtonClass + " " + _Component.prototype.buildCSSClass.call(this);
  90792. };
  90793. _proto.controlText = function controlText(text, el) {
  90794. if (el === void 0) {
  90795. el = this.menuButton_.el();
  90796. }
  90797. return this.menuButton_.controlText(text, el);
  90798. };
  90799. _proto.dispose = function dispose() {
  90800. this.handleMouseLeave();
  90801. _Component.prototype.dispose.call(this);
  90802. };
  90803. _proto.handleClick = function handleClick(event2) {
  90804. if (this.buttonPressed_) {
  90805. this.unpressButton();
  90806. } else {
  90807. this.pressButton();
  90808. }
  90809. };
  90810. _proto.handleMouseLeave = function handleMouseLeave(event2) {
  90811. this.removeClass("vjs-hover");
  90812. off(document_1, "keyup", this.handleMenuKeyUp_);
  90813. };
  90814. _proto.focus = function focus() {
  90815. this.menuButton_.focus();
  90816. };
  90817. _proto.blur = function blur() {
  90818. this.menuButton_.blur();
  90819. };
  90820. _proto.handleKeyDown = function handleKeyDown(event2) {
  90821. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  90822. if (this.buttonPressed_) {
  90823. this.unpressButton();
  90824. }
  90825. if (!keycode.isEventKey(event2, "Tab")) {
  90826. event2.preventDefault();
  90827. this.menuButton_.focus();
  90828. }
  90829. } else if (keycode.isEventKey(event2, "Up") || keycode.isEventKey(event2, "Down")) {
  90830. if (!this.buttonPressed_) {
  90831. event2.preventDefault();
  90832. this.pressButton();
  90833. }
  90834. }
  90835. };
  90836. _proto.handleMenuKeyUp = function handleMenuKeyUp(event2) {
  90837. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  90838. this.removeClass("vjs-hover");
  90839. }
  90840. };
  90841. _proto.handleSubmenuKeyPress = function handleSubmenuKeyPress(event2) {
  90842. this.handleSubmenuKeyDown(event2);
  90843. };
  90844. _proto.handleSubmenuKeyDown = function handleSubmenuKeyDown(event2) {
  90845. if (keycode.isEventKey(event2, "Esc") || keycode.isEventKey(event2, "Tab")) {
  90846. if (this.buttonPressed_) {
  90847. this.unpressButton();
  90848. }
  90849. if (!keycode.isEventKey(event2, "Tab")) {
  90850. event2.preventDefault();
  90851. this.menuButton_.focus();
  90852. }
  90853. }
  90854. };
  90855. _proto.pressButton = function pressButton() {
  90856. if (this.enabled_) {
  90857. this.buttonPressed_ = true;
  90858. this.menu.show();
  90859. this.menu.lockShowing();
  90860. this.menuButton_.el_.setAttribute("aria-expanded", "true");
  90861. if (IS_IOS && isInFrame()) {
  90862. return;
  90863. }
  90864. this.menu.focus();
  90865. }
  90866. };
  90867. _proto.unpressButton = function unpressButton() {
  90868. if (this.enabled_) {
  90869. this.buttonPressed_ = false;
  90870. this.menu.unlockShowing();
  90871. this.menu.hide();
  90872. this.menuButton_.el_.setAttribute("aria-expanded", "false");
  90873. }
  90874. };
  90875. _proto.disable = function disable() {
  90876. this.unpressButton();
  90877. this.enabled_ = false;
  90878. this.addClass("vjs-disabled");
  90879. this.menuButton_.disable();
  90880. };
  90881. _proto.enable = function enable() {
  90882. this.enabled_ = true;
  90883. this.removeClass("vjs-disabled");
  90884. this.menuButton_.enable();
  90885. };
  90886. return MenuButton2;
  90887. }(Component$1);
  90888. Component$1.registerComponent("MenuButton", MenuButton);
  90889. var TrackButton = /* @__PURE__ */ function(_MenuButton) {
  90890. _inheritsLoose(TrackButton2, _MenuButton);
  90891. function TrackButton2(player, options2) {
  90892. var _this;
  90893. var tracks = options2.tracks;
  90894. _this = _MenuButton.call(this, player, options2) || this;
  90895. if (_this.items.length <= 1) {
  90896. _this.hide();
  90897. }
  90898. if (!tracks) {
  90899. return _assertThisInitialized(_this);
  90900. }
  90901. var updateHandler = bind(_assertThisInitialized(_this), _this.update);
  90902. tracks.addEventListener("removetrack", updateHandler);
  90903. tracks.addEventListener("addtrack", updateHandler);
  90904. tracks.addEventListener("labelchange", updateHandler);
  90905. _this.player_.on("ready", updateHandler);
  90906. _this.player_.on("dispose", function() {
  90907. tracks.removeEventListener("removetrack", updateHandler);
  90908. tracks.removeEventListener("addtrack", updateHandler);
  90909. tracks.removeEventListener("labelchange", updateHandler);
  90910. });
  90911. return _this;
  90912. }
  90913. return TrackButton2;
  90914. }(MenuButton);
  90915. Component$1.registerComponent("TrackButton", TrackButton);
  90916. var MenuKeys = ["Tab", "Esc", "Up", "Down", "Right", "Left"];
  90917. var MenuItem = /* @__PURE__ */ function(_ClickableComponent) {
  90918. _inheritsLoose(MenuItem2, _ClickableComponent);
  90919. function MenuItem2(player, options2) {
  90920. var _this;
  90921. _this = _ClickableComponent.call(this, player, options2) || this;
  90922. _this.selectable = options2.selectable;
  90923. _this.isSelected_ = options2.selected || false;
  90924. _this.multiSelectable = options2.multiSelectable;
  90925. _this.selected(_this.isSelected_);
  90926. if (_this.selectable) {
  90927. if (_this.multiSelectable) {
  90928. _this.el_.setAttribute("role", "menuitemcheckbox");
  90929. } else {
  90930. _this.el_.setAttribute("role", "menuitemradio");
  90931. }
  90932. } else {
  90933. _this.el_.setAttribute("role", "menuitem");
  90934. }
  90935. return _this;
  90936. }
  90937. var _proto = MenuItem2.prototype;
  90938. _proto.createEl = function createEl$12(type2, props, attrs) {
  90939. this.nonIconControl = true;
  90940. var el = _ClickableComponent.prototype.createEl.call(this, "li", assign({
  90941. className: "vjs-menu-item",
  90942. tabIndex: -1
  90943. }, props), attrs);
  90944. el.replaceChild(createEl("span", {
  90945. className: "vjs-menu-item-text",
  90946. textContent: this.localize(this.options_.label)
  90947. }), el.querySelector(".vjs-icon-placeholder"));
  90948. return el;
  90949. };
  90950. _proto.handleKeyDown = function handleKeyDown(event2) {
  90951. if (!MenuKeys.some(function(key) {
  90952. return keycode.isEventKey(event2, key);
  90953. })) {
  90954. _ClickableComponent.prototype.handleKeyDown.call(this, event2);
  90955. }
  90956. };
  90957. _proto.handleClick = function handleClick(event2) {
  90958. this.selected(true);
  90959. };
  90960. _proto.selected = function selected(_selected) {
  90961. if (this.selectable) {
  90962. if (_selected) {
  90963. this.addClass("vjs-selected");
  90964. this.el_.setAttribute("aria-checked", "true");
  90965. this.controlText(", selected");
  90966. this.isSelected_ = true;
  90967. } else {
  90968. this.removeClass("vjs-selected");
  90969. this.el_.setAttribute("aria-checked", "false");
  90970. this.controlText("");
  90971. this.isSelected_ = false;
  90972. }
  90973. }
  90974. };
  90975. return MenuItem2;
  90976. }(ClickableComponent);
  90977. Component$1.registerComponent("MenuItem", MenuItem);
  90978. var TextTrackMenuItem = /* @__PURE__ */ function(_MenuItem) {
  90979. _inheritsLoose(TextTrackMenuItem2, _MenuItem);
  90980. function TextTrackMenuItem2(player, options2) {
  90981. var _this;
  90982. var track = options2.track;
  90983. var tracks = player.textTracks();
  90984. options2.label = track.label || track.language || "Unknown";
  90985. options2.selected = track.mode === "showing";
  90986. _this = _MenuItem.call(this, player, options2) || this;
  90987. _this.track = track;
  90988. _this.kinds = (options2.kinds || [options2.kind || _this.track.kind]).filter(Boolean);
  90989. var changeHandler = function changeHandler2() {
  90990. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  90991. args[_key] = arguments[_key];
  90992. }
  90993. _this.handleTracksChange.apply(_assertThisInitialized(_this), args);
  90994. };
  90995. var selectedLanguageChangeHandler = function selectedLanguageChangeHandler2() {
  90996. for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
  90997. args[_key2] = arguments[_key2];
  90998. }
  90999. _this.handleSelectedLanguageChange.apply(_assertThisInitialized(_this), args);
  91000. };
  91001. player.on(["loadstart", "texttrackchange"], changeHandler);
  91002. tracks.addEventListener("change", changeHandler);
  91003. tracks.addEventListener("selectedlanguagechange", selectedLanguageChangeHandler);
  91004. _this.on("dispose", function() {
  91005. player.off(["loadstart", "texttrackchange"], changeHandler);
  91006. tracks.removeEventListener("change", changeHandler);
  91007. tracks.removeEventListener("selectedlanguagechange", selectedLanguageChangeHandler);
  91008. });
  91009. if (tracks.onchange === void 0) {
  91010. var event2;
  91011. _this.on(["tap", "click"], function() {
  91012. if (typeof window_1.Event !== "object") {
  91013. try {
  91014. event2 = new window_1.Event("change");
  91015. } catch (err) {
  91016. }
  91017. }
  91018. if (!event2) {
  91019. event2 = document_1.createEvent("Event");
  91020. event2.initEvent("change", true, true);
  91021. }
  91022. tracks.dispatchEvent(event2);
  91023. });
  91024. }
  91025. _this.handleTracksChange();
  91026. return _this;
  91027. }
  91028. var _proto = TextTrackMenuItem2.prototype;
  91029. _proto.handleClick = function handleClick(event2) {
  91030. var referenceTrack = this.track;
  91031. var tracks = this.player_.textTracks();
  91032. _MenuItem.prototype.handleClick.call(this, event2);
  91033. if (!tracks) {
  91034. return;
  91035. }
  91036. for (var i2 = 0; i2 < tracks.length; i2++) {
  91037. var track = tracks[i2];
  91038. if (this.kinds.indexOf(track.kind) === -1) {
  91039. continue;
  91040. }
  91041. if (track === referenceTrack) {
  91042. if (track.mode !== "showing") {
  91043. track.mode = "showing";
  91044. }
  91045. } else if (track.mode !== "disabled") {
  91046. track.mode = "disabled";
  91047. }
  91048. }
  91049. };
  91050. _proto.handleTracksChange = function handleTracksChange(event2) {
  91051. var shouldBeSelected = this.track.mode === "showing";
  91052. if (shouldBeSelected !== this.isSelected_) {
  91053. this.selected(shouldBeSelected);
  91054. }
  91055. };
  91056. _proto.handleSelectedLanguageChange = function handleSelectedLanguageChange(event2) {
  91057. if (this.track.mode === "showing") {
  91058. var selectedLanguage = this.player_.cache_.selectedLanguage;
  91059. if (selectedLanguage && selectedLanguage.enabled && selectedLanguage.language === this.track.language && selectedLanguage.kind !== this.track.kind) {
  91060. return;
  91061. }
  91062. this.player_.cache_.selectedLanguage = {
  91063. enabled: true,
  91064. language: this.track.language,
  91065. kind: this.track.kind
  91066. };
  91067. }
  91068. };
  91069. _proto.dispose = function dispose() {
  91070. this.track = null;
  91071. _MenuItem.prototype.dispose.call(this);
  91072. };
  91073. return TextTrackMenuItem2;
  91074. }(MenuItem);
  91075. Component$1.registerComponent("TextTrackMenuItem", TextTrackMenuItem);
  91076. var OffTextTrackMenuItem = /* @__PURE__ */ function(_TextTrackMenuItem) {
  91077. _inheritsLoose(OffTextTrackMenuItem2, _TextTrackMenuItem);
  91078. function OffTextTrackMenuItem2(player, options2) {
  91079. options2.track = {
  91080. player,
  91081. kind: options2.kind,
  91082. kinds: options2.kinds,
  91083. "default": false,
  91084. mode: "disabled"
  91085. };
  91086. if (!options2.kinds) {
  91087. options2.kinds = [options2.kind];
  91088. }
  91089. if (options2.label) {
  91090. options2.track.label = options2.label;
  91091. } else {
  91092. options2.track.label = options2.kinds.join(" and ") + " off";
  91093. }
  91094. options2.selectable = true;
  91095. options2.multiSelectable = false;
  91096. return _TextTrackMenuItem.call(this, player, options2) || this;
  91097. }
  91098. var _proto = OffTextTrackMenuItem2.prototype;
  91099. _proto.handleTracksChange = function handleTracksChange(event2) {
  91100. var tracks = this.player().textTracks();
  91101. var shouldBeSelected = true;
  91102. for (var i2 = 0, l = tracks.length; i2 < l; i2++) {
  91103. var track = tracks[i2];
  91104. if (this.options_.kinds.indexOf(track.kind) > -1 && track.mode === "showing") {
  91105. shouldBeSelected = false;
  91106. break;
  91107. }
  91108. }
  91109. if (shouldBeSelected !== this.isSelected_) {
  91110. this.selected(shouldBeSelected);
  91111. }
  91112. };
  91113. _proto.handleSelectedLanguageChange = function handleSelectedLanguageChange(event2) {
  91114. var tracks = this.player().textTracks();
  91115. var allHidden = true;
  91116. for (var i2 = 0, l = tracks.length; i2 < l; i2++) {
  91117. var track = tracks[i2];
  91118. if (["captions", "descriptions", "subtitles"].indexOf(track.kind) > -1 && track.mode === "showing") {
  91119. allHidden = false;
  91120. break;
  91121. }
  91122. }
  91123. if (allHidden) {
  91124. this.player_.cache_.selectedLanguage = {
  91125. enabled: false
  91126. };
  91127. }
  91128. };
  91129. return OffTextTrackMenuItem2;
  91130. }(TextTrackMenuItem);
  91131. Component$1.registerComponent("OffTextTrackMenuItem", OffTextTrackMenuItem);
  91132. var TextTrackButton = /* @__PURE__ */ function(_TrackButton) {
  91133. _inheritsLoose(TextTrackButton2, _TrackButton);
  91134. function TextTrackButton2(player, options2) {
  91135. if (options2 === void 0) {
  91136. options2 = {};
  91137. }
  91138. options2.tracks = player.textTracks();
  91139. return _TrackButton.call(this, player, options2) || this;
  91140. }
  91141. var _proto = TextTrackButton2.prototype;
  91142. _proto.createItems = function createItems(items, TrackMenuItem) {
  91143. if (items === void 0) {
  91144. items = [];
  91145. }
  91146. if (TrackMenuItem === void 0) {
  91147. TrackMenuItem = TextTrackMenuItem;
  91148. }
  91149. var label;
  91150. if (this.label_) {
  91151. label = this.label_ + " off";
  91152. }
  91153. items.push(new OffTextTrackMenuItem(this.player_, {
  91154. kinds: this.kinds_,
  91155. kind: this.kind_,
  91156. label
  91157. }));
  91158. this.hideThreshold_ += 1;
  91159. var tracks = this.player_.textTracks();
  91160. if (!Array.isArray(this.kinds_)) {
  91161. this.kinds_ = [this.kind_];
  91162. }
  91163. for (var i2 = 0; i2 < tracks.length; i2++) {
  91164. var track = tracks[i2];
  91165. if (this.kinds_.indexOf(track.kind) > -1) {
  91166. var item = new TrackMenuItem(this.player_, {
  91167. track,
  91168. kinds: this.kinds_,
  91169. kind: this.kind_,
  91170. selectable: true,
  91171. multiSelectable: false
  91172. });
  91173. item.addClass("vjs-" + track.kind + "-menu-item");
  91174. items.push(item);
  91175. }
  91176. }
  91177. return items;
  91178. };
  91179. return TextTrackButton2;
  91180. }(TrackButton);
  91181. Component$1.registerComponent("TextTrackButton", TextTrackButton);
  91182. var ChaptersTrackMenuItem = /* @__PURE__ */ function(_MenuItem) {
  91183. _inheritsLoose(ChaptersTrackMenuItem2, _MenuItem);
  91184. function ChaptersTrackMenuItem2(player, options2) {
  91185. var _this;
  91186. var track = options2.track;
  91187. var cue = options2.cue;
  91188. var currentTime = player.currentTime();
  91189. options2.selectable = true;
  91190. options2.multiSelectable = false;
  91191. options2.label = cue.text;
  91192. options2.selected = cue.startTime <= currentTime && currentTime < cue.endTime;
  91193. _this = _MenuItem.call(this, player, options2) || this;
  91194. _this.track = track;
  91195. _this.cue = cue;
  91196. return _this;
  91197. }
  91198. var _proto = ChaptersTrackMenuItem2.prototype;
  91199. _proto.handleClick = function handleClick(event2) {
  91200. _MenuItem.prototype.handleClick.call(this);
  91201. this.player_.currentTime(this.cue.startTime);
  91202. };
  91203. return ChaptersTrackMenuItem2;
  91204. }(MenuItem);
  91205. Component$1.registerComponent("ChaptersTrackMenuItem", ChaptersTrackMenuItem);
  91206. var ChaptersButton = /* @__PURE__ */ function(_TextTrackButton) {
  91207. _inheritsLoose(ChaptersButton2, _TextTrackButton);
  91208. function ChaptersButton2(player, options2, ready) {
  91209. var _this;
  91210. _this = _TextTrackButton.call(this, player, options2, ready) || this;
  91211. _this.selectCurrentItem_ = function() {
  91212. _this.items.forEach(function(item) {
  91213. item.selected(_this.track_.activeCues[0] === item.cue);
  91214. });
  91215. };
  91216. return _this;
  91217. }
  91218. var _proto = ChaptersButton2.prototype;
  91219. _proto.buildCSSClass = function buildCSSClass() {
  91220. return "vjs-chapters-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91221. };
  91222. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91223. return "vjs-chapters-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91224. };
  91225. _proto.update = function update(event2) {
  91226. if (event2 && event2.track && event2.track.kind !== "chapters") {
  91227. return;
  91228. }
  91229. var track = this.findChaptersTrack();
  91230. if (track !== this.track_) {
  91231. this.setTrack(track);
  91232. _TextTrackButton.prototype.update.call(this);
  91233. } else if (!this.items || track && track.cues && track.cues.length !== this.items.length) {
  91234. _TextTrackButton.prototype.update.call(this);
  91235. }
  91236. };
  91237. _proto.setTrack = function setTrack(track) {
  91238. if (this.track_ === track) {
  91239. return;
  91240. }
  91241. if (!this.updateHandler_) {
  91242. this.updateHandler_ = this.update.bind(this);
  91243. }
  91244. if (this.track_) {
  91245. var remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  91246. if (remoteTextTrackEl) {
  91247. remoteTextTrackEl.removeEventListener("load", this.updateHandler_);
  91248. }
  91249. this.track_.removeEventListener("cuechange", this.selectCurrentItem_);
  91250. this.track_ = null;
  91251. }
  91252. this.track_ = track;
  91253. if (this.track_) {
  91254. this.track_.mode = "hidden";
  91255. var _remoteTextTrackEl = this.player_.remoteTextTrackEls().getTrackElementByTrack_(this.track_);
  91256. if (_remoteTextTrackEl) {
  91257. _remoteTextTrackEl.addEventListener("load", this.updateHandler_);
  91258. }
  91259. this.track_.addEventListener("cuechange", this.selectCurrentItem_);
  91260. }
  91261. };
  91262. _proto.findChaptersTrack = function findChaptersTrack() {
  91263. var tracks = this.player_.textTracks() || [];
  91264. for (var i2 = tracks.length - 1; i2 >= 0; i2--) {
  91265. var track = tracks[i2];
  91266. if (track.kind === this.kind_) {
  91267. return track;
  91268. }
  91269. }
  91270. };
  91271. _proto.getMenuCaption = function getMenuCaption() {
  91272. if (this.track_ && this.track_.label) {
  91273. return this.track_.label;
  91274. }
  91275. return this.localize(toTitleCase$1(this.kind_));
  91276. };
  91277. _proto.createMenu = function createMenu() {
  91278. this.options_.title = this.getMenuCaption();
  91279. return _TextTrackButton.prototype.createMenu.call(this);
  91280. };
  91281. _proto.createItems = function createItems() {
  91282. var items = [];
  91283. if (!this.track_) {
  91284. return items;
  91285. }
  91286. var cues = this.track_.cues;
  91287. if (!cues) {
  91288. return items;
  91289. }
  91290. for (var i2 = 0, l = cues.length; i2 < l; i2++) {
  91291. var cue = cues[i2];
  91292. var mi = new ChaptersTrackMenuItem(this.player_, {
  91293. track: this.track_,
  91294. cue
  91295. });
  91296. items.push(mi);
  91297. }
  91298. return items;
  91299. };
  91300. return ChaptersButton2;
  91301. }(TextTrackButton);
  91302. ChaptersButton.prototype.kind_ = "chapters";
  91303. ChaptersButton.prototype.controlText_ = "Chapters";
  91304. Component$1.registerComponent("ChaptersButton", ChaptersButton);
  91305. var DescriptionsButton = /* @__PURE__ */ function(_TextTrackButton) {
  91306. _inheritsLoose(DescriptionsButton2, _TextTrackButton);
  91307. function DescriptionsButton2(player, options2, ready) {
  91308. var _this;
  91309. _this = _TextTrackButton.call(this, player, options2, ready) || this;
  91310. var tracks = player.textTracks();
  91311. var changeHandler = bind(_assertThisInitialized(_this), _this.handleTracksChange);
  91312. tracks.addEventListener("change", changeHandler);
  91313. _this.on("dispose", function() {
  91314. tracks.removeEventListener("change", changeHandler);
  91315. });
  91316. return _this;
  91317. }
  91318. var _proto = DescriptionsButton2.prototype;
  91319. _proto.handleTracksChange = function handleTracksChange(event2) {
  91320. var tracks = this.player().textTracks();
  91321. var disabled = false;
  91322. for (var i2 = 0, l = tracks.length; i2 < l; i2++) {
  91323. var track = tracks[i2];
  91324. if (track.kind !== this.kind_ && track.mode === "showing") {
  91325. disabled = true;
  91326. break;
  91327. }
  91328. }
  91329. if (disabled) {
  91330. this.disable();
  91331. } else {
  91332. this.enable();
  91333. }
  91334. };
  91335. _proto.buildCSSClass = function buildCSSClass() {
  91336. return "vjs-descriptions-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91337. };
  91338. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91339. return "vjs-descriptions-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91340. };
  91341. return DescriptionsButton2;
  91342. }(TextTrackButton);
  91343. DescriptionsButton.prototype.kind_ = "descriptions";
  91344. DescriptionsButton.prototype.controlText_ = "Descriptions";
  91345. Component$1.registerComponent("DescriptionsButton", DescriptionsButton);
  91346. var SubtitlesButton = /* @__PURE__ */ function(_TextTrackButton) {
  91347. _inheritsLoose(SubtitlesButton2, _TextTrackButton);
  91348. function SubtitlesButton2(player, options2, ready) {
  91349. return _TextTrackButton.call(this, player, options2, ready) || this;
  91350. }
  91351. var _proto = SubtitlesButton2.prototype;
  91352. _proto.buildCSSClass = function buildCSSClass() {
  91353. return "vjs-subtitles-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91354. };
  91355. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91356. return "vjs-subtitles-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91357. };
  91358. return SubtitlesButton2;
  91359. }(TextTrackButton);
  91360. SubtitlesButton.prototype.kind_ = "subtitles";
  91361. SubtitlesButton.prototype.controlText_ = "Subtitles";
  91362. Component$1.registerComponent("SubtitlesButton", SubtitlesButton);
  91363. var CaptionSettingsMenuItem = /* @__PURE__ */ function(_TextTrackMenuItem) {
  91364. _inheritsLoose(CaptionSettingsMenuItem2, _TextTrackMenuItem);
  91365. function CaptionSettingsMenuItem2(player, options2) {
  91366. var _this;
  91367. options2.track = {
  91368. player,
  91369. kind: options2.kind,
  91370. label: options2.kind + " settings",
  91371. selectable: false,
  91372. "default": false,
  91373. mode: "disabled"
  91374. };
  91375. options2.selectable = false;
  91376. options2.name = "CaptionSettingsMenuItem";
  91377. _this = _TextTrackMenuItem.call(this, player, options2) || this;
  91378. _this.addClass("vjs-texttrack-settings");
  91379. _this.controlText(", opens " + options2.kind + " settings dialog");
  91380. return _this;
  91381. }
  91382. var _proto = CaptionSettingsMenuItem2.prototype;
  91383. _proto.handleClick = function handleClick(event2) {
  91384. this.player().getChild("textTrackSettings").open();
  91385. };
  91386. return CaptionSettingsMenuItem2;
  91387. }(TextTrackMenuItem);
  91388. Component$1.registerComponent("CaptionSettingsMenuItem", CaptionSettingsMenuItem);
  91389. var CaptionsButton = /* @__PURE__ */ function(_TextTrackButton) {
  91390. _inheritsLoose(CaptionsButton2, _TextTrackButton);
  91391. function CaptionsButton2(player, options2, ready) {
  91392. return _TextTrackButton.call(this, player, options2, ready) || this;
  91393. }
  91394. var _proto = CaptionsButton2.prototype;
  91395. _proto.buildCSSClass = function buildCSSClass() {
  91396. return "vjs-captions-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91397. };
  91398. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91399. return "vjs-captions-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91400. };
  91401. _proto.createItems = function createItems() {
  91402. var items = [];
  91403. if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild("textTrackSettings")) {
  91404. items.push(new CaptionSettingsMenuItem(this.player_, {
  91405. kind: this.kind_
  91406. }));
  91407. this.hideThreshold_ += 1;
  91408. }
  91409. return _TextTrackButton.prototype.createItems.call(this, items);
  91410. };
  91411. return CaptionsButton2;
  91412. }(TextTrackButton);
  91413. CaptionsButton.prototype.kind_ = "captions";
  91414. CaptionsButton.prototype.controlText_ = "Captions";
  91415. Component$1.registerComponent("CaptionsButton", CaptionsButton);
  91416. var SubsCapsMenuItem = /* @__PURE__ */ function(_TextTrackMenuItem) {
  91417. _inheritsLoose(SubsCapsMenuItem2, _TextTrackMenuItem);
  91418. function SubsCapsMenuItem2() {
  91419. return _TextTrackMenuItem.apply(this, arguments) || this;
  91420. }
  91421. var _proto = SubsCapsMenuItem2.prototype;
  91422. _proto.createEl = function createEl$12(type2, props, attrs) {
  91423. var el = _TextTrackMenuItem.prototype.createEl.call(this, type2, props, attrs);
  91424. var parentSpan = el.querySelector(".vjs-menu-item-text");
  91425. if (this.options_.track.kind === "captions") {
  91426. parentSpan.appendChild(createEl("span", {
  91427. className: "vjs-icon-placeholder"
  91428. }, {
  91429. "aria-hidden": true
  91430. }));
  91431. parentSpan.appendChild(createEl("span", {
  91432. className: "vjs-control-text",
  91433. textContent: " " + this.localize("Captions")
  91434. }));
  91435. }
  91436. return el;
  91437. };
  91438. return SubsCapsMenuItem2;
  91439. }(TextTrackMenuItem);
  91440. Component$1.registerComponent("SubsCapsMenuItem", SubsCapsMenuItem);
  91441. var SubsCapsButton = /* @__PURE__ */ function(_TextTrackButton) {
  91442. _inheritsLoose(SubsCapsButton2, _TextTrackButton);
  91443. function SubsCapsButton2(player, options2) {
  91444. var _this;
  91445. if (options2 === void 0) {
  91446. options2 = {};
  91447. }
  91448. _this = _TextTrackButton.call(this, player, options2) || this;
  91449. _this.label_ = "subtitles";
  91450. if (["en", "en-us", "en-ca", "fr-ca"].indexOf(_this.player_.language_) > -1) {
  91451. _this.label_ = "captions";
  91452. }
  91453. _this.menuButton_.controlText(toTitleCase$1(_this.label_));
  91454. return _this;
  91455. }
  91456. var _proto = SubsCapsButton2.prototype;
  91457. _proto.buildCSSClass = function buildCSSClass() {
  91458. return "vjs-subs-caps-button " + _TextTrackButton.prototype.buildCSSClass.call(this);
  91459. };
  91460. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91461. return "vjs-subs-caps-button " + _TextTrackButton.prototype.buildWrapperCSSClass.call(this);
  91462. };
  91463. _proto.createItems = function createItems() {
  91464. var items = [];
  91465. if (!(this.player().tech_ && this.player().tech_.featuresNativeTextTracks) && this.player().getChild("textTrackSettings")) {
  91466. items.push(new CaptionSettingsMenuItem(this.player_, {
  91467. kind: this.label_
  91468. }));
  91469. this.hideThreshold_ += 1;
  91470. }
  91471. items = _TextTrackButton.prototype.createItems.call(this, items, SubsCapsMenuItem);
  91472. return items;
  91473. };
  91474. return SubsCapsButton2;
  91475. }(TextTrackButton);
  91476. SubsCapsButton.prototype.kinds_ = ["captions", "subtitles"];
  91477. SubsCapsButton.prototype.controlText_ = "Subtitles";
  91478. Component$1.registerComponent("SubsCapsButton", SubsCapsButton);
  91479. var AudioTrackMenuItem = /* @__PURE__ */ function(_MenuItem) {
  91480. _inheritsLoose(AudioTrackMenuItem2, _MenuItem);
  91481. function AudioTrackMenuItem2(player, options2) {
  91482. var _this;
  91483. var track = options2.track;
  91484. var tracks = player.audioTracks();
  91485. options2.label = track.label || track.language || "Unknown";
  91486. options2.selected = track.enabled;
  91487. _this = _MenuItem.call(this, player, options2) || this;
  91488. _this.track = track;
  91489. _this.addClass("vjs-" + track.kind + "-menu-item");
  91490. var changeHandler = function changeHandler2() {
  91491. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  91492. args[_key] = arguments[_key];
  91493. }
  91494. _this.handleTracksChange.apply(_assertThisInitialized(_this), args);
  91495. };
  91496. tracks.addEventListener("change", changeHandler);
  91497. _this.on("dispose", function() {
  91498. tracks.removeEventListener("change", changeHandler);
  91499. });
  91500. return _this;
  91501. }
  91502. var _proto = AudioTrackMenuItem2.prototype;
  91503. _proto.createEl = function createEl$12(type2, props, attrs) {
  91504. var el = _MenuItem.prototype.createEl.call(this, type2, props, attrs);
  91505. var parentSpan = el.querySelector(".vjs-menu-item-text");
  91506. if (this.options_.track.kind === "main-desc") {
  91507. parentSpan.appendChild(createEl("span", {
  91508. className: "vjs-icon-placeholder"
  91509. }, {
  91510. "aria-hidden": true
  91511. }));
  91512. parentSpan.appendChild(createEl("span", {
  91513. className: "vjs-control-text",
  91514. textContent: " " + this.localize("Descriptions")
  91515. }));
  91516. }
  91517. return el;
  91518. };
  91519. _proto.handleClick = function handleClick(event2) {
  91520. _MenuItem.prototype.handleClick.call(this, event2);
  91521. this.track.enabled = true;
  91522. if (this.player_.tech_.featuresNativeAudioTracks) {
  91523. var tracks = this.player_.audioTracks();
  91524. for (var i2 = 0; i2 < tracks.length; i2++) {
  91525. var track = tracks[i2];
  91526. if (track === this.track) {
  91527. continue;
  91528. }
  91529. track.enabled = track === this.track;
  91530. }
  91531. }
  91532. };
  91533. _proto.handleTracksChange = function handleTracksChange(event2) {
  91534. this.selected(this.track.enabled);
  91535. };
  91536. return AudioTrackMenuItem2;
  91537. }(MenuItem);
  91538. Component$1.registerComponent("AudioTrackMenuItem", AudioTrackMenuItem);
  91539. var AudioTrackButton = /* @__PURE__ */ function(_TrackButton) {
  91540. _inheritsLoose(AudioTrackButton2, _TrackButton);
  91541. function AudioTrackButton2(player, options2) {
  91542. if (options2 === void 0) {
  91543. options2 = {};
  91544. }
  91545. options2.tracks = player.audioTracks();
  91546. return _TrackButton.call(this, player, options2) || this;
  91547. }
  91548. var _proto = AudioTrackButton2.prototype;
  91549. _proto.buildCSSClass = function buildCSSClass() {
  91550. return "vjs-audio-button " + _TrackButton.prototype.buildCSSClass.call(this);
  91551. };
  91552. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91553. return "vjs-audio-button " + _TrackButton.prototype.buildWrapperCSSClass.call(this);
  91554. };
  91555. _proto.createItems = function createItems(items) {
  91556. if (items === void 0) {
  91557. items = [];
  91558. }
  91559. this.hideThreshold_ = 1;
  91560. var tracks = this.player_.audioTracks();
  91561. for (var i2 = 0; i2 < tracks.length; i2++) {
  91562. var track = tracks[i2];
  91563. items.push(new AudioTrackMenuItem(this.player_, {
  91564. track,
  91565. selectable: true,
  91566. multiSelectable: false
  91567. }));
  91568. }
  91569. return items;
  91570. };
  91571. return AudioTrackButton2;
  91572. }(TrackButton);
  91573. AudioTrackButton.prototype.controlText_ = "Audio Track";
  91574. Component$1.registerComponent("AudioTrackButton", AudioTrackButton);
  91575. var PlaybackRateMenuItem = /* @__PURE__ */ function(_MenuItem) {
  91576. _inheritsLoose(PlaybackRateMenuItem2, _MenuItem);
  91577. function PlaybackRateMenuItem2(player, options2) {
  91578. var _this;
  91579. var label = options2.rate;
  91580. var rate = parseFloat(label, 10);
  91581. options2.label = label;
  91582. options2.selected = rate === player.playbackRate();
  91583. options2.selectable = true;
  91584. options2.multiSelectable = false;
  91585. _this = _MenuItem.call(this, player, options2) || this;
  91586. _this.label = label;
  91587. _this.rate = rate;
  91588. _this.on(player, "ratechange", function(e) {
  91589. return _this.update(e);
  91590. });
  91591. return _this;
  91592. }
  91593. var _proto = PlaybackRateMenuItem2.prototype;
  91594. _proto.handleClick = function handleClick(event2) {
  91595. _MenuItem.prototype.handleClick.call(this);
  91596. this.player().playbackRate(this.rate);
  91597. };
  91598. _proto.update = function update(event2) {
  91599. this.selected(this.player().playbackRate() === this.rate);
  91600. };
  91601. return PlaybackRateMenuItem2;
  91602. }(MenuItem);
  91603. PlaybackRateMenuItem.prototype.contentElType = "button";
  91604. Component$1.registerComponent("PlaybackRateMenuItem", PlaybackRateMenuItem);
  91605. var PlaybackRateMenuButton = /* @__PURE__ */ function(_MenuButton) {
  91606. _inheritsLoose(PlaybackRateMenuButton2, _MenuButton);
  91607. function PlaybackRateMenuButton2(player, options2) {
  91608. var _this;
  91609. _this = _MenuButton.call(this, player, options2) || this;
  91610. _this.menuButton_.el_.setAttribute("aria-describedby", _this.labelElId_);
  91611. _this.updateVisibility();
  91612. _this.updateLabel();
  91613. _this.on(player, "loadstart", function(e) {
  91614. return _this.updateVisibility(e);
  91615. });
  91616. _this.on(player, "ratechange", function(e) {
  91617. return _this.updateLabel(e);
  91618. });
  91619. _this.on(player, "playbackrateschange", function(e) {
  91620. return _this.handlePlaybackRateschange(e);
  91621. });
  91622. return _this;
  91623. }
  91624. var _proto = PlaybackRateMenuButton2.prototype;
  91625. _proto.createEl = function createEl$12() {
  91626. var el = _MenuButton.prototype.createEl.call(this);
  91627. this.labelElId_ = "vjs-playback-rate-value-label-" + this.id_;
  91628. this.labelEl_ = createEl("div", {
  91629. className: "vjs-playback-rate-value",
  91630. id: this.labelElId_,
  91631. textContent: "1x"
  91632. });
  91633. el.appendChild(this.labelEl_);
  91634. return el;
  91635. };
  91636. _proto.dispose = function dispose() {
  91637. this.labelEl_ = null;
  91638. _MenuButton.prototype.dispose.call(this);
  91639. };
  91640. _proto.buildCSSClass = function buildCSSClass() {
  91641. return "vjs-playback-rate " + _MenuButton.prototype.buildCSSClass.call(this);
  91642. };
  91643. _proto.buildWrapperCSSClass = function buildWrapperCSSClass() {
  91644. return "vjs-playback-rate " + _MenuButton.prototype.buildWrapperCSSClass.call(this);
  91645. };
  91646. _proto.createItems = function createItems() {
  91647. var rates = this.playbackRates();
  91648. var items = [];
  91649. for (var i2 = rates.length - 1; i2 >= 0; i2--) {
  91650. items.push(new PlaybackRateMenuItem(this.player(), {
  91651. rate: rates[i2] + "x"
  91652. }));
  91653. }
  91654. return items;
  91655. };
  91656. _proto.updateARIAAttributes = function updateARIAAttributes() {
  91657. this.el().setAttribute("aria-valuenow", this.player().playbackRate());
  91658. };
  91659. _proto.handleClick = function handleClick(event2) {
  91660. var currentRate = this.player().playbackRate();
  91661. var rates = this.playbackRates();
  91662. var currentIndex = rates.indexOf(currentRate);
  91663. var newIndex = (currentIndex + 1) % rates.length;
  91664. this.player().playbackRate(rates[newIndex]);
  91665. };
  91666. _proto.handlePlaybackRateschange = function handlePlaybackRateschange(event2) {
  91667. this.update();
  91668. };
  91669. _proto.playbackRates = function playbackRates() {
  91670. var player = this.player();
  91671. return player.playbackRates && player.playbackRates() || [];
  91672. };
  91673. _proto.playbackRateSupported = function playbackRateSupported() {
  91674. return this.player().tech_ && this.player().tech_.featuresPlaybackRate && this.playbackRates() && this.playbackRates().length > 0;
  91675. };
  91676. _proto.updateVisibility = function updateVisibility(event2) {
  91677. if (this.playbackRateSupported()) {
  91678. this.removeClass("vjs-hidden");
  91679. } else {
  91680. this.addClass("vjs-hidden");
  91681. }
  91682. };
  91683. _proto.updateLabel = function updateLabel(event2) {
  91684. if (this.playbackRateSupported()) {
  91685. this.labelEl_.textContent = this.player().playbackRate() + "x";
  91686. }
  91687. };
  91688. return PlaybackRateMenuButton2;
  91689. }(MenuButton);
  91690. PlaybackRateMenuButton.prototype.controlText_ = "Playback Rate";
  91691. Component$1.registerComponent("PlaybackRateMenuButton", PlaybackRateMenuButton);
  91692. var Spacer = /* @__PURE__ */ function(_Component) {
  91693. _inheritsLoose(Spacer2, _Component);
  91694. function Spacer2() {
  91695. return _Component.apply(this, arguments) || this;
  91696. }
  91697. var _proto = Spacer2.prototype;
  91698. _proto.buildCSSClass = function buildCSSClass() {
  91699. return "vjs-spacer " + _Component.prototype.buildCSSClass.call(this);
  91700. };
  91701. _proto.createEl = function createEl2(tag, props, attributes) {
  91702. if (tag === void 0) {
  91703. tag = "div";
  91704. }
  91705. if (props === void 0) {
  91706. props = {};
  91707. }
  91708. if (attributes === void 0) {
  91709. attributes = {};
  91710. }
  91711. if (!props.className) {
  91712. props.className = this.buildCSSClass();
  91713. }
  91714. return _Component.prototype.createEl.call(this, tag, props, attributes);
  91715. };
  91716. return Spacer2;
  91717. }(Component$1);
  91718. Component$1.registerComponent("Spacer", Spacer);
  91719. var CustomControlSpacer = /* @__PURE__ */ function(_Spacer) {
  91720. _inheritsLoose(CustomControlSpacer2, _Spacer);
  91721. function CustomControlSpacer2() {
  91722. return _Spacer.apply(this, arguments) || this;
  91723. }
  91724. var _proto = CustomControlSpacer2.prototype;
  91725. _proto.buildCSSClass = function buildCSSClass() {
  91726. return "vjs-custom-control-spacer " + _Spacer.prototype.buildCSSClass.call(this);
  91727. };
  91728. _proto.createEl = function createEl2() {
  91729. return _Spacer.prototype.createEl.call(this, "div", {
  91730. className: this.buildCSSClass(),
  91731. textContent: "\xA0"
  91732. });
  91733. };
  91734. return CustomControlSpacer2;
  91735. }(Spacer);
  91736. Component$1.registerComponent("CustomControlSpacer", CustomControlSpacer);
  91737. var ControlBar = /* @__PURE__ */ function(_Component) {
  91738. _inheritsLoose(ControlBar2, _Component);
  91739. function ControlBar2() {
  91740. return _Component.apply(this, arguments) || this;
  91741. }
  91742. var _proto = ControlBar2.prototype;
  91743. _proto.createEl = function createEl2() {
  91744. return _Component.prototype.createEl.call(this, "div", {
  91745. className: "vjs-control-bar",
  91746. dir: "ltr"
  91747. });
  91748. };
  91749. return ControlBar2;
  91750. }(Component$1);
  91751. ControlBar.prototype.options_ = {
  91752. children: ["playToggle", "volumePanel", "currentTimeDisplay", "timeDivider", "durationDisplay", "progressControl", "liveDisplay", "seekToLive", "remainingTimeDisplay", "customControlSpacer", "playbackRateMenuButton", "chaptersButton", "descriptionsButton", "subsCapsButton", "audioTrackButton", "fullscreenToggle"]
  91753. };
  91754. if ("exitPictureInPicture" in document_1) {
  91755. ControlBar.prototype.options_.children.splice(ControlBar.prototype.options_.children.length - 1, 0, "pictureInPictureToggle");
  91756. }
  91757. Component$1.registerComponent("ControlBar", ControlBar);
  91758. var ErrorDisplay = /* @__PURE__ */ function(_ModalDialog) {
  91759. _inheritsLoose(ErrorDisplay2, _ModalDialog);
  91760. function ErrorDisplay2(player, options2) {
  91761. var _this;
  91762. _this = _ModalDialog.call(this, player, options2) || this;
  91763. _this.on(player, "error", function(e) {
  91764. return _this.open(e);
  91765. });
  91766. return _this;
  91767. }
  91768. var _proto = ErrorDisplay2.prototype;
  91769. _proto.buildCSSClass = function buildCSSClass() {
  91770. return "vjs-error-display " + _ModalDialog.prototype.buildCSSClass.call(this);
  91771. };
  91772. _proto.content = function content() {
  91773. var error = this.player().error();
  91774. return error ? this.localize(error.message) : "";
  91775. };
  91776. return ErrorDisplay2;
  91777. }(ModalDialog);
  91778. ErrorDisplay.prototype.options_ = _extends$2({}, ModalDialog.prototype.options_, {
  91779. pauseOnOpen: false,
  91780. fillAlways: true,
  91781. temporary: false,
  91782. uncloseable: true
  91783. });
  91784. Component$1.registerComponent("ErrorDisplay", ErrorDisplay);
  91785. var LOCAL_STORAGE_KEY$1 = "vjs-text-track-settings";
  91786. var COLOR_BLACK = ["#000", "Black"];
  91787. var COLOR_BLUE = ["#00F", "Blue"];
  91788. var COLOR_CYAN = ["#0FF", "Cyan"];
  91789. var COLOR_GREEN = ["#0F0", "Green"];
  91790. var COLOR_MAGENTA = ["#F0F", "Magenta"];
  91791. var COLOR_RED = ["#F00", "Red"];
  91792. var COLOR_WHITE = ["#FFF", "White"];
  91793. var COLOR_YELLOW = ["#FF0", "Yellow"];
  91794. var OPACITY_OPAQUE = ["1", "Opaque"];
  91795. var OPACITY_SEMI = ["0.5", "Semi-Transparent"];
  91796. var OPACITY_TRANS = ["0", "Transparent"];
  91797. var selectConfigs = {
  91798. backgroundColor: {
  91799. selector: ".vjs-bg-color > select",
  91800. id: "captions-background-color-%s",
  91801. label: "Color",
  91802. options: [COLOR_BLACK, COLOR_WHITE, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN]
  91803. },
  91804. backgroundOpacity: {
  91805. selector: ".vjs-bg-opacity > select",
  91806. id: "captions-background-opacity-%s",
  91807. label: "Transparency",
  91808. options: [OPACITY_OPAQUE, OPACITY_SEMI, OPACITY_TRANS]
  91809. },
  91810. color: {
  91811. selector: ".vjs-fg-color > select",
  91812. id: "captions-foreground-color-%s",
  91813. label: "Color",
  91814. options: [COLOR_WHITE, COLOR_BLACK, COLOR_RED, COLOR_GREEN, COLOR_BLUE, COLOR_YELLOW, COLOR_MAGENTA, COLOR_CYAN]
  91815. },
  91816. edgeStyle: {
  91817. selector: ".vjs-edge-style > select",
  91818. id: "%s",
  91819. label: "Text Edge Style",
  91820. options: [["none", "None"], ["raised", "Raised"], ["depressed", "Depressed"], ["uniform", "Uniform"], ["dropshadow", "Dropshadow"]]
  91821. },
  91822. fontFamily: {
  91823. selector: ".vjs-font-family > select",
  91824. id: "captions-font-family-%s",
  91825. label: "Font Family",
  91826. options: [["proportionalSansSerif", "Proportional Sans-Serif"], ["monospaceSansSerif", "Monospace Sans-Serif"], ["proportionalSerif", "Proportional Serif"], ["monospaceSerif", "Monospace Serif"], ["casual", "Casual"], ["script", "Script"], ["small-caps", "Small Caps"]]
  91827. },
  91828. fontPercent: {
  91829. selector: ".vjs-font-percent > select",
  91830. id: "captions-font-size-%s",
  91831. label: "Font Size",
  91832. options: [["0.50", "50%"], ["0.75", "75%"], ["1.00", "100%"], ["1.25", "125%"], ["1.50", "150%"], ["1.75", "175%"], ["2.00", "200%"], ["3.00", "300%"], ["4.00", "400%"]],
  91833. "default": 2,
  91834. parser: function parser(v) {
  91835. return v === "1.00" ? null : Number(v);
  91836. }
  91837. },
  91838. textOpacity: {
  91839. selector: ".vjs-text-opacity > select",
  91840. id: "captions-foreground-opacity-%s",
  91841. label: "Transparency",
  91842. options: [OPACITY_OPAQUE, OPACITY_SEMI]
  91843. },
  91844. windowColor: {
  91845. selector: ".vjs-window-color > select",
  91846. id: "captions-window-color-%s",
  91847. label: "Color"
  91848. },
  91849. windowOpacity: {
  91850. selector: ".vjs-window-opacity > select",
  91851. id: "captions-window-opacity-%s",
  91852. label: "Transparency",
  91853. options: [OPACITY_TRANS, OPACITY_SEMI, OPACITY_OPAQUE]
  91854. }
  91855. };
  91856. selectConfigs.windowColor.options = selectConfigs.backgroundColor.options;
  91857. function parseOptionValue(value, parser2) {
  91858. if (parser2) {
  91859. value = parser2(value);
  91860. }
  91861. if (value && value !== "none") {
  91862. return value;
  91863. }
  91864. }
  91865. function getSelectedOptionValue(el, parser2) {
  91866. var value = el.options[el.options.selectedIndex].value;
  91867. return parseOptionValue(value, parser2);
  91868. }
  91869. function setSelectedOption(el, value, parser2) {
  91870. if (!value) {
  91871. return;
  91872. }
  91873. for (var i2 = 0; i2 < el.options.length; i2++) {
  91874. if (parseOptionValue(el.options[i2].value, parser2) === value) {
  91875. el.selectedIndex = i2;
  91876. break;
  91877. }
  91878. }
  91879. }
  91880. var TextTrackSettings = /* @__PURE__ */ function(_ModalDialog) {
  91881. _inheritsLoose(TextTrackSettings2, _ModalDialog);
  91882. function TextTrackSettings2(player, options2) {
  91883. var _this;
  91884. options2.temporary = false;
  91885. _this = _ModalDialog.call(this, player, options2) || this;
  91886. _this.updateDisplay = _this.updateDisplay.bind(_assertThisInitialized(_this));
  91887. _this.fill();
  91888. _this.hasBeenOpened_ = _this.hasBeenFilled_ = true;
  91889. _this.endDialog = createEl("p", {
  91890. className: "vjs-control-text",
  91891. textContent: _this.localize("End of dialog window.")
  91892. });
  91893. _this.el().appendChild(_this.endDialog);
  91894. _this.setDefaults();
  91895. if (options2.persistTextTrackSettings === void 0) {
  91896. _this.options_.persistTextTrackSettings = _this.options_.playerOptions.persistTextTrackSettings;
  91897. }
  91898. _this.on(_this.$(".vjs-done-button"), "click", function() {
  91899. _this.saveSettings();
  91900. _this.close();
  91901. });
  91902. _this.on(_this.$(".vjs-default-button"), "click", function() {
  91903. _this.setDefaults();
  91904. _this.updateDisplay();
  91905. });
  91906. each(selectConfigs, function(config) {
  91907. _this.on(_this.$(config.selector), "change", _this.updateDisplay);
  91908. });
  91909. if (_this.options_.persistTextTrackSettings) {
  91910. _this.restoreSettings();
  91911. }
  91912. return _this;
  91913. }
  91914. var _proto = TextTrackSettings2.prototype;
  91915. _proto.dispose = function dispose() {
  91916. this.endDialog = null;
  91917. _ModalDialog.prototype.dispose.call(this);
  91918. };
  91919. _proto.createElSelect_ = function createElSelect_(key, legendId, type2) {
  91920. var _this2 = this;
  91921. if (legendId === void 0) {
  91922. legendId = "";
  91923. }
  91924. if (type2 === void 0) {
  91925. type2 = "label";
  91926. }
  91927. var config = selectConfigs[key];
  91928. var id = config.id.replace("%s", this.id_);
  91929. var selectLabelledbyIds = [legendId, id].join(" ").trim();
  91930. return ["<" + type2 + ' id="' + id + '" class="' + (type2 === "label" ? "vjs-label" : "") + '">', this.localize(config.label), "</" + type2 + ">", '<select aria-labelledby="' + selectLabelledbyIds + '">'].concat(config.options.map(function(o) {
  91931. var optionId = id + "-" + o[1].replace(/\W+/g, "");
  91932. return ['<option id="' + optionId + '" value="' + o[0] + '" ', 'aria-labelledby="' + selectLabelledbyIds + " " + optionId + '">', _this2.localize(o[1]), "</option>"].join("");
  91933. })).concat("</select>").join("");
  91934. };
  91935. _proto.createElFgColor_ = function createElFgColor_() {
  91936. var legendId = "captions-text-legend-" + this.id_;
  91937. return ['<fieldset class="vjs-fg-color vjs-track-setting">', '<legend id="' + legendId + '">', this.localize("Text"), "</legend>", this.createElSelect_("color", legendId), '<span class="vjs-text-opacity vjs-opacity">', this.createElSelect_("textOpacity", legendId), "</span>", "</fieldset>"].join("");
  91938. };
  91939. _proto.createElBgColor_ = function createElBgColor_() {
  91940. var legendId = "captions-background-" + this.id_;
  91941. return ['<fieldset class="vjs-bg-color vjs-track-setting">', '<legend id="' + legendId + '">', this.localize("Background"), "</legend>", this.createElSelect_("backgroundColor", legendId), '<span class="vjs-bg-opacity vjs-opacity">', this.createElSelect_("backgroundOpacity", legendId), "</span>", "</fieldset>"].join("");
  91942. };
  91943. _proto.createElWinColor_ = function createElWinColor_() {
  91944. var legendId = "captions-window-" + this.id_;
  91945. return ['<fieldset class="vjs-window-color vjs-track-setting">', '<legend id="' + legendId + '">', this.localize("Window"), "</legend>", this.createElSelect_("windowColor", legendId), '<span class="vjs-window-opacity vjs-opacity">', this.createElSelect_("windowOpacity", legendId), "</span>", "</fieldset>"].join("");
  91946. };
  91947. _proto.createElColors_ = function createElColors_() {
  91948. return createEl("div", {
  91949. className: "vjs-track-settings-colors",
  91950. innerHTML: [this.createElFgColor_(), this.createElBgColor_(), this.createElWinColor_()].join("")
  91951. });
  91952. };
  91953. _proto.createElFont_ = function createElFont_() {
  91954. return createEl("div", {
  91955. className: "vjs-track-settings-font",
  91956. innerHTML: ['<fieldset class="vjs-font-percent vjs-track-setting">', this.createElSelect_("fontPercent", "", "legend"), "</fieldset>", '<fieldset class="vjs-edge-style vjs-track-setting">', this.createElSelect_("edgeStyle", "", "legend"), "</fieldset>", '<fieldset class="vjs-font-family vjs-track-setting">', this.createElSelect_("fontFamily", "", "legend"), "</fieldset>"].join("")
  91957. });
  91958. };
  91959. _proto.createElControls_ = function createElControls_() {
  91960. var defaultsDescription = this.localize("restore all settings to the default values");
  91961. return createEl("div", {
  91962. className: "vjs-track-settings-controls",
  91963. innerHTML: ['<button type="button" class="vjs-default-button" title="' + defaultsDescription + '">', this.localize("Reset"), '<span class="vjs-control-text"> ' + defaultsDescription + "</span>", "</button>", '<button type="button" class="vjs-done-button">' + this.localize("Done") + "</button>"].join("")
  91964. });
  91965. };
  91966. _proto.content = function content() {
  91967. return [this.createElColors_(), this.createElFont_(), this.createElControls_()];
  91968. };
  91969. _proto.label = function label() {
  91970. return this.localize("Caption Settings Dialog");
  91971. };
  91972. _proto.description = function description() {
  91973. return this.localize("Beginning of dialog window. Escape will cancel and close the window.");
  91974. };
  91975. _proto.buildCSSClass = function buildCSSClass() {
  91976. return _ModalDialog.prototype.buildCSSClass.call(this) + " vjs-text-track-settings";
  91977. };
  91978. _proto.getValues = function getValues() {
  91979. var _this3 = this;
  91980. return reduce(selectConfigs, function(accum, config, key) {
  91981. var value = getSelectedOptionValue(_this3.$(config.selector), config.parser);
  91982. if (value !== void 0) {
  91983. accum[key] = value;
  91984. }
  91985. return accum;
  91986. }, {});
  91987. };
  91988. _proto.setValues = function setValues(values3) {
  91989. var _this4 = this;
  91990. each(selectConfigs, function(config, key) {
  91991. setSelectedOption(_this4.$(config.selector), values3[key], config.parser);
  91992. });
  91993. };
  91994. _proto.setDefaults = function setDefaults() {
  91995. var _this5 = this;
  91996. each(selectConfigs, function(config) {
  91997. var index2 = config.hasOwnProperty("default") ? config["default"] : 0;
  91998. _this5.$(config.selector).selectedIndex = index2;
  91999. });
  92000. };
  92001. _proto.restoreSettings = function restoreSettings() {
  92002. var values3;
  92003. try {
  92004. values3 = JSON.parse(window_1.localStorage.getItem(LOCAL_STORAGE_KEY$1));
  92005. } catch (err) {
  92006. log$1.warn(err);
  92007. }
  92008. if (values3) {
  92009. this.setValues(values3);
  92010. }
  92011. };
  92012. _proto.saveSettings = function saveSettings() {
  92013. if (!this.options_.persistTextTrackSettings) {
  92014. return;
  92015. }
  92016. var values3 = this.getValues();
  92017. try {
  92018. if (Object.keys(values3).length) {
  92019. window_1.localStorage.setItem(LOCAL_STORAGE_KEY$1, JSON.stringify(values3));
  92020. } else {
  92021. window_1.localStorage.removeItem(LOCAL_STORAGE_KEY$1);
  92022. }
  92023. } catch (err) {
  92024. log$1.warn(err);
  92025. }
  92026. };
  92027. _proto.updateDisplay = function updateDisplay() {
  92028. var ttDisplay = this.player_.getChild("textTrackDisplay");
  92029. if (ttDisplay) {
  92030. ttDisplay.updateDisplay();
  92031. }
  92032. };
  92033. _proto.conditionalBlur_ = function conditionalBlur_() {
  92034. this.previouslyActiveEl_ = null;
  92035. var cb = this.player_.controlBar;
  92036. var subsCapsBtn = cb && cb.subsCapsButton;
  92037. var ccBtn = cb && cb.captionsButton;
  92038. if (subsCapsBtn) {
  92039. subsCapsBtn.focus();
  92040. } else if (ccBtn) {
  92041. ccBtn.focus();
  92042. }
  92043. };
  92044. return TextTrackSettings2;
  92045. }(ModalDialog);
  92046. Component$1.registerComponent("TextTrackSettings", TextTrackSettings);
  92047. var ResizeManager = /* @__PURE__ */ function(_Component) {
  92048. _inheritsLoose(ResizeManager2, _Component);
  92049. function ResizeManager2(player, options2) {
  92050. var _this;
  92051. var RESIZE_OBSERVER_AVAILABLE = options2.ResizeObserver || window_1.ResizeObserver;
  92052. if (options2.ResizeObserver === null) {
  92053. RESIZE_OBSERVER_AVAILABLE = false;
  92054. }
  92055. var options_ = mergeOptions$3({
  92056. createEl: !RESIZE_OBSERVER_AVAILABLE,
  92057. reportTouchActivity: false
  92058. }, options2);
  92059. _this = _Component.call(this, player, options_) || this;
  92060. _this.ResizeObserver = options2.ResizeObserver || window_1.ResizeObserver;
  92061. _this.loadListener_ = null;
  92062. _this.resizeObserver_ = null;
  92063. _this.debouncedHandler_ = debounce(function() {
  92064. _this.resizeHandler();
  92065. }, 100, false, _assertThisInitialized(_this));
  92066. if (RESIZE_OBSERVER_AVAILABLE) {
  92067. _this.resizeObserver_ = new _this.ResizeObserver(_this.debouncedHandler_);
  92068. _this.resizeObserver_.observe(player.el());
  92069. } else {
  92070. _this.loadListener_ = function() {
  92071. if (!_this.el_ || !_this.el_.contentWindow) {
  92072. return;
  92073. }
  92074. var debouncedHandler_ = _this.debouncedHandler_;
  92075. var unloadListener_ = _this.unloadListener_ = function() {
  92076. off(this, "resize", debouncedHandler_);
  92077. off(this, "unload", unloadListener_);
  92078. unloadListener_ = null;
  92079. };
  92080. on(_this.el_.contentWindow, "unload", unloadListener_);
  92081. on(_this.el_.contentWindow, "resize", debouncedHandler_);
  92082. };
  92083. _this.one("load", _this.loadListener_);
  92084. }
  92085. return _this;
  92086. }
  92087. var _proto = ResizeManager2.prototype;
  92088. _proto.createEl = function createEl2() {
  92089. return _Component.prototype.createEl.call(this, "iframe", {
  92090. className: "vjs-resize-manager",
  92091. tabIndex: -1,
  92092. title: this.localize("No content")
  92093. }, {
  92094. "aria-hidden": "true"
  92095. });
  92096. };
  92097. _proto.resizeHandler = function resizeHandler() {
  92098. if (!this.player_ || !this.player_.trigger) {
  92099. return;
  92100. }
  92101. this.player_.trigger("playerresize");
  92102. };
  92103. _proto.dispose = function dispose() {
  92104. if (this.debouncedHandler_) {
  92105. this.debouncedHandler_.cancel();
  92106. }
  92107. if (this.resizeObserver_) {
  92108. if (this.player_.el()) {
  92109. this.resizeObserver_.unobserve(this.player_.el());
  92110. }
  92111. this.resizeObserver_.disconnect();
  92112. }
  92113. if (this.loadListener_) {
  92114. this.off("load", this.loadListener_);
  92115. }
  92116. if (this.el_ && this.el_.contentWindow && this.unloadListener_) {
  92117. this.unloadListener_.call(this.el_.contentWindow);
  92118. }
  92119. this.ResizeObserver = null;
  92120. this.resizeObserver = null;
  92121. this.debouncedHandler_ = null;
  92122. this.loadListener_ = null;
  92123. _Component.prototype.dispose.call(this);
  92124. };
  92125. return ResizeManager2;
  92126. }(Component$1);
  92127. Component$1.registerComponent("ResizeManager", ResizeManager);
  92128. var defaults$1 = {
  92129. trackingThreshold: 20,
  92130. liveTolerance: 15
  92131. };
  92132. var LiveTracker = /* @__PURE__ */ function(_Component) {
  92133. _inheritsLoose(LiveTracker2, _Component);
  92134. function LiveTracker2(player, options2) {
  92135. var _this;
  92136. var options_ = mergeOptions$3(defaults$1, options2, {
  92137. createEl: false
  92138. });
  92139. _this = _Component.call(this, player, options_) || this;
  92140. _this.handleVisibilityChange_ = function(e) {
  92141. return _this.handleVisibilityChange(e);
  92142. };
  92143. _this.trackLiveHandler_ = function() {
  92144. return _this.trackLive_();
  92145. };
  92146. _this.handlePlay_ = function(e) {
  92147. return _this.handlePlay(e);
  92148. };
  92149. _this.handleFirstTimeupdate_ = function(e) {
  92150. return _this.handleFirstTimeupdate(e);
  92151. };
  92152. _this.handleSeeked_ = function(e) {
  92153. return _this.handleSeeked(e);
  92154. };
  92155. _this.seekToLiveEdge_ = function(e) {
  92156. return _this.seekToLiveEdge(e);
  92157. };
  92158. _this.reset_();
  92159. _this.on(_this.player_, "durationchange", function(e) {
  92160. return _this.handleDurationchange(e);
  92161. });
  92162. _this.on(_this.player_, "canplay", function() {
  92163. return _this.toggleTracking();
  92164. });
  92165. if (IE_VERSION && "hidden" in document_1 && "visibilityState" in document_1) {
  92166. _this.on(document_1, "visibilitychange", _this.handleVisibilityChange_);
  92167. }
  92168. return _this;
  92169. }
  92170. var _proto = LiveTracker2.prototype;
  92171. _proto.handleVisibilityChange = function handleVisibilityChange() {
  92172. if (this.player_.duration() !== Infinity) {
  92173. return;
  92174. }
  92175. if (document_1.hidden) {
  92176. this.stopTracking();
  92177. } else {
  92178. this.startTracking();
  92179. }
  92180. };
  92181. _proto.trackLive_ = function trackLive_() {
  92182. var seekable3 = this.player_.seekable();
  92183. if (!seekable3 || !seekable3.length) {
  92184. return;
  92185. }
  92186. var newTime = Number(window_1.performance.now().toFixed(4));
  92187. var deltaTime = this.lastTime_ === -1 ? 0 : (newTime - this.lastTime_) / 1e3;
  92188. this.lastTime_ = newTime;
  92189. this.pastSeekEnd_ = this.pastSeekEnd() + deltaTime;
  92190. var liveCurrentTime = this.liveCurrentTime();
  92191. var currentTime = this.player_.currentTime();
  92192. var isBehind = this.player_.paused() || this.seekedBehindLive_ || Math.abs(liveCurrentTime - currentTime) > this.options_.liveTolerance;
  92193. if (!this.timeupdateSeen_ || liveCurrentTime === Infinity) {
  92194. isBehind = false;
  92195. }
  92196. if (isBehind !== this.behindLiveEdge_) {
  92197. this.behindLiveEdge_ = isBehind;
  92198. this.trigger("liveedgechange");
  92199. }
  92200. };
  92201. _proto.handleDurationchange = function handleDurationchange() {
  92202. this.toggleTracking();
  92203. };
  92204. _proto.toggleTracking = function toggleTracking() {
  92205. if (this.player_.duration() === Infinity && this.liveWindow() >= this.options_.trackingThreshold) {
  92206. if (this.player_.options_.liveui) {
  92207. this.player_.addClass("vjs-liveui");
  92208. }
  92209. this.startTracking();
  92210. } else {
  92211. this.player_.removeClass("vjs-liveui");
  92212. this.stopTracking();
  92213. }
  92214. };
  92215. _proto.startTracking = function startTracking() {
  92216. if (this.isTracking()) {
  92217. return;
  92218. }
  92219. if (!this.timeupdateSeen_) {
  92220. this.timeupdateSeen_ = this.player_.hasStarted();
  92221. }
  92222. this.trackingInterval_ = this.setInterval(this.trackLiveHandler_, UPDATE_REFRESH_INTERVAL);
  92223. this.trackLive_();
  92224. this.on(this.player_, ["play", "pause"], this.trackLiveHandler_);
  92225. if (!this.timeupdateSeen_) {
  92226. this.one(this.player_, "play", this.handlePlay_);
  92227. this.one(this.player_, "timeupdate", this.handleFirstTimeupdate_);
  92228. } else {
  92229. this.on(this.player_, "seeked", this.handleSeeked_);
  92230. }
  92231. };
  92232. _proto.handleFirstTimeupdate = function handleFirstTimeupdate() {
  92233. this.timeupdateSeen_ = true;
  92234. this.on(this.player_, "seeked", this.handleSeeked_);
  92235. };
  92236. _proto.handleSeeked = function handleSeeked() {
  92237. var timeDiff = Math.abs(this.liveCurrentTime() - this.player_.currentTime());
  92238. this.seekedBehindLive_ = this.nextSeekedFromUser_ && timeDiff > 2;
  92239. this.nextSeekedFromUser_ = false;
  92240. this.trackLive_();
  92241. };
  92242. _proto.handlePlay = function handlePlay() {
  92243. this.one(this.player_, "timeupdate", this.seekToLiveEdge_);
  92244. };
  92245. _proto.reset_ = function reset_() {
  92246. this.lastTime_ = -1;
  92247. this.pastSeekEnd_ = 0;
  92248. this.lastSeekEnd_ = -1;
  92249. this.behindLiveEdge_ = true;
  92250. this.timeupdateSeen_ = false;
  92251. this.seekedBehindLive_ = false;
  92252. this.nextSeekedFromUser_ = false;
  92253. this.clearInterval(this.trackingInterval_);
  92254. this.trackingInterval_ = null;
  92255. this.off(this.player_, ["play", "pause"], this.trackLiveHandler_);
  92256. this.off(this.player_, "seeked", this.handleSeeked_);
  92257. this.off(this.player_, "play", this.handlePlay_);
  92258. this.off(this.player_, "timeupdate", this.handleFirstTimeupdate_);
  92259. this.off(this.player_, "timeupdate", this.seekToLiveEdge_);
  92260. };
  92261. _proto.nextSeekedFromUser = function nextSeekedFromUser() {
  92262. this.nextSeekedFromUser_ = true;
  92263. };
  92264. _proto.stopTracking = function stopTracking() {
  92265. if (!this.isTracking()) {
  92266. return;
  92267. }
  92268. this.reset_();
  92269. this.trigger("liveedgechange");
  92270. };
  92271. _proto.seekableEnd = function seekableEnd() {
  92272. var seekable3 = this.player_.seekable();
  92273. var seekableEnds = [];
  92274. var i2 = seekable3 ? seekable3.length : 0;
  92275. while (i2--) {
  92276. seekableEnds.push(seekable3.end(i2));
  92277. }
  92278. return seekableEnds.length ? seekableEnds.sort()[seekableEnds.length - 1] : Infinity;
  92279. };
  92280. _proto.seekableStart = function seekableStart() {
  92281. var seekable3 = this.player_.seekable();
  92282. var seekableStarts = [];
  92283. var i2 = seekable3 ? seekable3.length : 0;
  92284. while (i2--) {
  92285. seekableStarts.push(seekable3.start(i2));
  92286. }
  92287. return seekableStarts.length ? seekableStarts.sort()[0] : 0;
  92288. };
  92289. _proto.liveWindow = function liveWindow() {
  92290. var liveCurrentTime = this.liveCurrentTime();
  92291. if (liveCurrentTime === Infinity) {
  92292. return 0;
  92293. }
  92294. return liveCurrentTime - this.seekableStart();
  92295. };
  92296. _proto.isLive = function isLive() {
  92297. return this.isTracking();
  92298. };
  92299. _proto.atLiveEdge = function atLiveEdge() {
  92300. return !this.behindLiveEdge();
  92301. };
  92302. _proto.liveCurrentTime = function liveCurrentTime() {
  92303. return this.pastSeekEnd() + this.seekableEnd();
  92304. };
  92305. _proto.pastSeekEnd = function pastSeekEnd() {
  92306. var seekableEnd = this.seekableEnd();
  92307. if (this.lastSeekEnd_ !== -1 && seekableEnd !== this.lastSeekEnd_) {
  92308. this.pastSeekEnd_ = 0;
  92309. }
  92310. this.lastSeekEnd_ = seekableEnd;
  92311. return this.pastSeekEnd_;
  92312. };
  92313. _proto.behindLiveEdge = function behindLiveEdge() {
  92314. return this.behindLiveEdge_;
  92315. };
  92316. _proto.isTracking = function isTracking() {
  92317. return typeof this.trackingInterval_ === "number";
  92318. };
  92319. _proto.seekToLiveEdge = function seekToLiveEdge() {
  92320. this.seekedBehindLive_ = false;
  92321. if (this.atLiveEdge()) {
  92322. return;
  92323. }
  92324. this.nextSeekedFromUser_ = false;
  92325. this.player_.currentTime(this.liveCurrentTime());
  92326. };
  92327. _proto.dispose = function dispose() {
  92328. this.off(document_1, "visibilitychange", this.handleVisibilityChange_);
  92329. this.stopTracking();
  92330. _Component.prototype.dispose.call(this);
  92331. };
  92332. return LiveTracker2;
  92333. }(Component$1);
  92334. Component$1.registerComponent("LiveTracker", LiveTracker);
  92335. var sourcesetLoad = function sourcesetLoad2(tech) {
  92336. var el = tech.el();
  92337. if (el.hasAttribute("src")) {
  92338. tech.triggerSourceset(el.src);
  92339. return true;
  92340. }
  92341. var sources = tech.$$("source");
  92342. var srcUrls = [];
  92343. var src = "";
  92344. if (!sources.length) {
  92345. return false;
  92346. }
  92347. for (var i2 = 0; i2 < sources.length; i2++) {
  92348. var url = sources[i2].src;
  92349. if (url && srcUrls.indexOf(url) === -1) {
  92350. srcUrls.push(url);
  92351. }
  92352. }
  92353. if (!srcUrls.length) {
  92354. return false;
  92355. }
  92356. if (srcUrls.length === 1) {
  92357. src = srcUrls[0];
  92358. }
  92359. tech.triggerSourceset(src);
  92360. return true;
  92361. };
  92362. var innerHTMLDescriptorPolyfill = Object.defineProperty({}, "innerHTML", {
  92363. get: function get2() {
  92364. return this.cloneNode(true).innerHTML;
  92365. },
  92366. set: function set2(v) {
  92367. var dummy = document_1.createElement(this.nodeName.toLowerCase());
  92368. dummy.innerHTML = v;
  92369. var docFrag = document_1.createDocumentFragment();
  92370. while (dummy.childNodes.length) {
  92371. docFrag.appendChild(dummy.childNodes[0]);
  92372. }
  92373. this.innerText = "";
  92374. window_1.Element.prototype.appendChild.call(this, docFrag);
  92375. return this.innerHTML;
  92376. }
  92377. });
  92378. var getDescriptor = function getDescriptor2(priority, prop) {
  92379. var descriptor = {};
  92380. for (var i2 = 0; i2 < priority.length; i2++) {
  92381. descriptor = Object.getOwnPropertyDescriptor(priority[i2], prop);
  92382. if (descriptor && descriptor.set && descriptor.get) {
  92383. break;
  92384. }
  92385. }
  92386. descriptor.enumerable = true;
  92387. descriptor.configurable = true;
  92388. return descriptor;
  92389. };
  92390. var getInnerHTMLDescriptor = function getInnerHTMLDescriptor2(tech) {
  92391. return getDescriptor([tech.el(), window_1.HTMLMediaElement.prototype, window_1.Element.prototype, innerHTMLDescriptorPolyfill], "innerHTML");
  92392. };
  92393. var firstSourceWatch = function firstSourceWatch2(tech) {
  92394. var el = tech.el();
  92395. if (el.resetSourceWatch_) {
  92396. return;
  92397. }
  92398. var old = {};
  92399. var innerDescriptor = getInnerHTMLDescriptor(tech);
  92400. var appendWrapper = function appendWrapper2(appendFn) {
  92401. return function() {
  92402. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  92403. args[_key] = arguments[_key];
  92404. }
  92405. var retval = appendFn.apply(el, args);
  92406. sourcesetLoad(tech);
  92407. return retval;
  92408. };
  92409. };
  92410. ["append", "appendChild", "insertAdjacentHTML"].forEach(function(k) {
  92411. if (!el[k]) {
  92412. return;
  92413. }
  92414. old[k] = el[k];
  92415. el[k] = appendWrapper(old[k]);
  92416. });
  92417. Object.defineProperty(el, "innerHTML", mergeOptions$3(innerDescriptor, {
  92418. set: appendWrapper(innerDescriptor.set)
  92419. }));
  92420. el.resetSourceWatch_ = function() {
  92421. el.resetSourceWatch_ = null;
  92422. Object.keys(old).forEach(function(k) {
  92423. el[k] = old[k];
  92424. });
  92425. Object.defineProperty(el, "innerHTML", innerDescriptor);
  92426. };
  92427. tech.one("sourceset", el.resetSourceWatch_);
  92428. };
  92429. var srcDescriptorPolyfill = Object.defineProperty({}, "src", {
  92430. get: function get3() {
  92431. if (this.hasAttribute("src")) {
  92432. return getAbsoluteURL(window_1.Element.prototype.getAttribute.call(this, "src"));
  92433. }
  92434. return "";
  92435. },
  92436. set: function set3(v) {
  92437. window_1.Element.prototype.setAttribute.call(this, "src", v);
  92438. return v;
  92439. }
  92440. });
  92441. var getSrcDescriptor = function getSrcDescriptor2(tech) {
  92442. return getDescriptor([tech.el(), window_1.HTMLMediaElement.prototype, srcDescriptorPolyfill], "src");
  92443. };
  92444. var setupSourceset = function setupSourceset2(tech) {
  92445. if (!tech.featuresSourceset) {
  92446. return;
  92447. }
  92448. var el = tech.el();
  92449. if (el.resetSourceset_) {
  92450. return;
  92451. }
  92452. var srcDescriptor = getSrcDescriptor(tech);
  92453. var oldSetAttribute = el.setAttribute;
  92454. var oldLoad = el.load;
  92455. Object.defineProperty(el, "src", mergeOptions$3(srcDescriptor, {
  92456. set: function set4(v) {
  92457. var retval = srcDescriptor.set.call(el, v);
  92458. tech.triggerSourceset(el.src);
  92459. return retval;
  92460. }
  92461. }));
  92462. el.setAttribute = function(n, v) {
  92463. var retval = oldSetAttribute.call(el, n, v);
  92464. if (/src/i.test(n)) {
  92465. tech.triggerSourceset(el.src);
  92466. }
  92467. return retval;
  92468. };
  92469. el.load = function() {
  92470. var retval = oldLoad.call(el);
  92471. if (!sourcesetLoad(tech)) {
  92472. tech.triggerSourceset("");
  92473. firstSourceWatch(tech);
  92474. }
  92475. return retval;
  92476. };
  92477. if (el.currentSrc) {
  92478. tech.triggerSourceset(el.currentSrc);
  92479. } else if (!sourcesetLoad(tech)) {
  92480. firstSourceWatch(tech);
  92481. }
  92482. el.resetSourceset_ = function() {
  92483. el.resetSourceset_ = null;
  92484. el.load = oldLoad;
  92485. el.setAttribute = oldSetAttribute;
  92486. Object.defineProperty(el, "src", srcDescriptor);
  92487. if (el.resetSourceWatch_) {
  92488. el.resetSourceWatch_();
  92489. }
  92490. };
  92491. };
  92492. var defineLazyProperty = function defineLazyProperty2(obj, key, getValue2, setter) {
  92493. if (setter === void 0) {
  92494. setter = true;
  92495. }
  92496. var set4 = function set5(value) {
  92497. return Object.defineProperty(obj, key, {
  92498. value,
  92499. enumerable: true,
  92500. writable: true
  92501. });
  92502. };
  92503. var options2 = {
  92504. configurable: true,
  92505. enumerable: true,
  92506. get: function get7() {
  92507. var value = getValue2();
  92508. set4(value);
  92509. return value;
  92510. }
  92511. };
  92512. if (setter) {
  92513. options2.set = set4;
  92514. }
  92515. return Object.defineProperty(obj, key, options2);
  92516. };
  92517. var Html5$1 = /* @__PURE__ */ function(_Tech) {
  92518. _inheritsLoose(Html52, _Tech);
  92519. function Html52(options2, ready) {
  92520. var _this;
  92521. _this = _Tech.call(this, options2, ready) || this;
  92522. var source = options2.source;
  92523. var crossoriginTracks = false;
  92524. _this.featuresVideoFrameCallback = _this.featuresVideoFrameCallback && _this.el_.tagName === "VIDEO";
  92525. if (source && (_this.el_.currentSrc !== source.src || options2.tag && options2.tag.initNetworkState_ === 3)) {
  92526. _this.setSource(source);
  92527. } else {
  92528. _this.handleLateInit_(_this.el_);
  92529. }
  92530. if (options2.enableSourceset) {
  92531. _this.setupSourcesetHandling_();
  92532. }
  92533. _this.isScrubbing_ = false;
  92534. if (_this.el_.hasChildNodes()) {
  92535. var nodes = _this.el_.childNodes;
  92536. var nodesLength = nodes.length;
  92537. var removeNodes = [];
  92538. while (nodesLength--) {
  92539. var node = nodes[nodesLength];
  92540. var nodeName = node.nodeName.toLowerCase();
  92541. if (nodeName === "track") {
  92542. if (!_this.featuresNativeTextTracks) {
  92543. removeNodes.push(node);
  92544. } else {
  92545. _this.remoteTextTrackEls().addTrackElement_(node);
  92546. _this.remoteTextTracks().addTrack(node.track);
  92547. _this.textTracks().addTrack(node.track);
  92548. if (!crossoriginTracks && !_this.el_.hasAttribute("crossorigin") && isCrossOrigin(node.src)) {
  92549. crossoriginTracks = true;
  92550. }
  92551. }
  92552. }
  92553. }
  92554. for (var i2 = 0; i2 < removeNodes.length; i2++) {
  92555. _this.el_.removeChild(removeNodes[i2]);
  92556. }
  92557. }
  92558. _this.proxyNativeTracks_();
  92559. if (_this.featuresNativeTextTracks && crossoriginTracks) {
  92560. log$1.warn("Text Tracks are being loaded from another origin but the crossorigin attribute isn't used.\nThis may prevent text tracks from loading.");
  92561. }
  92562. _this.restoreMetadataTracksInIOSNativePlayer_();
  92563. if ((TOUCH_ENABLED || IS_IPHONE || IS_NATIVE_ANDROID) && options2.nativeControlsForTouch === true) {
  92564. _this.setControls(true);
  92565. }
  92566. _this.proxyWebkitFullscreen_();
  92567. _this.triggerReady();
  92568. return _this;
  92569. }
  92570. var _proto = Html52.prototype;
  92571. _proto.dispose = function dispose() {
  92572. if (this.el_ && this.el_.resetSourceset_) {
  92573. this.el_.resetSourceset_();
  92574. }
  92575. Html52.disposeMediaElement(this.el_);
  92576. this.options_ = null;
  92577. _Tech.prototype.dispose.call(this);
  92578. };
  92579. _proto.setupSourcesetHandling_ = function setupSourcesetHandling_() {
  92580. setupSourceset(this);
  92581. };
  92582. _proto.restoreMetadataTracksInIOSNativePlayer_ = function restoreMetadataTracksInIOSNativePlayer_() {
  92583. var textTracks = this.textTracks();
  92584. var metadataTracksPreFullscreenState;
  92585. var takeMetadataTrackSnapshot = function takeMetadataTrackSnapshot2() {
  92586. metadataTracksPreFullscreenState = [];
  92587. for (var i2 = 0; i2 < textTracks.length; i2++) {
  92588. var track = textTracks[i2];
  92589. if (track.kind === "metadata") {
  92590. metadataTracksPreFullscreenState.push({
  92591. track,
  92592. storedMode: track.mode
  92593. });
  92594. }
  92595. }
  92596. };
  92597. takeMetadataTrackSnapshot();
  92598. textTracks.addEventListener("change", takeMetadataTrackSnapshot);
  92599. this.on("dispose", function() {
  92600. return textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  92601. });
  92602. var restoreTrackMode = function restoreTrackMode2() {
  92603. for (var i2 = 0; i2 < metadataTracksPreFullscreenState.length; i2++) {
  92604. var storedTrack = metadataTracksPreFullscreenState[i2];
  92605. if (storedTrack.track.mode === "disabled" && storedTrack.track.mode !== storedTrack.storedMode) {
  92606. storedTrack.track.mode = storedTrack.storedMode;
  92607. }
  92608. }
  92609. textTracks.removeEventListener("change", restoreTrackMode2);
  92610. };
  92611. this.on("webkitbeginfullscreen", function() {
  92612. textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  92613. textTracks.removeEventListener("change", restoreTrackMode);
  92614. textTracks.addEventListener("change", restoreTrackMode);
  92615. });
  92616. this.on("webkitendfullscreen", function() {
  92617. textTracks.removeEventListener("change", takeMetadataTrackSnapshot);
  92618. textTracks.addEventListener("change", takeMetadataTrackSnapshot);
  92619. textTracks.removeEventListener("change", restoreTrackMode);
  92620. });
  92621. };
  92622. _proto.overrideNative_ = function overrideNative_(type2, override) {
  92623. var _this2 = this;
  92624. if (override !== this["featuresNative" + type2 + "Tracks"]) {
  92625. return;
  92626. }
  92627. var lowerCaseType = type2.toLowerCase();
  92628. if (this[lowerCaseType + "TracksListeners_"]) {
  92629. Object.keys(this[lowerCaseType + "TracksListeners_"]).forEach(function(eventName) {
  92630. var elTracks = _this2.el()[lowerCaseType + "Tracks"];
  92631. elTracks.removeEventListener(eventName, _this2[lowerCaseType + "TracksListeners_"][eventName]);
  92632. });
  92633. }
  92634. this["featuresNative" + type2 + "Tracks"] = !override;
  92635. this[lowerCaseType + "TracksListeners_"] = null;
  92636. this.proxyNativeTracksForType_(lowerCaseType);
  92637. };
  92638. _proto.overrideNativeAudioTracks = function overrideNativeAudioTracks(override) {
  92639. this.overrideNative_("Audio", override);
  92640. };
  92641. _proto.overrideNativeVideoTracks = function overrideNativeVideoTracks(override) {
  92642. this.overrideNative_("Video", override);
  92643. };
  92644. _proto.proxyNativeTracksForType_ = function proxyNativeTracksForType_(name) {
  92645. var _this3 = this;
  92646. var props = NORMAL[name];
  92647. var elTracks = this.el()[props.getterName];
  92648. var techTracks = this[props.getterName]();
  92649. if (!this["featuresNative" + props.capitalName + "Tracks"] || !elTracks || !elTracks.addEventListener) {
  92650. return;
  92651. }
  92652. var listeners = {
  92653. change: function change(e) {
  92654. var event2 = {
  92655. type: "change",
  92656. target: techTracks,
  92657. currentTarget: techTracks,
  92658. srcElement: techTracks
  92659. };
  92660. techTracks.trigger(event2);
  92661. if (name === "text") {
  92662. _this3[REMOTE.remoteText.getterName]().trigger(event2);
  92663. }
  92664. },
  92665. addtrack: function addtrack(e) {
  92666. techTracks.addTrack(e.track);
  92667. },
  92668. removetrack: function removetrack(e) {
  92669. techTracks.removeTrack(e.track);
  92670. }
  92671. };
  92672. var removeOldTracks = function removeOldTracks2() {
  92673. var removeTracks = [];
  92674. for (var i2 = 0; i2 < techTracks.length; i2++) {
  92675. var found = false;
  92676. for (var j = 0; j < elTracks.length; j++) {
  92677. if (elTracks[j] === techTracks[i2]) {
  92678. found = true;
  92679. break;
  92680. }
  92681. }
  92682. if (!found) {
  92683. removeTracks.push(techTracks[i2]);
  92684. }
  92685. }
  92686. while (removeTracks.length) {
  92687. techTracks.removeTrack(removeTracks.shift());
  92688. }
  92689. };
  92690. this[props.getterName + "Listeners_"] = listeners;
  92691. Object.keys(listeners).forEach(function(eventName) {
  92692. var listener = listeners[eventName];
  92693. elTracks.addEventListener(eventName, listener);
  92694. _this3.on("dispose", function(e) {
  92695. return elTracks.removeEventListener(eventName, listener);
  92696. });
  92697. });
  92698. this.on("loadstart", removeOldTracks);
  92699. this.on("dispose", function(e) {
  92700. return _this3.off("loadstart", removeOldTracks);
  92701. });
  92702. };
  92703. _proto.proxyNativeTracks_ = function proxyNativeTracks_() {
  92704. var _this4 = this;
  92705. NORMAL.names.forEach(function(name) {
  92706. _this4.proxyNativeTracksForType_(name);
  92707. });
  92708. };
  92709. _proto.createEl = function createEl2() {
  92710. var el = this.options_.tag;
  92711. if (!el || !(this.options_.playerElIngest || this.movingMediaElementInDOM)) {
  92712. if (el) {
  92713. var clone = el.cloneNode(true);
  92714. if (el.parentNode) {
  92715. el.parentNode.insertBefore(clone, el);
  92716. }
  92717. Html52.disposeMediaElement(el);
  92718. el = clone;
  92719. } else {
  92720. el = document_1.createElement("video");
  92721. var tagAttributes = this.options_.tag && getAttributes(this.options_.tag);
  92722. var attributes = mergeOptions$3({}, tagAttributes);
  92723. if (!TOUCH_ENABLED || this.options_.nativeControlsForTouch !== true) {
  92724. delete attributes.controls;
  92725. }
  92726. setAttributes(el, assign(attributes, {
  92727. id: this.options_.techId,
  92728. "class": "vjs-tech"
  92729. }));
  92730. }
  92731. el.playerId = this.options_.playerId;
  92732. }
  92733. if (typeof this.options_.preload !== "undefined") {
  92734. setAttribute(el, "preload", this.options_.preload);
  92735. }
  92736. if (this.options_.disablePictureInPicture !== void 0) {
  92737. el.disablePictureInPicture = this.options_.disablePictureInPicture;
  92738. }
  92739. var settingsAttrs = ["loop", "muted", "playsinline", "autoplay"];
  92740. for (var i2 = 0; i2 < settingsAttrs.length; i2++) {
  92741. var attr = settingsAttrs[i2];
  92742. var value = this.options_[attr];
  92743. if (typeof value !== "undefined") {
  92744. if (value) {
  92745. setAttribute(el, attr, attr);
  92746. } else {
  92747. removeAttribute(el, attr);
  92748. }
  92749. el[attr] = value;
  92750. }
  92751. }
  92752. return el;
  92753. };
  92754. _proto.handleLateInit_ = function handleLateInit_(el) {
  92755. if (el.networkState === 0 || el.networkState === 3) {
  92756. return;
  92757. }
  92758. if (el.readyState === 0) {
  92759. var loadstartFired = false;
  92760. var setLoadstartFired = function setLoadstartFired2() {
  92761. loadstartFired = true;
  92762. };
  92763. this.on("loadstart", setLoadstartFired);
  92764. var triggerLoadstart = function triggerLoadstart2() {
  92765. if (!loadstartFired) {
  92766. this.trigger("loadstart");
  92767. }
  92768. };
  92769. this.on("loadedmetadata", triggerLoadstart);
  92770. this.ready(function() {
  92771. this.off("loadstart", setLoadstartFired);
  92772. this.off("loadedmetadata", triggerLoadstart);
  92773. if (!loadstartFired) {
  92774. this.trigger("loadstart");
  92775. }
  92776. });
  92777. return;
  92778. }
  92779. var eventsToTrigger = ["loadstart"];
  92780. eventsToTrigger.push("loadedmetadata");
  92781. if (el.readyState >= 2) {
  92782. eventsToTrigger.push("loadeddata");
  92783. }
  92784. if (el.readyState >= 3) {
  92785. eventsToTrigger.push("canplay");
  92786. }
  92787. if (el.readyState >= 4) {
  92788. eventsToTrigger.push("canplaythrough");
  92789. }
  92790. this.ready(function() {
  92791. eventsToTrigger.forEach(function(type2) {
  92792. this.trigger(type2);
  92793. }, this);
  92794. });
  92795. };
  92796. _proto.setScrubbing = function setScrubbing(isScrubbing) {
  92797. this.isScrubbing_ = isScrubbing;
  92798. };
  92799. _proto.scrubbing = function scrubbing() {
  92800. return this.isScrubbing_;
  92801. };
  92802. _proto.setCurrentTime = function setCurrentTime(seconds) {
  92803. try {
  92804. if (this.isScrubbing_ && this.el_.fastSeek && IS_ANY_SAFARI) {
  92805. this.el_.fastSeek(seconds);
  92806. } else {
  92807. this.el_.currentTime = seconds;
  92808. }
  92809. } catch (e) {
  92810. log$1(e, "Video is not ready. (Video.js)");
  92811. }
  92812. };
  92813. _proto.duration = function duration5() {
  92814. var _this5 = this;
  92815. if (this.el_.duration === Infinity && IS_ANDROID && IS_CHROME && this.el_.currentTime === 0) {
  92816. var checkProgress = function checkProgress2() {
  92817. if (_this5.el_.currentTime > 0) {
  92818. if (_this5.el_.duration === Infinity) {
  92819. _this5.trigger("durationchange");
  92820. }
  92821. _this5.off("timeupdate", checkProgress2);
  92822. }
  92823. };
  92824. this.on("timeupdate", checkProgress);
  92825. return NaN;
  92826. }
  92827. return this.el_.duration || NaN;
  92828. };
  92829. _proto.width = function width2() {
  92830. return this.el_.offsetWidth;
  92831. };
  92832. _proto.height = function height2() {
  92833. return this.el_.offsetHeight;
  92834. };
  92835. _proto.proxyWebkitFullscreen_ = function proxyWebkitFullscreen_() {
  92836. var _this6 = this;
  92837. if (!("webkitDisplayingFullscreen" in this.el_)) {
  92838. return;
  92839. }
  92840. var endFn = function endFn2() {
  92841. this.trigger("fullscreenchange", {
  92842. isFullscreen: false
  92843. });
  92844. if (this.el_.controls && !this.options_.nativeControlsForTouch && this.controls()) {
  92845. this.el_.controls = false;
  92846. }
  92847. };
  92848. var beginFn = function beginFn2() {
  92849. if ("webkitPresentationMode" in this.el_ && this.el_.webkitPresentationMode !== "picture-in-picture") {
  92850. this.one("webkitendfullscreen", endFn);
  92851. this.trigger("fullscreenchange", {
  92852. isFullscreen: true,
  92853. nativeIOSFullscreen: true
  92854. });
  92855. }
  92856. };
  92857. this.on("webkitbeginfullscreen", beginFn);
  92858. this.on("dispose", function() {
  92859. _this6.off("webkitbeginfullscreen", beginFn);
  92860. _this6.off("webkitendfullscreen", endFn);
  92861. });
  92862. };
  92863. _proto.supportsFullScreen = function supportsFullScreen() {
  92864. if (typeof this.el_.webkitEnterFullScreen === "function") {
  92865. var userAgent = window_1.navigator && window_1.navigator.userAgent || "";
  92866. if (/Android/.test(userAgent) || !/Chrome|Mac OS X 10.5/.test(userAgent)) {
  92867. return true;
  92868. }
  92869. }
  92870. return false;
  92871. };
  92872. _proto.enterFullScreen = function enterFullScreen() {
  92873. var video = this.el_;
  92874. if (video.paused && video.networkState <= video.HAVE_METADATA) {
  92875. silencePromise(this.el_.play());
  92876. this.setTimeout(function() {
  92877. video.pause();
  92878. try {
  92879. video.webkitEnterFullScreen();
  92880. } catch (e) {
  92881. this.trigger("fullscreenerror", e);
  92882. }
  92883. }, 0);
  92884. } else {
  92885. try {
  92886. video.webkitEnterFullScreen();
  92887. } catch (e) {
  92888. this.trigger("fullscreenerror", e);
  92889. }
  92890. }
  92891. };
  92892. _proto.exitFullScreen = function exitFullScreen() {
  92893. if (!this.el_.webkitDisplayingFullscreen) {
  92894. this.trigger("fullscreenerror", new Error("The video is not fullscreen"));
  92895. return;
  92896. }
  92897. this.el_.webkitExitFullScreen();
  92898. };
  92899. _proto.requestPictureInPicture = function requestPictureInPicture() {
  92900. return this.el_.requestPictureInPicture();
  92901. };
  92902. _proto.requestVideoFrameCallback = function requestVideoFrameCallback(cb) {
  92903. if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {
  92904. return this.el_.requestVideoFrameCallback(cb);
  92905. }
  92906. return _Tech.prototype.requestVideoFrameCallback.call(this, cb);
  92907. };
  92908. _proto.cancelVideoFrameCallback = function cancelVideoFrameCallback(id) {
  92909. if (this.featuresVideoFrameCallback && !this.el_.webkitKeys) {
  92910. this.el_.cancelVideoFrameCallback(id);
  92911. } else {
  92912. _Tech.prototype.cancelVideoFrameCallback.call(this, id);
  92913. }
  92914. };
  92915. _proto.src = function src(_src) {
  92916. if (_src === void 0) {
  92917. return this.el_.src;
  92918. }
  92919. this.setSrc(_src);
  92920. };
  92921. _proto.reset = function reset3() {
  92922. Html52.resetMediaElement(this.el_);
  92923. };
  92924. _proto.currentSrc = function currentSrc() {
  92925. if (this.currentSource_) {
  92926. return this.currentSource_.src;
  92927. }
  92928. return this.el_.currentSrc;
  92929. };
  92930. _proto.setControls = function setControls(val) {
  92931. this.el_.controls = !!val;
  92932. };
  92933. _proto.addTextTrack = function addTextTrack(kind, label, language) {
  92934. if (!this.featuresNativeTextTracks) {
  92935. return _Tech.prototype.addTextTrack.call(this, kind, label, language);
  92936. }
  92937. return this.el_.addTextTrack(kind, label, language);
  92938. };
  92939. _proto.createRemoteTextTrack = function createRemoteTextTrack(options2) {
  92940. if (!this.featuresNativeTextTracks) {
  92941. return _Tech.prototype.createRemoteTextTrack.call(this, options2);
  92942. }
  92943. var htmlTrackElement = document_1.createElement("track");
  92944. if (options2.kind) {
  92945. htmlTrackElement.kind = options2.kind;
  92946. }
  92947. if (options2.label) {
  92948. htmlTrackElement.label = options2.label;
  92949. }
  92950. if (options2.language || options2.srclang) {
  92951. htmlTrackElement.srclang = options2.language || options2.srclang;
  92952. }
  92953. if (options2["default"]) {
  92954. htmlTrackElement["default"] = options2["default"];
  92955. }
  92956. if (options2.id) {
  92957. htmlTrackElement.id = options2.id;
  92958. }
  92959. if (options2.src) {
  92960. htmlTrackElement.src = options2.src;
  92961. }
  92962. return htmlTrackElement;
  92963. };
  92964. _proto.addRemoteTextTrack = function addRemoteTextTrack(options2, manualCleanup) {
  92965. var htmlTrackElement = _Tech.prototype.addRemoteTextTrack.call(this, options2, manualCleanup);
  92966. if (this.featuresNativeTextTracks) {
  92967. this.el().appendChild(htmlTrackElement);
  92968. }
  92969. return htmlTrackElement;
  92970. };
  92971. _proto.removeRemoteTextTrack = function removeRemoteTextTrack(track) {
  92972. _Tech.prototype.removeRemoteTextTrack.call(this, track);
  92973. if (this.featuresNativeTextTracks) {
  92974. var tracks = this.$$("track");
  92975. var i2 = tracks.length;
  92976. while (i2--) {
  92977. if (track === tracks[i2] || track === tracks[i2].track) {
  92978. this.el().removeChild(tracks[i2]);
  92979. }
  92980. }
  92981. }
  92982. };
  92983. _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
  92984. if (typeof this.el().getVideoPlaybackQuality === "function") {
  92985. return this.el().getVideoPlaybackQuality();
  92986. }
  92987. var videoPlaybackQuality = {};
  92988. if (typeof this.el().webkitDroppedFrameCount !== "undefined" && typeof this.el().webkitDecodedFrameCount !== "undefined") {
  92989. videoPlaybackQuality.droppedVideoFrames = this.el().webkitDroppedFrameCount;
  92990. videoPlaybackQuality.totalVideoFrames = this.el().webkitDecodedFrameCount;
  92991. }
  92992. if (window_1.performance && typeof window_1.performance.now === "function") {
  92993. videoPlaybackQuality.creationTime = window_1.performance.now();
  92994. } else if (window_1.performance && window_1.performance.timing && typeof window_1.performance.timing.navigationStart === "number") {
  92995. videoPlaybackQuality.creationTime = window_1.Date.now() - window_1.performance.timing.navigationStart;
  92996. }
  92997. return videoPlaybackQuality;
  92998. };
  92999. return Html52;
  93000. }(Tech$1);
  93001. defineLazyProperty(Html5$1, "TEST_VID", function() {
  93002. if (!isReal()) {
  93003. return;
  93004. }
  93005. var video = document_1.createElement("video");
  93006. var track = document_1.createElement("track");
  93007. track.kind = "captions";
  93008. track.srclang = "en";
  93009. track.label = "English";
  93010. video.appendChild(track);
  93011. return video;
  93012. });
  93013. Html5$1.isSupported = function() {
  93014. try {
  93015. Html5$1.TEST_VID.volume = 0.5;
  93016. } catch (e) {
  93017. return false;
  93018. }
  93019. return !!(Html5$1.TEST_VID && Html5$1.TEST_VID.canPlayType);
  93020. };
  93021. Html5$1.canPlayType = function(type2) {
  93022. return Html5$1.TEST_VID.canPlayType(type2);
  93023. };
  93024. Html5$1.canPlaySource = function(srcObj, options2) {
  93025. return Html5$1.canPlayType(srcObj.type);
  93026. };
  93027. Html5$1.canControlVolume = function() {
  93028. try {
  93029. var volume = Html5$1.TEST_VID.volume;
  93030. Html5$1.TEST_VID.volume = volume / 2 + 0.1;
  93031. var canControl = volume !== Html5$1.TEST_VID.volume;
  93032. if (canControl && IS_IOS) {
  93033. window_1.setTimeout(function() {
  93034. if (Html5$1 && Html5$1.prototype) {
  93035. Html5$1.prototype.featuresVolumeControl = volume !== Html5$1.TEST_VID.volume;
  93036. }
  93037. });
  93038. return false;
  93039. }
  93040. return canControl;
  93041. } catch (e) {
  93042. return false;
  93043. }
  93044. };
  93045. Html5$1.canMuteVolume = function() {
  93046. try {
  93047. var muted = Html5$1.TEST_VID.muted;
  93048. Html5$1.TEST_VID.muted = !muted;
  93049. if (Html5$1.TEST_VID.muted) {
  93050. setAttribute(Html5$1.TEST_VID, "muted", "muted");
  93051. } else {
  93052. removeAttribute(Html5$1.TEST_VID, "muted", "muted");
  93053. }
  93054. return muted !== Html5$1.TEST_VID.muted;
  93055. } catch (e) {
  93056. return false;
  93057. }
  93058. };
  93059. Html5$1.canControlPlaybackRate = function() {
  93060. if (IS_ANDROID && IS_CHROME && CHROME_VERSION < 58) {
  93061. return false;
  93062. }
  93063. try {
  93064. var playbackRate = Html5$1.TEST_VID.playbackRate;
  93065. Html5$1.TEST_VID.playbackRate = playbackRate / 2 + 0.1;
  93066. return playbackRate !== Html5$1.TEST_VID.playbackRate;
  93067. } catch (e) {
  93068. return false;
  93069. }
  93070. };
  93071. Html5$1.canOverrideAttributes = function() {
  93072. try {
  93073. var noop2 = function noop3() {
  93074. };
  93075. Object.defineProperty(document_1.createElement("video"), "src", {
  93076. get: noop2,
  93077. set: noop2
  93078. });
  93079. Object.defineProperty(document_1.createElement("audio"), "src", {
  93080. get: noop2,
  93081. set: noop2
  93082. });
  93083. Object.defineProperty(document_1.createElement("video"), "innerHTML", {
  93084. get: noop2,
  93085. set: noop2
  93086. });
  93087. Object.defineProperty(document_1.createElement("audio"), "innerHTML", {
  93088. get: noop2,
  93089. set: noop2
  93090. });
  93091. } catch (e) {
  93092. return false;
  93093. }
  93094. return true;
  93095. };
  93096. Html5$1.supportsNativeTextTracks = function() {
  93097. return IS_ANY_SAFARI || IS_IOS && IS_CHROME;
  93098. };
  93099. Html5$1.supportsNativeVideoTracks = function() {
  93100. return !!(Html5$1.TEST_VID && Html5$1.TEST_VID.videoTracks);
  93101. };
  93102. Html5$1.supportsNativeAudioTracks = function() {
  93103. return !!(Html5$1.TEST_VID && Html5$1.TEST_VID.audioTracks);
  93104. };
  93105. Html5$1.Events = ["loadstart", "suspend", "abort", "error", "emptied", "stalled", "loadedmetadata", "loadeddata", "canplay", "canplaythrough", "playing", "waiting", "seeking", "seeked", "ended", "durationchange", "timeupdate", "progress", "play", "pause", "ratechange", "resize", "volumechange"];
  93106. [["featuresMuteControl", "canMuteVolume"], ["featuresPlaybackRate", "canControlPlaybackRate"], ["featuresSourceset", "canOverrideAttributes"], ["featuresNativeTextTracks", "supportsNativeTextTracks"], ["featuresNativeVideoTracks", "supportsNativeVideoTracks"], ["featuresNativeAudioTracks", "supportsNativeAudioTracks"]].forEach(function(_ref) {
  93107. var key = _ref[0], fn2 = _ref[1];
  93108. defineLazyProperty(Html5$1.prototype, key, function() {
  93109. return Html5$1[fn2]();
  93110. }, true);
  93111. });
  93112. Html5$1.prototype.featuresVolumeControl = Html5$1.canControlVolume();
  93113. Html5$1.prototype.movingMediaElementInDOM = !IS_IOS;
  93114. Html5$1.prototype.featuresFullscreenResize = true;
  93115. Html5$1.prototype.featuresProgressEvents = true;
  93116. Html5$1.prototype.featuresTimeupdateEvents = true;
  93117. Html5$1.prototype.featuresVideoFrameCallback = !!(Html5$1.TEST_VID && Html5$1.TEST_VID.requestVideoFrameCallback);
  93118. var canPlayType;
  93119. Html5$1.patchCanPlayType = function() {
  93120. if (ANDROID_VERSION >= 4 && !IS_FIREFOX && !IS_CHROME) {
  93121. canPlayType = Html5$1.TEST_VID && Html5$1.TEST_VID.constructor.prototype.canPlayType;
  93122. Html5$1.TEST_VID.constructor.prototype.canPlayType = function(type2) {
  93123. var mpegurlRE = /^application\/(?:x-|vnd\.apple\.)mpegurl/i;
  93124. if (type2 && mpegurlRE.test(type2)) {
  93125. return "maybe";
  93126. }
  93127. return canPlayType.call(this, type2);
  93128. };
  93129. }
  93130. };
  93131. Html5$1.unpatchCanPlayType = function() {
  93132. var r2 = Html5$1.TEST_VID.constructor.prototype.canPlayType;
  93133. if (canPlayType) {
  93134. Html5$1.TEST_VID.constructor.prototype.canPlayType = canPlayType;
  93135. }
  93136. return r2;
  93137. };
  93138. Html5$1.patchCanPlayType();
  93139. Html5$1.disposeMediaElement = function(el) {
  93140. if (!el) {
  93141. return;
  93142. }
  93143. if (el.parentNode) {
  93144. el.parentNode.removeChild(el);
  93145. }
  93146. while (el.hasChildNodes()) {
  93147. el.removeChild(el.firstChild);
  93148. }
  93149. el.removeAttribute("src");
  93150. if (typeof el.load === "function") {
  93151. (function() {
  93152. try {
  93153. el.load();
  93154. } catch (e) {
  93155. }
  93156. })();
  93157. }
  93158. };
  93159. Html5$1.resetMediaElement = function(el) {
  93160. if (!el) {
  93161. return;
  93162. }
  93163. var sources = el.querySelectorAll("source");
  93164. var i2 = sources.length;
  93165. while (i2--) {
  93166. el.removeChild(sources[i2]);
  93167. }
  93168. el.removeAttribute("src");
  93169. if (typeof el.load === "function") {
  93170. (function() {
  93171. try {
  93172. el.load();
  93173. } catch (e) {
  93174. }
  93175. })();
  93176. }
  93177. };
  93178. [
  93179. "muted",
  93180. "defaultMuted",
  93181. "autoplay",
  93182. "controls",
  93183. "loop",
  93184. "playsinline"
  93185. ].forEach(function(prop) {
  93186. Html5$1.prototype[prop] = function() {
  93187. return this.el_[prop] || this.el_.hasAttribute(prop);
  93188. };
  93189. });
  93190. [
  93191. "muted",
  93192. "defaultMuted",
  93193. "autoplay",
  93194. "loop",
  93195. "playsinline"
  93196. ].forEach(function(prop) {
  93197. Html5$1.prototype["set" + toTitleCase$1(prop)] = function(v) {
  93198. this.el_[prop] = v;
  93199. if (v) {
  93200. this.el_.setAttribute(prop, prop);
  93201. } else {
  93202. this.el_.removeAttribute(prop);
  93203. }
  93204. };
  93205. });
  93206. [
  93207. "paused",
  93208. "currentTime",
  93209. "buffered",
  93210. "volume",
  93211. "poster",
  93212. "preload",
  93213. "error",
  93214. "seeking",
  93215. "seekable",
  93216. "ended",
  93217. "playbackRate",
  93218. "defaultPlaybackRate",
  93219. "disablePictureInPicture",
  93220. "played",
  93221. "networkState",
  93222. "readyState",
  93223. "videoWidth",
  93224. "videoHeight",
  93225. "crossOrigin"
  93226. ].forEach(function(prop) {
  93227. Html5$1.prototype[prop] = function() {
  93228. return this.el_[prop];
  93229. };
  93230. });
  93231. [
  93232. "volume",
  93233. "src",
  93234. "poster",
  93235. "preload",
  93236. "playbackRate",
  93237. "defaultPlaybackRate",
  93238. "disablePictureInPicture",
  93239. "crossOrigin"
  93240. ].forEach(function(prop) {
  93241. Html5$1.prototype["set" + toTitleCase$1(prop)] = function(v) {
  93242. this.el_[prop] = v;
  93243. };
  93244. });
  93245. [
  93246. "pause",
  93247. "load",
  93248. "play"
  93249. ].forEach(function(prop) {
  93250. Html5$1.prototype[prop] = function() {
  93251. return this.el_[prop]();
  93252. };
  93253. });
  93254. Tech$1.withSourceHandlers(Html5$1);
  93255. Html5$1.nativeSourceHandler = {};
  93256. Html5$1.nativeSourceHandler.canPlayType = function(type2) {
  93257. try {
  93258. return Html5$1.TEST_VID.canPlayType(type2);
  93259. } catch (e) {
  93260. return "";
  93261. }
  93262. };
  93263. Html5$1.nativeSourceHandler.canHandleSource = function(source, options2) {
  93264. if (source.type) {
  93265. return Html5$1.nativeSourceHandler.canPlayType(source.type);
  93266. } else if (source.src) {
  93267. var ext = getFileExtension(source.src);
  93268. return Html5$1.nativeSourceHandler.canPlayType("video/" + ext);
  93269. }
  93270. return "";
  93271. };
  93272. Html5$1.nativeSourceHandler.handleSource = function(source, tech, options2) {
  93273. tech.setSrc(source.src);
  93274. };
  93275. Html5$1.nativeSourceHandler.dispose = function() {
  93276. };
  93277. Html5$1.registerSourceHandler(Html5$1.nativeSourceHandler);
  93278. Tech$1.registerTech("Html5", Html5$1);
  93279. var TECH_EVENTS_RETRIGGER = [
  93280. "progress",
  93281. "abort",
  93282. "suspend",
  93283. "emptied",
  93284. "stalled",
  93285. "loadedmetadata",
  93286. "loadeddata",
  93287. "timeupdate",
  93288. "resize",
  93289. "volumechange",
  93290. "texttrackchange"
  93291. ];
  93292. var TECH_EVENTS_QUEUE = {
  93293. canplay: "CanPlay",
  93294. canplaythrough: "CanPlayThrough",
  93295. playing: "Playing",
  93296. seeked: "Seeked"
  93297. };
  93298. var BREAKPOINT_ORDER = ["tiny", "xsmall", "small", "medium", "large", "xlarge", "huge"];
  93299. var BREAKPOINT_CLASSES = {};
  93300. BREAKPOINT_ORDER.forEach(function(k) {
  93301. var v = k.charAt(0) === "x" ? "x-" + k.substring(1) : k;
  93302. BREAKPOINT_CLASSES[k] = "vjs-layout-" + v;
  93303. });
  93304. var DEFAULT_BREAKPOINTS = {
  93305. tiny: 210,
  93306. xsmall: 320,
  93307. small: 425,
  93308. medium: 768,
  93309. large: 1440,
  93310. xlarge: 2560,
  93311. huge: Infinity
  93312. };
  93313. var Player = /* @__PURE__ */ function(_Component) {
  93314. _inheritsLoose(Player2, _Component);
  93315. function Player2(tag, options2, ready) {
  93316. var _this;
  93317. tag.id = tag.id || options2.id || "vjs_video_" + newGUID();
  93318. options2 = assign(Player2.getTagSettings(tag), options2);
  93319. options2.initChildren = false;
  93320. options2.createEl = false;
  93321. options2.evented = false;
  93322. options2.reportTouchActivity = false;
  93323. if (!options2.language) {
  93324. if (typeof tag.closest === "function") {
  93325. var closest = tag.closest("[lang]");
  93326. if (closest && closest.getAttribute) {
  93327. options2.language = closest.getAttribute("lang");
  93328. }
  93329. } else {
  93330. var element = tag;
  93331. while (element && element.nodeType === 1) {
  93332. if (getAttributes(element).hasOwnProperty("lang")) {
  93333. options2.language = element.getAttribute("lang");
  93334. break;
  93335. }
  93336. element = element.parentNode;
  93337. }
  93338. }
  93339. }
  93340. _this = _Component.call(this, null, options2, ready) || this;
  93341. _this.boundDocumentFullscreenChange_ = function(e) {
  93342. return _this.documentFullscreenChange_(e);
  93343. };
  93344. _this.boundFullWindowOnEscKey_ = function(e) {
  93345. return _this.fullWindowOnEscKey(e);
  93346. };
  93347. _this.boundUpdateStyleEl_ = function(e) {
  93348. return _this.updateStyleEl_(e);
  93349. };
  93350. _this.boundApplyInitTime_ = function(e) {
  93351. return _this.applyInitTime_(e);
  93352. };
  93353. _this.boundUpdateCurrentBreakpoint_ = function(e) {
  93354. return _this.updateCurrentBreakpoint_(e);
  93355. };
  93356. _this.boundHandleTechClick_ = function(e) {
  93357. return _this.handleTechClick_(e);
  93358. };
  93359. _this.boundHandleTechDoubleClick_ = function(e) {
  93360. return _this.handleTechDoubleClick_(e);
  93361. };
  93362. _this.boundHandleTechTouchStart_ = function(e) {
  93363. return _this.handleTechTouchStart_(e);
  93364. };
  93365. _this.boundHandleTechTouchMove_ = function(e) {
  93366. return _this.handleTechTouchMove_(e);
  93367. };
  93368. _this.boundHandleTechTouchEnd_ = function(e) {
  93369. return _this.handleTechTouchEnd_(e);
  93370. };
  93371. _this.boundHandleTechTap_ = function(e) {
  93372. return _this.handleTechTap_(e);
  93373. };
  93374. _this.isFullscreen_ = false;
  93375. _this.log = createLogger(_this.id_);
  93376. _this.fsApi_ = FullscreenApi;
  93377. _this.isPosterFromTech_ = false;
  93378. _this.queuedCallbacks_ = [];
  93379. _this.isReady_ = false;
  93380. _this.hasStarted_ = false;
  93381. _this.userActive_ = false;
  93382. _this.debugEnabled_ = false;
  93383. _this.audioOnlyMode_ = false;
  93384. _this.audioPosterMode_ = false;
  93385. _this.audioOnlyCache_ = {
  93386. playerHeight: null,
  93387. hiddenChildren: []
  93388. };
  93389. if (!_this.options_ || !_this.options_.techOrder || !_this.options_.techOrder.length) {
  93390. throw new Error("No techOrder specified. Did you overwrite videojs.options instead of just changing the properties you want to override?");
  93391. }
  93392. _this.tag = tag;
  93393. _this.tagAttributes = tag && getAttributes(tag);
  93394. _this.language(_this.options_.language);
  93395. if (options2.languages) {
  93396. var languagesToLower = {};
  93397. Object.getOwnPropertyNames(options2.languages).forEach(function(name) {
  93398. languagesToLower[name.toLowerCase()] = options2.languages[name];
  93399. });
  93400. _this.languages_ = languagesToLower;
  93401. } else {
  93402. _this.languages_ = Player2.prototype.options_.languages;
  93403. }
  93404. _this.resetCache_();
  93405. _this.poster_ = options2.poster || "";
  93406. _this.controls_ = !!options2.controls;
  93407. tag.controls = false;
  93408. tag.removeAttribute("controls");
  93409. _this.changingSrc_ = false;
  93410. _this.playCallbacks_ = [];
  93411. _this.playTerminatedQueue_ = [];
  93412. if (tag.hasAttribute("autoplay")) {
  93413. _this.autoplay(true);
  93414. } else {
  93415. _this.autoplay(_this.options_.autoplay);
  93416. }
  93417. if (options2.plugins) {
  93418. Object.keys(options2.plugins).forEach(function(name) {
  93419. if (typeof _this[name] !== "function") {
  93420. throw new Error('plugin "' + name + '" does not exist');
  93421. }
  93422. });
  93423. }
  93424. _this.scrubbing_ = false;
  93425. _this.el_ = _this.createEl();
  93426. evented(_assertThisInitialized(_this), {
  93427. eventBusKey: "el_"
  93428. });
  93429. if (_this.fsApi_.requestFullscreen) {
  93430. on(document_1, _this.fsApi_.fullscreenchange, _this.boundDocumentFullscreenChange_);
  93431. _this.on(_this.fsApi_.fullscreenchange, _this.boundDocumentFullscreenChange_);
  93432. }
  93433. if (_this.fluid_) {
  93434. _this.on(["playerreset", "resize"], _this.boundUpdateStyleEl_);
  93435. }
  93436. var playerOptionsCopy = mergeOptions$3(_this.options_);
  93437. if (options2.plugins) {
  93438. Object.keys(options2.plugins).forEach(function(name) {
  93439. _this[name](options2.plugins[name]);
  93440. });
  93441. }
  93442. if (options2.debug) {
  93443. _this.debug(true);
  93444. }
  93445. _this.options_.playerOptions = playerOptionsCopy;
  93446. _this.middleware_ = [];
  93447. _this.playbackRates(options2.playbackRates);
  93448. _this.initChildren();
  93449. _this.isAudio(tag.nodeName.toLowerCase() === "audio");
  93450. if (_this.controls()) {
  93451. _this.addClass("vjs-controls-enabled");
  93452. } else {
  93453. _this.addClass("vjs-controls-disabled");
  93454. }
  93455. _this.el_.setAttribute("role", "region");
  93456. if (_this.isAudio()) {
  93457. _this.el_.setAttribute("aria-label", _this.localize("Audio Player"));
  93458. } else {
  93459. _this.el_.setAttribute("aria-label", _this.localize("Video Player"));
  93460. }
  93461. if (_this.isAudio()) {
  93462. _this.addClass("vjs-audio");
  93463. }
  93464. if (_this.flexNotSupported_()) {
  93465. _this.addClass("vjs-no-flex");
  93466. }
  93467. if (TOUCH_ENABLED) {
  93468. _this.addClass("vjs-touch-enabled");
  93469. }
  93470. if (!IS_IOS) {
  93471. _this.addClass("vjs-workinghover");
  93472. }
  93473. Player2.players[_this.id_] = _assertThisInitialized(_this);
  93474. var majorVersion = version$5.split(".")[0];
  93475. _this.addClass("vjs-v" + majorVersion);
  93476. _this.userActive(true);
  93477. _this.reportUserActivity();
  93478. _this.one("play", function(e) {
  93479. return _this.listenForUserActivity_(e);
  93480. });
  93481. _this.on("stageclick", function(e) {
  93482. return _this.handleStageClick_(e);
  93483. });
  93484. _this.on("keydown", function(e) {
  93485. return _this.handleKeyDown(e);
  93486. });
  93487. _this.on("languagechange", function(e) {
  93488. return _this.handleLanguagechange(e);
  93489. });
  93490. _this.breakpoints(_this.options_.breakpoints);
  93491. _this.responsive(_this.options_.responsive);
  93492. _this.on("ready", function() {
  93493. _this.audioPosterMode(_this.options_.audioPosterMode);
  93494. _this.audioOnlyMode(_this.options_.audioOnlyMode);
  93495. });
  93496. return _this;
  93497. }
  93498. var _proto = Player2.prototype;
  93499. _proto.dispose = function dispose() {
  93500. var _this2 = this;
  93501. this.trigger("dispose");
  93502. this.off("dispose");
  93503. off(document_1, this.fsApi_.fullscreenchange, this.boundDocumentFullscreenChange_);
  93504. off(document_1, "keydown", this.boundFullWindowOnEscKey_);
  93505. if (this.styleEl_ && this.styleEl_.parentNode) {
  93506. this.styleEl_.parentNode.removeChild(this.styleEl_);
  93507. this.styleEl_ = null;
  93508. }
  93509. Player2.players[this.id_] = null;
  93510. if (this.tag && this.tag.player) {
  93511. this.tag.player = null;
  93512. }
  93513. if (this.el_ && this.el_.player) {
  93514. this.el_.player = null;
  93515. }
  93516. if (this.tech_) {
  93517. this.tech_.dispose();
  93518. this.isPosterFromTech_ = false;
  93519. this.poster_ = "";
  93520. }
  93521. if (this.playerElIngest_) {
  93522. this.playerElIngest_ = null;
  93523. }
  93524. if (this.tag) {
  93525. this.tag = null;
  93526. }
  93527. clearCacheForPlayer(this);
  93528. ALL.names.forEach(function(name) {
  93529. var props = ALL[name];
  93530. var list = _this2[props.getterName]();
  93531. if (list && list.off) {
  93532. list.off();
  93533. }
  93534. });
  93535. _Component.prototype.dispose.call(this, {
  93536. restoreEl: this.options_.restoreEl
  93537. });
  93538. };
  93539. _proto.createEl = function createEl2() {
  93540. var tag = this.tag;
  93541. var el;
  93542. var playerElIngest = this.playerElIngest_ = tag.parentNode && tag.parentNode.hasAttribute && tag.parentNode.hasAttribute("data-vjs-player");
  93543. var divEmbed = this.tag.tagName.toLowerCase() === "video-js";
  93544. if (playerElIngest) {
  93545. el = this.el_ = tag.parentNode;
  93546. } else if (!divEmbed) {
  93547. el = this.el_ = _Component.prototype.createEl.call(this, "div");
  93548. }
  93549. var attrs = getAttributes(tag);
  93550. if (divEmbed) {
  93551. el = this.el_ = tag;
  93552. tag = this.tag = document_1.createElement("video");
  93553. while (el.children.length) {
  93554. tag.appendChild(el.firstChild);
  93555. }
  93556. if (!hasClass(el, "video-js")) {
  93557. addClass(el, "video-js");
  93558. }
  93559. el.appendChild(tag);
  93560. playerElIngest = this.playerElIngest_ = el;
  93561. Object.keys(el).forEach(function(k) {
  93562. try {
  93563. tag[k] = el[k];
  93564. } catch (e) {
  93565. }
  93566. });
  93567. }
  93568. tag.setAttribute("tabindex", "-1");
  93569. attrs.tabindex = "-1";
  93570. if (IE_VERSION || IS_CHROME && IS_WINDOWS) {
  93571. tag.setAttribute("role", "application");
  93572. attrs.role = "application";
  93573. }
  93574. tag.removeAttribute("width");
  93575. tag.removeAttribute("height");
  93576. if ("width" in attrs) {
  93577. delete attrs.width;
  93578. }
  93579. if ("height" in attrs) {
  93580. delete attrs.height;
  93581. }
  93582. Object.getOwnPropertyNames(attrs).forEach(function(attr) {
  93583. if (!(divEmbed && attr === "class")) {
  93584. el.setAttribute(attr, attrs[attr]);
  93585. }
  93586. if (divEmbed) {
  93587. tag.setAttribute(attr, attrs[attr]);
  93588. }
  93589. });
  93590. tag.playerId = tag.id;
  93591. tag.id += "_html5_api";
  93592. tag.className = "vjs-tech";
  93593. tag.player = el.player = this;
  93594. this.addClass("vjs-paused");
  93595. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true) {
  93596. this.styleEl_ = createStyleElement("vjs-styles-dimensions");
  93597. var defaultsStyleEl = $(".vjs-styles-defaults");
  93598. var head = $("head");
  93599. head.insertBefore(this.styleEl_, defaultsStyleEl ? defaultsStyleEl.nextSibling : head.firstChild);
  93600. }
  93601. this.fill_ = false;
  93602. this.fluid_ = false;
  93603. this.width(this.options_.width);
  93604. this.height(this.options_.height);
  93605. this.fill(this.options_.fill);
  93606. this.fluid(this.options_.fluid);
  93607. this.aspectRatio(this.options_.aspectRatio);
  93608. this.crossOrigin(this.options_.crossOrigin || this.options_.crossorigin);
  93609. var links = tag.getElementsByTagName("a");
  93610. for (var i2 = 0; i2 < links.length; i2++) {
  93611. var linkEl = links.item(i2);
  93612. addClass(linkEl, "vjs-hidden");
  93613. linkEl.setAttribute("hidden", "hidden");
  93614. }
  93615. tag.initNetworkState_ = tag.networkState;
  93616. if (tag.parentNode && !playerElIngest) {
  93617. tag.parentNode.insertBefore(el, tag);
  93618. }
  93619. prependTo(tag, el);
  93620. this.children_.unshift(tag);
  93621. this.el_.setAttribute("lang", this.language_);
  93622. this.el_.setAttribute("translate", "no");
  93623. this.el_ = el;
  93624. return el;
  93625. };
  93626. _proto.crossOrigin = function crossOrigin(value) {
  93627. if (!value) {
  93628. return this.techGet_("crossOrigin");
  93629. }
  93630. if (value !== "anonymous" && value !== "use-credentials") {
  93631. log$1.warn('crossOrigin must be "anonymous" or "use-credentials", given "' + value + '"');
  93632. return;
  93633. }
  93634. this.techCall_("setCrossOrigin", value);
  93635. return;
  93636. };
  93637. _proto.width = function width2(value) {
  93638. return this.dimension("width", value);
  93639. };
  93640. _proto.height = function height2(value) {
  93641. return this.dimension("height", value);
  93642. };
  93643. _proto.dimension = function dimension(_dimension, value) {
  93644. var privDimension = _dimension + "_";
  93645. if (value === void 0) {
  93646. return this[privDimension] || 0;
  93647. }
  93648. if (value === "" || value === "auto") {
  93649. this[privDimension] = void 0;
  93650. this.updateStyleEl_();
  93651. return;
  93652. }
  93653. var parsedVal = parseFloat(value);
  93654. if (isNaN(parsedVal)) {
  93655. log$1.error('Improper value "' + value + '" supplied for for ' + _dimension);
  93656. return;
  93657. }
  93658. this[privDimension] = parsedVal;
  93659. this.updateStyleEl_();
  93660. };
  93661. _proto.fluid = function fluid(bool) {
  93662. var _this3 = this;
  93663. if (bool === void 0) {
  93664. return !!this.fluid_;
  93665. }
  93666. this.fluid_ = !!bool;
  93667. if (isEvented(this)) {
  93668. this.off(["playerreset", "resize"], this.boundUpdateStyleEl_);
  93669. }
  93670. if (bool) {
  93671. this.addClass("vjs-fluid");
  93672. this.fill(false);
  93673. addEventedCallback(this, function() {
  93674. _this3.on(["playerreset", "resize"], _this3.boundUpdateStyleEl_);
  93675. });
  93676. } else {
  93677. this.removeClass("vjs-fluid");
  93678. }
  93679. this.updateStyleEl_();
  93680. };
  93681. _proto.fill = function fill(bool) {
  93682. if (bool === void 0) {
  93683. return !!this.fill_;
  93684. }
  93685. this.fill_ = !!bool;
  93686. if (bool) {
  93687. this.addClass("vjs-fill");
  93688. this.fluid(false);
  93689. } else {
  93690. this.removeClass("vjs-fill");
  93691. }
  93692. };
  93693. _proto.aspectRatio = function aspectRatio(ratio) {
  93694. if (ratio === void 0) {
  93695. return this.aspectRatio_;
  93696. }
  93697. if (!/^\d+\:\d+$/.test(ratio)) {
  93698. throw new Error("Improper value supplied for aspect ratio. The format should be width:height, for example 16:9.");
  93699. }
  93700. this.aspectRatio_ = ratio;
  93701. this.fluid(true);
  93702. this.updateStyleEl_();
  93703. };
  93704. _proto.updateStyleEl_ = function updateStyleEl_() {
  93705. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE === true) {
  93706. var _width = typeof this.width_ === "number" ? this.width_ : this.options_.width;
  93707. var _height = typeof this.height_ === "number" ? this.height_ : this.options_.height;
  93708. var techEl = this.tech_ && this.tech_.el();
  93709. if (techEl) {
  93710. if (_width >= 0) {
  93711. techEl.width = _width;
  93712. }
  93713. if (_height >= 0) {
  93714. techEl.height = _height;
  93715. }
  93716. }
  93717. return;
  93718. }
  93719. var width2;
  93720. var height2;
  93721. var aspectRatio;
  93722. var idClass;
  93723. if (this.aspectRatio_ !== void 0 && this.aspectRatio_ !== "auto") {
  93724. aspectRatio = this.aspectRatio_;
  93725. } else if (this.videoWidth() > 0) {
  93726. aspectRatio = this.videoWidth() + ":" + this.videoHeight();
  93727. } else {
  93728. aspectRatio = "16:9";
  93729. }
  93730. var ratioParts = aspectRatio.split(":");
  93731. var ratioMultiplier = ratioParts[1] / ratioParts[0];
  93732. if (this.width_ !== void 0) {
  93733. width2 = this.width_;
  93734. } else if (this.height_ !== void 0) {
  93735. width2 = this.height_ / ratioMultiplier;
  93736. } else {
  93737. width2 = this.videoWidth() || 300;
  93738. }
  93739. if (this.height_ !== void 0) {
  93740. height2 = this.height_;
  93741. } else {
  93742. height2 = width2 * ratioMultiplier;
  93743. }
  93744. if (/^[^a-zA-Z]/.test(this.id())) {
  93745. idClass = "dimensions-" + this.id();
  93746. } else {
  93747. idClass = this.id() + "-dimensions";
  93748. }
  93749. this.addClass(idClass);
  93750. setTextContent(this.styleEl_, "\n ." + idClass + " {\n width: " + width2 + "px;\n height: " + height2 + "px;\n }\n\n ." + idClass + ".vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: " + ratioMultiplier * 100 + "%;\n }\n ");
  93751. };
  93752. _proto.loadTech_ = function loadTech_(techName, source) {
  93753. var _this4 = this;
  93754. if (this.tech_) {
  93755. this.unloadTech_();
  93756. }
  93757. var titleTechName = toTitleCase$1(techName);
  93758. var camelTechName = techName.charAt(0).toLowerCase() + techName.slice(1);
  93759. if (titleTechName !== "Html5" && this.tag) {
  93760. Tech$1.getTech("Html5").disposeMediaElement(this.tag);
  93761. this.tag.player = null;
  93762. this.tag = null;
  93763. }
  93764. this.techName_ = titleTechName;
  93765. this.isReady_ = false;
  93766. var autoplay = this.autoplay();
  93767. if (typeof this.autoplay() === "string" || this.autoplay() === true && this.options_.normalizeAutoplay) {
  93768. autoplay = false;
  93769. }
  93770. var techOptions = {
  93771. source,
  93772. autoplay,
  93773. "nativeControlsForTouch": this.options_.nativeControlsForTouch,
  93774. "playerId": this.id(),
  93775. "techId": this.id() + "_" + camelTechName + "_api",
  93776. "playsinline": this.options_.playsinline,
  93777. "preload": this.options_.preload,
  93778. "loop": this.options_.loop,
  93779. "disablePictureInPicture": this.options_.disablePictureInPicture,
  93780. "muted": this.options_.muted,
  93781. "poster": this.poster(),
  93782. "language": this.language(),
  93783. "playerElIngest": this.playerElIngest_ || false,
  93784. "vtt.js": this.options_["vtt.js"],
  93785. "canOverridePoster": !!this.options_.techCanOverridePoster,
  93786. "enableSourceset": this.options_.enableSourceset,
  93787. "Promise": this.options_.Promise
  93788. };
  93789. ALL.names.forEach(function(name) {
  93790. var props = ALL[name];
  93791. techOptions[props.getterName] = _this4[props.privateName];
  93792. });
  93793. assign(techOptions, this.options_[titleTechName]);
  93794. assign(techOptions, this.options_[camelTechName]);
  93795. assign(techOptions, this.options_[techName.toLowerCase()]);
  93796. if (this.tag) {
  93797. techOptions.tag = this.tag;
  93798. }
  93799. if (source && source.src === this.cache_.src && this.cache_.currentTime > 0) {
  93800. techOptions.startTime = this.cache_.currentTime;
  93801. }
  93802. var TechClass = Tech$1.getTech(techName);
  93803. if (!TechClass) {
  93804. throw new Error("No Tech named '" + titleTechName + "' exists! '" + titleTechName + "' should be registered using videojs.registerTech()'");
  93805. }
  93806. this.tech_ = new TechClass(techOptions);
  93807. this.tech_.ready(bind(this, this.handleTechReady_), true);
  93808. textTrackConverter.jsonToTextTracks(this.textTracksJson_ || [], this.tech_);
  93809. TECH_EVENTS_RETRIGGER.forEach(function(event2) {
  93810. _this4.on(_this4.tech_, event2, function(e) {
  93811. return _this4["handleTech" + toTitleCase$1(event2) + "_"](e);
  93812. });
  93813. });
  93814. Object.keys(TECH_EVENTS_QUEUE).forEach(function(event2) {
  93815. _this4.on(_this4.tech_, event2, function(eventObj) {
  93816. if (_this4.tech_.playbackRate() === 0 && _this4.tech_.seeking()) {
  93817. _this4.queuedCallbacks_.push({
  93818. callback: _this4["handleTech" + TECH_EVENTS_QUEUE[event2] + "_"].bind(_this4),
  93819. event: eventObj
  93820. });
  93821. return;
  93822. }
  93823. _this4["handleTech" + TECH_EVENTS_QUEUE[event2] + "_"](eventObj);
  93824. });
  93825. });
  93826. this.on(this.tech_, "loadstart", function(e) {
  93827. return _this4.handleTechLoadStart_(e);
  93828. });
  93829. this.on(this.tech_, "sourceset", function(e) {
  93830. return _this4.handleTechSourceset_(e);
  93831. });
  93832. this.on(this.tech_, "waiting", function(e) {
  93833. return _this4.handleTechWaiting_(e);
  93834. });
  93835. this.on(this.tech_, "ended", function(e) {
  93836. return _this4.handleTechEnded_(e);
  93837. });
  93838. this.on(this.tech_, "seeking", function(e) {
  93839. return _this4.handleTechSeeking_(e);
  93840. });
  93841. this.on(this.tech_, "play", function(e) {
  93842. return _this4.handleTechPlay_(e);
  93843. });
  93844. this.on(this.tech_, "firstplay", function(e) {
  93845. return _this4.handleTechFirstPlay_(e);
  93846. });
  93847. this.on(this.tech_, "pause", function(e) {
  93848. return _this4.handleTechPause_(e);
  93849. });
  93850. this.on(this.tech_, "durationchange", function(e) {
  93851. return _this4.handleTechDurationChange_(e);
  93852. });
  93853. this.on(this.tech_, "fullscreenchange", function(e, data) {
  93854. return _this4.handleTechFullscreenChange_(e, data);
  93855. });
  93856. this.on(this.tech_, "fullscreenerror", function(e, err) {
  93857. return _this4.handleTechFullscreenError_(e, err);
  93858. });
  93859. this.on(this.tech_, "enterpictureinpicture", function(e) {
  93860. return _this4.handleTechEnterPictureInPicture_(e);
  93861. });
  93862. this.on(this.tech_, "leavepictureinpicture", function(e) {
  93863. return _this4.handleTechLeavePictureInPicture_(e);
  93864. });
  93865. this.on(this.tech_, "error", function(e) {
  93866. return _this4.handleTechError_(e);
  93867. });
  93868. this.on(this.tech_, "posterchange", function(e) {
  93869. return _this4.handleTechPosterChange_(e);
  93870. });
  93871. this.on(this.tech_, "textdata", function(e) {
  93872. return _this4.handleTechTextData_(e);
  93873. });
  93874. this.on(this.tech_, "ratechange", function(e) {
  93875. return _this4.handleTechRateChange_(e);
  93876. });
  93877. this.on(this.tech_, "loadedmetadata", this.boundUpdateStyleEl_);
  93878. this.usingNativeControls(this.techGet_("controls"));
  93879. if (this.controls() && !this.usingNativeControls()) {
  93880. this.addTechControlsListeners_();
  93881. }
  93882. if (this.tech_.el().parentNode !== this.el() && (titleTechName !== "Html5" || !this.tag)) {
  93883. prependTo(this.tech_.el(), this.el());
  93884. }
  93885. if (this.tag) {
  93886. this.tag.player = null;
  93887. this.tag = null;
  93888. }
  93889. };
  93890. _proto.unloadTech_ = function unloadTech_() {
  93891. var _this5 = this;
  93892. ALL.names.forEach(function(name) {
  93893. var props = ALL[name];
  93894. _this5[props.privateName] = _this5[props.getterName]();
  93895. });
  93896. this.textTracksJson_ = textTrackConverter.textTracksToJson(this.tech_);
  93897. this.isReady_ = false;
  93898. this.tech_.dispose();
  93899. this.tech_ = false;
  93900. if (this.isPosterFromTech_) {
  93901. this.poster_ = "";
  93902. this.trigger("posterchange");
  93903. }
  93904. this.isPosterFromTech_ = false;
  93905. };
  93906. _proto.tech = function tech(safety) {
  93907. if (safety === void 0) {
  93908. log$1.warn("Using the tech directly can be dangerous. I hope you know what you're doing.\nSee https://github.com/videojs/video.js/issues/2617 for more info.\n");
  93909. }
  93910. return this.tech_;
  93911. };
  93912. _proto.addTechControlsListeners_ = function addTechControlsListeners_() {
  93913. this.removeTechControlsListeners_();
  93914. this.on(this.tech_, "click", this.boundHandleTechClick_);
  93915. this.on(this.tech_, "dblclick", this.boundHandleTechDoubleClick_);
  93916. this.on(this.tech_, "touchstart", this.boundHandleTechTouchStart_);
  93917. this.on(this.tech_, "touchmove", this.boundHandleTechTouchMove_);
  93918. this.on(this.tech_, "touchend", this.boundHandleTechTouchEnd_);
  93919. this.on(this.tech_, "tap", this.boundHandleTechTap_);
  93920. };
  93921. _proto.removeTechControlsListeners_ = function removeTechControlsListeners_() {
  93922. this.off(this.tech_, "tap", this.boundHandleTechTap_);
  93923. this.off(this.tech_, "touchstart", this.boundHandleTechTouchStart_);
  93924. this.off(this.tech_, "touchmove", this.boundHandleTechTouchMove_);
  93925. this.off(this.tech_, "touchend", this.boundHandleTechTouchEnd_);
  93926. this.off(this.tech_, "click", this.boundHandleTechClick_);
  93927. this.off(this.tech_, "dblclick", this.boundHandleTechDoubleClick_);
  93928. };
  93929. _proto.handleTechReady_ = function handleTechReady_() {
  93930. this.triggerReady();
  93931. if (this.cache_.volume) {
  93932. this.techCall_("setVolume", this.cache_.volume);
  93933. }
  93934. this.handleTechPosterChange_();
  93935. this.handleTechDurationChange_();
  93936. };
  93937. _proto.handleTechLoadStart_ = function handleTechLoadStart_() {
  93938. this.removeClass("vjs-ended");
  93939. this.removeClass("vjs-seeking");
  93940. this.error(null);
  93941. this.handleTechDurationChange_();
  93942. if (!this.paused()) {
  93943. this.trigger("loadstart");
  93944. this.trigger("firstplay");
  93945. } else {
  93946. this.hasStarted(false);
  93947. this.trigger("loadstart");
  93948. }
  93949. this.manualAutoplay_(this.autoplay() === true && this.options_.normalizeAutoplay ? "play" : this.autoplay());
  93950. };
  93951. _proto.manualAutoplay_ = function manualAutoplay_(type2) {
  93952. var _this6 = this;
  93953. if (!this.tech_ || typeof type2 !== "string") {
  93954. return;
  93955. }
  93956. var resolveMuted = function resolveMuted2() {
  93957. var previouslyMuted = _this6.muted();
  93958. _this6.muted(true);
  93959. var restoreMuted = function restoreMuted2() {
  93960. _this6.muted(previouslyMuted);
  93961. };
  93962. _this6.playTerminatedQueue_.push(restoreMuted);
  93963. var mutedPromise = _this6.play();
  93964. if (!isPromise(mutedPromise)) {
  93965. return;
  93966. }
  93967. return mutedPromise["catch"](function(err) {
  93968. restoreMuted();
  93969. throw new Error("Rejection at manualAutoplay. Restoring muted value. " + (err ? err : ""));
  93970. });
  93971. };
  93972. var promise;
  93973. if (type2 === "any" && !this.muted()) {
  93974. promise = this.play();
  93975. if (isPromise(promise)) {
  93976. promise = promise["catch"](resolveMuted);
  93977. }
  93978. } else if (type2 === "muted" && !this.muted()) {
  93979. promise = resolveMuted();
  93980. } else {
  93981. promise = this.play();
  93982. }
  93983. if (!isPromise(promise)) {
  93984. return;
  93985. }
  93986. return promise.then(function() {
  93987. _this6.trigger({
  93988. type: "autoplay-success",
  93989. autoplay: type2
  93990. });
  93991. })["catch"](function() {
  93992. _this6.trigger({
  93993. type: "autoplay-failure",
  93994. autoplay: type2
  93995. });
  93996. });
  93997. };
  93998. _proto.updateSourceCaches_ = function updateSourceCaches_(srcObj) {
  93999. if (srcObj === void 0) {
  94000. srcObj = "";
  94001. }
  94002. var src = srcObj;
  94003. var type2 = "";
  94004. if (typeof src !== "string") {
  94005. src = srcObj.src;
  94006. type2 = srcObj.type;
  94007. }
  94008. this.cache_.source = this.cache_.source || {};
  94009. this.cache_.sources = this.cache_.sources || [];
  94010. if (src && !type2) {
  94011. type2 = findMimetype(this, src);
  94012. }
  94013. this.cache_.source = mergeOptions$3({}, srcObj, {
  94014. src,
  94015. type: type2
  94016. });
  94017. var matchingSources = this.cache_.sources.filter(function(s) {
  94018. return s.src && s.src === src;
  94019. });
  94020. var sourceElSources = [];
  94021. var sourceEls = this.$$("source");
  94022. var matchingSourceEls = [];
  94023. for (var i2 = 0; i2 < sourceEls.length; i2++) {
  94024. var sourceObj = getAttributes(sourceEls[i2]);
  94025. sourceElSources.push(sourceObj);
  94026. if (sourceObj.src && sourceObj.src === src) {
  94027. matchingSourceEls.push(sourceObj.src);
  94028. }
  94029. }
  94030. if (matchingSourceEls.length && !matchingSources.length) {
  94031. this.cache_.sources = sourceElSources;
  94032. } else if (!matchingSources.length) {
  94033. this.cache_.sources = [this.cache_.source];
  94034. }
  94035. this.cache_.src = src;
  94036. };
  94037. _proto.handleTechSourceset_ = function handleTechSourceset_(event2) {
  94038. var _this7 = this;
  94039. if (!this.changingSrc_) {
  94040. var updateSourceCaches = function updateSourceCaches2(src) {
  94041. return _this7.updateSourceCaches_(src);
  94042. };
  94043. var playerSrc = this.currentSource().src;
  94044. var eventSrc = event2.src;
  94045. if (playerSrc && !/^blob:/.test(playerSrc) && /^blob:/.test(eventSrc)) {
  94046. if (!this.lastSource_ || this.lastSource_.tech !== eventSrc && this.lastSource_.player !== playerSrc) {
  94047. updateSourceCaches = function updateSourceCaches2() {
  94048. };
  94049. }
  94050. }
  94051. updateSourceCaches(eventSrc);
  94052. if (!event2.src) {
  94053. this.tech_.any(["sourceset", "loadstart"], function(e) {
  94054. if (e.type === "sourceset") {
  94055. return;
  94056. }
  94057. var techSrc = _this7.techGet("currentSrc");
  94058. _this7.lastSource_.tech = techSrc;
  94059. _this7.updateSourceCaches_(techSrc);
  94060. });
  94061. }
  94062. }
  94063. this.lastSource_ = {
  94064. player: this.currentSource().src,
  94065. tech: event2.src
  94066. };
  94067. this.trigger({
  94068. src: event2.src,
  94069. type: "sourceset"
  94070. });
  94071. };
  94072. _proto.hasStarted = function hasStarted(request) {
  94073. if (request === void 0) {
  94074. return this.hasStarted_;
  94075. }
  94076. if (request === this.hasStarted_) {
  94077. return;
  94078. }
  94079. this.hasStarted_ = request;
  94080. if (this.hasStarted_) {
  94081. this.addClass("vjs-has-started");
  94082. this.trigger("firstplay");
  94083. } else {
  94084. this.removeClass("vjs-has-started");
  94085. }
  94086. };
  94087. _proto.handleTechPlay_ = function handleTechPlay_() {
  94088. this.removeClass("vjs-ended");
  94089. this.removeClass("vjs-paused");
  94090. this.addClass("vjs-playing");
  94091. this.hasStarted(true);
  94092. this.trigger("play");
  94093. };
  94094. _proto.handleTechRateChange_ = function handleTechRateChange_() {
  94095. if (this.tech_.playbackRate() > 0 && this.cache_.lastPlaybackRate === 0) {
  94096. this.queuedCallbacks_.forEach(function(queued) {
  94097. return queued.callback(queued.event);
  94098. });
  94099. this.queuedCallbacks_ = [];
  94100. }
  94101. this.cache_.lastPlaybackRate = this.tech_.playbackRate();
  94102. this.trigger("ratechange");
  94103. };
  94104. _proto.handleTechWaiting_ = function handleTechWaiting_() {
  94105. var _this8 = this;
  94106. this.addClass("vjs-waiting");
  94107. this.trigger("waiting");
  94108. var timeWhenWaiting = this.currentTime();
  94109. var timeUpdateListener = function timeUpdateListener2() {
  94110. if (timeWhenWaiting !== _this8.currentTime()) {
  94111. _this8.removeClass("vjs-waiting");
  94112. _this8.off("timeupdate", timeUpdateListener2);
  94113. }
  94114. };
  94115. this.on("timeupdate", timeUpdateListener);
  94116. };
  94117. _proto.handleTechCanPlay_ = function handleTechCanPlay_() {
  94118. this.removeClass("vjs-waiting");
  94119. this.trigger("canplay");
  94120. };
  94121. _proto.handleTechCanPlayThrough_ = function handleTechCanPlayThrough_() {
  94122. this.removeClass("vjs-waiting");
  94123. this.trigger("canplaythrough");
  94124. };
  94125. _proto.handleTechPlaying_ = function handleTechPlaying_() {
  94126. this.removeClass("vjs-waiting");
  94127. this.trigger("playing");
  94128. };
  94129. _proto.handleTechSeeking_ = function handleTechSeeking_() {
  94130. this.addClass("vjs-seeking");
  94131. this.trigger("seeking");
  94132. };
  94133. _proto.handleTechSeeked_ = function handleTechSeeked_() {
  94134. this.removeClass("vjs-seeking");
  94135. this.removeClass("vjs-ended");
  94136. this.trigger("seeked");
  94137. };
  94138. _proto.handleTechFirstPlay_ = function handleTechFirstPlay_() {
  94139. if (this.options_.starttime) {
  94140. log$1.warn("Passing the `starttime` option to the player will be deprecated in 6.0");
  94141. this.currentTime(this.options_.starttime);
  94142. }
  94143. this.addClass("vjs-has-started");
  94144. this.trigger("firstplay");
  94145. };
  94146. _proto.handleTechPause_ = function handleTechPause_() {
  94147. this.removeClass("vjs-playing");
  94148. this.addClass("vjs-paused");
  94149. this.trigger("pause");
  94150. };
  94151. _proto.handleTechEnded_ = function handleTechEnded_() {
  94152. this.addClass("vjs-ended");
  94153. this.removeClass("vjs-waiting");
  94154. if (this.options_.loop) {
  94155. this.currentTime(0);
  94156. this.play();
  94157. } else if (!this.paused()) {
  94158. this.pause();
  94159. }
  94160. this.trigger("ended");
  94161. };
  94162. _proto.handleTechDurationChange_ = function handleTechDurationChange_() {
  94163. this.duration(this.techGet_("duration"));
  94164. };
  94165. _proto.handleTechClick_ = function handleTechClick_(event2) {
  94166. if (!this.controls_) {
  94167. return;
  94168. }
  94169. if (this.options_ === void 0 || this.options_.userActions === void 0 || this.options_.userActions.click === void 0 || this.options_.userActions.click !== false) {
  94170. if (this.options_ !== void 0 && this.options_.userActions !== void 0 && typeof this.options_.userActions.click === "function") {
  94171. this.options_.userActions.click.call(this, event2);
  94172. } else if (this.paused()) {
  94173. silencePromise(this.play());
  94174. } else {
  94175. this.pause();
  94176. }
  94177. }
  94178. };
  94179. _proto.handleTechDoubleClick_ = function handleTechDoubleClick_(event2) {
  94180. if (!this.controls_) {
  94181. return;
  94182. }
  94183. var inAllowedEls = Array.prototype.some.call(this.$$(".vjs-control-bar, .vjs-modal-dialog"), function(el) {
  94184. return el.contains(event2.target);
  94185. });
  94186. if (!inAllowedEls) {
  94187. if (this.options_ === void 0 || this.options_.userActions === void 0 || this.options_.userActions.doubleClick === void 0 || this.options_.userActions.doubleClick !== false) {
  94188. if (this.options_ !== void 0 && this.options_.userActions !== void 0 && typeof this.options_.userActions.doubleClick === "function") {
  94189. this.options_.userActions.doubleClick.call(this, event2);
  94190. } else if (this.isFullscreen()) {
  94191. this.exitFullscreen();
  94192. } else {
  94193. this.requestFullscreen();
  94194. }
  94195. }
  94196. }
  94197. };
  94198. _proto.handleTechTap_ = function handleTechTap_() {
  94199. this.userActive(!this.userActive());
  94200. };
  94201. _proto.handleTechTouchStart_ = function handleTechTouchStart_() {
  94202. this.userWasActive = this.userActive();
  94203. };
  94204. _proto.handleTechTouchMove_ = function handleTechTouchMove_() {
  94205. if (this.userWasActive) {
  94206. this.reportUserActivity();
  94207. }
  94208. };
  94209. _proto.handleTechTouchEnd_ = function handleTechTouchEnd_(event2) {
  94210. if (event2.cancelable) {
  94211. event2.preventDefault();
  94212. }
  94213. };
  94214. _proto.handleStageClick_ = function handleStageClick_() {
  94215. this.reportUserActivity();
  94216. };
  94217. _proto.toggleFullscreenClass_ = function toggleFullscreenClass_() {
  94218. if (this.isFullscreen()) {
  94219. this.addClass("vjs-fullscreen");
  94220. } else {
  94221. this.removeClass("vjs-fullscreen");
  94222. }
  94223. };
  94224. _proto.documentFullscreenChange_ = function documentFullscreenChange_(e) {
  94225. var targetPlayer = e.target.player;
  94226. if (targetPlayer && targetPlayer !== this) {
  94227. return;
  94228. }
  94229. var el = this.el();
  94230. var isFs = document_1[this.fsApi_.fullscreenElement] === el;
  94231. if (!isFs && el.matches) {
  94232. isFs = el.matches(":" + this.fsApi_.fullscreen);
  94233. } else if (!isFs && el.msMatchesSelector) {
  94234. isFs = el.msMatchesSelector(":" + this.fsApi_.fullscreen);
  94235. }
  94236. this.isFullscreen(isFs);
  94237. };
  94238. _proto.handleTechFullscreenChange_ = function handleTechFullscreenChange_(event2, data) {
  94239. var _this9 = this;
  94240. if (data) {
  94241. if (data.nativeIOSFullscreen) {
  94242. this.addClass("vjs-ios-native-fs");
  94243. this.tech_.one("webkitendfullscreen", function() {
  94244. _this9.removeClass("vjs-ios-native-fs");
  94245. });
  94246. }
  94247. this.isFullscreen(data.isFullscreen);
  94248. }
  94249. };
  94250. _proto.handleTechFullscreenError_ = function handleTechFullscreenError_(event2, err) {
  94251. this.trigger("fullscreenerror", err);
  94252. };
  94253. _proto.togglePictureInPictureClass_ = function togglePictureInPictureClass_() {
  94254. if (this.isInPictureInPicture()) {
  94255. this.addClass("vjs-picture-in-picture");
  94256. } else {
  94257. this.removeClass("vjs-picture-in-picture");
  94258. }
  94259. };
  94260. _proto.handleTechEnterPictureInPicture_ = function handleTechEnterPictureInPicture_(event2) {
  94261. this.isInPictureInPicture(true);
  94262. };
  94263. _proto.handleTechLeavePictureInPicture_ = function handleTechLeavePictureInPicture_(event2) {
  94264. this.isInPictureInPicture(false);
  94265. };
  94266. _proto.handleTechError_ = function handleTechError_() {
  94267. var error = this.tech_.error();
  94268. this.error(error);
  94269. };
  94270. _proto.handleTechTextData_ = function handleTechTextData_() {
  94271. var data = null;
  94272. if (arguments.length > 1) {
  94273. data = arguments[1];
  94274. }
  94275. this.trigger("textdata", data);
  94276. };
  94277. _proto.getCache = function getCache() {
  94278. return this.cache_;
  94279. };
  94280. _proto.resetCache_ = function resetCache_() {
  94281. this.cache_ = {
  94282. currentTime: 0,
  94283. initTime: 0,
  94284. inactivityTimeout: this.options_.inactivityTimeout,
  94285. duration: NaN,
  94286. lastVolume: 1,
  94287. lastPlaybackRate: this.defaultPlaybackRate(),
  94288. media: null,
  94289. src: "",
  94290. source: {},
  94291. sources: [],
  94292. playbackRates: [],
  94293. volume: 1
  94294. };
  94295. };
  94296. _proto.techCall_ = function techCall_(method, arg) {
  94297. this.ready(function() {
  94298. if (method in allowedSetters) {
  94299. return set(this.middleware_, this.tech_, method, arg);
  94300. } else if (method in allowedMediators) {
  94301. return mediate(this.middleware_, this.tech_, method, arg);
  94302. }
  94303. try {
  94304. if (this.tech_) {
  94305. this.tech_[method](arg);
  94306. }
  94307. } catch (e) {
  94308. log$1(e);
  94309. throw e;
  94310. }
  94311. }, true);
  94312. };
  94313. _proto.techGet_ = function techGet_(method) {
  94314. if (!this.tech_ || !this.tech_.isReady_) {
  94315. return;
  94316. }
  94317. if (method in allowedGetters) {
  94318. return get(this.middleware_, this.tech_, method);
  94319. } else if (method in allowedMediators) {
  94320. return mediate(this.middleware_, this.tech_, method);
  94321. }
  94322. try {
  94323. return this.tech_[method]();
  94324. } catch (e) {
  94325. if (this.tech_[method] === void 0) {
  94326. log$1("Video.js: " + method + " method not defined for " + this.techName_ + " playback technology.", e);
  94327. throw e;
  94328. }
  94329. if (e.name === "TypeError") {
  94330. log$1("Video.js: " + method + " unavailable on " + this.techName_ + " playback technology element.", e);
  94331. this.tech_.isReady_ = false;
  94332. throw e;
  94333. }
  94334. log$1(e);
  94335. throw e;
  94336. }
  94337. };
  94338. _proto.play = function play() {
  94339. var _this10 = this;
  94340. var PromiseClass = this.options_.Promise || window_1.Promise;
  94341. if (PromiseClass) {
  94342. return new PromiseClass(function(resolve2) {
  94343. _this10.play_(resolve2);
  94344. });
  94345. }
  94346. return this.play_();
  94347. };
  94348. _proto.play_ = function play_(callback2) {
  94349. var _this11 = this;
  94350. if (callback2 === void 0) {
  94351. callback2 = silencePromise;
  94352. }
  94353. this.playCallbacks_.push(callback2);
  94354. var isSrcReady = Boolean(!this.changingSrc_ && (this.src() || this.currentSrc()));
  94355. var isSafariOrIOS = Boolean(IS_ANY_SAFARI || IS_IOS);
  94356. if (this.waitToPlay_) {
  94357. this.off(["ready", "loadstart"], this.waitToPlay_);
  94358. this.waitToPlay_ = null;
  94359. }
  94360. if (!this.isReady_ || !isSrcReady) {
  94361. this.waitToPlay_ = function(e) {
  94362. _this11.play_();
  94363. };
  94364. this.one(["ready", "loadstart"], this.waitToPlay_);
  94365. if (!isSrcReady && isSafariOrIOS) {
  94366. this.load();
  94367. }
  94368. return;
  94369. }
  94370. var val = this.techGet_("play");
  94371. var isNativeReplay = isSafariOrIOS && this.hasClass("vjs-ended");
  94372. if (isNativeReplay) {
  94373. this.resetProgressBar_();
  94374. }
  94375. if (val === null) {
  94376. this.runPlayTerminatedQueue_();
  94377. } else {
  94378. this.runPlayCallbacks_(val);
  94379. }
  94380. };
  94381. _proto.runPlayTerminatedQueue_ = function runPlayTerminatedQueue_() {
  94382. var queue = this.playTerminatedQueue_.slice(0);
  94383. this.playTerminatedQueue_ = [];
  94384. queue.forEach(function(q2) {
  94385. q2();
  94386. });
  94387. };
  94388. _proto.runPlayCallbacks_ = function runPlayCallbacks_(val) {
  94389. var callbacks = this.playCallbacks_.slice(0);
  94390. this.playCallbacks_ = [];
  94391. this.playTerminatedQueue_ = [];
  94392. callbacks.forEach(function(cb) {
  94393. cb(val);
  94394. });
  94395. };
  94396. _proto.pause = function pause() {
  94397. this.techCall_("pause");
  94398. };
  94399. _proto.paused = function paused() {
  94400. return this.techGet_("paused") === false ? false : true;
  94401. };
  94402. _proto.played = function played() {
  94403. return this.techGet_("played") || createTimeRanges(0, 0);
  94404. };
  94405. _proto.scrubbing = function scrubbing(isScrubbing) {
  94406. if (typeof isScrubbing === "undefined") {
  94407. return this.scrubbing_;
  94408. }
  94409. this.scrubbing_ = !!isScrubbing;
  94410. this.techCall_("setScrubbing", this.scrubbing_);
  94411. if (isScrubbing) {
  94412. this.addClass("vjs-scrubbing");
  94413. } else {
  94414. this.removeClass("vjs-scrubbing");
  94415. }
  94416. };
  94417. _proto.currentTime = function currentTime(seconds) {
  94418. if (typeof seconds !== "undefined") {
  94419. if (seconds < 0) {
  94420. seconds = 0;
  94421. }
  94422. if (!this.isReady_ || this.changingSrc_ || !this.tech_ || !this.tech_.isReady_) {
  94423. this.cache_.initTime = seconds;
  94424. this.off("canplay", this.boundApplyInitTime_);
  94425. this.one("canplay", this.boundApplyInitTime_);
  94426. return;
  94427. }
  94428. this.techCall_("setCurrentTime", seconds);
  94429. this.cache_.initTime = 0;
  94430. return;
  94431. }
  94432. this.cache_.currentTime = this.techGet_("currentTime") || 0;
  94433. return this.cache_.currentTime;
  94434. };
  94435. _proto.applyInitTime_ = function applyInitTime_() {
  94436. this.currentTime(this.cache_.initTime);
  94437. };
  94438. _proto.duration = function duration5(seconds) {
  94439. if (seconds === void 0) {
  94440. return this.cache_.duration !== void 0 ? this.cache_.duration : NaN;
  94441. }
  94442. seconds = parseFloat(seconds);
  94443. if (seconds < 0) {
  94444. seconds = Infinity;
  94445. }
  94446. if (seconds !== this.cache_.duration) {
  94447. this.cache_.duration = seconds;
  94448. if (seconds === Infinity) {
  94449. this.addClass("vjs-live");
  94450. } else {
  94451. this.removeClass("vjs-live");
  94452. }
  94453. if (!isNaN(seconds)) {
  94454. this.trigger("durationchange");
  94455. }
  94456. }
  94457. };
  94458. _proto.remainingTime = function remainingTime() {
  94459. return this.duration() - this.currentTime();
  94460. };
  94461. _proto.remainingTimeDisplay = function remainingTimeDisplay() {
  94462. return Math.floor(this.duration()) - Math.floor(this.currentTime());
  94463. };
  94464. _proto.buffered = function buffered() {
  94465. var buffered2 = this.techGet_("buffered");
  94466. if (!buffered2 || !buffered2.length) {
  94467. buffered2 = createTimeRanges(0, 0);
  94468. }
  94469. return buffered2;
  94470. };
  94471. _proto.bufferedPercent = function bufferedPercent$12() {
  94472. return bufferedPercent(this.buffered(), this.duration());
  94473. };
  94474. _proto.bufferedEnd = function bufferedEnd() {
  94475. var buffered = this.buffered();
  94476. var duration5 = this.duration();
  94477. var end = buffered.end(buffered.length - 1);
  94478. if (end > duration5) {
  94479. end = duration5;
  94480. }
  94481. return end;
  94482. };
  94483. _proto.volume = function volume(percentAsDecimal) {
  94484. var vol;
  94485. if (percentAsDecimal !== void 0) {
  94486. vol = Math.max(0, Math.min(1, parseFloat(percentAsDecimal)));
  94487. this.cache_.volume = vol;
  94488. this.techCall_("setVolume", vol);
  94489. if (vol > 0) {
  94490. this.lastVolume_(vol);
  94491. }
  94492. return;
  94493. }
  94494. vol = parseFloat(this.techGet_("volume"));
  94495. return isNaN(vol) ? 1 : vol;
  94496. };
  94497. _proto.muted = function muted(_muted) {
  94498. if (_muted !== void 0) {
  94499. this.techCall_("setMuted", _muted);
  94500. return;
  94501. }
  94502. return this.techGet_("muted") || false;
  94503. };
  94504. _proto.defaultMuted = function defaultMuted(_defaultMuted) {
  94505. if (_defaultMuted !== void 0) {
  94506. return this.techCall_("setDefaultMuted", _defaultMuted);
  94507. }
  94508. return this.techGet_("defaultMuted") || false;
  94509. };
  94510. _proto.lastVolume_ = function lastVolume_(percentAsDecimal) {
  94511. if (percentAsDecimal !== void 0 && percentAsDecimal !== 0) {
  94512. this.cache_.lastVolume = percentAsDecimal;
  94513. return;
  94514. }
  94515. return this.cache_.lastVolume;
  94516. };
  94517. _proto.supportsFullScreen = function supportsFullScreen() {
  94518. return this.techGet_("supportsFullScreen") || false;
  94519. };
  94520. _proto.isFullscreen = function isFullscreen(isFS) {
  94521. if (isFS !== void 0) {
  94522. var oldValue = this.isFullscreen_;
  94523. this.isFullscreen_ = Boolean(isFS);
  94524. if (this.isFullscreen_ !== oldValue && this.fsApi_.prefixed) {
  94525. this.trigger("fullscreenchange");
  94526. }
  94527. this.toggleFullscreenClass_();
  94528. return;
  94529. }
  94530. return this.isFullscreen_;
  94531. };
  94532. _proto.requestFullscreen = function requestFullscreen(fullscreenOptions) {
  94533. var PromiseClass = this.options_.Promise || window_1.Promise;
  94534. if (PromiseClass) {
  94535. var self2 = this;
  94536. return new PromiseClass(function(resolve2, reject2) {
  94537. function offHandler() {
  94538. self2.off("fullscreenerror", errorHandler);
  94539. self2.off("fullscreenchange", changeHandler);
  94540. }
  94541. function changeHandler() {
  94542. offHandler();
  94543. resolve2();
  94544. }
  94545. function errorHandler(e, err) {
  94546. offHandler();
  94547. reject2(err);
  94548. }
  94549. self2.one("fullscreenchange", changeHandler);
  94550. self2.one("fullscreenerror", errorHandler);
  94551. var promise = self2.requestFullscreenHelper_(fullscreenOptions);
  94552. if (promise) {
  94553. promise.then(offHandler, offHandler);
  94554. promise.then(resolve2, reject2);
  94555. }
  94556. });
  94557. }
  94558. return this.requestFullscreenHelper_();
  94559. };
  94560. _proto.requestFullscreenHelper_ = function requestFullscreenHelper_(fullscreenOptions) {
  94561. var _this12 = this;
  94562. var fsOptions;
  94563. if (!this.fsApi_.prefixed) {
  94564. fsOptions = this.options_.fullscreen && this.options_.fullscreen.options || {};
  94565. if (fullscreenOptions !== void 0) {
  94566. fsOptions = fullscreenOptions;
  94567. }
  94568. }
  94569. if (this.fsApi_.requestFullscreen) {
  94570. var promise = this.el_[this.fsApi_.requestFullscreen](fsOptions);
  94571. if (promise) {
  94572. promise.then(function() {
  94573. return _this12.isFullscreen(true);
  94574. }, function() {
  94575. return _this12.isFullscreen(false);
  94576. });
  94577. }
  94578. return promise;
  94579. } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
  94580. this.techCall_("enterFullScreen");
  94581. } else {
  94582. this.enterFullWindow();
  94583. }
  94584. };
  94585. _proto.exitFullscreen = function exitFullscreen() {
  94586. var PromiseClass = this.options_.Promise || window_1.Promise;
  94587. if (PromiseClass) {
  94588. var self2 = this;
  94589. return new PromiseClass(function(resolve2, reject2) {
  94590. function offHandler() {
  94591. self2.off("fullscreenerror", errorHandler);
  94592. self2.off("fullscreenchange", changeHandler);
  94593. }
  94594. function changeHandler() {
  94595. offHandler();
  94596. resolve2();
  94597. }
  94598. function errorHandler(e, err) {
  94599. offHandler();
  94600. reject2(err);
  94601. }
  94602. self2.one("fullscreenchange", changeHandler);
  94603. self2.one("fullscreenerror", errorHandler);
  94604. var promise = self2.exitFullscreenHelper_();
  94605. if (promise) {
  94606. promise.then(offHandler, offHandler);
  94607. promise.then(resolve2, reject2);
  94608. }
  94609. });
  94610. }
  94611. return this.exitFullscreenHelper_();
  94612. };
  94613. _proto.exitFullscreenHelper_ = function exitFullscreenHelper_() {
  94614. var _this13 = this;
  94615. if (this.fsApi_.requestFullscreen) {
  94616. var promise = document_1[this.fsApi_.exitFullscreen]();
  94617. if (promise) {
  94618. silencePromise(promise.then(function() {
  94619. return _this13.isFullscreen(false);
  94620. }));
  94621. }
  94622. return promise;
  94623. } else if (this.tech_.supportsFullScreen() && !this.options_.preferFullWindow === true) {
  94624. this.techCall_("exitFullScreen");
  94625. } else {
  94626. this.exitFullWindow();
  94627. }
  94628. };
  94629. _proto.enterFullWindow = function enterFullWindow() {
  94630. this.isFullscreen(true);
  94631. this.isFullWindow = true;
  94632. this.docOrigOverflow = document_1.documentElement.style.overflow;
  94633. on(document_1, "keydown", this.boundFullWindowOnEscKey_);
  94634. document_1.documentElement.style.overflow = "hidden";
  94635. addClass(document_1.body, "vjs-full-window");
  94636. this.trigger("enterFullWindow");
  94637. };
  94638. _proto.fullWindowOnEscKey = function fullWindowOnEscKey(event2) {
  94639. if (keycode.isEventKey(event2, "Esc")) {
  94640. if (this.isFullscreen() === true) {
  94641. if (!this.isFullWindow) {
  94642. this.exitFullscreen();
  94643. } else {
  94644. this.exitFullWindow();
  94645. }
  94646. }
  94647. }
  94648. };
  94649. _proto.exitFullWindow = function exitFullWindow() {
  94650. this.isFullscreen(false);
  94651. this.isFullWindow = false;
  94652. off(document_1, "keydown", this.boundFullWindowOnEscKey_);
  94653. document_1.documentElement.style.overflow = this.docOrigOverflow;
  94654. removeClass(document_1.body, "vjs-full-window");
  94655. this.trigger("exitFullWindow");
  94656. };
  94657. _proto.disablePictureInPicture = function disablePictureInPicture(value) {
  94658. if (value === void 0) {
  94659. return this.techGet_("disablePictureInPicture");
  94660. }
  94661. this.techCall_("setDisablePictureInPicture", value);
  94662. this.options_.disablePictureInPicture = value;
  94663. this.trigger("disablepictureinpicturechanged");
  94664. };
  94665. _proto.isInPictureInPicture = function isInPictureInPicture(isPiP) {
  94666. if (isPiP !== void 0) {
  94667. this.isInPictureInPicture_ = !!isPiP;
  94668. this.togglePictureInPictureClass_();
  94669. return;
  94670. }
  94671. return !!this.isInPictureInPicture_;
  94672. };
  94673. _proto.requestPictureInPicture = function requestPictureInPicture() {
  94674. if ("pictureInPictureEnabled" in document_1 && this.disablePictureInPicture() === false) {
  94675. return this.techGet_("requestPictureInPicture");
  94676. }
  94677. };
  94678. _proto.exitPictureInPicture = function exitPictureInPicture() {
  94679. if ("pictureInPictureEnabled" in document_1) {
  94680. return document_1.exitPictureInPicture();
  94681. }
  94682. };
  94683. _proto.handleKeyDown = function handleKeyDown(event2) {
  94684. var userActions = this.options_.userActions;
  94685. if (!userActions || !userActions.hotkeys) {
  94686. return;
  94687. }
  94688. var excludeElement = function excludeElement2(el) {
  94689. var tagName = el.tagName.toLowerCase();
  94690. if (el.isContentEditable) {
  94691. return true;
  94692. }
  94693. var allowedInputTypes = ["button", "checkbox", "hidden", "radio", "reset", "submit"];
  94694. if (tagName === "input") {
  94695. return allowedInputTypes.indexOf(el.type) === -1;
  94696. }
  94697. var excludedTags = ["textarea"];
  94698. return excludedTags.indexOf(tagName) !== -1;
  94699. };
  94700. if (excludeElement(this.el_.ownerDocument.activeElement)) {
  94701. return;
  94702. }
  94703. if (typeof userActions.hotkeys === "function") {
  94704. userActions.hotkeys.call(this, event2);
  94705. } else {
  94706. this.handleHotkeys(event2);
  94707. }
  94708. };
  94709. _proto.handleHotkeys = function handleHotkeys(event2) {
  94710. var hotkeys = this.options_.userActions ? this.options_.userActions.hotkeys : {};
  94711. var _hotkeys$fullscreenKe = hotkeys.fullscreenKey, fullscreenKey = _hotkeys$fullscreenKe === void 0 ? function(keydownEvent) {
  94712. return keycode.isEventKey(keydownEvent, "f");
  94713. } : _hotkeys$fullscreenKe, _hotkeys$muteKey = hotkeys.muteKey, muteKey = _hotkeys$muteKey === void 0 ? function(keydownEvent) {
  94714. return keycode.isEventKey(keydownEvent, "m");
  94715. } : _hotkeys$muteKey, _hotkeys$playPauseKey = hotkeys.playPauseKey, playPauseKey = _hotkeys$playPauseKey === void 0 ? function(keydownEvent) {
  94716. return keycode.isEventKey(keydownEvent, "k") || keycode.isEventKey(keydownEvent, "Space");
  94717. } : _hotkeys$playPauseKey;
  94718. if (fullscreenKey.call(this, event2)) {
  94719. event2.preventDefault();
  94720. event2.stopPropagation();
  94721. var FSToggle = Component$1.getComponent("FullscreenToggle");
  94722. if (document_1[this.fsApi_.fullscreenEnabled] !== false) {
  94723. FSToggle.prototype.handleClick.call(this, event2);
  94724. }
  94725. } else if (muteKey.call(this, event2)) {
  94726. event2.preventDefault();
  94727. event2.stopPropagation();
  94728. var MuteToggle2 = Component$1.getComponent("MuteToggle");
  94729. MuteToggle2.prototype.handleClick.call(this, event2);
  94730. } else if (playPauseKey.call(this, event2)) {
  94731. event2.preventDefault();
  94732. event2.stopPropagation();
  94733. var PlayToggle2 = Component$1.getComponent("PlayToggle");
  94734. PlayToggle2.prototype.handleClick.call(this, event2);
  94735. }
  94736. };
  94737. _proto.canPlayType = function canPlayType3(type2) {
  94738. var can;
  94739. for (var i2 = 0, j = this.options_.techOrder; i2 < j.length; i2++) {
  94740. var techName = j[i2];
  94741. var tech = Tech$1.getTech(techName);
  94742. if (!tech) {
  94743. tech = Component$1.getComponent(techName);
  94744. }
  94745. if (!tech) {
  94746. log$1.error('The "' + techName + '" tech is undefined. Skipped browser support check for that tech.');
  94747. continue;
  94748. }
  94749. if (tech.isSupported()) {
  94750. can = tech.canPlayType(type2);
  94751. if (can) {
  94752. return can;
  94753. }
  94754. }
  94755. }
  94756. return "";
  94757. };
  94758. _proto.selectSource = function selectSource(sources) {
  94759. var _this14 = this;
  94760. var techs = this.options_.techOrder.map(function(techName) {
  94761. return [techName, Tech$1.getTech(techName)];
  94762. }).filter(function(_ref) {
  94763. var techName = _ref[0], tech = _ref[1];
  94764. if (tech) {
  94765. return tech.isSupported();
  94766. }
  94767. log$1.error('The "' + techName + '" tech is undefined. Skipped browser support check for that tech.');
  94768. return false;
  94769. });
  94770. var findFirstPassingTechSourcePair = function findFirstPassingTechSourcePair2(outerArray, innerArray, tester) {
  94771. var found;
  94772. outerArray.some(function(outerChoice) {
  94773. return innerArray.some(function(innerChoice) {
  94774. found = tester(outerChoice, innerChoice);
  94775. if (found) {
  94776. return true;
  94777. }
  94778. });
  94779. });
  94780. return found;
  94781. };
  94782. var foundSourceAndTech;
  94783. var flip = function flip2(fn2) {
  94784. return function(a, b) {
  94785. return fn2(b, a);
  94786. };
  94787. };
  94788. var finder = function finder2(_ref2, source) {
  94789. var techName = _ref2[0], tech = _ref2[1];
  94790. if (tech.canPlaySource(source, _this14.options_[techName.toLowerCase()])) {
  94791. return {
  94792. source,
  94793. tech: techName
  94794. };
  94795. }
  94796. };
  94797. if (this.options_.sourceOrder) {
  94798. foundSourceAndTech = findFirstPassingTechSourcePair(sources, techs, flip(finder));
  94799. } else {
  94800. foundSourceAndTech = findFirstPassingTechSourcePair(techs, sources, finder);
  94801. }
  94802. return foundSourceAndTech || false;
  94803. };
  94804. _proto.handleSrc_ = function handleSrc_(source, isRetry) {
  94805. var _this15 = this;
  94806. if (typeof source === "undefined") {
  94807. return this.cache_.src || "";
  94808. }
  94809. if (this.resetRetryOnError_) {
  94810. this.resetRetryOnError_();
  94811. }
  94812. var sources = filterSource(source);
  94813. if (!sources.length) {
  94814. this.setTimeout(function() {
  94815. this.error({
  94816. code: 4,
  94817. message: this.options_.notSupportedMessage
  94818. });
  94819. }, 0);
  94820. return;
  94821. }
  94822. this.changingSrc_ = true;
  94823. if (!isRetry) {
  94824. this.cache_.sources = sources;
  94825. }
  94826. this.updateSourceCaches_(sources[0]);
  94827. setSource(this, sources[0], function(middlewareSource, mws) {
  94828. _this15.middleware_ = mws;
  94829. if (!isRetry) {
  94830. _this15.cache_.sources = sources;
  94831. }
  94832. _this15.updateSourceCaches_(middlewareSource);
  94833. var err = _this15.src_(middlewareSource);
  94834. if (err) {
  94835. if (sources.length > 1) {
  94836. return _this15.handleSrc_(sources.slice(1));
  94837. }
  94838. _this15.changingSrc_ = false;
  94839. _this15.setTimeout(function() {
  94840. this.error({
  94841. code: 4,
  94842. message: this.options_.notSupportedMessage
  94843. });
  94844. }, 0);
  94845. _this15.triggerReady();
  94846. return;
  94847. }
  94848. setTech(mws, _this15.tech_);
  94849. });
  94850. if (this.options_.retryOnError && sources.length > 1) {
  94851. var retry = function retry2() {
  94852. _this15.error(null);
  94853. _this15.handleSrc_(sources.slice(1), true);
  94854. };
  94855. var stopListeningForErrors = function stopListeningForErrors2() {
  94856. _this15.off("error", retry);
  94857. };
  94858. this.one("error", retry);
  94859. this.one("playing", stopListeningForErrors);
  94860. this.resetRetryOnError_ = function() {
  94861. _this15.off("error", retry);
  94862. _this15.off("playing", stopListeningForErrors);
  94863. };
  94864. }
  94865. };
  94866. _proto.src = function src(source) {
  94867. return this.handleSrc_(source, false);
  94868. };
  94869. _proto.src_ = function src_(source) {
  94870. var _this16 = this;
  94871. var sourceTech = this.selectSource([source]);
  94872. if (!sourceTech) {
  94873. return true;
  94874. }
  94875. if (!titleCaseEquals(sourceTech.tech, this.techName_)) {
  94876. this.changingSrc_ = true;
  94877. this.loadTech_(sourceTech.tech, sourceTech.source);
  94878. this.tech_.ready(function() {
  94879. _this16.changingSrc_ = false;
  94880. });
  94881. return false;
  94882. }
  94883. this.ready(function() {
  94884. if (this.tech_.constructor.prototype.hasOwnProperty("setSource")) {
  94885. this.techCall_("setSource", source);
  94886. } else {
  94887. this.techCall_("src", source.src);
  94888. }
  94889. this.changingSrc_ = false;
  94890. }, true);
  94891. return false;
  94892. };
  94893. _proto.load = function load() {
  94894. this.techCall_("load");
  94895. };
  94896. _proto.reset = function reset3() {
  94897. var _this17 = this;
  94898. var PromiseClass = this.options_.Promise || window_1.Promise;
  94899. if (this.paused() || !PromiseClass) {
  94900. this.doReset_();
  94901. } else {
  94902. var playPromise = this.play();
  94903. silencePromise(playPromise.then(function() {
  94904. return _this17.doReset_();
  94905. }));
  94906. }
  94907. };
  94908. _proto.doReset_ = function doReset_() {
  94909. if (this.tech_) {
  94910. this.tech_.clearTracks("text");
  94911. }
  94912. this.resetCache_();
  94913. this.poster("");
  94914. this.loadTech_(this.options_.techOrder[0], null);
  94915. this.techCall_("reset");
  94916. this.resetControlBarUI_();
  94917. if (isEvented(this)) {
  94918. this.trigger("playerreset");
  94919. }
  94920. };
  94921. _proto.resetControlBarUI_ = function resetControlBarUI_() {
  94922. this.resetProgressBar_();
  94923. this.resetPlaybackRate_();
  94924. this.resetVolumeBar_();
  94925. };
  94926. _proto.resetProgressBar_ = function resetProgressBar_() {
  94927. this.currentTime(0);
  94928. var _ref3 = this.controlBar || {}, durationDisplay = _ref3.durationDisplay, remainingTimeDisplay = _ref3.remainingTimeDisplay;
  94929. if (durationDisplay) {
  94930. durationDisplay.updateContent();
  94931. }
  94932. if (remainingTimeDisplay) {
  94933. remainingTimeDisplay.updateContent();
  94934. }
  94935. };
  94936. _proto.resetPlaybackRate_ = function resetPlaybackRate_() {
  94937. this.playbackRate(this.defaultPlaybackRate());
  94938. this.handleTechRateChange_();
  94939. };
  94940. _proto.resetVolumeBar_ = function resetVolumeBar_() {
  94941. this.volume(1);
  94942. this.trigger("volumechange");
  94943. };
  94944. _proto.currentSources = function currentSources() {
  94945. var source = this.currentSource();
  94946. var sources = [];
  94947. if (Object.keys(source).length !== 0) {
  94948. sources.push(source);
  94949. }
  94950. return this.cache_.sources || sources;
  94951. };
  94952. _proto.currentSource = function currentSource() {
  94953. return this.cache_.source || {};
  94954. };
  94955. _proto.currentSrc = function currentSrc() {
  94956. return this.currentSource() && this.currentSource().src || "";
  94957. };
  94958. _proto.currentType = function currentType() {
  94959. return this.currentSource() && this.currentSource().type || "";
  94960. };
  94961. _proto.preload = function preload(value) {
  94962. if (value !== void 0) {
  94963. this.techCall_("setPreload", value);
  94964. this.options_.preload = value;
  94965. return;
  94966. }
  94967. return this.techGet_("preload");
  94968. };
  94969. _proto.autoplay = function autoplay(value) {
  94970. if (value === void 0) {
  94971. return this.options_.autoplay || false;
  94972. }
  94973. var techAutoplay;
  94974. if (typeof value === "string" && /(any|play|muted)/.test(value) || value === true && this.options_.normalizeAutoplay) {
  94975. this.options_.autoplay = value;
  94976. this.manualAutoplay_(typeof value === "string" ? value : "play");
  94977. techAutoplay = false;
  94978. } else if (!value) {
  94979. this.options_.autoplay = false;
  94980. } else {
  94981. this.options_.autoplay = true;
  94982. }
  94983. techAutoplay = typeof techAutoplay === "undefined" ? this.options_.autoplay : techAutoplay;
  94984. if (this.tech_) {
  94985. this.techCall_("setAutoplay", techAutoplay);
  94986. }
  94987. };
  94988. _proto.playsinline = function playsinline(value) {
  94989. if (value !== void 0) {
  94990. this.techCall_("setPlaysinline", value);
  94991. this.options_.playsinline = value;
  94992. return this;
  94993. }
  94994. return this.techGet_("playsinline");
  94995. };
  94996. _proto.loop = function loop(value) {
  94997. if (value !== void 0) {
  94998. this.techCall_("setLoop", value);
  94999. this.options_.loop = value;
  95000. return;
  95001. }
  95002. return this.techGet_("loop");
  95003. };
  95004. _proto.poster = function poster(src) {
  95005. if (src === void 0) {
  95006. return this.poster_;
  95007. }
  95008. if (!src) {
  95009. src = "";
  95010. }
  95011. if (src === this.poster_) {
  95012. return;
  95013. }
  95014. this.poster_ = src;
  95015. this.techCall_("setPoster", src);
  95016. this.isPosterFromTech_ = false;
  95017. this.trigger("posterchange");
  95018. };
  95019. _proto.handleTechPosterChange_ = function handleTechPosterChange_() {
  95020. if ((!this.poster_ || this.options_.techCanOverridePoster) && this.tech_ && this.tech_.poster) {
  95021. var newPoster = this.tech_.poster() || "";
  95022. if (newPoster !== this.poster_) {
  95023. this.poster_ = newPoster;
  95024. this.isPosterFromTech_ = true;
  95025. this.trigger("posterchange");
  95026. }
  95027. }
  95028. };
  95029. _proto.controls = function controls(bool) {
  95030. if (bool === void 0) {
  95031. return !!this.controls_;
  95032. }
  95033. bool = !!bool;
  95034. if (this.controls_ === bool) {
  95035. return;
  95036. }
  95037. this.controls_ = bool;
  95038. if (this.usingNativeControls()) {
  95039. this.techCall_("setControls", bool);
  95040. }
  95041. if (this.controls_) {
  95042. this.removeClass("vjs-controls-disabled");
  95043. this.addClass("vjs-controls-enabled");
  95044. this.trigger("controlsenabled");
  95045. if (!this.usingNativeControls()) {
  95046. this.addTechControlsListeners_();
  95047. }
  95048. } else {
  95049. this.removeClass("vjs-controls-enabled");
  95050. this.addClass("vjs-controls-disabled");
  95051. this.trigger("controlsdisabled");
  95052. if (!this.usingNativeControls()) {
  95053. this.removeTechControlsListeners_();
  95054. }
  95055. }
  95056. };
  95057. _proto.usingNativeControls = function usingNativeControls(bool) {
  95058. if (bool === void 0) {
  95059. return !!this.usingNativeControls_;
  95060. }
  95061. bool = !!bool;
  95062. if (this.usingNativeControls_ === bool) {
  95063. return;
  95064. }
  95065. this.usingNativeControls_ = bool;
  95066. if (this.usingNativeControls_) {
  95067. this.addClass("vjs-using-native-controls");
  95068. this.trigger("usingnativecontrols");
  95069. } else {
  95070. this.removeClass("vjs-using-native-controls");
  95071. this.trigger("usingcustomcontrols");
  95072. }
  95073. };
  95074. _proto.error = function error(err) {
  95075. var _this18 = this;
  95076. if (err === void 0) {
  95077. return this.error_ || null;
  95078. }
  95079. hooks("beforeerror").forEach(function(hookFunction) {
  95080. var newErr = hookFunction(_this18, err);
  95081. if (!(isObject2(newErr) && !Array.isArray(newErr) || typeof newErr === "string" || typeof newErr === "number" || newErr === null)) {
  95082. _this18.log.error("please return a value that MediaError expects in beforeerror hooks");
  95083. return;
  95084. }
  95085. err = newErr;
  95086. });
  95087. if (this.options_.suppressNotSupportedError && err && err.code === 4) {
  95088. var triggerSuppressedError = function triggerSuppressedError2() {
  95089. this.error(err);
  95090. };
  95091. this.options_.suppressNotSupportedError = false;
  95092. this.any(["click", "touchstart"], triggerSuppressedError);
  95093. this.one("loadstart", function() {
  95094. this.off(["click", "touchstart"], triggerSuppressedError);
  95095. });
  95096. return;
  95097. }
  95098. if (err === null) {
  95099. this.error_ = err;
  95100. this.removeClass("vjs-error");
  95101. if (this.errorDisplay) {
  95102. this.errorDisplay.close();
  95103. }
  95104. return;
  95105. }
  95106. this.error_ = new MediaError(err);
  95107. this.addClass("vjs-error");
  95108. log$1.error("(CODE:" + this.error_.code + " " + MediaError.errorTypes[this.error_.code] + ")", this.error_.message, this.error_);
  95109. this.trigger("error");
  95110. hooks("error").forEach(function(hookFunction) {
  95111. return hookFunction(_this18, _this18.error_);
  95112. });
  95113. return;
  95114. };
  95115. _proto.reportUserActivity = function reportUserActivity(event2) {
  95116. this.userActivity_ = true;
  95117. };
  95118. _proto.userActive = function userActive(bool) {
  95119. if (bool === void 0) {
  95120. return this.userActive_;
  95121. }
  95122. bool = !!bool;
  95123. if (bool === this.userActive_) {
  95124. return;
  95125. }
  95126. this.userActive_ = bool;
  95127. if (this.userActive_) {
  95128. this.userActivity_ = true;
  95129. this.removeClass("vjs-user-inactive");
  95130. this.addClass("vjs-user-active");
  95131. this.trigger("useractive");
  95132. return;
  95133. }
  95134. if (this.tech_) {
  95135. this.tech_.one("mousemove", function(e) {
  95136. e.stopPropagation();
  95137. e.preventDefault();
  95138. });
  95139. }
  95140. this.userActivity_ = false;
  95141. this.removeClass("vjs-user-active");
  95142. this.addClass("vjs-user-inactive");
  95143. this.trigger("userinactive");
  95144. };
  95145. _proto.listenForUserActivity_ = function listenForUserActivity_() {
  95146. var mouseInProgress;
  95147. var lastMoveX;
  95148. var lastMoveY;
  95149. var handleActivity = bind(this, this.reportUserActivity);
  95150. var handleMouseMove = function handleMouseMove2(e) {
  95151. if (e.screenX !== lastMoveX || e.screenY !== lastMoveY) {
  95152. lastMoveX = e.screenX;
  95153. lastMoveY = e.screenY;
  95154. handleActivity();
  95155. }
  95156. };
  95157. var handleMouseDown = function handleMouseDown2() {
  95158. handleActivity();
  95159. this.clearInterval(mouseInProgress);
  95160. mouseInProgress = this.setInterval(handleActivity, 250);
  95161. };
  95162. var handleMouseUpAndMouseLeave = function handleMouseUpAndMouseLeave2(event2) {
  95163. handleActivity();
  95164. this.clearInterval(mouseInProgress);
  95165. };
  95166. this.on("mousedown", handleMouseDown);
  95167. this.on("mousemove", handleMouseMove);
  95168. this.on("mouseup", handleMouseUpAndMouseLeave);
  95169. this.on("mouseleave", handleMouseUpAndMouseLeave);
  95170. var controlBar = this.getChild("controlBar");
  95171. if (controlBar && !IS_IOS && !IS_ANDROID) {
  95172. controlBar.on("mouseenter", function(event2) {
  95173. if (this.player().options_.inactivityTimeout !== 0) {
  95174. this.player().cache_.inactivityTimeout = this.player().options_.inactivityTimeout;
  95175. }
  95176. this.player().options_.inactivityTimeout = 0;
  95177. });
  95178. controlBar.on("mouseleave", function(event2) {
  95179. this.player().options_.inactivityTimeout = this.player().cache_.inactivityTimeout;
  95180. });
  95181. }
  95182. this.on("keydown", handleActivity);
  95183. this.on("keyup", handleActivity);
  95184. var inactivityTimeout;
  95185. this.setInterval(function() {
  95186. if (!this.userActivity_) {
  95187. return;
  95188. }
  95189. this.userActivity_ = false;
  95190. this.userActive(true);
  95191. this.clearTimeout(inactivityTimeout);
  95192. var timeout = this.options_.inactivityTimeout;
  95193. if (timeout <= 0) {
  95194. return;
  95195. }
  95196. inactivityTimeout = this.setTimeout(function() {
  95197. if (!this.userActivity_) {
  95198. this.userActive(false);
  95199. }
  95200. }, timeout);
  95201. }, 250);
  95202. };
  95203. _proto.playbackRate = function playbackRate(rate) {
  95204. if (rate !== void 0) {
  95205. this.techCall_("setPlaybackRate", rate);
  95206. return;
  95207. }
  95208. if (this.tech_ && this.tech_.featuresPlaybackRate) {
  95209. return this.cache_.lastPlaybackRate || this.techGet_("playbackRate");
  95210. }
  95211. return 1;
  95212. };
  95213. _proto.defaultPlaybackRate = function defaultPlaybackRate(rate) {
  95214. if (rate !== void 0) {
  95215. return this.techCall_("setDefaultPlaybackRate", rate);
  95216. }
  95217. if (this.tech_ && this.tech_.featuresPlaybackRate) {
  95218. return this.techGet_("defaultPlaybackRate");
  95219. }
  95220. return 1;
  95221. };
  95222. _proto.isAudio = function isAudio(bool) {
  95223. if (bool !== void 0) {
  95224. this.isAudio_ = !!bool;
  95225. return;
  95226. }
  95227. return !!this.isAudio_;
  95228. };
  95229. _proto.enableAudioOnlyUI_ = function enableAudioOnlyUI_() {
  95230. var _this19 = this;
  95231. this.addClass("vjs-audio-only-mode");
  95232. var playerChildren = this.children();
  95233. var controlBar = this.getChild("ControlBar");
  95234. var controlBarHeight = controlBar && controlBar.currentHeight();
  95235. playerChildren.forEach(function(child) {
  95236. if (child === controlBar) {
  95237. return;
  95238. }
  95239. if (child.el_ && !child.hasClass("vjs-hidden")) {
  95240. child.hide();
  95241. _this19.audioOnlyCache_.hiddenChildren.push(child);
  95242. }
  95243. });
  95244. this.audioOnlyCache_.playerHeight = this.currentHeight();
  95245. this.height(controlBarHeight);
  95246. this.trigger("audioonlymodechange");
  95247. };
  95248. _proto.disableAudioOnlyUI_ = function disableAudioOnlyUI_() {
  95249. this.removeClass("vjs-audio-only-mode");
  95250. this.audioOnlyCache_.hiddenChildren.forEach(function(child) {
  95251. return child.show();
  95252. });
  95253. this.height(this.audioOnlyCache_.playerHeight);
  95254. this.trigger("audioonlymodechange");
  95255. };
  95256. _proto.audioOnlyMode = function audioOnlyMode(value) {
  95257. var _this20 = this;
  95258. if (typeof value !== "boolean" || value === this.audioOnlyMode_) {
  95259. return this.audioOnlyMode_;
  95260. }
  95261. this.audioOnlyMode_ = value;
  95262. var PromiseClass = this.options_.Promise || window_1.Promise;
  95263. if (PromiseClass) {
  95264. if (value) {
  95265. var exitPromises = [];
  95266. if (this.isInPictureInPicture()) {
  95267. exitPromises.push(this.exitPictureInPicture());
  95268. }
  95269. if (this.isFullscreen()) {
  95270. exitPromises.push(this.exitFullscreen());
  95271. }
  95272. if (this.audioPosterMode()) {
  95273. exitPromises.push(this.audioPosterMode(false));
  95274. }
  95275. return PromiseClass.all(exitPromises).then(function() {
  95276. return _this20.enableAudioOnlyUI_();
  95277. });
  95278. }
  95279. return PromiseClass.resolve().then(function() {
  95280. return _this20.disableAudioOnlyUI_();
  95281. });
  95282. }
  95283. if (value) {
  95284. if (this.isInPictureInPicture()) {
  95285. this.exitPictureInPicture();
  95286. }
  95287. if (this.isFullscreen()) {
  95288. this.exitFullscreen();
  95289. }
  95290. this.enableAudioOnlyUI_();
  95291. } else {
  95292. this.disableAudioOnlyUI_();
  95293. }
  95294. };
  95295. _proto.enablePosterModeUI_ = function enablePosterModeUI_() {
  95296. var tech = this.tech_ && this.tech_;
  95297. tech.hide();
  95298. this.addClass("vjs-audio-poster-mode");
  95299. this.trigger("audiopostermodechange");
  95300. };
  95301. _proto.disablePosterModeUI_ = function disablePosterModeUI_() {
  95302. var tech = this.tech_ && this.tech_;
  95303. tech.show();
  95304. this.removeClass("vjs-audio-poster-mode");
  95305. this.trigger("audiopostermodechange");
  95306. };
  95307. _proto.audioPosterMode = function audioPosterMode(value) {
  95308. var _this21 = this;
  95309. if (typeof value !== "boolean" || value === this.audioPosterMode_) {
  95310. return this.audioPosterMode_;
  95311. }
  95312. this.audioPosterMode_ = value;
  95313. var PromiseClass = this.options_.Promise || window_1.Promise;
  95314. if (PromiseClass) {
  95315. if (value) {
  95316. if (this.audioOnlyMode()) {
  95317. var audioOnlyModePromise = this.audioOnlyMode(false);
  95318. return audioOnlyModePromise.then(function() {
  95319. _this21.enablePosterModeUI_();
  95320. });
  95321. }
  95322. return PromiseClass.resolve().then(function() {
  95323. _this21.enablePosterModeUI_();
  95324. });
  95325. }
  95326. return PromiseClass.resolve().then(function() {
  95327. _this21.disablePosterModeUI_();
  95328. });
  95329. }
  95330. if (value) {
  95331. if (this.audioOnlyMode()) {
  95332. this.audioOnlyMode(false);
  95333. }
  95334. this.enablePosterModeUI_();
  95335. return;
  95336. }
  95337. this.disablePosterModeUI_();
  95338. };
  95339. _proto.addTextTrack = function addTextTrack(kind, label, language) {
  95340. if (this.tech_) {
  95341. return this.tech_.addTextTrack(kind, label, language);
  95342. }
  95343. };
  95344. _proto.addRemoteTextTrack = function addRemoteTextTrack(options2, manualCleanup) {
  95345. if (this.tech_) {
  95346. return this.tech_.addRemoteTextTrack(options2, manualCleanup);
  95347. }
  95348. };
  95349. _proto.removeRemoteTextTrack = function removeRemoteTextTrack(obj) {
  95350. if (obj === void 0) {
  95351. obj = {};
  95352. }
  95353. var _obj = obj, track = _obj.track;
  95354. if (!track) {
  95355. track = obj;
  95356. }
  95357. if (this.tech_) {
  95358. return this.tech_.removeRemoteTextTrack(track);
  95359. }
  95360. };
  95361. _proto.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
  95362. return this.techGet_("getVideoPlaybackQuality");
  95363. };
  95364. _proto.videoWidth = function videoWidth() {
  95365. return this.tech_ && this.tech_.videoWidth && this.tech_.videoWidth() || 0;
  95366. };
  95367. _proto.videoHeight = function videoHeight() {
  95368. return this.tech_ && this.tech_.videoHeight && this.tech_.videoHeight() || 0;
  95369. };
  95370. _proto.language = function language(code) {
  95371. if (code === void 0) {
  95372. return this.language_;
  95373. }
  95374. if (this.language_ !== String(code).toLowerCase()) {
  95375. this.language_ = String(code).toLowerCase();
  95376. if (isEvented(this)) {
  95377. this.trigger("languagechange");
  95378. }
  95379. }
  95380. };
  95381. _proto.languages = function languages() {
  95382. return mergeOptions$3(Player2.prototype.options_.languages, this.languages_);
  95383. };
  95384. _proto.toJSON = function toJSON() {
  95385. var options2 = mergeOptions$3(this.options_);
  95386. var tracks = options2.tracks;
  95387. options2.tracks = [];
  95388. for (var i2 = 0; i2 < tracks.length; i2++) {
  95389. var track = tracks[i2];
  95390. track = mergeOptions$3(track);
  95391. track.player = void 0;
  95392. options2.tracks[i2] = track;
  95393. }
  95394. return options2;
  95395. };
  95396. _proto.createModal = function createModal(content, options2) {
  95397. var _this22 = this;
  95398. options2 = options2 || {};
  95399. options2.content = content || "";
  95400. var modal = new ModalDialog(this, options2);
  95401. this.addChild(modal);
  95402. modal.on("dispose", function() {
  95403. _this22.removeChild(modal);
  95404. });
  95405. modal.open();
  95406. return modal;
  95407. };
  95408. _proto.updateCurrentBreakpoint_ = function updateCurrentBreakpoint_() {
  95409. if (!this.responsive()) {
  95410. return;
  95411. }
  95412. var currentBreakpoint = this.currentBreakpoint();
  95413. var currentWidth = this.currentWidth();
  95414. for (var i2 = 0; i2 < BREAKPOINT_ORDER.length; i2++) {
  95415. var candidateBreakpoint = BREAKPOINT_ORDER[i2];
  95416. var maxWidth = this.breakpoints_[candidateBreakpoint];
  95417. if (currentWidth <= maxWidth) {
  95418. if (currentBreakpoint === candidateBreakpoint) {
  95419. return;
  95420. }
  95421. if (currentBreakpoint) {
  95422. this.removeClass(BREAKPOINT_CLASSES[currentBreakpoint]);
  95423. }
  95424. this.addClass(BREAKPOINT_CLASSES[candidateBreakpoint]);
  95425. this.breakpoint_ = candidateBreakpoint;
  95426. break;
  95427. }
  95428. }
  95429. };
  95430. _proto.removeCurrentBreakpoint_ = function removeCurrentBreakpoint_() {
  95431. var className = this.currentBreakpointClass();
  95432. this.breakpoint_ = "";
  95433. if (className) {
  95434. this.removeClass(className);
  95435. }
  95436. };
  95437. _proto.breakpoints = function breakpoints(_breakpoints) {
  95438. if (_breakpoints === void 0) {
  95439. return assign(this.breakpoints_);
  95440. }
  95441. this.breakpoint_ = "";
  95442. this.breakpoints_ = assign({}, DEFAULT_BREAKPOINTS, _breakpoints);
  95443. this.updateCurrentBreakpoint_();
  95444. return assign(this.breakpoints_);
  95445. };
  95446. _proto.responsive = function responsive(value) {
  95447. if (value === void 0) {
  95448. return this.responsive_;
  95449. }
  95450. value = Boolean(value);
  95451. var current = this.responsive_;
  95452. if (value === current) {
  95453. return;
  95454. }
  95455. this.responsive_ = value;
  95456. if (value) {
  95457. this.on("playerresize", this.boundUpdateCurrentBreakpoint_);
  95458. this.updateCurrentBreakpoint_();
  95459. } else {
  95460. this.off("playerresize", this.boundUpdateCurrentBreakpoint_);
  95461. this.removeCurrentBreakpoint_();
  95462. }
  95463. return value;
  95464. };
  95465. _proto.currentBreakpoint = function currentBreakpoint() {
  95466. return this.breakpoint_;
  95467. };
  95468. _proto.currentBreakpointClass = function currentBreakpointClass() {
  95469. return BREAKPOINT_CLASSES[this.breakpoint_] || "";
  95470. };
  95471. _proto.loadMedia = function loadMedia(media, ready) {
  95472. var _this23 = this;
  95473. if (!media || typeof media !== "object") {
  95474. return;
  95475. }
  95476. this.reset();
  95477. this.cache_.media = mergeOptions$3(media);
  95478. var _this$cache_$media = this.cache_.media, artwork = _this$cache_$media.artwork, poster = _this$cache_$media.poster, src = _this$cache_$media.src, textTracks = _this$cache_$media.textTracks;
  95479. if (!artwork && poster) {
  95480. this.cache_.media.artwork = [{
  95481. src: poster,
  95482. type: getMimetype(poster)
  95483. }];
  95484. }
  95485. if (src) {
  95486. this.src(src);
  95487. }
  95488. if (poster) {
  95489. this.poster(poster);
  95490. }
  95491. if (Array.isArray(textTracks)) {
  95492. textTracks.forEach(function(tt2) {
  95493. return _this23.addRemoteTextTrack(tt2, false);
  95494. });
  95495. }
  95496. this.ready(ready);
  95497. };
  95498. _proto.getMedia = function getMedia() {
  95499. if (!this.cache_.media) {
  95500. var poster = this.poster();
  95501. var src = this.currentSources();
  95502. var textTracks = Array.prototype.map.call(this.remoteTextTracks(), function(tt2) {
  95503. return {
  95504. kind: tt2.kind,
  95505. label: tt2.label,
  95506. language: tt2.language,
  95507. src: tt2.src
  95508. };
  95509. });
  95510. var media = {
  95511. src,
  95512. textTracks
  95513. };
  95514. if (poster) {
  95515. media.poster = poster;
  95516. media.artwork = [{
  95517. src: media.poster,
  95518. type: getMimetype(media.poster)
  95519. }];
  95520. }
  95521. return media;
  95522. }
  95523. return mergeOptions$3(this.cache_.media);
  95524. };
  95525. Player2.getTagSettings = function getTagSettings(tag) {
  95526. var baseOptions = {
  95527. sources: [],
  95528. tracks: []
  95529. };
  95530. var tagOptions = getAttributes(tag);
  95531. var dataSetup = tagOptions["data-setup"];
  95532. if (hasClass(tag, "vjs-fill")) {
  95533. tagOptions.fill = true;
  95534. }
  95535. if (hasClass(tag, "vjs-fluid")) {
  95536. tagOptions.fluid = true;
  95537. }
  95538. if (dataSetup !== null) {
  95539. var _safeParseTuple = tuple(dataSetup || "{}"), err = _safeParseTuple[0], data = _safeParseTuple[1];
  95540. if (err) {
  95541. log$1.error(err);
  95542. }
  95543. assign(tagOptions, data);
  95544. }
  95545. assign(baseOptions, tagOptions);
  95546. if (tag.hasChildNodes()) {
  95547. var children = tag.childNodes;
  95548. for (var i2 = 0, j = children.length; i2 < j; i2++) {
  95549. var child = children[i2];
  95550. var childName = child.nodeName.toLowerCase();
  95551. if (childName === "source") {
  95552. baseOptions.sources.push(getAttributes(child));
  95553. } else if (childName === "track") {
  95554. baseOptions.tracks.push(getAttributes(child));
  95555. }
  95556. }
  95557. }
  95558. return baseOptions;
  95559. };
  95560. _proto.flexNotSupported_ = function flexNotSupported_() {
  95561. var elem = document_1.createElement("i");
  95562. return !("flexBasis" in elem.style || "webkitFlexBasis" in elem.style || "mozFlexBasis" in elem.style || "msFlexBasis" in elem.style || "msFlexOrder" in elem.style);
  95563. };
  95564. _proto.debug = function debug(enabled) {
  95565. if (enabled === void 0) {
  95566. return this.debugEnabled_;
  95567. }
  95568. if (enabled) {
  95569. this.trigger("debugon");
  95570. this.previousLogLevel_ = this.log.level;
  95571. this.log.level("debug");
  95572. this.debugEnabled_ = true;
  95573. } else {
  95574. this.trigger("debugoff");
  95575. this.log.level(this.previousLogLevel_);
  95576. this.previousLogLevel_ = void 0;
  95577. this.debugEnabled_ = false;
  95578. }
  95579. };
  95580. _proto.playbackRates = function playbackRates(newRates) {
  95581. if (newRates === void 0) {
  95582. return this.cache_.playbackRates;
  95583. }
  95584. if (!Array.isArray(newRates)) {
  95585. return;
  95586. }
  95587. if (!newRates.every(function(rate) {
  95588. return typeof rate === "number";
  95589. })) {
  95590. return;
  95591. }
  95592. this.cache_.playbackRates = newRates;
  95593. this.trigger("playbackrateschange");
  95594. };
  95595. return Player2;
  95596. }(Component$1);
  95597. ALL.names.forEach(function(name) {
  95598. var props = ALL[name];
  95599. Player.prototype[props.getterName] = function() {
  95600. if (this.tech_) {
  95601. return this.tech_[props.getterName]();
  95602. }
  95603. this[props.privateName] = this[props.privateName] || new props.ListClass();
  95604. return this[props.privateName];
  95605. };
  95606. });
  95607. Player.prototype.crossorigin = Player.prototype.crossOrigin;
  95608. Player.players = {};
  95609. var navigator$2 = window_1.navigator;
  95610. Player.prototype.options_ = {
  95611. techOrder: Tech$1.defaultTechOrder_,
  95612. html5: {},
  95613. inactivityTimeout: 2e3,
  95614. playbackRates: [],
  95615. liveui: false,
  95616. children: ["mediaLoader", "posterImage", "textTrackDisplay", "loadingSpinner", "bigPlayButton", "liveTracker", "controlBar", "errorDisplay", "textTrackSettings", "resizeManager"],
  95617. language: navigator$2 && (navigator$2.languages && navigator$2.languages[0] || navigator$2.userLanguage || navigator$2.language) || "en",
  95618. languages: {},
  95619. notSupportedMessage: "No compatible source was found for this media.",
  95620. normalizeAutoplay: false,
  95621. fullscreen: {
  95622. options: {
  95623. navigationUI: "hide"
  95624. }
  95625. },
  95626. breakpoints: {},
  95627. responsive: false,
  95628. audioOnlyMode: false,
  95629. audioPosterMode: false
  95630. };
  95631. [
  95632. "ended",
  95633. "seeking",
  95634. "seekable",
  95635. "networkState",
  95636. "readyState"
  95637. ].forEach(function(fn2) {
  95638. Player.prototype[fn2] = function() {
  95639. return this.techGet_(fn2);
  95640. };
  95641. });
  95642. TECH_EVENTS_RETRIGGER.forEach(function(event2) {
  95643. Player.prototype["handleTech" + toTitleCase$1(event2) + "_"] = function() {
  95644. return this.trigger(event2);
  95645. };
  95646. });
  95647. Component$1.registerComponent("Player", Player);
  95648. var BASE_PLUGIN_NAME = "plugin";
  95649. var PLUGIN_CACHE_KEY = "activePlugins_";
  95650. var pluginStorage = {};
  95651. var pluginExists = function pluginExists2(name) {
  95652. return pluginStorage.hasOwnProperty(name);
  95653. };
  95654. var getPlugin = function getPlugin2(name) {
  95655. return pluginExists(name) ? pluginStorage[name] : void 0;
  95656. };
  95657. var markPluginAsActive = function markPluginAsActive2(player, name) {
  95658. player[PLUGIN_CACHE_KEY] = player[PLUGIN_CACHE_KEY] || {};
  95659. player[PLUGIN_CACHE_KEY][name] = true;
  95660. };
  95661. var triggerSetupEvent = function triggerSetupEvent2(player, hash, before) {
  95662. var eventName = (before ? "before" : "") + "pluginsetup";
  95663. player.trigger(eventName, hash);
  95664. player.trigger(eventName + ":" + hash.name, hash);
  95665. };
  95666. var createBasicPlugin = function createBasicPlugin2(name, plugin) {
  95667. var basicPluginWrapper = function basicPluginWrapper2() {
  95668. triggerSetupEvent(this, {
  95669. name,
  95670. plugin,
  95671. instance: null
  95672. }, true);
  95673. var instance = plugin.apply(this, arguments);
  95674. markPluginAsActive(this, name);
  95675. triggerSetupEvent(this, {
  95676. name,
  95677. plugin,
  95678. instance
  95679. });
  95680. return instance;
  95681. };
  95682. Object.keys(plugin).forEach(function(prop) {
  95683. basicPluginWrapper[prop] = plugin[prop];
  95684. });
  95685. return basicPluginWrapper;
  95686. };
  95687. var createPluginFactory = function createPluginFactory2(name, PluginSubClass) {
  95688. PluginSubClass.prototype.name = name;
  95689. return function() {
  95690. triggerSetupEvent(this, {
  95691. name,
  95692. plugin: PluginSubClass,
  95693. instance: null
  95694. }, true);
  95695. for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
  95696. args[_key] = arguments[_key];
  95697. }
  95698. var instance = _construct(PluginSubClass, [this].concat(args));
  95699. this[name] = function() {
  95700. return instance;
  95701. };
  95702. triggerSetupEvent(this, instance.getEventHash());
  95703. return instance;
  95704. };
  95705. };
  95706. var Plugin = /* @__PURE__ */ function() {
  95707. function Plugin2(player) {
  95708. if (this.constructor === Plugin2) {
  95709. throw new Error("Plugin must be sub-classed; not directly instantiated.");
  95710. }
  95711. this.player = player;
  95712. if (!this.log) {
  95713. this.log = this.player.log.createLogger(this.name);
  95714. }
  95715. evented(this);
  95716. delete this.trigger;
  95717. stateful(this, this.constructor.defaultState);
  95718. markPluginAsActive(player, this.name);
  95719. this.dispose = this.dispose.bind(this);
  95720. player.on("dispose", this.dispose);
  95721. }
  95722. var _proto = Plugin2.prototype;
  95723. _proto.version = function version2() {
  95724. return this.constructor.VERSION;
  95725. };
  95726. _proto.getEventHash = function getEventHash(hash) {
  95727. if (hash === void 0) {
  95728. hash = {};
  95729. }
  95730. hash.name = this.name;
  95731. hash.plugin = this.constructor;
  95732. hash.instance = this;
  95733. return hash;
  95734. };
  95735. _proto.trigger = function trigger$13(event2, hash) {
  95736. if (hash === void 0) {
  95737. hash = {};
  95738. }
  95739. return trigger(this.eventBusEl_, event2, this.getEventHash(hash));
  95740. };
  95741. _proto.handleStateChanged = function handleStateChanged(e) {
  95742. };
  95743. _proto.dispose = function dispose() {
  95744. var name = this.name, player = this.player;
  95745. this.trigger("dispose");
  95746. this.off();
  95747. player.off("dispose", this.dispose);
  95748. player[PLUGIN_CACHE_KEY][name] = false;
  95749. this.player = this.state = null;
  95750. player[name] = createPluginFactory(name, pluginStorage[name]);
  95751. };
  95752. Plugin2.isBasic = function isBasic(plugin) {
  95753. var p = typeof plugin === "string" ? getPlugin(plugin) : plugin;
  95754. return typeof p === "function" && !Plugin2.prototype.isPrototypeOf(p.prototype);
  95755. };
  95756. Plugin2.registerPlugin = function registerPlugin(name, plugin) {
  95757. if (typeof name !== "string") {
  95758. throw new Error('Illegal plugin name, "' + name + '", must be a string, was ' + typeof name + ".");
  95759. }
  95760. if (pluginExists(name)) {
  95761. log$1.warn('A plugin named "' + name + '" already exists. You may want to avoid re-registering plugins!');
  95762. } else if (Player.prototype.hasOwnProperty(name)) {
  95763. throw new Error('Illegal plugin name, "' + name + '", cannot share a name with an existing player method!');
  95764. }
  95765. if (typeof plugin !== "function") {
  95766. throw new Error('Illegal plugin for "' + name + '", must be a function, was ' + typeof plugin + ".");
  95767. }
  95768. pluginStorage[name] = plugin;
  95769. if (name !== BASE_PLUGIN_NAME) {
  95770. if (Plugin2.isBasic(plugin)) {
  95771. Player.prototype[name] = createBasicPlugin(name, plugin);
  95772. } else {
  95773. Player.prototype[name] = createPluginFactory(name, plugin);
  95774. }
  95775. }
  95776. return plugin;
  95777. };
  95778. Plugin2.deregisterPlugin = function deregisterPlugin(name) {
  95779. if (name === BASE_PLUGIN_NAME) {
  95780. throw new Error("Cannot de-register base plugin.");
  95781. }
  95782. if (pluginExists(name)) {
  95783. delete pluginStorage[name];
  95784. delete Player.prototype[name];
  95785. }
  95786. };
  95787. Plugin2.getPlugins = function getPlugins(names2) {
  95788. if (names2 === void 0) {
  95789. names2 = Object.keys(pluginStorage);
  95790. }
  95791. var result;
  95792. names2.forEach(function(name) {
  95793. var plugin = getPlugin(name);
  95794. if (plugin) {
  95795. result = result || {};
  95796. result[name] = plugin;
  95797. }
  95798. });
  95799. return result;
  95800. };
  95801. Plugin2.getPluginVersion = function getPluginVersion(name) {
  95802. var plugin = getPlugin(name);
  95803. return plugin && plugin.VERSION || "";
  95804. };
  95805. return Plugin2;
  95806. }();
  95807. Plugin.getPlugin = getPlugin;
  95808. Plugin.BASE_PLUGIN_NAME = BASE_PLUGIN_NAME;
  95809. Plugin.registerPlugin(BASE_PLUGIN_NAME, Plugin);
  95810. Player.prototype.usingPlugin = function(name) {
  95811. return !!this[PLUGIN_CACHE_KEY] && this[PLUGIN_CACHE_KEY][name] === true;
  95812. };
  95813. Player.prototype.hasPlugin = function(name) {
  95814. return !!pluginExists(name);
  95815. };
  95816. var hasLogged = false;
  95817. var extend = function extend2(superClass, subClassMethods) {
  95818. if (subClassMethods === void 0) {
  95819. subClassMethods = {};
  95820. }
  95821. if (!hasLogged) {
  95822. log$1.warn("videojs.extend is deprecated as of Video.js 7.22.0 and will be removed in Video.js 8.0.0");
  95823. hasLogged = true;
  95824. }
  95825. var subClass = function subClass2() {
  95826. superClass.apply(this, arguments);
  95827. };
  95828. var methods = {};
  95829. if (typeof subClassMethods === "object") {
  95830. if (subClassMethods.constructor !== Object.prototype.constructor) {
  95831. subClass = subClassMethods.constructor;
  95832. }
  95833. methods = subClassMethods;
  95834. } else if (typeof subClassMethods === "function") {
  95835. subClass = subClassMethods;
  95836. }
  95837. _inherits(subClass, superClass);
  95838. if (superClass) {
  95839. subClass.super_ = superClass;
  95840. }
  95841. for (var name in methods) {
  95842. if (methods.hasOwnProperty(name)) {
  95843. subClass.prototype[name] = methods[name];
  95844. }
  95845. }
  95846. return subClass;
  95847. };
  95848. var normalizeId = function normalizeId2(id) {
  95849. return id.indexOf("#") === 0 ? id.slice(1) : id;
  95850. };
  95851. function videojs(id, options2, ready) {
  95852. var player = videojs.getPlayer(id);
  95853. if (player) {
  95854. if (options2) {
  95855. log$1.warn('Player "' + id + '" is already initialised. Options will not be applied.');
  95856. }
  95857. if (ready) {
  95858. player.ready(ready);
  95859. }
  95860. return player;
  95861. }
  95862. var el = typeof id === "string" ? $("#" + normalizeId(id)) : id;
  95863. if (!isEl(el)) {
  95864. throw new TypeError("The element or ID supplied is not valid. (videojs)");
  95865. }
  95866. if (!el.ownerDocument.defaultView || !el.ownerDocument.body.contains(el)) {
  95867. log$1.warn("The element supplied is not included in the DOM");
  95868. }
  95869. options2 = options2 || {};
  95870. if (options2.restoreEl === true) {
  95871. options2.restoreEl = (el.parentNode && el.parentNode.hasAttribute("data-vjs-player") ? el.parentNode : el).cloneNode(true);
  95872. }
  95873. hooks("beforesetup").forEach(function(hookFunction) {
  95874. var opts = hookFunction(el, mergeOptions$3(options2));
  95875. if (!isObject2(opts) || Array.isArray(opts)) {
  95876. log$1.error("please return an object in beforesetup hooks");
  95877. return;
  95878. }
  95879. options2 = mergeOptions$3(options2, opts);
  95880. });
  95881. var PlayerComponent = Component$1.getComponent("Player");
  95882. player = new PlayerComponent(el, options2, ready);
  95883. hooks("setup").forEach(function(hookFunction) {
  95884. return hookFunction(player);
  95885. });
  95886. return player;
  95887. }
  95888. videojs.hooks_ = hooks_;
  95889. videojs.hooks = hooks;
  95890. videojs.hook = hook;
  95891. videojs.hookOnce = hookOnce;
  95892. videojs.removeHook = removeHook;
  95893. if (window_1.VIDEOJS_NO_DYNAMIC_STYLE !== true && isReal()) {
  95894. var style = $(".vjs-styles-defaults");
  95895. if (!style) {
  95896. style = createStyleElement("vjs-styles-defaults");
  95897. var head = $("head");
  95898. if (head) {
  95899. head.insertBefore(style, head.firstChild);
  95900. }
  95901. setTextContent(style, "\n .video-js {\n width: 300px;\n height: 150px;\n }\n\n .vjs-fluid:not(.vjs-audio-only-mode) {\n padding-top: 56.25%\n }\n ");
  95902. }
  95903. }
  95904. autoSetupTimeout(1, videojs);
  95905. videojs.VERSION = version$5;
  95906. videojs.options = Player.prototype.options_;
  95907. videojs.getPlayers = function() {
  95908. return Player.players;
  95909. };
  95910. videojs.getPlayer = function(id) {
  95911. var players = Player.players;
  95912. var tag;
  95913. if (typeof id === "string") {
  95914. var nId = normalizeId(id);
  95915. var player = players[nId];
  95916. if (player) {
  95917. return player;
  95918. }
  95919. tag = $("#" + nId);
  95920. } else {
  95921. tag = id;
  95922. }
  95923. if (isEl(tag)) {
  95924. var _tag = tag, _player = _tag.player, playerId = _tag.playerId;
  95925. if (_player || players[playerId]) {
  95926. return _player || players[playerId];
  95927. }
  95928. }
  95929. };
  95930. videojs.getAllPlayers = function() {
  95931. return Object.keys(Player.players).map(function(k) {
  95932. return Player.players[k];
  95933. }).filter(Boolean);
  95934. };
  95935. videojs.players = Player.players;
  95936. videojs.getComponent = Component$1.getComponent;
  95937. videojs.registerComponent = function(name, comp) {
  95938. if (Tech$1.isTech(comp)) {
  95939. log$1.warn("The " + name + " tech was registered as a component. It should instead be registered using videojs.registerTech(name, tech)");
  95940. }
  95941. Component$1.registerComponent.call(Component$1, name, comp);
  95942. };
  95943. videojs.getTech = Tech$1.getTech;
  95944. videojs.registerTech = Tech$1.registerTech;
  95945. videojs.use = use;
  95946. Object.defineProperty(videojs, "middleware", {
  95947. value: {},
  95948. writeable: false,
  95949. enumerable: true
  95950. });
  95951. Object.defineProperty(videojs.middleware, "TERMINATOR", {
  95952. value: TERMINATOR,
  95953. writeable: false,
  95954. enumerable: true
  95955. });
  95956. videojs.browser = browser;
  95957. videojs.TOUCH_ENABLED = TOUCH_ENABLED;
  95958. videojs.extend = extend;
  95959. videojs.mergeOptions = mergeOptions$3;
  95960. videojs.bind = bind;
  95961. videojs.registerPlugin = Plugin.registerPlugin;
  95962. videojs.deregisterPlugin = Plugin.deregisterPlugin;
  95963. videojs.plugin = function(name, plugin) {
  95964. log$1.warn("videojs.plugin() is deprecated; use videojs.registerPlugin() instead");
  95965. return Plugin.registerPlugin(name, plugin);
  95966. };
  95967. videojs.getPlugins = Plugin.getPlugins;
  95968. videojs.getPlugin = Plugin.getPlugin;
  95969. videojs.getPluginVersion = Plugin.getPluginVersion;
  95970. videojs.addLanguage = function(code, data) {
  95971. var _mergeOptions;
  95972. code = ("" + code).toLowerCase();
  95973. videojs.options.languages = mergeOptions$3(videojs.options.languages, (_mergeOptions = {}, _mergeOptions[code] = data, _mergeOptions));
  95974. return videojs.options.languages[code];
  95975. };
  95976. videojs.log = log$1;
  95977. videojs.createLogger = createLogger;
  95978. videojs.createTimeRange = videojs.createTimeRanges = createTimeRanges;
  95979. videojs.formatTime = formatTime;
  95980. videojs.setFormatTime = setFormatTime;
  95981. videojs.resetFormatTime = resetFormatTime;
  95982. videojs.parseUrl = parseUrl;
  95983. videojs.isCrossOrigin = isCrossOrigin;
  95984. videojs.EventTarget = EventTarget$2;
  95985. videojs.on = on;
  95986. videojs.one = one;
  95987. videojs.off = off;
  95988. videojs.trigger = trigger;
  95989. videojs.xhr = XHR;
  95990. videojs.TextTrack = TextTrack;
  95991. videojs.AudioTrack = AudioTrack;
  95992. videojs.VideoTrack = VideoTrack;
  95993. ["isEl", "isTextNode", "createEl", "hasClass", "addClass", "removeClass", "toggleClass", "setAttributes", "getAttributes", "emptyEl", "appendContent", "insertContent"].forEach(function(k) {
  95994. videojs[k] = function() {
  95995. log$1.warn("videojs." + k + "() is deprecated; use videojs.dom." + k + "() instead");
  95996. return Dom$1[k].apply(null, arguments);
  95997. };
  95998. });
  95999. videojs.computedStyle = computedStyle;
  96000. videojs.dom = Dom$1;
  96001. videojs.url = Url$1;
  96002. videojs.defineLazyProperty = defineLazyProperty;
  96003. videojs.addLanguage("en", {
  96004. "Non-Fullscreen": "Exit Fullscreen"
  96005. });
  96006. /*! @name @videojs/http-streaming @version 2.16.2 @license Apache-2.0 */
  96007. var resolveUrl4 = resolveUrl$1;
  96008. var resolveManifestRedirect = function resolveManifestRedirect2(handleManifestRedirect, url, req) {
  96009. if (handleManifestRedirect && req && req.responseURL && url !== req.responseURL) {
  96010. return req.responseURL;
  96011. }
  96012. return url;
  96013. };
  96014. var logger = function logger2(source) {
  96015. if (videojs.log.debug) {
  96016. return videojs.log.debug.bind(videojs, "VHS:", source + " >");
  96017. }
  96018. return function() {
  96019. };
  96020. };
  96021. var TIME_FUDGE_FACTOR = 1 / 30;
  96022. var SAFE_TIME_DELTA = TIME_FUDGE_FACTOR * 3;
  96023. var filterRanges = function filterRanges2(timeRanges, predicate) {
  96024. var results = [];
  96025. var i2;
  96026. if (timeRanges && timeRanges.length) {
  96027. for (i2 = 0; i2 < timeRanges.length; i2++) {
  96028. if (predicate(timeRanges.start(i2), timeRanges.end(i2))) {
  96029. results.push([timeRanges.start(i2), timeRanges.end(i2)]);
  96030. }
  96031. }
  96032. }
  96033. return videojs.createTimeRanges(results);
  96034. };
  96035. var findRange = function findRange2(buffered, time) {
  96036. return filterRanges(buffered, function(start2, end) {
  96037. return start2 - SAFE_TIME_DELTA <= time && end + SAFE_TIME_DELTA >= time;
  96038. });
  96039. };
  96040. var findNextRange = function findNextRange2(timeRanges, time) {
  96041. return filterRanges(timeRanges, function(start2) {
  96042. return start2 - TIME_FUDGE_FACTOR >= time;
  96043. });
  96044. };
  96045. var findGaps = function findGaps2(buffered) {
  96046. if (buffered.length < 2) {
  96047. return videojs.createTimeRanges();
  96048. }
  96049. var ranges = [];
  96050. for (var i2 = 1; i2 < buffered.length; i2++) {
  96051. var start2 = buffered.end(i2 - 1);
  96052. var end = buffered.start(i2);
  96053. ranges.push([start2, end]);
  96054. }
  96055. return videojs.createTimeRanges(ranges);
  96056. };
  96057. var bufferIntersection = function bufferIntersection2(bufferA, bufferB) {
  96058. var start2 = null;
  96059. var end = null;
  96060. var arity = 0;
  96061. var extents = [];
  96062. var ranges = [];
  96063. if (!bufferA || !bufferA.length || !bufferB || !bufferB.length) {
  96064. return videojs.createTimeRange();
  96065. }
  96066. var count = bufferA.length;
  96067. while (count--) {
  96068. extents.push({
  96069. time: bufferA.start(count),
  96070. type: "start"
  96071. });
  96072. extents.push({
  96073. time: bufferA.end(count),
  96074. type: "end"
  96075. });
  96076. }
  96077. count = bufferB.length;
  96078. while (count--) {
  96079. extents.push({
  96080. time: bufferB.start(count),
  96081. type: "start"
  96082. });
  96083. extents.push({
  96084. time: bufferB.end(count),
  96085. type: "end"
  96086. });
  96087. }
  96088. extents.sort(function(a, b) {
  96089. return a.time - b.time;
  96090. });
  96091. for (count = 0; count < extents.length; count++) {
  96092. if (extents[count].type === "start") {
  96093. arity++;
  96094. if (arity === 2) {
  96095. start2 = extents[count].time;
  96096. }
  96097. } else if (extents[count].type === "end") {
  96098. arity--;
  96099. if (arity === 1) {
  96100. end = extents[count].time;
  96101. }
  96102. }
  96103. if (start2 !== null && end !== null) {
  96104. ranges.push([start2, end]);
  96105. start2 = null;
  96106. end = null;
  96107. }
  96108. }
  96109. return videojs.createTimeRanges(ranges);
  96110. };
  96111. var printableRange = function printableRange2(range3) {
  96112. var strArr = [];
  96113. if (!range3 || !range3.length) {
  96114. return "";
  96115. }
  96116. for (var i2 = 0; i2 < range3.length; i2++) {
  96117. strArr.push(range3.start(i2) + " => " + range3.end(i2));
  96118. }
  96119. return strArr.join(", ");
  96120. };
  96121. var timeUntilRebuffer = function timeUntilRebuffer2(buffered, currentTime, playbackRate) {
  96122. if (playbackRate === void 0) {
  96123. playbackRate = 1;
  96124. }
  96125. var bufferedEnd = buffered.length ? buffered.end(buffered.length - 1) : 0;
  96126. return (bufferedEnd - currentTime) / playbackRate;
  96127. };
  96128. var timeRangesToArray = function timeRangesToArray2(timeRanges) {
  96129. var timeRangesList = [];
  96130. for (var i2 = 0; i2 < timeRanges.length; i2++) {
  96131. timeRangesList.push({
  96132. start: timeRanges.start(i2),
  96133. end: timeRanges.end(i2)
  96134. });
  96135. }
  96136. return timeRangesList;
  96137. };
  96138. var isRangeDifferent = function isRangeDifferent2(a, b) {
  96139. if (a === b) {
  96140. return false;
  96141. }
  96142. if (!a && b || !b && a) {
  96143. return true;
  96144. }
  96145. if (a.length !== b.length) {
  96146. return true;
  96147. }
  96148. for (var i2 = 0; i2 < a.length; i2++) {
  96149. if (a.start(i2) !== b.start(i2) || a.end(i2) !== b.end(i2)) {
  96150. return true;
  96151. }
  96152. }
  96153. return false;
  96154. };
  96155. var lastBufferedEnd = function lastBufferedEnd2(a) {
  96156. if (!a || !a.length || !a.end) {
  96157. return;
  96158. }
  96159. return a.end(a.length - 1);
  96160. };
  96161. var timeAheadOf = function timeAheadOf2(range3, startTime) {
  96162. var time = 0;
  96163. if (!range3 || !range3.length) {
  96164. return time;
  96165. }
  96166. for (var i2 = 0; i2 < range3.length; i2++) {
  96167. var start2 = range3.start(i2);
  96168. var end = range3.end(i2);
  96169. if (startTime > end) {
  96170. continue;
  96171. }
  96172. if (startTime > start2 && startTime <= end) {
  96173. time += end - startTime;
  96174. continue;
  96175. }
  96176. time += end - start2;
  96177. }
  96178. return time;
  96179. };
  96180. var createTimeRange$1 = videojs.createTimeRange;
  96181. var segmentDurationWithParts = function segmentDurationWithParts2(playlist, segment) {
  96182. if (!segment.preload) {
  96183. return segment.duration;
  96184. }
  96185. var result = 0;
  96186. (segment.parts || []).forEach(function(p) {
  96187. result += p.duration;
  96188. });
  96189. (segment.preloadHints || []).forEach(function(p) {
  96190. if (p.type === "PART") {
  96191. result += playlist.partTargetDuration;
  96192. }
  96193. });
  96194. return result;
  96195. };
  96196. var getPartsAndSegments = function getPartsAndSegments2(playlist) {
  96197. return (playlist.segments || []).reduce(function(acc, segment, si) {
  96198. if (segment.parts) {
  96199. segment.parts.forEach(function(part, pi) {
  96200. acc.push({
  96201. duration: part.duration,
  96202. segmentIndex: si,
  96203. partIndex: pi,
  96204. part,
  96205. segment
  96206. });
  96207. });
  96208. } else {
  96209. acc.push({
  96210. duration: segment.duration,
  96211. segmentIndex: si,
  96212. partIndex: null,
  96213. segment,
  96214. part: null
  96215. });
  96216. }
  96217. return acc;
  96218. }, []);
  96219. };
  96220. var getLastParts = function getLastParts2(media) {
  96221. var lastSegment = media.segments && media.segments.length && media.segments[media.segments.length - 1];
  96222. return lastSegment && lastSegment.parts || [];
  96223. };
  96224. var getKnownPartCount = function getKnownPartCount2(_ref) {
  96225. var preloadSegment = _ref.preloadSegment;
  96226. if (!preloadSegment) {
  96227. return;
  96228. }
  96229. var parts = preloadSegment.parts, preloadHints = preloadSegment.preloadHints;
  96230. var partCount = (preloadHints || []).reduce(function(count, hint) {
  96231. return count + (hint.type === "PART" ? 1 : 0);
  96232. }, 0);
  96233. partCount += parts && parts.length ? parts.length : 0;
  96234. return partCount;
  96235. };
  96236. var liveEdgeDelay = function liveEdgeDelay2(master, media) {
  96237. if (media.endList) {
  96238. return 0;
  96239. }
  96240. if (master && master.suggestedPresentationDelay) {
  96241. return master.suggestedPresentationDelay;
  96242. }
  96243. var hasParts = getLastParts(media).length > 0;
  96244. if (hasParts && media.serverControl && media.serverControl.partHoldBack) {
  96245. return media.serverControl.partHoldBack;
  96246. } else if (hasParts && media.partTargetDuration) {
  96247. return media.partTargetDuration * 3;
  96248. } else if (media.serverControl && media.serverControl.holdBack) {
  96249. return media.serverControl.holdBack;
  96250. } else if (media.targetDuration) {
  96251. return media.targetDuration * 3;
  96252. }
  96253. return 0;
  96254. };
  96255. var backwardDuration = function backwardDuration2(playlist, endSequence) {
  96256. var result = 0;
  96257. var i2 = endSequence - playlist.mediaSequence;
  96258. var segment = playlist.segments[i2];
  96259. if (segment) {
  96260. if (typeof segment.start !== "undefined") {
  96261. return {
  96262. result: segment.start,
  96263. precise: true
  96264. };
  96265. }
  96266. if (typeof segment.end !== "undefined") {
  96267. return {
  96268. result: segment.end - segment.duration,
  96269. precise: true
  96270. };
  96271. }
  96272. }
  96273. while (i2--) {
  96274. segment = playlist.segments[i2];
  96275. if (typeof segment.end !== "undefined") {
  96276. return {
  96277. result: result + segment.end,
  96278. precise: true
  96279. };
  96280. }
  96281. result += segmentDurationWithParts(playlist, segment);
  96282. if (typeof segment.start !== "undefined") {
  96283. return {
  96284. result: result + segment.start,
  96285. precise: true
  96286. };
  96287. }
  96288. }
  96289. return {
  96290. result,
  96291. precise: false
  96292. };
  96293. };
  96294. var forwardDuration = function forwardDuration2(playlist, endSequence) {
  96295. var result = 0;
  96296. var segment;
  96297. var i2 = endSequence - playlist.mediaSequence;
  96298. for (; i2 < playlist.segments.length; i2++) {
  96299. segment = playlist.segments[i2];
  96300. if (typeof segment.start !== "undefined") {
  96301. return {
  96302. result: segment.start - result,
  96303. precise: true
  96304. };
  96305. }
  96306. result += segmentDurationWithParts(playlist, segment);
  96307. if (typeof segment.end !== "undefined") {
  96308. return {
  96309. result: segment.end - result,
  96310. precise: true
  96311. };
  96312. }
  96313. }
  96314. return {
  96315. result: -1,
  96316. precise: false
  96317. };
  96318. };
  96319. var intervalDuration = function intervalDuration2(playlist, endSequence, expired) {
  96320. if (typeof endSequence === "undefined") {
  96321. endSequence = playlist.mediaSequence + playlist.segments.length;
  96322. }
  96323. if (endSequence < playlist.mediaSequence) {
  96324. return 0;
  96325. }
  96326. var backward = backwardDuration(playlist, endSequence);
  96327. if (backward.precise) {
  96328. return backward.result;
  96329. }
  96330. var forward = forwardDuration(playlist, endSequence);
  96331. if (forward.precise) {
  96332. return forward.result;
  96333. }
  96334. return backward.result + expired;
  96335. };
  96336. var duration2 = function duration3(playlist, endSequence, expired) {
  96337. if (!playlist) {
  96338. return 0;
  96339. }
  96340. if (typeof expired !== "number") {
  96341. expired = 0;
  96342. }
  96343. if (typeof endSequence === "undefined") {
  96344. if (playlist.totalDuration) {
  96345. return playlist.totalDuration;
  96346. }
  96347. if (!playlist.endList) {
  96348. return window_1.Infinity;
  96349. }
  96350. }
  96351. return intervalDuration(playlist, endSequence, expired);
  96352. };
  96353. var sumDurations = function sumDurations2(_ref2) {
  96354. var defaultDuration = _ref2.defaultDuration, durationList = _ref2.durationList, startIndex = _ref2.startIndex, endIndex = _ref2.endIndex;
  96355. var durations = 0;
  96356. if (startIndex > endIndex) {
  96357. var _ref3 = [endIndex, startIndex];
  96358. startIndex = _ref3[0];
  96359. endIndex = _ref3[1];
  96360. }
  96361. if (startIndex < 0) {
  96362. for (var i2 = startIndex; i2 < Math.min(0, endIndex); i2++) {
  96363. durations += defaultDuration;
  96364. }
  96365. startIndex = 0;
  96366. }
  96367. for (var _i = startIndex; _i < endIndex; _i++) {
  96368. durations += durationList[_i].duration;
  96369. }
  96370. return durations;
  96371. };
  96372. var playlistEnd = function playlistEnd2(playlist, expired, useSafeLiveEnd, liveEdgePadding) {
  96373. if (!playlist || !playlist.segments) {
  96374. return null;
  96375. }
  96376. if (playlist.endList) {
  96377. return duration2(playlist);
  96378. }
  96379. if (expired === null) {
  96380. return null;
  96381. }
  96382. expired = expired || 0;
  96383. var lastSegmentEndTime = intervalDuration(playlist, playlist.mediaSequence + playlist.segments.length, expired);
  96384. if (useSafeLiveEnd) {
  96385. liveEdgePadding = typeof liveEdgePadding === "number" ? liveEdgePadding : liveEdgeDelay(null, playlist);
  96386. lastSegmentEndTime -= liveEdgePadding;
  96387. }
  96388. return Math.max(0, lastSegmentEndTime);
  96389. };
  96390. var seekable = function seekable2(playlist, expired, liveEdgePadding) {
  96391. var useSafeLiveEnd = true;
  96392. var seekableStart = expired || 0;
  96393. var seekableEnd = playlistEnd(playlist, expired, useSafeLiveEnd, liveEdgePadding);
  96394. if (seekableEnd === null) {
  96395. return createTimeRange$1();
  96396. }
  96397. return createTimeRange$1(seekableStart, seekableEnd);
  96398. };
  96399. var getMediaInfoForTime = function getMediaInfoForTime2(_ref4) {
  96400. var playlist = _ref4.playlist, currentTime = _ref4.currentTime, startingSegmentIndex = _ref4.startingSegmentIndex, startingPartIndex = _ref4.startingPartIndex, startTime = _ref4.startTime, experimentalExactManifestTimings = _ref4.experimentalExactManifestTimings;
  96401. var time = currentTime - startTime;
  96402. var partsAndSegments = getPartsAndSegments(playlist);
  96403. var startIndex = 0;
  96404. for (var i2 = 0; i2 < partsAndSegments.length; i2++) {
  96405. var partAndSegment = partsAndSegments[i2];
  96406. if (startingSegmentIndex !== partAndSegment.segmentIndex) {
  96407. continue;
  96408. }
  96409. if (typeof startingPartIndex === "number" && typeof partAndSegment.partIndex === "number" && startingPartIndex !== partAndSegment.partIndex) {
  96410. continue;
  96411. }
  96412. startIndex = i2;
  96413. break;
  96414. }
  96415. if (time < 0) {
  96416. if (startIndex > 0) {
  96417. for (var _i2 = startIndex - 1; _i2 >= 0; _i2--) {
  96418. var _partAndSegment = partsAndSegments[_i2];
  96419. time += _partAndSegment.duration;
  96420. if (experimentalExactManifestTimings) {
  96421. if (time < 0) {
  96422. continue;
  96423. }
  96424. } else if (time + TIME_FUDGE_FACTOR <= 0) {
  96425. continue;
  96426. }
  96427. return {
  96428. partIndex: _partAndSegment.partIndex,
  96429. segmentIndex: _partAndSegment.segmentIndex,
  96430. startTime: startTime - sumDurations({
  96431. defaultDuration: playlist.targetDuration,
  96432. durationList: partsAndSegments,
  96433. startIndex,
  96434. endIndex: _i2
  96435. })
  96436. };
  96437. }
  96438. }
  96439. return {
  96440. partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,
  96441. segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,
  96442. startTime: currentTime
  96443. };
  96444. }
  96445. if (startIndex < 0) {
  96446. for (var _i3 = startIndex; _i3 < 0; _i3++) {
  96447. time -= playlist.targetDuration;
  96448. if (time < 0) {
  96449. return {
  96450. partIndex: partsAndSegments[0] && partsAndSegments[0].partIndex || null,
  96451. segmentIndex: partsAndSegments[0] && partsAndSegments[0].segmentIndex || 0,
  96452. startTime: currentTime
  96453. };
  96454. }
  96455. }
  96456. startIndex = 0;
  96457. }
  96458. for (var _i4 = startIndex; _i4 < partsAndSegments.length; _i4++) {
  96459. var _partAndSegment2 = partsAndSegments[_i4];
  96460. time -= _partAndSegment2.duration;
  96461. if (experimentalExactManifestTimings) {
  96462. if (time > 0) {
  96463. continue;
  96464. }
  96465. } else if (time - TIME_FUDGE_FACTOR >= 0) {
  96466. continue;
  96467. }
  96468. return {
  96469. partIndex: _partAndSegment2.partIndex,
  96470. segmentIndex: _partAndSegment2.segmentIndex,
  96471. startTime: startTime + sumDurations({
  96472. defaultDuration: playlist.targetDuration,
  96473. durationList: partsAndSegments,
  96474. startIndex,
  96475. endIndex: _i4
  96476. })
  96477. };
  96478. }
  96479. return {
  96480. segmentIndex: partsAndSegments[partsAndSegments.length - 1].segmentIndex,
  96481. partIndex: partsAndSegments[partsAndSegments.length - 1].partIndex,
  96482. startTime: currentTime
  96483. };
  96484. };
  96485. var isBlacklisted = function isBlacklisted2(playlist) {
  96486. return playlist.excludeUntil && playlist.excludeUntil > Date.now();
  96487. };
  96488. var isIncompatible = function isIncompatible2(playlist) {
  96489. return playlist.excludeUntil && playlist.excludeUntil === Infinity;
  96490. };
  96491. var isEnabled = function isEnabled2(playlist) {
  96492. var blacklisted = isBlacklisted(playlist);
  96493. return !playlist.disabled && !blacklisted;
  96494. };
  96495. var isDisabled = function isDisabled2(playlist) {
  96496. return playlist.disabled;
  96497. };
  96498. var isAes = function isAes2(media) {
  96499. for (var i2 = 0; i2 < media.segments.length; i2++) {
  96500. if (media.segments[i2].key) {
  96501. return true;
  96502. }
  96503. }
  96504. return false;
  96505. };
  96506. var hasAttribute = function hasAttribute2(attr, playlist) {
  96507. return playlist.attributes && playlist.attributes[attr];
  96508. };
  96509. var estimateSegmentRequestTime = function estimateSegmentRequestTime2(segmentDuration, bandwidth2, playlist, bytesReceived) {
  96510. if (bytesReceived === void 0) {
  96511. bytesReceived = 0;
  96512. }
  96513. if (!hasAttribute("BANDWIDTH", playlist)) {
  96514. return NaN;
  96515. }
  96516. var size = segmentDuration * playlist.attributes.BANDWIDTH;
  96517. return (size - bytesReceived * 8) / bandwidth2;
  96518. };
  96519. var isLowestEnabledRendition = function isLowestEnabledRendition2(master, media) {
  96520. if (master.playlists.length === 1) {
  96521. return true;
  96522. }
  96523. var currentBandwidth = media.attributes.BANDWIDTH || Number.MAX_VALUE;
  96524. return master.playlists.filter(function(playlist) {
  96525. if (!isEnabled(playlist)) {
  96526. return false;
  96527. }
  96528. return (playlist.attributes.BANDWIDTH || 0) < currentBandwidth;
  96529. }).length === 0;
  96530. };
  96531. var playlistMatch = function playlistMatch2(a, b) {
  96532. if (!a && !b || !a && b || a && !b) {
  96533. return false;
  96534. }
  96535. if (a === b) {
  96536. return true;
  96537. }
  96538. if (a.id && b.id && a.id === b.id) {
  96539. return true;
  96540. }
  96541. if (a.resolvedUri && b.resolvedUri && a.resolvedUri === b.resolvedUri) {
  96542. return true;
  96543. }
  96544. if (a.uri && b.uri && a.uri === b.uri) {
  96545. return true;
  96546. }
  96547. return false;
  96548. };
  96549. var someAudioVariant = function someAudioVariant2(master, callback2) {
  96550. var AUDIO5 = master && master.mediaGroups && master.mediaGroups.AUDIO || {};
  96551. var found = false;
  96552. for (var groupName in AUDIO5) {
  96553. for (var label in AUDIO5[groupName]) {
  96554. found = callback2(AUDIO5[groupName][label]);
  96555. if (found) {
  96556. break;
  96557. }
  96558. }
  96559. if (found) {
  96560. break;
  96561. }
  96562. }
  96563. return !!found;
  96564. };
  96565. var isAudioOnly = function isAudioOnly2(master) {
  96566. if (!master || !master.playlists || !master.playlists.length) {
  96567. var found = someAudioVariant(master, function(variant) {
  96568. return variant.playlists && variant.playlists.length || variant.uri;
  96569. });
  96570. return found;
  96571. }
  96572. var _loop = function _loop2(i3) {
  96573. var playlist = master.playlists[i3];
  96574. var CODECS = playlist.attributes && playlist.attributes.CODECS;
  96575. if (CODECS && CODECS.split(",").every(function(c) {
  96576. return isAudioCodec2(c);
  96577. })) {
  96578. return "continue";
  96579. }
  96580. var found2 = someAudioVariant(master, function(variant) {
  96581. return playlistMatch(playlist, variant);
  96582. });
  96583. if (found2) {
  96584. return "continue";
  96585. }
  96586. return {
  96587. v: false
  96588. };
  96589. };
  96590. for (var i2 = 0; i2 < master.playlists.length; i2++) {
  96591. var _ret = _loop(i2);
  96592. if (_ret === "continue")
  96593. continue;
  96594. if (typeof _ret === "object")
  96595. return _ret.v;
  96596. }
  96597. return true;
  96598. };
  96599. var Playlist = {
  96600. liveEdgeDelay,
  96601. duration: duration2,
  96602. seekable,
  96603. getMediaInfoForTime,
  96604. isEnabled,
  96605. isDisabled,
  96606. isBlacklisted,
  96607. isIncompatible,
  96608. playlistEnd,
  96609. isAes,
  96610. hasAttribute,
  96611. estimateSegmentRequestTime,
  96612. isLowestEnabledRendition,
  96613. isAudioOnly,
  96614. playlistMatch,
  96615. segmentDurationWithParts
  96616. };
  96617. var log = videojs.log;
  96618. var createPlaylistID = function createPlaylistID2(index2, uri) {
  96619. return index2 + "-" + uri;
  96620. };
  96621. var groupID = function groupID2(type2, group, label) {
  96622. return "placeholder-uri-" + type2 + "-" + group + "-" + label;
  96623. };
  96624. var parseManifest = function parseManifest2(_ref) {
  96625. var onwarn = _ref.onwarn, oninfo = _ref.oninfo, manifestString = _ref.manifestString, _ref$customTagParsers = _ref.customTagParsers, customTagParsers = _ref$customTagParsers === void 0 ? [] : _ref$customTagParsers, _ref$customTagMappers = _ref.customTagMappers, customTagMappers = _ref$customTagMappers === void 0 ? [] : _ref$customTagMappers, experimentalLLHLS = _ref.experimentalLLHLS;
  96626. var parser2 = new Parser();
  96627. if (onwarn) {
  96628. parser2.on("warn", onwarn);
  96629. }
  96630. if (oninfo) {
  96631. parser2.on("info", oninfo);
  96632. }
  96633. customTagParsers.forEach(function(customParser) {
  96634. return parser2.addParser(customParser);
  96635. });
  96636. customTagMappers.forEach(function(mapper) {
  96637. return parser2.addTagMapper(mapper);
  96638. });
  96639. parser2.push(manifestString);
  96640. parser2.end();
  96641. var manifest = parser2.manifest;
  96642. if (!experimentalLLHLS) {
  96643. ["preloadSegment", "skip", "serverControl", "renditionReports", "partInf", "partTargetDuration"].forEach(function(k) {
  96644. if (manifest.hasOwnProperty(k)) {
  96645. delete manifest[k];
  96646. }
  96647. });
  96648. if (manifest.segments) {
  96649. manifest.segments.forEach(function(segment) {
  96650. ["parts", "preloadHints"].forEach(function(k) {
  96651. if (segment.hasOwnProperty(k)) {
  96652. delete segment[k];
  96653. }
  96654. });
  96655. });
  96656. }
  96657. }
  96658. if (!manifest.targetDuration) {
  96659. var targetDuration = 10;
  96660. if (manifest.segments && manifest.segments.length) {
  96661. targetDuration = manifest.segments.reduce(function(acc, s) {
  96662. return Math.max(acc, s.duration);
  96663. }, 0);
  96664. }
  96665. if (onwarn) {
  96666. onwarn("manifest has no targetDuration defaulting to " + targetDuration);
  96667. }
  96668. manifest.targetDuration = targetDuration;
  96669. }
  96670. var parts = getLastParts(manifest);
  96671. if (parts.length && !manifest.partTargetDuration) {
  96672. var partTargetDuration = parts.reduce(function(acc, p) {
  96673. return Math.max(acc, p.duration);
  96674. }, 0);
  96675. if (onwarn) {
  96676. onwarn("manifest has no partTargetDuration defaulting to " + partTargetDuration);
  96677. log.error("LL-HLS manifest has parts but lacks required #EXT-X-PART-INF:PART-TARGET value. See https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis-09#section-4.4.3.7. Playback is not guaranteed.");
  96678. }
  96679. manifest.partTargetDuration = partTargetDuration;
  96680. }
  96681. return manifest;
  96682. };
  96683. var forEachMediaGroup3 = function forEachMediaGroup4(master, callback2) {
  96684. if (!master.mediaGroups) {
  96685. return;
  96686. }
  96687. ["AUDIO", "SUBTITLES"].forEach(function(mediaType) {
  96688. if (!master.mediaGroups[mediaType]) {
  96689. return;
  96690. }
  96691. for (var groupKey in master.mediaGroups[mediaType]) {
  96692. for (var labelKey in master.mediaGroups[mediaType][groupKey]) {
  96693. var mediaProperties = master.mediaGroups[mediaType][groupKey][labelKey];
  96694. callback2(mediaProperties, mediaType, groupKey, labelKey);
  96695. }
  96696. }
  96697. });
  96698. };
  96699. var setupMediaPlaylist = function setupMediaPlaylist2(_ref2) {
  96700. var playlist = _ref2.playlist, uri = _ref2.uri, id = _ref2.id;
  96701. playlist.id = id;
  96702. playlist.playlistErrors_ = 0;
  96703. if (uri) {
  96704. playlist.uri = uri;
  96705. }
  96706. playlist.attributes = playlist.attributes || {};
  96707. };
  96708. var setupMediaPlaylists = function setupMediaPlaylists2(master) {
  96709. var i2 = master.playlists.length;
  96710. while (i2--) {
  96711. var playlist = master.playlists[i2];
  96712. setupMediaPlaylist({
  96713. playlist,
  96714. id: createPlaylistID(i2, playlist.uri)
  96715. });
  96716. playlist.resolvedUri = resolveUrl4(master.uri, playlist.uri);
  96717. master.playlists[playlist.id] = playlist;
  96718. master.playlists[playlist.uri] = playlist;
  96719. if (!playlist.attributes.BANDWIDTH) {
  96720. log.warn("Invalid playlist STREAM-INF detected. Missing BANDWIDTH attribute.");
  96721. }
  96722. }
  96723. };
  96724. var resolveMediaGroupUris = function resolveMediaGroupUris2(master) {
  96725. forEachMediaGroup3(master, function(properties) {
  96726. if (properties.uri) {
  96727. properties.resolvedUri = resolveUrl4(master.uri, properties.uri);
  96728. }
  96729. });
  96730. };
  96731. var masterForMedia = function masterForMedia2(media, uri) {
  96732. var id = createPlaylistID(0, uri);
  96733. var master = {
  96734. mediaGroups: {
  96735. "AUDIO": {},
  96736. "VIDEO": {},
  96737. "CLOSED-CAPTIONS": {},
  96738. "SUBTITLES": {}
  96739. },
  96740. uri: window_1.location.href,
  96741. resolvedUri: window_1.location.href,
  96742. playlists: [{
  96743. uri,
  96744. id,
  96745. resolvedUri: uri,
  96746. attributes: {}
  96747. }]
  96748. };
  96749. master.playlists[id] = master.playlists[0];
  96750. master.playlists[uri] = master.playlists[0];
  96751. return master;
  96752. };
  96753. var addPropertiesToMaster = function addPropertiesToMaster2(master, uri, createGroupID) {
  96754. if (createGroupID === void 0) {
  96755. createGroupID = groupID;
  96756. }
  96757. master.uri = uri;
  96758. for (var i2 = 0; i2 < master.playlists.length; i2++) {
  96759. if (!master.playlists[i2].uri) {
  96760. var phonyUri = "placeholder-uri-" + i2;
  96761. master.playlists[i2].uri = phonyUri;
  96762. }
  96763. }
  96764. var audioOnlyMaster = isAudioOnly(master);
  96765. forEachMediaGroup3(master, function(properties, mediaType, groupKey, labelKey) {
  96766. if (!properties.playlists || !properties.playlists.length) {
  96767. if (audioOnlyMaster && mediaType === "AUDIO" && !properties.uri) {
  96768. for (var _i = 0; _i < master.playlists.length; _i++) {
  96769. var p = master.playlists[_i];
  96770. if (p.attributes && p.attributes.AUDIO && p.attributes.AUDIO === groupKey) {
  96771. return;
  96772. }
  96773. }
  96774. }
  96775. properties.playlists = [_extends$2({}, properties)];
  96776. }
  96777. properties.playlists.forEach(function(p2, i3) {
  96778. var groupId = createGroupID(mediaType, groupKey, labelKey, p2);
  96779. var id = createPlaylistID(i3, groupId);
  96780. if (p2.uri) {
  96781. p2.resolvedUri = p2.resolvedUri || resolveUrl4(master.uri, p2.uri);
  96782. } else {
  96783. p2.uri = i3 === 0 ? groupId : id;
  96784. p2.resolvedUri = p2.uri;
  96785. }
  96786. p2.id = p2.id || id;
  96787. p2.attributes = p2.attributes || {};
  96788. master.playlists[p2.id] = p2;
  96789. master.playlists[p2.uri] = p2;
  96790. });
  96791. });
  96792. setupMediaPlaylists(master);
  96793. resolveMediaGroupUris(master);
  96794. };
  96795. var mergeOptions$2 = videojs.mergeOptions, EventTarget$1 = videojs.EventTarget;
  96796. var addLLHLSQueryDirectives = function addLLHLSQueryDirectives2(uri, media) {
  96797. if (media.endList || !media.serverControl) {
  96798. return uri;
  96799. }
  96800. var parameters = {};
  96801. if (media.serverControl.canBlockReload) {
  96802. var preloadSegment = media.preloadSegment;
  96803. var nextMSN = media.mediaSequence + media.segments.length;
  96804. if (preloadSegment) {
  96805. var parts = preloadSegment.parts || [];
  96806. var nextPart = getKnownPartCount(media) - 1;
  96807. if (nextPart > -1 && nextPart !== parts.length - 1) {
  96808. parameters._HLS_part = nextPart;
  96809. }
  96810. if (nextPart > -1 || parts.length) {
  96811. nextMSN--;
  96812. }
  96813. }
  96814. parameters._HLS_msn = nextMSN;
  96815. }
  96816. if (media.serverControl && media.serverControl.canSkipUntil) {
  96817. parameters._HLS_skip = media.serverControl.canSkipDateranges ? "v2" : "YES";
  96818. }
  96819. if (Object.keys(parameters).length) {
  96820. var parsedUri = new window_1.URL(uri);
  96821. ["_HLS_skip", "_HLS_msn", "_HLS_part"].forEach(function(name) {
  96822. if (!parameters.hasOwnProperty(name)) {
  96823. return;
  96824. }
  96825. parsedUri.searchParams.set(name, parameters[name]);
  96826. });
  96827. uri = parsedUri.toString();
  96828. }
  96829. return uri;
  96830. };
  96831. var updateSegment = function updateSegment2(a, b) {
  96832. if (!a) {
  96833. return b;
  96834. }
  96835. var result = mergeOptions$2(a, b);
  96836. if (a.preloadHints && !b.preloadHints) {
  96837. delete result.preloadHints;
  96838. }
  96839. if (a.parts && !b.parts) {
  96840. delete result.parts;
  96841. } else if (a.parts && b.parts) {
  96842. for (var i2 = 0; i2 < b.parts.length; i2++) {
  96843. if (a.parts && a.parts[i2]) {
  96844. result.parts[i2] = mergeOptions$2(a.parts[i2], b.parts[i2]);
  96845. }
  96846. }
  96847. }
  96848. if (!a.skipped && b.skipped) {
  96849. result.skipped = false;
  96850. }
  96851. if (a.preload && !b.preload) {
  96852. result.preload = false;
  96853. }
  96854. return result;
  96855. };
  96856. var updateSegments = function updateSegments2(original, update, offset) {
  96857. var oldSegments = original.slice();
  96858. var newSegments = update.slice();
  96859. offset = offset || 0;
  96860. var result = [];
  96861. var currentMap;
  96862. for (var newIndex = 0; newIndex < newSegments.length; newIndex++) {
  96863. var oldSegment = oldSegments[newIndex + offset];
  96864. var newSegment = newSegments[newIndex];
  96865. if (oldSegment) {
  96866. currentMap = oldSegment.map || currentMap;
  96867. result.push(updateSegment(oldSegment, newSegment));
  96868. } else {
  96869. if (currentMap && !newSegment.map) {
  96870. newSegment.map = currentMap;
  96871. }
  96872. result.push(newSegment);
  96873. }
  96874. }
  96875. return result;
  96876. };
  96877. var resolveSegmentUris = function resolveSegmentUris2(segment, baseUri) {
  96878. if (!segment.resolvedUri && segment.uri) {
  96879. segment.resolvedUri = resolveUrl4(baseUri, segment.uri);
  96880. }
  96881. if (segment.key && !segment.key.resolvedUri) {
  96882. segment.key.resolvedUri = resolveUrl4(baseUri, segment.key.uri);
  96883. }
  96884. if (segment.map && !segment.map.resolvedUri) {
  96885. segment.map.resolvedUri = resolveUrl4(baseUri, segment.map.uri);
  96886. }
  96887. if (segment.map && segment.map.key && !segment.map.key.resolvedUri) {
  96888. segment.map.key.resolvedUri = resolveUrl4(baseUri, segment.map.key.uri);
  96889. }
  96890. if (segment.parts && segment.parts.length) {
  96891. segment.parts.forEach(function(p) {
  96892. if (p.resolvedUri) {
  96893. return;
  96894. }
  96895. p.resolvedUri = resolveUrl4(baseUri, p.uri);
  96896. });
  96897. }
  96898. if (segment.preloadHints && segment.preloadHints.length) {
  96899. segment.preloadHints.forEach(function(p) {
  96900. if (p.resolvedUri) {
  96901. return;
  96902. }
  96903. p.resolvedUri = resolveUrl4(baseUri, p.uri);
  96904. });
  96905. }
  96906. };
  96907. var getAllSegments = function getAllSegments2(media) {
  96908. var segments = media.segments || [];
  96909. var preloadSegment = media.preloadSegment;
  96910. if (preloadSegment && preloadSegment.parts && preloadSegment.parts.length) {
  96911. if (preloadSegment.preloadHints) {
  96912. for (var i2 = 0; i2 < preloadSegment.preloadHints.length; i2++) {
  96913. if (preloadSegment.preloadHints[i2].type === "MAP") {
  96914. return segments;
  96915. }
  96916. }
  96917. }
  96918. preloadSegment.duration = media.targetDuration;
  96919. preloadSegment.preload = true;
  96920. segments.push(preloadSegment);
  96921. }
  96922. return segments;
  96923. };
  96924. var isPlaylistUnchanged = function isPlaylistUnchanged2(a, b) {
  96925. return a === b || a.segments && b.segments && a.segments.length === b.segments.length && a.endList === b.endList && a.mediaSequence === b.mediaSequence && a.preloadSegment === b.preloadSegment;
  96926. };
  96927. var updateMaster$1 = function updateMaster(master, newMedia, unchangedCheck) {
  96928. if (unchangedCheck === void 0) {
  96929. unchangedCheck = isPlaylistUnchanged;
  96930. }
  96931. var result = mergeOptions$2(master, {});
  96932. var oldMedia = result.playlists[newMedia.id];
  96933. if (!oldMedia) {
  96934. return null;
  96935. }
  96936. if (unchangedCheck(oldMedia, newMedia)) {
  96937. return null;
  96938. }
  96939. newMedia.segments = getAllSegments(newMedia);
  96940. var mergedPlaylist = mergeOptions$2(oldMedia, newMedia);
  96941. if (mergedPlaylist.preloadSegment && !newMedia.preloadSegment) {
  96942. delete mergedPlaylist.preloadSegment;
  96943. }
  96944. if (oldMedia.segments) {
  96945. if (newMedia.skip) {
  96946. newMedia.segments = newMedia.segments || [];
  96947. for (var i2 = 0; i2 < newMedia.skip.skippedSegments; i2++) {
  96948. newMedia.segments.unshift({
  96949. skipped: true
  96950. });
  96951. }
  96952. }
  96953. mergedPlaylist.segments = updateSegments(oldMedia.segments, newMedia.segments, newMedia.mediaSequence - oldMedia.mediaSequence);
  96954. }
  96955. mergedPlaylist.segments.forEach(function(segment) {
  96956. resolveSegmentUris(segment, mergedPlaylist.resolvedUri);
  96957. });
  96958. for (var _i = 0; _i < result.playlists.length; _i++) {
  96959. if (result.playlists[_i].id === newMedia.id) {
  96960. result.playlists[_i] = mergedPlaylist;
  96961. }
  96962. }
  96963. result.playlists[newMedia.id] = mergedPlaylist;
  96964. result.playlists[newMedia.uri] = mergedPlaylist;
  96965. forEachMediaGroup3(master, function(properties, mediaType, groupKey, labelKey) {
  96966. if (!properties.playlists) {
  96967. return;
  96968. }
  96969. for (var _i2 = 0; _i2 < properties.playlists.length; _i2++) {
  96970. if (newMedia.id === properties.playlists[_i2].id) {
  96971. properties.playlists[_i2] = mergedPlaylist;
  96972. }
  96973. }
  96974. });
  96975. return result;
  96976. };
  96977. var refreshDelay = function refreshDelay2(media, update) {
  96978. var segments = media.segments || [];
  96979. var lastSegment = segments[segments.length - 1];
  96980. var lastPart = lastSegment && lastSegment.parts && lastSegment.parts[lastSegment.parts.length - 1];
  96981. var lastDuration = lastPart && lastPart.duration || lastSegment && lastSegment.duration;
  96982. if (update && lastDuration) {
  96983. return lastDuration * 1e3;
  96984. }
  96985. return (media.partTargetDuration || media.targetDuration || 10) * 500;
  96986. };
  96987. var PlaylistLoader = /* @__PURE__ */ function(_EventTarget) {
  96988. _inheritsLoose(PlaylistLoader2, _EventTarget);
  96989. function PlaylistLoader2(src, vhs, options2) {
  96990. var _this;
  96991. if (options2 === void 0) {
  96992. options2 = {};
  96993. }
  96994. _this = _EventTarget.call(this) || this;
  96995. if (!src) {
  96996. throw new Error("A non-empty playlist URL or object is required");
  96997. }
  96998. _this.logger_ = logger("PlaylistLoader");
  96999. var _options = options2, _options$withCredenti = _options.withCredentials, withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti, _options$handleManife = _options.handleManifestRedirects, handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife;
  97000. _this.src = src;
  97001. _this.vhs_ = vhs;
  97002. _this.withCredentials = withCredentials;
  97003. _this.handleManifestRedirects = handleManifestRedirects;
  97004. var vhsOptions = vhs.options_;
  97005. _this.customTagParsers = vhsOptions && vhsOptions.customTagParsers || [];
  97006. _this.customTagMappers = vhsOptions && vhsOptions.customTagMappers || [];
  97007. _this.experimentalLLHLS = vhsOptions && vhsOptions.experimentalLLHLS || false;
  97008. if (videojs.browser.IE_VERSION) {
  97009. _this.experimentalLLHLS = false;
  97010. }
  97011. _this.state = "HAVE_NOTHING";
  97012. _this.handleMediaupdatetimeout_ = _this.handleMediaupdatetimeout_.bind(_assertThisInitialized(_this));
  97013. _this.on("mediaupdatetimeout", _this.handleMediaupdatetimeout_);
  97014. return _this;
  97015. }
  97016. var _proto = PlaylistLoader2.prototype;
  97017. _proto.handleMediaupdatetimeout_ = function handleMediaupdatetimeout_() {
  97018. var _this2 = this;
  97019. if (this.state !== "HAVE_METADATA") {
  97020. return;
  97021. }
  97022. var media = this.media();
  97023. var uri = resolveUrl4(this.master.uri, media.uri);
  97024. if (this.experimentalLLHLS) {
  97025. uri = addLLHLSQueryDirectives(uri, media);
  97026. }
  97027. this.state = "HAVE_CURRENT_METADATA";
  97028. this.request = this.vhs_.xhr({
  97029. uri,
  97030. withCredentials: this.withCredentials
  97031. }, function(error, req) {
  97032. if (!_this2.request) {
  97033. return;
  97034. }
  97035. if (error) {
  97036. return _this2.playlistRequestError(_this2.request, _this2.media(), "HAVE_METADATA");
  97037. }
  97038. _this2.haveMetadata({
  97039. playlistString: _this2.request.responseText,
  97040. url: _this2.media().uri,
  97041. id: _this2.media().id
  97042. });
  97043. });
  97044. };
  97045. _proto.playlistRequestError = function playlistRequestError(xhr, playlist, startingState) {
  97046. var uri = playlist.uri, id = playlist.id;
  97047. this.request = null;
  97048. if (startingState) {
  97049. this.state = startingState;
  97050. }
  97051. this.error = {
  97052. playlist: this.master.playlists[id],
  97053. status: xhr.status,
  97054. message: "HLS playlist request error at URL: " + uri + ".",
  97055. responseText: xhr.responseText,
  97056. code: xhr.status >= 500 ? 4 : 2
  97057. };
  97058. this.trigger("error");
  97059. };
  97060. _proto.parseManifest_ = function parseManifest_(_ref) {
  97061. var _this3 = this;
  97062. var url = _ref.url, manifestString = _ref.manifestString;
  97063. return parseManifest({
  97064. onwarn: function onwarn(_ref2) {
  97065. var message = _ref2.message;
  97066. return _this3.logger_("m3u8-parser warn for " + url + ": " + message);
  97067. },
  97068. oninfo: function oninfo(_ref3) {
  97069. var message = _ref3.message;
  97070. return _this3.logger_("m3u8-parser info for " + url + ": " + message);
  97071. },
  97072. manifestString,
  97073. customTagParsers: this.customTagParsers,
  97074. customTagMappers: this.customTagMappers,
  97075. experimentalLLHLS: this.experimentalLLHLS
  97076. });
  97077. };
  97078. _proto.haveMetadata = function haveMetadata(_ref4) {
  97079. var playlistString = _ref4.playlistString, playlistObject = _ref4.playlistObject, url = _ref4.url, id = _ref4.id;
  97080. this.request = null;
  97081. this.state = "HAVE_METADATA";
  97082. var playlist = playlistObject || this.parseManifest_({
  97083. url,
  97084. manifestString: playlistString
  97085. });
  97086. playlist.lastRequest = Date.now();
  97087. setupMediaPlaylist({
  97088. playlist,
  97089. uri: url,
  97090. id
  97091. });
  97092. var update = updateMaster$1(this.master, playlist);
  97093. this.targetDuration = playlist.partTargetDuration || playlist.targetDuration;
  97094. this.pendingMedia_ = null;
  97095. if (update) {
  97096. this.master = update;
  97097. this.media_ = this.master.playlists[id];
  97098. } else {
  97099. this.trigger("playlistunchanged");
  97100. }
  97101. this.updateMediaUpdateTimeout_(refreshDelay(this.media(), !!update));
  97102. this.trigger("loadedplaylist");
  97103. };
  97104. _proto.dispose = function dispose() {
  97105. this.trigger("dispose");
  97106. this.stopRequest();
  97107. window_1.clearTimeout(this.mediaUpdateTimeout);
  97108. window_1.clearTimeout(this.finalRenditionTimeout);
  97109. this.off();
  97110. };
  97111. _proto.stopRequest = function stopRequest() {
  97112. if (this.request) {
  97113. var oldRequest = this.request;
  97114. this.request = null;
  97115. oldRequest.onreadystatechange = null;
  97116. oldRequest.abort();
  97117. }
  97118. };
  97119. _proto.media = function media(playlist, shouldDelay) {
  97120. var _this4 = this;
  97121. if (!playlist) {
  97122. return this.media_;
  97123. }
  97124. if (this.state === "HAVE_NOTHING") {
  97125. throw new Error("Cannot switch media playlist from " + this.state);
  97126. }
  97127. if (typeof playlist === "string") {
  97128. if (!this.master.playlists[playlist]) {
  97129. throw new Error("Unknown playlist URI: " + playlist);
  97130. }
  97131. playlist = this.master.playlists[playlist];
  97132. }
  97133. window_1.clearTimeout(this.finalRenditionTimeout);
  97134. if (shouldDelay) {
  97135. var delay = (playlist.partTargetDuration || playlist.targetDuration) / 2 * 1e3 || 5 * 1e3;
  97136. this.finalRenditionTimeout = window_1.setTimeout(this.media.bind(this, playlist, false), delay);
  97137. return;
  97138. }
  97139. var startingState = this.state;
  97140. var mediaChange = !this.media_ || playlist.id !== this.media_.id;
  97141. var masterPlaylistRef = this.master.playlists[playlist.id];
  97142. if (masterPlaylistRef && masterPlaylistRef.endList || playlist.endList && playlist.segments.length) {
  97143. if (this.request) {
  97144. this.request.onreadystatechange = null;
  97145. this.request.abort();
  97146. this.request = null;
  97147. }
  97148. this.state = "HAVE_METADATA";
  97149. this.media_ = playlist;
  97150. if (mediaChange) {
  97151. this.trigger("mediachanging");
  97152. if (startingState === "HAVE_MASTER") {
  97153. this.trigger("loadedmetadata");
  97154. } else {
  97155. this.trigger("mediachange");
  97156. }
  97157. }
  97158. return;
  97159. }
  97160. this.updateMediaUpdateTimeout_(refreshDelay(playlist, true));
  97161. if (!mediaChange) {
  97162. return;
  97163. }
  97164. this.state = "SWITCHING_MEDIA";
  97165. if (this.request) {
  97166. if (playlist.resolvedUri === this.request.url) {
  97167. return;
  97168. }
  97169. this.request.onreadystatechange = null;
  97170. this.request.abort();
  97171. this.request = null;
  97172. }
  97173. if (this.media_) {
  97174. this.trigger("mediachanging");
  97175. }
  97176. this.pendingMedia_ = playlist;
  97177. this.request = this.vhs_.xhr({
  97178. uri: playlist.resolvedUri,
  97179. withCredentials: this.withCredentials
  97180. }, function(error, req) {
  97181. if (!_this4.request) {
  97182. return;
  97183. }
  97184. playlist.lastRequest = Date.now();
  97185. playlist.resolvedUri = resolveManifestRedirect(_this4.handleManifestRedirects, playlist.resolvedUri, req);
  97186. if (error) {
  97187. return _this4.playlistRequestError(_this4.request, playlist, startingState);
  97188. }
  97189. _this4.haveMetadata({
  97190. playlistString: req.responseText,
  97191. url: playlist.uri,
  97192. id: playlist.id
  97193. });
  97194. if (startingState === "HAVE_MASTER") {
  97195. _this4.trigger("loadedmetadata");
  97196. } else {
  97197. _this4.trigger("mediachange");
  97198. }
  97199. });
  97200. };
  97201. _proto.pause = function pause() {
  97202. if (this.mediaUpdateTimeout) {
  97203. window_1.clearTimeout(this.mediaUpdateTimeout);
  97204. this.mediaUpdateTimeout = null;
  97205. }
  97206. this.stopRequest();
  97207. if (this.state === "HAVE_NOTHING") {
  97208. this.started = false;
  97209. }
  97210. if (this.state === "SWITCHING_MEDIA") {
  97211. if (this.media_) {
  97212. this.state = "HAVE_METADATA";
  97213. } else {
  97214. this.state = "HAVE_MASTER";
  97215. }
  97216. } else if (this.state === "HAVE_CURRENT_METADATA") {
  97217. this.state = "HAVE_METADATA";
  97218. }
  97219. };
  97220. _proto.load = function load(shouldDelay) {
  97221. var _this5 = this;
  97222. if (this.mediaUpdateTimeout) {
  97223. window_1.clearTimeout(this.mediaUpdateTimeout);
  97224. this.mediaUpdateTimeout = null;
  97225. }
  97226. var media = this.media();
  97227. if (shouldDelay) {
  97228. var delay = media ? (media.partTargetDuration || media.targetDuration) / 2 * 1e3 : 5 * 1e3;
  97229. this.mediaUpdateTimeout = window_1.setTimeout(function() {
  97230. _this5.mediaUpdateTimeout = null;
  97231. _this5.load();
  97232. }, delay);
  97233. return;
  97234. }
  97235. if (!this.started) {
  97236. this.start();
  97237. return;
  97238. }
  97239. if (media && !media.endList) {
  97240. this.trigger("mediaupdatetimeout");
  97241. } else {
  97242. this.trigger("loadedplaylist");
  97243. }
  97244. };
  97245. _proto.updateMediaUpdateTimeout_ = function updateMediaUpdateTimeout_(delay) {
  97246. var _this6 = this;
  97247. if (this.mediaUpdateTimeout) {
  97248. window_1.clearTimeout(this.mediaUpdateTimeout);
  97249. this.mediaUpdateTimeout = null;
  97250. }
  97251. if (!this.media() || this.media().endList) {
  97252. return;
  97253. }
  97254. this.mediaUpdateTimeout = window_1.setTimeout(function() {
  97255. _this6.mediaUpdateTimeout = null;
  97256. _this6.trigger("mediaupdatetimeout");
  97257. _this6.updateMediaUpdateTimeout_(delay);
  97258. }, delay);
  97259. };
  97260. _proto.start = function start2() {
  97261. var _this7 = this;
  97262. this.started = true;
  97263. if (typeof this.src === "object") {
  97264. if (!this.src.uri) {
  97265. this.src.uri = window_1.location.href;
  97266. }
  97267. this.src.resolvedUri = this.src.uri;
  97268. setTimeout(function() {
  97269. _this7.setupInitialPlaylist(_this7.src);
  97270. }, 0);
  97271. return;
  97272. }
  97273. this.request = this.vhs_.xhr({
  97274. uri: this.src,
  97275. withCredentials: this.withCredentials
  97276. }, function(error, req) {
  97277. if (!_this7.request) {
  97278. return;
  97279. }
  97280. _this7.request = null;
  97281. if (error) {
  97282. _this7.error = {
  97283. status: req.status,
  97284. message: "HLS playlist request error at URL: " + _this7.src + ".",
  97285. responseText: req.responseText,
  97286. code: 2
  97287. };
  97288. if (_this7.state === "HAVE_NOTHING") {
  97289. _this7.started = false;
  97290. }
  97291. return _this7.trigger("error");
  97292. }
  97293. _this7.src = resolveManifestRedirect(_this7.handleManifestRedirects, _this7.src, req);
  97294. var manifest = _this7.parseManifest_({
  97295. manifestString: req.responseText,
  97296. url: _this7.src
  97297. });
  97298. _this7.setupInitialPlaylist(manifest);
  97299. });
  97300. };
  97301. _proto.srcUri = function srcUri() {
  97302. return typeof this.src === "string" ? this.src : this.src.uri;
  97303. };
  97304. _proto.setupInitialPlaylist = function setupInitialPlaylist(manifest) {
  97305. this.state = "HAVE_MASTER";
  97306. if (manifest.playlists) {
  97307. this.master = manifest;
  97308. addPropertiesToMaster(this.master, this.srcUri());
  97309. manifest.playlists.forEach(function(playlist) {
  97310. playlist.segments = getAllSegments(playlist);
  97311. playlist.segments.forEach(function(segment) {
  97312. resolveSegmentUris(segment, playlist.resolvedUri);
  97313. });
  97314. });
  97315. this.trigger("loadedplaylist");
  97316. if (!this.request) {
  97317. this.media(this.master.playlists[0]);
  97318. }
  97319. return;
  97320. }
  97321. var uri = this.srcUri() || window_1.location.href;
  97322. this.master = masterForMedia(manifest, uri);
  97323. this.haveMetadata({
  97324. playlistObject: manifest,
  97325. url: uri,
  97326. id: this.master.playlists[0].id
  97327. });
  97328. this.trigger("loadedmetadata");
  97329. };
  97330. return PlaylistLoader2;
  97331. }(EventTarget$1);
  97332. var videojsXHR = videojs.xhr, mergeOptions$1$1 = videojs.mergeOptions;
  97333. var callbackWrapper = function callbackWrapper2(request, error, response, callback2) {
  97334. var reqResponse = request.responseType === "arraybuffer" ? request.response : request.responseText;
  97335. if (!error && reqResponse) {
  97336. request.responseTime = Date.now();
  97337. request.roundTripTime = request.responseTime - request.requestTime;
  97338. request.bytesReceived = reqResponse.byteLength || reqResponse.length;
  97339. if (!request.bandwidth) {
  97340. request.bandwidth = Math.floor(request.bytesReceived / request.roundTripTime * 8 * 1e3);
  97341. }
  97342. }
  97343. if (response.headers) {
  97344. request.responseHeaders = response.headers;
  97345. }
  97346. if (error && error.code === "ETIMEDOUT") {
  97347. request.timedout = true;
  97348. }
  97349. if (!error && !request.aborted && response.statusCode !== 200 && response.statusCode !== 206 && response.statusCode !== 0) {
  97350. error = new Error("XHR Failed with a response of: " + (request && (reqResponse || request.responseText)));
  97351. }
  97352. callback2(error, request);
  97353. };
  97354. var xhrFactory = function xhrFactory2() {
  97355. var xhr = function XhrFunction(options2, callback2) {
  97356. options2 = mergeOptions$1$1({
  97357. timeout: 45e3
  97358. }, options2);
  97359. var beforeRequest = XhrFunction.beforeRequest || videojs.Vhs.xhr.beforeRequest;
  97360. if (beforeRequest && typeof beforeRequest === "function") {
  97361. var newOptions = beforeRequest(options2);
  97362. if (newOptions) {
  97363. options2 = newOptions;
  97364. }
  97365. }
  97366. var xhrMethod = videojs.Vhs.xhr.original === true ? videojsXHR : videojs.Vhs.xhr;
  97367. var request = xhrMethod(options2, function(error, response) {
  97368. return callbackWrapper(request, error, response, callback2);
  97369. });
  97370. var originalAbort = request.abort;
  97371. request.abort = function() {
  97372. request.aborted = true;
  97373. return originalAbort.apply(request, arguments);
  97374. };
  97375. request.uri = options2.uri;
  97376. request.requestTime = Date.now();
  97377. return request;
  97378. };
  97379. xhr.original = true;
  97380. return xhr;
  97381. };
  97382. var byterangeStr = function byterangeStr2(byterange) {
  97383. var byterangeEnd;
  97384. var byterangeStart = byterange.offset;
  97385. if (typeof byterange.offset === "bigint" || typeof byterange.length === "bigint") {
  97386. byterangeEnd = window_1.BigInt(byterange.offset) + window_1.BigInt(byterange.length) - window_1.BigInt(1);
  97387. } else {
  97388. byterangeEnd = byterange.offset + byterange.length - 1;
  97389. }
  97390. return "bytes=" + byterangeStart + "-" + byterangeEnd;
  97391. };
  97392. var segmentXhrHeaders = function segmentXhrHeaders2(segment) {
  97393. var headers = {};
  97394. if (segment.byterange) {
  97395. headers.Range = byterangeStr(segment.byterange);
  97396. }
  97397. return headers;
  97398. };
  97399. var textRange = function textRange2(range3, i2) {
  97400. return range3.start(i2) + "-" + range3.end(i2);
  97401. };
  97402. var formatHexString = function formatHexString2(e, i2) {
  97403. var value = e.toString(16);
  97404. return "00".substring(0, 2 - value.length) + value + (i2 % 2 ? " " : "");
  97405. };
  97406. var formatAsciiString = function formatAsciiString2(e) {
  97407. if (e >= 32 && e < 126) {
  97408. return String.fromCharCode(e);
  97409. }
  97410. return ".";
  97411. };
  97412. var createTransferableMessage = function createTransferableMessage2(message) {
  97413. var transferable = {};
  97414. Object.keys(message).forEach(function(key) {
  97415. var value = message[key];
  97416. if (isArrayBufferView2(value)) {
  97417. transferable[key] = {
  97418. bytes: value.buffer,
  97419. byteOffset: value.byteOffset,
  97420. byteLength: value.byteLength
  97421. };
  97422. } else {
  97423. transferable[key] = value;
  97424. }
  97425. });
  97426. return transferable;
  97427. };
  97428. var initSegmentId = function initSegmentId2(initSegment) {
  97429. var byterange = initSegment.byterange || {
  97430. length: Infinity,
  97431. offset: 0
  97432. };
  97433. return [byterange.length, byterange.offset, initSegment.resolvedUri].join(",");
  97434. };
  97435. var segmentKeyId = function segmentKeyId2(key) {
  97436. return key.resolvedUri;
  97437. };
  97438. var hexDump = function hexDump2(data) {
  97439. var bytes = Array.prototype.slice.call(data);
  97440. var step = 16;
  97441. var result = "";
  97442. var hex;
  97443. var ascii;
  97444. for (var j = 0; j < bytes.length / step; j++) {
  97445. hex = bytes.slice(j * step, j * step + step).map(formatHexString).join("");
  97446. ascii = bytes.slice(j * step, j * step + step).map(formatAsciiString).join("");
  97447. result += hex + " " + ascii + "\n";
  97448. }
  97449. return result;
  97450. };
  97451. var tagDump = function tagDump2(_ref) {
  97452. var bytes = _ref.bytes;
  97453. return hexDump(bytes);
  97454. };
  97455. var textRanges = function textRanges2(ranges) {
  97456. var result = "";
  97457. var i2;
  97458. for (i2 = 0; i2 < ranges.length; i2++) {
  97459. result += textRange(ranges, i2) + " ";
  97460. }
  97461. return result;
  97462. };
  97463. var utils = /* @__PURE__ */ Object.freeze({
  97464. __proto__: null,
  97465. createTransferableMessage,
  97466. initSegmentId,
  97467. segmentKeyId,
  97468. hexDump,
  97469. tagDump,
  97470. textRanges
  97471. });
  97472. var SEGMENT_END_FUDGE_PERCENT = 0.25;
  97473. var playerTimeToProgramTime = function playerTimeToProgramTime2(playerTime, segment) {
  97474. if (!segment.dateTimeObject) {
  97475. return null;
  97476. }
  97477. var transmuxerPrependedSeconds = segment.videoTimingInfo.transmuxerPrependedSeconds;
  97478. var transmuxedStart = segment.videoTimingInfo.transmuxedPresentationStart;
  97479. var startOfSegment = transmuxedStart + transmuxerPrependedSeconds;
  97480. var offsetFromSegmentStart = playerTime - startOfSegment;
  97481. return new Date(segment.dateTimeObject.getTime() + offsetFromSegmentStart * 1e3);
  97482. };
  97483. var originalSegmentVideoDuration = function originalSegmentVideoDuration2(videoTimingInfo) {
  97484. return videoTimingInfo.transmuxedPresentationEnd - videoTimingInfo.transmuxedPresentationStart - videoTimingInfo.transmuxerPrependedSeconds;
  97485. };
  97486. var findSegmentForProgramTime = function findSegmentForProgramTime2(programTime, playlist) {
  97487. var dateTimeObject;
  97488. try {
  97489. dateTimeObject = new Date(programTime);
  97490. } catch (e) {
  97491. return null;
  97492. }
  97493. if (!playlist || !playlist.segments || playlist.segments.length === 0) {
  97494. return null;
  97495. }
  97496. var segment = playlist.segments[0];
  97497. if (dateTimeObject < segment.dateTimeObject) {
  97498. return null;
  97499. }
  97500. for (var i2 = 0; i2 < playlist.segments.length - 1; i2++) {
  97501. segment = playlist.segments[i2];
  97502. var nextSegmentStart = playlist.segments[i2 + 1].dateTimeObject;
  97503. if (dateTimeObject < nextSegmentStart) {
  97504. break;
  97505. }
  97506. }
  97507. var lastSegment = playlist.segments[playlist.segments.length - 1];
  97508. var lastSegmentStart = lastSegment.dateTimeObject;
  97509. var lastSegmentDuration = lastSegment.videoTimingInfo ? originalSegmentVideoDuration(lastSegment.videoTimingInfo) : lastSegment.duration + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT;
  97510. var lastSegmentEnd = new Date(lastSegmentStart.getTime() + lastSegmentDuration * 1e3);
  97511. if (dateTimeObject > lastSegmentEnd) {
  97512. return null;
  97513. }
  97514. if (dateTimeObject > lastSegmentStart) {
  97515. segment = lastSegment;
  97516. }
  97517. return {
  97518. segment,
  97519. estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : Playlist.duration(playlist, playlist.mediaSequence + playlist.segments.indexOf(segment)),
  97520. type: segment.videoTimingInfo ? "accurate" : "estimate"
  97521. };
  97522. };
  97523. var findSegmentForPlayerTime = function findSegmentForPlayerTime2(time, playlist) {
  97524. if (!playlist || !playlist.segments || playlist.segments.length === 0) {
  97525. return null;
  97526. }
  97527. var segmentEnd = 0;
  97528. var segment;
  97529. for (var i2 = 0; i2 < playlist.segments.length; i2++) {
  97530. segment = playlist.segments[i2];
  97531. segmentEnd = segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationEnd : segmentEnd + segment.duration;
  97532. if (time <= segmentEnd) {
  97533. break;
  97534. }
  97535. }
  97536. var lastSegment = playlist.segments[playlist.segments.length - 1];
  97537. if (lastSegment.videoTimingInfo && lastSegment.videoTimingInfo.transmuxedPresentationEnd < time) {
  97538. return null;
  97539. }
  97540. if (time > segmentEnd) {
  97541. if (time > segmentEnd + lastSegment.duration * SEGMENT_END_FUDGE_PERCENT) {
  97542. return null;
  97543. }
  97544. segment = lastSegment;
  97545. }
  97546. return {
  97547. segment,
  97548. estimatedStart: segment.videoTimingInfo ? segment.videoTimingInfo.transmuxedPresentationStart : segmentEnd - segment.duration,
  97549. type: segment.videoTimingInfo ? "accurate" : "estimate"
  97550. };
  97551. };
  97552. var getOffsetFromTimestamp = function getOffsetFromTimestamp2(comparisonTimeStamp, programTime) {
  97553. var segmentDateTime;
  97554. var programDateTime;
  97555. try {
  97556. segmentDateTime = new Date(comparisonTimeStamp);
  97557. programDateTime = new Date(programTime);
  97558. } catch (e) {
  97559. }
  97560. var segmentTimeEpoch = segmentDateTime.getTime();
  97561. var programTimeEpoch = programDateTime.getTime();
  97562. return (programTimeEpoch - segmentTimeEpoch) / 1e3;
  97563. };
  97564. var verifyProgramDateTimeTags = function verifyProgramDateTimeTags2(playlist) {
  97565. if (!playlist.segments || playlist.segments.length === 0) {
  97566. return false;
  97567. }
  97568. for (var i2 = 0; i2 < playlist.segments.length; i2++) {
  97569. var segment = playlist.segments[i2];
  97570. if (!segment.dateTimeObject) {
  97571. return false;
  97572. }
  97573. }
  97574. return true;
  97575. };
  97576. var getProgramTime = function getProgramTime2(_ref) {
  97577. var playlist = _ref.playlist, _ref$time = _ref.time, time = _ref$time === void 0 ? void 0 : _ref$time, callback2 = _ref.callback;
  97578. if (!callback2) {
  97579. throw new Error("getProgramTime: callback must be provided");
  97580. }
  97581. if (!playlist || time === void 0) {
  97582. return callback2({
  97583. message: "getProgramTime: playlist and time must be provided"
  97584. });
  97585. }
  97586. var matchedSegment = findSegmentForPlayerTime(time, playlist);
  97587. if (!matchedSegment) {
  97588. return callback2({
  97589. message: "valid programTime was not found"
  97590. });
  97591. }
  97592. if (matchedSegment.type === "estimate") {
  97593. return callback2({
  97594. message: "Accurate programTime could not be determined. Please seek to e.seekTime and try again",
  97595. seekTime: matchedSegment.estimatedStart
  97596. });
  97597. }
  97598. var programTimeObject = {
  97599. mediaSeconds: time
  97600. };
  97601. var programTime = playerTimeToProgramTime(time, matchedSegment.segment);
  97602. if (programTime) {
  97603. programTimeObject.programDateTime = programTime.toISOString();
  97604. }
  97605. return callback2(null, programTimeObject);
  97606. };
  97607. var seekToProgramTime = function seekToProgramTime2(_ref2) {
  97608. var programTime = _ref2.programTime, playlist = _ref2.playlist, _ref2$retryCount = _ref2.retryCount, retryCount = _ref2$retryCount === void 0 ? 2 : _ref2$retryCount, seekTo = _ref2.seekTo, _ref2$pauseAfterSeek = _ref2.pauseAfterSeek, pauseAfterSeek = _ref2$pauseAfterSeek === void 0 ? true : _ref2$pauseAfterSeek, tech = _ref2.tech, callback2 = _ref2.callback;
  97609. if (!callback2) {
  97610. throw new Error("seekToProgramTime: callback must be provided");
  97611. }
  97612. if (typeof programTime === "undefined" || !playlist || !seekTo) {
  97613. return callback2({
  97614. message: "seekToProgramTime: programTime, seekTo and playlist must be provided"
  97615. });
  97616. }
  97617. if (!playlist.endList && !tech.hasStarted_) {
  97618. return callback2({
  97619. message: "player must be playing a live stream to start buffering"
  97620. });
  97621. }
  97622. if (!verifyProgramDateTimeTags(playlist)) {
  97623. return callback2({
  97624. message: "programDateTime tags must be provided in the manifest " + playlist.resolvedUri
  97625. });
  97626. }
  97627. var matchedSegment = findSegmentForProgramTime(programTime, playlist);
  97628. if (!matchedSegment) {
  97629. return callback2({
  97630. message: programTime + " was not found in the stream"
  97631. });
  97632. }
  97633. var segment = matchedSegment.segment;
  97634. var mediaOffset = getOffsetFromTimestamp(segment.dateTimeObject, programTime);
  97635. if (matchedSegment.type === "estimate") {
  97636. if (retryCount === 0) {
  97637. return callback2({
  97638. message: programTime + " is not buffered yet. Try again"
  97639. });
  97640. }
  97641. seekTo(matchedSegment.estimatedStart + mediaOffset);
  97642. tech.one("seeked", function() {
  97643. seekToProgramTime2({
  97644. programTime,
  97645. playlist,
  97646. retryCount: retryCount - 1,
  97647. seekTo,
  97648. pauseAfterSeek,
  97649. tech,
  97650. callback: callback2
  97651. });
  97652. });
  97653. return;
  97654. }
  97655. var seekToTime = segment.start + mediaOffset;
  97656. var seekedCallback = function seekedCallback2() {
  97657. return callback2(null, tech.currentTime());
  97658. };
  97659. tech.one("seeked", seekedCallback);
  97660. if (pauseAfterSeek) {
  97661. tech.pause();
  97662. }
  97663. seekTo(seekToTime);
  97664. };
  97665. var callbackOnCompleted = function callbackOnCompleted2(request, cb) {
  97666. if (request.readyState === 4) {
  97667. return cb();
  97668. }
  97669. return;
  97670. };
  97671. var containerRequest = function containerRequest2(uri, xhr, cb) {
  97672. var bytes = [];
  97673. var id3Offset;
  97674. var finished = false;
  97675. var endRequestAndCallback = function endRequestAndCallback2(err, req, type2, _bytes) {
  97676. req.abort();
  97677. finished = true;
  97678. return cb(err, req, type2, _bytes);
  97679. };
  97680. var progressListener = function progressListener2(error, request2) {
  97681. if (finished) {
  97682. return;
  97683. }
  97684. if (error) {
  97685. return endRequestAndCallback(error, request2, "", bytes);
  97686. }
  97687. var newPart = request2.responseText.substring(bytes && bytes.byteLength || 0, request2.responseText.length);
  97688. bytes = concatTypedArrays2(bytes, stringToBytes2(newPart, true));
  97689. id3Offset = id3Offset || getId3Offset2(bytes);
  97690. if (bytes.length < 10 || id3Offset && bytes.length < id3Offset + 2) {
  97691. return callbackOnCompleted(request2, function() {
  97692. return endRequestAndCallback(error, request2, "", bytes);
  97693. });
  97694. }
  97695. var type2 = detectContainerForBytes2(bytes);
  97696. if (type2 === "ts" && bytes.length < 188) {
  97697. return callbackOnCompleted(request2, function() {
  97698. return endRequestAndCallback(error, request2, "", bytes);
  97699. });
  97700. }
  97701. if (!type2 && bytes.length < 376) {
  97702. return callbackOnCompleted(request2, function() {
  97703. return endRequestAndCallback(error, request2, "", bytes);
  97704. });
  97705. }
  97706. return endRequestAndCallback(null, request2, type2, bytes);
  97707. };
  97708. var options2 = {
  97709. uri,
  97710. beforeSend: function beforeSend(request2) {
  97711. request2.overrideMimeType("text/plain; charset=x-user-defined");
  97712. request2.addEventListener("progress", function(_ref) {
  97713. _ref.total;
  97714. _ref.loaded;
  97715. return callbackWrapper(request2, null, {
  97716. statusCode: request2.status
  97717. }, progressListener);
  97718. });
  97719. }
  97720. };
  97721. var request = xhr(options2, function(error, response) {
  97722. return callbackWrapper(request, error, response, progressListener);
  97723. });
  97724. return request;
  97725. };
  97726. var EventTarget2 = videojs.EventTarget, mergeOptions$4 = videojs.mergeOptions;
  97727. var dashPlaylistUnchanged = function dashPlaylistUnchanged2(a, b) {
  97728. if (!isPlaylistUnchanged(a, b)) {
  97729. return false;
  97730. }
  97731. if (a.sidx && b.sidx && (a.sidx.offset !== b.sidx.offset || a.sidx.length !== b.sidx.length)) {
  97732. return false;
  97733. } else if (!a.sidx && b.sidx || a.sidx && !b.sidx) {
  97734. return false;
  97735. }
  97736. if (a.segments && !b.segments || !a.segments && b.segments) {
  97737. return false;
  97738. }
  97739. if (!a.segments && !b.segments) {
  97740. return true;
  97741. }
  97742. for (var i2 = 0; i2 < a.segments.length; i2++) {
  97743. var aSegment = a.segments[i2];
  97744. var bSegment = b.segments[i2];
  97745. if (aSegment.uri !== bSegment.uri) {
  97746. return false;
  97747. }
  97748. if (!aSegment.byterange && !bSegment.byterange) {
  97749. continue;
  97750. }
  97751. var aByterange = aSegment.byterange;
  97752. var bByterange = bSegment.byterange;
  97753. if (aByterange && !bByterange || !aByterange && bByterange) {
  97754. return false;
  97755. }
  97756. if (aByterange.offset !== bByterange.offset || aByterange.length !== bByterange.length) {
  97757. return false;
  97758. }
  97759. }
  97760. return true;
  97761. };
  97762. var dashGroupId = function dashGroupId2(type2, group, label, playlist) {
  97763. var playlistId = playlist.attributes.NAME || label;
  97764. return "placeholder-uri-" + type2 + "-" + group + "-" + playlistId;
  97765. };
  97766. var parseMasterXml = function parseMasterXml2(_ref) {
  97767. var masterXml = _ref.masterXml, srcUrl = _ref.srcUrl, clientOffset = _ref.clientOffset, sidxMapping = _ref.sidxMapping, previousManifest = _ref.previousManifest;
  97768. var manifest = parse(masterXml, {
  97769. manifestUri: srcUrl,
  97770. clientOffset,
  97771. sidxMapping,
  97772. previousManifest
  97773. });
  97774. addPropertiesToMaster(manifest, srcUrl, dashGroupId);
  97775. return manifest;
  97776. };
  97777. var removeOldMediaGroupLabels = function removeOldMediaGroupLabels2(update, newMaster) {
  97778. forEachMediaGroup3(update, function(properties, type2, group, label) {
  97779. if (!(label in newMaster.mediaGroups[type2][group])) {
  97780. delete update.mediaGroups[type2][group][label];
  97781. }
  97782. });
  97783. };
  97784. var updateMaster2 = function updateMaster3(oldMaster, newMaster, sidxMapping) {
  97785. var noChanges = true;
  97786. var update = mergeOptions$4(oldMaster, {
  97787. duration: newMaster.duration,
  97788. minimumUpdatePeriod: newMaster.minimumUpdatePeriod,
  97789. timelineStarts: newMaster.timelineStarts
  97790. });
  97791. for (var i2 = 0; i2 < newMaster.playlists.length; i2++) {
  97792. var playlist = newMaster.playlists[i2];
  97793. if (playlist.sidx) {
  97794. var sidxKey = generateSidxKey(playlist.sidx);
  97795. if (sidxMapping && sidxMapping[sidxKey] && sidxMapping[sidxKey].sidx) {
  97796. addSidxSegmentsToPlaylist$1(playlist, sidxMapping[sidxKey].sidx, playlist.sidx.resolvedUri);
  97797. }
  97798. }
  97799. var playlistUpdate = updateMaster$1(update, playlist, dashPlaylistUnchanged);
  97800. if (playlistUpdate) {
  97801. update = playlistUpdate;
  97802. noChanges = false;
  97803. }
  97804. }
  97805. forEachMediaGroup3(newMaster, function(properties, type2, group, label) {
  97806. if (properties.playlists && properties.playlists.length) {
  97807. var id = properties.playlists[0].id;
  97808. var _playlistUpdate = updateMaster$1(update, properties.playlists[0], dashPlaylistUnchanged);
  97809. if (_playlistUpdate) {
  97810. update = _playlistUpdate;
  97811. if (!(label in update.mediaGroups[type2][group])) {
  97812. update.mediaGroups[type2][group][label] = properties;
  97813. }
  97814. update.mediaGroups[type2][group][label].playlists[0] = update.playlists[id];
  97815. noChanges = false;
  97816. }
  97817. }
  97818. });
  97819. removeOldMediaGroupLabels(update, newMaster);
  97820. if (newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) {
  97821. noChanges = false;
  97822. }
  97823. if (noChanges) {
  97824. return null;
  97825. }
  97826. return update;
  97827. };
  97828. var equivalentSidx = function equivalentSidx2(a, b) {
  97829. var neitherMap = Boolean(!a.map && !b.map);
  97830. var equivalentMap = neitherMap || Boolean(a.map && b.map && a.map.byterange.offset === b.map.byterange.offset && a.map.byterange.length === b.map.byterange.length);
  97831. return equivalentMap && a.uri === b.uri && a.byterange.offset === b.byterange.offset && a.byterange.length === b.byterange.length;
  97832. };
  97833. var compareSidxEntry = function compareSidxEntry2(playlists, oldSidxMapping) {
  97834. var newSidxMapping = {};
  97835. for (var id in playlists) {
  97836. var playlist = playlists[id];
  97837. var currentSidxInfo = playlist.sidx;
  97838. if (currentSidxInfo) {
  97839. var key = generateSidxKey(currentSidxInfo);
  97840. if (!oldSidxMapping[key]) {
  97841. break;
  97842. }
  97843. var savedSidxInfo = oldSidxMapping[key].sidxInfo;
  97844. if (equivalentSidx(savedSidxInfo, currentSidxInfo)) {
  97845. newSidxMapping[key] = oldSidxMapping[key];
  97846. }
  97847. }
  97848. }
  97849. return newSidxMapping;
  97850. };
  97851. var filterChangedSidxMappings = function filterChangedSidxMappings2(master, oldSidxMapping) {
  97852. var videoSidx = compareSidxEntry(master.playlists, oldSidxMapping);
  97853. var mediaGroupSidx = videoSidx;
  97854. forEachMediaGroup3(master, function(properties, mediaType, groupKey, labelKey) {
  97855. if (properties.playlists && properties.playlists.length) {
  97856. var playlists = properties.playlists;
  97857. mediaGroupSidx = mergeOptions$4(mediaGroupSidx, compareSidxEntry(playlists, oldSidxMapping));
  97858. }
  97859. });
  97860. return mediaGroupSidx;
  97861. };
  97862. var DashPlaylistLoader = /* @__PURE__ */ function(_EventTarget) {
  97863. _inheritsLoose(DashPlaylistLoader2, _EventTarget);
  97864. function DashPlaylistLoader2(srcUrlOrPlaylist, vhs, options2, masterPlaylistLoader) {
  97865. var _this;
  97866. if (options2 === void 0) {
  97867. options2 = {};
  97868. }
  97869. _this = _EventTarget.call(this) || this;
  97870. _this.masterPlaylistLoader_ = masterPlaylistLoader || _assertThisInitialized(_this);
  97871. if (!masterPlaylistLoader) {
  97872. _this.isMaster_ = true;
  97873. }
  97874. var _options = options2, _options$withCredenti = _options.withCredentials, withCredentials = _options$withCredenti === void 0 ? false : _options$withCredenti, _options$handleManife = _options.handleManifestRedirects, handleManifestRedirects = _options$handleManife === void 0 ? false : _options$handleManife;
  97875. _this.vhs_ = vhs;
  97876. _this.withCredentials = withCredentials;
  97877. _this.handleManifestRedirects = handleManifestRedirects;
  97878. if (!srcUrlOrPlaylist) {
  97879. throw new Error("A non-empty playlist URL or object is required");
  97880. }
  97881. _this.on("minimumUpdatePeriod", function() {
  97882. _this.refreshXml_();
  97883. });
  97884. _this.on("mediaupdatetimeout", function() {
  97885. _this.refreshMedia_(_this.media().id);
  97886. });
  97887. _this.state = "HAVE_NOTHING";
  97888. _this.loadedPlaylists_ = {};
  97889. _this.logger_ = logger("DashPlaylistLoader");
  97890. if (_this.isMaster_) {
  97891. _this.masterPlaylistLoader_.srcUrl = srcUrlOrPlaylist;
  97892. _this.masterPlaylistLoader_.sidxMapping_ = {};
  97893. } else {
  97894. _this.childPlaylist_ = srcUrlOrPlaylist;
  97895. }
  97896. return _this;
  97897. }
  97898. var _proto = DashPlaylistLoader2.prototype;
  97899. _proto.requestErrored_ = function requestErrored_(err, request, startingState) {
  97900. if (!this.request) {
  97901. return true;
  97902. }
  97903. this.request = null;
  97904. if (err) {
  97905. this.error = typeof err === "object" && !(err instanceof Error) ? err : {
  97906. status: request.status,
  97907. message: "DASH request error at URL: " + request.uri,
  97908. response: request.response,
  97909. code: 2
  97910. };
  97911. if (startingState) {
  97912. this.state = startingState;
  97913. }
  97914. this.trigger("error");
  97915. return true;
  97916. }
  97917. };
  97918. _proto.addSidxSegments_ = function addSidxSegments_(playlist, startingState, cb) {
  97919. var _this2 = this;
  97920. var sidxKey = playlist.sidx && generateSidxKey(playlist.sidx);
  97921. if (!playlist.sidx || !sidxKey || this.masterPlaylistLoader_.sidxMapping_[sidxKey]) {
  97922. this.mediaRequest_ = window_1.setTimeout(function() {
  97923. return cb(false);
  97924. }, 0);
  97925. return;
  97926. }
  97927. var uri = resolveManifestRedirect(this.handleManifestRedirects, playlist.sidx.resolvedUri);
  97928. var fin = function fin2(err, request) {
  97929. if (_this2.requestErrored_(err, request, startingState)) {
  97930. return;
  97931. }
  97932. var sidxMapping = _this2.masterPlaylistLoader_.sidxMapping_;
  97933. var sidx;
  97934. try {
  97935. sidx = parseSidx_1(toUint82(request.response).subarray(8));
  97936. } catch (e) {
  97937. _this2.requestErrored_(e, request, startingState);
  97938. return;
  97939. }
  97940. sidxMapping[sidxKey] = {
  97941. sidxInfo: playlist.sidx,
  97942. sidx
  97943. };
  97944. addSidxSegmentsToPlaylist$1(playlist, sidx, playlist.sidx.resolvedUri);
  97945. return cb(true);
  97946. };
  97947. this.request = containerRequest(uri, this.vhs_.xhr, function(err, request, container, bytes) {
  97948. if (err) {
  97949. return fin(err, request);
  97950. }
  97951. if (!container || container !== "mp4") {
  97952. return fin({
  97953. status: request.status,
  97954. message: "Unsupported " + (container || "unknown") + " container type for sidx segment at URL: " + uri,
  97955. response: "",
  97956. playlist,
  97957. internal: true,
  97958. blacklistDuration: Infinity,
  97959. code: 2
  97960. }, request);
  97961. }
  97962. var _playlist$sidx$bytera = playlist.sidx.byterange, offset = _playlist$sidx$bytera.offset, length = _playlist$sidx$bytera.length;
  97963. if (bytes.length >= length + offset) {
  97964. return fin(err, {
  97965. response: bytes.subarray(offset, offset + length),
  97966. status: request.status,
  97967. uri: request.uri
  97968. });
  97969. }
  97970. _this2.request = _this2.vhs_.xhr({
  97971. uri,
  97972. responseType: "arraybuffer",
  97973. headers: segmentXhrHeaders({
  97974. byterange: playlist.sidx.byterange
  97975. })
  97976. }, fin);
  97977. });
  97978. };
  97979. _proto.dispose = function dispose() {
  97980. this.trigger("dispose");
  97981. this.stopRequest();
  97982. this.loadedPlaylists_ = {};
  97983. window_1.clearTimeout(this.minimumUpdatePeriodTimeout_);
  97984. window_1.clearTimeout(this.mediaRequest_);
  97985. window_1.clearTimeout(this.mediaUpdateTimeout);
  97986. this.mediaUpdateTimeout = null;
  97987. this.mediaRequest_ = null;
  97988. this.minimumUpdatePeriodTimeout_ = null;
  97989. if (this.masterPlaylistLoader_.createMupOnMedia_) {
  97990. this.off("loadedmetadata", this.masterPlaylistLoader_.createMupOnMedia_);
  97991. this.masterPlaylistLoader_.createMupOnMedia_ = null;
  97992. }
  97993. this.off();
  97994. };
  97995. _proto.hasPendingRequest = function hasPendingRequest() {
  97996. return this.request || this.mediaRequest_;
  97997. };
  97998. _proto.stopRequest = function stopRequest() {
  97999. if (this.request) {
  98000. var oldRequest = this.request;
  98001. this.request = null;
  98002. oldRequest.onreadystatechange = null;
  98003. oldRequest.abort();
  98004. }
  98005. };
  98006. _proto.media = function media(playlist) {
  98007. var _this3 = this;
  98008. if (!playlist) {
  98009. return this.media_;
  98010. }
  98011. if (this.state === "HAVE_NOTHING") {
  98012. throw new Error("Cannot switch media playlist from " + this.state);
  98013. }
  98014. var startingState = this.state;
  98015. if (typeof playlist === "string") {
  98016. if (!this.masterPlaylistLoader_.master.playlists[playlist]) {
  98017. throw new Error("Unknown playlist URI: " + playlist);
  98018. }
  98019. playlist = this.masterPlaylistLoader_.master.playlists[playlist];
  98020. }
  98021. var mediaChange = !this.media_ || playlist.id !== this.media_.id;
  98022. if (mediaChange && this.loadedPlaylists_[playlist.id] && this.loadedPlaylists_[playlist.id].endList) {
  98023. this.state = "HAVE_METADATA";
  98024. this.media_ = playlist;
  98025. if (mediaChange) {
  98026. this.trigger("mediachanging");
  98027. this.trigger("mediachange");
  98028. }
  98029. return;
  98030. }
  98031. if (!mediaChange) {
  98032. return;
  98033. }
  98034. if (this.media_) {
  98035. this.trigger("mediachanging");
  98036. }
  98037. this.addSidxSegments_(playlist, startingState, function(sidxChanged) {
  98038. _this3.haveMetadata({
  98039. startingState,
  98040. playlist
  98041. });
  98042. });
  98043. };
  98044. _proto.haveMetadata = function haveMetadata(_ref2) {
  98045. var startingState = _ref2.startingState, playlist = _ref2.playlist;
  98046. this.state = "HAVE_METADATA";
  98047. this.loadedPlaylists_[playlist.id] = playlist;
  98048. this.mediaRequest_ = null;
  98049. this.refreshMedia_(playlist.id);
  98050. if (startingState === "HAVE_MASTER") {
  98051. this.trigger("loadedmetadata");
  98052. } else {
  98053. this.trigger("mediachange");
  98054. }
  98055. };
  98056. _proto.pause = function pause() {
  98057. if (this.masterPlaylistLoader_.createMupOnMedia_) {
  98058. this.off("loadedmetadata", this.masterPlaylistLoader_.createMupOnMedia_);
  98059. this.masterPlaylistLoader_.createMupOnMedia_ = null;
  98060. }
  98061. this.stopRequest();
  98062. window_1.clearTimeout(this.mediaUpdateTimeout);
  98063. this.mediaUpdateTimeout = null;
  98064. if (this.isMaster_) {
  98065. window_1.clearTimeout(this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_);
  98066. this.masterPlaylistLoader_.minimumUpdatePeriodTimeout_ = null;
  98067. }
  98068. if (this.state === "HAVE_NOTHING") {
  98069. this.started = false;
  98070. }
  98071. };
  98072. _proto.load = function load(isFinalRendition) {
  98073. var _this4 = this;
  98074. window_1.clearTimeout(this.mediaUpdateTimeout);
  98075. this.mediaUpdateTimeout = null;
  98076. var media = this.media();
  98077. if (isFinalRendition) {
  98078. var delay = media ? media.targetDuration / 2 * 1e3 : 5 * 1e3;
  98079. this.mediaUpdateTimeout = window_1.setTimeout(function() {
  98080. return _this4.load();
  98081. }, delay);
  98082. return;
  98083. }
  98084. if (!this.started) {
  98085. this.start();
  98086. return;
  98087. }
  98088. if (media && !media.endList) {
  98089. if (this.isMaster_ && !this.minimumUpdatePeriodTimeout_) {
  98090. this.trigger("minimumUpdatePeriod");
  98091. this.updateMinimumUpdatePeriodTimeout_();
  98092. }
  98093. this.trigger("mediaupdatetimeout");
  98094. } else {
  98095. this.trigger("loadedplaylist");
  98096. }
  98097. };
  98098. _proto.start = function start2() {
  98099. var _this5 = this;
  98100. this.started = true;
  98101. if (!this.isMaster_) {
  98102. this.mediaRequest_ = window_1.setTimeout(function() {
  98103. return _this5.haveMaster_();
  98104. }, 0);
  98105. return;
  98106. }
  98107. this.requestMaster_(function(req, masterChanged) {
  98108. _this5.haveMaster_();
  98109. if (!_this5.hasPendingRequest() && !_this5.media_) {
  98110. _this5.media(_this5.masterPlaylistLoader_.master.playlists[0]);
  98111. }
  98112. });
  98113. };
  98114. _proto.requestMaster_ = function requestMaster_(cb) {
  98115. var _this6 = this;
  98116. this.request = this.vhs_.xhr({
  98117. uri: this.masterPlaylistLoader_.srcUrl,
  98118. withCredentials: this.withCredentials
  98119. }, function(error, req) {
  98120. if (_this6.requestErrored_(error, req)) {
  98121. if (_this6.state === "HAVE_NOTHING") {
  98122. _this6.started = false;
  98123. }
  98124. return;
  98125. }
  98126. var masterChanged = req.responseText !== _this6.masterPlaylistLoader_.masterXml_;
  98127. _this6.masterPlaylistLoader_.masterXml_ = req.responseText;
  98128. if (req.responseHeaders && req.responseHeaders.date) {
  98129. _this6.masterLoaded_ = Date.parse(req.responseHeaders.date);
  98130. } else {
  98131. _this6.masterLoaded_ = Date.now();
  98132. }
  98133. _this6.masterPlaylistLoader_.srcUrl = resolveManifestRedirect(_this6.handleManifestRedirects, _this6.masterPlaylistLoader_.srcUrl, req);
  98134. if (masterChanged) {
  98135. _this6.handleMaster_();
  98136. _this6.syncClientServerClock_(function() {
  98137. return cb(req, masterChanged);
  98138. });
  98139. return;
  98140. }
  98141. return cb(req, masterChanged);
  98142. });
  98143. };
  98144. _proto.syncClientServerClock_ = function syncClientServerClock_(done) {
  98145. var _this7 = this;
  98146. var utcTiming = parseUTCTiming(this.masterPlaylistLoader_.masterXml_);
  98147. if (utcTiming === null) {
  98148. this.masterPlaylistLoader_.clientOffset_ = this.masterLoaded_ - Date.now();
  98149. return done();
  98150. }
  98151. if (utcTiming.method === "DIRECT") {
  98152. this.masterPlaylistLoader_.clientOffset_ = utcTiming.value - Date.now();
  98153. return done();
  98154. }
  98155. this.request = this.vhs_.xhr({
  98156. uri: resolveUrl4(this.masterPlaylistLoader_.srcUrl, utcTiming.value),
  98157. method: utcTiming.method,
  98158. withCredentials: this.withCredentials
  98159. }, function(error, req) {
  98160. if (!_this7.request) {
  98161. return;
  98162. }
  98163. if (error) {
  98164. _this7.masterPlaylistLoader_.clientOffset_ = _this7.masterLoaded_ - Date.now();
  98165. return done();
  98166. }
  98167. var serverTime;
  98168. if (utcTiming.method === "HEAD") {
  98169. if (!req.responseHeaders || !req.responseHeaders.date) {
  98170. serverTime = _this7.masterLoaded_;
  98171. } else {
  98172. serverTime = Date.parse(req.responseHeaders.date);
  98173. }
  98174. } else {
  98175. serverTime = Date.parse(req.responseText);
  98176. }
  98177. _this7.masterPlaylistLoader_.clientOffset_ = serverTime - Date.now();
  98178. done();
  98179. });
  98180. };
  98181. _proto.haveMaster_ = function haveMaster_() {
  98182. this.state = "HAVE_MASTER";
  98183. if (this.isMaster_) {
  98184. this.trigger("loadedplaylist");
  98185. } else if (!this.media_) {
  98186. this.media(this.childPlaylist_);
  98187. }
  98188. };
  98189. _proto.handleMaster_ = function handleMaster_() {
  98190. this.mediaRequest_ = null;
  98191. var oldMaster = this.masterPlaylistLoader_.master;
  98192. var newMaster = parseMasterXml({
  98193. masterXml: this.masterPlaylistLoader_.masterXml_,
  98194. srcUrl: this.masterPlaylistLoader_.srcUrl,
  98195. clientOffset: this.masterPlaylistLoader_.clientOffset_,
  98196. sidxMapping: this.masterPlaylistLoader_.sidxMapping_,
  98197. previousManifest: oldMaster
  98198. });
  98199. if (oldMaster) {
  98200. newMaster = updateMaster2(oldMaster, newMaster, this.masterPlaylistLoader_.sidxMapping_);
  98201. }
  98202. this.masterPlaylistLoader_.master = newMaster ? newMaster : oldMaster;
  98203. var location = this.masterPlaylistLoader_.master.locations && this.masterPlaylistLoader_.master.locations[0];
  98204. if (location && location !== this.masterPlaylistLoader_.srcUrl) {
  98205. this.masterPlaylistLoader_.srcUrl = location;
  98206. }
  98207. if (!oldMaster || newMaster && newMaster.minimumUpdatePeriod !== oldMaster.minimumUpdatePeriod) {
  98208. this.updateMinimumUpdatePeriodTimeout_();
  98209. }
  98210. return Boolean(newMaster);
  98211. };
  98212. _proto.updateMinimumUpdatePeriodTimeout_ = function updateMinimumUpdatePeriodTimeout_() {
  98213. var mpl = this.masterPlaylistLoader_;
  98214. if (mpl.createMupOnMedia_) {
  98215. mpl.off("loadedmetadata", mpl.createMupOnMedia_);
  98216. mpl.createMupOnMedia_ = null;
  98217. }
  98218. if (mpl.minimumUpdatePeriodTimeout_) {
  98219. window_1.clearTimeout(mpl.minimumUpdatePeriodTimeout_);
  98220. mpl.minimumUpdatePeriodTimeout_ = null;
  98221. }
  98222. var mup = mpl.master && mpl.master.minimumUpdatePeriod;
  98223. if (mup === 0) {
  98224. if (mpl.media()) {
  98225. mup = mpl.media().targetDuration * 1e3;
  98226. } else {
  98227. mpl.createMupOnMedia_ = mpl.updateMinimumUpdatePeriodTimeout_;
  98228. mpl.one("loadedmetadata", mpl.createMupOnMedia_);
  98229. }
  98230. }
  98231. if (typeof mup !== "number" || mup <= 0) {
  98232. if (mup < 0) {
  98233. this.logger_("found invalid minimumUpdatePeriod of " + mup + ", not setting a timeout");
  98234. }
  98235. return;
  98236. }
  98237. this.createMUPTimeout_(mup);
  98238. };
  98239. _proto.createMUPTimeout_ = function createMUPTimeout_(mup) {
  98240. var mpl = this.masterPlaylistLoader_;
  98241. mpl.minimumUpdatePeriodTimeout_ = window_1.setTimeout(function() {
  98242. mpl.minimumUpdatePeriodTimeout_ = null;
  98243. mpl.trigger("minimumUpdatePeriod");
  98244. mpl.createMUPTimeout_(mup);
  98245. }, mup);
  98246. };
  98247. _proto.refreshXml_ = function refreshXml_() {
  98248. var _this8 = this;
  98249. this.requestMaster_(function(req, masterChanged) {
  98250. if (!masterChanged) {
  98251. return;
  98252. }
  98253. if (_this8.media_) {
  98254. _this8.media_ = _this8.masterPlaylistLoader_.master.playlists[_this8.media_.id];
  98255. }
  98256. _this8.masterPlaylistLoader_.sidxMapping_ = filterChangedSidxMappings(_this8.masterPlaylistLoader_.master, _this8.masterPlaylistLoader_.sidxMapping_);
  98257. _this8.addSidxSegments_(_this8.media(), _this8.state, function(sidxChanged) {
  98258. _this8.refreshMedia_(_this8.media().id);
  98259. });
  98260. });
  98261. };
  98262. _proto.refreshMedia_ = function refreshMedia_(mediaID) {
  98263. var _this9 = this;
  98264. if (!mediaID) {
  98265. throw new Error("refreshMedia_ must take a media id");
  98266. }
  98267. if (this.media_ && this.isMaster_) {
  98268. this.handleMaster_();
  98269. }
  98270. var playlists = this.masterPlaylistLoader_.master.playlists;
  98271. var mediaChanged = !this.media_ || this.media_ !== playlists[mediaID];
  98272. if (mediaChanged) {
  98273. this.media_ = playlists[mediaID];
  98274. } else {
  98275. this.trigger("playlistunchanged");
  98276. }
  98277. if (!this.mediaUpdateTimeout) {
  98278. var createMediaUpdateTimeout = function createMediaUpdateTimeout2() {
  98279. if (_this9.media().endList) {
  98280. return;
  98281. }
  98282. _this9.mediaUpdateTimeout = window_1.setTimeout(function() {
  98283. _this9.trigger("mediaupdatetimeout");
  98284. createMediaUpdateTimeout2();
  98285. }, refreshDelay(_this9.media(), Boolean(mediaChanged)));
  98286. };
  98287. createMediaUpdateTimeout();
  98288. }
  98289. this.trigger("loadedplaylist");
  98290. };
  98291. return DashPlaylistLoader2;
  98292. }(EventTarget2);
  98293. var Config = {
  98294. GOAL_BUFFER_LENGTH: 30,
  98295. MAX_GOAL_BUFFER_LENGTH: 60,
  98296. BACK_BUFFER_LENGTH: 30,
  98297. GOAL_BUFFER_LENGTH_RATE: 1,
  98298. INITIAL_BANDWIDTH: 4194304,
  98299. BANDWIDTH_VARIANCE: 1.2,
  98300. BUFFER_LOW_WATER_LINE: 0,
  98301. MAX_BUFFER_LOW_WATER_LINE: 30,
  98302. EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE: 16,
  98303. BUFFER_LOW_WATER_LINE_RATE: 1,
  98304. BUFFER_HIGH_WATER_LINE: 30
  98305. };
  98306. var stringToArrayBuffer = function stringToArrayBuffer2(string) {
  98307. var view = new Uint8Array(new ArrayBuffer(string.length));
  98308. for (var i2 = 0; i2 < string.length; i2++) {
  98309. view[i2] = string.charCodeAt(i2);
  98310. }
  98311. return view.buffer;
  98312. };
  98313. var browserWorkerPolyFill = function browserWorkerPolyFill2(workerObj) {
  98314. workerObj.on = workerObj.addEventListener;
  98315. workerObj.off = workerObj.removeEventListener;
  98316. return workerObj;
  98317. };
  98318. var createObjectURL = function createObjectURL2(str) {
  98319. try {
  98320. return URL.createObjectURL(new Blob([str], {
  98321. type: "application/javascript"
  98322. }));
  98323. } catch (e) {
  98324. var blob = new BlobBuilder();
  98325. blob.append(str);
  98326. return URL.createObjectURL(blob.getBlob());
  98327. }
  98328. };
  98329. var factory = function factory2(code) {
  98330. return function() {
  98331. var objectUrl = createObjectURL(code);
  98332. var worker = browserWorkerPolyFill(new Worker(objectUrl));
  98333. worker.objURL = objectUrl;
  98334. var terminate = worker.terminate;
  98335. worker.on = worker.addEventListener;
  98336. worker.off = worker.removeEventListener;
  98337. worker.terminate = function() {
  98338. URL.revokeObjectURL(objectUrl);
  98339. return terminate.call(this);
  98340. };
  98341. return worker;
  98342. };
  98343. };
  98344. var transform = function transform2(code) {
  98345. return "var browserWorkerPolyFill = " + browserWorkerPolyFill.toString() + ";\nbrowserWorkerPolyFill(self);\n" + code;
  98346. };
  98347. var getWorkerString = function getWorkerString2(fn2) {
  98348. return fn2.toString().replace(/^function.+?{/, "").slice(0, -1);
  98349. };
  98350. var workerCode$1 = transform(getWorkerString(function() {
  98351. var Stream2 = function Stream3() {
  98352. this.init = function() {
  98353. var listeners = {};
  98354. this.on = function(type3, listener) {
  98355. if (!listeners[type3]) {
  98356. listeners[type3] = [];
  98357. }
  98358. listeners[type3] = listeners[type3].concat(listener);
  98359. };
  98360. this.off = function(type3, listener) {
  98361. var index2;
  98362. if (!listeners[type3]) {
  98363. return false;
  98364. }
  98365. index2 = listeners[type3].indexOf(listener);
  98366. listeners[type3] = listeners[type3].slice();
  98367. listeners[type3].splice(index2, 1);
  98368. return index2 > -1;
  98369. };
  98370. this.trigger = function(type3) {
  98371. var callbacks, i2, length, args;
  98372. callbacks = listeners[type3];
  98373. if (!callbacks) {
  98374. return;
  98375. }
  98376. if (arguments.length === 2) {
  98377. length = callbacks.length;
  98378. for (i2 = 0; i2 < length; ++i2) {
  98379. callbacks[i2].call(this, arguments[1]);
  98380. }
  98381. } else {
  98382. args = [];
  98383. i2 = arguments.length;
  98384. for (i2 = 1; i2 < arguments.length; ++i2) {
  98385. args.push(arguments[i2]);
  98386. }
  98387. length = callbacks.length;
  98388. for (i2 = 0; i2 < length; ++i2) {
  98389. callbacks[i2].apply(this, args);
  98390. }
  98391. }
  98392. };
  98393. this.dispose = function() {
  98394. listeners = {};
  98395. };
  98396. };
  98397. };
  98398. Stream2.prototype.pipe = function(destination2) {
  98399. this.on("data", function(data) {
  98400. destination2.push(data);
  98401. });
  98402. this.on("done", function(flushSource) {
  98403. destination2.flush(flushSource);
  98404. });
  98405. this.on("partialdone", function(flushSource) {
  98406. destination2.partialFlush(flushSource);
  98407. });
  98408. this.on("endedtimeline", function(flushSource) {
  98409. destination2.endTimeline(flushSource);
  98410. });
  98411. this.on("reset", function(flushSource) {
  98412. destination2.reset(flushSource);
  98413. });
  98414. return destination2;
  98415. };
  98416. Stream2.prototype.push = function(data) {
  98417. this.trigger("data", data);
  98418. };
  98419. Stream2.prototype.flush = function(flushSource) {
  98420. this.trigger("done", flushSource);
  98421. };
  98422. Stream2.prototype.partialFlush = function(flushSource) {
  98423. this.trigger("partialdone", flushSource);
  98424. };
  98425. Stream2.prototype.endTimeline = function(flushSource) {
  98426. this.trigger("endedtimeline", flushSource);
  98427. };
  98428. Stream2.prototype.reset = function(flushSource) {
  98429. this.trigger("reset", flushSource);
  98430. };
  98431. var stream = Stream2;
  98432. var MAX_UINT32$12 = Math.pow(2, 32);
  98433. var getUint64$22 = function getUint643(uint8) {
  98434. var dv = new DataView(uint8.buffer, uint8.byteOffset, uint8.byteLength);
  98435. var value;
  98436. if (dv.getBigUint64) {
  98437. value = dv.getBigUint64(0);
  98438. if (value < Number.MAX_SAFE_INTEGER) {
  98439. return Number(value);
  98440. }
  98441. return value;
  98442. }
  98443. return dv.getUint32(0) * MAX_UINT32$12 + dv.getUint32(4);
  98444. };
  98445. var numbers2 = {
  98446. getUint64: getUint64$22,
  98447. MAX_UINT32: MAX_UINT32$12
  98448. };
  98449. var MAX_UINT322 = numbers2.MAX_UINT32;
  98450. var box, dinf, esds, ftyp, mdat, mfhd, minf, moof, moov, mvex, mvhd, trak, tkhd, mdia, mdhd, hdlr, sdtp, stbl, stsd, traf, trex, trun$1, types, MAJOR_BRAND, MINOR_VERSION, AVC1_BRAND, VIDEO_HDLR, AUDIO_HDLR, HDLR_TYPES, VMHD, SMHD, DREF, STCO, STSC, STSZ, STTS;
  98451. (function() {
  98452. var i2;
  98453. types = {
  98454. avc1: [],
  98455. avcC: [],
  98456. btrt: [],
  98457. dinf: [],
  98458. dref: [],
  98459. esds: [],
  98460. ftyp: [],
  98461. hdlr: [],
  98462. mdat: [],
  98463. mdhd: [],
  98464. mdia: [],
  98465. mfhd: [],
  98466. minf: [],
  98467. moof: [],
  98468. moov: [],
  98469. mp4a: [],
  98470. mvex: [],
  98471. mvhd: [],
  98472. pasp: [],
  98473. sdtp: [],
  98474. smhd: [],
  98475. stbl: [],
  98476. stco: [],
  98477. stsc: [],
  98478. stsd: [],
  98479. stsz: [],
  98480. stts: [],
  98481. styp: [],
  98482. tfdt: [],
  98483. tfhd: [],
  98484. traf: [],
  98485. trak: [],
  98486. trun: [],
  98487. trex: [],
  98488. tkhd: [],
  98489. vmhd: []
  98490. };
  98491. if (typeof Uint8Array === "undefined") {
  98492. return;
  98493. }
  98494. for (i2 in types) {
  98495. if (types.hasOwnProperty(i2)) {
  98496. types[i2] = [i2.charCodeAt(0), i2.charCodeAt(1), i2.charCodeAt(2), i2.charCodeAt(3)];
  98497. }
  98498. }
  98499. MAJOR_BRAND = new Uint8Array(["i".charCodeAt(0), "s".charCodeAt(0), "o".charCodeAt(0), "m".charCodeAt(0)]);
  98500. AVC1_BRAND = new Uint8Array(["a".charCodeAt(0), "v".charCodeAt(0), "c".charCodeAt(0), "1".charCodeAt(0)]);
  98501. MINOR_VERSION = new Uint8Array([0, 0, 0, 1]);
  98502. VIDEO_HDLR = new Uint8Array([
  98503. 0,
  98504. 0,
  98505. 0,
  98506. 0,
  98507. 0,
  98508. 0,
  98509. 0,
  98510. 0,
  98511. 118,
  98512. 105,
  98513. 100,
  98514. 101,
  98515. 0,
  98516. 0,
  98517. 0,
  98518. 0,
  98519. 0,
  98520. 0,
  98521. 0,
  98522. 0,
  98523. 0,
  98524. 0,
  98525. 0,
  98526. 0,
  98527. 86,
  98528. 105,
  98529. 100,
  98530. 101,
  98531. 111,
  98532. 72,
  98533. 97,
  98534. 110,
  98535. 100,
  98536. 108,
  98537. 101,
  98538. 114,
  98539. 0
  98540. ]);
  98541. AUDIO_HDLR = new Uint8Array([
  98542. 0,
  98543. 0,
  98544. 0,
  98545. 0,
  98546. 0,
  98547. 0,
  98548. 0,
  98549. 0,
  98550. 115,
  98551. 111,
  98552. 117,
  98553. 110,
  98554. 0,
  98555. 0,
  98556. 0,
  98557. 0,
  98558. 0,
  98559. 0,
  98560. 0,
  98561. 0,
  98562. 0,
  98563. 0,
  98564. 0,
  98565. 0,
  98566. 83,
  98567. 111,
  98568. 117,
  98569. 110,
  98570. 100,
  98571. 72,
  98572. 97,
  98573. 110,
  98574. 100,
  98575. 108,
  98576. 101,
  98577. 114,
  98578. 0
  98579. ]);
  98580. HDLR_TYPES = {
  98581. video: VIDEO_HDLR,
  98582. audio: AUDIO_HDLR
  98583. };
  98584. DREF = new Uint8Array([
  98585. 0,
  98586. 0,
  98587. 0,
  98588. 0,
  98589. 0,
  98590. 0,
  98591. 0,
  98592. 1,
  98593. 0,
  98594. 0,
  98595. 0,
  98596. 12,
  98597. 117,
  98598. 114,
  98599. 108,
  98600. 32,
  98601. 0,
  98602. 0,
  98603. 0,
  98604. 1
  98605. ]);
  98606. SMHD = new Uint8Array([
  98607. 0,
  98608. 0,
  98609. 0,
  98610. 0,
  98611. 0,
  98612. 0,
  98613. 0,
  98614. 0
  98615. ]);
  98616. STCO = new Uint8Array([
  98617. 0,
  98618. 0,
  98619. 0,
  98620. 0,
  98621. 0,
  98622. 0,
  98623. 0,
  98624. 0
  98625. ]);
  98626. STSC = STCO;
  98627. STSZ = new Uint8Array([
  98628. 0,
  98629. 0,
  98630. 0,
  98631. 0,
  98632. 0,
  98633. 0,
  98634. 0,
  98635. 0,
  98636. 0,
  98637. 0,
  98638. 0,
  98639. 0
  98640. ]);
  98641. STTS = STCO;
  98642. VMHD = new Uint8Array([
  98643. 0,
  98644. 0,
  98645. 0,
  98646. 1,
  98647. 0,
  98648. 0,
  98649. 0,
  98650. 0,
  98651. 0,
  98652. 0,
  98653. 0,
  98654. 0
  98655. ]);
  98656. })();
  98657. box = function box2(type3) {
  98658. var payload = [], size = 0, i2, result, view;
  98659. for (i2 = 1; i2 < arguments.length; i2++) {
  98660. payload.push(arguments[i2]);
  98661. }
  98662. i2 = payload.length;
  98663. while (i2--) {
  98664. size += payload[i2].byteLength;
  98665. }
  98666. result = new Uint8Array(size + 8);
  98667. view = new DataView(result.buffer, result.byteOffset, result.byteLength);
  98668. view.setUint32(0, result.byteLength);
  98669. result.set(type3, 4);
  98670. for (i2 = 0, size = 8; i2 < payload.length; i2++) {
  98671. result.set(payload[i2], size);
  98672. size += payload[i2].byteLength;
  98673. }
  98674. return result;
  98675. };
  98676. dinf = function dinf2() {
  98677. return box(types.dinf, box(types.dref, DREF));
  98678. };
  98679. esds = function esds2(track) {
  98680. return box(types.esds, new Uint8Array([
  98681. 0,
  98682. 0,
  98683. 0,
  98684. 0,
  98685. 3,
  98686. 25,
  98687. 0,
  98688. 0,
  98689. 0,
  98690. 4,
  98691. 17,
  98692. 64,
  98693. 21,
  98694. 0,
  98695. 6,
  98696. 0,
  98697. 0,
  98698. 0,
  98699. 218,
  98700. 192,
  98701. 0,
  98702. 0,
  98703. 218,
  98704. 192,
  98705. 5,
  98706. 2,
  98707. track.audioobjecttype << 3 | track.samplingfrequencyindex >>> 1,
  98708. track.samplingfrequencyindex << 7 | track.channelcount << 3,
  98709. 6,
  98710. 1,
  98711. 2
  98712. ]));
  98713. };
  98714. ftyp = function ftyp2() {
  98715. return box(types.ftyp, MAJOR_BRAND, MINOR_VERSION, MAJOR_BRAND, AVC1_BRAND);
  98716. };
  98717. hdlr = function hdlr2(type3) {
  98718. return box(types.hdlr, HDLR_TYPES[type3]);
  98719. };
  98720. mdat = function mdat2(data) {
  98721. return box(types.mdat, data);
  98722. };
  98723. mdhd = function mdhd2(track) {
  98724. var result = new Uint8Array([
  98725. 0,
  98726. 0,
  98727. 0,
  98728. 0,
  98729. 0,
  98730. 0,
  98731. 0,
  98732. 2,
  98733. 0,
  98734. 0,
  98735. 0,
  98736. 3,
  98737. 0,
  98738. 1,
  98739. 95,
  98740. 144,
  98741. track.duration >>> 24 & 255,
  98742. track.duration >>> 16 & 255,
  98743. track.duration >>> 8 & 255,
  98744. track.duration & 255,
  98745. 85,
  98746. 196,
  98747. 0,
  98748. 0
  98749. ]);
  98750. if (track.samplerate) {
  98751. result[12] = track.samplerate >>> 24 & 255;
  98752. result[13] = track.samplerate >>> 16 & 255;
  98753. result[14] = track.samplerate >>> 8 & 255;
  98754. result[15] = track.samplerate & 255;
  98755. }
  98756. return box(types.mdhd, result);
  98757. };
  98758. mdia = function mdia2(track) {
  98759. return box(types.mdia, mdhd(track), hdlr(track.type), minf(track));
  98760. };
  98761. mfhd = function mfhd2(sequenceNumber) {
  98762. return box(types.mfhd, new Uint8Array([
  98763. 0,
  98764. 0,
  98765. 0,
  98766. 0,
  98767. (sequenceNumber & 4278190080) >> 24,
  98768. (sequenceNumber & 16711680) >> 16,
  98769. (sequenceNumber & 65280) >> 8,
  98770. sequenceNumber & 255
  98771. ]));
  98772. };
  98773. minf = function minf2(track) {
  98774. return box(types.minf, track.type === "video" ? box(types.vmhd, VMHD) : box(types.smhd, SMHD), dinf(), stbl(track));
  98775. };
  98776. moof = function moof2(sequenceNumber, tracks) {
  98777. var trackFragments = [], i2 = tracks.length;
  98778. while (i2--) {
  98779. trackFragments[i2] = traf(tracks[i2]);
  98780. }
  98781. return box.apply(null, [types.moof, mfhd(sequenceNumber)].concat(trackFragments));
  98782. };
  98783. moov = function moov2(tracks) {
  98784. var i2 = tracks.length, boxes = [];
  98785. while (i2--) {
  98786. boxes[i2] = trak(tracks[i2]);
  98787. }
  98788. return box.apply(null, [types.moov, mvhd(4294967295)].concat(boxes).concat(mvex(tracks)));
  98789. };
  98790. mvex = function mvex2(tracks) {
  98791. var i2 = tracks.length, boxes = [];
  98792. while (i2--) {
  98793. boxes[i2] = trex(tracks[i2]);
  98794. }
  98795. return box.apply(null, [types.mvex].concat(boxes));
  98796. };
  98797. mvhd = function mvhd2(duration5) {
  98798. var bytes = new Uint8Array([
  98799. 0,
  98800. 0,
  98801. 0,
  98802. 0,
  98803. 0,
  98804. 0,
  98805. 0,
  98806. 1,
  98807. 0,
  98808. 0,
  98809. 0,
  98810. 2,
  98811. 0,
  98812. 1,
  98813. 95,
  98814. 144,
  98815. (duration5 & 4278190080) >> 24,
  98816. (duration5 & 16711680) >> 16,
  98817. (duration5 & 65280) >> 8,
  98818. duration5 & 255,
  98819. 0,
  98820. 1,
  98821. 0,
  98822. 0,
  98823. 1,
  98824. 0,
  98825. 0,
  98826. 0,
  98827. 0,
  98828. 0,
  98829. 0,
  98830. 0,
  98831. 0,
  98832. 0,
  98833. 0,
  98834. 0,
  98835. 0,
  98836. 1,
  98837. 0,
  98838. 0,
  98839. 0,
  98840. 0,
  98841. 0,
  98842. 0,
  98843. 0,
  98844. 0,
  98845. 0,
  98846. 0,
  98847. 0,
  98848. 0,
  98849. 0,
  98850. 0,
  98851. 0,
  98852. 1,
  98853. 0,
  98854. 0,
  98855. 0,
  98856. 0,
  98857. 0,
  98858. 0,
  98859. 0,
  98860. 0,
  98861. 0,
  98862. 0,
  98863. 0,
  98864. 0,
  98865. 0,
  98866. 0,
  98867. 64,
  98868. 0,
  98869. 0,
  98870. 0,
  98871. 0,
  98872. 0,
  98873. 0,
  98874. 0,
  98875. 0,
  98876. 0,
  98877. 0,
  98878. 0,
  98879. 0,
  98880. 0,
  98881. 0,
  98882. 0,
  98883. 0,
  98884. 0,
  98885. 0,
  98886. 0,
  98887. 0,
  98888. 0,
  98889. 0,
  98890. 0,
  98891. 0,
  98892. 0,
  98893. 0,
  98894. 0,
  98895. 255,
  98896. 255,
  98897. 255,
  98898. 255
  98899. ]);
  98900. return box(types.mvhd, bytes);
  98901. };
  98902. sdtp = function sdtp2(track) {
  98903. var samples = track.samples || [], bytes = new Uint8Array(4 + samples.length), flags, i2;
  98904. for (i2 = 0; i2 < samples.length; i2++) {
  98905. flags = samples[i2].flags;
  98906. bytes[i2 + 4] = flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;
  98907. }
  98908. return box(types.sdtp, bytes);
  98909. };
  98910. stbl = function stbl2(track) {
  98911. return box(types.stbl, stsd(track), box(types.stts, STTS), box(types.stsc, STSC), box(types.stsz, STSZ), box(types.stco, STCO));
  98912. };
  98913. (function() {
  98914. var videoSample, audioSample;
  98915. stsd = function stsd2(track) {
  98916. return box(types.stsd, new Uint8Array([
  98917. 0,
  98918. 0,
  98919. 0,
  98920. 0,
  98921. 0,
  98922. 0,
  98923. 0,
  98924. 1
  98925. ]), track.type === "video" ? videoSample(track) : audioSample(track));
  98926. };
  98927. videoSample = function videoSample2(track) {
  98928. var sps = track.sps || [], pps = track.pps || [], sequenceParameterSets = [], pictureParameterSets = [], i2, avc1Box;
  98929. for (i2 = 0; i2 < sps.length; i2++) {
  98930. sequenceParameterSets.push((sps[i2].byteLength & 65280) >>> 8);
  98931. sequenceParameterSets.push(sps[i2].byteLength & 255);
  98932. sequenceParameterSets = sequenceParameterSets.concat(Array.prototype.slice.call(sps[i2]));
  98933. }
  98934. for (i2 = 0; i2 < pps.length; i2++) {
  98935. pictureParameterSets.push((pps[i2].byteLength & 65280) >>> 8);
  98936. pictureParameterSets.push(pps[i2].byteLength & 255);
  98937. pictureParameterSets = pictureParameterSets.concat(Array.prototype.slice.call(pps[i2]));
  98938. }
  98939. avc1Box = [types.avc1, new Uint8Array([
  98940. 0,
  98941. 0,
  98942. 0,
  98943. 0,
  98944. 0,
  98945. 0,
  98946. 0,
  98947. 1,
  98948. 0,
  98949. 0,
  98950. 0,
  98951. 0,
  98952. 0,
  98953. 0,
  98954. 0,
  98955. 0,
  98956. 0,
  98957. 0,
  98958. 0,
  98959. 0,
  98960. 0,
  98961. 0,
  98962. 0,
  98963. 0,
  98964. (track.width & 65280) >> 8,
  98965. track.width & 255,
  98966. (track.height & 65280) >> 8,
  98967. track.height & 255,
  98968. 0,
  98969. 72,
  98970. 0,
  98971. 0,
  98972. 0,
  98973. 72,
  98974. 0,
  98975. 0,
  98976. 0,
  98977. 0,
  98978. 0,
  98979. 0,
  98980. 0,
  98981. 1,
  98982. 19,
  98983. 118,
  98984. 105,
  98985. 100,
  98986. 101,
  98987. 111,
  98988. 106,
  98989. 115,
  98990. 45,
  98991. 99,
  98992. 111,
  98993. 110,
  98994. 116,
  98995. 114,
  98996. 105,
  98997. 98,
  98998. 45,
  98999. 104,
  99000. 108,
  99001. 115,
  99002. 0,
  99003. 0,
  99004. 0,
  99005. 0,
  99006. 0,
  99007. 0,
  99008. 0,
  99009. 0,
  99010. 0,
  99011. 0,
  99012. 0,
  99013. 0,
  99014. 0,
  99015. 24,
  99016. 17,
  99017. 17
  99018. ]), box(types.avcC, new Uint8Array([
  99019. 1,
  99020. track.profileIdc,
  99021. track.profileCompatibility,
  99022. track.levelIdc,
  99023. 255
  99024. ].concat(
  99025. [sps.length],
  99026. sequenceParameterSets,
  99027. [pps.length],
  99028. pictureParameterSets
  99029. ))), box(types.btrt, new Uint8Array([
  99030. 0,
  99031. 28,
  99032. 156,
  99033. 128,
  99034. 0,
  99035. 45,
  99036. 198,
  99037. 192,
  99038. 0,
  99039. 45,
  99040. 198,
  99041. 192
  99042. ]))];
  99043. if (track.sarRatio) {
  99044. var hSpacing = track.sarRatio[0], vSpacing = track.sarRatio[1];
  99045. avc1Box.push(box(types.pasp, new Uint8Array([(hSpacing & 4278190080) >> 24, (hSpacing & 16711680) >> 16, (hSpacing & 65280) >> 8, hSpacing & 255, (vSpacing & 4278190080) >> 24, (vSpacing & 16711680) >> 16, (vSpacing & 65280) >> 8, vSpacing & 255])));
  99046. }
  99047. return box.apply(null, avc1Box);
  99048. };
  99049. audioSample = function audioSample2(track) {
  99050. return box(types.mp4a, new Uint8Array([
  99051. 0,
  99052. 0,
  99053. 0,
  99054. 0,
  99055. 0,
  99056. 0,
  99057. 0,
  99058. 1,
  99059. 0,
  99060. 0,
  99061. 0,
  99062. 0,
  99063. 0,
  99064. 0,
  99065. 0,
  99066. 0,
  99067. (track.channelcount & 65280) >> 8,
  99068. track.channelcount & 255,
  99069. (track.samplesize & 65280) >> 8,
  99070. track.samplesize & 255,
  99071. 0,
  99072. 0,
  99073. 0,
  99074. 0,
  99075. (track.samplerate & 65280) >> 8,
  99076. track.samplerate & 255,
  99077. 0,
  99078. 0
  99079. ]), esds(track));
  99080. };
  99081. })();
  99082. tkhd = function tkhd2(track) {
  99083. var result = new Uint8Array([
  99084. 0,
  99085. 0,
  99086. 0,
  99087. 7,
  99088. 0,
  99089. 0,
  99090. 0,
  99091. 0,
  99092. 0,
  99093. 0,
  99094. 0,
  99095. 0,
  99096. (track.id & 4278190080) >> 24,
  99097. (track.id & 16711680) >> 16,
  99098. (track.id & 65280) >> 8,
  99099. track.id & 255,
  99100. 0,
  99101. 0,
  99102. 0,
  99103. 0,
  99104. (track.duration & 4278190080) >> 24,
  99105. (track.duration & 16711680) >> 16,
  99106. (track.duration & 65280) >> 8,
  99107. track.duration & 255,
  99108. 0,
  99109. 0,
  99110. 0,
  99111. 0,
  99112. 0,
  99113. 0,
  99114. 0,
  99115. 0,
  99116. 0,
  99117. 0,
  99118. 0,
  99119. 0,
  99120. 1,
  99121. 0,
  99122. 0,
  99123. 0,
  99124. 0,
  99125. 1,
  99126. 0,
  99127. 0,
  99128. 0,
  99129. 0,
  99130. 0,
  99131. 0,
  99132. 0,
  99133. 0,
  99134. 0,
  99135. 0,
  99136. 0,
  99137. 0,
  99138. 0,
  99139. 0,
  99140. 0,
  99141. 1,
  99142. 0,
  99143. 0,
  99144. 0,
  99145. 0,
  99146. 0,
  99147. 0,
  99148. 0,
  99149. 0,
  99150. 0,
  99151. 0,
  99152. 0,
  99153. 0,
  99154. 0,
  99155. 0,
  99156. 64,
  99157. 0,
  99158. 0,
  99159. 0,
  99160. (track.width & 65280) >> 8,
  99161. track.width & 255,
  99162. 0,
  99163. 0,
  99164. (track.height & 65280) >> 8,
  99165. track.height & 255,
  99166. 0,
  99167. 0
  99168. ]);
  99169. return box(types.tkhd, result);
  99170. };
  99171. traf = function traf2(track) {
  99172. var trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable, dataOffset, upperWordBaseMediaDecodeTime, lowerWordBaseMediaDecodeTime;
  99173. trackFragmentHeader = box(types.tfhd, new Uint8Array([
  99174. 0,
  99175. 0,
  99176. 0,
  99177. 58,
  99178. (track.id & 4278190080) >> 24,
  99179. (track.id & 16711680) >> 16,
  99180. (track.id & 65280) >> 8,
  99181. track.id & 255,
  99182. 0,
  99183. 0,
  99184. 0,
  99185. 1,
  99186. 0,
  99187. 0,
  99188. 0,
  99189. 0,
  99190. 0,
  99191. 0,
  99192. 0,
  99193. 0,
  99194. 0,
  99195. 0,
  99196. 0,
  99197. 0
  99198. ]));
  99199. upperWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime / MAX_UINT322);
  99200. lowerWordBaseMediaDecodeTime = Math.floor(track.baseMediaDecodeTime % MAX_UINT322);
  99201. trackFragmentDecodeTime = box(types.tfdt, new Uint8Array([
  99202. 1,
  99203. 0,
  99204. 0,
  99205. 0,
  99206. upperWordBaseMediaDecodeTime >>> 24 & 255,
  99207. upperWordBaseMediaDecodeTime >>> 16 & 255,
  99208. upperWordBaseMediaDecodeTime >>> 8 & 255,
  99209. upperWordBaseMediaDecodeTime & 255,
  99210. lowerWordBaseMediaDecodeTime >>> 24 & 255,
  99211. lowerWordBaseMediaDecodeTime >>> 16 & 255,
  99212. lowerWordBaseMediaDecodeTime >>> 8 & 255,
  99213. lowerWordBaseMediaDecodeTime & 255
  99214. ]));
  99215. dataOffset = 32 + 20 + 8 + 16 + 8 + 8;
  99216. if (track.type === "audio") {
  99217. trackFragmentRun = trun$1(track, dataOffset);
  99218. return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun);
  99219. }
  99220. sampleDependencyTable = sdtp(track);
  99221. trackFragmentRun = trun$1(track, sampleDependencyTable.length + dataOffset);
  99222. return box(types.traf, trackFragmentHeader, trackFragmentDecodeTime, trackFragmentRun, sampleDependencyTable);
  99223. };
  99224. trak = function trak2(track) {
  99225. track.duration = track.duration || 4294967295;
  99226. return box(types.trak, tkhd(track), mdia(track));
  99227. };
  99228. trex = function trex2(track) {
  99229. var result = new Uint8Array([
  99230. 0,
  99231. 0,
  99232. 0,
  99233. 0,
  99234. (track.id & 4278190080) >> 24,
  99235. (track.id & 16711680) >> 16,
  99236. (track.id & 65280) >> 8,
  99237. track.id & 255,
  99238. 0,
  99239. 0,
  99240. 0,
  99241. 1,
  99242. 0,
  99243. 0,
  99244. 0,
  99245. 0,
  99246. 0,
  99247. 0,
  99248. 0,
  99249. 0,
  99250. 0,
  99251. 1,
  99252. 0,
  99253. 1
  99254. ]);
  99255. if (track.type !== "video") {
  99256. result[result.length - 1] = 0;
  99257. }
  99258. return box(types.trex, result);
  99259. };
  99260. (function() {
  99261. var audioTrun, videoTrun, trunHeader;
  99262. trunHeader = function trunHeader2(samples, offset) {
  99263. var durationPresent = 0, sizePresent = 0, flagsPresent = 0, compositionTimeOffset = 0;
  99264. if (samples.length) {
  99265. if (samples[0].duration !== void 0) {
  99266. durationPresent = 1;
  99267. }
  99268. if (samples[0].size !== void 0) {
  99269. sizePresent = 2;
  99270. }
  99271. if (samples[0].flags !== void 0) {
  99272. flagsPresent = 4;
  99273. }
  99274. if (samples[0].compositionTimeOffset !== void 0) {
  99275. compositionTimeOffset = 8;
  99276. }
  99277. }
  99278. return [
  99279. 0,
  99280. 0,
  99281. durationPresent | sizePresent | flagsPresent | compositionTimeOffset,
  99282. 1,
  99283. (samples.length & 4278190080) >>> 24,
  99284. (samples.length & 16711680) >>> 16,
  99285. (samples.length & 65280) >>> 8,
  99286. samples.length & 255,
  99287. (offset & 4278190080) >>> 24,
  99288. (offset & 16711680) >>> 16,
  99289. (offset & 65280) >>> 8,
  99290. offset & 255
  99291. ];
  99292. };
  99293. videoTrun = function videoTrun2(track, offset) {
  99294. var bytesOffest, bytes, header, samples, sample, i2;
  99295. samples = track.samples || [];
  99296. offset += 8 + 12 + 16 * samples.length;
  99297. header = trunHeader(samples, offset);
  99298. bytes = new Uint8Array(header.length + samples.length * 16);
  99299. bytes.set(header);
  99300. bytesOffest = header.length;
  99301. for (i2 = 0; i2 < samples.length; i2++) {
  99302. sample = samples[i2];
  99303. bytes[bytesOffest++] = (sample.duration & 4278190080) >>> 24;
  99304. bytes[bytesOffest++] = (sample.duration & 16711680) >>> 16;
  99305. bytes[bytesOffest++] = (sample.duration & 65280) >>> 8;
  99306. bytes[bytesOffest++] = sample.duration & 255;
  99307. bytes[bytesOffest++] = (sample.size & 4278190080) >>> 24;
  99308. bytes[bytesOffest++] = (sample.size & 16711680) >>> 16;
  99309. bytes[bytesOffest++] = (sample.size & 65280) >>> 8;
  99310. bytes[bytesOffest++] = sample.size & 255;
  99311. bytes[bytesOffest++] = sample.flags.isLeading << 2 | sample.flags.dependsOn;
  99312. bytes[bytesOffest++] = sample.flags.isDependedOn << 6 | sample.flags.hasRedundancy << 4 | sample.flags.paddingValue << 1 | sample.flags.isNonSyncSample;
  99313. bytes[bytesOffest++] = sample.flags.degradationPriority & 240 << 8;
  99314. bytes[bytesOffest++] = sample.flags.degradationPriority & 15;
  99315. bytes[bytesOffest++] = (sample.compositionTimeOffset & 4278190080) >>> 24;
  99316. bytes[bytesOffest++] = (sample.compositionTimeOffset & 16711680) >>> 16;
  99317. bytes[bytesOffest++] = (sample.compositionTimeOffset & 65280) >>> 8;
  99318. bytes[bytesOffest++] = sample.compositionTimeOffset & 255;
  99319. }
  99320. return box(types.trun, bytes);
  99321. };
  99322. audioTrun = function audioTrun2(track, offset) {
  99323. var bytes, bytesOffest, header, samples, sample, i2;
  99324. samples = track.samples || [];
  99325. offset += 8 + 12 + 8 * samples.length;
  99326. header = trunHeader(samples, offset);
  99327. bytes = new Uint8Array(header.length + samples.length * 8);
  99328. bytes.set(header);
  99329. bytesOffest = header.length;
  99330. for (i2 = 0; i2 < samples.length; i2++) {
  99331. sample = samples[i2];
  99332. bytes[bytesOffest++] = (sample.duration & 4278190080) >>> 24;
  99333. bytes[bytesOffest++] = (sample.duration & 16711680) >>> 16;
  99334. bytes[bytesOffest++] = (sample.duration & 65280) >>> 8;
  99335. bytes[bytesOffest++] = sample.duration & 255;
  99336. bytes[bytesOffest++] = (sample.size & 4278190080) >>> 24;
  99337. bytes[bytesOffest++] = (sample.size & 16711680) >>> 16;
  99338. bytes[bytesOffest++] = (sample.size & 65280) >>> 8;
  99339. bytes[bytesOffest++] = sample.size & 255;
  99340. }
  99341. return box(types.trun, bytes);
  99342. };
  99343. trun$1 = function trun2(track, offset) {
  99344. if (track.type === "audio") {
  99345. return audioTrun(track, offset);
  99346. }
  99347. return videoTrun(track, offset);
  99348. };
  99349. })();
  99350. var mp4Generator = {
  99351. ftyp,
  99352. mdat,
  99353. moof,
  99354. moov,
  99355. initSegment: function initSegment(tracks) {
  99356. var fileType = ftyp(), movie = moov(tracks), result;
  99357. result = new Uint8Array(fileType.byteLength + movie.byteLength);
  99358. result.set(fileType);
  99359. result.set(movie, fileType.byteLength);
  99360. return result;
  99361. }
  99362. };
  99363. var groupNalsIntoFrames = function groupNalsIntoFrames2(nalUnits) {
  99364. var i2, currentNal, currentFrame = [], frames = [];
  99365. frames.byteLength = 0;
  99366. frames.nalCount = 0;
  99367. frames.duration = 0;
  99368. currentFrame.byteLength = 0;
  99369. for (i2 = 0; i2 < nalUnits.length; i2++) {
  99370. currentNal = nalUnits[i2];
  99371. if (currentNal.nalUnitType === "access_unit_delimiter_rbsp") {
  99372. if (currentFrame.length) {
  99373. currentFrame.duration = currentNal.dts - currentFrame.dts;
  99374. frames.byteLength += currentFrame.byteLength;
  99375. frames.nalCount += currentFrame.length;
  99376. frames.duration += currentFrame.duration;
  99377. frames.push(currentFrame);
  99378. }
  99379. currentFrame = [currentNal];
  99380. currentFrame.byteLength = currentNal.data.byteLength;
  99381. currentFrame.pts = currentNal.pts;
  99382. currentFrame.dts = currentNal.dts;
  99383. } else {
  99384. if (currentNal.nalUnitType === "slice_layer_without_partitioning_rbsp_idr") {
  99385. currentFrame.keyFrame = true;
  99386. }
  99387. currentFrame.duration = currentNal.dts - currentFrame.dts;
  99388. currentFrame.byteLength += currentNal.data.byteLength;
  99389. currentFrame.push(currentNal);
  99390. }
  99391. }
  99392. if (frames.length && (!currentFrame.duration || currentFrame.duration <= 0)) {
  99393. currentFrame.duration = frames[frames.length - 1].duration;
  99394. }
  99395. frames.byteLength += currentFrame.byteLength;
  99396. frames.nalCount += currentFrame.length;
  99397. frames.duration += currentFrame.duration;
  99398. frames.push(currentFrame);
  99399. return frames;
  99400. };
  99401. var groupFramesIntoGops = function groupFramesIntoGops2(frames) {
  99402. var i2, currentFrame, currentGop = [], gops = [];
  99403. currentGop.byteLength = 0;
  99404. currentGop.nalCount = 0;
  99405. currentGop.duration = 0;
  99406. currentGop.pts = frames[0].pts;
  99407. currentGop.dts = frames[0].dts;
  99408. gops.byteLength = 0;
  99409. gops.nalCount = 0;
  99410. gops.duration = 0;
  99411. gops.pts = frames[0].pts;
  99412. gops.dts = frames[0].dts;
  99413. for (i2 = 0; i2 < frames.length; i2++) {
  99414. currentFrame = frames[i2];
  99415. if (currentFrame.keyFrame) {
  99416. if (currentGop.length) {
  99417. gops.push(currentGop);
  99418. gops.byteLength += currentGop.byteLength;
  99419. gops.nalCount += currentGop.nalCount;
  99420. gops.duration += currentGop.duration;
  99421. }
  99422. currentGop = [currentFrame];
  99423. currentGop.nalCount = currentFrame.length;
  99424. currentGop.byteLength = currentFrame.byteLength;
  99425. currentGop.pts = currentFrame.pts;
  99426. currentGop.dts = currentFrame.dts;
  99427. currentGop.duration = currentFrame.duration;
  99428. } else {
  99429. currentGop.duration += currentFrame.duration;
  99430. currentGop.nalCount += currentFrame.length;
  99431. currentGop.byteLength += currentFrame.byteLength;
  99432. currentGop.push(currentFrame);
  99433. }
  99434. }
  99435. if (gops.length && currentGop.duration <= 0) {
  99436. currentGop.duration = gops[gops.length - 1].duration;
  99437. }
  99438. gops.byteLength += currentGop.byteLength;
  99439. gops.nalCount += currentGop.nalCount;
  99440. gops.duration += currentGop.duration;
  99441. gops.push(currentGop);
  99442. return gops;
  99443. };
  99444. var extendFirstKeyFrame = function extendFirstKeyFrame2(gops) {
  99445. var currentGop;
  99446. if (!gops[0][0].keyFrame && gops.length > 1) {
  99447. currentGop = gops.shift();
  99448. gops.byteLength -= currentGop.byteLength;
  99449. gops.nalCount -= currentGop.nalCount;
  99450. gops[0][0].dts = currentGop.dts;
  99451. gops[0][0].pts = currentGop.pts;
  99452. gops[0][0].duration += currentGop.duration;
  99453. }
  99454. return gops;
  99455. };
  99456. var createDefaultSample = function createDefaultSample2() {
  99457. return {
  99458. size: 0,
  99459. flags: {
  99460. isLeading: 0,
  99461. dependsOn: 1,
  99462. isDependedOn: 0,
  99463. hasRedundancy: 0,
  99464. degradationPriority: 0,
  99465. isNonSyncSample: 1
  99466. }
  99467. };
  99468. };
  99469. var sampleForFrame = function sampleForFrame2(frame, dataOffset) {
  99470. var sample = createDefaultSample();
  99471. sample.dataOffset = dataOffset;
  99472. sample.compositionTimeOffset = frame.pts - frame.dts;
  99473. sample.duration = frame.duration;
  99474. sample.size = 4 * frame.length;
  99475. sample.size += frame.byteLength;
  99476. if (frame.keyFrame) {
  99477. sample.flags.dependsOn = 2;
  99478. sample.flags.isNonSyncSample = 0;
  99479. }
  99480. return sample;
  99481. };
  99482. var generateSampleTable$1 = function generateSampleTable2(gops, baseDataOffset) {
  99483. var h2, i2, sample, currentGop, currentFrame, dataOffset = baseDataOffset || 0, samples = [];
  99484. for (h2 = 0; h2 < gops.length; h2++) {
  99485. currentGop = gops[h2];
  99486. for (i2 = 0; i2 < currentGop.length; i2++) {
  99487. currentFrame = currentGop[i2];
  99488. sample = sampleForFrame(currentFrame, dataOffset);
  99489. dataOffset += sample.size;
  99490. samples.push(sample);
  99491. }
  99492. }
  99493. return samples;
  99494. };
  99495. var concatenateNalData = function concatenateNalData2(gops) {
  99496. var h2, i2, j, currentGop, currentFrame, currentNal, dataOffset = 0, nalsByteLength = gops.byteLength, numberOfNals = gops.nalCount, totalByteLength = nalsByteLength + 4 * numberOfNals, data = new Uint8Array(totalByteLength), view = new DataView(data.buffer);
  99497. for (h2 = 0; h2 < gops.length; h2++) {
  99498. currentGop = gops[h2];
  99499. for (i2 = 0; i2 < currentGop.length; i2++) {
  99500. currentFrame = currentGop[i2];
  99501. for (j = 0; j < currentFrame.length; j++) {
  99502. currentNal = currentFrame[j];
  99503. view.setUint32(dataOffset, currentNal.data.byteLength);
  99504. dataOffset += 4;
  99505. data.set(currentNal.data, dataOffset);
  99506. dataOffset += currentNal.data.byteLength;
  99507. }
  99508. }
  99509. }
  99510. return data;
  99511. };
  99512. var generateSampleTableForFrame = function generateSampleTableForFrame2(frame, baseDataOffset) {
  99513. var sample, dataOffset = baseDataOffset || 0, samples = [];
  99514. sample = sampleForFrame(frame, dataOffset);
  99515. samples.push(sample);
  99516. return samples;
  99517. };
  99518. var concatenateNalDataForFrame = function concatenateNalDataForFrame2(frame) {
  99519. var i2, currentNal, dataOffset = 0, nalsByteLength = frame.byteLength, numberOfNals = frame.length, totalByteLength = nalsByteLength + 4 * numberOfNals, data = new Uint8Array(totalByteLength), view = new DataView(data.buffer);
  99520. for (i2 = 0; i2 < frame.length; i2++) {
  99521. currentNal = frame[i2];
  99522. view.setUint32(dataOffset, currentNal.data.byteLength);
  99523. dataOffset += 4;
  99524. data.set(currentNal.data, dataOffset);
  99525. dataOffset += currentNal.data.byteLength;
  99526. }
  99527. return data;
  99528. };
  99529. var frameUtils = {
  99530. groupNalsIntoFrames,
  99531. groupFramesIntoGops,
  99532. extendFirstKeyFrame,
  99533. generateSampleTable: generateSampleTable$1,
  99534. concatenateNalData,
  99535. generateSampleTableForFrame,
  99536. concatenateNalDataForFrame
  99537. };
  99538. var highPrefix = [33, 16, 5, 32, 164, 27];
  99539. var lowPrefix = [33, 65, 108, 84, 1, 2, 4, 8, 168, 2, 4, 8, 17, 191, 252];
  99540. var zeroFill = function zeroFill2(count) {
  99541. var a = [];
  99542. while (count--) {
  99543. a.push(0);
  99544. }
  99545. return a;
  99546. };
  99547. var makeTable = function makeTable2(metaTable) {
  99548. return Object.keys(metaTable).reduce(function(obj, key) {
  99549. obj[key] = new Uint8Array(metaTable[key].reduce(function(arr, part) {
  99550. return arr.concat(part);
  99551. }, []));
  99552. return obj;
  99553. }, {});
  99554. };
  99555. var silence;
  99556. var silence_1 = function silence_12() {
  99557. if (!silence) {
  99558. var coneOfSilence = {
  99559. 96e3: [highPrefix, [227, 64], zeroFill(154), [56]],
  99560. 88200: [highPrefix, [231], zeroFill(170), [56]],
  99561. 64e3: [highPrefix, [248, 192], zeroFill(240), [56]],
  99562. 48e3: [highPrefix, [255, 192], zeroFill(268), [55, 148, 128], zeroFill(54), [112]],
  99563. 44100: [highPrefix, [255, 192], zeroFill(268), [55, 163, 128], zeroFill(84), [112]],
  99564. 32e3: [highPrefix, [255, 192], zeroFill(268), [55, 234], zeroFill(226), [112]],
  99565. 24e3: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 112], zeroFill(126), [224]],
  99566. 16e3: [highPrefix, [255, 192], zeroFill(268), [55, 255, 128], zeroFill(268), [111, 255], zeroFill(269), [223, 108], zeroFill(195), [1, 192]],
  99567. 12e3: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 253, 128], zeroFill(259), [56]],
  99568. 11025: [lowPrefix, zeroFill(268), [3, 127, 248], zeroFill(268), [6, 255, 240], zeroFill(268), [13, 255, 224], zeroFill(268), [27, 255, 192], zeroFill(268), [55, 175, 128], zeroFill(108), [112]],
  99569. 8e3: [lowPrefix, zeroFill(268), [3, 121, 16], zeroFill(47), [7]]
  99570. };
  99571. silence = makeTable(coneOfSilence);
  99572. }
  99573. return silence;
  99574. };
  99575. var ONE_SECOND_IN_TS$4 = 9e4, secondsToVideoTs2, secondsToAudioTs2, videoTsToSeconds2, audioTsToSeconds2, audioTsToVideoTs2, videoTsToAudioTs2, metadataTsToSeconds2;
  99576. secondsToVideoTs2 = function secondsToVideoTs3(seconds) {
  99577. return seconds * ONE_SECOND_IN_TS$4;
  99578. };
  99579. secondsToAudioTs2 = function secondsToAudioTs3(seconds, sampleRate) {
  99580. return seconds * sampleRate;
  99581. };
  99582. videoTsToSeconds2 = function videoTsToSeconds3(timestamp) {
  99583. return timestamp / ONE_SECOND_IN_TS$4;
  99584. };
  99585. audioTsToSeconds2 = function audioTsToSeconds3(timestamp, sampleRate) {
  99586. return timestamp / sampleRate;
  99587. };
  99588. audioTsToVideoTs2 = function audioTsToVideoTs3(timestamp, sampleRate) {
  99589. return secondsToVideoTs2(audioTsToSeconds2(timestamp, sampleRate));
  99590. };
  99591. videoTsToAudioTs2 = function videoTsToAudioTs3(timestamp, sampleRate) {
  99592. return secondsToAudioTs2(videoTsToSeconds2(timestamp), sampleRate);
  99593. };
  99594. metadataTsToSeconds2 = function metadataTsToSeconds3(timestamp, timelineStartPts, keepOriginalTimestamps) {
  99595. return videoTsToSeconds2(keepOriginalTimestamps ? timestamp : timestamp - timelineStartPts);
  99596. };
  99597. var clock2 = {
  99598. ONE_SECOND_IN_TS: ONE_SECOND_IN_TS$4,
  99599. secondsToVideoTs: secondsToVideoTs2,
  99600. secondsToAudioTs: secondsToAudioTs2,
  99601. videoTsToSeconds: videoTsToSeconds2,
  99602. audioTsToSeconds: audioTsToSeconds2,
  99603. audioTsToVideoTs: audioTsToVideoTs2,
  99604. videoTsToAudioTs: videoTsToAudioTs2,
  99605. metadataTsToSeconds: metadataTsToSeconds2
  99606. };
  99607. var sumFrameByteLengths = function sumFrameByteLengths2(array) {
  99608. var i2, currentObj, sum = 0;
  99609. for (i2 = 0; i2 < array.length; i2++) {
  99610. currentObj = array[i2];
  99611. sum += currentObj.data.byteLength;
  99612. }
  99613. return sum;
  99614. };
  99615. var prefixWithSilence = function prefixWithSilence2(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime) {
  99616. var baseMediaDecodeTimeTs, frameDuration = 0, audioGapDuration = 0, audioFillFrameCount = 0, audioFillDuration = 0, silentFrame, i2, firstFrame;
  99617. if (!frames.length) {
  99618. return;
  99619. }
  99620. baseMediaDecodeTimeTs = clock2.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate);
  99621. frameDuration = Math.ceil(clock2.ONE_SECOND_IN_TS / (track.samplerate / 1024));
  99622. if (audioAppendStartTs && videoBaseMediaDecodeTime) {
  99623. audioGapDuration = baseMediaDecodeTimeTs - Math.max(audioAppendStartTs, videoBaseMediaDecodeTime);
  99624. audioFillFrameCount = Math.floor(audioGapDuration / frameDuration);
  99625. audioFillDuration = audioFillFrameCount * frameDuration;
  99626. }
  99627. if (audioFillFrameCount < 1 || audioFillDuration > clock2.ONE_SECOND_IN_TS / 2) {
  99628. return;
  99629. }
  99630. silentFrame = silence_1()[track.samplerate];
  99631. if (!silentFrame) {
  99632. silentFrame = frames[0].data;
  99633. }
  99634. for (i2 = 0; i2 < audioFillFrameCount; i2++) {
  99635. firstFrame = frames[0];
  99636. frames.splice(0, 0, {
  99637. data: silentFrame,
  99638. dts: firstFrame.dts - frameDuration,
  99639. pts: firstFrame.pts - frameDuration
  99640. });
  99641. }
  99642. track.baseMediaDecodeTime -= Math.floor(clock2.videoTsToAudioTs(audioFillDuration, track.samplerate));
  99643. return audioFillDuration;
  99644. };
  99645. var trimAdtsFramesByEarliestDts = function trimAdtsFramesByEarliestDts2(adtsFrames, track, earliestAllowedDts) {
  99646. if (track.minSegmentDts >= earliestAllowedDts) {
  99647. return adtsFrames;
  99648. }
  99649. track.minSegmentDts = Infinity;
  99650. return adtsFrames.filter(function(currentFrame) {
  99651. if (currentFrame.dts >= earliestAllowedDts) {
  99652. track.minSegmentDts = Math.min(track.minSegmentDts, currentFrame.dts);
  99653. track.minSegmentPts = track.minSegmentDts;
  99654. return true;
  99655. }
  99656. return false;
  99657. });
  99658. };
  99659. var generateSampleTable = function generateSampleTable2(frames) {
  99660. var i2, currentFrame, samples = [];
  99661. for (i2 = 0; i2 < frames.length; i2++) {
  99662. currentFrame = frames[i2];
  99663. samples.push({
  99664. size: currentFrame.data.byteLength,
  99665. duration: 1024
  99666. });
  99667. }
  99668. return samples;
  99669. };
  99670. var concatenateFrameData = function concatenateFrameData2(frames) {
  99671. var i2, currentFrame, dataOffset = 0, data = new Uint8Array(sumFrameByteLengths(frames));
  99672. for (i2 = 0; i2 < frames.length; i2++) {
  99673. currentFrame = frames[i2];
  99674. data.set(currentFrame.data, dataOffset);
  99675. dataOffset += currentFrame.data.byteLength;
  99676. }
  99677. return data;
  99678. };
  99679. var audioFrameUtils = {
  99680. prefixWithSilence,
  99681. trimAdtsFramesByEarliestDts,
  99682. generateSampleTable,
  99683. concatenateFrameData
  99684. };
  99685. var ONE_SECOND_IN_TS$3 = clock2.ONE_SECOND_IN_TS;
  99686. var collectDtsInfo = function collectDtsInfo2(track, data) {
  99687. if (typeof data.pts === "number") {
  99688. if (track.timelineStartInfo.pts === void 0) {
  99689. track.timelineStartInfo.pts = data.pts;
  99690. }
  99691. if (track.minSegmentPts === void 0) {
  99692. track.minSegmentPts = data.pts;
  99693. } else {
  99694. track.minSegmentPts = Math.min(track.minSegmentPts, data.pts);
  99695. }
  99696. if (track.maxSegmentPts === void 0) {
  99697. track.maxSegmentPts = data.pts;
  99698. } else {
  99699. track.maxSegmentPts = Math.max(track.maxSegmentPts, data.pts);
  99700. }
  99701. }
  99702. if (typeof data.dts === "number") {
  99703. if (track.timelineStartInfo.dts === void 0) {
  99704. track.timelineStartInfo.dts = data.dts;
  99705. }
  99706. if (track.minSegmentDts === void 0) {
  99707. track.minSegmentDts = data.dts;
  99708. } else {
  99709. track.minSegmentDts = Math.min(track.minSegmentDts, data.dts);
  99710. }
  99711. if (track.maxSegmentDts === void 0) {
  99712. track.maxSegmentDts = data.dts;
  99713. } else {
  99714. track.maxSegmentDts = Math.max(track.maxSegmentDts, data.dts);
  99715. }
  99716. }
  99717. };
  99718. var clearDtsInfo = function clearDtsInfo2(track) {
  99719. delete track.minSegmentDts;
  99720. delete track.maxSegmentDts;
  99721. delete track.minSegmentPts;
  99722. delete track.maxSegmentPts;
  99723. };
  99724. var calculateTrackBaseMediaDecodeTime = function calculateTrackBaseMediaDecodeTime2(track, keepOriginalTimestamps) {
  99725. var baseMediaDecodeTime, scale, minSegmentDts = track.minSegmentDts;
  99726. if (!keepOriginalTimestamps) {
  99727. minSegmentDts -= track.timelineStartInfo.dts;
  99728. }
  99729. baseMediaDecodeTime = track.timelineStartInfo.baseMediaDecodeTime;
  99730. baseMediaDecodeTime += minSegmentDts;
  99731. baseMediaDecodeTime = Math.max(0, baseMediaDecodeTime);
  99732. if (track.type === "audio") {
  99733. scale = track.samplerate / ONE_SECOND_IN_TS$3;
  99734. baseMediaDecodeTime *= scale;
  99735. baseMediaDecodeTime = Math.floor(baseMediaDecodeTime);
  99736. }
  99737. return baseMediaDecodeTime;
  99738. };
  99739. var trackDecodeInfo = {
  99740. clearDtsInfo,
  99741. calculateTrackBaseMediaDecodeTime,
  99742. collectDtsInfo
  99743. };
  99744. var USER_DATA_REGISTERED_ITU_T_T35 = 4, RBSP_TRAILING_BITS = 128;
  99745. var parseSei = function parseSei2(bytes) {
  99746. var i2 = 0, result = {
  99747. payloadType: -1,
  99748. payloadSize: 0
  99749. }, payloadType = 0, payloadSize = 0;
  99750. while (i2 < bytes.byteLength) {
  99751. if (bytes[i2] === RBSP_TRAILING_BITS) {
  99752. break;
  99753. }
  99754. while (bytes[i2] === 255) {
  99755. payloadType += 255;
  99756. i2++;
  99757. }
  99758. payloadType += bytes[i2++];
  99759. while (bytes[i2] === 255) {
  99760. payloadSize += 255;
  99761. i2++;
  99762. }
  99763. payloadSize += bytes[i2++];
  99764. if (!result.payload && payloadType === USER_DATA_REGISTERED_ITU_T_T35) {
  99765. var userIdentifier = String.fromCharCode(bytes[i2 + 3], bytes[i2 + 4], bytes[i2 + 5], bytes[i2 + 6]);
  99766. if (userIdentifier === "GA94") {
  99767. result.payloadType = payloadType;
  99768. result.payloadSize = payloadSize;
  99769. result.payload = bytes.subarray(i2, i2 + payloadSize);
  99770. break;
  99771. } else {
  99772. result.payload = void 0;
  99773. }
  99774. }
  99775. i2 += payloadSize;
  99776. payloadType = 0;
  99777. payloadSize = 0;
  99778. }
  99779. return result;
  99780. };
  99781. var parseUserData = function parseUserData2(sei) {
  99782. if (sei.payload[0] !== 181) {
  99783. return null;
  99784. }
  99785. if ((sei.payload[1] << 8 | sei.payload[2]) !== 49) {
  99786. return null;
  99787. }
  99788. if (String.fromCharCode(sei.payload[3], sei.payload[4], sei.payload[5], sei.payload[6]) !== "GA94") {
  99789. return null;
  99790. }
  99791. if (sei.payload[7] !== 3) {
  99792. return null;
  99793. }
  99794. return sei.payload.subarray(8, sei.payload.length - 1);
  99795. };
  99796. var parseCaptionPackets = function parseCaptionPackets2(pts, userData) {
  99797. var results = [], i2, count, offset, data;
  99798. if (!(userData[0] & 64)) {
  99799. return results;
  99800. }
  99801. count = userData[0] & 31;
  99802. for (i2 = 0; i2 < count; i2++) {
  99803. offset = i2 * 3;
  99804. data = {
  99805. type: userData[offset + 2] & 3,
  99806. pts
  99807. };
  99808. if (userData[offset + 2] & 4) {
  99809. data.ccData = userData[offset + 3] << 8 | userData[offset + 4];
  99810. results.push(data);
  99811. }
  99812. }
  99813. return results;
  99814. };
  99815. var discardEmulationPreventionBytes$12 = function discardEmulationPreventionBytes5(data) {
  99816. var length = data.byteLength, emulationPreventionBytesPositions = [], i2 = 1, newLength, newData;
  99817. while (i2 < length - 2) {
  99818. if (data[i2] === 0 && data[i2 + 1] === 0 && data[i2 + 2] === 3) {
  99819. emulationPreventionBytesPositions.push(i2 + 2);
  99820. i2 += 2;
  99821. } else {
  99822. i2++;
  99823. }
  99824. }
  99825. if (emulationPreventionBytesPositions.length === 0) {
  99826. return data;
  99827. }
  99828. newLength = length - emulationPreventionBytesPositions.length;
  99829. newData = new Uint8Array(newLength);
  99830. var sourceIndex = 0;
  99831. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  99832. if (sourceIndex === emulationPreventionBytesPositions[0]) {
  99833. sourceIndex++;
  99834. emulationPreventionBytesPositions.shift();
  99835. }
  99836. newData[i2] = data[sourceIndex];
  99837. }
  99838. return newData;
  99839. };
  99840. var captionPacketParser = {
  99841. parseSei,
  99842. parseUserData,
  99843. parseCaptionPackets,
  99844. discardEmulationPreventionBytes: discardEmulationPreventionBytes$12,
  99845. USER_DATA_REGISTERED_ITU_T_T35
  99846. };
  99847. var CaptionStream$1 = function CaptionStream2(options2) {
  99848. options2 = options2 || {};
  99849. CaptionStream2.prototype.init.call(this);
  99850. this.parse708captions_ = typeof options2.parse708captions === "boolean" ? options2.parse708captions : true;
  99851. this.captionPackets_ = [];
  99852. this.ccStreams_ = [
  99853. new Cea608Stream(0, 0),
  99854. new Cea608Stream(0, 1),
  99855. new Cea608Stream(1, 0),
  99856. new Cea608Stream(1, 1)
  99857. ];
  99858. if (this.parse708captions_) {
  99859. this.cc708Stream_ = new Cea708Stream({
  99860. captionServices: options2.captionServices
  99861. });
  99862. }
  99863. this.reset();
  99864. this.ccStreams_.forEach(function(cc) {
  99865. cc.on("data", this.trigger.bind(this, "data"));
  99866. cc.on("partialdone", this.trigger.bind(this, "partialdone"));
  99867. cc.on("done", this.trigger.bind(this, "done"));
  99868. }, this);
  99869. if (this.parse708captions_) {
  99870. this.cc708Stream_.on("data", this.trigger.bind(this, "data"));
  99871. this.cc708Stream_.on("partialdone", this.trigger.bind(this, "partialdone"));
  99872. this.cc708Stream_.on("done", this.trigger.bind(this, "done"));
  99873. }
  99874. };
  99875. CaptionStream$1.prototype = new stream();
  99876. CaptionStream$1.prototype.push = function(event2) {
  99877. var sei, userData, newCaptionPackets;
  99878. if (event2.nalUnitType !== "sei_rbsp") {
  99879. return;
  99880. }
  99881. sei = captionPacketParser.parseSei(event2.escapedRBSP);
  99882. if (!sei.payload) {
  99883. return;
  99884. }
  99885. if (sei.payloadType !== captionPacketParser.USER_DATA_REGISTERED_ITU_T_T35) {
  99886. return;
  99887. }
  99888. userData = captionPacketParser.parseUserData(sei);
  99889. if (!userData) {
  99890. return;
  99891. }
  99892. if (event2.dts < this.latestDts_) {
  99893. this.ignoreNextEqualDts_ = true;
  99894. return;
  99895. } else if (event2.dts === this.latestDts_ && this.ignoreNextEqualDts_) {
  99896. this.numSameDts_--;
  99897. if (!this.numSameDts_) {
  99898. this.ignoreNextEqualDts_ = false;
  99899. }
  99900. return;
  99901. }
  99902. newCaptionPackets = captionPacketParser.parseCaptionPackets(event2.pts, userData);
  99903. this.captionPackets_ = this.captionPackets_.concat(newCaptionPackets);
  99904. if (this.latestDts_ !== event2.dts) {
  99905. this.numSameDts_ = 0;
  99906. }
  99907. this.numSameDts_++;
  99908. this.latestDts_ = event2.dts;
  99909. };
  99910. CaptionStream$1.prototype.flushCCStreams = function(flushType) {
  99911. this.ccStreams_.forEach(function(cc) {
  99912. return flushType === "flush" ? cc.flush() : cc.partialFlush();
  99913. }, this);
  99914. };
  99915. CaptionStream$1.prototype.flushStream = function(flushType) {
  99916. if (!this.captionPackets_.length) {
  99917. this.flushCCStreams(flushType);
  99918. return;
  99919. }
  99920. this.captionPackets_.forEach(function(elem, idx) {
  99921. elem.presortIndex = idx;
  99922. });
  99923. this.captionPackets_.sort(function(a, b) {
  99924. if (a.pts === b.pts) {
  99925. return a.presortIndex - b.presortIndex;
  99926. }
  99927. return a.pts - b.pts;
  99928. });
  99929. this.captionPackets_.forEach(function(packet) {
  99930. if (packet.type < 2) {
  99931. this.dispatchCea608Packet(packet);
  99932. } else {
  99933. this.dispatchCea708Packet(packet);
  99934. }
  99935. }, this);
  99936. this.captionPackets_.length = 0;
  99937. this.flushCCStreams(flushType);
  99938. };
  99939. CaptionStream$1.prototype.flush = function() {
  99940. return this.flushStream("flush");
  99941. };
  99942. CaptionStream$1.prototype.partialFlush = function() {
  99943. return this.flushStream("partialFlush");
  99944. };
  99945. CaptionStream$1.prototype.reset = function() {
  99946. this.latestDts_ = null;
  99947. this.ignoreNextEqualDts_ = false;
  99948. this.numSameDts_ = 0;
  99949. this.activeCea608Channel_ = [null, null];
  99950. this.ccStreams_.forEach(function(ccStream) {
  99951. ccStream.reset();
  99952. });
  99953. };
  99954. CaptionStream$1.prototype.dispatchCea608Packet = function(packet) {
  99955. if (this.setsTextOrXDSActive(packet)) {
  99956. this.activeCea608Channel_[packet.type] = null;
  99957. } else if (this.setsChannel1Active(packet)) {
  99958. this.activeCea608Channel_[packet.type] = 0;
  99959. } else if (this.setsChannel2Active(packet)) {
  99960. this.activeCea608Channel_[packet.type] = 1;
  99961. }
  99962. if (this.activeCea608Channel_[packet.type] === null) {
  99963. return;
  99964. }
  99965. this.ccStreams_[(packet.type << 1) + this.activeCea608Channel_[packet.type]].push(packet);
  99966. };
  99967. CaptionStream$1.prototype.setsChannel1Active = function(packet) {
  99968. return (packet.ccData & 30720) === 4096;
  99969. };
  99970. CaptionStream$1.prototype.setsChannel2Active = function(packet) {
  99971. return (packet.ccData & 30720) === 6144;
  99972. };
  99973. CaptionStream$1.prototype.setsTextOrXDSActive = function(packet) {
  99974. return (packet.ccData & 28928) === 256 || (packet.ccData & 30974) === 4138 || (packet.ccData & 30974) === 6186;
  99975. };
  99976. CaptionStream$1.prototype.dispatchCea708Packet = function(packet) {
  99977. if (this.parse708captions_) {
  99978. this.cc708Stream_.push(packet);
  99979. }
  99980. };
  99981. var CHARACTER_TRANSLATION_708 = {
  99982. 127: 9834,
  99983. 4128: 32,
  99984. 4129: 160,
  99985. 4133: 8230,
  99986. 4138: 352,
  99987. 4140: 338,
  99988. 4144: 9608,
  99989. 4145: 8216,
  99990. 4146: 8217,
  99991. 4147: 8220,
  99992. 4148: 8221,
  99993. 4149: 8226,
  99994. 4153: 8482,
  99995. 4154: 353,
  99996. 4156: 339,
  99997. 4157: 8480,
  99998. 4159: 376,
  99999. 4214: 8539,
  100000. 4215: 8540,
  100001. 4216: 8541,
  100002. 4217: 8542,
  100003. 4218: 9168,
  100004. 4219: 9124,
  100005. 4220: 9123,
  100006. 4221: 9135,
  100007. 4222: 9126,
  100008. 4223: 9121,
  100009. 4256: 12600
  100010. };
  100011. var get708CharFromCode = function get708CharFromCode2(code) {
  100012. var newCode = CHARACTER_TRANSLATION_708[code] || code;
  100013. if (code & 4096 && code === newCode) {
  100014. return "";
  100015. }
  100016. return String.fromCharCode(newCode);
  100017. };
  100018. var within708TextBlock = function within708TextBlock2(b) {
  100019. return 32 <= b && b <= 127 || 160 <= b && b <= 255;
  100020. };
  100021. var Cea708Window = function Cea708Window2(windowNum) {
  100022. this.windowNum = windowNum;
  100023. this.reset();
  100024. };
  100025. Cea708Window.prototype.reset = function() {
  100026. this.clearText();
  100027. this.pendingNewLine = false;
  100028. this.winAttr = {};
  100029. this.penAttr = {};
  100030. this.penLoc = {};
  100031. this.penColor = {};
  100032. this.visible = 0;
  100033. this.rowLock = 0;
  100034. this.columnLock = 0;
  100035. this.priority = 0;
  100036. this.relativePositioning = 0;
  100037. this.anchorVertical = 0;
  100038. this.anchorHorizontal = 0;
  100039. this.anchorPoint = 0;
  100040. this.rowCount = 1;
  100041. this.virtualRowCount = this.rowCount + 1;
  100042. this.columnCount = 41;
  100043. this.windowStyle = 0;
  100044. this.penStyle = 0;
  100045. };
  100046. Cea708Window.prototype.getText = function() {
  100047. return this.rows.join("\n");
  100048. };
  100049. Cea708Window.prototype.clearText = function() {
  100050. this.rows = [""];
  100051. this.rowIdx = 0;
  100052. };
  100053. Cea708Window.prototype.newLine = function(pts) {
  100054. if (this.rows.length >= this.virtualRowCount && typeof this.beforeRowOverflow === "function") {
  100055. this.beforeRowOverflow(pts);
  100056. }
  100057. if (this.rows.length > 0) {
  100058. this.rows.push("");
  100059. this.rowIdx++;
  100060. }
  100061. while (this.rows.length > this.virtualRowCount) {
  100062. this.rows.shift();
  100063. this.rowIdx--;
  100064. }
  100065. };
  100066. Cea708Window.prototype.isEmpty = function() {
  100067. if (this.rows.length === 0) {
  100068. return true;
  100069. } else if (this.rows.length === 1) {
  100070. return this.rows[0] === "";
  100071. }
  100072. return false;
  100073. };
  100074. Cea708Window.prototype.addText = function(text) {
  100075. this.rows[this.rowIdx] += text;
  100076. };
  100077. Cea708Window.prototype.backspace = function() {
  100078. if (!this.isEmpty()) {
  100079. var row = this.rows[this.rowIdx];
  100080. this.rows[this.rowIdx] = row.substr(0, row.length - 1);
  100081. }
  100082. };
  100083. var Cea708Service = function Cea708Service2(serviceNum, encoding, stream2) {
  100084. this.serviceNum = serviceNum;
  100085. this.text = "";
  100086. this.currentWindow = new Cea708Window(-1);
  100087. this.windows = [];
  100088. this.stream = stream2;
  100089. if (typeof encoding === "string") {
  100090. this.createTextDecoder(encoding);
  100091. }
  100092. };
  100093. Cea708Service.prototype.init = function(pts, beforeRowOverflow) {
  100094. this.startPts = pts;
  100095. for (var win3 = 0; win3 < 8; win3++) {
  100096. this.windows[win3] = new Cea708Window(win3);
  100097. if (typeof beforeRowOverflow === "function") {
  100098. this.windows[win3].beforeRowOverflow = beforeRowOverflow;
  100099. }
  100100. }
  100101. };
  100102. Cea708Service.prototype.setCurrentWindow = function(windowNum) {
  100103. this.currentWindow = this.windows[windowNum];
  100104. };
  100105. Cea708Service.prototype.createTextDecoder = function(encoding) {
  100106. if (typeof TextDecoder === "undefined") {
  100107. this.stream.trigger("log", {
  100108. level: "warn",
  100109. message: "The `encoding` option is unsupported without TextDecoder support"
  100110. });
  100111. } else {
  100112. try {
  100113. this.textDecoder_ = new TextDecoder(encoding);
  100114. } catch (error) {
  100115. this.stream.trigger("log", {
  100116. level: "warn",
  100117. message: "TextDecoder could not be created with " + encoding + " encoding. " + error
  100118. });
  100119. }
  100120. }
  100121. };
  100122. var Cea708Stream = function Cea708Stream2(options2) {
  100123. options2 = options2 || {};
  100124. Cea708Stream2.prototype.init.call(this);
  100125. var self2 = this;
  100126. var captionServices = options2.captionServices || {};
  100127. var captionServiceEncodings = {};
  100128. var serviceProps;
  100129. Object.keys(captionServices).forEach(function(serviceName) {
  100130. serviceProps = captionServices[serviceName];
  100131. if (/^SERVICE/.test(serviceName)) {
  100132. captionServiceEncodings[serviceName] = serviceProps.encoding;
  100133. }
  100134. });
  100135. this.serviceEncodings = captionServiceEncodings;
  100136. this.current708Packet = null;
  100137. this.services = {};
  100138. this.push = function(packet) {
  100139. if (packet.type === 3) {
  100140. self2.new708Packet();
  100141. self2.add708Bytes(packet);
  100142. } else {
  100143. if (self2.current708Packet === null) {
  100144. self2.new708Packet();
  100145. }
  100146. self2.add708Bytes(packet);
  100147. }
  100148. };
  100149. };
  100150. Cea708Stream.prototype = new stream();
  100151. Cea708Stream.prototype.new708Packet = function() {
  100152. if (this.current708Packet !== null) {
  100153. this.push708Packet();
  100154. }
  100155. this.current708Packet = {
  100156. data: [],
  100157. ptsVals: []
  100158. };
  100159. };
  100160. Cea708Stream.prototype.add708Bytes = function(packet) {
  100161. var data = packet.ccData;
  100162. var byte0 = data >>> 8;
  100163. var byte1 = data & 255;
  100164. this.current708Packet.ptsVals.push(packet.pts);
  100165. this.current708Packet.data.push(byte0);
  100166. this.current708Packet.data.push(byte1);
  100167. };
  100168. Cea708Stream.prototype.push708Packet = function() {
  100169. var packet708 = this.current708Packet;
  100170. var packetData = packet708.data;
  100171. var serviceNum = null;
  100172. var blockSize = null;
  100173. var i2 = 0;
  100174. var b = packetData[i2++];
  100175. packet708.seq = b >> 6;
  100176. packet708.sizeCode = b & 63;
  100177. for (; i2 < packetData.length; i2++) {
  100178. b = packetData[i2++];
  100179. serviceNum = b >> 5;
  100180. blockSize = b & 31;
  100181. if (serviceNum === 7 && blockSize > 0) {
  100182. b = packetData[i2++];
  100183. serviceNum = b;
  100184. }
  100185. this.pushServiceBlock(serviceNum, i2, blockSize);
  100186. if (blockSize > 0) {
  100187. i2 += blockSize - 1;
  100188. }
  100189. }
  100190. };
  100191. Cea708Stream.prototype.pushServiceBlock = function(serviceNum, start2, size) {
  100192. var b;
  100193. var i2 = start2;
  100194. var packetData = this.current708Packet.data;
  100195. var service = this.services[serviceNum];
  100196. if (!service) {
  100197. service = this.initService(serviceNum, i2);
  100198. }
  100199. for (; i2 < start2 + size && i2 < packetData.length; i2++) {
  100200. b = packetData[i2];
  100201. if (within708TextBlock(b)) {
  100202. i2 = this.handleText(i2, service);
  100203. } else if (b === 24) {
  100204. i2 = this.multiByteCharacter(i2, service);
  100205. } else if (b === 16) {
  100206. i2 = this.extendedCommands(i2, service);
  100207. } else if (128 <= b && b <= 135) {
  100208. i2 = this.setCurrentWindow(i2, service);
  100209. } else if (152 <= b && b <= 159) {
  100210. i2 = this.defineWindow(i2, service);
  100211. } else if (b === 136) {
  100212. i2 = this.clearWindows(i2, service);
  100213. } else if (b === 140) {
  100214. i2 = this.deleteWindows(i2, service);
  100215. } else if (b === 137) {
  100216. i2 = this.displayWindows(i2, service);
  100217. } else if (b === 138) {
  100218. i2 = this.hideWindows(i2, service);
  100219. } else if (b === 139) {
  100220. i2 = this.toggleWindows(i2, service);
  100221. } else if (b === 151) {
  100222. i2 = this.setWindowAttributes(i2, service);
  100223. } else if (b === 144) {
  100224. i2 = this.setPenAttributes(i2, service);
  100225. } else if (b === 145) {
  100226. i2 = this.setPenColor(i2, service);
  100227. } else if (b === 146) {
  100228. i2 = this.setPenLocation(i2, service);
  100229. } else if (b === 143) {
  100230. service = this.reset(i2, service);
  100231. } else if (b === 8) {
  100232. service.currentWindow.backspace();
  100233. } else if (b === 12) {
  100234. service.currentWindow.clearText();
  100235. } else if (b === 13) {
  100236. service.currentWindow.pendingNewLine = true;
  100237. } else if (b === 14) {
  100238. service.currentWindow.clearText();
  100239. } else if (b === 141) {
  100240. i2++;
  100241. } else
  100242. ;
  100243. }
  100244. };
  100245. Cea708Stream.prototype.extendedCommands = function(i2, service) {
  100246. var packetData = this.current708Packet.data;
  100247. var b = packetData[++i2];
  100248. if (within708TextBlock(b)) {
  100249. i2 = this.handleText(i2, service, {
  100250. isExtended: true
  100251. });
  100252. }
  100253. return i2;
  100254. };
  100255. Cea708Stream.prototype.getPts = function(byteIndex) {
  100256. return this.current708Packet.ptsVals[Math.floor(byteIndex / 2)];
  100257. };
  100258. Cea708Stream.prototype.initService = function(serviceNum, i2) {
  100259. var serviceName = "SERVICE" + serviceNum;
  100260. var self2 = this;
  100261. var serviceName;
  100262. var encoding;
  100263. if (serviceName in this.serviceEncodings) {
  100264. encoding = this.serviceEncodings[serviceName];
  100265. }
  100266. this.services[serviceNum] = new Cea708Service(serviceNum, encoding, self2);
  100267. this.services[serviceNum].init(this.getPts(i2), function(pts) {
  100268. self2.flushDisplayed(pts, self2.services[serviceNum]);
  100269. });
  100270. return this.services[serviceNum];
  100271. };
  100272. Cea708Stream.prototype.handleText = function(i2, service, options2) {
  100273. var isExtended = options2 && options2.isExtended;
  100274. var isMultiByte = options2 && options2.isMultiByte;
  100275. var packetData = this.current708Packet.data;
  100276. var extended = isExtended ? 4096 : 0;
  100277. var currentByte = packetData[i2];
  100278. var nextByte = packetData[i2 + 1];
  100279. var win3 = service.currentWindow;
  100280. var _char;
  100281. var charCodeArray;
  100282. if (service.textDecoder_ && !isExtended) {
  100283. if (isMultiByte) {
  100284. charCodeArray = [currentByte, nextByte];
  100285. i2++;
  100286. } else {
  100287. charCodeArray = [currentByte];
  100288. }
  100289. _char = service.textDecoder_.decode(new Uint8Array(charCodeArray));
  100290. } else {
  100291. _char = get708CharFromCode(extended | currentByte);
  100292. }
  100293. if (win3.pendingNewLine && !win3.isEmpty()) {
  100294. win3.newLine(this.getPts(i2));
  100295. }
  100296. win3.pendingNewLine = false;
  100297. win3.addText(_char);
  100298. return i2;
  100299. };
  100300. Cea708Stream.prototype.multiByteCharacter = function(i2, service) {
  100301. var packetData = this.current708Packet.data;
  100302. var firstByte = packetData[i2 + 1];
  100303. var secondByte = packetData[i2 + 2];
  100304. if (within708TextBlock(firstByte) && within708TextBlock(secondByte)) {
  100305. i2 = this.handleText(++i2, service, {
  100306. isMultiByte: true
  100307. });
  100308. }
  100309. return i2;
  100310. };
  100311. Cea708Stream.prototype.setCurrentWindow = function(i2, service) {
  100312. var packetData = this.current708Packet.data;
  100313. var b = packetData[i2];
  100314. var windowNum = b & 7;
  100315. service.setCurrentWindow(windowNum);
  100316. return i2;
  100317. };
  100318. Cea708Stream.prototype.defineWindow = function(i2, service) {
  100319. var packetData = this.current708Packet.data;
  100320. var b = packetData[i2];
  100321. var windowNum = b & 7;
  100322. service.setCurrentWindow(windowNum);
  100323. var win3 = service.currentWindow;
  100324. b = packetData[++i2];
  100325. win3.visible = (b & 32) >> 5;
  100326. win3.rowLock = (b & 16) >> 4;
  100327. win3.columnLock = (b & 8) >> 3;
  100328. win3.priority = b & 7;
  100329. b = packetData[++i2];
  100330. win3.relativePositioning = (b & 128) >> 7;
  100331. win3.anchorVertical = b & 127;
  100332. b = packetData[++i2];
  100333. win3.anchorHorizontal = b;
  100334. b = packetData[++i2];
  100335. win3.anchorPoint = (b & 240) >> 4;
  100336. win3.rowCount = b & 15;
  100337. b = packetData[++i2];
  100338. win3.columnCount = b & 63;
  100339. b = packetData[++i2];
  100340. win3.windowStyle = (b & 56) >> 3;
  100341. win3.penStyle = b & 7;
  100342. win3.virtualRowCount = win3.rowCount + 1;
  100343. return i2;
  100344. };
  100345. Cea708Stream.prototype.setWindowAttributes = function(i2, service) {
  100346. var packetData = this.current708Packet.data;
  100347. var b = packetData[i2];
  100348. var winAttr = service.currentWindow.winAttr;
  100349. b = packetData[++i2];
  100350. winAttr.fillOpacity = (b & 192) >> 6;
  100351. winAttr.fillRed = (b & 48) >> 4;
  100352. winAttr.fillGreen = (b & 12) >> 2;
  100353. winAttr.fillBlue = b & 3;
  100354. b = packetData[++i2];
  100355. winAttr.borderType = (b & 192) >> 6;
  100356. winAttr.borderRed = (b & 48) >> 4;
  100357. winAttr.borderGreen = (b & 12) >> 2;
  100358. winAttr.borderBlue = b & 3;
  100359. b = packetData[++i2];
  100360. winAttr.borderType += (b & 128) >> 5;
  100361. winAttr.wordWrap = (b & 64) >> 6;
  100362. winAttr.printDirection = (b & 48) >> 4;
  100363. winAttr.scrollDirection = (b & 12) >> 2;
  100364. winAttr.justify = b & 3;
  100365. b = packetData[++i2];
  100366. winAttr.effectSpeed = (b & 240) >> 4;
  100367. winAttr.effectDirection = (b & 12) >> 2;
  100368. winAttr.displayEffect = b & 3;
  100369. return i2;
  100370. };
  100371. Cea708Stream.prototype.flushDisplayed = function(pts, service) {
  100372. var displayedText = [];
  100373. for (var winId = 0; winId < 8; winId++) {
  100374. if (service.windows[winId].visible && !service.windows[winId].isEmpty()) {
  100375. displayedText.push(service.windows[winId].getText());
  100376. }
  100377. }
  100378. service.endPts = pts;
  100379. service.text = displayedText.join("\n\n");
  100380. this.pushCaption(service);
  100381. service.startPts = pts;
  100382. };
  100383. Cea708Stream.prototype.pushCaption = function(service) {
  100384. if (service.text !== "") {
  100385. this.trigger("data", {
  100386. startPts: service.startPts,
  100387. endPts: service.endPts,
  100388. text: service.text,
  100389. stream: "cc708_" + service.serviceNum
  100390. });
  100391. service.text = "";
  100392. service.startPts = service.endPts;
  100393. }
  100394. };
  100395. Cea708Stream.prototype.displayWindows = function(i2, service) {
  100396. var packetData = this.current708Packet.data;
  100397. var b = packetData[++i2];
  100398. var pts = this.getPts(i2);
  100399. this.flushDisplayed(pts, service);
  100400. for (var winId = 0; winId < 8; winId++) {
  100401. if (b & 1 << winId) {
  100402. service.windows[winId].visible = 1;
  100403. }
  100404. }
  100405. return i2;
  100406. };
  100407. Cea708Stream.prototype.hideWindows = function(i2, service) {
  100408. var packetData = this.current708Packet.data;
  100409. var b = packetData[++i2];
  100410. var pts = this.getPts(i2);
  100411. this.flushDisplayed(pts, service);
  100412. for (var winId = 0; winId < 8; winId++) {
  100413. if (b & 1 << winId) {
  100414. service.windows[winId].visible = 0;
  100415. }
  100416. }
  100417. return i2;
  100418. };
  100419. Cea708Stream.prototype.toggleWindows = function(i2, service) {
  100420. var packetData = this.current708Packet.data;
  100421. var b = packetData[++i2];
  100422. var pts = this.getPts(i2);
  100423. this.flushDisplayed(pts, service);
  100424. for (var winId = 0; winId < 8; winId++) {
  100425. if (b & 1 << winId) {
  100426. service.windows[winId].visible ^= 1;
  100427. }
  100428. }
  100429. return i2;
  100430. };
  100431. Cea708Stream.prototype.clearWindows = function(i2, service) {
  100432. var packetData = this.current708Packet.data;
  100433. var b = packetData[++i2];
  100434. var pts = this.getPts(i2);
  100435. this.flushDisplayed(pts, service);
  100436. for (var winId = 0; winId < 8; winId++) {
  100437. if (b & 1 << winId) {
  100438. service.windows[winId].clearText();
  100439. }
  100440. }
  100441. return i2;
  100442. };
  100443. Cea708Stream.prototype.deleteWindows = function(i2, service) {
  100444. var packetData = this.current708Packet.data;
  100445. var b = packetData[++i2];
  100446. var pts = this.getPts(i2);
  100447. this.flushDisplayed(pts, service);
  100448. for (var winId = 0; winId < 8; winId++) {
  100449. if (b & 1 << winId) {
  100450. service.windows[winId].reset();
  100451. }
  100452. }
  100453. return i2;
  100454. };
  100455. Cea708Stream.prototype.setPenAttributes = function(i2, service) {
  100456. var packetData = this.current708Packet.data;
  100457. var b = packetData[i2];
  100458. var penAttr = service.currentWindow.penAttr;
  100459. b = packetData[++i2];
  100460. penAttr.textTag = (b & 240) >> 4;
  100461. penAttr.offset = (b & 12) >> 2;
  100462. penAttr.penSize = b & 3;
  100463. b = packetData[++i2];
  100464. penAttr.italics = (b & 128) >> 7;
  100465. penAttr.underline = (b & 64) >> 6;
  100466. penAttr.edgeType = (b & 56) >> 3;
  100467. penAttr.fontStyle = b & 7;
  100468. return i2;
  100469. };
  100470. Cea708Stream.prototype.setPenColor = function(i2, service) {
  100471. var packetData = this.current708Packet.data;
  100472. var b = packetData[i2];
  100473. var penColor = service.currentWindow.penColor;
  100474. b = packetData[++i2];
  100475. penColor.fgOpacity = (b & 192) >> 6;
  100476. penColor.fgRed = (b & 48) >> 4;
  100477. penColor.fgGreen = (b & 12) >> 2;
  100478. penColor.fgBlue = b & 3;
  100479. b = packetData[++i2];
  100480. penColor.bgOpacity = (b & 192) >> 6;
  100481. penColor.bgRed = (b & 48) >> 4;
  100482. penColor.bgGreen = (b & 12) >> 2;
  100483. penColor.bgBlue = b & 3;
  100484. b = packetData[++i2];
  100485. penColor.edgeRed = (b & 48) >> 4;
  100486. penColor.edgeGreen = (b & 12) >> 2;
  100487. penColor.edgeBlue = b & 3;
  100488. return i2;
  100489. };
  100490. Cea708Stream.prototype.setPenLocation = function(i2, service) {
  100491. var packetData = this.current708Packet.data;
  100492. var b = packetData[i2];
  100493. var penLoc = service.currentWindow.penLoc;
  100494. service.currentWindow.pendingNewLine = true;
  100495. b = packetData[++i2];
  100496. penLoc.row = b & 15;
  100497. b = packetData[++i2];
  100498. penLoc.column = b & 63;
  100499. return i2;
  100500. };
  100501. Cea708Stream.prototype.reset = function(i2, service) {
  100502. var pts = this.getPts(i2);
  100503. this.flushDisplayed(pts, service);
  100504. return this.initService(service.serviceNum, i2);
  100505. };
  100506. var CHARACTER_TRANSLATION = {
  100507. 42: 225,
  100508. 92: 233,
  100509. 94: 237,
  100510. 95: 243,
  100511. 96: 250,
  100512. 123: 231,
  100513. 124: 247,
  100514. 125: 209,
  100515. 126: 241,
  100516. 127: 9608,
  100517. 304: 174,
  100518. 305: 176,
  100519. 306: 189,
  100520. 307: 191,
  100521. 308: 8482,
  100522. 309: 162,
  100523. 310: 163,
  100524. 311: 9834,
  100525. 312: 224,
  100526. 313: 160,
  100527. 314: 232,
  100528. 315: 226,
  100529. 316: 234,
  100530. 317: 238,
  100531. 318: 244,
  100532. 319: 251,
  100533. 544: 193,
  100534. 545: 201,
  100535. 546: 211,
  100536. 547: 218,
  100537. 548: 220,
  100538. 549: 252,
  100539. 550: 8216,
  100540. 551: 161,
  100541. 552: 42,
  100542. 553: 39,
  100543. 554: 8212,
  100544. 555: 169,
  100545. 556: 8480,
  100546. 557: 8226,
  100547. 558: 8220,
  100548. 559: 8221,
  100549. 560: 192,
  100550. 561: 194,
  100551. 562: 199,
  100552. 563: 200,
  100553. 564: 202,
  100554. 565: 203,
  100555. 566: 235,
  100556. 567: 206,
  100557. 568: 207,
  100558. 569: 239,
  100559. 570: 212,
  100560. 571: 217,
  100561. 572: 249,
  100562. 573: 219,
  100563. 574: 171,
  100564. 575: 187,
  100565. 800: 195,
  100566. 801: 227,
  100567. 802: 205,
  100568. 803: 204,
  100569. 804: 236,
  100570. 805: 210,
  100571. 806: 242,
  100572. 807: 213,
  100573. 808: 245,
  100574. 809: 123,
  100575. 810: 125,
  100576. 811: 92,
  100577. 812: 94,
  100578. 813: 95,
  100579. 814: 124,
  100580. 815: 126,
  100581. 816: 196,
  100582. 817: 228,
  100583. 818: 214,
  100584. 819: 246,
  100585. 820: 223,
  100586. 821: 165,
  100587. 822: 164,
  100588. 823: 9474,
  100589. 824: 197,
  100590. 825: 229,
  100591. 826: 216,
  100592. 827: 248,
  100593. 828: 9484,
  100594. 829: 9488,
  100595. 830: 9492,
  100596. 831: 9496
  100597. };
  100598. var getCharFromCode = function getCharFromCode2(code) {
  100599. if (code === null) {
  100600. return "";
  100601. }
  100602. code = CHARACTER_TRANSLATION[code] || code;
  100603. return String.fromCharCode(code);
  100604. };
  100605. var BOTTOM_ROW = 14;
  100606. var ROWS = [4352, 4384, 4608, 4640, 5376, 5408, 5632, 5664, 5888, 5920, 4096, 4864, 4896, 5120, 5152];
  100607. var createDisplayBuffer = function createDisplayBuffer2() {
  100608. var result = [], i2 = BOTTOM_ROW + 1;
  100609. while (i2--) {
  100610. result.push("");
  100611. }
  100612. return result;
  100613. };
  100614. var Cea608Stream = function Cea608Stream2(field, dataChannel) {
  100615. Cea608Stream2.prototype.init.call(this);
  100616. this.field_ = field || 0;
  100617. this.dataChannel_ = dataChannel || 0;
  100618. this.name_ = "CC" + ((this.field_ << 1 | this.dataChannel_) + 1);
  100619. this.setConstants();
  100620. this.reset();
  100621. this.push = function(packet) {
  100622. var data, swap, char0, char1, text;
  100623. data = packet.ccData & 32639;
  100624. if (data === this.lastControlCode_) {
  100625. this.lastControlCode_ = null;
  100626. return;
  100627. }
  100628. if ((data & 61440) === 4096) {
  100629. this.lastControlCode_ = data;
  100630. } else if (data !== this.PADDING_) {
  100631. this.lastControlCode_ = null;
  100632. }
  100633. char0 = data >>> 8;
  100634. char1 = data & 255;
  100635. if (data === this.PADDING_) {
  100636. return;
  100637. } else if (data === this.RESUME_CAPTION_LOADING_) {
  100638. this.mode_ = "popOn";
  100639. } else if (data === this.END_OF_CAPTION_) {
  100640. this.mode_ = "popOn";
  100641. this.clearFormatting(packet.pts);
  100642. this.flushDisplayed(packet.pts);
  100643. swap = this.displayed_;
  100644. this.displayed_ = this.nonDisplayed_;
  100645. this.nonDisplayed_ = swap;
  100646. this.startPts_ = packet.pts;
  100647. } else if (data === this.ROLL_UP_2_ROWS_) {
  100648. this.rollUpRows_ = 2;
  100649. this.setRollUp(packet.pts);
  100650. } else if (data === this.ROLL_UP_3_ROWS_) {
  100651. this.rollUpRows_ = 3;
  100652. this.setRollUp(packet.pts);
  100653. } else if (data === this.ROLL_UP_4_ROWS_) {
  100654. this.rollUpRows_ = 4;
  100655. this.setRollUp(packet.pts);
  100656. } else if (data === this.CARRIAGE_RETURN_) {
  100657. this.clearFormatting(packet.pts);
  100658. this.flushDisplayed(packet.pts);
  100659. this.shiftRowsUp_();
  100660. this.startPts_ = packet.pts;
  100661. } else if (data === this.BACKSPACE_) {
  100662. if (this.mode_ === "popOn") {
  100663. this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);
  100664. } else {
  100665. this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
  100666. }
  100667. } else if (data === this.ERASE_DISPLAYED_MEMORY_) {
  100668. this.flushDisplayed(packet.pts);
  100669. this.displayed_ = createDisplayBuffer();
  100670. } else if (data === this.ERASE_NON_DISPLAYED_MEMORY_) {
  100671. this.nonDisplayed_ = createDisplayBuffer();
  100672. } else if (data === this.RESUME_DIRECT_CAPTIONING_) {
  100673. if (this.mode_ !== "paintOn") {
  100674. this.flushDisplayed(packet.pts);
  100675. this.displayed_ = createDisplayBuffer();
  100676. }
  100677. this.mode_ = "paintOn";
  100678. this.startPts_ = packet.pts;
  100679. } else if (this.isSpecialCharacter(char0, char1)) {
  100680. char0 = (char0 & 3) << 8;
  100681. text = getCharFromCode(char0 | char1);
  100682. this[this.mode_](packet.pts, text);
  100683. this.column_++;
  100684. } else if (this.isExtCharacter(char0, char1)) {
  100685. if (this.mode_ === "popOn") {
  100686. this.nonDisplayed_[this.row_] = this.nonDisplayed_[this.row_].slice(0, -1);
  100687. } else {
  100688. this.displayed_[this.row_] = this.displayed_[this.row_].slice(0, -1);
  100689. }
  100690. char0 = (char0 & 3) << 8;
  100691. text = getCharFromCode(char0 | char1);
  100692. this[this.mode_](packet.pts, text);
  100693. this.column_++;
  100694. } else if (this.isMidRowCode(char0, char1)) {
  100695. this.clearFormatting(packet.pts);
  100696. this[this.mode_](packet.pts, " ");
  100697. this.column_++;
  100698. if ((char1 & 14) === 14) {
  100699. this.addFormatting(packet.pts, ["i"]);
  100700. }
  100701. if ((char1 & 1) === 1) {
  100702. this.addFormatting(packet.pts, ["u"]);
  100703. }
  100704. } else if (this.isOffsetControlCode(char0, char1)) {
  100705. this.column_ += char1 & 3;
  100706. } else if (this.isPAC(char0, char1)) {
  100707. var row = ROWS.indexOf(data & 7968);
  100708. if (this.mode_ === "rollUp") {
  100709. if (row - this.rollUpRows_ + 1 < 0) {
  100710. row = this.rollUpRows_ - 1;
  100711. }
  100712. this.setRollUp(packet.pts, row);
  100713. }
  100714. if (row !== this.row_) {
  100715. this.clearFormatting(packet.pts);
  100716. this.row_ = row;
  100717. }
  100718. if (char1 & 1 && this.formatting_.indexOf("u") === -1) {
  100719. this.addFormatting(packet.pts, ["u"]);
  100720. }
  100721. if ((data & 16) === 16) {
  100722. this.column_ = ((data & 14) >> 1) * 4;
  100723. }
  100724. if (this.isColorPAC(char1)) {
  100725. if ((char1 & 14) === 14) {
  100726. this.addFormatting(packet.pts, ["i"]);
  100727. }
  100728. }
  100729. } else if (this.isNormalChar(char0)) {
  100730. if (char1 === 0) {
  100731. char1 = null;
  100732. }
  100733. text = getCharFromCode(char0);
  100734. text += getCharFromCode(char1);
  100735. this[this.mode_](packet.pts, text);
  100736. this.column_ += text.length;
  100737. }
  100738. };
  100739. };
  100740. Cea608Stream.prototype = new stream();
  100741. Cea608Stream.prototype.flushDisplayed = function(pts) {
  100742. var content = this.displayed_.map(function(row, index2) {
  100743. try {
  100744. return row.trim();
  100745. } catch (e) {
  100746. this.trigger("log", {
  100747. level: "warn",
  100748. message: "Skipping a malformed 608 caption at index " + index2 + "."
  100749. });
  100750. return "";
  100751. }
  100752. }, this).join("\n").replace(/^\n+|\n+$/g, "");
  100753. if (content.length) {
  100754. this.trigger("data", {
  100755. startPts: this.startPts_,
  100756. endPts: pts,
  100757. text: content,
  100758. stream: this.name_
  100759. });
  100760. }
  100761. };
  100762. Cea608Stream.prototype.reset = function() {
  100763. this.mode_ = "popOn";
  100764. this.topRow_ = 0;
  100765. this.startPts_ = 0;
  100766. this.displayed_ = createDisplayBuffer();
  100767. this.nonDisplayed_ = createDisplayBuffer();
  100768. this.lastControlCode_ = null;
  100769. this.column_ = 0;
  100770. this.row_ = BOTTOM_ROW;
  100771. this.rollUpRows_ = 2;
  100772. this.formatting_ = [];
  100773. };
  100774. Cea608Stream.prototype.setConstants = function() {
  100775. if (this.dataChannel_ === 0) {
  100776. this.BASE_ = 16;
  100777. this.EXT_ = 17;
  100778. this.CONTROL_ = (20 | this.field_) << 8;
  100779. this.OFFSET_ = 23;
  100780. } else if (this.dataChannel_ === 1) {
  100781. this.BASE_ = 24;
  100782. this.EXT_ = 25;
  100783. this.CONTROL_ = (28 | this.field_) << 8;
  100784. this.OFFSET_ = 31;
  100785. }
  100786. this.PADDING_ = 0;
  100787. this.RESUME_CAPTION_LOADING_ = this.CONTROL_ | 32;
  100788. this.END_OF_CAPTION_ = this.CONTROL_ | 47;
  100789. this.ROLL_UP_2_ROWS_ = this.CONTROL_ | 37;
  100790. this.ROLL_UP_3_ROWS_ = this.CONTROL_ | 38;
  100791. this.ROLL_UP_4_ROWS_ = this.CONTROL_ | 39;
  100792. this.CARRIAGE_RETURN_ = this.CONTROL_ | 45;
  100793. this.RESUME_DIRECT_CAPTIONING_ = this.CONTROL_ | 41;
  100794. this.BACKSPACE_ = this.CONTROL_ | 33;
  100795. this.ERASE_DISPLAYED_MEMORY_ = this.CONTROL_ | 44;
  100796. this.ERASE_NON_DISPLAYED_MEMORY_ = this.CONTROL_ | 46;
  100797. };
  100798. Cea608Stream.prototype.isSpecialCharacter = function(char0, char1) {
  100799. return char0 === this.EXT_ && char1 >= 48 && char1 <= 63;
  100800. };
  100801. Cea608Stream.prototype.isExtCharacter = function(char0, char1) {
  100802. return (char0 === this.EXT_ + 1 || char0 === this.EXT_ + 2) && char1 >= 32 && char1 <= 63;
  100803. };
  100804. Cea608Stream.prototype.isMidRowCode = function(char0, char1) {
  100805. return char0 === this.EXT_ && char1 >= 32 && char1 <= 47;
  100806. };
  100807. Cea608Stream.prototype.isOffsetControlCode = function(char0, char1) {
  100808. return char0 === this.OFFSET_ && char1 >= 33 && char1 <= 35;
  100809. };
  100810. Cea608Stream.prototype.isPAC = function(char0, char1) {
  100811. return char0 >= this.BASE_ && char0 < this.BASE_ + 8 && char1 >= 64 && char1 <= 127;
  100812. };
  100813. Cea608Stream.prototype.isColorPAC = function(char1) {
  100814. return char1 >= 64 && char1 <= 79 || char1 >= 96 && char1 <= 127;
  100815. };
  100816. Cea608Stream.prototype.isNormalChar = function(_char2) {
  100817. return _char2 >= 32 && _char2 <= 127;
  100818. };
  100819. Cea608Stream.prototype.setRollUp = function(pts, newBaseRow) {
  100820. if (this.mode_ !== "rollUp") {
  100821. this.row_ = BOTTOM_ROW;
  100822. this.mode_ = "rollUp";
  100823. this.flushDisplayed(pts);
  100824. this.nonDisplayed_ = createDisplayBuffer();
  100825. this.displayed_ = createDisplayBuffer();
  100826. }
  100827. if (newBaseRow !== void 0 && newBaseRow !== this.row_) {
  100828. for (var i2 = 0; i2 < this.rollUpRows_; i2++) {
  100829. this.displayed_[newBaseRow - i2] = this.displayed_[this.row_ - i2];
  100830. this.displayed_[this.row_ - i2] = "";
  100831. }
  100832. }
  100833. if (newBaseRow === void 0) {
  100834. newBaseRow = this.row_;
  100835. }
  100836. this.topRow_ = newBaseRow - this.rollUpRows_ + 1;
  100837. };
  100838. Cea608Stream.prototype.addFormatting = function(pts, format) {
  100839. this.formatting_ = this.formatting_.concat(format);
  100840. var text = format.reduce(function(text2, format2) {
  100841. return text2 + "<" + format2 + ">";
  100842. }, "");
  100843. this[this.mode_](pts, text);
  100844. };
  100845. Cea608Stream.prototype.clearFormatting = function(pts) {
  100846. if (!this.formatting_.length) {
  100847. return;
  100848. }
  100849. var text = this.formatting_.reverse().reduce(function(text2, format) {
  100850. return text2 + "</" + format + ">";
  100851. }, "");
  100852. this.formatting_ = [];
  100853. this[this.mode_](pts, text);
  100854. };
  100855. Cea608Stream.prototype.popOn = function(pts, text) {
  100856. var baseRow = this.nonDisplayed_[this.row_];
  100857. baseRow += text;
  100858. this.nonDisplayed_[this.row_] = baseRow;
  100859. };
  100860. Cea608Stream.prototype.rollUp = function(pts, text) {
  100861. var baseRow = this.displayed_[this.row_];
  100862. baseRow += text;
  100863. this.displayed_[this.row_] = baseRow;
  100864. };
  100865. Cea608Stream.prototype.shiftRowsUp_ = function() {
  100866. var i2;
  100867. for (i2 = 0; i2 < this.topRow_; i2++) {
  100868. this.displayed_[i2] = "";
  100869. }
  100870. for (i2 = this.row_ + 1; i2 < BOTTOM_ROW + 1; i2++) {
  100871. this.displayed_[i2] = "";
  100872. }
  100873. for (i2 = this.topRow_; i2 < this.row_; i2++) {
  100874. this.displayed_[i2] = this.displayed_[i2 + 1];
  100875. }
  100876. this.displayed_[this.row_] = "";
  100877. };
  100878. Cea608Stream.prototype.paintOn = function(pts, text) {
  100879. var baseRow = this.displayed_[this.row_];
  100880. baseRow += text;
  100881. this.displayed_[this.row_] = baseRow;
  100882. };
  100883. var captionStream = {
  100884. CaptionStream: CaptionStream$1,
  100885. Cea608Stream,
  100886. Cea708Stream
  100887. };
  100888. var streamTypes = {
  100889. H264_STREAM_TYPE: 27,
  100890. ADTS_STREAM_TYPE: 15,
  100891. METADATA_STREAM_TYPE: 21
  100892. };
  100893. var MAX_TS = 8589934592;
  100894. var RO_THRESH = 4294967296;
  100895. var TYPE_SHARED = "shared";
  100896. var handleRollover$1 = function handleRollover2(value, reference) {
  100897. var direction = 1;
  100898. if (value > reference) {
  100899. direction = -1;
  100900. }
  100901. while (Math.abs(reference - value) > RO_THRESH) {
  100902. value += direction * MAX_TS;
  100903. }
  100904. return value;
  100905. };
  100906. var TimestampRolloverStream$1 = function TimestampRolloverStream2(type3) {
  100907. var lastDTS, referenceDTS;
  100908. TimestampRolloverStream2.prototype.init.call(this);
  100909. this.type_ = type3 || TYPE_SHARED;
  100910. this.push = function(data) {
  100911. if (this.type_ !== TYPE_SHARED && data.type !== this.type_) {
  100912. return;
  100913. }
  100914. if (referenceDTS === void 0) {
  100915. referenceDTS = data.dts;
  100916. }
  100917. data.dts = handleRollover$1(data.dts, referenceDTS);
  100918. data.pts = handleRollover$1(data.pts, referenceDTS);
  100919. lastDTS = data.dts;
  100920. this.trigger("data", data);
  100921. };
  100922. this.flush = function() {
  100923. referenceDTS = lastDTS;
  100924. this.trigger("done");
  100925. };
  100926. this.endTimeline = function() {
  100927. this.flush();
  100928. this.trigger("endedtimeline");
  100929. };
  100930. this.discontinuity = function() {
  100931. referenceDTS = void 0;
  100932. lastDTS = void 0;
  100933. };
  100934. this.reset = function() {
  100935. this.discontinuity();
  100936. this.trigger("reset");
  100937. };
  100938. };
  100939. TimestampRolloverStream$1.prototype = new stream();
  100940. var timestampRolloverStream = {
  100941. TimestampRolloverStream: TimestampRolloverStream$1,
  100942. handleRollover: handleRollover$1
  100943. };
  100944. var percentEncode$1 = function percentEncode2(bytes, start2, end) {
  100945. var i2, result = "";
  100946. for (i2 = start2; i2 < end; i2++) {
  100947. result += "%" + ("00" + bytes[i2].toString(16)).slice(-2);
  100948. }
  100949. return result;
  100950. }, parseUtf8 = function parseUtf82(bytes, start2, end) {
  100951. return decodeURIComponent(percentEncode$1(bytes, start2, end));
  100952. }, parseIso88591$1 = function parseIso885912(bytes, start2, end) {
  100953. return unescape(percentEncode$1(bytes, start2, end));
  100954. }, parseSyncSafeInteger$1 = function parseSyncSafeInteger2(data) {
  100955. return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];
  100956. }, tagParsers = {
  100957. TXXX: function TXXX(tag) {
  100958. var i2;
  100959. if (tag.data[0] !== 3) {
  100960. return;
  100961. }
  100962. for (i2 = 1; i2 < tag.data.length; i2++) {
  100963. if (tag.data[i2] === 0) {
  100964. tag.description = parseUtf8(tag.data, 1, i2);
  100965. tag.value = parseUtf8(tag.data, i2 + 1, tag.data.length).replace(/\0*$/, "");
  100966. break;
  100967. }
  100968. }
  100969. tag.data = tag.value;
  100970. },
  100971. WXXX: function WXXX(tag) {
  100972. var i2;
  100973. if (tag.data[0] !== 3) {
  100974. return;
  100975. }
  100976. for (i2 = 1; i2 < tag.data.length; i2++) {
  100977. if (tag.data[i2] === 0) {
  100978. tag.description = parseUtf8(tag.data, 1, i2);
  100979. tag.url = parseUtf8(tag.data, i2 + 1, tag.data.length);
  100980. break;
  100981. }
  100982. }
  100983. },
  100984. PRIV: function PRIV(tag) {
  100985. var i2;
  100986. for (i2 = 0; i2 < tag.data.length; i2++) {
  100987. if (tag.data[i2] === 0) {
  100988. tag.owner = parseIso88591$1(tag.data, 0, i2);
  100989. break;
  100990. }
  100991. }
  100992. tag.privateData = tag.data.subarray(i2 + 1);
  100993. tag.data = tag.privateData;
  100994. }
  100995. }, _MetadataStream;
  100996. _MetadataStream = function MetadataStream(options2) {
  100997. var settings = {
  100998. descriptor: options2 && options2.descriptor
  100999. }, tagSize = 0, buffer = [], bufferSize = 0, i2;
  101000. _MetadataStream.prototype.init.call(this);
  101001. this.dispatchType = streamTypes.METADATA_STREAM_TYPE.toString(16);
  101002. if (settings.descriptor) {
  101003. for (i2 = 0; i2 < settings.descriptor.length; i2++) {
  101004. this.dispatchType += ("00" + settings.descriptor[i2].toString(16)).slice(-2);
  101005. }
  101006. }
  101007. this.push = function(chunk) {
  101008. var tag, frameStart, frameSize, frame, i3, frameHeader;
  101009. if (chunk.type !== "timed-metadata") {
  101010. return;
  101011. }
  101012. if (chunk.dataAlignmentIndicator) {
  101013. bufferSize = 0;
  101014. buffer.length = 0;
  101015. }
  101016. if (buffer.length === 0 && (chunk.data.length < 10 || chunk.data[0] !== "I".charCodeAt(0) || chunk.data[1] !== "D".charCodeAt(0) || chunk.data[2] !== "3".charCodeAt(0))) {
  101017. this.trigger("log", {
  101018. level: "warn",
  101019. message: "Skipping unrecognized metadata packet"
  101020. });
  101021. return;
  101022. }
  101023. buffer.push(chunk);
  101024. bufferSize += chunk.data.byteLength;
  101025. if (buffer.length === 1) {
  101026. tagSize = parseSyncSafeInteger$1(chunk.data.subarray(6, 10));
  101027. tagSize += 10;
  101028. }
  101029. if (bufferSize < tagSize) {
  101030. return;
  101031. }
  101032. tag = {
  101033. data: new Uint8Array(tagSize),
  101034. frames: [],
  101035. pts: buffer[0].pts,
  101036. dts: buffer[0].dts
  101037. };
  101038. for (i3 = 0; i3 < tagSize; ) {
  101039. tag.data.set(buffer[0].data.subarray(0, tagSize - i3), i3);
  101040. i3 += buffer[0].data.byteLength;
  101041. bufferSize -= buffer[0].data.byteLength;
  101042. buffer.shift();
  101043. }
  101044. frameStart = 10;
  101045. if (tag.data[5] & 64) {
  101046. frameStart += 4;
  101047. frameStart += parseSyncSafeInteger$1(tag.data.subarray(10, 14));
  101048. tagSize -= parseSyncSafeInteger$1(tag.data.subarray(16, 20));
  101049. }
  101050. do {
  101051. frameSize = parseSyncSafeInteger$1(tag.data.subarray(frameStart + 4, frameStart + 8));
  101052. if (frameSize < 1) {
  101053. this.trigger("log", {
  101054. level: "warn",
  101055. message: "Malformed ID3 frame encountered. Skipping metadata parsing."
  101056. });
  101057. return;
  101058. }
  101059. frameHeader = String.fromCharCode(tag.data[frameStart], tag.data[frameStart + 1], tag.data[frameStart + 2], tag.data[frameStart + 3]);
  101060. frame = {
  101061. id: frameHeader,
  101062. data: tag.data.subarray(frameStart + 10, frameStart + frameSize + 10)
  101063. };
  101064. frame.key = frame.id;
  101065. if (tagParsers[frame.id]) {
  101066. tagParsers[frame.id](frame);
  101067. if (frame.owner === "com.apple.streaming.transportStreamTimestamp") {
  101068. var d2 = frame.data, size = (d2[3] & 1) << 30 | d2[4] << 22 | d2[5] << 14 | d2[6] << 6 | d2[7] >>> 2;
  101069. size *= 4;
  101070. size += d2[7] & 3;
  101071. frame.timeStamp = size;
  101072. if (tag.pts === void 0 && tag.dts === void 0) {
  101073. tag.pts = frame.timeStamp;
  101074. tag.dts = frame.timeStamp;
  101075. }
  101076. this.trigger("timestamp", frame);
  101077. }
  101078. }
  101079. tag.frames.push(frame);
  101080. frameStart += 10;
  101081. frameStart += frameSize;
  101082. } while (frameStart < tagSize);
  101083. this.trigger("data", tag);
  101084. };
  101085. };
  101086. _MetadataStream.prototype = new stream();
  101087. var metadataStream = _MetadataStream;
  101088. var TimestampRolloverStream = timestampRolloverStream.TimestampRolloverStream;
  101089. var _TransportPacketStream, _TransportParseStream, _ElementaryStream;
  101090. var MP2T_PACKET_LENGTH$1 = 188, SYNC_BYTE$1 = 71;
  101091. _TransportPacketStream = function TransportPacketStream() {
  101092. var buffer = new Uint8Array(MP2T_PACKET_LENGTH$1), bytesInBuffer = 0;
  101093. _TransportPacketStream.prototype.init.call(this);
  101094. this.push = function(bytes) {
  101095. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH$1, everything;
  101096. if (bytesInBuffer) {
  101097. everything = new Uint8Array(bytes.byteLength + bytesInBuffer);
  101098. everything.set(buffer.subarray(0, bytesInBuffer));
  101099. everything.set(bytes, bytesInBuffer);
  101100. bytesInBuffer = 0;
  101101. } else {
  101102. everything = bytes;
  101103. }
  101104. while (endIndex < everything.byteLength) {
  101105. if (everything[startIndex] === SYNC_BYTE$1 && everything[endIndex] === SYNC_BYTE$1) {
  101106. this.trigger("data", everything.subarray(startIndex, endIndex));
  101107. startIndex += MP2T_PACKET_LENGTH$1;
  101108. endIndex += MP2T_PACKET_LENGTH$1;
  101109. continue;
  101110. }
  101111. startIndex++;
  101112. endIndex++;
  101113. }
  101114. if (startIndex < everything.byteLength) {
  101115. buffer.set(everything.subarray(startIndex), 0);
  101116. bytesInBuffer = everything.byteLength - startIndex;
  101117. }
  101118. };
  101119. this.flush = function() {
  101120. if (bytesInBuffer === MP2T_PACKET_LENGTH$1 && buffer[0] === SYNC_BYTE$1) {
  101121. this.trigger("data", buffer);
  101122. bytesInBuffer = 0;
  101123. }
  101124. this.trigger("done");
  101125. };
  101126. this.endTimeline = function() {
  101127. this.flush();
  101128. this.trigger("endedtimeline");
  101129. };
  101130. this.reset = function() {
  101131. bytesInBuffer = 0;
  101132. this.trigger("reset");
  101133. };
  101134. };
  101135. _TransportPacketStream.prototype = new stream();
  101136. _TransportParseStream = function TransportParseStream() {
  101137. var parsePsi, parsePat2, parsePmt2, self2;
  101138. _TransportParseStream.prototype.init.call(this);
  101139. self2 = this;
  101140. this.packetsWaitingForPmt = [];
  101141. this.programMapTable = void 0;
  101142. parsePsi = function parsePsi2(payload, psi) {
  101143. var offset = 0;
  101144. if (psi.payloadUnitStartIndicator) {
  101145. offset += payload[offset] + 1;
  101146. }
  101147. if (psi.type === "pat") {
  101148. parsePat2(payload.subarray(offset), psi);
  101149. } else {
  101150. parsePmt2(payload.subarray(offset), psi);
  101151. }
  101152. };
  101153. parsePat2 = function parsePat3(payload, pat) {
  101154. pat.section_number = payload[7];
  101155. pat.last_section_number = payload[8];
  101156. self2.pmtPid = (payload[10] & 31) << 8 | payload[11];
  101157. pat.pmtPid = self2.pmtPid;
  101158. };
  101159. parsePmt2 = function parsePmt3(payload, pmt) {
  101160. var sectionLength, tableEnd, programInfoLength, offset;
  101161. if (!(payload[5] & 1)) {
  101162. return;
  101163. }
  101164. self2.programMapTable = {
  101165. video: null,
  101166. audio: null,
  101167. "timed-metadata": {}
  101168. };
  101169. sectionLength = (payload[1] & 15) << 8 | payload[2];
  101170. tableEnd = 3 + sectionLength - 4;
  101171. programInfoLength = (payload[10] & 15) << 8 | payload[11];
  101172. offset = 12 + programInfoLength;
  101173. while (offset < tableEnd) {
  101174. var streamType = payload[offset];
  101175. var pid = (payload[offset + 1] & 31) << 8 | payload[offset + 2];
  101176. if (streamType === streamTypes.H264_STREAM_TYPE && self2.programMapTable.video === null) {
  101177. self2.programMapTable.video = pid;
  101178. } else if (streamType === streamTypes.ADTS_STREAM_TYPE && self2.programMapTable.audio === null) {
  101179. self2.programMapTable.audio = pid;
  101180. } else if (streamType === streamTypes.METADATA_STREAM_TYPE) {
  101181. self2.programMapTable["timed-metadata"][pid] = streamType;
  101182. }
  101183. offset += ((payload[offset + 3] & 15) << 8 | payload[offset + 4]) + 5;
  101184. }
  101185. pmt.programMapTable = self2.programMapTable;
  101186. };
  101187. this.push = function(packet) {
  101188. var result = {}, offset = 4;
  101189. result.payloadUnitStartIndicator = !!(packet[1] & 64);
  101190. result.pid = packet[1] & 31;
  101191. result.pid <<= 8;
  101192. result.pid |= packet[2];
  101193. if ((packet[3] & 48) >>> 4 > 1) {
  101194. offset += packet[offset] + 1;
  101195. }
  101196. if (result.pid === 0) {
  101197. result.type = "pat";
  101198. parsePsi(packet.subarray(offset), result);
  101199. this.trigger("data", result);
  101200. } else if (result.pid === this.pmtPid) {
  101201. result.type = "pmt";
  101202. parsePsi(packet.subarray(offset), result);
  101203. this.trigger("data", result);
  101204. while (this.packetsWaitingForPmt.length) {
  101205. this.processPes_.apply(this, this.packetsWaitingForPmt.shift());
  101206. }
  101207. } else if (this.programMapTable === void 0) {
  101208. this.packetsWaitingForPmt.push([packet, offset, result]);
  101209. } else {
  101210. this.processPes_(packet, offset, result);
  101211. }
  101212. };
  101213. this.processPes_ = function(packet, offset, result) {
  101214. if (result.pid === this.programMapTable.video) {
  101215. result.streamType = streamTypes.H264_STREAM_TYPE;
  101216. } else if (result.pid === this.programMapTable.audio) {
  101217. result.streamType = streamTypes.ADTS_STREAM_TYPE;
  101218. } else {
  101219. result.streamType = this.programMapTable["timed-metadata"][result.pid];
  101220. }
  101221. result.type = "pes";
  101222. result.data = packet.subarray(offset);
  101223. this.trigger("data", result);
  101224. };
  101225. };
  101226. _TransportParseStream.prototype = new stream();
  101227. _TransportParseStream.STREAM_TYPES = {
  101228. h264: 27,
  101229. adts: 15
  101230. };
  101231. _ElementaryStream = function ElementaryStream() {
  101232. var self2 = this, segmentHadPmt = false, video = {
  101233. data: [],
  101234. size: 0
  101235. }, audio = {
  101236. data: [],
  101237. size: 0
  101238. }, timedMetadata = {
  101239. data: [],
  101240. size: 0
  101241. }, programMapTable, parsePes = function parsePes2(payload, pes) {
  101242. var ptsDtsFlags;
  101243. var startPrefix = payload[0] << 16 | payload[1] << 8 | payload[2];
  101244. pes.data = new Uint8Array();
  101245. if (startPrefix !== 1) {
  101246. return;
  101247. }
  101248. pes.packetLength = 6 + (payload[4] << 8 | payload[5]);
  101249. pes.dataAlignmentIndicator = (payload[6] & 4) !== 0;
  101250. ptsDtsFlags = payload[7];
  101251. if (ptsDtsFlags & 192) {
  101252. pes.pts = (payload[9] & 14) << 27 | (payload[10] & 255) << 20 | (payload[11] & 254) << 12 | (payload[12] & 255) << 5 | (payload[13] & 254) >>> 3;
  101253. pes.pts *= 4;
  101254. pes.pts += (payload[13] & 6) >>> 1;
  101255. pes.dts = pes.pts;
  101256. if (ptsDtsFlags & 64) {
  101257. pes.dts = (payload[14] & 14) << 27 | (payload[15] & 255) << 20 | (payload[16] & 254) << 12 | (payload[17] & 255) << 5 | (payload[18] & 254) >>> 3;
  101258. pes.dts *= 4;
  101259. pes.dts += (payload[18] & 6) >>> 1;
  101260. }
  101261. }
  101262. pes.data = payload.subarray(9 + payload[8]);
  101263. }, flushStream = function flushStream2(stream2, type3, forceFlush) {
  101264. var packetData = new Uint8Array(stream2.size), event2 = {
  101265. type: type3
  101266. }, i2 = 0, offset = 0, packetFlushable = false, fragment;
  101267. if (!stream2.data.length || stream2.size < 9) {
  101268. return;
  101269. }
  101270. event2.trackId = stream2.data[0].pid;
  101271. for (i2 = 0; i2 < stream2.data.length; i2++) {
  101272. fragment = stream2.data[i2];
  101273. packetData.set(fragment.data, offset);
  101274. offset += fragment.data.byteLength;
  101275. }
  101276. parsePes(packetData, event2);
  101277. packetFlushable = type3 === "video" || event2.packetLength <= stream2.size;
  101278. if (forceFlush || packetFlushable) {
  101279. stream2.size = 0;
  101280. stream2.data.length = 0;
  101281. }
  101282. if (packetFlushable) {
  101283. self2.trigger("data", event2);
  101284. }
  101285. };
  101286. _ElementaryStream.prototype.init.call(this);
  101287. this.push = function(data) {
  101288. ({
  101289. pat: function pat() {
  101290. },
  101291. pes: function pes() {
  101292. var stream2, streamType;
  101293. switch (data.streamType) {
  101294. case streamTypes.H264_STREAM_TYPE:
  101295. stream2 = video;
  101296. streamType = "video";
  101297. break;
  101298. case streamTypes.ADTS_STREAM_TYPE:
  101299. stream2 = audio;
  101300. streamType = "audio";
  101301. break;
  101302. case streamTypes.METADATA_STREAM_TYPE:
  101303. stream2 = timedMetadata;
  101304. streamType = "timed-metadata";
  101305. break;
  101306. default:
  101307. return;
  101308. }
  101309. if (data.payloadUnitStartIndicator) {
  101310. flushStream(stream2, streamType, true);
  101311. }
  101312. stream2.data.push(data);
  101313. stream2.size += data.data.byteLength;
  101314. },
  101315. pmt: function pmt() {
  101316. var event2 = {
  101317. type: "metadata",
  101318. tracks: []
  101319. };
  101320. programMapTable = data.programMapTable;
  101321. if (programMapTable.video !== null) {
  101322. event2.tracks.push({
  101323. timelineStartInfo: {
  101324. baseMediaDecodeTime: 0
  101325. },
  101326. id: +programMapTable.video,
  101327. codec: "avc",
  101328. type: "video"
  101329. });
  101330. }
  101331. if (programMapTable.audio !== null) {
  101332. event2.tracks.push({
  101333. timelineStartInfo: {
  101334. baseMediaDecodeTime: 0
  101335. },
  101336. id: +programMapTable.audio,
  101337. codec: "adts",
  101338. type: "audio"
  101339. });
  101340. }
  101341. segmentHadPmt = true;
  101342. self2.trigger("data", event2);
  101343. }
  101344. })[data.type]();
  101345. };
  101346. this.reset = function() {
  101347. video.size = 0;
  101348. video.data.length = 0;
  101349. audio.size = 0;
  101350. audio.data.length = 0;
  101351. this.trigger("reset");
  101352. };
  101353. this.flushStreams_ = function() {
  101354. flushStream(video, "video");
  101355. flushStream(audio, "audio");
  101356. flushStream(timedMetadata, "timed-metadata");
  101357. };
  101358. this.flush = function() {
  101359. if (!segmentHadPmt && programMapTable) {
  101360. var pmt = {
  101361. type: "metadata",
  101362. tracks: []
  101363. };
  101364. if (programMapTable.video !== null) {
  101365. pmt.tracks.push({
  101366. timelineStartInfo: {
  101367. baseMediaDecodeTime: 0
  101368. },
  101369. id: +programMapTable.video,
  101370. codec: "avc",
  101371. type: "video"
  101372. });
  101373. }
  101374. if (programMapTable.audio !== null) {
  101375. pmt.tracks.push({
  101376. timelineStartInfo: {
  101377. baseMediaDecodeTime: 0
  101378. },
  101379. id: +programMapTable.audio,
  101380. codec: "adts",
  101381. type: "audio"
  101382. });
  101383. }
  101384. self2.trigger("data", pmt);
  101385. }
  101386. segmentHadPmt = false;
  101387. this.flushStreams_();
  101388. this.trigger("done");
  101389. };
  101390. };
  101391. _ElementaryStream.prototype = new stream();
  101392. var m2ts = {
  101393. PAT_PID: 0,
  101394. MP2T_PACKET_LENGTH: MP2T_PACKET_LENGTH$1,
  101395. TransportPacketStream: _TransportPacketStream,
  101396. TransportParseStream: _TransportParseStream,
  101397. ElementaryStream: _ElementaryStream,
  101398. TimestampRolloverStream,
  101399. CaptionStream: captionStream.CaptionStream,
  101400. Cea608Stream: captionStream.Cea608Stream,
  101401. Cea708Stream: captionStream.Cea708Stream,
  101402. MetadataStream: metadataStream
  101403. };
  101404. for (var type2 in streamTypes) {
  101405. if (streamTypes.hasOwnProperty(type2)) {
  101406. m2ts[type2] = streamTypes[type2];
  101407. }
  101408. }
  101409. var m2ts_1 = m2ts;
  101410. var ONE_SECOND_IN_TS$2 = clock2.ONE_SECOND_IN_TS;
  101411. var _AdtsStream;
  101412. var ADTS_SAMPLING_FREQUENCIES$1 = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  101413. _AdtsStream = function AdtsStream(handlePartialSegments) {
  101414. var buffer, frameNum = 0;
  101415. _AdtsStream.prototype.init.call(this);
  101416. this.skipWarn_ = function(start2, end) {
  101417. this.trigger("log", {
  101418. level: "warn",
  101419. message: "adts skiping bytes " + start2 + " to " + end + " in frame " + frameNum + " outside syncword"
  101420. });
  101421. };
  101422. this.push = function(packet) {
  101423. var i2 = 0, frameLength, protectionSkipBytes, oldBuffer, sampleCount, adtsFrameDuration;
  101424. if (!handlePartialSegments) {
  101425. frameNum = 0;
  101426. }
  101427. if (packet.type !== "audio") {
  101428. return;
  101429. }
  101430. if (buffer && buffer.length) {
  101431. oldBuffer = buffer;
  101432. buffer = new Uint8Array(oldBuffer.byteLength + packet.data.byteLength);
  101433. buffer.set(oldBuffer);
  101434. buffer.set(packet.data, oldBuffer.byteLength);
  101435. } else {
  101436. buffer = packet.data;
  101437. }
  101438. var skip;
  101439. while (i2 + 7 < buffer.length) {
  101440. if (buffer[i2] !== 255 || (buffer[i2 + 1] & 246) !== 240) {
  101441. if (typeof skip !== "number") {
  101442. skip = i2;
  101443. }
  101444. i2++;
  101445. continue;
  101446. }
  101447. if (typeof skip === "number") {
  101448. this.skipWarn_(skip, i2);
  101449. skip = null;
  101450. }
  101451. protectionSkipBytes = (~buffer[i2 + 1] & 1) * 2;
  101452. frameLength = (buffer[i2 + 3] & 3) << 11 | buffer[i2 + 4] << 3 | (buffer[i2 + 5] & 224) >> 5;
  101453. sampleCount = ((buffer[i2 + 6] & 3) + 1) * 1024;
  101454. adtsFrameDuration = sampleCount * ONE_SECOND_IN_TS$2 / ADTS_SAMPLING_FREQUENCIES$1[(buffer[i2 + 2] & 60) >>> 2];
  101455. if (buffer.byteLength - i2 < frameLength) {
  101456. break;
  101457. }
  101458. this.trigger("data", {
  101459. pts: packet.pts + frameNum * adtsFrameDuration,
  101460. dts: packet.dts + frameNum * adtsFrameDuration,
  101461. sampleCount,
  101462. audioobjecttype: (buffer[i2 + 2] >>> 6 & 3) + 1,
  101463. channelcount: (buffer[i2 + 2] & 1) << 2 | (buffer[i2 + 3] & 192) >>> 6,
  101464. samplerate: ADTS_SAMPLING_FREQUENCIES$1[(buffer[i2 + 2] & 60) >>> 2],
  101465. samplingfrequencyindex: (buffer[i2 + 2] & 60) >>> 2,
  101466. samplesize: 16,
  101467. data: buffer.subarray(i2 + 7 + protectionSkipBytes, i2 + frameLength)
  101468. });
  101469. frameNum++;
  101470. i2 += frameLength;
  101471. }
  101472. if (typeof skip === "number") {
  101473. this.skipWarn_(skip, i2);
  101474. skip = null;
  101475. }
  101476. buffer = buffer.subarray(i2);
  101477. };
  101478. this.flush = function() {
  101479. frameNum = 0;
  101480. this.trigger("done");
  101481. };
  101482. this.reset = function() {
  101483. buffer = void 0;
  101484. this.trigger("reset");
  101485. };
  101486. this.endTimeline = function() {
  101487. buffer = void 0;
  101488. this.trigger("endedtimeline");
  101489. };
  101490. };
  101491. _AdtsStream.prototype = new stream();
  101492. var adts = _AdtsStream;
  101493. var ExpGolomb;
  101494. ExpGolomb = function ExpGolomb2(workingData) {
  101495. var workingBytesAvailable = workingData.byteLength, workingWord = 0, workingBitsAvailable = 0;
  101496. this.length = function() {
  101497. return 8 * workingBytesAvailable;
  101498. };
  101499. this.bitsAvailable = function() {
  101500. return 8 * workingBytesAvailable + workingBitsAvailable;
  101501. };
  101502. this.loadWord = function() {
  101503. var position2 = workingData.byteLength - workingBytesAvailable, workingBytes = new Uint8Array(4), availableBytes = Math.min(4, workingBytesAvailable);
  101504. if (availableBytes === 0) {
  101505. throw new Error("no bytes available");
  101506. }
  101507. workingBytes.set(workingData.subarray(position2, position2 + availableBytes));
  101508. workingWord = new DataView(workingBytes.buffer).getUint32(0);
  101509. workingBitsAvailable = availableBytes * 8;
  101510. workingBytesAvailable -= availableBytes;
  101511. };
  101512. this.skipBits = function(count) {
  101513. var skipBytes;
  101514. if (workingBitsAvailable > count) {
  101515. workingWord <<= count;
  101516. workingBitsAvailable -= count;
  101517. } else {
  101518. count -= workingBitsAvailable;
  101519. skipBytes = Math.floor(count / 8);
  101520. count -= skipBytes * 8;
  101521. workingBytesAvailable -= skipBytes;
  101522. this.loadWord();
  101523. workingWord <<= count;
  101524. workingBitsAvailable -= count;
  101525. }
  101526. };
  101527. this.readBits = function(size) {
  101528. var bits = Math.min(workingBitsAvailable, size), valu = workingWord >>> 32 - bits;
  101529. workingBitsAvailable -= bits;
  101530. if (workingBitsAvailable > 0) {
  101531. workingWord <<= bits;
  101532. } else if (workingBytesAvailable > 0) {
  101533. this.loadWord();
  101534. }
  101535. bits = size - bits;
  101536. if (bits > 0) {
  101537. return valu << bits | this.readBits(bits);
  101538. }
  101539. return valu;
  101540. };
  101541. this.skipLeadingZeros = function() {
  101542. var leadingZeroCount;
  101543. for (leadingZeroCount = 0; leadingZeroCount < workingBitsAvailable; ++leadingZeroCount) {
  101544. if ((workingWord & 2147483648 >>> leadingZeroCount) !== 0) {
  101545. workingWord <<= leadingZeroCount;
  101546. workingBitsAvailable -= leadingZeroCount;
  101547. return leadingZeroCount;
  101548. }
  101549. }
  101550. this.loadWord();
  101551. return leadingZeroCount + this.skipLeadingZeros();
  101552. };
  101553. this.skipUnsignedExpGolomb = function() {
  101554. this.skipBits(1 + this.skipLeadingZeros());
  101555. };
  101556. this.skipExpGolomb = function() {
  101557. this.skipBits(1 + this.skipLeadingZeros());
  101558. };
  101559. this.readUnsignedExpGolomb = function() {
  101560. var clz = this.skipLeadingZeros();
  101561. return this.readBits(clz + 1) - 1;
  101562. };
  101563. this.readExpGolomb = function() {
  101564. var valu = this.readUnsignedExpGolomb();
  101565. if (1 & valu) {
  101566. return 1 + valu >>> 1;
  101567. }
  101568. return -1 * (valu >>> 1);
  101569. };
  101570. this.readBoolean = function() {
  101571. return this.readBits(1) === 1;
  101572. };
  101573. this.readUnsignedByte = function() {
  101574. return this.readBits(8);
  101575. };
  101576. this.loadWord();
  101577. };
  101578. var expGolomb = ExpGolomb;
  101579. var _H264Stream, _NalByteStream;
  101580. var PROFILES_WITH_OPTIONAL_SPS_DATA;
  101581. _NalByteStream = function NalByteStream() {
  101582. var syncPoint = 0, i2, buffer;
  101583. _NalByteStream.prototype.init.call(this);
  101584. this.push = function(data) {
  101585. var swapBuffer;
  101586. if (!buffer) {
  101587. buffer = data.data;
  101588. } else {
  101589. swapBuffer = new Uint8Array(buffer.byteLength + data.data.byteLength);
  101590. swapBuffer.set(buffer);
  101591. swapBuffer.set(data.data, buffer.byteLength);
  101592. buffer = swapBuffer;
  101593. }
  101594. var len = buffer.byteLength;
  101595. for (; syncPoint < len - 3; syncPoint++) {
  101596. if (buffer[syncPoint + 2] === 1) {
  101597. i2 = syncPoint + 5;
  101598. break;
  101599. }
  101600. }
  101601. while (i2 < len) {
  101602. switch (buffer[i2]) {
  101603. case 0:
  101604. if (buffer[i2 - 1] !== 0) {
  101605. i2 += 2;
  101606. break;
  101607. } else if (buffer[i2 - 2] !== 0) {
  101608. i2++;
  101609. break;
  101610. }
  101611. if (syncPoint + 3 !== i2 - 2) {
  101612. this.trigger("data", buffer.subarray(syncPoint + 3, i2 - 2));
  101613. }
  101614. do {
  101615. i2++;
  101616. } while (buffer[i2] !== 1 && i2 < len);
  101617. syncPoint = i2 - 2;
  101618. i2 += 3;
  101619. break;
  101620. case 1:
  101621. if (buffer[i2 - 1] !== 0 || buffer[i2 - 2] !== 0) {
  101622. i2 += 3;
  101623. break;
  101624. }
  101625. this.trigger("data", buffer.subarray(syncPoint + 3, i2 - 2));
  101626. syncPoint = i2 - 2;
  101627. i2 += 3;
  101628. break;
  101629. default:
  101630. i2 += 3;
  101631. break;
  101632. }
  101633. }
  101634. buffer = buffer.subarray(syncPoint);
  101635. i2 -= syncPoint;
  101636. syncPoint = 0;
  101637. };
  101638. this.reset = function() {
  101639. buffer = null;
  101640. syncPoint = 0;
  101641. this.trigger("reset");
  101642. };
  101643. this.flush = function() {
  101644. if (buffer && buffer.byteLength > 3) {
  101645. this.trigger("data", buffer.subarray(syncPoint + 3));
  101646. }
  101647. buffer = null;
  101648. syncPoint = 0;
  101649. this.trigger("done");
  101650. };
  101651. this.endTimeline = function() {
  101652. this.flush();
  101653. this.trigger("endedtimeline");
  101654. };
  101655. };
  101656. _NalByteStream.prototype = new stream();
  101657. PROFILES_WITH_OPTIONAL_SPS_DATA = {
  101658. 100: true,
  101659. 110: true,
  101660. 122: true,
  101661. 244: true,
  101662. 44: true,
  101663. 83: true,
  101664. 86: true,
  101665. 118: true,
  101666. 128: true,
  101667. 138: true,
  101668. 139: true,
  101669. 134: true
  101670. };
  101671. _H264Stream = function H264Stream2() {
  101672. var nalByteStream = new _NalByteStream(), self2, trackId, currentPts, currentDts, discardEmulationPreventionBytes5, readSequenceParameterSet, skipScalingList;
  101673. _H264Stream.prototype.init.call(this);
  101674. self2 = this;
  101675. this.push = function(packet) {
  101676. if (packet.type !== "video") {
  101677. return;
  101678. }
  101679. trackId = packet.trackId;
  101680. currentPts = packet.pts;
  101681. currentDts = packet.dts;
  101682. nalByteStream.push(packet);
  101683. };
  101684. nalByteStream.on("data", function(data) {
  101685. var event2 = {
  101686. trackId,
  101687. pts: currentPts,
  101688. dts: currentDts,
  101689. data,
  101690. nalUnitTypeCode: data[0] & 31
  101691. };
  101692. switch (event2.nalUnitTypeCode) {
  101693. case 5:
  101694. event2.nalUnitType = "slice_layer_without_partitioning_rbsp_idr";
  101695. break;
  101696. case 6:
  101697. event2.nalUnitType = "sei_rbsp";
  101698. event2.escapedRBSP = discardEmulationPreventionBytes5(data.subarray(1));
  101699. break;
  101700. case 7:
  101701. event2.nalUnitType = "seq_parameter_set_rbsp";
  101702. event2.escapedRBSP = discardEmulationPreventionBytes5(data.subarray(1));
  101703. event2.config = readSequenceParameterSet(event2.escapedRBSP);
  101704. break;
  101705. case 8:
  101706. event2.nalUnitType = "pic_parameter_set_rbsp";
  101707. break;
  101708. case 9:
  101709. event2.nalUnitType = "access_unit_delimiter_rbsp";
  101710. break;
  101711. }
  101712. self2.trigger("data", event2);
  101713. });
  101714. nalByteStream.on("done", function() {
  101715. self2.trigger("done");
  101716. });
  101717. nalByteStream.on("partialdone", function() {
  101718. self2.trigger("partialdone");
  101719. });
  101720. nalByteStream.on("reset", function() {
  101721. self2.trigger("reset");
  101722. });
  101723. nalByteStream.on("endedtimeline", function() {
  101724. self2.trigger("endedtimeline");
  101725. });
  101726. this.flush = function() {
  101727. nalByteStream.flush();
  101728. };
  101729. this.partialFlush = function() {
  101730. nalByteStream.partialFlush();
  101731. };
  101732. this.reset = function() {
  101733. nalByteStream.reset();
  101734. };
  101735. this.endTimeline = function() {
  101736. nalByteStream.endTimeline();
  101737. };
  101738. skipScalingList = function skipScalingList2(count, expGolombDecoder) {
  101739. var lastScale = 8, nextScale = 8, j, deltaScale;
  101740. for (j = 0; j < count; j++) {
  101741. if (nextScale !== 0) {
  101742. deltaScale = expGolombDecoder.readExpGolomb();
  101743. nextScale = (lastScale + deltaScale + 256) % 256;
  101744. }
  101745. lastScale = nextScale === 0 ? lastScale : nextScale;
  101746. }
  101747. };
  101748. discardEmulationPreventionBytes5 = function discardEmulationPreventionBytes6(data) {
  101749. var length = data.byteLength, emulationPreventionBytesPositions = [], i2 = 1, newLength, newData;
  101750. while (i2 < length - 2) {
  101751. if (data[i2] === 0 && data[i2 + 1] === 0 && data[i2 + 2] === 3) {
  101752. emulationPreventionBytesPositions.push(i2 + 2);
  101753. i2 += 2;
  101754. } else {
  101755. i2++;
  101756. }
  101757. }
  101758. if (emulationPreventionBytesPositions.length === 0) {
  101759. return data;
  101760. }
  101761. newLength = length - emulationPreventionBytesPositions.length;
  101762. newData = new Uint8Array(newLength);
  101763. var sourceIndex = 0;
  101764. for (i2 = 0; i2 < newLength; sourceIndex++, i2++) {
  101765. if (sourceIndex === emulationPreventionBytesPositions[0]) {
  101766. sourceIndex++;
  101767. emulationPreventionBytesPositions.shift();
  101768. }
  101769. newData[i2] = data[sourceIndex];
  101770. }
  101771. return newData;
  101772. };
  101773. readSequenceParameterSet = function readSequenceParameterSet2(data) {
  101774. var frameCropLeftOffset = 0, frameCropRightOffset = 0, frameCropTopOffset = 0, frameCropBottomOffset = 0, expGolombDecoder, profileIdc, levelIdc, profileCompatibility, chromaFormatIdc, picOrderCntType, numRefFramesInPicOrderCntCycle, picWidthInMbsMinus1, picHeightInMapUnitsMinus1, frameMbsOnlyFlag, scalingListCount, sarRatio = [1, 1], aspectRatioIdc, i2;
  101775. expGolombDecoder = new expGolomb(data);
  101776. profileIdc = expGolombDecoder.readUnsignedByte();
  101777. profileCompatibility = expGolombDecoder.readUnsignedByte();
  101778. levelIdc = expGolombDecoder.readUnsignedByte();
  101779. expGolombDecoder.skipUnsignedExpGolomb();
  101780. if (PROFILES_WITH_OPTIONAL_SPS_DATA[profileIdc]) {
  101781. chromaFormatIdc = expGolombDecoder.readUnsignedExpGolomb();
  101782. if (chromaFormatIdc === 3) {
  101783. expGolombDecoder.skipBits(1);
  101784. }
  101785. expGolombDecoder.skipUnsignedExpGolomb();
  101786. expGolombDecoder.skipUnsignedExpGolomb();
  101787. expGolombDecoder.skipBits(1);
  101788. if (expGolombDecoder.readBoolean()) {
  101789. scalingListCount = chromaFormatIdc !== 3 ? 8 : 12;
  101790. for (i2 = 0; i2 < scalingListCount; i2++) {
  101791. if (expGolombDecoder.readBoolean()) {
  101792. if (i2 < 6) {
  101793. skipScalingList(16, expGolombDecoder);
  101794. } else {
  101795. skipScalingList(64, expGolombDecoder);
  101796. }
  101797. }
  101798. }
  101799. }
  101800. }
  101801. expGolombDecoder.skipUnsignedExpGolomb();
  101802. picOrderCntType = expGolombDecoder.readUnsignedExpGolomb();
  101803. if (picOrderCntType === 0) {
  101804. expGolombDecoder.readUnsignedExpGolomb();
  101805. } else if (picOrderCntType === 1) {
  101806. expGolombDecoder.skipBits(1);
  101807. expGolombDecoder.skipExpGolomb();
  101808. expGolombDecoder.skipExpGolomb();
  101809. numRefFramesInPicOrderCntCycle = expGolombDecoder.readUnsignedExpGolomb();
  101810. for (i2 = 0; i2 < numRefFramesInPicOrderCntCycle; i2++) {
  101811. expGolombDecoder.skipExpGolomb();
  101812. }
  101813. }
  101814. expGolombDecoder.skipUnsignedExpGolomb();
  101815. expGolombDecoder.skipBits(1);
  101816. picWidthInMbsMinus1 = expGolombDecoder.readUnsignedExpGolomb();
  101817. picHeightInMapUnitsMinus1 = expGolombDecoder.readUnsignedExpGolomb();
  101818. frameMbsOnlyFlag = expGolombDecoder.readBits(1);
  101819. if (frameMbsOnlyFlag === 0) {
  101820. expGolombDecoder.skipBits(1);
  101821. }
  101822. expGolombDecoder.skipBits(1);
  101823. if (expGolombDecoder.readBoolean()) {
  101824. frameCropLeftOffset = expGolombDecoder.readUnsignedExpGolomb();
  101825. frameCropRightOffset = expGolombDecoder.readUnsignedExpGolomb();
  101826. frameCropTopOffset = expGolombDecoder.readUnsignedExpGolomb();
  101827. frameCropBottomOffset = expGolombDecoder.readUnsignedExpGolomb();
  101828. }
  101829. if (expGolombDecoder.readBoolean()) {
  101830. if (expGolombDecoder.readBoolean()) {
  101831. aspectRatioIdc = expGolombDecoder.readUnsignedByte();
  101832. switch (aspectRatioIdc) {
  101833. case 1:
  101834. sarRatio = [1, 1];
  101835. break;
  101836. case 2:
  101837. sarRatio = [12, 11];
  101838. break;
  101839. case 3:
  101840. sarRatio = [10, 11];
  101841. break;
  101842. case 4:
  101843. sarRatio = [16, 11];
  101844. break;
  101845. case 5:
  101846. sarRatio = [40, 33];
  101847. break;
  101848. case 6:
  101849. sarRatio = [24, 11];
  101850. break;
  101851. case 7:
  101852. sarRatio = [20, 11];
  101853. break;
  101854. case 8:
  101855. sarRatio = [32, 11];
  101856. break;
  101857. case 9:
  101858. sarRatio = [80, 33];
  101859. break;
  101860. case 10:
  101861. sarRatio = [18, 11];
  101862. break;
  101863. case 11:
  101864. sarRatio = [15, 11];
  101865. break;
  101866. case 12:
  101867. sarRatio = [64, 33];
  101868. break;
  101869. case 13:
  101870. sarRatio = [160, 99];
  101871. break;
  101872. case 14:
  101873. sarRatio = [4, 3];
  101874. break;
  101875. case 15:
  101876. sarRatio = [3, 2];
  101877. break;
  101878. case 16:
  101879. sarRatio = [2, 1];
  101880. break;
  101881. case 255: {
  101882. sarRatio = [expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte(), expGolombDecoder.readUnsignedByte() << 8 | expGolombDecoder.readUnsignedByte()];
  101883. break;
  101884. }
  101885. }
  101886. if (sarRatio) {
  101887. sarRatio[0] / sarRatio[1];
  101888. }
  101889. }
  101890. }
  101891. return {
  101892. profileIdc,
  101893. levelIdc,
  101894. profileCompatibility,
  101895. width: (picWidthInMbsMinus1 + 1) * 16 - frameCropLeftOffset * 2 - frameCropRightOffset * 2,
  101896. height: (2 - frameMbsOnlyFlag) * (picHeightInMapUnitsMinus1 + 1) * 16 - frameCropTopOffset * 2 - frameCropBottomOffset * 2,
  101897. sarRatio
  101898. };
  101899. };
  101900. };
  101901. _H264Stream.prototype = new stream();
  101902. var h2643 = {
  101903. H264Stream: _H264Stream,
  101904. NalByteStream: _NalByteStream
  101905. };
  101906. var ADTS_SAMPLING_FREQUENCIES = [96e3, 88200, 64e3, 48e3, 44100, 32e3, 24e3, 22050, 16e3, 12e3, 11025, 8e3, 7350];
  101907. var parseId3TagSize = function parseId3TagSize2(header, byteIndex) {
  101908. var returnSize = header[byteIndex + 6] << 21 | header[byteIndex + 7] << 14 | header[byteIndex + 8] << 7 | header[byteIndex + 9], flags = header[byteIndex + 5], footerPresent = (flags & 16) >> 4;
  101909. returnSize = returnSize >= 0 ? returnSize : 0;
  101910. if (footerPresent) {
  101911. return returnSize + 20;
  101912. }
  101913. return returnSize + 10;
  101914. };
  101915. var getId3Offset4 = function getId3Offset5(data, offset) {
  101916. if (data.length - offset < 10 || data[offset] !== "I".charCodeAt(0) || data[offset + 1] !== "D".charCodeAt(0) || data[offset + 2] !== "3".charCodeAt(0)) {
  101917. return offset;
  101918. }
  101919. offset += parseId3TagSize(data, offset);
  101920. return getId3Offset5(data, offset);
  101921. };
  101922. var isLikelyAacData$1 = function isLikelyAacData2(data) {
  101923. var offset = getId3Offset4(data, 0);
  101924. return data.length >= offset + 2 && (data[offset] & 255) === 255 && (data[offset + 1] & 240) === 240 && (data[offset + 1] & 22) === 16;
  101925. };
  101926. var parseSyncSafeInteger = function parseSyncSafeInteger2(data) {
  101927. return data[0] << 21 | data[1] << 14 | data[2] << 7 | data[3];
  101928. };
  101929. var percentEncode = function percentEncode2(bytes, start2, end) {
  101930. var i2, result = "";
  101931. for (i2 = start2; i2 < end; i2++) {
  101932. result += "%" + ("00" + bytes[i2].toString(16)).slice(-2);
  101933. }
  101934. return result;
  101935. };
  101936. var parseIso88591 = function parseIso885912(bytes, start2, end) {
  101937. return unescape(percentEncode(bytes, start2, end));
  101938. };
  101939. var parseAdtsSize = function parseAdtsSize2(header, byteIndex) {
  101940. var lowThree = (header[byteIndex + 5] & 224) >> 5, middle = header[byteIndex + 4] << 3, highTwo = header[byteIndex + 3] & 3 << 11;
  101941. return highTwo | middle | lowThree;
  101942. };
  101943. var parseType$2 = function parseType2(header, byteIndex) {
  101944. if (header[byteIndex] === "I".charCodeAt(0) && header[byteIndex + 1] === "D".charCodeAt(0) && header[byteIndex + 2] === "3".charCodeAt(0)) {
  101945. return "timed-metadata";
  101946. } else if (header[byteIndex] & true && (header[byteIndex + 1] & 240) === 240) {
  101947. return "audio";
  101948. }
  101949. return null;
  101950. };
  101951. var parseSampleRate = function parseSampleRate2(packet) {
  101952. var i2 = 0;
  101953. while (i2 + 5 < packet.length) {
  101954. if (packet[i2] !== 255 || (packet[i2 + 1] & 246) !== 240) {
  101955. i2++;
  101956. continue;
  101957. }
  101958. return ADTS_SAMPLING_FREQUENCIES[(packet[i2 + 2] & 60) >>> 2];
  101959. }
  101960. return null;
  101961. };
  101962. var parseAacTimestamp = function parseAacTimestamp2(packet) {
  101963. var frameStart, frameSize, frame, frameHeader;
  101964. frameStart = 10;
  101965. if (packet[5] & 64) {
  101966. frameStart += 4;
  101967. frameStart += parseSyncSafeInteger(packet.subarray(10, 14));
  101968. }
  101969. do {
  101970. frameSize = parseSyncSafeInteger(packet.subarray(frameStart + 4, frameStart + 8));
  101971. if (frameSize < 1) {
  101972. return null;
  101973. }
  101974. frameHeader = String.fromCharCode(packet[frameStart], packet[frameStart + 1], packet[frameStart + 2], packet[frameStart + 3]);
  101975. if (frameHeader === "PRIV") {
  101976. frame = packet.subarray(frameStart + 10, frameStart + frameSize + 10);
  101977. for (var i2 = 0; i2 < frame.byteLength; i2++) {
  101978. if (frame[i2] === 0) {
  101979. var owner = parseIso88591(frame, 0, i2);
  101980. if (owner === "com.apple.streaming.transportStreamTimestamp") {
  101981. var d2 = frame.subarray(i2 + 1);
  101982. var size = (d2[3] & 1) << 30 | d2[4] << 22 | d2[5] << 14 | d2[6] << 6 | d2[7] >>> 2;
  101983. size *= 4;
  101984. size += d2[7] & 3;
  101985. return size;
  101986. }
  101987. break;
  101988. }
  101989. }
  101990. }
  101991. frameStart += 10;
  101992. frameStart += frameSize;
  101993. } while (frameStart < packet.byteLength);
  101994. return null;
  101995. };
  101996. var utils2 = {
  101997. isLikelyAacData: isLikelyAacData$1,
  101998. parseId3TagSize,
  101999. parseAdtsSize,
  102000. parseType: parseType$2,
  102001. parseSampleRate,
  102002. parseAacTimestamp
  102003. };
  102004. var _AacStream;
  102005. _AacStream = function AacStream() {
  102006. var everything = new Uint8Array(), timeStamp = 0;
  102007. _AacStream.prototype.init.call(this);
  102008. this.setTimestamp = function(timestamp) {
  102009. timeStamp = timestamp;
  102010. };
  102011. this.push = function(bytes) {
  102012. var frameSize = 0, byteIndex = 0, bytesLeft, chunk, packet, tempLength;
  102013. if (everything.length) {
  102014. tempLength = everything.length;
  102015. everything = new Uint8Array(bytes.byteLength + tempLength);
  102016. everything.set(everything.subarray(0, tempLength));
  102017. everything.set(bytes, tempLength);
  102018. } else {
  102019. everything = bytes;
  102020. }
  102021. while (everything.length - byteIndex >= 3) {
  102022. if (everything[byteIndex] === "I".charCodeAt(0) && everything[byteIndex + 1] === "D".charCodeAt(0) && everything[byteIndex + 2] === "3".charCodeAt(0)) {
  102023. if (everything.length - byteIndex < 10) {
  102024. break;
  102025. }
  102026. frameSize = utils2.parseId3TagSize(everything, byteIndex);
  102027. if (byteIndex + frameSize > everything.length) {
  102028. break;
  102029. }
  102030. chunk = {
  102031. type: "timed-metadata",
  102032. data: everything.subarray(byteIndex, byteIndex + frameSize)
  102033. };
  102034. this.trigger("data", chunk);
  102035. byteIndex += frameSize;
  102036. continue;
  102037. } else if ((everything[byteIndex] & 255) === 255 && (everything[byteIndex + 1] & 240) === 240) {
  102038. if (everything.length - byteIndex < 7) {
  102039. break;
  102040. }
  102041. frameSize = utils2.parseAdtsSize(everything, byteIndex);
  102042. if (byteIndex + frameSize > everything.length) {
  102043. break;
  102044. }
  102045. packet = {
  102046. type: "audio",
  102047. data: everything.subarray(byteIndex, byteIndex + frameSize),
  102048. pts: timeStamp,
  102049. dts: timeStamp
  102050. };
  102051. this.trigger("data", packet);
  102052. byteIndex += frameSize;
  102053. continue;
  102054. }
  102055. byteIndex++;
  102056. }
  102057. bytesLeft = everything.length - byteIndex;
  102058. if (bytesLeft > 0) {
  102059. everything = everything.subarray(byteIndex);
  102060. } else {
  102061. everything = new Uint8Array();
  102062. }
  102063. };
  102064. this.reset = function() {
  102065. everything = new Uint8Array();
  102066. this.trigger("reset");
  102067. };
  102068. this.endTimeline = function() {
  102069. everything = new Uint8Array();
  102070. this.trigger("endedtimeline");
  102071. };
  102072. };
  102073. _AacStream.prototype = new stream();
  102074. var aac3 = _AacStream;
  102075. var AUDIO_PROPERTIES = ["audioobjecttype", "channelcount", "samplerate", "samplingfrequencyindex", "samplesize"];
  102076. var audioProperties = AUDIO_PROPERTIES;
  102077. var VIDEO_PROPERTIES = ["width", "height", "profileIdc", "levelIdc", "profileCompatibility", "sarRatio"];
  102078. var videoProperties = VIDEO_PROPERTIES;
  102079. var H264Stream = h2643.H264Stream;
  102080. var isLikelyAacData = utils2.isLikelyAacData;
  102081. var ONE_SECOND_IN_TS$12 = clock2.ONE_SECOND_IN_TS;
  102082. var _VideoSegmentStream, _AudioSegmentStream, _Transmuxer, _CoalesceStream;
  102083. var retriggerForStream = function retriggerForStream2(key, event2) {
  102084. event2.stream = key;
  102085. this.trigger("log", event2);
  102086. };
  102087. var addPipelineLogRetriggers = function addPipelineLogRetriggers2(transmuxer2, pipeline) {
  102088. var keys3 = Object.keys(pipeline);
  102089. for (var i2 = 0; i2 < keys3.length; i2++) {
  102090. var key = keys3[i2];
  102091. if (key === "headOfPipeline" || !pipeline[key].on) {
  102092. continue;
  102093. }
  102094. pipeline[key].on("log", retriggerForStream.bind(transmuxer2, key));
  102095. }
  102096. };
  102097. var arrayEquals = function arrayEquals2(a, b) {
  102098. var i2;
  102099. if (a.length !== b.length) {
  102100. return false;
  102101. }
  102102. for (i2 = 0; i2 < a.length; i2++) {
  102103. if (a[i2] !== b[i2]) {
  102104. return false;
  102105. }
  102106. }
  102107. return true;
  102108. };
  102109. var generateSegmentTimingInfo = function generateSegmentTimingInfo2(baseMediaDecodeTime, startDts, startPts, endDts, endPts, prependedContentDuration) {
  102110. var ptsOffsetFromDts = startPts - startDts, decodeDuration = endDts - startDts, presentationDuration = endPts - startPts;
  102111. return {
  102112. start: {
  102113. dts: baseMediaDecodeTime,
  102114. pts: baseMediaDecodeTime + ptsOffsetFromDts
  102115. },
  102116. end: {
  102117. dts: baseMediaDecodeTime + decodeDuration,
  102118. pts: baseMediaDecodeTime + presentationDuration
  102119. },
  102120. prependedContentDuration,
  102121. baseMediaDecodeTime
  102122. };
  102123. };
  102124. _AudioSegmentStream = function AudioSegmentStream(track, options2) {
  102125. var adtsFrames = [], sequenceNumber, earliestAllowedDts = 0, audioAppendStartTs = 0, videoBaseMediaDecodeTime = Infinity;
  102126. options2 = options2 || {};
  102127. sequenceNumber = options2.firstSequenceNumber || 0;
  102128. _AudioSegmentStream.prototype.init.call(this);
  102129. this.push = function(data) {
  102130. trackDecodeInfo.collectDtsInfo(track, data);
  102131. if (track) {
  102132. audioProperties.forEach(function(prop) {
  102133. track[prop] = data[prop];
  102134. });
  102135. }
  102136. adtsFrames.push(data);
  102137. };
  102138. this.setEarliestDts = function(earliestDts) {
  102139. earliestAllowedDts = earliestDts;
  102140. };
  102141. this.setVideoBaseMediaDecodeTime = function(baseMediaDecodeTime) {
  102142. videoBaseMediaDecodeTime = baseMediaDecodeTime;
  102143. };
  102144. this.setAudioAppendStart = function(timestamp) {
  102145. audioAppendStartTs = timestamp;
  102146. };
  102147. this.flush = function() {
  102148. var frames, moof2, mdat2, boxes, frameDuration, segmentDuration, videoClockCyclesOfSilencePrefixed;
  102149. if (adtsFrames.length === 0) {
  102150. this.trigger("done", "AudioSegmentStream");
  102151. return;
  102152. }
  102153. frames = audioFrameUtils.trimAdtsFramesByEarliestDts(adtsFrames, track, earliestAllowedDts);
  102154. track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options2.keepOriginalTimestamps);
  102155. videoClockCyclesOfSilencePrefixed = audioFrameUtils.prefixWithSilence(track, frames, audioAppendStartTs, videoBaseMediaDecodeTime);
  102156. track.samples = audioFrameUtils.generateSampleTable(frames);
  102157. mdat2 = mp4Generator.mdat(audioFrameUtils.concatenateFrameData(frames));
  102158. adtsFrames = [];
  102159. moof2 = mp4Generator.moof(sequenceNumber, [track]);
  102160. boxes = new Uint8Array(moof2.byteLength + mdat2.byteLength);
  102161. sequenceNumber++;
  102162. boxes.set(moof2);
  102163. boxes.set(mdat2, moof2.byteLength);
  102164. trackDecodeInfo.clearDtsInfo(track);
  102165. frameDuration = Math.ceil(ONE_SECOND_IN_TS$12 * 1024 / track.samplerate);
  102166. if (frames.length) {
  102167. segmentDuration = frames.length * frameDuration;
  102168. this.trigger("segmentTimingInfo", generateSegmentTimingInfo(
  102169. clock2.audioTsToVideoTs(track.baseMediaDecodeTime, track.samplerate),
  102170. frames[0].dts,
  102171. frames[0].pts,
  102172. frames[0].dts + segmentDuration,
  102173. frames[0].pts + segmentDuration,
  102174. videoClockCyclesOfSilencePrefixed || 0
  102175. ));
  102176. this.trigger("timingInfo", {
  102177. start: frames[0].pts,
  102178. end: frames[0].pts + segmentDuration
  102179. });
  102180. }
  102181. this.trigger("data", {
  102182. track,
  102183. boxes
  102184. });
  102185. this.trigger("done", "AudioSegmentStream");
  102186. };
  102187. this.reset = function() {
  102188. trackDecodeInfo.clearDtsInfo(track);
  102189. adtsFrames = [];
  102190. this.trigger("reset");
  102191. };
  102192. };
  102193. _AudioSegmentStream.prototype = new stream();
  102194. _VideoSegmentStream = function VideoSegmentStream(track, options2) {
  102195. var sequenceNumber, nalUnits = [], gopsToAlignWith = [], config, pps;
  102196. options2 = options2 || {};
  102197. sequenceNumber = options2.firstSequenceNumber || 0;
  102198. _VideoSegmentStream.prototype.init.call(this);
  102199. delete track.minPTS;
  102200. this.gopCache_ = [];
  102201. this.push = function(nalUnit) {
  102202. trackDecodeInfo.collectDtsInfo(track, nalUnit);
  102203. if (nalUnit.nalUnitType === "seq_parameter_set_rbsp" && !config) {
  102204. config = nalUnit.config;
  102205. track.sps = [nalUnit.data];
  102206. videoProperties.forEach(function(prop) {
  102207. track[prop] = config[prop];
  102208. }, this);
  102209. }
  102210. if (nalUnit.nalUnitType === "pic_parameter_set_rbsp" && !pps) {
  102211. pps = nalUnit.data;
  102212. track.pps = [nalUnit.data];
  102213. }
  102214. nalUnits.push(nalUnit);
  102215. };
  102216. this.flush = function() {
  102217. var frames, gopForFusion, gops, moof2, mdat2, boxes, prependedContentDuration = 0, firstGop, lastGop;
  102218. while (nalUnits.length) {
  102219. if (nalUnits[0].nalUnitType === "access_unit_delimiter_rbsp") {
  102220. break;
  102221. }
  102222. nalUnits.shift();
  102223. }
  102224. if (nalUnits.length === 0) {
  102225. this.resetStream_();
  102226. this.trigger("done", "VideoSegmentStream");
  102227. return;
  102228. }
  102229. frames = frameUtils.groupNalsIntoFrames(nalUnits);
  102230. gops = frameUtils.groupFramesIntoGops(frames);
  102231. if (!gops[0][0].keyFrame) {
  102232. gopForFusion = this.getGopForFusion_(nalUnits[0], track);
  102233. if (gopForFusion) {
  102234. prependedContentDuration = gopForFusion.duration;
  102235. gops.unshift(gopForFusion);
  102236. gops.byteLength += gopForFusion.byteLength;
  102237. gops.nalCount += gopForFusion.nalCount;
  102238. gops.pts = gopForFusion.pts;
  102239. gops.dts = gopForFusion.dts;
  102240. gops.duration += gopForFusion.duration;
  102241. } else {
  102242. gops = frameUtils.extendFirstKeyFrame(gops);
  102243. }
  102244. }
  102245. if (gopsToAlignWith.length) {
  102246. var alignedGops;
  102247. if (options2.alignGopsAtEnd) {
  102248. alignedGops = this.alignGopsAtEnd_(gops);
  102249. } else {
  102250. alignedGops = this.alignGopsAtStart_(gops);
  102251. }
  102252. if (!alignedGops) {
  102253. this.gopCache_.unshift({
  102254. gop: gops.pop(),
  102255. pps: track.pps,
  102256. sps: track.sps
  102257. });
  102258. this.gopCache_.length = Math.min(6, this.gopCache_.length);
  102259. nalUnits = [];
  102260. this.resetStream_();
  102261. this.trigger("done", "VideoSegmentStream");
  102262. return;
  102263. }
  102264. trackDecodeInfo.clearDtsInfo(track);
  102265. gops = alignedGops;
  102266. }
  102267. trackDecodeInfo.collectDtsInfo(track, gops);
  102268. track.samples = frameUtils.generateSampleTable(gops);
  102269. mdat2 = mp4Generator.mdat(frameUtils.concatenateNalData(gops));
  102270. track.baseMediaDecodeTime = trackDecodeInfo.calculateTrackBaseMediaDecodeTime(track, options2.keepOriginalTimestamps);
  102271. this.trigger("processedGopsInfo", gops.map(function(gop) {
  102272. return {
  102273. pts: gop.pts,
  102274. dts: gop.dts,
  102275. byteLength: gop.byteLength
  102276. };
  102277. }));
  102278. firstGop = gops[0];
  102279. lastGop = gops[gops.length - 1];
  102280. this.trigger("segmentTimingInfo", generateSegmentTimingInfo(track.baseMediaDecodeTime, firstGop.dts, firstGop.pts, lastGop.dts + lastGop.duration, lastGop.pts + lastGop.duration, prependedContentDuration));
  102281. this.trigger("timingInfo", {
  102282. start: gops[0].pts,
  102283. end: gops[gops.length - 1].pts + gops[gops.length - 1].duration
  102284. });
  102285. this.gopCache_.unshift({
  102286. gop: gops.pop(),
  102287. pps: track.pps,
  102288. sps: track.sps
  102289. });
  102290. this.gopCache_.length = Math.min(6, this.gopCache_.length);
  102291. nalUnits = [];
  102292. this.trigger("baseMediaDecodeTime", track.baseMediaDecodeTime);
  102293. this.trigger("timelineStartInfo", track.timelineStartInfo);
  102294. moof2 = mp4Generator.moof(sequenceNumber, [track]);
  102295. boxes = new Uint8Array(moof2.byteLength + mdat2.byteLength);
  102296. sequenceNumber++;
  102297. boxes.set(moof2);
  102298. boxes.set(mdat2, moof2.byteLength);
  102299. this.trigger("data", {
  102300. track,
  102301. boxes
  102302. });
  102303. this.resetStream_();
  102304. this.trigger("done", "VideoSegmentStream");
  102305. };
  102306. this.reset = function() {
  102307. this.resetStream_();
  102308. nalUnits = [];
  102309. this.gopCache_.length = 0;
  102310. gopsToAlignWith.length = 0;
  102311. this.trigger("reset");
  102312. };
  102313. this.resetStream_ = function() {
  102314. trackDecodeInfo.clearDtsInfo(track);
  102315. config = void 0;
  102316. pps = void 0;
  102317. };
  102318. this.getGopForFusion_ = function(nalUnit) {
  102319. var halfSecond = 45e3, allowableOverlap = 1e4, nearestDistance = Infinity, dtsDistance, nearestGopObj, currentGop, currentGopObj, i2;
  102320. for (i2 = 0; i2 < this.gopCache_.length; i2++) {
  102321. currentGopObj = this.gopCache_[i2];
  102322. currentGop = currentGopObj.gop;
  102323. if (!(track.pps && arrayEquals(track.pps[0], currentGopObj.pps[0])) || !(track.sps && arrayEquals(track.sps[0], currentGopObj.sps[0]))) {
  102324. continue;
  102325. }
  102326. if (currentGop.dts < track.timelineStartInfo.dts) {
  102327. continue;
  102328. }
  102329. dtsDistance = nalUnit.dts - currentGop.dts - currentGop.duration;
  102330. if (dtsDistance >= -allowableOverlap && dtsDistance <= halfSecond) {
  102331. if (!nearestGopObj || nearestDistance > dtsDistance) {
  102332. nearestGopObj = currentGopObj;
  102333. nearestDistance = dtsDistance;
  102334. }
  102335. }
  102336. }
  102337. if (nearestGopObj) {
  102338. return nearestGopObj.gop;
  102339. }
  102340. return null;
  102341. };
  102342. this.alignGopsAtStart_ = function(gops) {
  102343. var alignIndex, gopIndex, align, gop, byteLength, nalCount, duration5, alignedGops;
  102344. byteLength = gops.byteLength;
  102345. nalCount = gops.nalCount;
  102346. duration5 = gops.duration;
  102347. alignIndex = gopIndex = 0;
  102348. while (alignIndex < gopsToAlignWith.length && gopIndex < gops.length) {
  102349. align = gopsToAlignWith[alignIndex];
  102350. gop = gops[gopIndex];
  102351. if (align.pts === gop.pts) {
  102352. break;
  102353. }
  102354. if (gop.pts > align.pts) {
  102355. alignIndex++;
  102356. continue;
  102357. }
  102358. gopIndex++;
  102359. byteLength -= gop.byteLength;
  102360. nalCount -= gop.nalCount;
  102361. duration5 -= gop.duration;
  102362. }
  102363. if (gopIndex === 0) {
  102364. return gops;
  102365. }
  102366. if (gopIndex === gops.length) {
  102367. return null;
  102368. }
  102369. alignedGops = gops.slice(gopIndex);
  102370. alignedGops.byteLength = byteLength;
  102371. alignedGops.duration = duration5;
  102372. alignedGops.nalCount = nalCount;
  102373. alignedGops.pts = alignedGops[0].pts;
  102374. alignedGops.dts = alignedGops[0].dts;
  102375. return alignedGops;
  102376. };
  102377. this.alignGopsAtEnd_ = function(gops) {
  102378. var alignIndex, gopIndex, align, gop, alignEndIndex, matchFound;
  102379. alignIndex = gopsToAlignWith.length - 1;
  102380. gopIndex = gops.length - 1;
  102381. alignEndIndex = null;
  102382. matchFound = false;
  102383. while (alignIndex >= 0 && gopIndex >= 0) {
  102384. align = gopsToAlignWith[alignIndex];
  102385. gop = gops[gopIndex];
  102386. if (align.pts === gop.pts) {
  102387. matchFound = true;
  102388. break;
  102389. }
  102390. if (align.pts > gop.pts) {
  102391. alignIndex--;
  102392. continue;
  102393. }
  102394. if (alignIndex === gopsToAlignWith.length - 1) {
  102395. alignEndIndex = gopIndex;
  102396. }
  102397. gopIndex--;
  102398. }
  102399. if (!matchFound && alignEndIndex === null) {
  102400. return null;
  102401. }
  102402. var trimIndex;
  102403. if (matchFound) {
  102404. trimIndex = gopIndex;
  102405. } else {
  102406. trimIndex = alignEndIndex;
  102407. }
  102408. if (trimIndex === 0) {
  102409. return gops;
  102410. }
  102411. var alignedGops = gops.slice(trimIndex);
  102412. var metadata = alignedGops.reduce(function(total, gop2) {
  102413. total.byteLength += gop2.byteLength;
  102414. total.duration += gop2.duration;
  102415. total.nalCount += gop2.nalCount;
  102416. return total;
  102417. }, {
  102418. byteLength: 0,
  102419. duration: 0,
  102420. nalCount: 0
  102421. });
  102422. alignedGops.byteLength = metadata.byteLength;
  102423. alignedGops.duration = metadata.duration;
  102424. alignedGops.nalCount = metadata.nalCount;
  102425. alignedGops.pts = alignedGops[0].pts;
  102426. alignedGops.dts = alignedGops[0].dts;
  102427. return alignedGops;
  102428. };
  102429. this.alignGopsWith = function(newGopsToAlignWith) {
  102430. gopsToAlignWith = newGopsToAlignWith;
  102431. };
  102432. };
  102433. _VideoSegmentStream.prototype = new stream();
  102434. _CoalesceStream = function CoalesceStream(options2, metadataStream2) {
  102435. this.numberOfTracks = 0;
  102436. this.metadataStream = metadataStream2;
  102437. options2 = options2 || {};
  102438. if (typeof options2.remux !== "undefined") {
  102439. this.remuxTracks = !!options2.remux;
  102440. } else {
  102441. this.remuxTracks = true;
  102442. }
  102443. if (typeof options2.keepOriginalTimestamps === "boolean") {
  102444. this.keepOriginalTimestamps = options2.keepOriginalTimestamps;
  102445. } else {
  102446. this.keepOriginalTimestamps = false;
  102447. }
  102448. this.pendingTracks = [];
  102449. this.videoTrack = null;
  102450. this.pendingBoxes = [];
  102451. this.pendingCaptions = [];
  102452. this.pendingMetadata = [];
  102453. this.pendingBytes = 0;
  102454. this.emittedTracks = 0;
  102455. _CoalesceStream.prototype.init.call(this);
  102456. this.push = function(output) {
  102457. if (output.text) {
  102458. return this.pendingCaptions.push(output);
  102459. }
  102460. if (output.frames) {
  102461. return this.pendingMetadata.push(output);
  102462. }
  102463. this.pendingTracks.push(output.track);
  102464. this.pendingBytes += output.boxes.byteLength;
  102465. if (output.track.type === "video") {
  102466. this.videoTrack = output.track;
  102467. this.pendingBoxes.push(output.boxes);
  102468. }
  102469. if (output.track.type === "audio") {
  102470. this.audioTrack = output.track;
  102471. this.pendingBoxes.unshift(output.boxes);
  102472. }
  102473. };
  102474. };
  102475. _CoalesceStream.prototype = new stream();
  102476. _CoalesceStream.prototype.flush = function(flushSource) {
  102477. var offset = 0, event2 = {
  102478. captions: [],
  102479. captionStreams: {},
  102480. metadata: [],
  102481. info: {}
  102482. }, caption, id3, initSegment, timelineStartPts = 0, i2;
  102483. if (this.pendingTracks.length < this.numberOfTracks) {
  102484. if (flushSource !== "VideoSegmentStream" && flushSource !== "AudioSegmentStream") {
  102485. return;
  102486. } else if (this.remuxTracks) {
  102487. return;
  102488. } else if (this.pendingTracks.length === 0) {
  102489. this.emittedTracks++;
  102490. if (this.emittedTracks >= this.numberOfTracks) {
  102491. this.trigger("done");
  102492. this.emittedTracks = 0;
  102493. }
  102494. return;
  102495. }
  102496. }
  102497. if (this.videoTrack) {
  102498. timelineStartPts = this.videoTrack.timelineStartInfo.pts;
  102499. videoProperties.forEach(function(prop) {
  102500. event2.info[prop] = this.videoTrack[prop];
  102501. }, this);
  102502. } else if (this.audioTrack) {
  102503. timelineStartPts = this.audioTrack.timelineStartInfo.pts;
  102504. audioProperties.forEach(function(prop) {
  102505. event2.info[prop] = this.audioTrack[prop];
  102506. }, this);
  102507. }
  102508. if (this.videoTrack || this.audioTrack) {
  102509. if (this.pendingTracks.length === 1) {
  102510. event2.type = this.pendingTracks[0].type;
  102511. } else {
  102512. event2.type = "combined";
  102513. }
  102514. this.emittedTracks += this.pendingTracks.length;
  102515. initSegment = mp4Generator.initSegment(this.pendingTracks);
  102516. event2.initSegment = new Uint8Array(initSegment.byteLength);
  102517. event2.initSegment.set(initSegment);
  102518. event2.data = new Uint8Array(this.pendingBytes);
  102519. for (i2 = 0; i2 < this.pendingBoxes.length; i2++) {
  102520. event2.data.set(this.pendingBoxes[i2], offset);
  102521. offset += this.pendingBoxes[i2].byteLength;
  102522. }
  102523. for (i2 = 0; i2 < this.pendingCaptions.length; i2++) {
  102524. caption = this.pendingCaptions[i2];
  102525. caption.startTime = clock2.metadataTsToSeconds(caption.startPts, timelineStartPts, this.keepOriginalTimestamps);
  102526. caption.endTime = clock2.metadataTsToSeconds(caption.endPts, timelineStartPts, this.keepOriginalTimestamps);
  102527. event2.captionStreams[caption.stream] = true;
  102528. event2.captions.push(caption);
  102529. }
  102530. for (i2 = 0; i2 < this.pendingMetadata.length; i2++) {
  102531. id3 = this.pendingMetadata[i2];
  102532. id3.cueTime = clock2.metadataTsToSeconds(id3.pts, timelineStartPts, this.keepOriginalTimestamps);
  102533. event2.metadata.push(id3);
  102534. }
  102535. event2.metadata.dispatchType = this.metadataStream.dispatchType;
  102536. this.pendingTracks.length = 0;
  102537. this.videoTrack = null;
  102538. this.pendingBoxes.length = 0;
  102539. this.pendingCaptions.length = 0;
  102540. this.pendingBytes = 0;
  102541. this.pendingMetadata.length = 0;
  102542. this.trigger("data", event2);
  102543. for (i2 = 0; i2 < event2.captions.length; i2++) {
  102544. caption = event2.captions[i2];
  102545. this.trigger("caption", caption);
  102546. }
  102547. for (i2 = 0; i2 < event2.metadata.length; i2++) {
  102548. id3 = event2.metadata[i2];
  102549. this.trigger("id3Frame", id3);
  102550. }
  102551. }
  102552. if (this.emittedTracks >= this.numberOfTracks) {
  102553. this.trigger("done");
  102554. this.emittedTracks = 0;
  102555. }
  102556. };
  102557. _CoalesceStream.prototype.setRemux = function(val) {
  102558. this.remuxTracks = val;
  102559. };
  102560. _Transmuxer = function Transmuxer(options2) {
  102561. var self2 = this, hasFlushed = true, videoTrack, audioTrack;
  102562. _Transmuxer.prototype.init.call(this);
  102563. options2 = options2 || {};
  102564. this.baseMediaDecodeTime = options2.baseMediaDecodeTime || 0;
  102565. this.transmuxPipeline_ = {};
  102566. this.setupAacPipeline = function() {
  102567. var pipeline = {};
  102568. this.transmuxPipeline_ = pipeline;
  102569. pipeline.type = "aac";
  102570. pipeline.metadataStream = new m2ts_1.MetadataStream();
  102571. pipeline.aacStream = new aac3();
  102572. pipeline.audioTimestampRolloverStream = new m2ts_1.TimestampRolloverStream("audio");
  102573. pipeline.timedMetadataTimestampRolloverStream = new m2ts_1.TimestampRolloverStream("timed-metadata");
  102574. pipeline.adtsStream = new adts();
  102575. pipeline.coalesceStream = new _CoalesceStream(options2, pipeline.metadataStream);
  102576. pipeline.headOfPipeline = pipeline.aacStream;
  102577. pipeline.aacStream.pipe(pipeline.audioTimestampRolloverStream).pipe(pipeline.adtsStream);
  102578. pipeline.aacStream.pipe(pipeline.timedMetadataTimestampRolloverStream).pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);
  102579. pipeline.metadataStream.on("timestamp", function(frame) {
  102580. pipeline.aacStream.setTimestamp(frame.timeStamp);
  102581. });
  102582. pipeline.aacStream.on("data", function(data) {
  102583. if (data.type !== "timed-metadata" && data.type !== "audio" || pipeline.audioSegmentStream) {
  102584. return;
  102585. }
  102586. audioTrack = audioTrack || {
  102587. timelineStartInfo: {
  102588. baseMediaDecodeTime: self2.baseMediaDecodeTime
  102589. },
  102590. codec: "adts",
  102591. type: "audio"
  102592. };
  102593. pipeline.coalesceStream.numberOfTracks++;
  102594. pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options2);
  102595. pipeline.audioSegmentStream.on("log", self2.getLogTrigger_("audioSegmentStream"));
  102596. pipeline.audioSegmentStream.on("timingInfo", self2.trigger.bind(self2, "audioTimingInfo"));
  102597. pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);
  102598. self2.trigger("trackinfo", {
  102599. hasAudio: !!audioTrack,
  102600. hasVideo: !!videoTrack
  102601. });
  102602. });
  102603. pipeline.coalesceStream.on("data", this.trigger.bind(this, "data"));
  102604. pipeline.coalesceStream.on("done", this.trigger.bind(this, "done"));
  102605. addPipelineLogRetriggers(this, pipeline);
  102606. };
  102607. this.setupTsPipeline = function() {
  102608. var pipeline = {};
  102609. this.transmuxPipeline_ = pipeline;
  102610. pipeline.type = "ts";
  102611. pipeline.metadataStream = new m2ts_1.MetadataStream();
  102612. pipeline.packetStream = new m2ts_1.TransportPacketStream();
  102613. pipeline.parseStream = new m2ts_1.TransportParseStream();
  102614. pipeline.elementaryStream = new m2ts_1.ElementaryStream();
  102615. pipeline.timestampRolloverStream = new m2ts_1.TimestampRolloverStream();
  102616. pipeline.adtsStream = new adts();
  102617. pipeline.h264Stream = new H264Stream();
  102618. pipeline.captionStream = new m2ts_1.CaptionStream(options2);
  102619. pipeline.coalesceStream = new _CoalesceStream(options2, pipeline.metadataStream);
  102620. pipeline.headOfPipeline = pipeline.packetStream;
  102621. pipeline.packetStream.pipe(pipeline.parseStream).pipe(pipeline.elementaryStream).pipe(pipeline.timestampRolloverStream);
  102622. pipeline.timestampRolloverStream.pipe(pipeline.h264Stream);
  102623. pipeline.timestampRolloverStream.pipe(pipeline.adtsStream);
  102624. pipeline.timestampRolloverStream.pipe(pipeline.metadataStream).pipe(pipeline.coalesceStream);
  102625. pipeline.h264Stream.pipe(pipeline.captionStream).pipe(pipeline.coalesceStream);
  102626. pipeline.elementaryStream.on("data", function(data) {
  102627. var i2;
  102628. if (data.type === "metadata") {
  102629. i2 = data.tracks.length;
  102630. while (i2--) {
  102631. if (!videoTrack && data.tracks[i2].type === "video") {
  102632. videoTrack = data.tracks[i2];
  102633. videoTrack.timelineStartInfo.baseMediaDecodeTime = self2.baseMediaDecodeTime;
  102634. } else if (!audioTrack && data.tracks[i2].type === "audio") {
  102635. audioTrack = data.tracks[i2];
  102636. audioTrack.timelineStartInfo.baseMediaDecodeTime = self2.baseMediaDecodeTime;
  102637. }
  102638. }
  102639. if (videoTrack && !pipeline.videoSegmentStream) {
  102640. pipeline.coalesceStream.numberOfTracks++;
  102641. pipeline.videoSegmentStream = new _VideoSegmentStream(videoTrack, options2);
  102642. pipeline.videoSegmentStream.on("log", self2.getLogTrigger_("videoSegmentStream"));
  102643. pipeline.videoSegmentStream.on("timelineStartInfo", function(timelineStartInfo) {
  102644. if (audioTrack && !options2.keepOriginalTimestamps) {
  102645. audioTrack.timelineStartInfo = timelineStartInfo;
  102646. pipeline.audioSegmentStream.setEarliestDts(timelineStartInfo.dts - self2.baseMediaDecodeTime);
  102647. }
  102648. });
  102649. pipeline.videoSegmentStream.on("processedGopsInfo", self2.trigger.bind(self2, "gopInfo"));
  102650. pipeline.videoSegmentStream.on("segmentTimingInfo", self2.trigger.bind(self2, "videoSegmentTimingInfo"));
  102651. pipeline.videoSegmentStream.on("baseMediaDecodeTime", function(baseMediaDecodeTime) {
  102652. if (audioTrack) {
  102653. pipeline.audioSegmentStream.setVideoBaseMediaDecodeTime(baseMediaDecodeTime);
  102654. }
  102655. });
  102656. pipeline.videoSegmentStream.on("timingInfo", self2.trigger.bind(self2, "videoTimingInfo"));
  102657. pipeline.h264Stream.pipe(pipeline.videoSegmentStream).pipe(pipeline.coalesceStream);
  102658. }
  102659. if (audioTrack && !pipeline.audioSegmentStream) {
  102660. pipeline.coalesceStream.numberOfTracks++;
  102661. pipeline.audioSegmentStream = new _AudioSegmentStream(audioTrack, options2);
  102662. pipeline.audioSegmentStream.on("log", self2.getLogTrigger_("audioSegmentStream"));
  102663. pipeline.audioSegmentStream.on("timingInfo", self2.trigger.bind(self2, "audioTimingInfo"));
  102664. pipeline.audioSegmentStream.on("segmentTimingInfo", self2.trigger.bind(self2, "audioSegmentTimingInfo"));
  102665. pipeline.adtsStream.pipe(pipeline.audioSegmentStream).pipe(pipeline.coalesceStream);
  102666. }
  102667. self2.trigger("trackinfo", {
  102668. hasAudio: !!audioTrack,
  102669. hasVideo: !!videoTrack
  102670. });
  102671. }
  102672. });
  102673. pipeline.coalesceStream.on("data", this.trigger.bind(this, "data"));
  102674. pipeline.coalesceStream.on("id3Frame", function(id3Frame) {
  102675. id3Frame.dispatchType = pipeline.metadataStream.dispatchType;
  102676. self2.trigger("id3Frame", id3Frame);
  102677. });
  102678. pipeline.coalesceStream.on("caption", this.trigger.bind(this, "caption"));
  102679. pipeline.coalesceStream.on("done", this.trigger.bind(this, "done"));
  102680. addPipelineLogRetriggers(this, pipeline);
  102681. };
  102682. this.setBaseMediaDecodeTime = function(baseMediaDecodeTime) {
  102683. var pipeline = this.transmuxPipeline_;
  102684. if (!options2.keepOriginalTimestamps) {
  102685. this.baseMediaDecodeTime = baseMediaDecodeTime;
  102686. }
  102687. if (audioTrack) {
  102688. audioTrack.timelineStartInfo.dts = void 0;
  102689. audioTrack.timelineStartInfo.pts = void 0;
  102690. trackDecodeInfo.clearDtsInfo(audioTrack);
  102691. if (pipeline.audioTimestampRolloverStream) {
  102692. pipeline.audioTimestampRolloverStream.discontinuity();
  102693. }
  102694. }
  102695. if (videoTrack) {
  102696. if (pipeline.videoSegmentStream) {
  102697. pipeline.videoSegmentStream.gopCache_ = [];
  102698. }
  102699. videoTrack.timelineStartInfo.dts = void 0;
  102700. videoTrack.timelineStartInfo.pts = void 0;
  102701. trackDecodeInfo.clearDtsInfo(videoTrack);
  102702. pipeline.captionStream.reset();
  102703. }
  102704. if (pipeline.timestampRolloverStream) {
  102705. pipeline.timestampRolloverStream.discontinuity();
  102706. }
  102707. };
  102708. this.setAudioAppendStart = function(timestamp) {
  102709. if (audioTrack) {
  102710. this.transmuxPipeline_.audioSegmentStream.setAudioAppendStart(timestamp);
  102711. }
  102712. };
  102713. this.setRemux = function(val) {
  102714. var pipeline = this.transmuxPipeline_;
  102715. options2.remux = val;
  102716. if (pipeline && pipeline.coalesceStream) {
  102717. pipeline.coalesceStream.setRemux(val);
  102718. }
  102719. };
  102720. this.alignGopsWith = function(gopsToAlignWith) {
  102721. if (videoTrack && this.transmuxPipeline_.videoSegmentStream) {
  102722. this.transmuxPipeline_.videoSegmentStream.alignGopsWith(gopsToAlignWith);
  102723. }
  102724. };
  102725. this.getLogTrigger_ = function(key) {
  102726. var self3 = this;
  102727. return function(event2) {
  102728. event2.stream = key;
  102729. self3.trigger("log", event2);
  102730. };
  102731. };
  102732. this.push = function(data) {
  102733. if (hasFlushed) {
  102734. var isAac = isLikelyAacData(data);
  102735. if (isAac && this.transmuxPipeline_.type !== "aac") {
  102736. this.setupAacPipeline();
  102737. } else if (!isAac && this.transmuxPipeline_.type !== "ts") {
  102738. this.setupTsPipeline();
  102739. }
  102740. hasFlushed = false;
  102741. }
  102742. this.transmuxPipeline_.headOfPipeline.push(data);
  102743. };
  102744. this.flush = function() {
  102745. hasFlushed = true;
  102746. this.transmuxPipeline_.headOfPipeline.flush();
  102747. };
  102748. this.endTimeline = function() {
  102749. this.transmuxPipeline_.headOfPipeline.endTimeline();
  102750. };
  102751. this.reset = function() {
  102752. if (this.transmuxPipeline_.headOfPipeline) {
  102753. this.transmuxPipeline_.headOfPipeline.reset();
  102754. }
  102755. };
  102756. this.resetCaptions = function() {
  102757. if (this.transmuxPipeline_.captionStream) {
  102758. this.transmuxPipeline_.captionStream.reset();
  102759. }
  102760. };
  102761. };
  102762. _Transmuxer.prototype = new stream();
  102763. var transmuxer = {
  102764. Transmuxer: _Transmuxer,
  102765. VideoSegmentStream: _VideoSegmentStream,
  102766. AudioSegmentStream: _AudioSegmentStream,
  102767. AUDIO_PROPERTIES: audioProperties,
  102768. VIDEO_PROPERTIES: videoProperties,
  102769. generateSegmentTimingInfo
  102770. };
  102771. var toUnsigned$3 = function toUnsigned2(value) {
  102772. return value >>> 0;
  102773. };
  102774. var toHexString$1 = function toHexString2(value) {
  102775. return ("00" + value.toString(16)).slice(-2);
  102776. };
  102777. var bin = {
  102778. toUnsigned: toUnsigned$3,
  102779. toHexString: toHexString$1
  102780. };
  102781. var parseType$1 = function parseType2(buffer) {
  102782. var result = "";
  102783. result += String.fromCharCode(buffer[0]);
  102784. result += String.fromCharCode(buffer[1]);
  102785. result += String.fromCharCode(buffer[2]);
  102786. result += String.fromCharCode(buffer[3]);
  102787. return result;
  102788. };
  102789. var parseType_1 = parseType$1;
  102790. var toUnsigned$2 = bin.toUnsigned;
  102791. var findBox4 = function findBox5(data, path) {
  102792. var results = [], i2, size, type3, end, subresults;
  102793. if (!path.length) {
  102794. return null;
  102795. }
  102796. for (i2 = 0; i2 < data.byteLength; ) {
  102797. size = toUnsigned$2(data[i2] << 24 | data[i2 + 1] << 16 | data[i2 + 2] << 8 | data[i2 + 3]);
  102798. type3 = parseType_1(data.subarray(i2 + 4, i2 + 8));
  102799. end = size > 1 ? i2 + size : data.byteLength;
  102800. if (type3 === path[0]) {
  102801. if (path.length === 1) {
  102802. results.push(data.subarray(i2 + 8, end));
  102803. } else {
  102804. subresults = findBox5(data.subarray(i2 + 8, end), path.slice(1));
  102805. if (subresults.length) {
  102806. results = results.concat(subresults);
  102807. }
  102808. }
  102809. }
  102810. i2 = end;
  102811. }
  102812. return results;
  102813. };
  102814. var findBox_1 = findBox4;
  102815. var toUnsigned$1 = bin.toUnsigned;
  102816. var getUint64$12 = numbers2.getUint64;
  102817. var tfdt = function tfdt2(data) {
  102818. var result = {
  102819. version: data[0],
  102820. flags: new Uint8Array(data.subarray(1, 4))
  102821. };
  102822. if (result.version === 1) {
  102823. result.baseMediaDecodeTime = getUint64$12(data.subarray(4));
  102824. } else {
  102825. result.baseMediaDecodeTime = toUnsigned$1(data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7]);
  102826. }
  102827. return result;
  102828. };
  102829. var parseTfdt = tfdt;
  102830. var parseSampleFlags = function parseSampleFlags2(flags) {
  102831. return {
  102832. isLeading: (flags[0] & 12) >>> 2,
  102833. dependsOn: flags[0] & 3,
  102834. isDependedOn: (flags[1] & 192) >>> 6,
  102835. hasRedundancy: (flags[1] & 48) >>> 4,
  102836. paddingValue: (flags[1] & 14) >>> 1,
  102837. isNonSyncSample: flags[1] & 1,
  102838. degradationPriority: flags[2] << 8 | flags[3]
  102839. };
  102840. };
  102841. var parseSampleFlags_1 = parseSampleFlags;
  102842. var trun = function trun2(data) {
  102843. var result = {
  102844. version: data[0],
  102845. flags: new Uint8Array(data.subarray(1, 4)),
  102846. samples: []
  102847. }, view = new DataView(data.buffer, data.byteOffset, data.byteLength), dataOffsetPresent = result.flags[2] & 1, firstSampleFlagsPresent = result.flags[2] & 4, sampleDurationPresent = result.flags[1] & 1, sampleSizePresent = result.flags[1] & 2, sampleFlagsPresent = result.flags[1] & 4, sampleCompositionTimeOffsetPresent = result.flags[1] & 8, sampleCount = view.getUint32(4), offset = 8, sample;
  102848. if (dataOffsetPresent) {
  102849. result.dataOffset = view.getInt32(offset);
  102850. offset += 4;
  102851. }
  102852. if (firstSampleFlagsPresent && sampleCount) {
  102853. sample = {
  102854. flags: parseSampleFlags_1(data.subarray(offset, offset + 4))
  102855. };
  102856. offset += 4;
  102857. if (sampleDurationPresent) {
  102858. sample.duration = view.getUint32(offset);
  102859. offset += 4;
  102860. }
  102861. if (sampleSizePresent) {
  102862. sample.size = view.getUint32(offset);
  102863. offset += 4;
  102864. }
  102865. if (sampleCompositionTimeOffsetPresent) {
  102866. if (result.version === 1) {
  102867. sample.compositionTimeOffset = view.getInt32(offset);
  102868. } else {
  102869. sample.compositionTimeOffset = view.getUint32(offset);
  102870. }
  102871. offset += 4;
  102872. }
  102873. result.samples.push(sample);
  102874. sampleCount--;
  102875. }
  102876. while (sampleCount--) {
  102877. sample = {};
  102878. if (sampleDurationPresent) {
  102879. sample.duration = view.getUint32(offset);
  102880. offset += 4;
  102881. }
  102882. if (sampleSizePresent) {
  102883. sample.size = view.getUint32(offset);
  102884. offset += 4;
  102885. }
  102886. if (sampleFlagsPresent) {
  102887. sample.flags = parseSampleFlags_1(data.subarray(offset, offset + 4));
  102888. offset += 4;
  102889. }
  102890. if (sampleCompositionTimeOffsetPresent) {
  102891. if (result.version === 1) {
  102892. sample.compositionTimeOffset = view.getInt32(offset);
  102893. } else {
  102894. sample.compositionTimeOffset = view.getUint32(offset);
  102895. }
  102896. offset += 4;
  102897. }
  102898. result.samples.push(sample);
  102899. }
  102900. return result;
  102901. };
  102902. var parseTrun = trun;
  102903. var tfhd = function tfhd2(data) {
  102904. var view = new DataView(data.buffer, data.byteOffset, data.byteLength), result = {
  102905. version: data[0],
  102906. flags: new Uint8Array(data.subarray(1, 4)),
  102907. trackId: view.getUint32(4)
  102908. }, baseDataOffsetPresent = result.flags[2] & 1, sampleDescriptionIndexPresent = result.flags[2] & 2, defaultSampleDurationPresent = result.flags[2] & 8, defaultSampleSizePresent = result.flags[2] & 16, defaultSampleFlagsPresent = result.flags[2] & 32, durationIsEmpty = result.flags[0] & 65536, defaultBaseIsMoof = result.flags[0] & 131072, i2;
  102909. i2 = 8;
  102910. if (baseDataOffsetPresent) {
  102911. i2 += 4;
  102912. result.baseDataOffset = view.getUint32(12);
  102913. i2 += 4;
  102914. }
  102915. if (sampleDescriptionIndexPresent) {
  102916. result.sampleDescriptionIndex = view.getUint32(i2);
  102917. i2 += 4;
  102918. }
  102919. if (defaultSampleDurationPresent) {
  102920. result.defaultSampleDuration = view.getUint32(i2);
  102921. i2 += 4;
  102922. }
  102923. if (defaultSampleSizePresent) {
  102924. result.defaultSampleSize = view.getUint32(i2);
  102925. i2 += 4;
  102926. }
  102927. if (defaultSampleFlagsPresent) {
  102928. result.defaultSampleFlags = view.getUint32(i2);
  102929. }
  102930. if (durationIsEmpty) {
  102931. result.durationIsEmpty = true;
  102932. }
  102933. if (!baseDataOffsetPresent && defaultBaseIsMoof) {
  102934. result.baseDataOffsetIsMoof = true;
  102935. }
  102936. return result;
  102937. };
  102938. var parseTfhd = tfhd;
  102939. var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  102940. var win2;
  102941. if (typeof window !== "undefined") {
  102942. win2 = window;
  102943. } else if (typeof commonjsGlobal2 !== "undefined") {
  102944. win2 = commonjsGlobal2;
  102945. } else if (typeof self !== "undefined") {
  102946. win2 = self;
  102947. } else {
  102948. win2 = {};
  102949. }
  102950. var window_12 = win2;
  102951. var discardEmulationPreventionBytes4 = captionPacketParser.discardEmulationPreventionBytes;
  102952. var CaptionStream = captionStream.CaptionStream;
  102953. var mapToSample = function mapToSample2(offset, samples) {
  102954. var approximateOffset = offset;
  102955. for (var i2 = 0; i2 < samples.length; i2++) {
  102956. var sample = samples[i2];
  102957. if (approximateOffset < sample.size) {
  102958. return sample;
  102959. }
  102960. approximateOffset -= sample.size;
  102961. }
  102962. return null;
  102963. };
  102964. var findSeiNals = function findSeiNals2(avcStream, samples, trackId) {
  102965. var avcView = new DataView(avcStream.buffer, avcStream.byteOffset, avcStream.byteLength), result = {
  102966. logs: [],
  102967. seiNals: []
  102968. }, seiNal, i2, length, lastMatchedSample;
  102969. for (i2 = 0; i2 + 4 < avcStream.length; i2 += length) {
  102970. length = avcView.getUint32(i2);
  102971. i2 += 4;
  102972. if (length <= 0) {
  102973. continue;
  102974. }
  102975. switch (avcStream[i2] & 31) {
  102976. case 6:
  102977. var data = avcStream.subarray(i2 + 1, i2 + 1 + length);
  102978. var matchingSample = mapToSample(i2, samples);
  102979. seiNal = {
  102980. nalUnitType: "sei_rbsp",
  102981. size: length,
  102982. data,
  102983. escapedRBSP: discardEmulationPreventionBytes4(data),
  102984. trackId
  102985. };
  102986. if (matchingSample) {
  102987. seiNal.pts = matchingSample.pts;
  102988. seiNal.dts = matchingSample.dts;
  102989. lastMatchedSample = matchingSample;
  102990. } else if (lastMatchedSample) {
  102991. seiNal.pts = lastMatchedSample.pts;
  102992. seiNal.dts = lastMatchedSample.dts;
  102993. } else {
  102994. result.logs.push({
  102995. level: "warn",
  102996. message: "We've encountered a nal unit without data at " + i2 + " for trackId " + trackId + ". See mux.js#223."
  102997. });
  102998. break;
  102999. }
  103000. result.seiNals.push(seiNal);
  103001. break;
  103002. }
  103003. }
  103004. return result;
  103005. };
  103006. var parseSamples = function parseSamples2(truns, baseMediaDecodeTime, tfhd2) {
  103007. var currentDts = baseMediaDecodeTime;
  103008. var defaultSampleDuration = tfhd2.defaultSampleDuration || 0;
  103009. var defaultSampleSize = tfhd2.defaultSampleSize || 0;
  103010. var trackId = tfhd2.trackId;
  103011. var allSamples = [];
  103012. truns.forEach(function(trun2) {
  103013. var trackRun = parseTrun(trun2);
  103014. var samples = trackRun.samples;
  103015. samples.forEach(function(sample) {
  103016. if (sample.duration === void 0) {
  103017. sample.duration = defaultSampleDuration;
  103018. }
  103019. if (sample.size === void 0) {
  103020. sample.size = defaultSampleSize;
  103021. }
  103022. sample.trackId = trackId;
  103023. sample.dts = currentDts;
  103024. if (sample.compositionTimeOffset === void 0) {
  103025. sample.compositionTimeOffset = 0;
  103026. }
  103027. if (typeof currentDts === "bigint") {
  103028. sample.pts = currentDts + window_12.BigInt(sample.compositionTimeOffset);
  103029. currentDts += window_12.BigInt(sample.duration);
  103030. } else {
  103031. sample.pts = currentDts + sample.compositionTimeOffset;
  103032. currentDts += sample.duration;
  103033. }
  103034. });
  103035. allSamples = allSamples.concat(samples);
  103036. });
  103037. return allSamples;
  103038. };
  103039. var parseCaptionNals = function parseCaptionNals2(segment, videoTrackId) {
  103040. var trafs = findBox_1(segment, ["moof", "traf"]);
  103041. var mdats = findBox_1(segment, ["mdat"]);
  103042. var captionNals = {};
  103043. var mdatTrafPairs = [];
  103044. mdats.forEach(function(mdat2, index2) {
  103045. var matchingTraf = trafs[index2];
  103046. mdatTrafPairs.push({
  103047. mdat: mdat2,
  103048. traf: matchingTraf
  103049. });
  103050. });
  103051. mdatTrafPairs.forEach(function(pair) {
  103052. var mdat2 = pair.mdat;
  103053. var traf2 = pair.traf;
  103054. var tfhd2 = findBox_1(traf2, ["tfhd"]);
  103055. var headerInfo = parseTfhd(tfhd2[0]);
  103056. var trackId = headerInfo.trackId;
  103057. var tfdt2 = findBox_1(traf2, ["tfdt"]);
  103058. var baseMediaDecodeTime = tfdt2.length > 0 ? parseTfdt(tfdt2[0]).baseMediaDecodeTime : 0;
  103059. var truns = findBox_1(traf2, ["trun"]);
  103060. var samples;
  103061. var result;
  103062. if (videoTrackId === trackId && truns.length > 0) {
  103063. samples = parseSamples(truns, baseMediaDecodeTime, headerInfo);
  103064. result = findSeiNals(mdat2, samples, trackId);
  103065. if (!captionNals[trackId]) {
  103066. captionNals[trackId] = {
  103067. seiNals: [],
  103068. logs: []
  103069. };
  103070. }
  103071. captionNals[trackId].seiNals = captionNals[trackId].seiNals.concat(result.seiNals);
  103072. captionNals[trackId].logs = captionNals[trackId].logs.concat(result.logs);
  103073. }
  103074. });
  103075. return captionNals;
  103076. };
  103077. var parseEmbeddedCaptions = function parseEmbeddedCaptions2(segment, trackId, timescale3) {
  103078. var captionNals;
  103079. if (trackId === null) {
  103080. return null;
  103081. }
  103082. captionNals = parseCaptionNals(segment, trackId);
  103083. var trackNals = captionNals[trackId] || {};
  103084. return {
  103085. seiNals: trackNals.seiNals,
  103086. logs: trackNals.logs,
  103087. timescale: timescale3
  103088. };
  103089. };
  103090. var CaptionParser = function CaptionParser2() {
  103091. var isInitialized = false;
  103092. var captionStream2;
  103093. var segmentCache;
  103094. var trackId;
  103095. var timescale3;
  103096. var parsedCaptions;
  103097. var parsingPartial;
  103098. this.isInitialized = function() {
  103099. return isInitialized;
  103100. };
  103101. this.init = function(options2) {
  103102. captionStream2 = new CaptionStream();
  103103. isInitialized = true;
  103104. parsingPartial = options2 ? options2.isPartial : false;
  103105. captionStream2.on("data", function(event2) {
  103106. event2.startTime = event2.startPts / timescale3;
  103107. event2.endTime = event2.endPts / timescale3;
  103108. parsedCaptions.captions.push(event2);
  103109. parsedCaptions.captionStreams[event2.stream] = true;
  103110. });
  103111. captionStream2.on("log", function(log2) {
  103112. parsedCaptions.logs.push(log2);
  103113. });
  103114. };
  103115. this.isNewInit = function(videoTrackIds, timescales) {
  103116. if (videoTrackIds && videoTrackIds.length === 0 || timescales && typeof timescales === "object" && Object.keys(timescales).length === 0) {
  103117. return false;
  103118. }
  103119. return trackId !== videoTrackIds[0] || timescale3 !== timescales[trackId];
  103120. };
  103121. this.parse = function(segment, videoTrackIds, timescales) {
  103122. var parsedData;
  103123. if (!this.isInitialized()) {
  103124. return null;
  103125. } else if (!videoTrackIds || !timescales) {
  103126. return null;
  103127. } else if (this.isNewInit(videoTrackIds, timescales)) {
  103128. trackId = videoTrackIds[0];
  103129. timescale3 = timescales[trackId];
  103130. } else if (trackId === null || !timescale3) {
  103131. segmentCache.push(segment);
  103132. return null;
  103133. }
  103134. while (segmentCache.length > 0) {
  103135. var cachedSegment = segmentCache.shift();
  103136. this.parse(cachedSegment, videoTrackIds, timescales);
  103137. }
  103138. parsedData = parseEmbeddedCaptions(segment, trackId, timescale3);
  103139. if (parsedData && parsedData.logs) {
  103140. parsedCaptions.logs = parsedCaptions.logs.concat(parsedData.logs);
  103141. }
  103142. if (parsedData === null || !parsedData.seiNals) {
  103143. if (parsedCaptions.logs.length) {
  103144. return {
  103145. logs: parsedCaptions.logs,
  103146. captions: [],
  103147. captionStreams: []
  103148. };
  103149. }
  103150. return null;
  103151. }
  103152. this.pushNals(parsedData.seiNals);
  103153. this.flushStream();
  103154. return parsedCaptions;
  103155. };
  103156. this.pushNals = function(nals) {
  103157. if (!this.isInitialized() || !nals || nals.length === 0) {
  103158. return null;
  103159. }
  103160. nals.forEach(function(nal) {
  103161. captionStream2.push(nal);
  103162. });
  103163. };
  103164. this.flushStream = function() {
  103165. if (!this.isInitialized()) {
  103166. return null;
  103167. }
  103168. if (!parsingPartial) {
  103169. captionStream2.flush();
  103170. } else {
  103171. captionStream2.partialFlush();
  103172. }
  103173. };
  103174. this.clearParsedCaptions = function() {
  103175. parsedCaptions.captions = [];
  103176. parsedCaptions.captionStreams = {};
  103177. parsedCaptions.logs = [];
  103178. };
  103179. this.resetCaptionStream = function() {
  103180. if (!this.isInitialized()) {
  103181. return null;
  103182. }
  103183. captionStream2.reset();
  103184. };
  103185. this.clearAllCaptions = function() {
  103186. this.clearParsedCaptions();
  103187. this.resetCaptionStream();
  103188. };
  103189. this.reset = function() {
  103190. segmentCache = [];
  103191. trackId = null;
  103192. timescale3 = null;
  103193. if (!parsedCaptions) {
  103194. parsedCaptions = {
  103195. captions: [],
  103196. captionStreams: {},
  103197. logs: []
  103198. };
  103199. } else {
  103200. this.clearParsedCaptions();
  103201. }
  103202. this.resetCaptionStream();
  103203. };
  103204. this.reset();
  103205. };
  103206. var captionParser = CaptionParser;
  103207. var toUnsigned = bin.toUnsigned;
  103208. var toHexString = bin.toHexString;
  103209. var getUint642 = numbers2.getUint64;
  103210. var timescale2, startTime, compositionStartTime, getVideoTrackIds, getTracks, getTimescaleFromMediaHeader;
  103211. timescale2 = function timescale3(init) {
  103212. var result = {}, traks = findBox_1(init, ["moov", "trak"]);
  103213. return traks.reduce(function(result2, trak2) {
  103214. var tkhd2, version2, index2, id, mdhd2;
  103215. tkhd2 = findBox_1(trak2, ["tkhd"])[0];
  103216. if (!tkhd2) {
  103217. return null;
  103218. }
  103219. version2 = tkhd2[0];
  103220. index2 = version2 === 0 ? 12 : 20;
  103221. id = toUnsigned(tkhd2[index2] << 24 | tkhd2[index2 + 1] << 16 | tkhd2[index2 + 2] << 8 | tkhd2[index2 + 3]);
  103222. mdhd2 = findBox_1(trak2, ["mdia", "mdhd"])[0];
  103223. if (!mdhd2) {
  103224. return null;
  103225. }
  103226. version2 = mdhd2[0];
  103227. index2 = version2 === 0 ? 12 : 20;
  103228. result2[id] = toUnsigned(mdhd2[index2] << 24 | mdhd2[index2 + 1] << 16 | mdhd2[index2 + 2] << 8 | mdhd2[index2 + 3]);
  103229. return result2;
  103230. }, result);
  103231. };
  103232. startTime = function startTime2(timescale3, fragment) {
  103233. var trafs;
  103234. trafs = findBox_1(fragment, ["moof", "traf"]);
  103235. var lowestTime = trafs.reduce(function(acc, traf2) {
  103236. var tfhd2 = findBox_1(traf2, ["tfhd"])[0];
  103237. var id = toUnsigned(tfhd2[4] << 24 | tfhd2[5] << 16 | tfhd2[6] << 8 | tfhd2[7]);
  103238. var scale = timescale3[id] || 9e4;
  103239. var tfdt2 = findBox_1(traf2, ["tfdt"])[0];
  103240. var dv = new DataView(tfdt2.buffer, tfdt2.byteOffset, tfdt2.byteLength);
  103241. var baseTime;
  103242. if (tfdt2[0] === 1) {
  103243. baseTime = getUint642(tfdt2.subarray(4, 12));
  103244. } else {
  103245. baseTime = dv.getUint32(4);
  103246. }
  103247. var seconds;
  103248. if (typeof baseTime === "bigint") {
  103249. seconds = baseTime / window_12.BigInt(scale);
  103250. } else if (typeof baseTime === "number" && !isNaN(baseTime)) {
  103251. seconds = baseTime / scale;
  103252. }
  103253. if (seconds < Number.MAX_SAFE_INTEGER) {
  103254. seconds = Number(seconds);
  103255. }
  103256. if (seconds < acc) {
  103257. acc = seconds;
  103258. }
  103259. return acc;
  103260. }, Infinity);
  103261. return typeof lowestTime === "bigint" || isFinite(lowestTime) ? lowestTime : 0;
  103262. };
  103263. compositionStartTime = function compositionStartTime2(timescales, fragment) {
  103264. var trafBoxes = findBox_1(fragment, ["moof", "traf"]);
  103265. var baseMediaDecodeTime = 0;
  103266. var compositionTimeOffset = 0;
  103267. var trackId;
  103268. if (trafBoxes && trafBoxes.length) {
  103269. var tfhd2 = findBox_1(trafBoxes[0], ["tfhd"])[0];
  103270. var trun2 = findBox_1(trafBoxes[0], ["trun"])[0];
  103271. var tfdt2 = findBox_1(trafBoxes[0], ["tfdt"])[0];
  103272. if (tfhd2) {
  103273. var parsedTfhd = parseTfhd(tfhd2);
  103274. trackId = parsedTfhd.trackId;
  103275. }
  103276. if (tfdt2) {
  103277. var parsedTfdt = parseTfdt(tfdt2);
  103278. baseMediaDecodeTime = parsedTfdt.baseMediaDecodeTime;
  103279. }
  103280. if (trun2) {
  103281. var parsedTrun = parseTrun(trun2);
  103282. if (parsedTrun.samples && parsedTrun.samples.length) {
  103283. compositionTimeOffset = parsedTrun.samples[0].compositionTimeOffset || 0;
  103284. }
  103285. }
  103286. }
  103287. var timescale3 = timescales[trackId] || 9e4;
  103288. if (typeof baseMediaDecodeTime === "bigint") {
  103289. compositionTimeOffset = window_12.BigInt(compositionTimeOffset);
  103290. timescale3 = window_12.BigInt(timescale3);
  103291. }
  103292. var result = (baseMediaDecodeTime + compositionTimeOffset) / timescale3;
  103293. if (typeof result === "bigint" && result < Number.MAX_SAFE_INTEGER) {
  103294. result = Number(result);
  103295. }
  103296. return result;
  103297. };
  103298. getVideoTrackIds = function getVideoTrackIds2(init) {
  103299. var traks = findBox_1(init, ["moov", "trak"]);
  103300. var videoTrackIds = [];
  103301. traks.forEach(function(trak2) {
  103302. var hdlrs = findBox_1(trak2, ["mdia", "hdlr"]);
  103303. var tkhds = findBox_1(trak2, ["tkhd"]);
  103304. hdlrs.forEach(function(hdlr2, index2) {
  103305. var handlerType = parseType_1(hdlr2.subarray(8, 12));
  103306. var tkhd2 = tkhds[index2];
  103307. var view;
  103308. var version2;
  103309. var trackId;
  103310. if (handlerType === "vide") {
  103311. view = new DataView(tkhd2.buffer, tkhd2.byteOffset, tkhd2.byteLength);
  103312. version2 = view.getUint8(0);
  103313. trackId = version2 === 0 ? view.getUint32(12) : view.getUint32(20);
  103314. videoTrackIds.push(trackId);
  103315. }
  103316. });
  103317. });
  103318. return videoTrackIds;
  103319. };
  103320. getTimescaleFromMediaHeader = function getTimescaleFromMediaHeader2(mdhd2) {
  103321. var version2 = mdhd2[0];
  103322. var index2 = version2 === 0 ? 12 : 20;
  103323. return toUnsigned(mdhd2[index2] << 24 | mdhd2[index2 + 1] << 16 | mdhd2[index2 + 2] << 8 | mdhd2[index2 + 3]);
  103324. };
  103325. getTracks = function getTracks2(init) {
  103326. var traks = findBox_1(init, ["moov", "trak"]);
  103327. var tracks = [];
  103328. traks.forEach(function(trak2) {
  103329. var track = {};
  103330. var tkhd2 = findBox_1(trak2, ["tkhd"])[0];
  103331. var view, tkhdVersion;
  103332. if (tkhd2) {
  103333. view = new DataView(tkhd2.buffer, tkhd2.byteOffset, tkhd2.byteLength);
  103334. tkhdVersion = view.getUint8(0);
  103335. track.id = tkhdVersion === 0 ? view.getUint32(12) : view.getUint32(20);
  103336. }
  103337. var hdlr2 = findBox_1(trak2, ["mdia", "hdlr"])[0];
  103338. if (hdlr2) {
  103339. var type3 = parseType_1(hdlr2.subarray(8, 12));
  103340. if (type3 === "vide") {
  103341. track.type = "video";
  103342. } else if (type3 === "soun") {
  103343. track.type = "audio";
  103344. } else {
  103345. track.type = type3;
  103346. }
  103347. }
  103348. var stsd2 = findBox_1(trak2, ["mdia", "minf", "stbl", "stsd"])[0];
  103349. if (stsd2) {
  103350. var sampleDescriptions = stsd2.subarray(8);
  103351. track.codec = parseType_1(sampleDescriptions.subarray(4, 8));
  103352. var codecBox = findBox_1(sampleDescriptions, [track.codec])[0];
  103353. var codecConfig, codecConfigType;
  103354. if (codecBox) {
  103355. if (/^[asm]vc[1-9]$/i.test(track.codec)) {
  103356. codecConfig = codecBox.subarray(78);
  103357. codecConfigType = parseType_1(codecConfig.subarray(4, 8));
  103358. if (codecConfigType === "avcC" && codecConfig.length > 11) {
  103359. track.codec += ".";
  103360. track.codec += toHexString(codecConfig[9]);
  103361. track.codec += toHexString(codecConfig[10]);
  103362. track.codec += toHexString(codecConfig[11]);
  103363. } else {
  103364. track.codec = "avc1.4d400d";
  103365. }
  103366. } else if (/^mp4[a,v]$/i.test(track.codec)) {
  103367. codecConfig = codecBox.subarray(28);
  103368. codecConfigType = parseType_1(codecConfig.subarray(4, 8));
  103369. if (codecConfigType === "esds" && codecConfig.length > 20 && codecConfig[19] !== 0) {
  103370. track.codec += "." + toHexString(codecConfig[19]);
  103371. track.codec += "." + toHexString(codecConfig[20] >>> 2 & 63).replace(/^0/, "");
  103372. } else {
  103373. track.codec = "mp4a.40.2";
  103374. }
  103375. } else {
  103376. track.codec = track.codec.toLowerCase();
  103377. }
  103378. }
  103379. }
  103380. var mdhd2 = findBox_1(trak2, ["mdia", "mdhd"])[0];
  103381. if (mdhd2) {
  103382. track.timescale = getTimescaleFromMediaHeader(mdhd2);
  103383. }
  103384. tracks.push(track);
  103385. });
  103386. return tracks;
  103387. };
  103388. var probe$2 = {
  103389. findBox: findBox_1,
  103390. parseType: parseType_1,
  103391. timescale: timescale2,
  103392. startTime,
  103393. compositionStartTime,
  103394. videoTrackIds: getVideoTrackIds,
  103395. tracks: getTracks,
  103396. getTimescaleFromMediaHeader
  103397. };
  103398. var parsePid = function parsePid2(packet) {
  103399. var pid = packet[1] & 31;
  103400. pid <<= 8;
  103401. pid |= packet[2];
  103402. return pid;
  103403. };
  103404. var parsePayloadUnitStartIndicator = function parsePayloadUnitStartIndicator2(packet) {
  103405. return !!(packet[1] & 64);
  103406. };
  103407. var parseAdaptionField = function parseAdaptionField2(packet) {
  103408. var offset = 0;
  103409. if ((packet[3] & 48) >>> 4 > 1) {
  103410. offset += packet[4] + 1;
  103411. }
  103412. return offset;
  103413. };
  103414. var parseType = function parseType2(packet, pmtPid) {
  103415. var pid = parsePid(packet);
  103416. if (pid === 0) {
  103417. return "pat";
  103418. } else if (pid === pmtPid) {
  103419. return "pmt";
  103420. } else if (pmtPid) {
  103421. return "pes";
  103422. }
  103423. return null;
  103424. };
  103425. var parsePat = function parsePat2(packet) {
  103426. var pusi = parsePayloadUnitStartIndicator(packet);
  103427. var offset = 4 + parseAdaptionField(packet);
  103428. if (pusi) {
  103429. offset += packet[offset] + 1;
  103430. }
  103431. return (packet[offset + 10] & 31) << 8 | packet[offset + 11];
  103432. };
  103433. var parsePmt = function parsePmt2(packet) {
  103434. var programMapTable = {};
  103435. var pusi = parsePayloadUnitStartIndicator(packet);
  103436. var payloadOffset = 4 + parseAdaptionField(packet);
  103437. if (pusi) {
  103438. payloadOffset += packet[payloadOffset] + 1;
  103439. }
  103440. if (!(packet[payloadOffset + 5] & 1)) {
  103441. return;
  103442. }
  103443. var sectionLength, tableEnd, programInfoLength;
  103444. sectionLength = (packet[payloadOffset + 1] & 15) << 8 | packet[payloadOffset + 2];
  103445. tableEnd = 3 + sectionLength - 4;
  103446. programInfoLength = (packet[payloadOffset + 10] & 15) << 8 | packet[payloadOffset + 11];
  103447. var offset = 12 + programInfoLength;
  103448. while (offset < tableEnd) {
  103449. var i2 = payloadOffset + offset;
  103450. programMapTable[(packet[i2 + 1] & 31) << 8 | packet[i2 + 2]] = packet[i2];
  103451. offset += ((packet[i2 + 3] & 15) << 8 | packet[i2 + 4]) + 5;
  103452. }
  103453. return programMapTable;
  103454. };
  103455. var parsePesType = function parsePesType2(packet, programMapTable) {
  103456. var pid = parsePid(packet);
  103457. var type3 = programMapTable[pid];
  103458. switch (type3) {
  103459. case streamTypes.H264_STREAM_TYPE:
  103460. return "video";
  103461. case streamTypes.ADTS_STREAM_TYPE:
  103462. return "audio";
  103463. case streamTypes.METADATA_STREAM_TYPE:
  103464. return "timed-metadata";
  103465. default:
  103466. return null;
  103467. }
  103468. };
  103469. var parsePesTime = function parsePesTime2(packet) {
  103470. var pusi = parsePayloadUnitStartIndicator(packet);
  103471. if (!pusi) {
  103472. return null;
  103473. }
  103474. var offset = 4 + parseAdaptionField(packet);
  103475. if (offset >= packet.byteLength) {
  103476. return null;
  103477. }
  103478. var pes = null;
  103479. var ptsDtsFlags;
  103480. ptsDtsFlags = packet[offset + 7];
  103481. if (ptsDtsFlags & 192) {
  103482. pes = {};
  103483. pes.pts = (packet[offset + 9] & 14) << 27 | (packet[offset + 10] & 255) << 20 | (packet[offset + 11] & 254) << 12 | (packet[offset + 12] & 255) << 5 | (packet[offset + 13] & 254) >>> 3;
  103484. pes.pts *= 4;
  103485. pes.pts += (packet[offset + 13] & 6) >>> 1;
  103486. pes.dts = pes.pts;
  103487. if (ptsDtsFlags & 64) {
  103488. pes.dts = (packet[offset + 14] & 14) << 27 | (packet[offset + 15] & 255) << 20 | (packet[offset + 16] & 254) << 12 | (packet[offset + 17] & 255) << 5 | (packet[offset + 18] & 254) >>> 3;
  103489. pes.dts *= 4;
  103490. pes.dts += (packet[offset + 18] & 6) >>> 1;
  103491. }
  103492. }
  103493. return pes;
  103494. };
  103495. var parseNalUnitType = function parseNalUnitType2(type3) {
  103496. switch (type3) {
  103497. case 5:
  103498. return "slice_layer_without_partitioning_rbsp_idr";
  103499. case 6:
  103500. return "sei_rbsp";
  103501. case 7:
  103502. return "seq_parameter_set_rbsp";
  103503. case 8:
  103504. return "pic_parameter_set_rbsp";
  103505. case 9:
  103506. return "access_unit_delimiter_rbsp";
  103507. default:
  103508. return null;
  103509. }
  103510. };
  103511. var videoPacketContainsKeyFrame = function videoPacketContainsKeyFrame2(packet) {
  103512. var offset = 4 + parseAdaptionField(packet);
  103513. var frameBuffer = packet.subarray(offset);
  103514. var frameI = 0;
  103515. var frameSyncPoint = 0;
  103516. var foundKeyFrame = false;
  103517. var nalType;
  103518. for (; frameSyncPoint < frameBuffer.byteLength - 3; frameSyncPoint++) {
  103519. if (frameBuffer[frameSyncPoint + 2] === 1) {
  103520. frameI = frameSyncPoint + 5;
  103521. break;
  103522. }
  103523. }
  103524. while (frameI < frameBuffer.byteLength) {
  103525. switch (frameBuffer[frameI]) {
  103526. case 0:
  103527. if (frameBuffer[frameI - 1] !== 0) {
  103528. frameI += 2;
  103529. break;
  103530. } else if (frameBuffer[frameI - 2] !== 0) {
  103531. frameI++;
  103532. break;
  103533. }
  103534. if (frameSyncPoint + 3 !== frameI - 2) {
  103535. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  103536. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  103537. foundKeyFrame = true;
  103538. }
  103539. }
  103540. do {
  103541. frameI++;
  103542. } while (frameBuffer[frameI] !== 1 && frameI < frameBuffer.length);
  103543. frameSyncPoint = frameI - 2;
  103544. frameI += 3;
  103545. break;
  103546. case 1:
  103547. if (frameBuffer[frameI - 1] !== 0 || frameBuffer[frameI - 2] !== 0) {
  103548. frameI += 3;
  103549. break;
  103550. }
  103551. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  103552. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  103553. foundKeyFrame = true;
  103554. }
  103555. frameSyncPoint = frameI - 2;
  103556. frameI += 3;
  103557. break;
  103558. default:
  103559. frameI += 3;
  103560. break;
  103561. }
  103562. }
  103563. frameBuffer = frameBuffer.subarray(frameSyncPoint);
  103564. frameI -= frameSyncPoint;
  103565. frameSyncPoint = 0;
  103566. if (frameBuffer && frameBuffer.byteLength > 3) {
  103567. nalType = parseNalUnitType(frameBuffer[frameSyncPoint + 3] & 31);
  103568. if (nalType === "slice_layer_without_partitioning_rbsp_idr") {
  103569. foundKeyFrame = true;
  103570. }
  103571. }
  103572. return foundKeyFrame;
  103573. };
  103574. var probe$1 = {
  103575. parseType,
  103576. parsePat,
  103577. parsePmt,
  103578. parsePayloadUnitStartIndicator,
  103579. parsePesType,
  103580. parsePesTime,
  103581. videoPacketContainsKeyFrame
  103582. };
  103583. var handleRollover = timestampRolloverStream.handleRollover;
  103584. var probe = {};
  103585. probe.ts = probe$1;
  103586. probe.aac = utils2;
  103587. var ONE_SECOND_IN_TS2 = clock2.ONE_SECOND_IN_TS;
  103588. var MP2T_PACKET_LENGTH = 188, SYNC_BYTE = 71;
  103589. var parsePsi_ = function parsePsi_2(bytes, pmt) {
  103590. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3;
  103591. while (endIndex < bytes.byteLength) {
  103592. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  103593. packet = bytes.subarray(startIndex, endIndex);
  103594. type3 = probe.ts.parseType(packet, pmt.pid);
  103595. switch (type3) {
  103596. case "pat":
  103597. pmt.pid = probe.ts.parsePat(packet);
  103598. break;
  103599. case "pmt":
  103600. var table = probe.ts.parsePmt(packet);
  103601. pmt.table = pmt.table || {};
  103602. Object.keys(table).forEach(function(key) {
  103603. pmt.table[key] = table[key];
  103604. });
  103605. break;
  103606. }
  103607. startIndex += MP2T_PACKET_LENGTH;
  103608. endIndex += MP2T_PACKET_LENGTH;
  103609. continue;
  103610. }
  103611. startIndex++;
  103612. endIndex++;
  103613. }
  103614. };
  103615. var parseAudioPes_ = function parseAudioPes_2(bytes, pmt, result) {
  103616. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3, pesType, pusi, parsed;
  103617. var endLoop = false;
  103618. while (endIndex <= bytes.byteLength) {
  103619. if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {
  103620. packet = bytes.subarray(startIndex, endIndex);
  103621. type3 = probe.ts.parseType(packet, pmt.pid);
  103622. switch (type3) {
  103623. case "pes":
  103624. pesType = probe.ts.parsePesType(packet, pmt.table);
  103625. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  103626. if (pesType === "audio" && pusi) {
  103627. parsed = probe.ts.parsePesTime(packet);
  103628. if (parsed) {
  103629. parsed.type = "audio";
  103630. result.audio.push(parsed);
  103631. endLoop = true;
  103632. }
  103633. }
  103634. break;
  103635. }
  103636. if (endLoop) {
  103637. break;
  103638. }
  103639. startIndex += MP2T_PACKET_LENGTH;
  103640. endIndex += MP2T_PACKET_LENGTH;
  103641. continue;
  103642. }
  103643. startIndex++;
  103644. endIndex++;
  103645. }
  103646. endIndex = bytes.byteLength;
  103647. startIndex = endIndex - MP2T_PACKET_LENGTH;
  103648. endLoop = false;
  103649. while (startIndex >= 0) {
  103650. if (bytes[startIndex] === SYNC_BYTE && (bytes[endIndex] === SYNC_BYTE || endIndex === bytes.byteLength)) {
  103651. packet = bytes.subarray(startIndex, endIndex);
  103652. type3 = probe.ts.parseType(packet, pmt.pid);
  103653. switch (type3) {
  103654. case "pes":
  103655. pesType = probe.ts.parsePesType(packet, pmt.table);
  103656. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  103657. if (pesType === "audio" && pusi) {
  103658. parsed = probe.ts.parsePesTime(packet);
  103659. if (parsed) {
  103660. parsed.type = "audio";
  103661. result.audio.push(parsed);
  103662. endLoop = true;
  103663. }
  103664. }
  103665. break;
  103666. }
  103667. if (endLoop) {
  103668. break;
  103669. }
  103670. startIndex -= MP2T_PACKET_LENGTH;
  103671. endIndex -= MP2T_PACKET_LENGTH;
  103672. continue;
  103673. }
  103674. startIndex--;
  103675. endIndex--;
  103676. }
  103677. };
  103678. var parseVideoPes_ = function parseVideoPes_2(bytes, pmt, result) {
  103679. var startIndex = 0, endIndex = MP2T_PACKET_LENGTH, packet, type3, pesType, pusi, parsed, frame, i2, pes;
  103680. var endLoop = false;
  103681. var currentFrame = {
  103682. data: [],
  103683. size: 0
  103684. };
  103685. while (endIndex < bytes.byteLength) {
  103686. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  103687. packet = bytes.subarray(startIndex, endIndex);
  103688. type3 = probe.ts.parseType(packet, pmt.pid);
  103689. switch (type3) {
  103690. case "pes":
  103691. pesType = probe.ts.parsePesType(packet, pmt.table);
  103692. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  103693. if (pesType === "video") {
  103694. if (pusi && !endLoop) {
  103695. parsed = probe.ts.parsePesTime(packet);
  103696. if (parsed) {
  103697. parsed.type = "video";
  103698. result.video.push(parsed);
  103699. endLoop = true;
  103700. }
  103701. }
  103702. if (!result.firstKeyFrame) {
  103703. if (pusi) {
  103704. if (currentFrame.size !== 0) {
  103705. frame = new Uint8Array(currentFrame.size);
  103706. i2 = 0;
  103707. while (currentFrame.data.length) {
  103708. pes = currentFrame.data.shift();
  103709. frame.set(pes, i2);
  103710. i2 += pes.byteLength;
  103711. }
  103712. if (probe.ts.videoPacketContainsKeyFrame(frame)) {
  103713. var firstKeyFrame = probe.ts.parsePesTime(frame);
  103714. if (firstKeyFrame) {
  103715. result.firstKeyFrame = firstKeyFrame;
  103716. result.firstKeyFrame.type = "video";
  103717. } else {
  103718. console.warn("Failed to extract PTS/DTS from PES at first keyframe. This could be an unusual TS segment, or else mux.js did not parse your TS segment correctly. If you know your TS segments do contain PTS/DTS on keyframes please file a bug report! You can try ffprobe to double check for yourself.");
  103719. }
  103720. }
  103721. currentFrame.size = 0;
  103722. }
  103723. }
  103724. currentFrame.data.push(packet);
  103725. currentFrame.size += packet.byteLength;
  103726. }
  103727. }
  103728. break;
  103729. }
  103730. if (endLoop && result.firstKeyFrame) {
  103731. break;
  103732. }
  103733. startIndex += MP2T_PACKET_LENGTH;
  103734. endIndex += MP2T_PACKET_LENGTH;
  103735. continue;
  103736. }
  103737. startIndex++;
  103738. endIndex++;
  103739. }
  103740. endIndex = bytes.byteLength;
  103741. startIndex = endIndex - MP2T_PACKET_LENGTH;
  103742. endLoop = false;
  103743. while (startIndex >= 0) {
  103744. if (bytes[startIndex] === SYNC_BYTE && bytes[endIndex] === SYNC_BYTE) {
  103745. packet = bytes.subarray(startIndex, endIndex);
  103746. type3 = probe.ts.parseType(packet, pmt.pid);
  103747. switch (type3) {
  103748. case "pes":
  103749. pesType = probe.ts.parsePesType(packet, pmt.table);
  103750. pusi = probe.ts.parsePayloadUnitStartIndicator(packet);
  103751. if (pesType === "video" && pusi) {
  103752. parsed = probe.ts.parsePesTime(packet);
  103753. if (parsed) {
  103754. parsed.type = "video";
  103755. result.video.push(parsed);
  103756. endLoop = true;
  103757. }
  103758. }
  103759. break;
  103760. }
  103761. if (endLoop) {
  103762. break;
  103763. }
  103764. startIndex -= MP2T_PACKET_LENGTH;
  103765. endIndex -= MP2T_PACKET_LENGTH;
  103766. continue;
  103767. }
  103768. startIndex--;
  103769. endIndex--;
  103770. }
  103771. };
  103772. var adjustTimestamp_ = function adjustTimestamp_2(segmentInfo, baseTimestamp) {
  103773. if (segmentInfo.audio && segmentInfo.audio.length) {
  103774. var audioBaseTimestamp = baseTimestamp;
  103775. if (typeof audioBaseTimestamp === "undefined" || isNaN(audioBaseTimestamp)) {
  103776. audioBaseTimestamp = segmentInfo.audio[0].dts;
  103777. }
  103778. segmentInfo.audio.forEach(function(info) {
  103779. info.dts = handleRollover(info.dts, audioBaseTimestamp);
  103780. info.pts = handleRollover(info.pts, audioBaseTimestamp);
  103781. info.dtsTime = info.dts / ONE_SECOND_IN_TS2;
  103782. info.ptsTime = info.pts / ONE_SECOND_IN_TS2;
  103783. });
  103784. }
  103785. if (segmentInfo.video && segmentInfo.video.length) {
  103786. var videoBaseTimestamp = baseTimestamp;
  103787. if (typeof videoBaseTimestamp === "undefined" || isNaN(videoBaseTimestamp)) {
  103788. videoBaseTimestamp = segmentInfo.video[0].dts;
  103789. }
  103790. segmentInfo.video.forEach(function(info) {
  103791. info.dts = handleRollover(info.dts, videoBaseTimestamp);
  103792. info.pts = handleRollover(info.pts, videoBaseTimestamp);
  103793. info.dtsTime = info.dts / ONE_SECOND_IN_TS2;
  103794. info.ptsTime = info.pts / ONE_SECOND_IN_TS2;
  103795. });
  103796. if (segmentInfo.firstKeyFrame) {
  103797. var frame = segmentInfo.firstKeyFrame;
  103798. frame.dts = handleRollover(frame.dts, videoBaseTimestamp);
  103799. frame.pts = handleRollover(frame.pts, videoBaseTimestamp);
  103800. frame.dtsTime = frame.dts / ONE_SECOND_IN_TS2;
  103801. frame.ptsTime = frame.pts / ONE_SECOND_IN_TS2;
  103802. }
  103803. }
  103804. };
  103805. var inspectAac_ = function inspectAac_2(bytes) {
  103806. var endLoop = false, audioCount = 0, sampleRate = null, timestamp = null, frameSize = 0, byteIndex = 0, packet;
  103807. while (bytes.length - byteIndex >= 3) {
  103808. var type3 = probe.aac.parseType(bytes, byteIndex);
  103809. switch (type3) {
  103810. case "timed-metadata":
  103811. if (bytes.length - byteIndex < 10) {
  103812. endLoop = true;
  103813. break;
  103814. }
  103815. frameSize = probe.aac.parseId3TagSize(bytes, byteIndex);
  103816. if (frameSize > bytes.length) {
  103817. endLoop = true;
  103818. break;
  103819. }
  103820. if (timestamp === null) {
  103821. packet = bytes.subarray(byteIndex, byteIndex + frameSize);
  103822. timestamp = probe.aac.parseAacTimestamp(packet);
  103823. }
  103824. byteIndex += frameSize;
  103825. break;
  103826. case "audio":
  103827. if (bytes.length - byteIndex < 7) {
  103828. endLoop = true;
  103829. break;
  103830. }
  103831. frameSize = probe.aac.parseAdtsSize(bytes, byteIndex);
  103832. if (frameSize > bytes.length) {
  103833. endLoop = true;
  103834. break;
  103835. }
  103836. if (sampleRate === null) {
  103837. packet = bytes.subarray(byteIndex, byteIndex + frameSize);
  103838. sampleRate = probe.aac.parseSampleRate(packet);
  103839. }
  103840. audioCount++;
  103841. byteIndex += frameSize;
  103842. break;
  103843. default:
  103844. byteIndex++;
  103845. break;
  103846. }
  103847. if (endLoop) {
  103848. return null;
  103849. }
  103850. }
  103851. if (sampleRate === null || timestamp === null) {
  103852. return null;
  103853. }
  103854. var audioTimescale = ONE_SECOND_IN_TS2 / sampleRate;
  103855. var result = {
  103856. audio: [{
  103857. type: "audio",
  103858. dts: timestamp,
  103859. pts: timestamp
  103860. }, {
  103861. type: "audio",
  103862. dts: timestamp + audioCount * 1024 * audioTimescale,
  103863. pts: timestamp + audioCount * 1024 * audioTimescale
  103864. }]
  103865. };
  103866. return result;
  103867. };
  103868. var inspectTs_ = function inspectTs_2(bytes) {
  103869. var pmt = {
  103870. pid: null,
  103871. table: null
  103872. };
  103873. var result = {};
  103874. parsePsi_(bytes, pmt);
  103875. for (var pid in pmt.table) {
  103876. if (pmt.table.hasOwnProperty(pid)) {
  103877. var type3 = pmt.table[pid];
  103878. switch (type3) {
  103879. case streamTypes.H264_STREAM_TYPE:
  103880. result.video = [];
  103881. parseVideoPes_(bytes, pmt, result);
  103882. if (result.video.length === 0) {
  103883. delete result.video;
  103884. }
  103885. break;
  103886. case streamTypes.ADTS_STREAM_TYPE:
  103887. result.audio = [];
  103888. parseAudioPes_(bytes, pmt, result);
  103889. if (result.audio.length === 0) {
  103890. delete result.audio;
  103891. }
  103892. break;
  103893. }
  103894. }
  103895. }
  103896. return result;
  103897. };
  103898. var inspect = function inspect2(bytes, baseTimestamp) {
  103899. var isAacData = probe.aac.isLikelyAacData(bytes);
  103900. var result;
  103901. if (isAacData) {
  103902. result = inspectAac_(bytes);
  103903. } else {
  103904. result = inspectTs_(bytes);
  103905. }
  103906. if (!result || !result.audio && !result.video) {
  103907. return null;
  103908. }
  103909. adjustTimestamp_(result, baseTimestamp);
  103910. return result;
  103911. };
  103912. var tsInspector = {
  103913. inspect,
  103914. parseAudioPes_
  103915. };
  103916. var wireTransmuxerEvents = function wireTransmuxerEvents2(self2, transmuxer2) {
  103917. transmuxer2.on("data", function(segment) {
  103918. var initArray = segment.initSegment;
  103919. segment.initSegment = {
  103920. data: initArray.buffer,
  103921. byteOffset: initArray.byteOffset,
  103922. byteLength: initArray.byteLength
  103923. };
  103924. var typedArray = segment.data;
  103925. segment.data = typedArray.buffer;
  103926. self2.postMessage({
  103927. action: "data",
  103928. segment,
  103929. byteOffset: typedArray.byteOffset,
  103930. byteLength: typedArray.byteLength
  103931. }, [segment.data]);
  103932. });
  103933. transmuxer2.on("done", function(data) {
  103934. self2.postMessage({
  103935. action: "done"
  103936. });
  103937. });
  103938. transmuxer2.on("gopInfo", function(gopInfo) {
  103939. self2.postMessage({
  103940. action: "gopInfo",
  103941. gopInfo
  103942. });
  103943. });
  103944. transmuxer2.on("videoSegmentTimingInfo", function(timingInfo) {
  103945. var videoSegmentTimingInfo = {
  103946. start: {
  103947. decode: clock2.videoTsToSeconds(timingInfo.start.dts),
  103948. presentation: clock2.videoTsToSeconds(timingInfo.start.pts)
  103949. },
  103950. end: {
  103951. decode: clock2.videoTsToSeconds(timingInfo.end.dts),
  103952. presentation: clock2.videoTsToSeconds(timingInfo.end.pts)
  103953. },
  103954. baseMediaDecodeTime: clock2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)
  103955. };
  103956. if (timingInfo.prependedContentDuration) {
  103957. videoSegmentTimingInfo.prependedContentDuration = clock2.videoTsToSeconds(timingInfo.prependedContentDuration);
  103958. }
  103959. self2.postMessage({
  103960. action: "videoSegmentTimingInfo",
  103961. videoSegmentTimingInfo
  103962. });
  103963. });
  103964. transmuxer2.on("audioSegmentTimingInfo", function(timingInfo) {
  103965. var audioSegmentTimingInfo = {
  103966. start: {
  103967. decode: clock2.videoTsToSeconds(timingInfo.start.dts),
  103968. presentation: clock2.videoTsToSeconds(timingInfo.start.pts)
  103969. },
  103970. end: {
  103971. decode: clock2.videoTsToSeconds(timingInfo.end.dts),
  103972. presentation: clock2.videoTsToSeconds(timingInfo.end.pts)
  103973. },
  103974. baseMediaDecodeTime: clock2.videoTsToSeconds(timingInfo.baseMediaDecodeTime)
  103975. };
  103976. if (timingInfo.prependedContentDuration) {
  103977. audioSegmentTimingInfo.prependedContentDuration = clock2.videoTsToSeconds(timingInfo.prependedContentDuration);
  103978. }
  103979. self2.postMessage({
  103980. action: "audioSegmentTimingInfo",
  103981. audioSegmentTimingInfo
  103982. });
  103983. });
  103984. transmuxer2.on("id3Frame", function(id3Frame) {
  103985. self2.postMessage({
  103986. action: "id3Frame",
  103987. id3Frame
  103988. });
  103989. });
  103990. transmuxer2.on("caption", function(caption) {
  103991. self2.postMessage({
  103992. action: "caption",
  103993. caption
  103994. });
  103995. });
  103996. transmuxer2.on("trackinfo", function(trackInfo) {
  103997. self2.postMessage({
  103998. action: "trackinfo",
  103999. trackInfo
  104000. });
  104001. });
  104002. transmuxer2.on("audioTimingInfo", function(audioTimingInfo) {
  104003. self2.postMessage({
  104004. action: "audioTimingInfo",
  104005. audioTimingInfo: {
  104006. start: clock2.videoTsToSeconds(audioTimingInfo.start),
  104007. end: clock2.videoTsToSeconds(audioTimingInfo.end)
  104008. }
  104009. });
  104010. });
  104011. transmuxer2.on("videoTimingInfo", function(videoTimingInfo) {
  104012. self2.postMessage({
  104013. action: "videoTimingInfo",
  104014. videoTimingInfo: {
  104015. start: clock2.videoTsToSeconds(videoTimingInfo.start),
  104016. end: clock2.videoTsToSeconds(videoTimingInfo.end)
  104017. }
  104018. });
  104019. });
  104020. transmuxer2.on("log", function(log2) {
  104021. self2.postMessage({
  104022. action: "log",
  104023. log: log2
  104024. });
  104025. });
  104026. };
  104027. var MessageHandlers = /* @__PURE__ */ function() {
  104028. function MessageHandlers2(self2, options2) {
  104029. this.options = options2 || {};
  104030. this.self = self2;
  104031. this.init();
  104032. }
  104033. var _proto = MessageHandlers2.prototype;
  104034. _proto.init = function init() {
  104035. if (this.transmuxer) {
  104036. this.transmuxer.dispose();
  104037. }
  104038. this.transmuxer = new transmuxer.Transmuxer(this.options);
  104039. wireTransmuxerEvents(this.self, this.transmuxer);
  104040. };
  104041. _proto.pushMp4Captions = function pushMp4Captions(data) {
  104042. if (!this.captionParser) {
  104043. this.captionParser = new captionParser();
  104044. this.captionParser.init();
  104045. }
  104046. var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);
  104047. var parsed = this.captionParser.parse(segment, data.trackIds, data.timescales);
  104048. this.self.postMessage({
  104049. action: "mp4Captions",
  104050. captions: parsed && parsed.captions || [],
  104051. logs: parsed && parsed.logs || [],
  104052. data: segment.buffer
  104053. }, [segment.buffer]);
  104054. };
  104055. _proto.probeMp4StartTime = function probeMp4StartTime(_ref) {
  104056. var timescales = _ref.timescales, data = _ref.data;
  104057. var startTime2 = probe$2.startTime(timescales, data);
  104058. this.self.postMessage({
  104059. action: "probeMp4StartTime",
  104060. startTime: startTime2,
  104061. data
  104062. }, [data.buffer]);
  104063. };
  104064. _proto.probeMp4Tracks = function probeMp4Tracks(_ref2) {
  104065. var data = _ref2.data;
  104066. var tracks = probe$2.tracks(data);
  104067. this.self.postMessage({
  104068. action: "probeMp4Tracks",
  104069. tracks,
  104070. data
  104071. }, [data.buffer]);
  104072. };
  104073. _proto.probeTs = function probeTs(_ref3) {
  104074. var data = _ref3.data, baseStartTime = _ref3.baseStartTime;
  104075. var tsStartTime = typeof baseStartTime === "number" && !isNaN(baseStartTime) ? baseStartTime * clock2.ONE_SECOND_IN_TS : void 0;
  104076. var timeInfo = tsInspector.inspect(data, tsStartTime);
  104077. var result = null;
  104078. if (timeInfo) {
  104079. result = {
  104080. hasVideo: timeInfo.video && timeInfo.video.length === 2 || false,
  104081. hasAudio: timeInfo.audio && timeInfo.audio.length === 2 || false
  104082. };
  104083. if (result.hasVideo) {
  104084. result.videoStart = timeInfo.video[0].ptsTime;
  104085. }
  104086. if (result.hasAudio) {
  104087. result.audioStart = timeInfo.audio[0].ptsTime;
  104088. }
  104089. }
  104090. this.self.postMessage({
  104091. action: "probeTs",
  104092. result,
  104093. data
  104094. }, [data.buffer]);
  104095. };
  104096. _proto.clearAllMp4Captions = function clearAllMp4Captions() {
  104097. if (this.captionParser) {
  104098. this.captionParser.clearAllCaptions();
  104099. }
  104100. };
  104101. _proto.clearParsedMp4Captions = function clearParsedMp4Captions() {
  104102. if (this.captionParser) {
  104103. this.captionParser.clearParsedCaptions();
  104104. }
  104105. };
  104106. _proto.push = function push(data) {
  104107. var segment = new Uint8Array(data.data, data.byteOffset, data.byteLength);
  104108. this.transmuxer.push(segment);
  104109. };
  104110. _proto.reset = function reset3() {
  104111. this.transmuxer.reset();
  104112. };
  104113. _proto.setTimestampOffset = function setTimestampOffset(data) {
  104114. var timestampOffset2 = data.timestampOffset || 0;
  104115. this.transmuxer.setBaseMediaDecodeTime(Math.round(clock2.secondsToVideoTs(timestampOffset2)));
  104116. };
  104117. _proto.setAudioAppendStart = function setAudioAppendStart(data) {
  104118. this.transmuxer.setAudioAppendStart(Math.ceil(clock2.secondsToVideoTs(data.appendStart)));
  104119. };
  104120. _proto.setRemux = function setRemux(data) {
  104121. this.transmuxer.setRemux(data.remux);
  104122. };
  104123. _proto.flush = function flush(data) {
  104124. this.transmuxer.flush();
  104125. self.postMessage({
  104126. action: "done",
  104127. type: "transmuxed"
  104128. });
  104129. };
  104130. _proto.endTimeline = function endTimeline3() {
  104131. this.transmuxer.endTimeline();
  104132. self.postMessage({
  104133. action: "endedtimeline",
  104134. type: "transmuxed"
  104135. });
  104136. };
  104137. _proto.alignGopsWith = function alignGopsWith(data) {
  104138. this.transmuxer.alignGopsWith(data.gopsToAlignWith.slice());
  104139. };
  104140. return MessageHandlers2;
  104141. }();
  104142. self.onmessage = function(event2) {
  104143. if (event2.data.action === "init" && event2.data.options) {
  104144. this.messageHandlers = new MessageHandlers(self, event2.data.options);
  104145. return;
  104146. }
  104147. if (!this.messageHandlers) {
  104148. this.messageHandlers = new MessageHandlers(self);
  104149. }
  104150. if (event2.data && event2.data.action && event2.data.action !== "init") {
  104151. if (this.messageHandlers[event2.data.action]) {
  104152. this.messageHandlers[event2.data.action](event2.data);
  104153. }
  104154. }
  104155. };
  104156. }));
  104157. var TransmuxWorker = factory(workerCode$1);
  104158. var handleData_ = function handleData_2(event2, transmuxedData, callback2) {
  104159. var _event$data$segment = event2.data.segment, type2 = _event$data$segment.type, initSegment = _event$data$segment.initSegment, captions = _event$data$segment.captions, captionStreams = _event$data$segment.captionStreams, metadata = _event$data$segment.metadata, videoFrameDtsTime = _event$data$segment.videoFrameDtsTime, videoFramePtsTime = _event$data$segment.videoFramePtsTime;
  104160. transmuxedData.buffer.push({
  104161. captions,
  104162. captionStreams,
  104163. metadata
  104164. });
  104165. var boxes = event2.data.segment.boxes || {
  104166. data: event2.data.segment.data
  104167. };
  104168. var result = {
  104169. type: type2,
  104170. data: new Uint8Array(boxes.data, boxes.data.byteOffset, boxes.data.byteLength),
  104171. initSegment: new Uint8Array(initSegment.data, initSegment.byteOffset, initSegment.byteLength)
  104172. };
  104173. if (typeof videoFrameDtsTime !== "undefined") {
  104174. result.videoFrameDtsTime = videoFrameDtsTime;
  104175. }
  104176. if (typeof videoFramePtsTime !== "undefined") {
  104177. result.videoFramePtsTime = videoFramePtsTime;
  104178. }
  104179. callback2(result);
  104180. };
  104181. var handleDone_ = function handleDone_2(_ref) {
  104182. var transmuxedData = _ref.transmuxedData, callback2 = _ref.callback;
  104183. transmuxedData.buffer = [];
  104184. callback2(transmuxedData);
  104185. };
  104186. var handleGopInfo_ = function handleGopInfo_2(event2, transmuxedData) {
  104187. transmuxedData.gopInfo = event2.data.gopInfo;
  104188. };
  104189. var processTransmux = function processTransmux2(options2) {
  104190. var transmuxer = options2.transmuxer, bytes = options2.bytes, audioAppendStart = options2.audioAppendStart, gopsToAlignWith = options2.gopsToAlignWith, remux = options2.remux, onData = options2.onData, onTrackInfo = options2.onTrackInfo, onAudioTimingInfo = options2.onAudioTimingInfo, onVideoTimingInfo = options2.onVideoTimingInfo, onVideoSegmentTimingInfo = options2.onVideoSegmentTimingInfo, onAudioSegmentTimingInfo = options2.onAudioSegmentTimingInfo, onId3 = options2.onId3, onCaptions = options2.onCaptions, onDone = options2.onDone, onEndedTimeline = options2.onEndedTimeline, onTransmuxerLog = options2.onTransmuxerLog, isEndOfTimeline = options2.isEndOfTimeline;
  104191. var transmuxedData = {
  104192. buffer: []
  104193. };
  104194. var waitForEndedTimelineEvent = isEndOfTimeline;
  104195. var handleMessage = function handleMessage2(event2) {
  104196. if (transmuxer.currentTransmux !== options2) {
  104197. return;
  104198. }
  104199. if (event2.data.action === "data") {
  104200. handleData_(event2, transmuxedData, onData);
  104201. }
  104202. if (event2.data.action === "trackinfo") {
  104203. onTrackInfo(event2.data.trackInfo);
  104204. }
  104205. if (event2.data.action === "gopInfo") {
  104206. handleGopInfo_(event2, transmuxedData);
  104207. }
  104208. if (event2.data.action === "audioTimingInfo") {
  104209. onAudioTimingInfo(event2.data.audioTimingInfo);
  104210. }
  104211. if (event2.data.action === "videoTimingInfo") {
  104212. onVideoTimingInfo(event2.data.videoTimingInfo);
  104213. }
  104214. if (event2.data.action === "videoSegmentTimingInfo") {
  104215. onVideoSegmentTimingInfo(event2.data.videoSegmentTimingInfo);
  104216. }
  104217. if (event2.data.action === "audioSegmentTimingInfo") {
  104218. onAudioSegmentTimingInfo(event2.data.audioSegmentTimingInfo);
  104219. }
  104220. if (event2.data.action === "id3Frame") {
  104221. onId3([event2.data.id3Frame], event2.data.id3Frame.dispatchType);
  104222. }
  104223. if (event2.data.action === "caption") {
  104224. onCaptions(event2.data.caption);
  104225. }
  104226. if (event2.data.action === "endedtimeline") {
  104227. waitForEndedTimelineEvent = false;
  104228. onEndedTimeline();
  104229. }
  104230. if (event2.data.action === "log") {
  104231. onTransmuxerLog(event2.data.log);
  104232. }
  104233. if (event2.data.type !== "transmuxed") {
  104234. return;
  104235. }
  104236. if (waitForEndedTimelineEvent) {
  104237. return;
  104238. }
  104239. transmuxer.onmessage = null;
  104240. handleDone_({
  104241. transmuxedData,
  104242. callback: onDone
  104243. });
  104244. dequeue(transmuxer);
  104245. };
  104246. transmuxer.onmessage = handleMessage;
  104247. if (audioAppendStart) {
  104248. transmuxer.postMessage({
  104249. action: "setAudioAppendStart",
  104250. appendStart: audioAppendStart
  104251. });
  104252. }
  104253. if (Array.isArray(gopsToAlignWith)) {
  104254. transmuxer.postMessage({
  104255. action: "alignGopsWith",
  104256. gopsToAlignWith
  104257. });
  104258. }
  104259. if (typeof remux !== "undefined") {
  104260. transmuxer.postMessage({
  104261. action: "setRemux",
  104262. remux
  104263. });
  104264. }
  104265. if (bytes.byteLength) {
  104266. var buffer = bytes instanceof ArrayBuffer ? bytes : bytes.buffer;
  104267. var byteOffset = bytes instanceof ArrayBuffer ? 0 : bytes.byteOffset;
  104268. transmuxer.postMessage({
  104269. action: "push",
  104270. data: buffer,
  104271. byteOffset,
  104272. byteLength: bytes.byteLength
  104273. }, [buffer]);
  104274. }
  104275. if (isEndOfTimeline) {
  104276. transmuxer.postMessage({
  104277. action: "endTimeline"
  104278. });
  104279. }
  104280. transmuxer.postMessage({
  104281. action: "flush"
  104282. });
  104283. };
  104284. var dequeue = function dequeue2(transmuxer) {
  104285. transmuxer.currentTransmux = null;
  104286. if (transmuxer.transmuxQueue.length) {
  104287. transmuxer.currentTransmux = transmuxer.transmuxQueue.shift();
  104288. if (typeof transmuxer.currentTransmux === "function") {
  104289. transmuxer.currentTransmux();
  104290. } else {
  104291. processTransmux(transmuxer.currentTransmux);
  104292. }
  104293. }
  104294. };
  104295. var processAction = function processAction2(transmuxer, action) {
  104296. transmuxer.postMessage({
  104297. action
  104298. });
  104299. dequeue(transmuxer);
  104300. };
  104301. var enqueueAction = function enqueueAction2(action, transmuxer) {
  104302. if (!transmuxer.currentTransmux) {
  104303. transmuxer.currentTransmux = action;
  104304. processAction(transmuxer, action);
  104305. return;
  104306. }
  104307. transmuxer.transmuxQueue.push(processAction.bind(null, transmuxer, action));
  104308. };
  104309. var reset = function reset2(transmuxer) {
  104310. enqueueAction("reset", transmuxer);
  104311. };
  104312. var endTimeline = function endTimeline2(transmuxer) {
  104313. enqueueAction("endTimeline", transmuxer);
  104314. };
  104315. var transmux = function transmux2(options2) {
  104316. if (!options2.transmuxer.currentTransmux) {
  104317. options2.transmuxer.currentTransmux = options2;
  104318. processTransmux(options2);
  104319. return;
  104320. }
  104321. options2.transmuxer.transmuxQueue.push(options2);
  104322. };
  104323. var createTransmuxer = function createTransmuxer2(options2) {
  104324. var transmuxer = new TransmuxWorker();
  104325. transmuxer.currentTransmux = null;
  104326. transmuxer.transmuxQueue = [];
  104327. var term = transmuxer.terminate;
  104328. transmuxer.terminate = function() {
  104329. transmuxer.currentTransmux = null;
  104330. transmuxer.transmuxQueue.length = 0;
  104331. return term.call(transmuxer);
  104332. };
  104333. transmuxer.postMessage({
  104334. action: "init",
  104335. options: options2
  104336. });
  104337. return transmuxer;
  104338. };
  104339. var segmentTransmuxer = {
  104340. reset,
  104341. endTimeline,
  104342. transmux,
  104343. createTransmuxer
  104344. };
  104345. var workerCallback = function workerCallback2(options2) {
  104346. var transmuxer = options2.transmuxer;
  104347. var endAction = options2.endAction || options2.action;
  104348. var callback2 = options2.callback;
  104349. var message = _extends$2({}, options2, {
  104350. endAction: null,
  104351. transmuxer: null,
  104352. callback: null
  104353. });
  104354. var listenForEndEvent = function listenForEndEvent2(event2) {
  104355. if (event2.data.action !== endAction) {
  104356. return;
  104357. }
  104358. transmuxer.removeEventListener("message", listenForEndEvent2);
  104359. if (event2.data.data) {
  104360. event2.data.data = new Uint8Array(event2.data.data, options2.byteOffset || 0, options2.byteLength || event2.data.data.byteLength);
  104361. if (options2.data) {
  104362. options2.data = event2.data.data;
  104363. }
  104364. }
  104365. callback2(event2.data);
  104366. };
  104367. transmuxer.addEventListener("message", listenForEndEvent);
  104368. if (options2.data) {
  104369. var isArrayBuffer = options2.data instanceof ArrayBuffer;
  104370. message.byteOffset = isArrayBuffer ? 0 : options2.data.byteOffset;
  104371. message.byteLength = options2.data.byteLength;
  104372. var transfers = [isArrayBuffer ? options2.data : options2.data.buffer];
  104373. transmuxer.postMessage(message, transfers);
  104374. } else {
  104375. transmuxer.postMessage(message);
  104376. }
  104377. };
  104378. var REQUEST_ERRORS = {
  104379. FAILURE: 2,
  104380. TIMEOUT: -101,
  104381. ABORTED: -102
  104382. };
  104383. var abortAll = function abortAll2(activeXhrs) {
  104384. activeXhrs.forEach(function(xhr) {
  104385. xhr.abort();
  104386. });
  104387. };
  104388. var getRequestStats = function getRequestStats2(request) {
  104389. return {
  104390. bandwidth: request.bandwidth,
  104391. bytesReceived: request.bytesReceived || 0,
  104392. roundTripTime: request.roundTripTime || 0
  104393. };
  104394. };
  104395. var getProgressStats = function getProgressStats2(progressEvent) {
  104396. var request = progressEvent.target;
  104397. var roundTripTime = Date.now() - request.requestTime;
  104398. var stats = {
  104399. bandwidth: Infinity,
  104400. bytesReceived: 0,
  104401. roundTripTime: roundTripTime || 0
  104402. };
  104403. stats.bytesReceived = progressEvent.loaded;
  104404. stats.bandwidth = Math.floor(stats.bytesReceived / stats.roundTripTime * 8 * 1e3);
  104405. return stats;
  104406. };
  104407. var handleErrors = function handleErrors2(error, request) {
  104408. if (request.timedout) {
  104409. return {
  104410. status: request.status,
  104411. message: "HLS request timed-out at URL: " + request.uri,
  104412. code: REQUEST_ERRORS.TIMEOUT,
  104413. xhr: request
  104414. };
  104415. }
  104416. if (request.aborted) {
  104417. return {
  104418. status: request.status,
  104419. message: "HLS request aborted at URL: " + request.uri,
  104420. code: REQUEST_ERRORS.ABORTED,
  104421. xhr: request
  104422. };
  104423. }
  104424. if (error) {
  104425. return {
  104426. status: request.status,
  104427. message: "HLS request errored at URL: " + request.uri,
  104428. code: REQUEST_ERRORS.FAILURE,
  104429. xhr: request
  104430. };
  104431. }
  104432. if (request.responseType === "arraybuffer" && request.response.byteLength === 0) {
  104433. return {
  104434. status: request.status,
  104435. message: "Empty HLS response at URL: " + request.uri,
  104436. code: REQUEST_ERRORS.FAILURE,
  104437. xhr: request
  104438. };
  104439. }
  104440. return null;
  104441. };
  104442. var handleKeyResponse = function handleKeyResponse2(segment, objects, finishProcessingFn) {
  104443. return function(error, request) {
  104444. var response = request.response;
  104445. var errorObj = handleErrors(error, request);
  104446. if (errorObj) {
  104447. return finishProcessingFn(errorObj, segment);
  104448. }
  104449. if (response.byteLength !== 16) {
  104450. return finishProcessingFn({
  104451. status: request.status,
  104452. message: "Invalid HLS key at URL: " + request.uri,
  104453. code: REQUEST_ERRORS.FAILURE,
  104454. xhr: request
  104455. }, segment);
  104456. }
  104457. var view = new DataView(response);
  104458. var bytes = new Uint32Array([view.getUint32(0), view.getUint32(4), view.getUint32(8), view.getUint32(12)]);
  104459. for (var i2 = 0; i2 < objects.length; i2++) {
  104460. objects[i2].bytes = bytes;
  104461. }
  104462. return finishProcessingFn(null, segment);
  104463. };
  104464. };
  104465. var parseInitSegment = function parseInitSegment2(segment, _callback) {
  104466. var type2 = detectContainerForBytes2(segment.map.bytes);
  104467. if (type2 !== "mp4") {
  104468. var uri = segment.map.resolvedUri || segment.map.uri;
  104469. return _callback({
  104470. internal: true,
  104471. message: "Found unsupported " + (type2 || "unknown") + " container for initialization segment at URL: " + uri,
  104472. code: REQUEST_ERRORS.FAILURE
  104473. });
  104474. }
  104475. workerCallback({
  104476. action: "probeMp4Tracks",
  104477. data: segment.map.bytes,
  104478. transmuxer: segment.transmuxer,
  104479. callback: function callback2(_ref) {
  104480. var tracks = _ref.tracks, data = _ref.data;
  104481. segment.map.bytes = data;
  104482. tracks.forEach(function(track) {
  104483. segment.map.tracks = segment.map.tracks || {};
  104484. if (segment.map.tracks[track.type]) {
  104485. return;
  104486. }
  104487. segment.map.tracks[track.type] = track;
  104488. if (typeof track.id === "number" && track.timescale) {
  104489. segment.map.timescales = segment.map.timescales || {};
  104490. segment.map.timescales[track.id] = track.timescale;
  104491. }
  104492. });
  104493. return _callback(null);
  104494. }
  104495. });
  104496. };
  104497. var handleInitSegmentResponse = function handleInitSegmentResponse2(_ref2) {
  104498. var segment = _ref2.segment, finishProcessingFn = _ref2.finishProcessingFn;
  104499. return function(error, request) {
  104500. var errorObj = handleErrors(error, request);
  104501. if (errorObj) {
  104502. return finishProcessingFn(errorObj, segment);
  104503. }
  104504. var bytes = new Uint8Array(request.response);
  104505. if (segment.map.key) {
  104506. segment.map.encryptedBytes = bytes;
  104507. return finishProcessingFn(null, segment);
  104508. }
  104509. segment.map.bytes = bytes;
  104510. parseInitSegment(segment, function(parseError) {
  104511. if (parseError) {
  104512. parseError.xhr = request;
  104513. parseError.status = request.status;
  104514. return finishProcessingFn(parseError, segment);
  104515. }
  104516. finishProcessingFn(null, segment);
  104517. });
  104518. };
  104519. };
  104520. var handleSegmentResponse = function handleSegmentResponse2(_ref3) {
  104521. var segment = _ref3.segment, finishProcessingFn = _ref3.finishProcessingFn, responseType = _ref3.responseType;
  104522. return function(error, request) {
  104523. var errorObj = handleErrors(error, request);
  104524. if (errorObj) {
  104525. return finishProcessingFn(errorObj, segment);
  104526. }
  104527. var newBytes = responseType === "arraybuffer" || !request.responseText ? request.response : stringToArrayBuffer(request.responseText.substring(segment.lastReachedChar || 0));
  104528. segment.stats = getRequestStats(request);
  104529. if (segment.key) {
  104530. segment.encryptedBytes = new Uint8Array(newBytes);
  104531. } else {
  104532. segment.bytes = new Uint8Array(newBytes);
  104533. }
  104534. return finishProcessingFn(null, segment);
  104535. };
  104536. };
  104537. var transmuxAndNotify = function transmuxAndNotify2(_ref4) {
  104538. var segment = _ref4.segment, bytes = _ref4.bytes, trackInfoFn = _ref4.trackInfoFn, timingInfoFn = _ref4.timingInfoFn, videoSegmentTimingInfoFn = _ref4.videoSegmentTimingInfoFn, audioSegmentTimingInfoFn = _ref4.audioSegmentTimingInfoFn, id3Fn = _ref4.id3Fn, captionsFn = _ref4.captionsFn, isEndOfTimeline = _ref4.isEndOfTimeline, endedTimelineFn = _ref4.endedTimelineFn, dataFn = _ref4.dataFn, doneFn = _ref4.doneFn, onTransmuxerLog = _ref4.onTransmuxerLog;
  104539. var fmp4Tracks = segment.map && segment.map.tracks || {};
  104540. var isMuxed3 = Boolean(fmp4Tracks.audio && fmp4Tracks.video);
  104541. var audioStartFn = timingInfoFn.bind(null, segment, "audio", "start");
  104542. var audioEndFn = timingInfoFn.bind(null, segment, "audio", "end");
  104543. var videoStartFn = timingInfoFn.bind(null, segment, "video", "start");
  104544. var videoEndFn = timingInfoFn.bind(null, segment, "video", "end");
  104545. var finish = function finish2() {
  104546. return transmux({
  104547. bytes,
  104548. transmuxer: segment.transmuxer,
  104549. audioAppendStart: segment.audioAppendStart,
  104550. gopsToAlignWith: segment.gopsToAlignWith,
  104551. remux: isMuxed3,
  104552. onData: function onData(result) {
  104553. result.type = result.type === "combined" ? "video" : result.type;
  104554. dataFn(segment, result);
  104555. },
  104556. onTrackInfo: function onTrackInfo(trackInfo) {
  104557. if (trackInfoFn) {
  104558. if (isMuxed3) {
  104559. trackInfo.isMuxed = true;
  104560. }
  104561. trackInfoFn(segment, trackInfo);
  104562. }
  104563. },
  104564. onAudioTimingInfo: function onAudioTimingInfo(audioTimingInfo) {
  104565. if (audioStartFn && typeof audioTimingInfo.start !== "undefined") {
  104566. audioStartFn(audioTimingInfo.start);
  104567. audioStartFn = null;
  104568. }
  104569. if (audioEndFn && typeof audioTimingInfo.end !== "undefined") {
  104570. audioEndFn(audioTimingInfo.end);
  104571. }
  104572. },
  104573. onVideoTimingInfo: function onVideoTimingInfo(videoTimingInfo) {
  104574. if (videoStartFn && typeof videoTimingInfo.start !== "undefined") {
  104575. videoStartFn(videoTimingInfo.start);
  104576. videoStartFn = null;
  104577. }
  104578. if (videoEndFn && typeof videoTimingInfo.end !== "undefined") {
  104579. videoEndFn(videoTimingInfo.end);
  104580. }
  104581. },
  104582. onVideoSegmentTimingInfo: function onVideoSegmentTimingInfo(videoSegmentTimingInfo) {
  104583. videoSegmentTimingInfoFn(videoSegmentTimingInfo);
  104584. },
  104585. onAudioSegmentTimingInfo: function onAudioSegmentTimingInfo(audioSegmentTimingInfo) {
  104586. audioSegmentTimingInfoFn(audioSegmentTimingInfo);
  104587. },
  104588. onId3: function onId3(id3Frames, dispatchType) {
  104589. id3Fn(segment, id3Frames, dispatchType);
  104590. },
  104591. onCaptions: function onCaptions(captions) {
  104592. captionsFn(segment, [captions]);
  104593. },
  104594. isEndOfTimeline,
  104595. onEndedTimeline: function onEndedTimeline() {
  104596. endedTimelineFn();
  104597. },
  104598. onTransmuxerLog,
  104599. onDone: function onDone(result) {
  104600. if (!doneFn) {
  104601. return;
  104602. }
  104603. result.type = result.type === "combined" ? "video" : result.type;
  104604. doneFn(null, segment, result);
  104605. }
  104606. });
  104607. };
  104608. workerCallback({
  104609. action: "probeTs",
  104610. transmuxer: segment.transmuxer,
  104611. data: bytes,
  104612. baseStartTime: segment.baseStartTime,
  104613. callback: function callback2(data) {
  104614. segment.bytes = bytes = data.data;
  104615. var probeResult = data.result;
  104616. if (probeResult) {
  104617. trackInfoFn(segment, {
  104618. hasAudio: probeResult.hasAudio,
  104619. hasVideo: probeResult.hasVideo,
  104620. isMuxed: isMuxed3
  104621. });
  104622. trackInfoFn = null;
  104623. if (probeResult.hasAudio && !isMuxed3) {
  104624. audioStartFn(probeResult.audioStart);
  104625. }
  104626. if (probeResult.hasVideo) {
  104627. videoStartFn(probeResult.videoStart);
  104628. }
  104629. audioStartFn = null;
  104630. videoStartFn = null;
  104631. }
  104632. finish();
  104633. }
  104634. });
  104635. };
  104636. var handleSegmentBytes = function handleSegmentBytes2(_ref5) {
  104637. var segment = _ref5.segment, bytes = _ref5.bytes, trackInfoFn = _ref5.trackInfoFn, timingInfoFn = _ref5.timingInfoFn, videoSegmentTimingInfoFn = _ref5.videoSegmentTimingInfoFn, audioSegmentTimingInfoFn = _ref5.audioSegmentTimingInfoFn, id3Fn = _ref5.id3Fn, captionsFn = _ref5.captionsFn, isEndOfTimeline = _ref5.isEndOfTimeline, endedTimelineFn = _ref5.endedTimelineFn, dataFn = _ref5.dataFn, doneFn = _ref5.doneFn, onTransmuxerLog = _ref5.onTransmuxerLog;
  104638. var bytesAsUint8Array = new Uint8Array(bytes);
  104639. if (isLikelyFmp4MediaSegment2(bytesAsUint8Array)) {
  104640. segment.isFmp4 = true;
  104641. var tracks = segment.map.tracks;
  104642. var trackInfo = {
  104643. isFmp4: true,
  104644. hasVideo: !!tracks.video,
  104645. hasAudio: !!tracks.audio
  104646. };
  104647. if (tracks.audio && tracks.audio.codec && tracks.audio.codec !== "enca") {
  104648. trackInfo.audioCodec = tracks.audio.codec;
  104649. }
  104650. if (tracks.video && tracks.video.codec && tracks.video.codec !== "encv") {
  104651. trackInfo.videoCodec = tracks.video.codec;
  104652. }
  104653. if (tracks.video && tracks.audio) {
  104654. trackInfo.isMuxed = true;
  104655. }
  104656. trackInfoFn(segment, trackInfo);
  104657. var finishLoading = function finishLoading2(captions) {
  104658. dataFn(segment, {
  104659. data: bytesAsUint8Array,
  104660. type: trackInfo.hasAudio && !trackInfo.isMuxed ? "audio" : "video"
  104661. });
  104662. if (captions && captions.length) {
  104663. captionsFn(segment, captions);
  104664. }
  104665. doneFn(null, segment, {});
  104666. };
  104667. workerCallback({
  104668. action: "probeMp4StartTime",
  104669. timescales: segment.map.timescales,
  104670. data: bytesAsUint8Array,
  104671. transmuxer: segment.transmuxer,
  104672. callback: function callback2(_ref6) {
  104673. var data = _ref6.data, startTime = _ref6.startTime;
  104674. bytes = data.buffer;
  104675. segment.bytes = bytesAsUint8Array = data;
  104676. if (trackInfo.hasAudio && !trackInfo.isMuxed) {
  104677. timingInfoFn(segment, "audio", "start", startTime);
  104678. }
  104679. if (trackInfo.hasVideo) {
  104680. timingInfoFn(segment, "video", "start", startTime);
  104681. }
  104682. if (!tracks.video || !data.byteLength || !segment.transmuxer) {
  104683. finishLoading();
  104684. return;
  104685. }
  104686. workerCallback({
  104687. action: "pushMp4Captions",
  104688. endAction: "mp4Captions",
  104689. transmuxer: segment.transmuxer,
  104690. data: bytesAsUint8Array,
  104691. timescales: segment.map.timescales,
  104692. trackIds: [tracks.video.id],
  104693. callback: function callback3(message) {
  104694. bytes = message.data.buffer;
  104695. segment.bytes = bytesAsUint8Array = message.data;
  104696. message.logs.forEach(function(log2) {
  104697. onTransmuxerLog(videojs.mergeOptions(log2, {
  104698. stream: "mp4CaptionParser"
  104699. }));
  104700. });
  104701. finishLoading(message.captions);
  104702. }
  104703. });
  104704. }
  104705. });
  104706. return;
  104707. }
  104708. if (!segment.transmuxer) {
  104709. doneFn(null, segment, {});
  104710. return;
  104711. }
  104712. if (typeof segment.container === "undefined") {
  104713. segment.container = detectContainerForBytes2(bytesAsUint8Array);
  104714. }
  104715. if (segment.container !== "ts" && segment.container !== "aac") {
  104716. trackInfoFn(segment, {
  104717. hasAudio: false,
  104718. hasVideo: false
  104719. });
  104720. doneFn(null, segment, {});
  104721. return;
  104722. }
  104723. transmuxAndNotify({
  104724. segment,
  104725. bytes,
  104726. trackInfoFn,
  104727. timingInfoFn,
  104728. videoSegmentTimingInfoFn,
  104729. audioSegmentTimingInfoFn,
  104730. id3Fn,
  104731. captionsFn,
  104732. isEndOfTimeline,
  104733. endedTimelineFn,
  104734. dataFn,
  104735. doneFn,
  104736. onTransmuxerLog
  104737. });
  104738. };
  104739. var decrypt = function decrypt2(_ref7, callback2) {
  104740. var id = _ref7.id, key = _ref7.key, encryptedBytes = _ref7.encryptedBytes, decryptionWorker = _ref7.decryptionWorker;
  104741. var decryptionHandler = function decryptionHandler2(event2) {
  104742. if (event2.data.source === id) {
  104743. decryptionWorker.removeEventListener("message", decryptionHandler2);
  104744. var decrypted = event2.data.decrypted;
  104745. callback2(new Uint8Array(decrypted.bytes, decrypted.byteOffset, decrypted.byteLength));
  104746. }
  104747. };
  104748. decryptionWorker.addEventListener("message", decryptionHandler);
  104749. var keyBytes;
  104750. if (key.bytes.slice) {
  104751. keyBytes = key.bytes.slice();
  104752. } else {
  104753. keyBytes = new Uint32Array(Array.prototype.slice.call(key.bytes));
  104754. }
  104755. decryptionWorker.postMessage(createTransferableMessage({
  104756. source: id,
  104757. encrypted: encryptedBytes,
  104758. key: keyBytes,
  104759. iv: key.iv
  104760. }), [encryptedBytes.buffer, keyBytes.buffer]);
  104761. };
  104762. var decryptSegment = function decryptSegment2(_ref8) {
  104763. var decryptionWorker = _ref8.decryptionWorker, segment = _ref8.segment, trackInfoFn = _ref8.trackInfoFn, timingInfoFn = _ref8.timingInfoFn, videoSegmentTimingInfoFn = _ref8.videoSegmentTimingInfoFn, audioSegmentTimingInfoFn = _ref8.audioSegmentTimingInfoFn, id3Fn = _ref8.id3Fn, captionsFn = _ref8.captionsFn, isEndOfTimeline = _ref8.isEndOfTimeline, endedTimelineFn = _ref8.endedTimelineFn, dataFn = _ref8.dataFn, doneFn = _ref8.doneFn, onTransmuxerLog = _ref8.onTransmuxerLog;
  104764. decrypt({
  104765. id: segment.requestId,
  104766. key: segment.key,
  104767. encryptedBytes: segment.encryptedBytes,
  104768. decryptionWorker
  104769. }, function(decryptedBytes) {
  104770. segment.bytes = decryptedBytes;
  104771. handleSegmentBytes({
  104772. segment,
  104773. bytes: segment.bytes,
  104774. trackInfoFn,
  104775. timingInfoFn,
  104776. videoSegmentTimingInfoFn,
  104777. audioSegmentTimingInfoFn,
  104778. id3Fn,
  104779. captionsFn,
  104780. isEndOfTimeline,
  104781. endedTimelineFn,
  104782. dataFn,
  104783. doneFn,
  104784. onTransmuxerLog
  104785. });
  104786. });
  104787. };
  104788. var waitForCompletion = function waitForCompletion2(_ref9) {
  104789. var activeXhrs = _ref9.activeXhrs, decryptionWorker = _ref9.decryptionWorker, trackInfoFn = _ref9.trackInfoFn, timingInfoFn = _ref9.timingInfoFn, videoSegmentTimingInfoFn = _ref9.videoSegmentTimingInfoFn, audioSegmentTimingInfoFn = _ref9.audioSegmentTimingInfoFn, id3Fn = _ref9.id3Fn, captionsFn = _ref9.captionsFn, isEndOfTimeline = _ref9.isEndOfTimeline, endedTimelineFn = _ref9.endedTimelineFn, dataFn = _ref9.dataFn, doneFn = _ref9.doneFn, onTransmuxerLog = _ref9.onTransmuxerLog;
  104790. var count = 0;
  104791. var didError = false;
  104792. return function(error, segment) {
  104793. if (didError) {
  104794. return;
  104795. }
  104796. if (error) {
  104797. didError = true;
  104798. abortAll(activeXhrs);
  104799. return doneFn(error, segment);
  104800. }
  104801. count += 1;
  104802. if (count === activeXhrs.length) {
  104803. var segmentFinish = function segmentFinish2() {
  104804. if (segment.encryptedBytes) {
  104805. return decryptSegment({
  104806. decryptionWorker,
  104807. segment,
  104808. trackInfoFn,
  104809. timingInfoFn,
  104810. videoSegmentTimingInfoFn,
  104811. audioSegmentTimingInfoFn,
  104812. id3Fn,
  104813. captionsFn,
  104814. isEndOfTimeline,
  104815. endedTimelineFn,
  104816. dataFn,
  104817. doneFn,
  104818. onTransmuxerLog
  104819. });
  104820. }
  104821. handleSegmentBytes({
  104822. segment,
  104823. bytes: segment.bytes,
  104824. trackInfoFn,
  104825. timingInfoFn,
  104826. videoSegmentTimingInfoFn,
  104827. audioSegmentTimingInfoFn,
  104828. id3Fn,
  104829. captionsFn,
  104830. isEndOfTimeline,
  104831. endedTimelineFn,
  104832. dataFn,
  104833. doneFn,
  104834. onTransmuxerLog
  104835. });
  104836. };
  104837. segment.endOfAllRequests = Date.now();
  104838. if (segment.map && segment.map.encryptedBytes && !segment.map.bytes) {
  104839. return decrypt({
  104840. decryptionWorker,
  104841. id: segment.requestId + "-init",
  104842. encryptedBytes: segment.map.encryptedBytes,
  104843. key: segment.map.key
  104844. }, function(decryptedBytes) {
  104845. segment.map.bytes = decryptedBytes;
  104846. parseInitSegment(segment, function(parseError) {
  104847. if (parseError) {
  104848. abortAll(activeXhrs);
  104849. return doneFn(parseError, segment);
  104850. }
  104851. segmentFinish();
  104852. });
  104853. });
  104854. }
  104855. segmentFinish();
  104856. }
  104857. };
  104858. };
  104859. var handleLoadEnd = function handleLoadEnd2(_ref10) {
  104860. var loadendState = _ref10.loadendState, abortFn = _ref10.abortFn;
  104861. return function(event2) {
  104862. var request = event2.target;
  104863. if (request.aborted && abortFn && !loadendState.calledAbortFn) {
  104864. abortFn();
  104865. loadendState.calledAbortFn = true;
  104866. }
  104867. };
  104868. };
  104869. var handleProgress = function handleProgress2(_ref11) {
  104870. var segment = _ref11.segment, progressFn = _ref11.progressFn;
  104871. _ref11.trackInfoFn;
  104872. _ref11.timingInfoFn;
  104873. _ref11.videoSegmentTimingInfoFn;
  104874. _ref11.audioSegmentTimingInfoFn;
  104875. _ref11.id3Fn;
  104876. _ref11.captionsFn;
  104877. _ref11.isEndOfTimeline;
  104878. _ref11.endedTimelineFn;
  104879. _ref11.dataFn;
  104880. return function(event2) {
  104881. var request = event2.target;
  104882. if (request.aborted) {
  104883. return;
  104884. }
  104885. segment.stats = videojs.mergeOptions(segment.stats, getProgressStats(event2));
  104886. if (!segment.stats.firstBytesReceivedAt && segment.stats.bytesReceived) {
  104887. segment.stats.firstBytesReceivedAt = Date.now();
  104888. }
  104889. return progressFn(event2, segment);
  104890. };
  104891. };
  104892. var mediaSegmentRequest = function mediaSegmentRequest2(_ref12) {
  104893. var xhr = _ref12.xhr, xhrOptions = _ref12.xhrOptions, decryptionWorker = _ref12.decryptionWorker, segment = _ref12.segment, abortFn = _ref12.abortFn, progressFn = _ref12.progressFn, trackInfoFn = _ref12.trackInfoFn, timingInfoFn = _ref12.timingInfoFn, videoSegmentTimingInfoFn = _ref12.videoSegmentTimingInfoFn, audioSegmentTimingInfoFn = _ref12.audioSegmentTimingInfoFn, id3Fn = _ref12.id3Fn, captionsFn = _ref12.captionsFn, isEndOfTimeline = _ref12.isEndOfTimeline, endedTimelineFn = _ref12.endedTimelineFn, dataFn = _ref12.dataFn, doneFn = _ref12.doneFn, onTransmuxerLog = _ref12.onTransmuxerLog;
  104894. var activeXhrs = [];
  104895. var finishProcessingFn = waitForCompletion({
  104896. activeXhrs,
  104897. decryptionWorker,
  104898. trackInfoFn,
  104899. timingInfoFn,
  104900. videoSegmentTimingInfoFn,
  104901. audioSegmentTimingInfoFn,
  104902. id3Fn,
  104903. captionsFn,
  104904. isEndOfTimeline,
  104905. endedTimelineFn,
  104906. dataFn,
  104907. doneFn,
  104908. onTransmuxerLog
  104909. });
  104910. if (segment.key && !segment.key.bytes) {
  104911. var objects = [segment.key];
  104912. if (segment.map && !segment.map.bytes && segment.map.key && segment.map.key.resolvedUri === segment.key.resolvedUri) {
  104913. objects.push(segment.map.key);
  104914. }
  104915. var keyRequestOptions = videojs.mergeOptions(xhrOptions, {
  104916. uri: segment.key.resolvedUri,
  104917. responseType: "arraybuffer"
  104918. });
  104919. var keyRequestCallback = handleKeyResponse(segment, objects, finishProcessingFn);
  104920. var keyXhr = xhr(keyRequestOptions, keyRequestCallback);
  104921. activeXhrs.push(keyXhr);
  104922. }
  104923. if (segment.map && !segment.map.bytes) {
  104924. var differentMapKey = segment.map.key && (!segment.key || segment.key.resolvedUri !== segment.map.key.resolvedUri);
  104925. if (differentMapKey) {
  104926. var mapKeyRequestOptions = videojs.mergeOptions(xhrOptions, {
  104927. uri: segment.map.key.resolvedUri,
  104928. responseType: "arraybuffer"
  104929. });
  104930. var mapKeyRequestCallback = handleKeyResponse(segment, [segment.map.key], finishProcessingFn);
  104931. var mapKeyXhr = xhr(mapKeyRequestOptions, mapKeyRequestCallback);
  104932. activeXhrs.push(mapKeyXhr);
  104933. }
  104934. var initSegmentOptions = videojs.mergeOptions(xhrOptions, {
  104935. uri: segment.map.resolvedUri,
  104936. responseType: "arraybuffer",
  104937. headers: segmentXhrHeaders(segment.map)
  104938. });
  104939. var initSegmentRequestCallback = handleInitSegmentResponse({
  104940. segment,
  104941. finishProcessingFn
  104942. });
  104943. var initSegmentXhr = xhr(initSegmentOptions, initSegmentRequestCallback);
  104944. activeXhrs.push(initSegmentXhr);
  104945. }
  104946. var segmentRequestOptions = videojs.mergeOptions(xhrOptions, {
  104947. uri: segment.part && segment.part.resolvedUri || segment.resolvedUri,
  104948. responseType: "arraybuffer",
  104949. headers: segmentXhrHeaders(segment)
  104950. });
  104951. var segmentRequestCallback = handleSegmentResponse({
  104952. segment,
  104953. finishProcessingFn,
  104954. responseType: segmentRequestOptions.responseType
  104955. });
  104956. var segmentXhr = xhr(segmentRequestOptions, segmentRequestCallback);
  104957. segmentXhr.addEventListener("progress", handleProgress({
  104958. segment,
  104959. progressFn,
  104960. trackInfoFn,
  104961. timingInfoFn,
  104962. videoSegmentTimingInfoFn,
  104963. audioSegmentTimingInfoFn,
  104964. id3Fn,
  104965. captionsFn,
  104966. isEndOfTimeline,
  104967. endedTimelineFn,
  104968. dataFn
  104969. }));
  104970. activeXhrs.push(segmentXhr);
  104971. var loadendState = {};
  104972. activeXhrs.forEach(function(activeXhr) {
  104973. activeXhr.addEventListener("loadend", handleLoadEnd({
  104974. loadendState,
  104975. abortFn
  104976. }));
  104977. });
  104978. return function() {
  104979. return abortAll(activeXhrs);
  104980. };
  104981. };
  104982. var logFn$1 = logger("CodecUtils");
  104983. var getCodecs = function getCodecs2(media) {
  104984. var mediaAttributes = media.attributes || {};
  104985. if (mediaAttributes.CODECS) {
  104986. return parseCodecs2(mediaAttributes.CODECS);
  104987. }
  104988. };
  104989. var isMaat = function isMaat2(master, media) {
  104990. var mediaAttributes = media.attributes || {};
  104991. return master && master.mediaGroups && master.mediaGroups.AUDIO && mediaAttributes.AUDIO && master.mediaGroups.AUDIO[mediaAttributes.AUDIO];
  104992. };
  104993. var isMuxed = function isMuxed2(master, media) {
  104994. if (!isMaat(master, media)) {
  104995. return true;
  104996. }
  104997. var mediaAttributes = media.attributes || {};
  104998. var audioGroup = master.mediaGroups.AUDIO[mediaAttributes.AUDIO];
  104999. for (var groupId in audioGroup) {
  105000. if (!audioGroup[groupId].uri && !audioGroup[groupId].playlists) {
  105001. return true;
  105002. }
  105003. }
  105004. return false;
  105005. };
  105006. var unwrapCodecList = function unwrapCodecList2(codecList) {
  105007. var codecs = {};
  105008. codecList.forEach(function(_ref) {
  105009. var mediaType = _ref.mediaType, type2 = _ref.type, details = _ref.details;
  105010. codecs[mediaType] = codecs[mediaType] || [];
  105011. codecs[mediaType].push(translateLegacyCodec2("" + type2 + details));
  105012. });
  105013. Object.keys(codecs).forEach(function(mediaType) {
  105014. if (codecs[mediaType].length > 1) {
  105015. logFn$1("multiple " + mediaType + " codecs found as attributes: " + codecs[mediaType].join(", ") + ". Setting playlist codecs to null so that we wait for mux.js to probe segments for real codecs.");
  105016. codecs[mediaType] = null;
  105017. return;
  105018. }
  105019. codecs[mediaType] = codecs[mediaType][0];
  105020. });
  105021. return codecs;
  105022. };
  105023. var codecCount = function codecCount2(codecObj) {
  105024. var count = 0;
  105025. if (codecObj.audio) {
  105026. count++;
  105027. }
  105028. if (codecObj.video) {
  105029. count++;
  105030. }
  105031. return count;
  105032. };
  105033. var codecsForPlaylist = function codecsForPlaylist2(master, media) {
  105034. var mediaAttributes = media.attributes || {};
  105035. var codecInfo = unwrapCodecList(getCodecs(media) || []);
  105036. if (isMaat(master, media) && !codecInfo.audio) {
  105037. if (!isMuxed(master, media)) {
  105038. var defaultCodecs = unwrapCodecList(codecsFromDefault2(master, mediaAttributes.AUDIO) || []);
  105039. if (defaultCodecs.audio) {
  105040. codecInfo.audio = defaultCodecs.audio;
  105041. }
  105042. }
  105043. }
  105044. return codecInfo;
  105045. };
  105046. var logFn = logger("PlaylistSelector");
  105047. var representationToString = function representationToString2(representation) {
  105048. if (!representation || !representation.playlist) {
  105049. return;
  105050. }
  105051. var playlist = representation.playlist;
  105052. return JSON.stringify({
  105053. id: playlist.id,
  105054. bandwidth: representation.bandwidth,
  105055. width: representation.width,
  105056. height: representation.height,
  105057. codecs: playlist.attributes && playlist.attributes.CODECS || ""
  105058. });
  105059. };
  105060. var safeGetComputedStyle = function safeGetComputedStyle2(el, property) {
  105061. if (!el) {
  105062. return "";
  105063. }
  105064. var result = window_1.getComputedStyle(el);
  105065. if (!result) {
  105066. return "";
  105067. }
  105068. return result[property];
  105069. };
  105070. var stableSort = function stableSort2(array, sortFn) {
  105071. var newArray = array.slice();
  105072. array.sort(function(left, right) {
  105073. var cmp = sortFn(left, right);
  105074. if (cmp === 0) {
  105075. return newArray.indexOf(left) - newArray.indexOf(right);
  105076. }
  105077. return cmp;
  105078. });
  105079. };
  105080. var comparePlaylistBandwidth = function comparePlaylistBandwidth2(left, right) {
  105081. var leftBandwidth;
  105082. var rightBandwidth;
  105083. if (left.attributes.BANDWIDTH) {
  105084. leftBandwidth = left.attributes.BANDWIDTH;
  105085. }
  105086. leftBandwidth = leftBandwidth || window_1.Number.MAX_VALUE;
  105087. if (right.attributes.BANDWIDTH) {
  105088. rightBandwidth = right.attributes.BANDWIDTH;
  105089. }
  105090. rightBandwidth = rightBandwidth || window_1.Number.MAX_VALUE;
  105091. return leftBandwidth - rightBandwidth;
  105092. };
  105093. var comparePlaylistResolution = function comparePlaylistResolution2(left, right) {
  105094. var leftWidth;
  105095. var rightWidth;
  105096. if (left.attributes.RESOLUTION && left.attributes.RESOLUTION.width) {
  105097. leftWidth = left.attributes.RESOLUTION.width;
  105098. }
  105099. leftWidth = leftWidth || window_1.Number.MAX_VALUE;
  105100. if (right.attributes.RESOLUTION && right.attributes.RESOLUTION.width) {
  105101. rightWidth = right.attributes.RESOLUTION.width;
  105102. }
  105103. rightWidth = rightWidth || window_1.Number.MAX_VALUE;
  105104. if (leftWidth === rightWidth && left.attributes.BANDWIDTH && right.attributes.BANDWIDTH) {
  105105. return left.attributes.BANDWIDTH - right.attributes.BANDWIDTH;
  105106. }
  105107. return leftWidth - rightWidth;
  105108. };
  105109. var simpleSelector = function simpleSelector2(master, playerBandwidth, playerWidth, playerHeight, limitRenditionByPlayerDimensions, masterPlaylistController) {
  105110. if (!master) {
  105111. return;
  105112. }
  105113. var options2 = {
  105114. bandwidth: playerBandwidth,
  105115. width: playerWidth,
  105116. height: playerHeight,
  105117. limitRenditionByPlayerDimensions
  105118. };
  105119. var playlists = master.playlists;
  105120. if (Playlist.isAudioOnly(master)) {
  105121. playlists = masterPlaylistController.getAudioTrackPlaylists_();
  105122. options2.audioOnly = true;
  105123. }
  105124. var sortedPlaylistReps = playlists.map(function(playlist) {
  105125. var bandwidth2;
  105126. var width2 = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.width;
  105127. var height2 = playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height;
  105128. bandwidth2 = playlist.attributes && playlist.attributes.BANDWIDTH;
  105129. bandwidth2 = bandwidth2 || window_1.Number.MAX_VALUE;
  105130. return {
  105131. bandwidth: bandwidth2,
  105132. width: width2,
  105133. height: height2,
  105134. playlist
  105135. };
  105136. });
  105137. stableSort(sortedPlaylistReps, function(left, right) {
  105138. return left.bandwidth - right.bandwidth;
  105139. });
  105140. sortedPlaylistReps = sortedPlaylistReps.filter(function(rep2) {
  105141. return !Playlist.isIncompatible(rep2.playlist);
  105142. });
  105143. var enabledPlaylistReps = sortedPlaylistReps.filter(function(rep2) {
  105144. return Playlist.isEnabled(rep2.playlist);
  105145. });
  105146. if (!enabledPlaylistReps.length) {
  105147. enabledPlaylistReps = sortedPlaylistReps.filter(function(rep2) {
  105148. return !Playlist.isDisabled(rep2.playlist);
  105149. });
  105150. }
  105151. var bandwidthPlaylistReps = enabledPlaylistReps.filter(function(rep2) {
  105152. return rep2.bandwidth * Config.BANDWIDTH_VARIANCE < playerBandwidth;
  105153. });
  105154. var highestRemainingBandwidthRep = bandwidthPlaylistReps[bandwidthPlaylistReps.length - 1];
  105155. var bandwidthBestRep = bandwidthPlaylistReps.filter(function(rep2) {
  105156. return rep2.bandwidth === highestRemainingBandwidthRep.bandwidth;
  105157. })[0];
  105158. if (limitRenditionByPlayerDimensions === false) {
  105159. var _chosenRep = bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];
  105160. if (_chosenRep && _chosenRep.playlist) {
  105161. var type2 = "sortedPlaylistReps";
  105162. if (bandwidthBestRep) {
  105163. type2 = "bandwidthBestRep";
  105164. }
  105165. if (enabledPlaylistReps[0]) {
  105166. type2 = "enabledPlaylistReps";
  105167. }
  105168. logFn("choosing " + representationToString(_chosenRep) + " using " + type2 + " with options", options2);
  105169. return _chosenRep.playlist;
  105170. }
  105171. logFn("could not choose a playlist with options", options2);
  105172. return null;
  105173. }
  105174. var haveResolution = bandwidthPlaylistReps.filter(function(rep2) {
  105175. return rep2.width && rep2.height;
  105176. });
  105177. stableSort(haveResolution, function(left, right) {
  105178. return left.width - right.width;
  105179. });
  105180. var resolutionBestRepList = haveResolution.filter(function(rep2) {
  105181. return rep2.width === playerWidth && rep2.height === playerHeight;
  105182. });
  105183. highestRemainingBandwidthRep = resolutionBestRepList[resolutionBestRepList.length - 1];
  105184. var resolutionBestRep = resolutionBestRepList.filter(function(rep2) {
  105185. return rep2.bandwidth === highestRemainingBandwidthRep.bandwidth;
  105186. })[0];
  105187. var resolutionPlusOneList;
  105188. var resolutionPlusOneSmallest;
  105189. var resolutionPlusOneRep;
  105190. if (!resolutionBestRep) {
  105191. resolutionPlusOneList = haveResolution.filter(function(rep2) {
  105192. return rep2.width > playerWidth || rep2.height > playerHeight;
  105193. });
  105194. resolutionPlusOneSmallest = resolutionPlusOneList.filter(function(rep2) {
  105195. return rep2.width === resolutionPlusOneList[0].width && rep2.height === resolutionPlusOneList[0].height;
  105196. });
  105197. highestRemainingBandwidthRep = resolutionPlusOneSmallest[resolutionPlusOneSmallest.length - 1];
  105198. resolutionPlusOneRep = resolutionPlusOneSmallest.filter(function(rep2) {
  105199. return rep2.bandwidth === highestRemainingBandwidthRep.bandwidth;
  105200. })[0];
  105201. }
  105202. var leastPixelDiffRep;
  105203. if (masterPlaylistController.experimentalLeastPixelDiffSelector) {
  105204. var leastPixelDiffList = haveResolution.map(function(rep2) {
  105205. rep2.pixelDiff = Math.abs(rep2.width - playerWidth) + Math.abs(rep2.height - playerHeight);
  105206. return rep2;
  105207. });
  105208. stableSort(leastPixelDiffList, function(left, right) {
  105209. if (left.pixelDiff === right.pixelDiff) {
  105210. return right.bandwidth - left.bandwidth;
  105211. }
  105212. return left.pixelDiff - right.pixelDiff;
  105213. });
  105214. leastPixelDiffRep = leastPixelDiffList[0];
  105215. }
  105216. var chosenRep = leastPixelDiffRep || resolutionPlusOneRep || resolutionBestRep || bandwidthBestRep || enabledPlaylistReps[0] || sortedPlaylistReps[0];
  105217. if (chosenRep && chosenRep.playlist) {
  105218. var _type = "sortedPlaylistReps";
  105219. if (leastPixelDiffRep) {
  105220. _type = "leastPixelDiffRep";
  105221. } else if (resolutionPlusOneRep) {
  105222. _type = "resolutionPlusOneRep";
  105223. } else if (resolutionBestRep) {
  105224. _type = "resolutionBestRep";
  105225. } else if (bandwidthBestRep) {
  105226. _type = "bandwidthBestRep";
  105227. } else if (enabledPlaylistReps[0]) {
  105228. _type = "enabledPlaylistReps";
  105229. }
  105230. logFn("choosing " + representationToString(chosenRep) + " using " + _type + " with options", options2);
  105231. return chosenRep.playlist;
  105232. }
  105233. logFn("could not choose a playlist with options", options2);
  105234. return null;
  105235. };
  105236. var lastBandwidthSelector = function lastBandwidthSelector2() {
  105237. var pixelRatio = this.useDevicePixelRatio ? window_1.devicePixelRatio || 1 : 1;
  105238. return simpleSelector(this.playlists.master, this.systemBandwidth, parseInt(safeGetComputedStyle(this.tech_.el(), "width"), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), "height"), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_);
  105239. };
  105240. var movingAverageBandwidthSelector = function movingAverageBandwidthSelector2(decay) {
  105241. var average = -1;
  105242. var lastSystemBandwidth = -1;
  105243. if (decay < 0 || decay > 1) {
  105244. throw new Error("Moving average bandwidth decay must be between 0 and 1.");
  105245. }
  105246. return function() {
  105247. var pixelRatio = this.useDevicePixelRatio ? window_1.devicePixelRatio || 1 : 1;
  105248. if (average < 0) {
  105249. average = this.systemBandwidth;
  105250. lastSystemBandwidth = this.systemBandwidth;
  105251. }
  105252. if (this.systemBandwidth > 0 && this.systemBandwidth !== lastSystemBandwidth) {
  105253. average = decay * this.systemBandwidth + (1 - decay) * average;
  105254. lastSystemBandwidth = this.systemBandwidth;
  105255. }
  105256. return simpleSelector(this.playlists.master, average, parseInt(safeGetComputedStyle(this.tech_.el(), "width"), 10) * pixelRatio, parseInt(safeGetComputedStyle(this.tech_.el(), "height"), 10) * pixelRatio, this.limitRenditionByPlayerDimensions, this.masterPlaylistController_);
  105257. };
  105258. };
  105259. var minRebufferMaxBandwidthSelector = function minRebufferMaxBandwidthSelector2(settings) {
  105260. var master = settings.master, currentTime = settings.currentTime, bandwidth2 = settings.bandwidth, duration5 = settings.duration, segmentDuration = settings.segmentDuration, timeUntilRebuffer3 = settings.timeUntilRebuffer, currentTimeline = settings.currentTimeline, syncController = settings.syncController;
  105261. var compatiblePlaylists = master.playlists.filter(function(playlist) {
  105262. return !Playlist.isIncompatible(playlist);
  105263. });
  105264. var enabledPlaylists = compatiblePlaylists.filter(Playlist.isEnabled);
  105265. if (!enabledPlaylists.length) {
  105266. enabledPlaylists = compatiblePlaylists.filter(function(playlist) {
  105267. return !Playlist.isDisabled(playlist);
  105268. });
  105269. }
  105270. var bandwidthPlaylists = enabledPlaylists.filter(Playlist.hasAttribute.bind(null, "BANDWIDTH"));
  105271. var rebufferingEstimates = bandwidthPlaylists.map(function(playlist) {
  105272. var syncPoint = syncController.getSyncPoint(playlist, duration5, currentTimeline, currentTime);
  105273. var numRequests = syncPoint ? 1 : 2;
  105274. var requestTimeEstimate = Playlist.estimateSegmentRequestTime(segmentDuration, bandwidth2, playlist);
  105275. var rebufferingImpact = requestTimeEstimate * numRequests - timeUntilRebuffer3;
  105276. return {
  105277. playlist,
  105278. rebufferingImpact
  105279. };
  105280. });
  105281. var noRebufferingPlaylists = rebufferingEstimates.filter(function(estimate) {
  105282. return estimate.rebufferingImpact <= 0;
  105283. });
  105284. stableSort(noRebufferingPlaylists, function(a, b) {
  105285. return comparePlaylistBandwidth(b.playlist, a.playlist);
  105286. });
  105287. if (noRebufferingPlaylists.length) {
  105288. return noRebufferingPlaylists[0];
  105289. }
  105290. stableSort(rebufferingEstimates, function(a, b) {
  105291. return a.rebufferingImpact - b.rebufferingImpact;
  105292. });
  105293. return rebufferingEstimates[0] || null;
  105294. };
  105295. var lowestBitrateCompatibleVariantSelector = function lowestBitrateCompatibleVariantSelector2() {
  105296. var _this = this;
  105297. var playlists = this.playlists.master.playlists.filter(Playlist.isEnabled);
  105298. stableSort(playlists, function(a, b) {
  105299. return comparePlaylistBandwidth(a, b);
  105300. });
  105301. var playlistsWithVideo = playlists.filter(function(playlist) {
  105302. return !!codecsForPlaylist(_this.playlists.master, playlist).video;
  105303. });
  105304. return playlistsWithVideo[0] || null;
  105305. };
  105306. var concatSegments = function concatSegments2(segmentObj) {
  105307. var offset = 0;
  105308. var tempBuffer;
  105309. if (segmentObj.bytes) {
  105310. tempBuffer = new Uint8Array(segmentObj.bytes);
  105311. segmentObj.segments.forEach(function(segment) {
  105312. tempBuffer.set(segment, offset);
  105313. offset += segment.byteLength;
  105314. });
  105315. }
  105316. return tempBuffer;
  105317. };
  105318. var createCaptionsTrackIfNotExists = function createCaptionsTrackIfNotExists2(inbandTextTracks, tech, captionStream) {
  105319. if (!inbandTextTracks[captionStream]) {
  105320. tech.trigger({
  105321. type: "usage",
  105322. name: "vhs-608"
  105323. });
  105324. tech.trigger({
  105325. type: "usage",
  105326. name: "hls-608"
  105327. });
  105328. var instreamId = captionStream;
  105329. if (/^cc708_/.test(captionStream)) {
  105330. instreamId = "SERVICE" + captionStream.split("_")[1];
  105331. }
  105332. var track = tech.textTracks().getTrackById(instreamId);
  105333. if (track) {
  105334. inbandTextTracks[captionStream] = track;
  105335. } else {
  105336. var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};
  105337. var label = captionStream;
  105338. var language = captionStream;
  105339. var def = false;
  105340. var captionService = captionServices[instreamId];
  105341. if (captionService) {
  105342. label = captionService.label;
  105343. language = captionService.language;
  105344. def = captionService["default"];
  105345. }
  105346. inbandTextTracks[captionStream] = tech.addRemoteTextTrack({
  105347. kind: "captions",
  105348. id: instreamId,
  105349. "default": def,
  105350. label,
  105351. language
  105352. }, false).track;
  105353. }
  105354. }
  105355. };
  105356. var addCaptionData = function addCaptionData2(_ref) {
  105357. var inbandTextTracks = _ref.inbandTextTracks, captionArray = _ref.captionArray, timestampOffset2 = _ref.timestampOffset;
  105358. if (!captionArray) {
  105359. return;
  105360. }
  105361. var Cue = window_1.WebKitDataCue || window_1.VTTCue;
  105362. captionArray.forEach(function(caption) {
  105363. var track = caption.stream;
  105364. inbandTextTracks[track].addCue(new Cue(caption.startTime + timestampOffset2, caption.endTime + timestampOffset2, caption.text));
  105365. });
  105366. };
  105367. var deprecateOldCue = function deprecateOldCue2(cue) {
  105368. Object.defineProperties(cue.frame, {
  105369. id: {
  105370. get: function get7() {
  105371. videojs.log.warn("cue.frame.id is deprecated. Use cue.value.key instead.");
  105372. return cue.value.key;
  105373. }
  105374. },
  105375. value: {
  105376. get: function get7() {
  105377. videojs.log.warn("cue.frame.value is deprecated. Use cue.value.data instead.");
  105378. return cue.value.data;
  105379. }
  105380. },
  105381. privateData: {
  105382. get: function get7() {
  105383. videojs.log.warn("cue.frame.privateData is deprecated. Use cue.value.data instead.");
  105384. return cue.value.data;
  105385. }
  105386. }
  105387. });
  105388. };
  105389. var addMetadata = function addMetadata2(_ref2) {
  105390. var inbandTextTracks = _ref2.inbandTextTracks, metadataArray = _ref2.metadataArray, timestampOffset2 = _ref2.timestampOffset, videoDuration = _ref2.videoDuration;
  105391. if (!metadataArray) {
  105392. return;
  105393. }
  105394. var Cue = window_1.WebKitDataCue || window_1.VTTCue;
  105395. var metadataTrack = inbandTextTracks.metadataTrack_;
  105396. if (!metadataTrack) {
  105397. return;
  105398. }
  105399. metadataArray.forEach(function(metadata) {
  105400. var time = metadata.cueTime + timestampOffset2;
  105401. if (typeof time !== "number" || window_1.isNaN(time) || time < 0 || !(time < Infinity)) {
  105402. return;
  105403. }
  105404. metadata.frames.forEach(function(frame) {
  105405. var cue = new Cue(time, time, frame.value || frame.url || frame.data || "");
  105406. cue.frame = frame;
  105407. cue.value = frame;
  105408. deprecateOldCue(cue);
  105409. metadataTrack.addCue(cue);
  105410. });
  105411. });
  105412. if (!metadataTrack.cues || !metadataTrack.cues.length) {
  105413. return;
  105414. }
  105415. var cues = metadataTrack.cues;
  105416. var cuesArray = [];
  105417. for (var i2 = 0; i2 < cues.length; i2++) {
  105418. if (cues[i2]) {
  105419. cuesArray.push(cues[i2]);
  105420. }
  105421. }
  105422. var cuesGroupedByStartTime = cuesArray.reduce(function(obj, cue) {
  105423. var timeSlot = obj[cue.startTime] || [];
  105424. timeSlot.push(cue);
  105425. obj[cue.startTime] = timeSlot;
  105426. return obj;
  105427. }, {});
  105428. var sortedStartTimes = Object.keys(cuesGroupedByStartTime).sort(function(a, b) {
  105429. return Number(a) - Number(b);
  105430. });
  105431. sortedStartTimes.forEach(function(startTime, idx) {
  105432. var cueGroup = cuesGroupedByStartTime[startTime];
  105433. var nextTime = Number(sortedStartTimes[idx + 1]) || videoDuration;
  105434. cueGroup.forEach(function(cue) {
  105435. cue.endTime = nextTime;
  105436. });
  105437. });
  105438. };
  105439. var createMetadataTrackIfNotExists = function createMetadataTrackIfNotExists2(inbandTextTracks, dispatchType, tech) {
  105440. if (inbandTextTracks.metadataTrack_) {
  105441. return;
  105442. }
  105443. inbandTextTracks.metadataTrack_ = tech.addRemoteTextTrack({
  105444. kind: "metadata",
  105445. label: "Timed Metadata"
  105446. }, false).track;
  105447. inbandTextTracks.metadataTrack_.inBandMetadataTrackDispatchType = dispatchType;
  105448. };
  105449. var removeCuesFromTrack = function removeCuesFromTrack2(start2, end, track) {
  105450. var i2;
  105451. var cue;
  105452. if (!track) {
  105453. return;
  105454. }
  105455. if (!track.cues) {
  105456. return;
  105457. }
  105458. i2 = track.cues.length;
  105459. while (i2--) {
  105460. cue = track.cues[i2];
  105461. if (cue.startTime >= start2 && cue.endTime <= end) {
  105462. track.removeCue(cue);
  105463. }
  105464. }
  105465. };
  105466. var removeDuplicateCuesFromTrack = function removeDuplicateCuesFromTrack2(track) {
  105467. var cues = track.cues;
  105468. if (!cues) {
  105469. return;
  105470. }
  105471. for (var i2 = 0; i2 < cues.length; i2++) {
  105472. var duplicates = [];
  105473. var occurrences = 0;
  105474. for (var j = 0; j < cues.length; j++) {
  105475. if (cues[i2].startTime === cues[j].startTime && cues[i2].endTime === cues[j].endTime && cues[i2].text === cues[j].text) {
  105476. occurrences++;
  105477. if (occurrences > 1) {
  105478. duplicates.push(cues[j]);
  105479. }
  105480. }
  105481. }
  105482. if (duplicates.length) {
  105483. duplicates.forEach(function(dupe) {
  105484. return track.removeCue(dupe);
  105485. });
  105486. }
  105487. }
  105488. };
  105489. var gopsSafeToAlignWith = function gopsSafeToAlignWith2(buffer, currentTime, mapping) {
  105490. if (typeof currentTime === "undefined" || currentTime === null || !buffer.length) {
  105491. return [];
  105492. }
  105493. var currentTimePts = Math.ceil((currentTime - mapping + 3) * clock.ONE_SECOND_IN_TS);
  105494. var i2;
  105495. for (i2 = 0; i2 < buffer.length; i2++) {
  105496. if (buffer[i2].pts > currentTimePts) {
  105497. break;
  105498. }
  105499. }
  105500. return buffer.slice(i2);
  105501. };
  105502. var updateGopBuffer = function updateGopBuffer2(buffer, gops, replace) {
  105503. if (!gops.length) {
  105504. return buffer;
  105505. }
  105506. if (replace) {
  105507. return gops.slice();
  105508. }
  105509. var start2 = gops[0].pts;
  105510. var i2 = 0;
  105511. for (i2; i2 < buffer.length; i2++) {
  105512. if (buffer[i2].pts >= start2) {
  105513. break;
  105514. }
  105515. }
  105516. return buffer.slice(0, i2).concat(gops);
  105517. };
  105518. var removeGopBuffer = function removeGopBuffer2(buffer, start2, end, mapping) {
  105519. var startPts = Math.ceil((start2 - mapping) * clock.ONE_SECOND_IN_TS);
  105520. var endPts = Math.ceil((end - mapping) * clock.ONE_SECOND_IN_TS);
  105521. var updatedBuffer = buffer.slice();
  105522. var i2 = buffer.length;
  105523. while (i2--) {
  105524. if (buffer[i2].pts <= endPts) {
  105525. break;
  105526. }
  105527. }
  105528. if (i2 === -1) {
  105529. return updatedBuffer;
  105530. }
  105531. var j = i2 + 1;
  105532. while (j--) {
  105533. if (buffer[j].pts <= startPts) {
  105534. break;
  105535. }
  105536. }
  105537. j = Math.max(j, 0);
  105538. updatedBuffer.splice(j, i2 - j + 1);
  105539. return updatedBuffer;
  105540. };
  105541. var shallowEqual = function shallowEqual2(a, b) {
  105542. if (!a && !b || !a && b || a && !b) {
  105543. return false;
  105544. }
  105545. if (a === b) {
  105546. return true;
  105547. }
  105548. var akeys = Object.keys(a).sort();
  105549. var bkeys = Object.keys(b).sort();
  105550. if (akeys.length !== bkeys.length) {
  105551. return false;
  105552. }
  105553. for (var i2 = 0; i2 < akeys.length; i2++) {
  105554. var key = akeys[i2];
  105555. if (key !== bkeys[i2]) {
  105556. return false;
  105557. }
  105558. if (a[key] !== b[key]) {
  105559. return false;
  105560. }
  105561. }
  105562. return true;
  105563. };
  105564. var QUOTA_EXCEEDED_ERR = 22;
  105565. var getSyncSegmentCandidate = function getSyncSegmentCandidate2(currentTimeline, segments, targetTime) {
  105566. segments = segments || [];
  105567. var timelineSegments = [];
  105568. var time = 0;
  105569. for (var i2 = 0; i2 < segments.length; i2++) {
  105570. var segment = segments[i2];
  105571. if (currentTimeline === segment.timeline) {
  105572. timelineSegments.push(i2);
  105573. time += segment.duration;
  105574. if (time > targetTime) {
  105575. return i2;
  105576. }
  105577. }
  105578. }
  105579. if (timelineSegments.length === 0) {
  105580. return 0;
  105581. }
  105582. return timelineSegments[timelineSegments.length - 1];
  105583. };
  105584. var MIN_BACK_BUFFER = 1;
  105585. var CHECK_BUFFER_DELAY = 500;
  105586. var finite = function finite2(num) {
  105587. return typeof num === "number" && isFinite(num);
  105588. };
  105589. var MIN_SEGMENT_DURATION_TO_SAVE_STATS = 1 / 60;
  105590. var illegalMediaSwitch = function illegalMediaSwitch2(loaderType, startingMedia, trackInfo) {
  105591. if (loaderType !== "main" || !startingMedia || !trackInfo) {
  105592. return null;
  105593. }
  105594. if (!trackInfo.hasAudio && !trackInfo.hasVideo) {
  105595. return "Neither audio nor video found in segment.";
  105596. }
  105597. if (startingMedia.hasVideo && !trackInfo.hasVideo) {
  105598. return "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.";
  105599. }
  105600. if (!startingMedia.hasVideo && trackInfo.hasVideo) {
  105601. return "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.";
  105602. }
  105603. return null;
  105604. };
  105605. var safeBackBufferTrimTime = function safeBackBufferTrimTime2(seekable3, currentTime, targetDuration) {
  105606. var trimTime = currentTime - Config.BACK_BUFFER_LENGTH;
  105607. if (seekable3.length) {
  105608. trimTime = Math.max(trimTime, seekable3.start(0));
  105609. }
  105610. var maxTrimTime = currentTime - targetDuration;
  105611. return Math.min(maxTrimTime, trimTime);
  105612. };
  105613. var segmentInfoString = function segmentInfoString2(segmentInfo) {
  105614. var startOfSegment = segmentInfo.startOfSegment, duration5 = segmentInfo.duration, segment = segmentInfo.segment, part = segmentInfo.part, _segmentInfo$playlist = segmentInfo.playlist, seq = _segmentInfo$playlist.mediaSequence, id = _segmentInfo$playlist.id, _segmentInfo$playlist2 = _segmentInfo$playlist.segments, segments = _segmentInfo$playlist2 === void 0 ? [] : _segmentInfo$playlist2, index2 = segmentInfo.mediaIndex, partIndex = segmentInfo.partIndex, timeline = segmentInfo.timeline;
  105615. var segmentLen = segments.length - 1;
  105616. var selection = "mediaIndex/partIndex increment";
  105617. if (segmentInfo.getMediaInfoForTime) {
  105618. selection = "getMediaInfoForTime (" + segmentInfo.getMediaInfoForTime + ")";
  105619. } else if (segmentInfo.isSyncRequest) {
  105620. selection = "getSyncSegmentCandidate (isSyncRequest)";
  105621. }
  105622. if (segmentInfo.independent) {
  105623. selection += " with independent " + segmentInfo.independent;
  105624. }
  105625. var hasPartIndex = typeof partIndex === "number";
  105626. var name = segmentInfo.segment.uri ? "segment" : "pre-segment";
  105627. var zeroBasedPartCount = hasPartIndex ? getKnownPartCount({
  105628. preloadSegment: segment
  105629. }) - 1 : 0;
  105630. return name + " [" + (seq + index2) + "/" + (seq + segmentLen) + "]" + (hasPartIndex ? " part [" + partIndex + "/" + zeroBasedPartCount + "]" : "") + (" segment start/end [" + segment.start + " => " + segment.end + "]") + (hasPartIndex ? " part start/end [" + part.start + " => " + part.end + "]" : "") + (" startOfSegment [" + startOfSegment + "]") + (" duration [" + duration5 + "]") + (" timeline [" + timeline + "]") + (" selected by [" + selection + "]") + (" playlist [" + id + "]");
  105631. };
  105632. var timingInfoPropertyForMedia = function timingInfoPropertyForMedia2(mediaType) {
  105633. return mediaType + "TimingInfo";
  105634. };
  105635. var timestampOffsetForSegment = function timestampOffsetForSegment2(_ref) {
  105636. var segmentTimeline = _ref.segmentTimeline, currentTimeline = _ref.currentTimeline, startOfSegment = _ref.startOfSegment, buffered = _ref.buffered, overrideCheck = _ref.overrideCheck;
  105637. if (!overrideCheck && segmentTimeline === currentTimeline) {
  105638. return null;
  105639. }
  105640. if (segmentTimeline < currentTimeline) {
  105641. return startOfSegment;
  105642. }
  105643. return buffered.length ? buffered.end(buffered.length - 1) : startOfSegment;
  105644. };
  105645. var shouldWaitForTimelineChange = function shouldWaitForTimelineChange2(_ref2) {
  105646. var timelineChangeController = _ref2.timelineChangeController, currentTimeline = _ref2.currentTimeline, segmentTimeline = _ref2.segmentTimeline, loaderType = _ref2.loaderType, audioDisabled = _ref2.audioDisabled;
  105647. if (currentTimeline === segmentTimeline) {
  105648. return false;
  105649. }
  105650. if (loaderType === "audio") {
  105651. var lastMainTimelineChange = timelineChangeController.lastTimelineChange({
  105652. type: "main"
  105653. });
  105654. return !lastMainTimelineChange || lastMainTimelineChange.to !== segmentTimeline;
  105655. }
  105656. if (loaderType === "main" && audioDisabled) {
  105657. var pendingAudioTimelineChange = timelineChangeController.pendingTimelineChange({
  105658. type: "audio"
  105659. });
  105660. if (pendingAudioTimelineChange && pendingAudioTimelineChange.to === segmentTimeline) {
  105661. return false;
  105662. }
  105663. return true;
  105664. }
  105665. return false;
  105666. };
  105667. var mediaDuration = function mediaDuration2(timingInfos) {
  105668. var maxDuration = 0;
  105669. ["video", "audio"].forEach(function(type2) {
  105670. var typeTimingInfo = timingInfos[type2 + "TimingInfo"];
  105671. if (!typeTimingInfo) {
  105672. return;
  105673. }
  105674. var start2 = typeTimingInfo.start, end = typeTimingInfo.end;
  105675. var duration5;
  105676. if (typeof start2 === "bigint" || typeof end === "bigint") {
  105677. duration5 = window_1.BigInt(end) - window_1.BigInt(start2);
  105678. } else if (typeof start2 === "number" && typeof end === "number") {
  105679. duration5 = end - start2;
  105680. }
  105681. if (typeof duration5 !== "undefined" && duration5 > maxDuration) {
  105682. maxDuration = duration5;
  105683. }
  105684. });
  105685. if (typeof maxDuration === "bigint" && maxDuration < Number.MAX_SAFE_INTEGER) {
  105686. maxDuration = Number(maxDuration);
  105687. }
  105688. return maxDuration;
  105689. };
  105690. var segmentTooLong = function segmentTooLong2(_ref3) {
  105691. var segmentDuration = _ref3.segmentDuration, maxDuration = _ref3.maxDuration;
  105692. if (!segmentDuration) {
  105693. return false;
  105694. }
  105695. return Math.round(segmentDuration) > maxDuration + TIME_FUDGE_FACTOR;
  105696. };
  105697. var getTroublesomeSegmentDurationMessage = function getTroublesomeSegmentDurationMessage2(segmentInfo, sourceType) {
  105698. if (sourceType !== "hls") {
  105699. return null;
  105700. }
  105701. var segmentDuration = mediaDuration({
  105702. audioTimingInfo: segmentInfo.audioTimingInfo,
  105703. videoTimingInfo: segmentInfo.videoTimingInfo
  105704. });
  105705. if (!segmentDuration) {
  105706. return null;
  105707. }
  105708. var targetDuration = segmentInfo.playlist.targetDuration;
  105709. var isSegmentWayTooLong = segmentTooLong({
  105710. segmentDuration,
  105711. maxDuration: targetDuration * 2
  105712. });
  105713. var isSegmentSlightlyTooLong = segmentTooLong({
  105714. segmentDuration,
  105715. maxDuration: targetDuration
  105716. });
  105717. var segmentTooLongMessage = "Segment with index " + segmentInfo.mediaIndex + " " + ("from playlist " + segmentInfo.playlist.id + " ") + ("has a duration of " + segmentDuration + " ") + ("when the reported duration is " + segmentInfo.duration + " ") + ("and the target duration is " + targetDuration + ". ") + "For HLS content, a duration in excess of the target duration may result in playback issues. See the HLS specification section on EXT-X-TARGETDURATION for more details: https://tools.ietf.org/html/draft-pantos-http-live-streaming-23#section-4.3.3.1";
  105718. if (isSegmentWayTooLong || isSegmentSlightlyTooLong) {
  105719. return {
  105720. severity: isSegmentWayTooLong ? "warn" : "info",
  105721. message: segmentTooLongMessage
  105722. };
  105723. }
  105724. return null;
  105725. };
  105726. var SegmentLoader = /* @__PURE__ */ function(_videojs$EventTarget) {
  105727. _inheritsLoose(SegmentLoader2, _videojs$EventTarget);
  105728. function SegmentLoader2(settings, options2) {
  105729. var _this;
  105730. _this = _videojs$EventTarget.call(this) || this;
  105731. if (!settings) {
  105732. throw new TypeError("Initialization settings are required");
  105733. }
  105734. if (typeof settings.currentTime !== "function") {
  105735. throw new TypeError("No currentTime getter specified");
  105736. }
  105737. if (!settings.mediaSource) {
  105738. throw new TypeError("No MediaSource specified");
  105739. }
  105740. _this.bandwidth = settings.bandwidth;
  105741. _this.throughput = {
  105742. rate: 0,
  105743. count: 0
  105744. };
  105745. _this.roundTrip = NaN;
  105746. _this.resetStats_();
  105747. _this.mediaIndex = null;
  105748. _this.partIndex = null;
  105749. _this.hasPlayed_ = settings.hasPlayed;
  105750. _this.currentTime_ = settings.currentTime;
  105751. _this.seekable_ = settings.seekable;
  105752. _this.seeking_ = settings.seeking;
  105753. _this.duration_ = settings.duration;
  105754. _this.mediaSource_ = settings.mediaSource;
  105755. _this.vhs_ = settings.vhs;
  105756. _this.loaderType_ = settings.loaderType;
  105757. _this.currentMediaInfo_ = void 0;
  105758. _this.startingMediaInfo_ = void 0;
  105759. _this.segmentMetadataTrack_ = settings.segmentMetadataTrack;
  105760. _this.goalBufferLength_ = settings.goalBufferLength;
  105761. _this.sourceType_ = settings.sourceType;
  105762. _this.sourceUpdater_ = settings.sourceUpdater;
  105763. _this.inbandTextTracks_ = settings.inbandTextTracks;
  105764. _this.state_ = "INIT";
  105765. _this.timelineChangeController_ = settings.timelineChangeController;
  105766. _this.shouldSaveSegmentTimingInfo_ = true;
  105767. _this.parse708captions_ = settings.parse708captions;
  105768. _this.useDtsForTimestampOffset_ = settings.useDtsForTimestampOffset;
  105769. _this.captionServices_ = settings.captionServices;
  105770. _this.experimentalExactManifestTimings = settings.experimentalExactManifestTimings;
  105771. _this.checkBufferTimeout_ = null;
  105772. _this.error_ = void 0;
  105773. _this.currentTimeline_ = -1;
  105774. _this.pendingSegment_ = null;
  105775. _this.xhrOptions_ = null;
  105776. _this.pendingSegments_ = [];
  105777. _this.audioDisabled_ = false;
  105778. _this.isPendingTimestampOffset_ = false;
  105779. _this.gopBuffer_ = [];
  105780. _this.timeMapping_ = 0;
  105781. _this.safeAppend_ = videojs.browser.IE_VERSION >= 11;
  105782. _this.appendInitSegment_ = {
  105783. audio: true,
  105784. video: true
  105785. };
  105786. _this.playlistOfLastInitSegment_ = {
  105787. audio: null,
  105788. video: null
  105789. };
  105790. _this.callQueue_ = [];
  105791. _this.loadQueue_ = [];
  105792. _this.metadataQueue_ = {
  105793. id3: [],
  105794. caption: []
  105795. };
  105796. _this.waitingOnRemove_ = false;
  105797. _this.quotaExceededErrorRetryTimeout_ = null;
  105798. _this.activeInitSegmentId_ = null;
  105799. _this.initSegments_ = {};
  105800. _this.cacheEncryptionKeys_ = settings.cacheEncryptionKeys;
  105801. _this.keyCache_ = {};
  105802. _this.decrypter_ = settings.decrypter;
  105803. _this.syncController_ = settings.syncController;
  105804. _this.syncPoint_ = {
  105805. segmentIndex: 0,
  105806. time: 0
  105807. };
  105808. _this.transmuxer_ = _this.createTransmuxer_();
  105809. _this.triggerSyncInfoUpdate_ = function() {
  105810. return _this.trigger("syncinfoupdate");
  105811. };
  105812. _this.syncController_.on("syncinfoupdate", _this.triggerSyncInfoUpdate_);
  105813. _this.mediaSource_.addEventListener("sourceopen", function() {
  105814. if (!_this.isEndOfStream_()) {
  105815. _this.ended_ = false;
  105816. }
  105817. });
  105818. _this.fetchAtBuffer_ = false;
  105819. _this.logger_ = logger("SegmentLoader[" + _this.loaderType_ + "]");
  105820. Object.defineProperty(_assertThisInitialized(_this), "state", {
  105821. get: function get7() {
  105822. return this.state_;
  105823. },
  105824. set: function set4(newState) {
  105825. if (newState !== this.state_) {
  105826. this.logger_(this.state_ + " -> " + newState);
  105827. this.state_ = newState;
  105828. this.trigger("statechange");
  105829. }
  105830. }
  105831. });
  105832. _this.sourceUpdater_.on("ready", function() {
  105833. if (_this.hasEnoughInfoToAppend_()) {
  105834. _this.processCallQueue_();
  105835. }
  105836. });
  105837. if (_this.loaderType_ === "main") {
  105838. _this.timelineChangeController_.on("pendingtimelinechange", function() {
  105839. if (_this.hasEnoughInfoToAppend_()) {
  105840. _this.processCallQueue_();
  105841. }
  105842. });
  105843. }
  105844. if (_this.loaderType_ === "audio") {
  105845. _this.timelineChangeController_.on("timelinechange", function() {
  105846. if (_this.hasEnoughInfoToLoad_()) {
  105847. _this.processLoadQueue_();
  105848. }
  105849. if (_this.hasEnoughInfoToAppend_()) {
  105850. _this.processCallQueue_();
  105851. }
  105852. });
  105853. }
  105854. return _this;
  105855. }
  105856. var _proto = SegmentLoader2.prototype;
  105857. _proto.createTransmuxer_ = function createTransmuxer_() {
  105858. return segmentTransmuxer.createTransmuxer({
  105859. remux: false,
  105860. alignGopsAtEnd: this.safeAppend_,
  105861. keepOriginalTimestamps: true,
  105862. parse708captions: this.parse708captions_,
  105863. captionServices: this.captionServices_
  105864. });
  105865. };
  105866. _proto.resetStats_ = function resetStats_() {
  105867. this.mediaBytesTransferred = 0;
  105868. this.mediaRequests = 0;
  105869. this.mediaRequestsAborted = 0;
  105870. this.mediaRequestsTimedout = 0;
  105871. this.mediaRequestsErrored = 0;
  105872. this.mediaTransferDuration = 0;
  105873. this.mediaSecondsLoaded = 0;
  105874. this.mediaAppends = 0;
  105875. };
  105876. _proto.dispose = function dispose() {
  105877. this.trigger("dispose");
  105878. this.state = "DISPOSED";
  105879. this.pause();
  105880. this.abort_();
  105881. if (this.transmuxer_) {
  105882. this.transmuxer_.terminate();
  105883. }
  105884. this.resetStats_();
  105885. if (this.checkBufferTimeout_) {
  105886. window_1.clearTimeout(this.checkBufferTimeout_);
  105887. }
  105888. if (this.syncController_ && this.triggerSyncInfoUpdate_) {
  105889. this.syncController_.off("syncinfoupdate", this.triggerSyncInfoUpdate_);
  105890. }
  105891. this.off();
  105892. };
  105893. _proto.setAudio = function setAudio(enable) {
  105894. this.audioDisabled_ = !enable;
  105895. if (enable) {
  105896. this.appendInitSegment_.audio = true;
  105897. } else {
  105898. this.sourceUpdater_.removeAudio(0, this.duration_());
  105899. }
  105900. };
  105901. _proto.abort = function abort2() {
  105902. if (this.state !== "WAITING") {
  105903. if (this.pendingSegment_) {
  105904. this.pendingSegment_ = null;
  105905. }
  105906. return;
  105907. }
  105908. this.abort_();
  105909. this.state = "READY";
  105910. if (!this.paused()) {
  105911. this.monitorBuffer_();
  105912. }
  105913. };
  105914. _proto.abort_ = function abort_() {
  105915. if (this.pendingSegment_ && this.pendingSegment_.abortRequests) {
  105916. this.pendingSegment_.abortRequests();
  105917. }
  105918. this.pendingSegment_ = null;
  105919. this.callQueue_ = [];
  105920. this.loadQueue_ = [];
  105921. this.metadataQueue_.id3 = [];
  105922. this.metadataQueue_.caption = [];
  105923. this.timelineChangeController_.clearPendingTimelineChange(this.loaderType_);
  105924. this.waitingOnRemove_ = false;
  105925. window_1.clearTimeout(this.quotaExceededErrorRetryTimeout_);
  105926. this.quotaExceededErrorRetryTimeout_ = null;
  105927. };
  105928. _proto.checkForAbort_ = function checkForAbort_(requestId) {
  105929. if (this.state === "APPENDING" && !this.pendingSegment_) {
  105930. this.state = "READY";
  105931. return true;
  105932. }
  105933. if (!this.pendingSegment_ || this.pendingSegment_.requestId !== requestId) {
  105934. return true;
  105935. }
  105936. return false;
  105937. };
  105938. _proto.error = function error(_error) {
  105939. if (typeof _error !== "undefined") {
  105940. this.logger_("error occurred:", _error);
  105941. this.error_ = _error;
  105942. }
  105943. this.pendingSegment_ = null;
  105944. return this.error_;
  105945. };
  105946. _proto.endOfStream = function endOfStream2() {
  105947. this.ended_ = true;
  105948. if (this.transmuxer_) {
  105949. segmentTransmuxer.reset(this.transmuxer_);
  105950. }
  105951. this.gopBuffer_.length = 0;
  105952. this.pause();
  105953. this.trigger("ended");
  105954. };
  105955. _proto.buffered_ = function buffered_() {
  105956. var trackInfo = this.getMediaInfo_();
  105957. if (!this.sourceUpdater_ || !trackInfo) {
  105958. return videojs.createTimeRanges();
  105959. }
  105960. if (this.loaderType_ === "main") {
  105961. var hasAudio = trackInfo.hasAudio, hasVideo = trackInfo.hasVideo, isMuxed3 = trackInfo.isMuxed;
  105962. if (hasVideo && hasAudio && !this.audioDisabled_ && !isMuxed3) {
  105963. return this.sourceUpdater_.buffered();
  105964. }
  105965. if (hasVideo) {
  105966. return this.sourceUpdater_.videoBuffered();
  105967. }
  105968. }
  105969. return this.sourceUpdater_.audioBuffered();
  105970. };
  105971. _proto.initSegmentForMap = function initSegmentForMap(map, set4) {
  105972. if (set4 === void 0) {
  105973. set4 = false;
  105974. }
  105975. if (!map) {
  105976. return null;
  105977. }
  105978. var id = initSegmentId(map);
  105979. var storedMap = this.initSegments_[id];
  105980. if (set4 && !storedMap && map.bytes) {
  105981. this.initSegments_[id] = storedMap = {
  105982. resolvedUri: map.resolvedUri,
  105983. byterange: map.byterange,
  105984. bytes: map.bytes,
  105985. tracks: map.tracks,
  105986. timescales: map.timescales
  105987. };
  105988. }
  105989. return storedMap || map;
  105990. };
  105991. _proto.segmentKey = function segmentKey(key, set4) {
  105992. if (set4 === void 0) {
  105993. set4 = false;
  105994. }
  105995. if (!key) {
  105996. return null;
  105997. }
  105998. var id = segmentKeyId(key);
  105999. var storedKey = this.keyCache_[id];
  106000. if (this.cacheEncryptionKeys_ && set4 && !storedKey && key.bytes) {
  106001. this.keyCache_[id] = storedKey = {
  106002. resolvedUri: key.resolvedUri,
  106003. bytes: key.bytes
  106004. };
  106005. }
  106006. var result = {
  106007. resolvedUri: (storedKey || key).resolvedUri
  106008. };
  106009. if (storedKey) {
  106010. result.bytes = storedKey.bytes;
  106011. }
  106012. return result;
  106013. };
  106014. _proto.couldBeginLoading_ = function couldBeginLoading_() {
  106015. return this.playlist_ && !this.paused();
  106016. };
  106017. _proto.load = function load() {
  106018. this.monitorBuffer_();
  106019. if (!this.playlist_) {
  106020. return;
  106021. }
  106022. if (this.state === "INIT" && this.couldBeginLoading_()) {
  106023. return this.init_();
  106024. }
  106025. if (!this.couldBeginLoading_() || this.state !== "READY" && this.state !== "INIT") {
  106026. return;
  106027. }
  106028. this.state = "READY";
  106029. };
  106030. _proto.init_ = function init_() {
  106031. this.state = "READY";
  106032. this.resetEverything();
  106033. return this.monitorBuffer_();
  106034. };
  106035. _proto.playlist = function playlist(newPlaylist, options2) {
  106036. if (options2 === void 0) {
  106037. options2 = {};
  106038. }
  106039. if (!newPlaylist) {
  106040. return;
  106041. }
  106042. var oldPlaylist = this.playlist_;
  106043. var segmentInfo = this.pendingSegment_;
  106044. this.playlist_ = newPlaylist;
  106045. this.xhrOptions_ = options2;
  106046. if (this.state === "INIT") {
  106047. newPlaylist.syncInfo = {
  106048. mediaSequence: newPlaylist.mediaSequence,
  106049. time: 0
  106050. };
  106051. if (this.loaderType_ === "main") {
  106052. this.syncController_.setDateTimeMappingForStart(newPlaylist);
  106053. }
  106054. }
  106055. var oldId = null;
  106056. if (oldPlaylist) {
  106057. if (oldPlaylist.id) {
  106058. oldId = oldPlaylist.id;
  106059. } else if (oldPlaylist.uri) {
  106060. oldId = oldPlaylist.uri;
  106061. }
  106062. }
  106063. this.logger_("playlist update [" + oldId + " => " + (newPlaylist.id || newPlaylist.uri) + "]");
  106064. this.trigger("syncinfoupdate");
  106065. if (this.state === "INIT" && this.couldBeginLoading_()) {
  106066. return this.init_();
  106067. }
  106068. if (!oldPlaylist || oldPlaylist.uri !== newPlaylist.uri) {
  106069. if (this.mediaIndex !== null) {
  106070. if (!newPlaylist.endList) {
  106071. this.resetLoader();
  106072. } else {
  106073. this.resyncLoader();
  106074. }
  106075. }
  106076. this.currentMediaInfo_ = void 0;
  106077. this.trigger("playlistupdate");
  106078. return;
  106079. }
  106080. var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;
  106081. this.logger_("live window shift [" + mediaSequenceDiff + "]");
  106082. if (this.mediaIndex !== null) {
  106083. this.mediaIndex -= mediaSequenceDiff;
  106084. if (this.mediaIndex < 0) {
  106085. this.mediaIndex = null;
  106086. this.partIndex = null;
  106087. } else {
  106088. var segment = this.playlist_.segments[this.mediaIndex];
  106089. if (this.partIndex && (!segment.parts || !segment.parts.length || !segment.parts[this.partIndex])) {
  106090. var mediaIndex = this.mediaIndex;
  106091. this.logger_("currently processing part (index " + this.partIndex + ") no longer exists.");
  106092. this.resetLoader();
  106093. this.mediaIndex = mediaIndex;
  106094. }
  106095. }
  106096. }
  106097. if (segmentInfo) {
  106098. segmentInfo.mediaIndex -= mediaSequenceDiff;
  106099. if (segmentInfo.mediaIndex < 0) {
  106100. segmentInfo.mediaIndex = null;
  106101. segmentInfo.partIndex = null;
  106102. } else {
  106103. if (segmentInfo.mediaIndex >= 0) {
  106104. segmentInfo.segment = newPlaylist.segments[segmentInfo.mediaIndex];
  106105. }
  106106. if (segmentInfo.partIndex >= 0 && segmentInfo.segment.parts) {
  106107. segmentInfo.part = segmentInfo.segment.parts[segmentInfo.partIndex];
  106108. }
  106109. }
  106110. }
  106111. this.syncController_.saveExpiredSegmentInfo(oldPlaylist, newPlaylist);
  106112. };
  106113. _proto.pause = function pause() {
  106114. if (this.checkBufferTimeout_) {
  106115. window_1.clearTimeout(this.checkBufferTimeout_);
  106116. this.checkBufferTimeout_ = null;
  106117. }
  106118. };
  106119. _proto.paused = function paused() {
  106120. return this.checkBufferTimeout_ === null;
  106121. };
  106122. _proto.resetEverything = function resetEverything(done) {
  106123. this.ended_ = false;
  106124. this.activeInitSegmentId_ = null;
  106125. this.appendInitSegment_ = {
  106126. audio: true,
  106127. video: true
  106128. };
  106129. this.resetLoader();
  106130. this.remove(0, Infinity, done);
  106131. if (this.transmuxer_) {
  106132. this.transmuxer_.postMessage({
  106133. action: "clearAllMp4Captions"
  106134. });
  106135. this.transmuxer_.postMessage({
  106136. action: "reset"
  106137. });
  106138. }
  106139. };
  106140. _proto.resetLoader = function resetLoader() {
  106141. this.fetchAtBuffer_ = false;
  106142. this.resyncLoader();
  106143. };
  106144. _proto.resyncLoader = function resyncLoader() {
  106145. if (this.transmuxer_) {
  106146. segmentTransmuxer.reset(this.transmuxer_);
  106147. }
  106148. this.mediaIndex = null;
  106149. this.partIndex = null;
  106150. this.syncPoint_ = null;
  106151. this.isPendingTimestampOffset_ = false;
  106152. this.callQueue_ = [];
  106153. this.loadQueue_ = [];
  106154. this.metadataQueue_.id3 = [];
  106155. this.metadataQueue_.caption = [];
  106156. this.abort();
  106157. if (this.transmuxer_) {
  106158. this.transmuxer_.postMessage({
  106159. action: "clearParsedMp4Captions"
  106160. });
  106161. }
  106162. };
  106163. _proto.remove = function remove2(start2, end, done, force) {
  106164. if (done === void 0) {
  106165. done = function done2() {
  106166. };
  106167. }
  106168. if (force === void 0) {
  106169. force = false;
  106170. }
  106171. if (end === Infinity) {
  106172. end = this.duration_();
  106173. }
  106174. if (end <= start2) {
  106175. this.logger_("skipping remove because end ${end} is <= start ${start}");
  106176. return;
  106177. }
  106178. if (!this.sourceUpdater_ || !this.getMediaInfo_()) {
  106179. this.logger_("skipping remove because no source updater or starting media info");
  106180. return;
  106181. }
  106182. var removesRemaining = 1;
  106183. var removeFinished = function removeFinished2() {
  106184. removesRemaining--;
  106185. if (removesRemaining === 0) {
  106186. done();
  106187. }
  106188. };
  106189. if (force || !this.audioDisabled_) {
  106190. removesRemaining++;
  106191. this.sourceUpdater_.removeAudio(start2, end, removeFinished);
  106192. }
  106193. if (force || this.loaderType_ === "main") {
  106194. this.gopBuffer_ = removeGopBuffer(this.gopBuffer_, start2, end, this.timeMapping_);
  106195. removesRemaining++;
  106196. this.sourceUpdater_.removeVideo(start2, end, removeFinished);
  106197. }
  106198. for (var track in this.inbandTextTracks_) {
  106199. removeCuesFromTrack(start2, end, this.inbandTextTracks_[track]);
  106200. }
  106201. removeCuesFromTrack(start2, end, this.segmentMetadataTrack_);
  106202. removeFinished();
  106203. };
  106204. _proto.monitorBuffer_ = function monitorBuffer_() {
  106205. if (this.checkBufferTimeout_) {
  106206. window_1.clearTimeout(this.checkBufferTimeout_);
  106207. }
  106208. this.checkBufferTimeout_ = window_1.setTimeout(this.monitorBufferTick_.bind(this), 1);
  106209. };
  106210. _proto.monitorBufferTick_ = function monitorBufferTick_() {
  106211. if (this.state === "READY") {
  106212. this.fillBuffer_();
  106213. }
  106214. if (this.checkBufferTimeout_) {
  106215. window_1.clearTimeout(this.checkBufferTimeout_);
  106216. }
  106217. this.checkBufferTimeout_ = window_1.setTimeout(this.monitorBufferTick_.bind(this), CHECK_BUFFER_DELAY);
  106218. };
  106219. _proto.fillBuffer_ = function fillBuffer_() {
  106220. if (this.sourceUpdater_.updating()) {
  106221. return;
  106222. }
  106223. var segmentInfo = this.chooseNextRequest_();
  106224. if (!segmentInfo) {
  106225. return;
  106226. }
  106227. if (typeof segmentInfo.timestampOffset === "number") {
  106228. this.isPendingTimestampOffset_ = false;
  106229. this.timelineChangeController_.pendingTimelineChange({
  106230. type: this.loaderType_,
  106231. from: this.currentTimeline_,
  106232. to: segmentInfo.timeline
  106233. });
  106234. }
  106235. this.loadSegment_(segmentInfo);
  106236. };
  106237. _proto.isEndOfStream_ = function isEndOfStream_(mediaIndex, playlist, partIndex) {
  106238. if (mediaIndex === void 0) {
  106239. mediaIndex = this.mediaIndex;
  106240. }
  106241. if (playlist === void 0) {
  106242. playlist = this.playlist_;
  106243. }
  106244. if (partIndex === void 0) {
  106245. partIndex = this.partIndex;
  106246. }
  106247. if (!playlist || !this.mediaSource_) {
  106248. return false;
  106249. }
  106250. var segment = typeof mediaIndex === "number" && playlist.segments[mediaIndex];
  106251. var appendedLastSegment = mediaIndex + 1 === playlist.segments.length;
  106252. var appendedLastPart = !segment || !segment.parts || partIndex + 1 === segment.parts.length;
  106253. return playlist.endList && this.mediaSource_.readyState === "open" && appendedLastSegment && appendedLastPart;
  106254. };
  106255. _proto.chooseNextRequest_ = function chooseNextRequest_() {
  106256. var buffered = this.buffered_();
  106257. var bufferedEnd = lastBufferedEnd(buffered) || 0;
  106258. var bufferedTime = timeAheadOf(buffered, this.currentTime_());
  106259. var preloaded = !this.hasPlayed_() && bufferedTime >= 1;
  106260. var haveEnoughBuffer = bufferedTime >= this.goalBufferLength_();
  106261. var segments = this.playlist_.segments;
  106262. if (!segments.length || preloaded || haveEnoughBuffer) {
  106263. return null;
  106264. }
  106265. this.syncPoint_ = this.syncPoint_ || this.syncController_.getSyncPoint(this.playlist_, this.duration_(), this.currentTimeline_, this.currentTime_());
  106266. var next = {
  106267. partIndex: null,
  106268. mediaIndex: null,
  106269. startOfSegment: null,
  106270. playlist: this.playlist_,
  106271. isSyncRequest: Boolean(!this.syncPoint_)
  106272. };
  106273. if (next.isSyncRequest) {
  106274. next.mediaIndex = getSyncSegmentCandidate(this.currentTimeline_, segments, bufferedEnd);
  106275. } else if (this.mediaIndex !== null) {
  106276. var segment = segments[this.mediaIndex];
  106277. var partIndex = typeof this.partIndex === "number" ? this.partIndex : -1;
  106278. next.startOfSegment = segment.end ? segment.end : bufferedEnd;
  106279. if (segment.parts && segment.parts[partIndex + 1]) {
  106280. next.mediaIndex = this.mediaIndex;
  106281. next.partIndex = partIndex + 1;
  106282. } else {
  106283. next.mediaIndex = this.mediaIndex + 1;
  106284. }
  106285. } else {
  106286. var _Playlist$getMediaInf = Playlist.getMediaInfoForTime({
  106287. experimentalExactManifestTimings: this.experimentalExactManifestTimings,
  106288. playlist: this.playlist_,
  106289. currentTime: this.fetchAtBuffer_ ? bufferedEnd : this.currentTime_(),
  106290. startingPartIndex: this.syncPoint_.partIndex,
  106291. startingSegmentIndex: this.syncPoint_.segmentIndex,
  106292. startTime: this.syncPoint_.time
  106293. }), segmentIndex = _Playlist$getMediaInf.segmentIndex, startTime = _Playlist$getMediaInf.startTime, _partIndex = _Playlist$getMediaInf.partIndex;
  106294. next.getMediaInfoForTime = this.fetchAtBuffer_ ? "bufferedEnd " + bufferedEnd : "currentTime " + this.currentTime_();
  106295. next.mediaIndex = segmentIndex;
  106296. next.startOfSegment = startTime;
  106297. next.partIndex = _partIndex;
  106298. }
  106299. var nextSegment = segments[next.mediaIndex];
  106300. var nextPart = nextSegment && typeof next.partIndex === "number" && nextSegment.parts && nextSegment.parts[next.partIndex];
  106301. if (!nextSegment || typeof next.partIndex === "number" && !nextPart) {
  106302. return null;
  106303. }
  106304. if (typeof next.partIndex !== "number" && nextSegment.parts) {
  106305. next.partIndex = 0;
  106306. nextPart = nextSegment.parts[0];
  106307. }
  106308. if (!bufferedTime && nextPart && !nextPart.independent) {
  106309. if (next.partIndex === 0) {
  106310. var lastSegment = segments[next.mediaIndex - 1];
  106311. var lastSegmentLastPart = lastSegment.parts && lastSegment.parts.length && lastSegment.parts[lastSegment.parts.length - 1];
  106312. if (lastSegmentLastPart && lastSegmentLastPart.independent) {
  106313. next.mediaIndex -= 1;
  106314. next.partIndex = lastSegment.parts.length - 1;
  106315. next.independent = "previous segment";
  106316. }
  106317. } else if (nextSegment.parts[next.partIndex - 1].independent) {
  106318. next.partIndex -= 1;
  106319. next.independent = "previous part";
  106320. }
  106321. }
  106322. var ended = this.mediaSource_ && this.mediaSource_.readyState === "ended";
  106323. if (next.mediaIndex >= segments.length - 1 && ended && !this.seeking_()) {
  106324. return null;
  106325. }
  106326. return this.generateSegmentInfo_(next);
  106327. };
  106328. _proto.generateSegmentInfo_ = function generateSegmentInfo_(options2) {
  106329. var independent = options2.independent, playlist = options2.playlist, mediaIndex = options2.mediaIndex, startOfSegment = options2.startOfSegment, isSyncRequest = options2.isSyncRequest, partIndex = options2.partIndex, forceTimestampOffset = options2.forceTimestampOffset, getMediaInfoForTime3 = options2.getMediaInfoForTime;
  106330. var segment = playlist.segments[mediaIndex];
  106331. var part = typeof partIndex === "number" && segment.parts[partIndex];
  106332. var segmentInfo = {
  106333. requestId: "segment-loader-" + Math.random(),
  106334. uri: part && part.resolvedUri || segment.resolvedUri,
  106335. mediaIndex,
  106336. partIndex: part ? partIndex : null,
  106337. isSyncRequest,
  106338. startOfSegment,
  106339. playlist,
  106340. bytes: null,
  106341. encryptedBytes: null,
  106342. timestampOffset: null,
  106343. timeline: segment.timeline,
  106344. duration: part && part.duration || segment.duration,
  106345. segment,
  106346. part,
  106347. byteLength: 0,
  106348. transmuxer: this.transmuxer_,
  106349. getMediaInfoForTime: getMediaInfoForTime3,
  106350. independent
  106351. };
  106352. var overrideCheck = typeof forceTimestampOffset !== "undefined" ? forceTimestampOffset : this.isPendingTimestampOffset_;
  106353. segmentInfo.timestampOffset = this.timestampOffsetForSegment_({
  106354. segmentTimeline: segment.timeline,
  106355. currentTimeline: this.currentTimeline_,
  106356. startOfSegment,
  106357. buffered: this.buffered_(),
  106358. overrideCheck
  106359. });
  106360. var audioBufferedEnd = lastBufferedEnd(this.sourceUpdater_.audioBuffered());
  106361. if (typeof audioBufferedEnd === "number") {
  106362. segmentInfo.audioAppendStart = audioBufferedEnd - this.sourceUpdater_.audioTimestampOffset();
  106363. }
  106364. if (this.sourceUpdater_.videoBuffered().length) {
  106365. segmentInfo.gopsToAlignWith = gopsSafeToAlignWith(
  106366. this.gopBuffer_,
  106367. this.currentTime_() - this.sourceUpdater_.videoTimestampOffset(),
  106368. this.timeMapping_
  106369. );
  106370. }
  106371. return segmentInfo;
  106372. };
  106373. _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_(options2) {
  106374. return timestampOffsetForSegment(options2);
  106375. };
  106376. _proto.earlyAbortWhenNeeded_ = function earlyAbortWhenNeeded_(stats) {
  106377. if (this.vhs_.tech_.paused() || !this.xhrOptions_.timeout || !this.playlist_.attributes.BANDWIDTH) {
  106378. return;
  106379. }
  106380. if (Date.now() - (stats.firstBytesReceivedAt || Date.now()) < 1e3) {
  106381. return;
  106382. }
  106383. var currentTime = this.currentTime_();
  106384. var measuredBandwidth = stats.bandwidth;
  106385. var segmentDuration = this.pendingSegment_.duration;
  106386. var requestTimeRemaining = Playlist.estimateSegmentRequestTime(segmentDuration, measuredBandwidth, this.playlist_, stats.bytesReceived);
  106387. var timeUntilRebuffer$12 = timeUntilRebuffer(this.buffered_(), currentTime, this.vhs_.tech_.playbackRate()) - 1;
  106388. if (requestTimeRemaining <= timeUntilRebuffer$12) {
  106389. return;
  106390. }
  106391. var switchCandidate = minRebufferMaxBandwidthSelector({
  106392. master: this.vhs_.playlists.master,
  106393. currentTime,
  106394. bandwidth: measuredBandwidth,
  106395. duration: this.duration_(),
  106396. segmentDuration,
  106397. timeUntilRebuffer: timeUntilRebuffer$12,
  106398. currentTimeline: this.currentTimeline_,
  106399. syncController: this.syncController_
  106400. });
  106401. if (!switchCandidate) {
  106402. return;
  106403. }
  106404. var rebufferingImpact = requestTimeRemaining - timeUntilRebuffer$12;
  106405. var timeSavedBySwitching = rebufferingImpact - switchCandidate.rebufferingImpact;
  106406. var minimumTimeSaving = 0.5;
  106407. if (timeUntilRebuffer$12 <= TIME_FUDGE_FACTOR) {
  106408. minimumTimeSaving = 1;
  106409. }
  106410. if (!switchCandidate.playlist || switchCandidate.playlist.uri === this.playlist_.uri || timeSavedBySwitching < minimumTimeSaving) {
  106411. return;
  106412. }
  106413. this.bandwidth = switchCandidate.playlist.attributes.BANDWIDTH * Config.BANDWIDTH_VARIANCE + 1;
  106414. this.trigger("earlyabort");
  106415. };
  106416. _proto.handleAbort_ = function handleAbort_(segmentInfo) {
  106417. this.logger_("Aborting " + segmentInfoString(segmentInfo));
  106418. this.mediaRequestsAborted += 1;
  106419. };
  106420. _proto.handleProgress_ = function handleProgress_(event2, simpleSegment) {
  106421. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106422. if (this.checkForAbort_(simpleSegment.requestId)) {
  106423. return;
  106424. }
  106425. this.trigger("progress");
  106426. };
  106427. _proto.handleTrackInfo_ = function handleTrackInfo_(simpleSegment, trackInfo) {
  106428. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106429. if (this.checkForAbort_(simpleSegment.requestId)) {
  106430. return;
  106431. }
  106432. if (this.checkForIllegalMediaSwitch(trackInfo)) {
  106433. return;
  106434. }
  106435. trackInfo = trackInfo || {};
  106436. if (!shallowEqual(this.currentMediaInfo_, trackInfo)) {
  106437. this.appendInitSegment_ = {
  106438. audio: true,
  106439. video: true
  106440. };
  106441. this.startingMediaInfo_ = trackInfo;
  106442. this.currentMediaInfo_ = trackInfo;
  106443. this.logger_("trackinfo update", trackInfo);
  106444. this.trigger("trackinfo");
  106445. }
  106446. if (this.checkForAbort_(simpleSegment.requestId)) {
  106447. return;
  106448. }
  106449. this.pendingSegment_.trackInfo = trackInfo;
  106450. if (this.hasEnoughInfoToAppend_()) {
  106451. this.processCallQueue_();
  106452. }
  106453. };
  106454. _proto.handleTimingInfo_ = function handleTimingInfo_(simpleSegment, mediaType, timeType, time) {
  106455. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106456. if (this.checkForAbort_(simpleSegment.requestId)) {
  106457. return;
  106458. }
  106459. var segmentInfo = this.pendingSegment_;
  106460. var timingInfoProperty = timingInfoPropertyForMedia(mediaType);
  106461. segmentInfo[timingInfoProperty] = segmentInfo[timingInfoProperty] || {};
  106462. segmentInfo[timingInfoProperty][timeType] = time;
  106463. this.logger_("timinginfo: " + mediaType + " - " + timeType + " - " + time);
  106464. if (this.hasEnoughInfoToAppend_()) {
  106465. this.processCallQueue_();
  106466. }
  106467. };
  106468. _proto.handleCaptions_ = function handleCaptions_(simpleSegment, captionData) {
  106469. var _this2 = this;
  106470. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106471. if (this.checkForAbort_(simpleSegment.requestId)) {
  106472. return;
  106473. }
  106474. if (captionData.length === 0) {
  106475. this.logger_("SegmentLoader received no captions from a caption event");
  106476. return;
  106477. }
  106478. var segmentInfo = this.pendingSegment_;
  106479. if (!segmentInfo.hasAppendedData_) {
  106480. this.metadataQueue_.caption.push(this.handleCaptions_.bind(this, simpleSegment, captionData));
  106481. return;
  106482. }
  106483. var timestampOffset2 = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
  106484. var captionTracks = {};
  106485. captionData.forEach(function(caption) {
  106486. captionTracks[caption.stream] = captionTracks[caption.stream] || {
  106487. startTime: Infinity,
  106488. captions: [],
  106489. endTime: 0
  106490. };
  106491. var captionTrack = captionTracks[caption.stream];
  106492. captionTrack.startTime = Math.min(captionTrack.startTime, caption.startTime + timestampOffset2);
  106493. captionTrack.endTime = Math.max(captionTrack.endTime, caption.endTime + timestampOffset2);
  106494. captionTrack.captions.push(caption);
  106495. });
  106496. Object.keys(captionTracks).forEach(function(trackName) {
  106497. var _captionTracks$trackN = captionTracks[trackName], startTime = _captionTracks$trackN.startTime, endTime = _captionTracks$trackN.endTime, captions = _captionTracks$trackN.captions;
  106498. var inbandTextTracks = _this2.inbandTextTracks_;
  106499. _this2.logger_("adding cues from " + startTime + " -> " + endTime + " for " + trackName);
  106500. createCaptionsTrackIfNotExists(inbandTextTracks, _this2.vhs_.tech_, trackName);
  106501. removeCuesFromTrack(startTime, endTime, inbandTextTracks[trackName]);
  106502. addCaptionData({
  106503. captionArray: captions,
  106504. inbandTextTracks,
  106505. timestampOffset: timestampOffset2
  106506. });
  106507. });
  106508. if (this.transmuxer_) {
  106509. this.transmuxer_.postMessage({
  106510. action: "clearParsedMp4Captions"
  106511. });
  106512. }
  106513. };
  106514. _proto.handleId3_ = function handleId3_(simpleSegment, id3Frames, dispatchType) {
  106515. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106516. if (this.checkForAbort_(simpleSegment.requestId)) {
  106517. return;
  106518. }
  106519. var segmentInfo = this.pendingSegment_;
  106520. if (!segmentInfo.hasAppendedData_) {
  106521. this.metadataQueue_.id3.push(this.handleId3_.bind(this, simpleSegment, id3Frames, dispatchType));
  106522. return;
  106523. }
  106524. var timestampOffset2 = this.sourceUpdater_.videoTimestampOffset() === null ? this.sourceUpdater_.audioTimestampOffset() : this.sourceUpdater_.videoTimestampOffset();
  106525. createMetadataTrackIfNotExists(this.inbandTextTracks_, dispatchType, this.vhs_.tech_);
  106526. addMetadata({
  106527. inbandTextTracks: this.inbandTextTracks_,
  106528. metadataArray: id3Frames,
  106529. timestampOffset: timestampOffset2,
  106530. videoDuration: this.duration_()
  106531. });
  106532. };
  106533. _proto.processMetadataQueue_ = function processMetadataQueue_() {
  106534. this.metadataQueue_.id3.forEach(function(fn2) {
  106535. return fn2();
  106536. });
  106537. this.metadataQueue_.caption.forEach(function(fn2) {
  106538. return fn2();
  106539. });
  106540. this.metadataQueue_.id3 = [];
  106541. this.metadataQueue_.caption = [];
  106542. };
  106543. _proto.processCallQueue_ = function processCallQueue_() {
  106544. var callQueue = this.callQueue_;
  106545. this.callQueue_ = [];
  106546. callQueue.forEach(function(fun) {
  106547. return fun();
  106548. });
  106549. };
  106550. _proto.processLoadQueue_ = function processLoadQueue_() {
  106551. var loadQueue = this.loadQueue_;
  106552. this.loadQueue_ = [];
  106553. loadQueue.forEach(function(fun) {
  106554. return fun();
  106555. });
  106556. };
  106557. _proto.hasEnoughInfoToLoad_ = function hasEnoughInfoToLoad_() {
  106558. if (this.loaderType_ !== "audio") {
  106559. return true;
  106560. }
  106561. var segmentInfo = this.pendingSegment_;
  106562. if (!segmentInfo) {
  106563. return false;
  106564. }
  106565. if (!this.getCurrentMediaInfo_()) {
  106566. return true;
  106567. }
  106568. if (shouldWaitForTimelineChange({
  106569. timelineChangeController: this.timelineChangeController_,
  106570. currentTimeline: this.currentTimeline_,
  106571. segmentTimeline: segmentInfo.timeline,
  106572. loaderType: this.loaderType_,
  106573. audioDisabled: this.audioDisabled_
  106574. })) {
  106575. return false;
  106576. }
  106577. return true;
  106578. };
  106579. _proto.getCurrentMediaInfo_ = function getCurrentMediaInfo_(segmentInfo) {
  106580. if (segmentInfo === void 0) {
  106581. segmentInfo = this.pendingSegment_;
  106582. }
  106583. return segmentInfo && segmentInfo.trackInfo || this.currentMediaInfo_;
  106584. };
  106585. _proto.getMediaInfo_ = function getMediaInfo_(segmentInfo) {
  106586. if (segmentInfo === void 0) {
  106587. segmentInfo = this.pendingSegment_;
  106588. }
  106589. return this.getCurrentMediaInfo_(segmentInfo) || this.startingMediaInfo_;
  106590. };
  106591. _proto.getPendingSegmentPlaylist = function getPendingSegmentPlaylist() {
  106592. return this.pendingSegment_ ? this.pendingSegment_.playlist : null;
  106593. };
  106594. _proto.hasEnoughInfoToAppend_ = function hasEnoughInfoToAppend_() {
  106595. if (!this.sourceUpdater_.ready()) {
  106596. return false;
  106597. }
  106598. if (this.waitingOnRemove_ || this.quotaExceededErrorRetryTimeout_) {
  106599. return false;
  106600. }
  106601. var segmentInfo = this.pendingSegment_;
  106602. var trackInfo = this.getCurrentMediaInfo_();
  106603. if (!segmentInfo || !trackInfo) {
  106604. return false;
  106605. }
  106606. var hasAudio = trackInfo.hasAudio, hasVideo = trackInfo.hasVideo, isMuxed3 = trackInfo.isMuxed;
  106607. if (hasVideo && !segmentInfo.videoTimingInfo) {
  106608. return false;
  106609. }
  106610. if (hasAudio && !this.audioDisabled_ && !isMuxed3 && !segmentInfo.audioTimingInfo) {
  106611. return false;
  106612. }
  106613. if (shouldWaitForTimelineChange({
  106614. timelineChangeController: this.timelineChangeController_,
  106615. currentTimeline: this.currentTimeline_,
  106616. segmentTimeline: segmentInfo.timeline,
  106617. loaderType: this.loaderType_,
  106618. audioDisabled: this.audioDisabled_
  106619. })) {
  106620. return false;
  106621. }
  106622. return true;
  106623. };
  106624. _proto.handleData_ = function handleData_3(simpleSegment, result) {
  106625. this.earlyAbortWhenNeeded_(simpleSegment.stats);
  106626. if (this.checkForAbort_(simpleSegment.requestId)) {
  106627. return;
  106628. }
  106629. if (this.callQueue_.length || !this.hasEnoughInfoToAppend_()) {
  106630. this.callQueue_.push(this.handleData_.bind(this, simpleSegment, result));
  106631. return;
  106632. }
  106633. var segmentInfo = this.pendingSegment_;
  106634. this.setTimeMapping_(segmentInfo.timeline);
  106635. this.updateMediaSecondsLoaded_(segmentInfo.part || segmentInfo.segment);
  106636. if (this.mediaSource_.readyState === "closed") {
  106637. return;
  106638. }
  106639. if (simpleSegment.map) {
  106640. simpleSegment.map = this.initSegmentForMap(simpleSegment.map, true);
  106641. segmentInfo.segment.map = simpleSegment.map;
  106642. }
  106643. if (simpleSegment.key) {
  106644. this.segmentKey(simpleSegment.key, true);
  106645. }
  106646. segmentInfo.isFmp4 = simpleSegment.isFmp4;
  106647. segmentInfo.timingInfo = segmentInfo.timingInfo || {};
  106648. if (segmentInfo.isFmp4) {
  106649. this.trigger("fmp4");
  106650. segmentInfo.timingInfo.start = segmentInfo[timingInfoPropertyForMedia(result.type)].start;
  106651. } else {
  106652. var trackInfo = this.getCurrentMediaInfo_();
  106653. var useVideoTimingInfo = this.loaderType_ === "main" && trackInfo && trackInfo.hasVideo;
  106654. var firstVideoFrameTimeForData;
  106655. if (useVideoTimingInfo) {
  106656. firstVideoFrameTimeForData = segmentInfo.videoTimingInfo.start;
  106657. }
  106658. segmentInfo.timingInfo.start = this.trueSegmentStart_({
  106659. currentStart: segmentInfo.timingInfo.start,
  106660. playlist: segmentInfo.playlist,
  106661. mediaIndex: segmentInfo.mediaIndex,
  106662. currentVideoTimestampOffset: this.sourceUpdater_.videoTimestampOffset(),
  106663. useVideoTimingInfo,
  106664. firstVideoFrameTimeForData,
  106665. videoTimingInfo: segmentInfo.videoTimingInfo,
  106666. audioTimingInfo: segmentInfo.audioTimingInfo
  106667. });
  106668. }
  106669. this.updateAppendInitSegmentStatus(segmentInfo, result.type);
  106670. this.updateSourceBufferTimestampOffset_(segmentInfo);
  106671. if (segmentInfo.isSyncRequest) {
  106672. this.updateTimingInfoEnd_(segmentInfo);
  106673. this.syncController_.saveSegmentTimingInfo({
  106674. segmentInfo,
  106675. shouldSaveTimelineMapping: this.loaderType_ === "main"
  106676. });
  106677. var next = this.chooseNextRequest_();
  106678. if (next.mediaIndex !== segmentInfo.mediaIndex || next.partIndex !== segmentInfo.partIndex) {
  106679. this.logger_("sync segment was incorrect, not appending");
  106680. return;
  106681. }
  106682. this.logger_("sync segment was correct, appending");
  106683. }
  106684. segmentInfo.hasAppendedData_ = true;
  106685. this.processMetadataQueue_();
  106686. this.appendData_(segmentInfo, result);
  106687. };
  106688. _proto.updateAppendInitSegmentStatus = function updateAppendInitSegmentStatus(segmentInfo, type2) {
  106689. if (this.loaderType_ === "main" && typeof segmentInfo.timestampOffset === "number" && !segmentInfo.changedTimestampOffset) {
  106690. this.appendInitSegment_ = {
  106691. audio: true,
  106692. video: true
  106693. };
  106694. }
  106695. if (this.playlistOfLastInitSegment_[type2] !== segmentInfo.playlist) {
  106696. this.appendInitSegment_[type2] = true;
  106697. }
  106698. };
  106699. _proto.getInitSegmentAndUpdateState_ = function getInitSegmentAndUpdateState_(_ref4) {
  106700. var type2 = _ref4.type, initSegment = _ref4.initSegment, map = _ref4.map, playlist = _ref4.playlist;
  106701. if (map) {
  106702. var id = initSegmentId(map);
  106703. if (this.activeInitSegmentId_ === id) {
  106704. return null;
  106705. }
  106706. initSegment = this.initSegmentForMap(map, true).bytes;
  106707. this.activeInitSegmentId_ = id;
  106708. }
  106709. if (initSegment && this.appendInitSegment_[type2]) {
  106710. this.playlistOfLastInitSegment_[type2] = playlist;
  106711. this.appendInitSegment_[type2] = false;
  106712. this.activeInitSegmentId_ = null;
  106713. return initSegment;
  106714. }
  106715. return null;
  106716. };
  106717. _proto.handleQuotaExceededError_ = function handleQuotaExceededError_(_ref5, error) {
  106718. var _this3 = this;
  106719. var segmentInfo = _ref5.segmentInfo, type2 = _ref5.type, bytes = _ref5.bytes;
  106720. var audioBuffered = this.sourceUpdater_.audioBuffered();
  106721. var videoBuffered = this.sourceUpdater_.videoBuffered();
  106722. if (audioBuffered.length > 1) {
  106723. this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the audio buffer: " + timeRangesToArray(audioBuffered).join(", "));
  106724. }
  106725. if (videoBuffered.length > 1) {
  106726. this.logger_("On QUOTA_EXCEEDED_ERR, found gaps in the video buffer: " + timeRangesToArray(videoBuffered).join(", "));
  106727. }
  106728. var audioBufferStart = audioBuffered.length ? audioBuffered.start(0) : 0;
  106729. var audioBufferEnd = audioBuffered.length ? audioBuffered.end(audioBuffered.length - 1) : 0;
  106730. var videoBufferStart = videoBuffered.length ? videoBuffered.start(0) : 0;
  106731. var videoBufferEnd = videoBuffered.length ? videoBuffered.end(videoBuffered.length - 1) : 0;
  106732. if (audioBufferEnd - audioBufferStart <= MIN_BACK_BUFFER && videoBufferEnd - videoBufferStart <= MIN_BACK_BUFFER) {
  106733. this.logger_("On QUOTA_EXCEEDED_ERR, single segment too large to append to buffer, triggering an error. " + ("Appended byte length: " + bytes.byteLength + ", ") + ("audio buffer: " + timeRangesToArray(audioBuffered).join(", ") + ", ") + ("video buffer: " + timeRangesToArray(videoBuffered).join(", ") + ", "));
  106734. this.error({
  106735. message: "Quota exceeded error with append of a single segment of content",
  106736. excludeUntil: Infinity
  106737. });
  106738. this.trigger("error");
  106739. return;
  106740. }
  106741. this.waitingOnRemove_ = true;
  106742. this.callQueue_.push(this.appendToSourceBuffer_.bind(this, {
  106743. segmentInfo,
  106744. type: type2,
  106745. bytes
  106746. }));
  106747. var currentTime = this.currentTime_();
  106748. var timeToRemoveUntil = currentTime - MIN_BACK_BUFFER;
  106749. this.logger_("On QUOTA_EXCEEDED_ERR, removing audio/video from 0 to " + timeToRemoveUntil);
  106750. this.remove(0, timeToRemoveUntil, function() {
  106751. _this3.logger_("On QUOTA_EXCEEDED_ERR, retrying append in " + MIN_BACK_BUFFER + "s");
  106752. _this3.waitingOnRemove_ = false;
  106753. _this3.quotaExceededErrorRetryTimeout_ = window_1.setTimeout(function() {
  106754. _this3.logger_("On QUOTA_EXCEEDED_ERR, re-processing call queue");
  106755. _this3.quotaExceededErrorRetryTimeout_ = null;
  106756. _this3.processCallQueue_();
  106757. }, MIN_BACK_BUFFER * 1e3);
  106758. }, true);
  106759. };
  106760. _proto.handleAppendError_ = function handleAppendError_(_ref6, error) {
  106761. var segmentInfo = _ref6.segmentInfo, type2 = _ref6.type, bytes = _ref6.bytes;
  106762. if (!error) {
  106763. return;
  106764. }
  106765. if (error.code === QUOTA_EXCEEDED_ERR) {
  106766. this.handleQuotaExceededError_({
  106767. segmentInfo,
  106768. type: type2,
  106769. bytes
  106770. });
  106771. return;
  106772. }
  106773. this.logger_("Received non QUOTA_EXCEEDED_ERR on append", error);
  106774. this.error(type2 + " append of " + bytes.length + "b failed for segment " + ("#" + segmentInfo.mediaIndex + " in playlist " + segmentInfo.playlist.id));
  106775. this.trigger("appenderror");
  106776. };
  106777. _proto.appendToSourceBuffer_ = function appendToSourceBuffer_(_ref7) {
  106778. var segmentInfo = _ref7.segmentInfo, type2 = _ref7.type, initSegment = _ref7.initSegment, data = _ref7.data, bytes = _ref7.bytes;
  106779. if (!bytes) {
  106780. var segments = [data];
  106781. var byteLength = data.byteLength;
  106782. if (initSegment) {
  106783. segments.unshift(initSegment);
  106784. byteLength += initSegment.byteLength;
  106785. }
  106786. bytes = concatSegments({
  106787. bytes: byteLength,
  106788. segments
  106789. });
  106790. }
  106791. this.sourceUpdater_.appendBuffer({
  106792. segmentInfo,
  106793. type: type2,
  106794. bytes
  106795. }, this.handleAppendError_.bind(this, {
  106796. segmentInfo,
  106797. type: type2,
  106798. bytes
  106799. }));
  106800. };
  106801. _proto.handleSegmentTimingInfo_ = function handleSegmentTimingInfo_(type2, requestId, segmentTimingInfo) {
  106802. if (!this.pendingSegment_ || requestId !== this.pendingSegment_.requestId) {
  106803. return;
  106804. }
  106805. var segment = this.pendingSegment_.segment;
  106806. var timingInfoProperty = type2 + "TimingInfo";
  106807. if (!segment[timingInfoProperty]) {
  106808. segment[timingInfoProperty] = {};
  106809. }
  106810. segment[timingInfoProperty].transmuxerPrependedSeconds = segmentTimingInfo.prependedContentDuration || 0;
  106811. segment[timingInfoProperty].transmuxedPresentationStart = segmentTimingInfo.start.presentation;
  106812. segment[timingInfoProperty].transmuxedDecodeStart = segmentTimingInfo.start.decode;
  106813. segment[timingInfoProperty].transmuxedPresentationEnd = segmentTimingInfo.end.presentation;
  106814. segment[timingInfoProperty].transmuxedDecodeEnd = segmentTimingInfo.end.decode;
  106815. segment[timingInfoProperty].baseMediaDecodeTime = segmentTimingInfo.baseMediaDecodeTime;
  106816. };
  106817. _proto.appendData_ = function appendData_(segmentInfo, result) {
  106818. var type2 = result.type, data = result.data;
  106819. if (!data || !data.byteLength) {
  106820. return;
  106821. }
  106822. if (type2 === "audio" && this.audioDisabled_) {
  106823. return;
  106824. }
  106825. var initSegment = this.getInitSegmentAndUpdateState_({
  106826. type: type2,
  106827. initSegment: result.initSegment,
  106828. playlist: segmentInfo.playlist,
  106829. map: segmentInfo.isFmp4 ? segmentInfo.segment.map : null
  106830. });
  106831. this.appendToSourceBuffer_({
  106832. segmentInfo,
  106833. type: type2,
  106834. initSegment,
  106835. data
  106836. });
  106837. };
  106838. _proto.loadSegment_ = function loadSegment_(segmentInfo) {
  106839. var _this4 = this;
  106840. this.state = "WAITING";
  106841. this.pendingSegment_ = segmentInfo;
  106842. this.trimBackBuffer_(segmentInfo);
  106843. if (typeof segmentInfo.timestampOffset === "number") {
  106844. if (this.transmuxer_) {
  106845. this.transmuxer_.postMessage({
  106846. action: "clearAllMp4Captions"
  106847. });
  106848. }
  106849. }
  106850. if (!this.hasEnoughInfoToLoad_()) {
  106851. this.loadQueue_.push(function() {
  106852. var options2 = _extends$2({}, segmentInfo, {
  106853. forceTimestampOffset: true
  106854. });
  106855. _extends$2(segmentInfo, _this4.generateSegmentInfo_(options2));
  106856. _this4.isPendingTimestampOffset_ = false;
  106857. _this4.updateTransmuxerAndRequestSegment_(segmentInfo);
  106858. });
  106859. return;
  106860. }
  106861. this.updateTransmuxerAndRequestSegment_(segmentInfo);
  106862. };
  106863. _proto.updateTransmuxerAndRequestSegment_ = function updateTransmuxerAndRequestSegment_(segmentInfo) {
  106864. var _this5 = this;
  106865. if (this.shouldUpdateTransmuxerTimestampOffset_(segmentInfo.timestampOffset)) {
  106866. this.gopBuffer_.length = 0;
  106867. segmentInfo.gopsToAlignWith = [];
  106868. this.timeMapping_ = 0;
  106869. this.transmuxer_.postMessage({
  106870. action: "reset"
  106871. });
  106872. this.transmuxer_.postMessage({
  106873. action: "setTimestampOffset",
  106874. timestampOffset: segmentInfo.timestampOffset
  106875. });
  106876. }
  106877. var simpleSegment = this.createSimplifiedSegmentObj_(segmentInfo);
  106878. var isEndOfStream = this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex);
  106879. var isWalkingForward = this.mediaIndex !== null;
  106880. var isDiscontinuity = segmentInfo.timeline !== this.currentTimeline_ && segmentInfo.timeline > 0;
  106881. var isEndOfTimeline = isEndOfStream || isWalkingForward && isDiscontinuity;
  106882. this.logger_("Requesting " + segmentInfoString(segmentInfo));
  106883. if (simpleSegment.map && !simpleSegment.map.bytes) {
  106884. this.logger_("going to request init segment.");
  106885. this.appendInitSegment_ = {
  106886. video: true,
  106887. audio: true
  106888. };
  106889. }
  106890. segmentInfo.abortRequests = mediaSegmentRequest({
  106891. xhr: this.vhs_.xhr,
  106892. xhrOptions: this.xhrOptions_,
  106893. decryptionWorker: this.decrypter_,
  106894. segment: simpleSegment,
  106895. abortFn: this.handleAbort_.bind(this, segmentInfo),
  106896. progressFn: this.handleProgress_.bind(this),
  106897. trackInfoFn: this.handleTrackInfo_.bind(this),
  106898. timingInfoFn: this.handleTimingInfo_.bind(this),
  106899. videoSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "video", segmentInfo.requestId),
  106900. audioSegmentTimingInfoFn: this.handleSegmentTimingInfo_.bind(this, "audio", segmentInfo.requestId),
  106901. captionsFn: this.handleCaptions_.bind(this),
  106902. isEndOfTimeline,
  106903. endedTimelineFn: function endedTimelineFn() {
  106904. _this5.logger_("received endedtimeline callback");
  106905. },
  106906. id3Fn: this.handleId3_.bind(this),
  106907. dataFn: this.handleData_.bind(this),
  106908. doneFn: this.segmentRequestFinished_.bind(this),
  106909. onTransmuxerLog: function onTransmuxerLog(_ref8) {
  106910. var message = _ref8.message, level = _ref8.level, stream = _ref8.stream;
  106911. _this5.logger_(segmentInfoString(segmentInfo) + " logged from transmuxer stream " + stream + " as a " + level + ": " + message);
  106912. }
  106913. });
  106914. };
  106915. _proto.trimBackBuffer_ = function trimBackBuffer_(segmentInfo) {
  106916. var removeToTime = safeBackBufferTrimTime(this.seekable_(), this.currentTime_(), this.playlist_.targetDuration || 10);
  106917. if (removeToTime > 0) {
  106918. this.remove(0, removeToTime);
  106919. }
  106920. };
  106921. _proto.createSimplifiedSegmentObj_ = function createSimplifiedSegmentObj_(segmentInfo) {
  106922. var segment = segmentInfo.segment;
  106923. var part = segmentInfo.part;
  106924. var simpleSegment = {
  106925. resolvedUri: part ? part.resolvedUri : segment.resolvedUri,
  106926. byterange: part ? part.byterange : segment.byterange,
  106927. requestId: segmentInfo.requestId,
  106928. transmuxer: segmentInfo.transmuxer,
  106929. audioAppendStart: segmentInfo.audioAppendStart,
  106930. gopsToAlignWith: segmentInfo.gopsToAlignWith,
  106931. part: segmentInfo.part
  106932. };
  106933. var previousSegment = segmentInfo.playlist.segments[segmentInfo.mediaIndex - 1];
  106934. if (previousSegment && previousSegment.timeline === segment.timeline) {
  106935. if (previousSegment.videoTimingInfo) {
  106936. simpleSegment.baseStartTime = previousSegment.videoTimingInfo.transmuxedDecodeEnd;
  106937. } else if (previousSegment.audioTimingInfo) {
  106938. simpleSegment.baseStartTime = previousSegment.audioTimingInfo.transmuxedDecodeEnd;
  106939. }
  106940. }
  106941. if (segment.key) {
  106942. var iv = segment.key.iv || new Uint32Array([0, 0, 0, segmentInfo.mediaIndex + segmentInfo.playlist.mediaSequence]);
  106943. simpleSegment.key = this.segmentKey(segment.key);
  106944. simpleSegment.key.iv = iv;
  106945. }
  106946. if (segment.map) {
  106947. simpleSegment.map = this.initSegmentForMap(segment.map);
  106948. }
  106949. return simpleSegment;
  106950. };
  106951. _proto.saveTransferStats_ = function saveTransferStats_(stats) {
  106952. this.mediaRequests += 1;
  106953. if (stats) {
  106954. this.mediaBytesTransferred += stats.bytesReceived;
  106955. this.mediaTransferDuration += stats.roundTripTime;
  106956. }
  106957. };
  106958. _proto.saveBandwidthRelatedStats_ = function saveBandwidthRelatedStats_(duration5, stats) {
  106959. this.pendingSegment_.byteLength = stats.bytesReceived;
  106960. if (duration5 < MIN_SEGMENT_DURATION_TO_SAVE_STATS) {
  106961. this.logger_("Ignoring segment's bandwidth because its duration of " + duration5 + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS));
  106962. return;
  106963. }
  106964. this.bandwidth = stats.bandwidth;
  106965. this.roundTrip = stats.roundTripTime;
  106966. };
  106967. _proto.handleTimeout_ = function handleTimeout_() {
  106968. this.mediaRequestsTimedout += 1;
  106969. this.bandwidth = 1;
  106970. this.roundTrip = NaN;
  106971. this.trigger("bandwidthupdate");
  106972. this.trigger("timeout");
  106973. };
  106974. _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) {
  106975. if (this.callQueue_.length) {
  106976. this.callQueue_.push(this.segmentRequestFinished_.bind(this, error, simpleSegment, result));
  106977. return;
  106978. }
  106979. this.saveTransferStats_(simpleSegment.stats);
  106980. if (!this.pendingSegment_) {
  106981. return;
  106982. }
  106983. if (simpleSegment.requestId !== this.pendingSegment_.requestId) {
  106984. return;
  106985. }
  106986. if (error) {
  106987. this.pendingSegment_ = null;
  106988. this.state = "READY";
  106989. if (error.code === REQUEST_ERRORS.ABORTED) {
  106990. return;
  106991. }
  106992. this.pause();
  106993. if (error.code === REQUEST_ERRORS.TIMEOUT) {
  106994. this.handleTimeout_();
  106995. return;
  106996. }
  106997. this.mediaRequestsErrored += 1;
  106998. this.error(error);
  106999. this.trigger("error");
  107000. return;
  107001. }
  107002. var segmentInfo = this.pendingSegment_;
  107003. this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);
  107004. segmentInfo.endOfAllRequests = simpleSegment.endOfAllRequests;
  107005. if (result.gopInfo) {
  107006. this.gopBuffer_ = updateGopBuffer(this.gopBuffer_, result.gopInfo, this.safeAppend_);
  107007. }
  107008. this.state = "APPENDING";
  107009. this.trigger("appending");
  107010. this.waitForAppendsToComplete_(segmentInfo);
  107011. };
  107012. _proto.setTimeMapping_ = function setTimeMapping_(timeline) {
  107013. var timelineMapping = this.syncController_.mappingForTimeline(timeline);
  107014. if (timelineMapping !== null) {
  107015. this.timeMapping_ = timelineMapping;
  107016. }
  107017. };
  107018. _proto.updateMediaSecondsLoaded_ = function updateMediaSecondsLoaded_(segment) {
  107019. if (typeof segment.start === "number" && typeof segment.end === "number") {
  107020. this.mediaSecondsLoaded += segment.end - segment.start;
  107021. } else {
  107022. this.mediaSecondsLoaded += segment.duration;
  107023. }
  107024. };
  107025. _proto.shouldUpdateTransmuxerTimestampOffset_ = function shouldUpdateTransmuxerTimestampOffset_(timestampOffset2) {
  107026. if (timestampOffset2 === null) {
  107027. return false;
  107028. }
  107029. if (this.loaderType_ === "main" && timestampOffset2 !== this.sourceUpdater_.videoTimestampOffset()) {
  107030. return true;
  107031. }
  107032. if (!this.audioDisabled_ && timestampOffset2 !== this.sourceUpdater_.audioTimestampOffset()) {
  107033. return true;
  107034. }
  107035. return false;
  107036. };
  107037. _proto.trueSegmentStart_ = function trueSegmentStart_(_ref9) {
  107038. var currentStart = _ref9.currentStart, playlist = _ref9.playlist, mediaIndex = _ref9.mediaIndex, firstVideoFrameTimeForData = _ref9.firstVideoFrameTimeForData, currentVideoTimestampOffset = _ref9.currentVideoTimestampOffset, useVideoTimingInfo = _ref9.useVideoTimingInfo, videoTimingInfo = _ref9.videoTimingInfo, audioTimingInfo = _ref9.audioTimingInfo;
  107039. if (typeof currentStart !== "undefined") {
  107040. return currentStart;
  107041. }
  107042. if (!useVideoTimingInfo) {
  107043. return audioTimingInfo.start;
  107044. }
  107045. var previousSegment = playlist.segments[mediaIndex - 1];
  107046. if (mediaIndex === 0 || !previousSegment || typeof previousSegment.start === "undefined" || previousSegment.end !== firstVideoFrameTimeForData + currentVideoTimestampOffset) {
  107047. return firstVideoFrameTimeForData;
  107048. }
  107049. return videoTimingInfo.start;
  107050. };
  107051. _proto.waitForAppendsToComplete_ = function waitForAppendsToComplete_(segmentInfo) {
  107052. var trackInfo = this.getCurrentMediaInfo_(segmentInfo);
  107053. if (!trackInfo) {
  107054. this.error({
  107055. message: "No starting media returned, likely due to an unsupported media format.",
  107056. blacklistDuration: Infinity
  107057. });
  107058. this.trigger("error");
  107059. return;
  107060. }
  107061. var hasAudio = trackInfo.hasAudio, hasVideo = trackInfo.hasVideo, isMuxed3 = trackInfo.isMuxed;
  107062. var waitForVideo = this.loaderType_ === "main" && hasVideo;
  107063. var waitForAudio = !this.audioDisabled_ && hasAudio && !isMuxed3;
  107064. segmentInfo.waitingOnAppends = 0;
  107065. if (!segmentInfo.hasAppendedData_) {
  107066. if (!segmentInfo.timingInfo && typeof segmentInfo.timestampOffset === "number") {
  107067. this.isPendingTimestampOffset_ = true;
  107068. }
  107069. segmentInfo.timingInfo = {
  107070. start: 0
  107071. };
  107072. segmentInfo.waitingOnAppends++;
  107073. if (!this.isPendingTimestampOffset_) {
  107074. this.updateSourceBufferTimestampOffset_(segmentInfo);
  107075. this.processMetadataQueue_();
  107076. }
  107077. this.checkAppendsDone_(segmentInfo);
  107078. return;
  107079. }
  107080. if (waitForVideo) {
  107081. segmentInfo.waitingOnAppends++;
  107082. }
  107083. if (waitForAudio) {
  107084. segmentInfo.waitingOnAppends++;
  107085. }
  107086. if (waitForVideo) {
  107087. this.sourceUpdater_.videoQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));
  107088. }
  107089. if (waitForAudio) {
  107090. this.sourceUpdater_.audioQueueCallback(this.checkAppendsDone_.bind(this, segmentInfo));
  107091. }
  107092. };
  107093. _proto.checkAppendsDone_ = function checkAppendsDone_(segmentInfo) {
  107094. if (this.checkForAbort_(segmentInfo.requestId)) {
  107095. return;
  107096. }
  107097. segmentInfo.waitingOnAppends--;
  107098. if (segmentInfo.waitingOnAppends === 0) {
  107099. this.handleAppendsDone_();
  107100. }
  107101. };
  107102. _proto.checkForIllegalMediaSwitch = function checkForIllegalMediaSwitch(trackInfo) {
  107103. var illegalMediaSwitchError = illegalMediaSwitch(this.loaderType_, this.getCurrentMediaInfo_(), trackInfo);
  107104. if (illegalMediaSwitchError) {
  107105. this.error({
  107106. message: illegalMediaSwitchError,
  107107. blacklistDuration: Infinity
  107108. });
  107109. this.trigger("error");
  107110. return true;
  107111. }
  107112. return false;
  107113. };
  107114. _proto.updateSourceBufferTimestampOffset_ = function updateSourceBufferTimestampOffset_(segmentInfo) {
  107115. if (segmentInfo.timestampOffset === null || typeof segmentInfo.timingInfo.start !== "number" || segmentInfo.changedTimestampOffset || this.loaderType_ !== "main") {
  107116. return;
  107117. }
  107118. var didChange = false;
  107119. segmentInfo.timestampOffset -= this.getSegmentStartTimeForTimestampOffsetCalculation_({
  107120. videoTimingInfo: segmentInfo.segment.videoTimingInfo,
  107121. audioTimingInfo: segmentInfo.segment.audioTimingInfo,
  107122. timingInfo: segmentInfo.timingInfo
  107123. });
  107124. segmentInfo.changedTimestampOffset = true;
  107125. if (segmentInfo.timestampOffset !== this.sourceUpdater_.videoTimestampOffset()) {
  107126. this.sourceUpdater_.videoTimestampOffset(segmentInfo.timestampOffset);
  107127. didChange = true;
  107128. }
  107129. if (segmentInfo.timestampOffset !== this.sourceUpdater_.audioTimestampOffset()) {
  107130. this.sourceUpdater_.audioTimestampOffset(segmentInfo.timestampOffset);
  107131. didChange = true;
  107132. }
  107133. if (didChange) {
  107134. this.trigger("timestampoffset");
  107135. }
  107136. };
  107137. _proto.getSegmentStartTimeForTimestampOffsetCalculation_ = function getSegmentStartTimeForTimestampOffsetCalculation_(_ref10) {
  107138. var videoTimingInfo = _ref10.videoTimingInfo, audioTimingInfo = _ref10.audioTimingInfo, timingInfo = _ref10.timingInfo;
  107139. if (!this.useDtsForTimestampOffset_) {
  107140. return timingInfo.start;
  107141. }
  107142. if (videoTimingInfo && typeof videoTimingInfo.transmuxedDecodeStart === "number") {
  107143. return videoTimingInfo.transmuxedDecodeStart;
  107144. }
  107145. if (audioTimingInfo && typeof audioTimingInfo.transmuxedDecodeStart === "number") {
  107146. return audioTimingInfo.transmuxedDecodeStart;
  107147. }
  107148. return timingInfo.start;
  107149. };
  107150. _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_(segmentInfo) {
  107151. segmentInfo.timingInfo = segmentInfo.timingInfo || {};
  107152. var trackInfo = this.getMediaInfo_();
  107153. var useVideoTimingInfo = this.loaderType_ === "main" && trackInfo && trackInfo.hasVideo;
  107154. var prioritizedTimingInfo = useVideoTimingInfo && segmentInfo.videoTimingInfo ? segmentInfo.videoTimingInfo : segmentInfo.audioTimingInfo;
  107155. if (!prioritizedTimingInfo) {
  107156. return;
  107157. }
  107158. segmentInfo.timingInfo.end = typeof prioritizedTimingInfo.end === "number" ? prioritizedTimingInfo.end : prioritizedTimingInfo.start + segmentInfo.duration;
  107159. };
  107160. _proto.handleAppendsDone_ = function handleAppendsDone_() {
  107161. if (this.pendingSegment_) {
  107162. this.trigger("appendsdone");
  107163. }
  107164. if (!this.pendingSegment_) {
  107165. this.state = "READY";
  107166. if (!this.paused()) {
  107167. this.monitorBuffer_();
  107168. }
  107169. return;
  107170. }
  107171. var segmentInfo = this.pendingSegment_;
  107172. this.updateTimingInfoEnd_(segmentInfo);
  107173. if (this.shouldSaveSegmentTimingInfo_) {
  107174. this.syncController_.saveSegmentTimingInfo({
  107175. segmentInfo,
  107176. shouldSaveTimelineMapping: this.loaderType_ === "main"
  107177. });
  107178. }
  107179. var segmentDurationMessage = getTroublesomeSegmentDurationMessage(segmentInfo, this.sourceType_);
  107180. if (segmentDurationMessage) {
  107181. if (segmentDurationMessage.severity === "warn") {
  107182. videojs.log.warn(segmentDurationMessage.message);
  107183. } else {
  107184. this.logger_(segmentDurationMessage.message);
  107185. }
  107186. }
  107187. this.recordThroughput_(segmentInfo);
  107188. this.pendingSegment_ = null;
  107189. this.state = "READY";
  107190. if (segmentInfo.isSyncRequest) {
  107191. this.trigger("syncinfoupdate");
  107192. if (!segmentInfo.hasAppendedData_) {
  107193. this.logger_("Throwing away un-appended sync request " + segmentInfoString(segmentInfo));
  107194. return;
  107195. }
  107196. }
  107197. this.logger_("Appended " + segmentInfoString(segmentInfo));
  107198. this.addSegmentMetadataCue_(segmentInfo);
  107199. this.fetchAtBuffer_ = true;
  107200. if (this.currentTimeline_ !== segmentInfo.timeline) {
  107201. this.timelineChangeController_.lastTimelineChange({
  107202. type: this.loaderType_,
  107203. from: this.currentTimeline_,
  107204. to: segmentInfo.timeline
  107205. });
  107206. if (this.loaderType_ === "main" && !this.audioDisabled_) {
  107207. this.timelineChangeController_.lastTimelineChange({
  107208. type: "audio",
  107209. from: this.currentTimeline_,
  107210. to: segmentInfo.timeline
  107211. });
  107212. }
  107213. }
  107214. this.currentTimeline_ = segmentInfo.timeline;
  107215. this.trigger("syncinfoupdate");
  107216. var segment = segmentInfo.segment;
  107217. var part = segmentInfo.part;
  107218. var badSegmentGuess = segment.end && this.currentTime_() - segment.end > segmentInfo.playlist.targetDuration * 3;
  107219. var badPartGuess = part && part.end && this.currentTime_() - part.end > segmentInfo.playlist.partTargetDuration * 3;
  107220. if (badSegmentGuess || badPartGuess) {
  107221. this.logger_("bad " + (badSegmentGuess ? "segment" : "part") + " " + segmentInfoString(segmentInfo));
  107222. this.resetEverything();
  107223. return;
  107224. }
  107225. var isWalkingForward = this.mediaIndex !== null;
  107226. if (isWalkingForward) {
  107227. this.trigger("bandwidthupdate");
  107228. }
  107229. this.trigger("progress");
  107230. this.mediaIndex = segmentInfo.mediaIndex;
  107231. this.partIndex = segmentInfo.partIndex;
  107232. if (this.isEndOfStream_(segmentInfo.mediaIndex, segmentInfo.playlist, segmentInfo.partIndex)) {
  107233. this.endOfStream();
  107234. }
  107235. this.trigger("appended");
  107236. if (segmentInfo.hasAppendedData_) {
  107237. this.mediaAppends++;
  107238. }
  107239. if (!this.paused()) {
  107240. this.monitorBuffer_();
  107241. }
  107242. };
  107243. _proto.recordThroughput_ = function recordThroughput_(segmentInfo) {
  107244. if (segmentInfo.duration < MIN_SEGMENT_DURATION_TO_SAVE_STATS) {
  107245. this.logger_("Ignoring segment's throughput because its duration of " + segmentInfo.duration + (" is less than the min to record " + MIN_SEGMENT_DURATION_TO_SAVE_STATS));
  107246. return;
  107247. }
  107248. var rate = this.throughput.rate;
  107249. var segmentProcessingTime = Date.now() - segmentInfo.endOfAllRequests + 1;
  107250. var segmentProcessingThroughput = Math.floor(segmentInfo.byteLength / segmentProcessingTime * 8 * 1e3);
  107251. this.throughput.rate += (segmentProcessingThroughput - rate) / ++this.throughput.count;
  107252. };
  107253. _proto.addSegmentMetadataCue_ = function addSegmentMetadataCue_(segmentInfo) {
  107254. if (!this.segmentMetadataTrack_) {
  107255. return;
  107256. }
  107257. var segment = segmentInfo.segment;
  107258. var start2 = segment.start;
  107259. var end = segment.end;
  107260. if (!finite(start2) || !finite(end)) {
  107261. return;
  107262. }
  107263. removeCuesFromTrack(start2, end, this.segmentMetadataTrack_);
  107264. var Cue = window_1.WebKitDataCue || window_1.VTTCue;
  107265. var value = {
  107266. custom: segment.custom,
  107267. dateTimeObject: segment.dateTimeObject,
  107268. dateTimeString: segment.dateTimeString,
  107269. bandwidth: segmentInfo.playlist.attributes.BANDWIDTH,
  107270. resolution: segmentInfo.playlist.attributes.RESOLUTION,
  107271. codecs: segmentInfo.playlist.attributes.CODECS,
  107272. byteLength: segmentInfo.byteLength,
  107273. uri: segmentInfo.uri,
  107274. timeline: segmentInfo.timeline,
  107275. playlist: segmentInfo.playlist.id,
  107276. start: start2,
  107277. end
  107278. };
  107279. var data = JSON.stringify(value);
  107280. var cue = new Cue(start2, end, data);
  107281. cue.value = value;
  107282. this.segmentMetadataTrack_.addCue(cue);
  107283. };
  107284. return SegmentLoader2;
  107285. }(videojs.EventTarget);
  107286. function noop() {
  107287. }
  107288. var toTitleCase2 = function toTitleCase3(string) {
  107289. if (typeof string !== "string") {
  107290. return string;
  107291. }
  107292. return string.replace(/./, function(w) {
  107293. return w.toUpperCase();
  107294. });
  107295. };
  107296. var bufferTypes = ["video", "audio"];
  107297. var _updating = function updating2(type2, sourceUpdater) {
  107298. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107299. return sourceBuffer && sourceBuffer.updating || sourceUpdater.queuePending[type2];
  107300. };
  107301. var nextQueueIndexOfType = function nextQueueIndexOfType2(type2, queue) {
  107302. for (var i2 = 0; i2 < queue.length; i2++) {
  107303. var queueEntry = queue[i2];
  107304. if (queueEntry.type === "mediaSource") {
  107305. return null;
  107306. }
  107307. if (queueEntry.type === type2) {
  107308. return i2;
  107309. }
  107310. }
  107311. return null;
  107312. };
  107313. var shiftQueue = function shiftQueue2(type2, sourceUpdater) {
  107314. if (sourceUpdater.queue.length === 0) {
  107315. return;
  107316. }
  107317. var queueIndex = 0;
  107318. var queueEntry = sourceUpdater.queue[queueIndex];
  107319. if (queueEntry.type === "mediaSource") {
  107320. if (!sourceUpdater.updating() && sourceUpdater.mediaSource.readyState !== "closed") {
  107321. sourceUpdater.queue.shift();
  107322. queueEntry.action(sourceUpdater);
  107323. if (queueEntry.doneFn) {
  107324. queueEntry.doneFn();
  107325. }
  107326. shiftQueue2("audio", sourceUpdater);
  107327. shiftQueue2("video", sourceUpdater);
  107328. }
  107329. return;
  107330. }
  107331. if (type2 === "mediaSource") {
  107332. return;
  107333. }
  107334. if (!sourceUpdater.ready() || sourceUpdater.mediaSource.readyState === "closed" || _updating(type2, sourceUpdater)) {
  107335. return;
  107336. }
  107337. if (queueEntry.type !== type2) {
  107338. queueIndex = nextQueueIndexOfType(type2, sourceUpdater.queue);
  107339. if (queueIndex === null) {
  107340. return;
  107341. }
  107342. queueEntry = sourceUpdater.queue[queueIndex];
  107343. }
  107344. sourceUpdater.queue.splice(queueIndex, 1);
  107345. sourceUpdater.queuePending[type2] = queueEntry;
  107346. queueEntry.action(type2, sourceUpdater);
  107347. if (!queueEntry.doneFn) {
  107348. sourceUpdater.queuePending[type2] = null;
  107349. shiftQueue2(type2, sourceUpdater);
  107350. return;
  107351. }
  107352. };
  107353. var cleanupBuffer = function cleanupBuffer2(type2, sourceUpdater) {
  107354. var buffer = sourceUpdater[type2 + "Buffer"];
  107355. var titleType = toTitleCase2(type2);
  107356. if (!buffer) {
  107357. return;
  107358. }
  107359. buffer.removeEventListener("updateend", sourceUpdater["on" + titleType + "UpdateEnd_"]);
  107360. buffer.removeEventListener("error", sourceUpdater["on" + titleType + "Error_"]);
  107361. sourceUpdater.codecs[type2] = null;
  107362. sourceUpdater[type2 + "Buffer"] = null;
  107363. };
  107364. var inSourceBuffers = function inSourceBuffers2(mediaSource, sourceBuffer) {
  107365. return mediaSource && sourceBuffer && Array.prototype.indexOf.call(mediaSource.sourceBuffers, sourceBuffer) !== -1;
  107366. };
  107367. var actions = {
  107368. appendBuffer: function appendBuffer(bytes, segmentInfo, onError2) {
  107369. return function(type2, sourceUpdater) {
  107370. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107371. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107372. return;
  107373. }
  107374. sourceUpdater.logger_("Appending segment " + segmentInfo.mediaIndex + "'s " + bytes.length + " bytes to " + type2 + "Buffer");
  107375. try {
  107376. sourceBuffer.appendBuffer(bytes);
  107377. } catch (e) {
  107378. sourceUpdater.logger_("Error with code " + e.code + " " + (e.code === QUOTA_EXCEEDED_ERR ? "(QUOTA_EXCEEDED_ERR) " : "") + ("when appending segment " + segmentInfo.mediaIndex + " to " + type2 + "Buffer"));
  107379. sourceUpdater.queuePending[type2] = null;
  107380. onError2(e);
  107381. }
  107382. };
  107383. },
  107384. remove: function remove(start2, end) {
  107385. return function(type2, sourceUpdater) {
  107386. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107387. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107388. return;
  107389. }
  107390. sourceUpdater.logger_("Removing " + start2 + " to " + end + " from " + type2 + "Buffer");
  107391. try {
  107392. sourceBuffer.remove(start2, end);
  107393. } catch (e) {
  107394. sourceUpdater.logger_("Remove " + start2 + " to " + end + " from " + type2 + "Buffer failed");
  107395. }
  107396. };
  107397. },
  107398. timestampOffset: function timestampOffset(offset) {
  107399. return function(type2, sourceUpdater) {
  107400. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107401. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107402. return;
  107403. }
  107404. sourceUpdater.logger_("Setting " + type2 + "timestampOffset to " + offset);
  107405. sourceBuffer.timestampOffset = offset;
  107406. };
  107407. },
  107408. callback: function callback(_callback) {
  107409. return function(type2, sourceUpdater) {
  107410. _callback();
  107411. };
  107412. },
  107413. endOfStream: function endOfStream(error) {
  107414. return function(sourceUpdater) {
  107415. if (sourceUpdater.mediaSource.readyState !== "open") {
  107416. return;
  107417. }
  107418. sourceUpdater.logger_("Calling mediaSource endOfStream(" + (error || "") + ")");
  107419. try {
  107420. sourceUpdater.mediaSource.endOfStream(error);
  107421. } catch (e) {
  107422. videojs.log.warn("Failed to call media source endOfStream", e);
  107423. }
  107424. };
  107425. },
  107426. duration: function duration4(_duration) {
  107427. return function(sourceUpdater) {
  107428. sourceUpdater.logger_("Setting mediaSource duration to " + _duration);
  107429. try {
  107430. sourceUpdater.mediaSource.duration = _duration;
  107431. } catch (e) {
  107432. videojs.log.warn("Failed to set media source duration", e);
  107433. }
  107434. };
  107435. },
  107436. abort: function abort() {
  107437. return function(type2, sourceUpdater) {
  107438. if (sourceUpdater.mediaSource.readyState !== "open") {
  107439. return;
  107440. }
  107441. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107442. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107443. return;
  107444. }
  107445. sourceUpdater.logger_("calling abort on " + type2 + "Buffer");
  107446. try {
  107447. sourceBuffer.abort();
  107448. } catch (e) {
  107449. videojs.log.warn("Failed to abort on " + type2 + "Buffer", e);
  107450. }
  107451. };
  107452. },
  107453. addSourceBuffer: function addSourceBuffer(type2, codec) {
  107454. return function(sourceUpdater) {
  107455. var titleType = toTitleCase2(type2);
  107456. var mime = getMimeForCodec2(codec);
  107457. sourceUpdater.logger_("Adding " + type2 + "Buffer with codec " + codec + " to mediaSource");
  107458. var sourceBuffer = sourceUpdater.mediaSource.addSourceBuffer(mime);
  107459. sourceBuffer.addEventListener("updateend", sourceUpdater["on" + titleType + "UpdateEnd_"]);
  107460. sourceBuffer.addEventListener("error", sourceUpdater["on" + titleType + "Error_"]);
  107461. sourceUpdater.codecs[type2] = codec;
  107462. sourceUpdater[type2 + "Buffer"] = sourceBuffer;
  107463. };
  107464. },
  107465. removeSourceBuffer: function removeSourceBuffer(type2) {
  107466. return function(sourceUpdater) {
  107467. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107468. cleanupBuffer(type2, sourceUpdater);
  107469. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107470. return;
  107471. }
  107472. sourceUpdater.logger_("Removing " + type2 + "Buffer with codec " + sourceUpdater.codecs[type2] + " from mediaSource");
  107473. try {
  107474. sourceUpdater.mediaSource.removeSourceBuffer(sourceBuffer);
  107475. } catch (e) {
  107476. videojs.log.warn("Failed to removeSourceBuffer " + type2 + "Buffer", e);
  107477. }
  107478. };
  107479. },
  107480. changeType: function changeType(codec) {
  107481. return function(type2, sourceUpdater) {
  107482. var sourceBuffer = sourceUpdater[type2 + "Buffer"];
  107483. var mime = getMimeForCodec2(codec);
  107484. if (!inSourceBuffers(sourceUpdater.mediaSource, sourceBuffer)) {
  107485. return;
  107486. }
  107487. if (sourceUpdater.codecs[type2] === codec) {
  107488. return;
  107489. }
  107490. sourceUpdater.logger_("changing " + type2 + "Buffer codec from " + sourceUpdater.codecs[type2] + " to " + codec);
  107491. sourceBuffer.changeType(mime);
  107492. sourceUpdater.codecs[type2] = codec;
  107493. };
  107494. }
  107495. };
  107496. var pushQueue = function pushQueue2(_ref) {
  107497. var type2 = _ref.type, sourceUpdater = _ref.sourceUpdater, action = _ref.action, doneFn = _ref.doneFn, name = _ref.name;
  107498. sourceUpdater.queue.push({
  107499. type: type2,
  107500. action,
  107501. doneFn,
  107502. name
  107503. });
  107504. shiftQueue(type2, sourceUpdater);
  107505. };
  107506. var onUpdateend = function onUpdateend2(type2, sourceUpdater) {
  107507. return function(e) {
  107508. if (sourceUpdater.queuePending[type2]) {
  107509. var doneFn = sourceUpdater.queuePending[type2].doneFn;
  107510. sourceUpdater.queuePending[type2] = null;
  107511. if (doneFn) {
  107512. doneFn(sourceUpdater[type2 + "Error_"]);
  107513. }
  107514. }
  107515. shiftQueue(type2, sourceUpdater);
  107516. };
  107517. };
  107518. var SourceUpdater = /* @__PURE__ */ function(_videojs$EventTarget) {
  107519. _inheritsLoose(SourceUpdater2, _videojs$EventTarget);
  107520. function SourceUpdater2(mediaSource) {
  107521. var _this;
  107522. _this = _videojs$EventTarget.call(this) || this;
  107523. _this.mediaSource = mediaSource;
  107524. _this.sourceopenListener_ = function() {
  107525. return shiftQueue("mediaSource", _assertThisInitialized(_this));
  107526. };
  107527. _this.mediaSource.addEventListener("sourceopen", _this.sourceopenListener_);
  107528. _this.logger_ = logger("SourceUpdater");
  107529. _this.audioTimestampOffset_ = 0;
  107530. _this.videoTimestampOffset_ = 0;
  107531. _this.queue = [];
  107532. _this.queuePending = {
  107533. audio: null,
  107534. video: null
  107535. };
  107536. _this.delayedAudioAppendQueue_ = [];
  107537. _this.videoAppendQueued_ = false;
  107538. _this.codecs = {};
  107539. _this.onVideoUpdateEnd_ = onUpdateend("video", _assertThisInitialized(_this));
  107540. _this.onAudioUpdateEnd_ = onUpdateend("audio", _assertThisInitialized(_this));
  107541. _this.onVideoError_ = function(e) {
  107542. _this.videoError_ = e;
  107543. };
  107544. _this.onAudioError_ = function(e) {
  107545. _this.audioError_ = e;
  107546. };
  107547. _this.createdSourceBuffers_ = false;
  107548. _this.initializedEme_ = false;
  107549. _this.triggeredReady_ = false;
  107550. return _this;
  107551. }
  107552. var _proto = SourceUpdater2.prototype;
  107553. _proto.initializedEme = function initializedEme() {
  107554. this.initializedEme_ = true;
  107555. this.triggerReady();
  107556. };
  107557. _proto.hasCreatedSourceBuffers = function hasCreatedSourceBuffers() {
  107558. return this.createdSourceBuffers_;
  107559. };
  107560. _proto.hasInitializedAnyEme = function hasInitializedAnyEme() {
  107561. return this.initializedEme_;
  107562. };
  107563. _proto.ready = function ready() {
  107564. return this.hasCreatedSourceBuffers() && this.hasInitializedAnyEme();
  107565. };
  107566. _proto.createSourceBuffers = function createSourceBuffers(codecs) {
  107567. if (this.hasCreatedSourceBuffers()) {
  107568. return;
  107569. }
  107570. this.addOrChangeSourceBuffers(codecs);
  107571. this.createdSourceBuffers_ = true;
  107572. this.trigger("createdsourcebuffers");
  107573. this.triggerReady();
  107574. };
  107575. _proto.triggerReady = function triggerReady() {
  107576. if (this.ready() && !this.triggeredReady_) {
  107577. this.triggeredReady_ = true;
  107578. this.trigger("ready");
  107579. }
  107580. };
  107581. _proto.addSourceBuffer = function addSourceBuffer2(type2, codec) {
  107582. pushQueue({
  107583. type: "mediaSource",
  107584. sourceUpdater: this,
  107585. action: actions.addSourceBuffer(type2, codec),
  107586. name: "addSourceBuffer"
  107587. });
  107588. };
  107589. _proto.abort = function abort2(type2) {
  107590. pushQueue({
  107591. type: type2,
  107592. sourceUpdater: this,
  107593. action: actions.abort(type2),
  107594. name: "abort"
  107595. });
  107596. };
  107597. _proto.removeSourceBuffer = function removeSourceBuffer2(type2) {
  107598. if (!this.canRemoveSourceBuffer()) {
  107599. videojs.log.error("removeSourceBuffer is not supported!");
  107600. return;
  107601. }
  107602. pushQueue({
  107603. type: "mediaSource",
  107604. sourceUpdater: this,
  107605. action: actions.removeSourceBuffer(type2),
  107606. name: "removeSourceBuffer"
  107607. });
  107608. };
  107609. _proto.canRemoveSourceBuffer = function canRemoveSourceBuffer() {
  107610. return !videojs.browser.IE_VERSION && !videojs.browser.IS_FIREFOX && window_1.MediaSource && window_1.MediaSource.prototype && typeof window_1.MediaSource.prototype.removeSourceBuffer === "function";
  107611. };
  107612. SourceUpdater2.canChangeType = function canChangeType() {
  107613. return window_1.SourceBuffer && window_1.SourceBuffer.prototype && typeof window_1.SourceBuffer.prototype.changeType === "function";
  107614. };
  107615. _proto.canChangeType = function canChangeType() {
  107616. return this.constructor.canChangeType();
  107617. };
  107618. _proto.changeType = function changeType2(type2, codec) {
  107619. if (!this.canChangeType()) {
  107620. videojs.log.error("changeType is not supported!");
  107621. return;
  107622. }
  107623. pushQueue({
  107624. type: type2,
  107625. sourceUpdater: this,
  107626. action: actions.changeType(codec),
  107627. name: "changeType"
  107628. });
  107629. };
  107630. _proto.addOrChangeSourceBuffers = function addOrChangeSourceBuffers(codecs) {
  107631. var _this2 = this;
  107632. if (!codecs || typeof codecs !== "object" || Object.keys(codecs).length === 0) {
  107633. throw new Error("Cannot addOrChangeSourceBuffers to undefined codecs");
  107634. }
  107635. Object.keys(codecs).forEach(function(type2) {
  107636. var codec = codecs[type2];
  107637. if (!_this2.hasCreatedSourceBuffers()) {
  107638. return _this2.addSourceBuffer(type2, codec);
  107639. }
  107640. if (_this2.canChangeType()) {
  107641. _this2.changeType(type2, codec);
  107642. }
  107643. });
  107644. };
  107645. _proto.appendBuffer = function appendBuffer2(options2, doneFn) {
  107646. var _this3 = this;
  107647. var segmentInfo = options2.segmentInfo, type2 = options2.type, bytes = options2.bytes;
  107648. this.processedAppend_ = true;
  107649. if (type2 === "audio" && this.videoBuffer && !this.videoAppendQueued_) {
  107650. this.delayedAudioAppendQueue_.push([options2, doneFn]);
  107651. this.logger_("delayed audio append of " + bytes.length + " until video append");
  107652. return;
  107653. }
  107654. var onError2 = doneFn;
  107655. pushQueue({
  107656. type: type2,
  107657. sourceUpdater: this,
  107658. action: actions.appendBuffer(bytes, segmentInfo || {
  107659. mediaIndex: -1
  107660. }, onError2),
  107661. doneFn,
  107662. name: "appendBuffer"
  107663. });
  107664. if (type2 === "video") {
  107665. this.videoAppendQueued_ = true;
  107666. if (!this.delayedAudioAppendQueue_.length) {
  107667. return;
  107668. }
  107669. var queue = this.delayedAudioAppendQueue_.slice();
  107670. this.logger_("queuing delayed audio " + queue.length + " appendBuffers");
  107671. this.delayedAudioAppendQueue_.length = 0;
  107672. queue.forEach(function(que) {
  107673. _this3.appendBuffer.apply(_this3, que);
  107674. });
  107675. }
  107676. };
  107677. _proto.audioBuffered = function audioBuffered() {
  107678. if (!inSourceBuffers(this.mediaSource, this.audioBuffer)) {
  107679. return videojs.createTimeRange();
  107680. }
  107681. return this.audioBuffer.buffered ? this.audioBuffer.buffered : videojs.createTimeRange();
  107682. };
  107683. _proto.videoBuffered = function videoBuffered() {
  107684. if (!inSourceBuffers(this.mediaSource, this.videoBuffer)) {
  107685. return videojs.createTimeRange();
  107686. }
  107687. return this.videoBuffer.buffered ? this.videoBuffer.buffered : videojs.createTimeRange();
  107688. };
  107689. _proto.buffered = function buffered() {
  107690. var video = inSourceBuffers(this.mediaSource, this.videoBuffer) ? this.videoBuffer : null;
  107691. var audio = inSourceBuffers(this.mediaSource, this.audioBuffer) ? this.audioBuffer : null;
  107692. if (audio && !video) {
  107693. return this.audioBuffered();
  107694. }
  107695. if (video && !audio) {
  107696. return this.videoBuffered();
  107697. }
  107698. return bufferIntersection(this.audioBuffered(), this.videoBuffered());
  107699. };
  107700. _proto.setDuration = function setDuration(duration5, doneFn) {
  107701. if (doneFn === void 0) {
  107702. doneFn = noop;
  107703. }
  107704. pushQueue({
  107705. type: "mediaSource",
  107706. sourceUpdater: this,
  107707. action: actions.duration(duration5),
  107708. name: "duration",
  107709. doneFn
  107710. });
  107711. };
  107712. _proto.endOfStream = function endOfStream2(error, doneFn) {
  107713. if (error === void 0) {
  107714. error = null;
  107715. }
  107716. if (doneFn === void 0) {
  107717. doneFn = noop;
  107718. }
  107719. if (typeof error !== "string") {
  107720. error = void 0;
  107721. }
  107722. pushQueue({
  107723. type: "mediaSource",
  107724. sourceUpdater: this,
  107725. action: actions.endOfStream(error),
  107726. name: "endOfStream",
  107727. doneFn
  107728. });
  107729. };
  107730. _proto.removeAudio = function removeAudio(start2, end, done) {
  107731. if (done === void 0) {
  107732. done = noop;
  107733. }
  107734. if (!this.audioBuffered().length || this.audioBuffered().end(0) === 0) {
  107735. done();
  107736. return;
  107737. }
  107738. pushQueue({
  107739. type: "audio",
  107740. sourceUpdater: this,
  107741. action: actions.remove(start2, end),
  107742. doneFn: done,
  107743. name: "remove"
  107744. });
  107745. };
  107746. _proto.removeVideo = function removeVideo(start2, end, done) {
  107747. if (done === void 0) {
  107748. done = noop;
  107749. }
  107750. if (!this.videoBuffered().length || this.videoBuffered().end(0) === 0) {
  107751. done();
  107752. return;
  107753. }
  107754. pushQueue({
  107755. type: "video",
  107756. sourceUpdater: this,
  107757. action: actions.remove(start2, end),
  107758. doneFn: done,
  107759. name: "remove"
  107760. });
  107761. };
  107762. _proto.updating = function updating3() {
  107763. if (_updating("audio", this) || _updating("video", this)) {
  107764. return true;
  107765. }
  107766. return false;
  107767. };
  107768. _proto.audioTimestampOffset = function audioTimestampOffset(offset) {
  107769. if (typeof offset !== "undefined" && this.audioBuffer && this.audioTimestampOffset_ !== offset) {
  107770. pushQueue({
  107771. type: "audio",
  107772. sourceUpdater: this,
  107773. action: actions.timestampOffset(offset),
  107774. name: "timestampOffset"
  107775. });
  107776. this.audioTimestampOffset_ = offset;
  107777. }
  107778. return this.audioTimestampOffset_;
  107779. };
  107780. _proto.videoTimestampOffset = function videoTimestampOffset(offset) {
  107781. if (typeof offset !== "undefined" && this.videoBuffer && this.videoTimestampOffset !== offset) {
  107782. pushQueue({
  107783. type: "video",
  107784. sourceUpdater: this,
  107785. action: actions.timestampOffset(offset),
  107786. name: "timestampOffset"
  107787. });
  107788. this.videoTimestampOffset_ = offset;
  107789. }
  107790. return this.videoTimestampOffset_;
  107791. };
  107792. _proto.audioQueueCallback = function audioQueueCallback(callback2) {
  107793. if (!this.audioBuffer) {
  107794. return;
  107795. }
  107796. pushQueue({
  107797. type: "audio",
  107798. sourceUpdater: this,
  107799. action: actions.callback(callback2),
  107800. name: "callback"
  107801. });
  107802. };
  107803. _proto.videoQueueCallback = function videoQueueCallback(callback2) {
  107804. if (!this.videoBuffer) {
  107805. return;
  107806. }
  107807. pushQueue({
  107808. type: "video",
  107809. sourceUpdater: this,
  107810. action: actions.callback(callback2),
  107811. name: "callback"
  107812. });
  107813. };
  107814. _proto.dispose = function dispose() {
  107815. var _this4 = this;
  107816. this.trigger("dispose");
  107817. bufferTypes.forEach(function(type2) {
  107818. _this4.abort(type2);
  107819. if (_this4.canRemoveSourceBuffer()) {
  107820. _this4.removeSourceBuffer(type2);
  107821. } else {
  107822. _this4[type2 + "QueueCallback"](function() {
  107823. return cleanupBuffer(type2, _this4);
  107824. });
  107825. }
  107826. });
  107827. this.videoAppendQueued_ = false;
  107828. this.delayedAudioAppendQueue_.length = 0;
  107829. if (this.sourceopenListener_) {
  107830. this.mediaSource.removeEventListener("sourceopen", this.sourceopenListener_);
  107831. }
  107832. this.off();
  107833. };
  107834. return SourceUpdater2;
  107835. }(videojs.EventTarget);
  107836. var uint8ToUtf8 = function uint8ToUtf82(uintArray) {
  107837. return decodeURIComponent(escape(String.fromCharCode.apply(null, uintArray)));
  107838. };
  107839. var VTT_LINE_TERMINATORS = new Uint8Array("\n\n".split("").map(function(_char3) {
  107840. return _char3.charCodeAt(0);
  107841. }));
  107842. var NoVttJsError = /* @__PURE__ */ function(_Error) {
  107843. _inheritsLoose(NoVttJsError2, _Error);
  107844. function NoVttJsError2() {
  107845. return _Error.call(this, "Trying to parse received VTT cues, but there is no WebVTT. Make sure vtt.js is loaded.") || this;
  107846. }
  107847. return NoVttJsError2;
  107848. }(/* @__PURE__ */ _wrapNativeSuper(Error));
  107849. var VTTSegmentLoader = /* @__PURE__ */ function(_SegmentLoader) {
  107850. _inheritsLoose(VTTSegmentLoader2, _SegmentLoader);
  107851. function VTTSegmentLoader2(settings, options2) {
  107852. var _this;
  107853. if (options2 === void 0) {
  107854. options2 = {};
  107855. }
  107856. _this = _SegmentLoader.call(this, settings, options2) || this;
  107857. _this.mediaSource_ = null;
  107858. _this.subtitlesTrack_ = null;
  107859. _this.loaderType_ = "subtitle";
  107860. _this.featuresNativeTextTracks_ = settings.featuresNativeTextTracks;
  107861. _this.loadVttJs = settings.loadVttJs;
  107862. _this.shouldSaveSegmentTimingInfo_ = false;
  107863. return _this;
  107864. }
  107865. var _proto = VTTSegmentLoader2.prototype;
  107866. _proto.createTransmuxer_ = function createTransmuxer_() {
  107867. return null;
  107868. };
  107869. _proto.buffered_ = function buffered_() {
  107870. if (!this.subtitlesTrack_ || !this.subtitlesTrack_.cues || !this.subtitlesTrack_.cues.length) {
  107871. return videojs.createTimeRanges();
  107872. }
  107873. var cues = this.subtitlesTrack_.cues;
  107874. var start2 = cues[0].startTime;
  107875. var end = cues[cues.length - 1].startTime;
  107876. return videojs.createTimeRanges([[start2, end]]);
  107877. };
  107878. _proto.initSegmentForMap = function initSegmentForMap(map, set4) {
  107879. if (set4 === void 0) {
  107880. set4 = false;
  107881. }
  107882. if (!map) {
  107883. return null;
  107884. }
  107885. var id = initSegmentId(map);
  107886. var storedMap = this.initSegments_[id];
  107887. if (set4 && !storedMap && map.bytes) {
  107888. var combinedByteLength = VTT_LINE_TERMINATORS.byteLength + map.bytes.byteLength;
  107889. var combinedSegment = new Uint8Array(combinedByteLength);
  107890. combinedSegment.set(map.bytes);
  107891. combinedSegment.set(VTT_LINE_TERMINATORS, map.bytes.byteLength);
  107892. this.initSegments_[id] = storedMap = {
  107893. resolvedUri: map.resolvedUri,
  107894. byterange: map.byterange,
  107895. bytes: combinedSegment
  107896. };
  107897. }
  107898. return storedMap || map;
  107899. };
  107900. _proto.couldBeginLoading_ = function couldBeginLoading_() {
  107901. return this.playlist_ && this.subtitlesTrack_ && !this.paused();
  107902. };
  107903. _proto.init_ = function init_() {
  107904. this.state = "READY";
  107905. this.resetEverything();
  107906. return this.monitorBuffer_();
  107907. };
  107908. _proto.track = function track(_track) {
  107909. if (typeof _track === "undefined") {
  107910. return this.subtitlesTrack_;
  107911. }
  107912. this.subtitlesTrack_ = _track;
  107913. if (this.state === "INIT" && this.couldBeginLoading_()) {
  107914. this.init_();
  107915. }
  107916. return this.subtitlesTrack_;
  107917. };
  107918. _proto.remove = function remove2(start2, end) {
  107919. removeCuesFromTrack(start2, end, this.subtitlesTrack_);
  107920. };
  107921. _proto.fillBuffer_ = function fillBuffer_() {
  107922. var _this2 = this;
  107923. var segmentInfo = this.chooseNextRequest_();
  107924. if (!segmentInfo) {
  107925. return;
  107926. }
  107927. if (this.syncController_.timestampOffsetForTimeline(segmentInfo.timeline) === null) {
  107928. var checkTimestampOffset = function checkTimestampOffset2() {
  107929. _this2.state = "READY";
  107930. if (!_this2.paused()) {
  107931. _this2.monitorBuffer_();
  107932. }
  107933. };
  107934. this.syncController_.one("timestampoffset", checkTimestampOffset);
  107935. this.state = "WAITING_ON_TIMELINE";
  107936. return;
  107937. }
  107938. this.loadSegment_(segmentInfo);
  107939. };
  107940. _proto.timestampOffsetForSegment_ = function timestampOffsetForSegment_() {
  107941. return null;
  107942. };
  107943. _proto.chooseNextRequest_ = function chooseNextRequest_() {
  107944. return this.skipEmptySegments_(_SegmentLoader.prototype.chooseNextRequest_.call(this));
  107945. };
  107946. _proto.skipEmptySegments_ = function skipEmptySegments_(segmentInfo) {
  107947. while (segmentInfo && segmentInfo.segment.empty) {
  107948. if (segmentInfo.mediaIndex + 1 >= segmentInfo.playlist.segments.length) {
  107949. segmentInfo = null;
  107950. break;
  107951. }
  107952. segmentInfo = this.generateSegmentInfo_({
  107953. playlist: segmentInfo.playlist,
  107954. mediaIndex: segmentInfo.mediaIndex + 1,
  107955. startOfSegment: segmentInfo.startOfSegment + segmentInfo.duration,
  107956. isSyncRequest: segmentInfo.isSyncRequest
  107957. });
  107958. }
  107959. return segmentInfo;
  107960. };
  107961. _proto.stopForError = function stopForError(error) {
  107962. this.error(error);
  107963. this.state = "READY";
  107964. this.pause();
  107965. this.trigger("error");
  107966. };
  107967. _proto.segmentRequestFinished_ = function segmentRequestFinished_(error, simpleSegment, result) {
  107968. var _this3 = this;
  107969. if (!this.subtitlesTrack_) {
  107970. this.state = "READY";
  107971. return;
  107972. }
  107973. this.saveTransferStats_(simpleSegment.stats);
  107974. if (!this.pendingSegment_) {
  107975. this.state = "READY";
  107976. this.mediaRequestsAborted += 1;
  107977. return;
  107978. }
  107979. if (error) {
  107980. if (error.code === REQUEST_ERRORS.TIMEOUT) {
  107981. this.handleTimeout_();
  107982. }
  107983. if (error.code === REQUEST_ERRORS.ABORTED) {
  107984. this.mediaRequestsAborted += 1;
  107985. } else {
  107986. this.mediaRequestsErrored += 1;
  107987. }
  107988. this.stopForError(error);
  107989. return;
  107990. }
  107991. var segmentInfo = this.pendingSegment_;
  107992. this.saveBandwidthRelatedStats_(segmentInfo.duration, simpleSegment.stats);
  107993. if (simpleSegment.key) {
  107994. this.segmentKey(simpleSegment.key, true);
  107995. }
  107996. this.state = "APPENDING";
  107997. this.trigger("appending");
  107998. var segment = segmentInfo.segment;
  107999. if (segment.map) {
  108000. segment.map.bytes = simpleSegment.map.bytes;
  108001. }
  108002. segmentInfo.bytes = simpleSegment.bytes;
  108003. if (typeof window_1.WebVTT !== "function" && typeof this.loadVttJs === "function") {
  108004. this.state = "WAITING_ON_VTTJS";
  108005. this.loadVttJs().then(function() {
  108006. return _this3.segmentRequestFinished_(error, simpleSegment, result);
  108007. }, function() {
  108008. return _this3.stopForError({
  108009. message: "Error loading vtt.js"
  108010. });
  108011. });
  108012. return;
  108013. }
  108014. segment.requested = true;
  108015. try {
  108016. this.parseVTTCues_(segmentInfo);
  108017. } catch (e) {
  108018. this.stopForError({
  108019. message: e.message
  108020. });
  108021. return;
  108022. }
  108023. this.updateTimeMapping_(segmentInfo, this.syncController_.timelines[segmentInfo.timeline], this.playlist_);
  108024. if (segmentInfo.cues.length) {
  108025. segmentInfo.timingInfo = {
  108026. start: segmentInfo.cues[0].startTime,
  108027. end: segmentInfo.cues[segmentInfo.cues.length - 1].endTime
  108028. };
  108029. } else {
  108030. segmentInfo.timingInfo = {
  108031. start: segmentInfo.startOfSegment,
  108032. end: segmentInfo.startOfSegment + segmentInfo.duration
  108033. };
  108034. }
  108035. if (segmentInfo.isSyncRequest) {
  108036. this.trigger("syncinfoupdate");
  108037. this.pendingSegment_ = null;
  108038. this.state = "READY";
  108039. return;
  108040. }
  108041. segmentInfo.byteLength = segmentInfo.bytes.byteLength;
  108042. this.mediaSecondsLoaded += segment.duration;
  108043. segmentInfo.cues.forEach(function(cue) {
  108044. _this3.subtitlesTrack_.addCue(_this3.featuresNativeTextTracks_ ? new window_1.VTTCue(cue.startTime, cue.endTime, cue.text) : cue);
  108045. });
  108046. removeDuplicateCuesFromTrack(this.subtitlesTrack_);
  108047. this.handleAppendsDone_();
  108048. };
  108049. _proto.handleData_ = function handleData_3() {
  108050. };
  108051. _proto.updateTimingInfoEnd_ = function updateTimingInfoEnd_() {
  108052. };
  108053. _proto.parseVTTCues_ = function parseVTTCues_(segmentInfo) {
  108054. var decoder;
  108055. var decodeBytesToString = false;
  108056. if (typeof window_1.WebVTT !== "function") {
  108057. throw new NoVttJsError();
  108058. }
  108059. if (typeof window_1.TextDecoder === "function") {
  108060. decoder = new window_1.TextDecoder("utf8");
  108061. } else {
  108062. decoder = window_1.WebVTT.StringDecoder();
  108063. decodeBytesToString = true;
  108064. }
  108065. var parser2 = new window_1.WebVTT.Parser(window_1, window_1.vttjs, decoder);
  108066. segmentInfo.cues = [];
  108067. segmentInfo.timestampmap = {
  108068. MPEGTS: 0,
  108069. LOCAL: 0
  108070. };
  108071. parser2.oncue = segmentInfo.cues.push.bind(segmentInfo.cues);
  108072. parser2.ontimestampmap = function(map) {
  108073. segmentInfo.timestampmap = map;
  108074. };
  108075. parser2.onparsingerror = function(error) {
  108076. videojs.log.warn("Error encountered when parsing cues: " + error.message);
  108077. };
  108078. if (segmentInfo.segment.map) {
  108079. var mapData = segmentInfo.segment.map.bytes;
  108080. if (decodeBytesToString) {
  108081. mapData = uint8ToUtf8(mapData);
  108082. }
  108083. parser2.parse(mapData);
  108084. }
  108085. var segmentData = segmentInfo.bytes;
  108086. if (decodeBytesToString) {
  108087. segmentData = uint8ToUtf8(segmentData);
  108088. }
  108089. parser2.parse(segmentData);
  108090. parser2.flush();
  108091. };
  108092. _proto.updateTimeMapping_ = function updateTimeMapping_(segmentInfo, mappingObj, playlist) {
  108093. var segment = segmentInfo.segment;
  108094. if (!mappingObj) {
  108095. return;
  108096. }
  108097. if (!segmentInfo.cues.length) {
  108098. segment.empty = true;
  108099. return;
  108100. }
  108101. var timestampmap = segmentInfo.timestampmap;
  108102. var diff = timestampmap.MPEGTS / clock.ONE_SECOND_IN_TS - timestampmap.LOCAL + mappingObj.mapping;
  108103. segmentInfo.cues.forEach(function(cue) {
  108104. cue.startTime += diff;
  108105. cue.endTime += diff;
  108106. });
  108107. if (!playlist.syncInfo) {
  108108. var firstStart = segmentInfo.cues[0].startTime;
  108109. var lastStart = segmentInfo.cues[segmentInfo.cues.length - 1].startTime;
  108110. playlist.syncInfo = {
  108111. mediaSequence: playlist.mediaSequence + segmentInfo.mediaIndex,
  108112. time: Math.min(firstStart, lastStart - segment.duration)
  108113. };
  108114. }
  108115. };
  108116. return VTTSegmentLoader2;
  108117. }(SegmentLoader);
  108118. var findAdCue = function findAdCue2(track, mediaTime) {
  108119. var cues = track.cues;
  108120. for (var i2 = 0; i2 < cues.length; i2++) {
  108121. var cue = cues[i2];
  108122. if (mediaTime >= cue.adStartTime && mediaTime <= cue.adEndTime) {
  108123. return cue;
  108124. }
  108125. }
  108126. return null;
  108127. };
  108128. var updateAdCues = function updateAdCues2(media, track, offset) {
  108129. if (offset === void 0) {
  108130. offset = 0;
  108131. }
  108132. if (!media.segments) {
  108133. return;
  108134. }
  108135. var mediaTime = offset;
  108136. var cue;
  108137. for (var i2 = 0; i2 < media.segments.length; i2++) {
  108138. var segment = media.segments[i2];
  108139. if (!cue) {
  108140. cue = findAdCue(track, mediaTime + segment.duration / 2);
  108141. }
  108142. if (cue) {
  108143. if ("cueIn" in segment) {
  108144. cue.endTime = mediaTime;
  108145. cue.adEndTime = mediaTime;
  108146. mediaTime += segment.duration;
  108147. cue = null;
  108148. continue;
  108149. }
  108150. if (mediaTime < cue.endTime) {
  108151. mediaTime += segment.duration;
  108152. continue;
  108153. }
  108154. cue.endTime += segment.duration;
  108155. } else {
  108156. if ("cueOut" in segment) {
  108157. cue = new window_1.VTTCue(mediaTime, mediaTime + segment.duration, segment.cueOut);
  108158. cue.adStartTime = mediaTime;
  108159. cue.adEndTime = mediaTime + parseFloat(segment.cueOut);
  108160. track.addCue(cue);
  108161. }
  108162. if ("cueOutCont" in segment) {
  108163. var _segment$cueOutCont$s = segment.cueOutCont.split("/").map(parseFloat), adOffset = _segment$cueOutCont$s[0], adTotal = _segment$cueOutCont$s[1];
  108164. cue = new window_1.VTTCue(mediaTime, mediaTime + segment.duration, "");
  108165. cue.adStartTime = mediaTime - adOffset;
  108166. cue.adEndTime = cue.adStartTime + adTotal;
  108167. track.addCue(cue);
  108168. }
  108169. }
  108170. mediaTime += segment.duration;
  108171. }
  108172. };
  108173. var MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC = 86400;
  108174. var syncPointStrategies = [
  108175. {
  108176. name: "VOD",
  108177. run: function run(syncController, playlist, duration5, currentTimeline, currentTime) {
  108178. if (duration5 !== Infinity) {
  108179. var syncPoint = {
  108180. time: 0,
  108181. segmentIndex: 0,
  108182. partIndex: null
  108183. };
  108184. return syncPoint;
  108185. }
  108186. return null;
  108187. }
  108188. },
  108189. {
  108190. name: "ProgramDateTime",
  108191. run: function run2(syncController, playlist, duration5, currentTimeline, currentTime) {
  108192. if (!Object.keys(syncController.timelineToDatetimeMappings).length) {
  108193. return null;
  108194. }
  108195. var syncPoint = null;
  108196. var lastDistance = null;
  108197. var partsAndSegments = getPartsAndSegments(playlist);
  108198. currentTime = currentTime || 0;
  108199. for (var i2 = 0; i2 < partsAndSegments.length; i2++) {
  108200. var index2 = playlist.endList || currentTime === 0 ? i2 : partsAndSegments.length - (i2 + 1);
  108201. var partAndSegment = partsAndSegments[index2];
  108202. var segment = partAndSegment.segment;
  108203. var datetimeMapping = syncController.timelineToDatetimeMappings[segment.timeline];
  108204. if (!datetimeMapping || !segment.dateTimeObject) {
  108205. continue;
  108206. }
  108207. var segmentTime = segment.dateTimeObject.getTime() / 1e3;
  108208. var start2 = segmentTime + datetimeMapping;
  108209. if (segment.parts && typeof partAndSegment.partIndex === "number") {
  108210. for (var z = 0; z < partAndSegment.partIndex; z++) {
  108211. start2 += segment.parts[z].duration;
  108212. }
  108213. }
  108214. var distance2 = Math.abs(currentTime - start2);
  108215. if (lastDistance !== null && (distance2 === 0 || lastDistance < distance2)) {
  108216. break;
  108217. }
  108218. lastDistance = distance2;
  108219. syncPoint = {
  108220. time: start2,
  108221. segmentIndex: partAndSegment.segmentIndex,
  108222. partIndex: partAndSegment.partIndex
  108223. };
  108224. }
  108225. return syncPoint;
  108226. }
  108227. },
  108228. {
  108229. name: "Segment",
  108230. run: function run3(syncController, playlist, duration5, currentTimeline, currentTime) {
  108231. var syncPoint = null;
  108232. var lastDistance = null;
  108233. currentTime = currentTime || 0;
  108234. var partsAndSegments = getPartsAndSegments(playlist);
  108235. for (var i2 = 0; i2 < partsAndSegments.length; i2++) {
  108236. var index2 = playlist.endList || currentTime === 0 ? i2 : partsAndSegments.length - (i2 + 1);
  108237. var partAndSegment = partsAndSegments[index2];
  108238. var segment = partAndSegment.segment;
  108239. var start2 = partAndSegment.part && partAndSegment.part.start || segment && segment.start;
  108240. if (segment.timeline === currentTimeline && typeof start2 !== "undefined") {
  108241. var distance2 = Math.abs(currentTime - start2);
  108242. if (lastDistance !== null && lastDistance < distance2) {
  108243. break;
  108244. }
  108245. if (!syncPoint || lastDistance === null || lastDistance >= distance2) {
  108246. lastDistance = distance2;
  108247. syncPoint = {
  108248. time: start2,
  108249. segmentIndex: partAndSegment.segmentIndex,
  108250. partIndex: partAndSegment.partIndex
  108251. };
  108252. }
  108253. }
  108254. }
  108255. return syncPoint;
  108256. }
  108257. },
  108258. {
  108259. name: "Discontinuity",
  108260. run: function run4(syncController, playlist, duration5, currentTimeline, currentTime) {
  108261. var syncPoint = null;
  108262. currentTime = currentTime || 0;
  108263. if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
  108264. var lastDistance = null;
  108265. for (var i2 = 0; i2 < playlist.discontinuityStarts.length; i2++) {
  108266. var segmentIndex = playlist.discontinuityStarts[i2];
  108267. var discontinuity = playlist.discontinuitySequence + i2 + 1;
  108268. var discontinuitySync = syncController.discontinuities[discontinuity];
  108269. if (discontinuitySync) {
  108270. var distance2 = Math.abs(currentTime - discontinuitySync.time);
  108271. if (lastDistance !== null && lastDistance < distance2) {
  108272. break;
  108273. }
  108274. if (!syncPoint || lastDistance === null || lastDistance >= distance2) {
  108275. lastDistance = distance2;
  108276. syncPoint = {
  108277. time: discontinuitySync.time,
  108278. segmentIndex,
  108279. partIndex: null
  108280. };
  108281. }
  108282. }
  108283. }
  108284. }
  108285. return syncPoint;
  108286. }
  108287. },
  108288. {
  108289. name: "Playlist",
  108290. run: function run5(syncController, playlist, duration5, currentTimeline, currentTime) {
  108291. if (playlist.syncInfo) {
  108292. var syncPoint = {
  108293. time: playlist.syncInfo.time,
  108294. segmentIndex: playlist.syncInfo.mediaSequence - playlist.mediaSequence,
  108295. partIndex: null
  108296. };
  108297. return syncPoint;
  108298. }
  108299. return null;
  108300. }
  108301. }
  108302. ];
  108303. var SyncController = /* @__PURE__ */ function(_videojs$EventTarget) {
  108304. _inheritsLoose(SyncController2, _videojs$EventTarget);
  108305. function SyncController2(options2) {
  108306. var _this;
  108307. _this = _videojs$EventTarget.call(this) || this;
  108308. _this.timelines = [];
  108309. _this.discontinuities = [];
  108310. _this.timelineToDatetimeMappings = {};
  108311. _this.logger_ = logger("SyncController");
  108312. return _this;
  108313. }
  108314. var _proto = SyncController2.prototype;
  108315. _proto.getSyncPoint = function getSyncPoint(playlist, duration5, currentTimeline, currentTime) {
  108316. var syncPoints = this.runStrategies_(playlist, duration5, currentTimeline, currentTime);
  108317. if (!syncPoints.length) {
  108318. return null;
  108319. }
  108320. return this.selectSyncPoint_(syncPoints, {
  108321. key: "time",
  108322. value: currentTime
  108323. });
  108324. };
  108325. _proto.getExpiredTime = function getExpiredTime(playlist, duration5) {
  108326. if (!playlist || !playlist.segments) {
  108327. return null;
  108328. }
  108329. var syncPoints = this.runStrategies_(playlist, duration5, playlist.discontinuitySequence, 0);
  108330. if (!syncPoints.length) {
  108331. return null;
  108332. }
  108333. var syncPoint = this.selectSyncPoint_(syncPoints, {
  108334. key: "segmentIndex",
  108335. value: 0
  108336. });
  108337. if (syncPoint.segmentIndex > 0) {
  108338. syncPoint.time *= -1;
  108339. }
  108340. return Math.abs(syncPoint.time + sumDurations({
  108341. defaultDuration: playlist.targetDuration,
  108342. durationList: playlist.segments,
  108343. startIndex: syncPoint.segmentIndex,
  108344. endIndex: 0
  108345. }));
  108346. };
  108347. _proto.runStrategies_ = function runStrategies_(playlist, duration5, currentTimeline, currentTime) {
  108348. var syncPoints = [];
  108349. for (var i2 = 0; i2 < syncPointStrategies.length; i2++) {
  108350. var strategy = syncPointStrategies[i2];
  108351. var syncPoint = strategy.run(this, playlist, duration5, currentTimeline, currentTime);
  108352. if (syncPoint) {
  108353. syncPoint.strategy = strategy.name;
  108354. syncPoints.push({
  108355. strategy: strategy.name,
  108356. syncPoint
  108357. });
  108358. }
  108359. }
  108360. return syncPoints;
  108361. };
  108362. _proto.selectSyncPoint_ = function selectSyncPoint_(syncPoints, target) {
  108363. var bestSyncPoint = syncPoints[0].syncPoint;
  108364. var bestDistance = Math.abs(syncPoints[0].syncPoint[target.key] - target.value);
  108365. var bestStrategy = syncPoints[0].strategy;
  108366. for (var i2 = 1; i2 < syncPoints.length; i2++) {
  108367. var newDistance = Math.abs(syncPoints[i2].syncPoint[target.key] - target.value);
  108368. if (newDistance < bestDistance) {
  108369. bestDistance = newDistance;
  108370. bestSyncPoint = syncPoints[i2].syncPoint;
  108371. bestStrategy = syncPoints[i2].strategy;
  108372. }
  108373. }
  108374. this.logger_("syncPoint for [" + target.key + ": " + target.value + "] chosen with strategy" + (" [" + bestStrategy + "]: [time:" + bestSyncPoint.time + ",") + (" segmentIndex:" + bestSyncPoint.segmentIndex) + (typeof bestSyncPoint.partIndex === "number" ? ",partIndex:" + bestSyncPoint.partIndex : "") + "]");
  108375. return bestSyncPoint;
  108376. };
  108377. _proto.saveExpiredSegmentInfo = function saveExpiredSegmentInfo(oldPlaylist, newPlaylist) {
  108378. var mediaSequenceDiff = newPlaylist.mediaSequence - oldPlaylist.mediaSequence;
  108379. if (mediaSequenceDiff > MAX_MEDIA_SEQUENCE_DIFF_FOR_SYNC) {
  108380. videojs.log.warn("Not saving expired segment info. Media sequence gap " + mediaSequenceDiff + " is too large.");
  108381. return;
  108382. }
  108383. for (var i2 = mediaSequenceDiff - 1; i2 >= 0; i2--) {
  108384. var lastRemovedSegment = oldPlaylist.segments[i2];
  108385. if (lastRemovedSegment && typeof lastRemovedSegment.start !== "undefined") {
  108386. newPlaylist.syncInfo = {
  108387. mediaSequence: oldPlaylist.mediaSequence + i2,
  108388. time: lastRemovedSegment.start
  108389. };
  108390. this.logger_("playlist refresh sync: [time:" + newPlaylist.syncInfo.time + "," + (" mediaSequence: " + newPlaylist.syncInfo.mediaSequence + "]"));
  108391. this.trigger("syncinfoupdate");
  108392. break;
  108393. }
  108394. }
  108395. };
  108396. _proto.setDateTimeMappingForStart = function setDateTimeMappingForStart(playlist) {
  108397. this.timelineToDatetimeMappings = {};
  108398. if (playlist.segments && playlist.segments.length && playlist.segments[0].dateTimeObject) {
  108399. var firstSegment = playlist.segments[0];
  108400. var playlistTimestamp = firstSegment.dateTimeObject.getTime() / 1e3;
  108401. this.timelineToDatetimeMappings[firstSegment.timeline] = -playlistTimestamp;
  108402. }
  108403. };
  108404. _proto.saveSegmentTimingInfo = function saveSegmentTimingInfo(_ref) {
  108405. var segmentInfo = _ref.segmentInfo, shouldSaveTimelineMapping = _ref.shouldSaveTimelineMapping;
  108406. var didCalculateSegmentTimeMapping = this.calculateSegmentTimeMapping_(segmentInfo, segmentInfo.timingInfo, shouldSaveTimelineMapping);
  108407. var segment = segmentInfo.segment;
  108408. if (didCalculateSegmentTimeMapping) {
  108409. this.saveDiscontinuitySyncInfo_(segmentInfo);
  108410. if (!segmentInfo.playlist.syncInfo) {
  108411. segmentInfo.playlist.syncInfo = {
  108412. mediaSequence: segmentInfo.playlist.mediaSequence + segmentInfo.mediaIndex,
  108413. time: segment.start
  108414. };
  108415. }
  108416. }
  108417. var dateTime = segment.dateTimeObject;
  108418. if (segment.discontinuity && shouldSaveTimelineMapping && dateTime) {
  108419. this.timelineToDatetimeMappings[segment.timeline] = -(dateTime.getTime() / 1e3);
  108420. }
  108421. };
  108422. _proto.timestampOffsetForTimeline = function timestampOffsetForTimeline(timeline) {
  108423. if (typeof this.timelines[timeline] === "undefined") {
  108424. return null;
  108425. }
  108426. return this.timelines[timeline].time;
  108427. };
  108428. _proto.mappingForTimeline = function mappingForTimeline(timeline) {
  108429. if (typeof this.timelines[timeline] === "undefined") {
  108430. return null;
  108431. }
  108432. return this.timelines[timeline].mapping;
  108433. };
  108434. _proto.calculateSegmentTimeMapping_ = function calculateSegmentTimeMapping_(segmentInfo, timingInfo, shouldSaveTimelineMapping) {
  108435. var segment = segmentInfo.segment;
  108436. var part = segmentInfo.part;
  108437. var mappingObj = this.timelines[segmentInfo.timeline];
  108438. var start2;
  108439. var end;
  108440. if (typeof segmentInfo.timestampOffset === "number") {
  108441. mappingObj = {
  108442. time: segmentInfo.startOfSegment,
  108443. mapping: segmentInfo.startOfSegment - timingInfo.start
  108444. };
  108445. if (shouldSaveTimelineMapping) {
  108446. this.timelines[segmentInfo.timeline] = mappingObj;
  108447. this.trigger("timestampoffset");
  108448. this.logger_("time mapping for timeline " + segmentInfo.timeline + ": " + ("[time: " + mappingObj.time + "] [mapping: " + mappingObj.mapping + "]"));
  108449. }
  108450. start2 = segmentInfo.startOfSegment;
  108451. end = timingInfo.end + mappingObj.mapping;
  108452. } else if (mappingObj) {
  108453. start2 = timingInfo.start + mappingObj.mapping;
  108454. end = timingInfo.end + mappingObj.mapping;
  108455. } else {
  108456. return false;
  108457. }
  108458. if (part) {
  108459. part.start = start2;
  108460. part.end = end;
  108461. }
  108462. if (!segment.start || start2 < segment.start) {
  108463. segment.start = start2;
  108464. }
  108465. segment.end = end;
  108466. return true;
  108467. };
  108468. _proto.saveDiscontinuitySyncInfo_ = function saveDiscontinuitySyncInfo_(segmentInfo) {
  108469. var playlist = segmentInfo.playlist;
  108470. var segment = segmentInfo.segment;
  108471. if (segment.discontinuity) {
  108472. this.discontinuities[segment.timeline] = {
  108473. time: segment.start,
  108474. accuracy: 0
  108475. };
  108476. } else if (playlist.discontinuityStarts && playlist.discontinuityStarts.length) {
  108477. for (var i2 = 0; i2 < playlist.discontinuityStarts.length; i2++) {
  108478. var segmentIndex = playlist.discontinuityStarts[i2];
  108479. var discontinuity = playlist.discontinuitySequence + i2 + 1;
  108480. var mediaIndexDiff = segmentIndex - segmentInfo.mediaIndex;
  108481. var accuracy = Math.abs(mediaIndexDiff);
  108482. if (!this.discontinuities[discontinuity] || this.discontinuities[discontinuity].accuracy > accuracy) {
  108483. var time = void 0;
  108484. if (mediaIndexDiff < 0) {
  108485. time = segment.start - sumDurations({
  108486. defaultDuration: playlist.targetDuration,
  108487. durationList: playlist.segments,
  108488. startIndex: segmentInfo.mediaIndex,
  108489. endIndex: segmentIndex
  108490. });
  108491. } else {
  108492. time = segment.end + sumDurations({
  108493. defaultDuration: playlist.targetDuration,
  108494. durationList: playlist.segments,
  108495. startIndex: segmentInfo.mediaIndex + 1,
  108496. endIndex: segmentIndex
  108497. });
  108498. }
  108499. this.discontinuities[discontinuity] = {
  108500. time,
  108501. accuracy
  108502. };
  108503. }
  108504. }
  108505. }
  108506. };
  108507. _proto.dispose = function dispose() {
  108508. this.trigger("dispose");
  108509. this.off();
  108510. };
  108511. return SyncController2;
  108512. }(videojs.EventTarget);
  108513. var TimelineChangeController = /* @__PURE__ */ function(_videojs$EventTarget) {
  108514. _inheritsLoose(TimelineChangeController2, _videojs$EventTarget);
  108515. function TimelineChangeController2() {
  108516. var _this;
  108517. _this = _videojs$EventTarget.call(this) || this;
  108518. _this.pendingTimelineChanges_ = {};
  108519. _this.lastTimelineChanges_ = {};
  108520. return _this;
  108521. }
  108522. var _proto = TimelineChangeController2.prototype;
  108523. _proto.clearPendingTimelineChange = function clearPendingTimelineChange(type2) {
  108524. this.pendingTimelineChanges_[type2] = null;
  108525. this.trigger("pendingtimelinechange");
  108526. };
  108527. _proto.pendingTimelineChange = function pendingTimelineChange(_ref) {
  108528. var type2 = _ref.type, from3 = _ref.from, to = _ref.to;
  108529. if (typeof from3 === "number" && typeof to === "number") {
  108530. this.pendingTimelineChanges_[type2] = {
  108531. type: type2,
  108532. from: from3,
  108533. to
  108534. };
  108535. this.trigger("pendingtimelinechange");
  108536. }
  108537. return this.pendingTimelineChanges_[type2];
  108538. };
  108539. _proto.lastTimelineChange = function lastTimelineChange(_ref2) {
  108540. var type2 = _ref2.type, from3 = _ref2.from, to = _ref2.to;
  108541. if (typeof from3 === "number" && typeof to === "number") {
  108542. this.lastTimelineChanges_[type2] = {
  108543. type: type2,
  108544. from: from3,
  108545. to
  108546. };
  108547. delete this.pendingTimelineChanges_[type2];
  108548. this.trigger("timelinechange");
  108549. }
  108550. return this.lastTimelineChanges_[type2];
  108551. };
  108552. _proto.dispose = function dispose() {
  108553. this.trigger("dispose");
  108554. this.pendingTimelineChanges_ = {};
  108555. this.lastTimelineChanges_ = {};
  108556. this.off();
  108557. };
  108558. return TimelineChangeController2;
  108559. }(videojs.EventTarget);
  108560. var workerCode = transform(getWorkerString(function() {
  108561. var commonjsGlobal2 = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
  108562. function createCommonjsModule(fn2, basedir, module2) {
  108563. return module2 = {
  108564. path: basedir,
  108565. exports: {},
  108566. require: function require2(path, base2) {
  108567. return commonjsRequire(path, base2 === void 0 || base2 === null ? module2.path : base2);
  108568. }
  108569. }, fn2(module2, module2.exports), module2.exports;
  108570. }
  108571. function commonjsRequire() {
  108572. throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs");
  108573. }
  108574. var createClass = createCommonjsModule(function(module2) {
  108575. function _defineProperties(target, props) {
  108576. for (var i2 = 0; i2 < props.length; i2++) {
  108577. var descriptor = props[i2];
  108578. descriptor.enumerable = descriptor.enumerable || false;
  108579. descriptor.configurable = true;
  108580. if ("value" in descriptor)
  108581. descriptor.writable = true;
  108582. Object.defineProperty(target, descriptor.key, descriptor);
  108583. }
  108584. }
  108585. function _createClass(Constructor, protoProps, staticProps) {
  108586. if (protoProps)
  108587. _defineProperties(Constructor.prototype, protoProps);
  108588. if (staticProps)
  108589. _defineProperties(Constructor, staticProps);
  108590. return Constructor;
  108591. }
  108592. module2.exports = _createClass;
  108593. module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
  108594. });
  108595. var setPrototypeOf = createCommonjsModule(function(module2) {
  108596. function _setPrototypeOf2(o, p) {
  108597. module2.exports = _setPrototypeOf2 = Object.setPrototypeOf || function _setPrototypeOf3(o2, p2) {
  108598. o2.__proto__ = p2;
  108599. return o2;
  108600. };
  108601. module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
  108602. return _setPrototypeOf2(o, p);
  108603. }
  108604. module2.exports = _setPrototypeOf2;
  108605. module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
  108606. });
  108607. var inheritsLoose = createCommonjsModule(function(module2) {
  108608. function _inheritsLoose2(subClass, superClass) {
  108609. subClass.prototype = Object.create(superClass.prototype);
  108610. subClass.prototype.constructor = subClass;
  108611. setPrototypeOf(subClass, superClass);
  108612. }
  108613. module2.exports = _inheritsLoose2;
  108614. module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
  108615. });
  108616. var Stream2 = /* @__PURE__ */ function() {
  108617. function Stream3() {
  108618. this.listeners = {};
  108619. }
  108620. var _proto = Stream3.prototype;
  108621. _proto.on = function on3(type2, listener) {
  108622. if (!this.listeners[type2]) {
  108623. this.listeners[type2] = [];
  108624. }
  108625. this.listeners[type2].push(listener);
  108626. };
  108627. _proto.off = function off2(type2, listener) {
  108628. if (!this.listeners[type2]) {
  108629. return false;
  108630. }
  108631. var index2 = this.listeners[type2].indexOf(listener);
  108632. this.listeners[type2] = this.listeners[type2].slice(0);
  108633. this.listeners[type2].splice(index2, 1);
  108634. return index2 > -1;
  108635. };
  108636. _proto.trigger = function trigger2(type2) {
  108637. var callbacks = this.listeners[type2];
  108638. if (!callbacks) {
  108639. return;
  108640. }
  108641. if (arguments.length === 2) {
  108642. var length = callbacks.length;
  108643. for (var i2 = 0; i2 < length; ++i2) {
  108644. callbacks[i2].call(this, arguments[1]);
  108645. }
  108646. } else {
  108647. var args = Array.prototype.slice.call(arguments, 1);
  108648. var _length = callbacks.length;
  108649. for (var _i = 0; _i < _length; ++_i) {
  108650. callbacks[_i].apply(this, args);
  108651. }
  108652. }
  108653. };
  108654. _proto.dispose = function dispose() {
  108655. this.listeners = {};
  108656. };
  108657. _proto.pipe = function pipe(destination2) {
  108658. this.on("data", function(data) {
  108659. destination2.push(data);
  108660. });
  108661. };
  108662. return Stream3;
  108663. }();
  108664. /*! @name pkcs7 @version 1.0.4 @license Apache-2.0 */
  108665. function unpad(padded) {
  108666. return padded.subarray(0, padded.byteLength - padded[padded.byteLength - 1]);
  108667. }
  108668. /*! @name aes-decrypter @version 3.1.3 @license Apache-2.0 */
  108669. var precompute = function precompute2() {
  108670. var tables = [[[], [], [], [], []], [[], [], [], [], []]];
  108671. var encTable = tables[0];
  108672. var decTable = tables[1];
  108673. var sbox = encTable[4];
  108674. var sboxInv = decTable[4];
  108675. var i2;
  108676. var x;
  108677. var xInv;
  108678. var d2 = [];
  108679. var th = [];
  108680. var x2;
  108681. var x4;
  108682. var x8;
  108683. var s;
  108684. var tEnc;
  108685. var tDec;
  108686. for (i2 = 0; i2 < 256; i2++) {
  108687. th[(d2[i2] = i2 << 1 ^ (i2 >> 7) * 283) ^ i2] = i2;
  108688. }
  108689. for (x = xInv = 0; !sbox[x]; x ^= x2 || 1, xInv = th[xInv] || 1) {
  108690. s = xInv ^ xInv << 1 ^ xInv << 2 ^ xInv << 3 ^ xInv << 4;
  108691. s = s >> 8 ^ s & 255 ^ 99;
  108692. sbox[x] = s;
  108693. sboxInv[s] = x;
  108694. x8 = d2[x4 = d2[x2 = d2[x]]];
  108695. tDec = x8 * 16843009 ^ x4 * 65537 ^ x2 * 257 ^ x * 16843008;
  108696. tEnc = d2[s] * 257 ^ s * 16843008;
  108697. for (i2 = 0; i2 < 4; i2++) {
  108698. encTable[i2][x] = tEnc = tEnc << 24 ^ tEnc >>> 8;
  108699. decTable[i2][s] = tDec = tDec << 24 ^ tDec >>> 8;
  108700. }
  108701. }
  108702. for (i2 = 0; i2 < 5; i2++) {
  108703. encTable[i2] = encTable[i2].slice(0);
  108704. decTable[i2] = decTable[i2].slice(0);
  108705. }
  108706. return tables;
  108707. };
  108708. var aesTables = null;
  108709. var AES = /* @__PURE__ */ function() {
  108710. function AES2(key) {
  108711. if (!aesTables) {
  108712. aesTables = precompute();
  108713. }
  108714. this._tables = [[aesTables[0][0].slice(), aesTables[0][1].slice(), aesTables[0][2].slice(), aesTables[0][3].slice(), aesTables[0][4].slice()], [aesTables[1][0].slice(), aesTables[1][1].slice(), aesTables[1][2].slice(), aesTables[1][3].slice(), aesTables[1][4].slice()]];
  108715. var i2;
  108716. var j;
  108717. var tmp;
  108718. var sbox = this._tables[0][4];
  108719. var decTable = this._tables[1];
  108720. var keyLen = key.length;
  108721. var rcon = 1;
  108722. if (keyLen !== 4 && keyLen !== 6 && keyLen !== 8) {
  108723. throw new Error("Invalid aes key size");
  108724. }
  108725. var encKey = key.slice(0);
  108726. var decKey = [];
  108727. this._key = [encKey, decKey];
  108728. for (i2 = keyLen; i2 < 4 * keyLen + 28; i2++) {
  108729. tmp = encKey[i2 - 1];
  108730. if (i2 % keyLen === 0 || keyLen === 8 && i2 % keyLen === 4) {
  108731. tmp = sbox[tmp >>> 24] << 24 ^ sbox[tmp >> 16 & 255] << 16 ^ sbox[tmp >> 8 & 255] << 8 ^ sbox[tmp & 255];
  108732. if (i2 % keyLen === 0) {
  108733. tmp = tmp << 8 ^ tmp >>> 24 ^ rcon << 24;
  108734. rcon = rcon << 1 ^ (rcon >> 7) * 283;
  108735. }
  108736. }
  108737. encKey[i2] = encKey[i2 - keyLen] ^ tmp;
  108738. }
  108739. for (j = 0; i2; j++, i2--) {
  108740. tmp = encKey[j & 3 ? i2 : i2 - 4];
  108741. if (i2 <= 4 || j < 4) {
  108742. decKey[j] = tmp;
  108743. } else {
  108744. decKey[j] = decTable[0][sbox[tmp >>> 24]] ^ decTable[1][sbox[tmp >> 16 & 255]] ^ decTable[2][sbox[tmp >> 8 & 255]] ^ decTable[3][sbox[tmp & 255]];
  108745. }
  108746. }
  108747. }
  108748. var _proto = AES2.prototype;
  108749. _proto.decrypt = function decrypt4(encrypted0, encrypted1, encrypted2, encrypted3, out, offset) {
  108750. var key = this._key[1];
  108751. var a = encrypted0 ^ key[0];
  108752. var b = encrypted3 ^ key[1];
  108753. var c = encrypted2 ^ key[2];
  108754. var d2 = encrypted1 ^ key[3];
  108755. var a2;
  108756. var b2;
  108757. var c2;
  108758. var nInnerRounds = key.length / 4 - 2;
  108759. var i2;
  108760. var kIndex = 4;
  108761. var table = this._tables[1];
  108762. var table0 = table[0];
  108763. var table1 = table[1];
  108764. var table2 = table[2];
  108765. var table3 = table[3];
  108766. var sbox = table[4];
  108767. for (i2 = 0; i2 < nInnerRounds; i2++) {
  108768. a2 = table0[a >>> 24] ^ table1[b >> 16 & 255] ^ table2[c >> 8 & 255] ^ table3[d2 & 255] ^ key[kIndex];
  108769. b2 = table0[b >>> 24] ^ table1[c >> 16 & 255] ^ table2[d2 >> 8 & 255] ^ table3[a & 255] ^ key[kIndex + 1];
  108770. c2 = table0[c >>> 24] ^ table1[d2 >> 16 & 255] ^ table2[a >> 8 & 255] ^ table3[b & 255] ^ key[kIndex + 2];
  108771. d2 = table0[d2 >>> 24] ^ table1[a >> 16 & 255] ^ table2[b >> 8 & 255] ^ table3[c & 255] ^ key[kIndex + 3];
  108772. kIndex += 4;
  108773. a = a2;
  108774. b = b2;
  108775. c = c2;
  108776. }
  108777. for (i2 = 0; i2 < 4; i2++) {
  108778. out[(3 & -i2) + offset] = sbox[a >>> 24] << 24 ^ sbox[b >> 16 & 255] << 16 ^ sbox[c >> 8 & 255] << 8 ^ sbox[d2 & 255] ^ key[kIndex++];
  108779. a2 = a;
  108780. a = b;
  108781. b = c;
  108782. c = d2;
  108783. d2 = a2;
  108784. }
  108785. };
  108786. return AES2;
  108787. }();
  108788. var AsyncStream = /* @__PURE__ */ function(_Stream) {
  108789. inheritsLoose(AsyncStream2, _Stream);
  108790. function AsyncStream2() {
  108791. var _this;
  108792. _this = _Stream.call(this, Stream2) || this;
  108793. _this.jobs = [];
  108794. _this.delay = 1;
  108795. _this.timeout_ = null;
  108796. return _this;
  108797. }
  108798. var _proto = AsyncStream2.prototype;
  108799. _proto.processJob_ = function processJob_() {
  108800. this.jobs.shift()();
  108801. if (this.jobs.length) {
  108802. this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);
  108803. } else {
  108804. this.timeout_ = null;
  108805. }
  108806. };
  108807. _proto.push = function push(job) {
  108808. this.jobs.push(job);
  108809. if (!this.timeout_) {
  108810. this.timeout_ = setTimeout(this.processJob_.bind(this), this.delay);
  108811. }
  108812. };
  108813. return AsyncStream2;
  108814. }(Stream2);
  108815. var ntoh = function ntoh2(word) {
  108816. return word << 24 | (word & 65280) << 8 | (word & 16711680) >> 8 | word >>> 24;
  108817. };
  108818. var decrypt3 = function decrypt4(encrypted, key, initVector) {
  108819. var encrypted32 = new Int32Array(encrypted.buffer, encrypted.byteOffset, encrypted.byteLength >> 2);
  108820. var decipher = new AES(Array.prototype.slice.call(key));
  108821. var decrypted = new Uint8Array(encrypted.byteLength);
  108822. var decrypted32 = new Int32Array(decrypted.buffer);
  108823. var init0;
  108824. var init1;
  108825. var init2;
  108826. var init3;
  108827. var encrypted0;
  108828. var encrypted1;
  108829. var encrypted2;
  108830. var encrypted3;
  108831. var wordIx;
  108832. init0 = initVector[0];
  108833. init1 = initVector[1];
  108834. init2 = initVector[2];
  108835. init3 = initVector[3];
  108836. for (wordIx = 0; wordIx < encrypted32.length; wordIx += 4) {
  108837. encrypted0 = ntoh(encrypted32[wordIx]);
  108838. encrypted1 = ntoh(encrypted32[wordIx + 1]);
  108839. encrypted2 = ntoh(encrypted32[wordIx + 2]);
  108840. encrypted3 = ntoh(encrypted32[wordIx + 3]);
  108841. decipher.decrypt(encrypted0, encrypted1, encrypted2, encrypted3, decrypted32, wordIx);
  108842. decrypted32[wordIx] = ntoh(decrypted32[wordIx] ^ init0);
  108843. decrypted32[wordIx + 1] = ntoh(decrypted32[wordIx + 1] ^ init1);
  108844. decrypted32[wordIx + 2] = ntoh(decrypted32[wordIx + 2] ^ init2);
  108845. decrypted32[wordIx + 3] = ntoh(decrypted32[wordIx + 3] ^ init3);
  108846. init0 = encrypted0;
  108847. init1 = encrypted1;
  108848. init2 = encrypted2;
  108849. init3 = encrypted3;
  108850. }
  108851. return decrypted;
  108852. };
  108853. var Decrypter2 = /* @__PURE__ */ function() {
  108854. function Decrypter3(encrypted, key, initVector, done) {
  108855. var step = Decrypter3.STEP;
  108856. var encrypted32 = new Int32Array(encrypted.buffer);
  108857. var decrypted = new Uint8Array(encrypted.byteLength);
  108858. var i2 = 0;
  108859. this.asyncStream_ = new AsyncStream();
  108860. this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i2, i2 + step), key, initVector, decrypted));
  108861. for (i2 = step; i2 < encrypted32.length; i2 += step) {
  108862. initVector = new Uint32Array([ntoh(encrypted32[i2 - 4]), ntoh(encrypted32[i2 - 3]), ntoh(encrypted32[i2 - 2]), ntoh(encrypted32[i2 - 1])]);
  108863. this.asyncStream_.push(this.decryptChunk_(encrypted32.subarray(i2, i2 + step), key, initVector, decrypted));
  108864. }
  108865. this.asyncStream_.push(function() {
  108866. done(null, unpad(decrypted));
  108867. });
  108868. }
  108869. var _proto = Decrypter3.prototype;
  108870. _proto.decryptChunk_ = function decryptChunk_(encrypted, key, initVector, decrypted) {
  108871. return function() {
  108872. var bytes = decrypt3(encrypted, key, initVector);
  108873. decrypted.set(bytes, encrypted.byteOffset);
  108874. };
  108875. };
  108876. createClass(Decrypter3, null, [{
  108877. key: "STEP",
  108878. get: function get7() {
  108879. return 32e3;
  108880. }
  108881. }]);
  108882. return Decrypter3;
  108883. }();
  108884. var win2;
  108885. if (typeof window !== "undefined") {
  108886. win2 = window;
  108887. } else if (typeof commonjsGlobal2 !== "undefined") {
  108888. win2 = commonjsGlobal2;
  108889. } else if (typeof self !== "undefined") {
  108890. win2 = self;
  108891. } else {
  108892. win2 = {};
  108893. }
  108894. var window_12 = win2;
  108895. var isArrayBufferView4 = function isArrayBufferView5(obj) {
  108896. if (ArrayBuffer.isView === "function") {
  108897. return ArrayBuffer.isView(obj);
  108898. }
  108899. return obj && obj.buffer instanceof ArrayBuffer;
  108900. };
  108901. var BigInt2 = window_12.BigInt || Number;
  108902. [BigInt2("0x1"), BigInt2("0x100"), BigInt2("0x10000"), BigInt2("0x1000000"), BigInt2("0x100000000"), BigInt2("0x10000000000"), BigInt2("0x1000000000000"), BigInt2("0x100000000000000"), BigInt2("0x10000000000000000")];
  108903. var createTransferableMessage3 = function createTransferableMessage4(message) {
  108904. var transferable = {};
  108905. Object.keys(message).forEach(function(key) {
  108906. var value = message[key];
  108907. if (isArrayBufferView4(value)) {
  108908. transferable[key] = {
  108909. bytes: value.buffer,
  108910. byteOffset: value.byteOffset,
  108911. byteLength: value.byteLength
  108912. };
  108913. } else {
  108914. transferable[key] = value;
  108915. }
  108916. });
  108917. return transferable;
  108918. };
  108919. self.onmessage = function(event2) {
  108920. var data = event2.data;
  108921. var encrypted = new Uint8Array(data.encrypted.bytes, data.encrypted.byteOffset, data.encrypted.byteLength);
  108922. var key = new Uint32Array(data.key.bytes, data.key.byteOffset, data.key.byteLength / 4);
  108923. var iv = new Uint32Array(data.iv.bytes, data.iv.byteOffset, data.iv.byteLength / 4);
  108924. new Decrypter2(encrypted, key, iv, function(err, bytes) {
  108925. self.postMessage(createTransferableMessage3({
  108926. source: data.source,
  108927. decrypted: bytes
  108928. }), [bytes.buffer]);
  108929. });
  108930. };
  108931. }));
  108932. var Decrypter = factory(workerCode);
  108933. var audioTrackKind_ = function audioTrackKind_2(properties) {
  108934. var kind = properties["default"] ? "main" : "alternative";
  108935. if (properties.characteristics && properties.characteristics.indexOf("public.accessibility.describes-video") >= 0) {
  108936. kind = "main-desc";
  108937. }
  108938. return kind;
  108939. };
  108940. var stopLoaders = function stopLoaders2(segmentLoader, mediaType) {
  108941. segmentLoader.abort();
  108942. segmentLoader.pause();
  108943. if (mediaType && mediaType.activePlaylistLoader) {
  108944. mediaType.activePlaylistLoader.pause();
  108945. mediaType.activePlaylistLoader = null;
  108946. }
  108947. };
  108948. var startLoaders = function startLoaders2(playlistLoader, mediaType) {
  108949. mediaType.activePlaylistLoader = playlistLoader;
  108950. playlistLoader.load();
  108951. };
  108952. var onGroupChanged = function onGroupChanged2(type2, settings) {
  108953. return function() {
  108954. var _settings$segmentLoad = settings.segmentLoaders, segmentLoader = _settings$segmentLoad[type2], mainSegmentLoader = _settings$segmentLoad.main, mediaType = settings.mediaTypes[type2];
  108955. var activeTrack2 = mediaType.activeTrack();
  108956. var activeGroup3 = mediaType.getActiveGroup();
  108957. var previousActiveLoader = mediaType.activePlaylistLoader;
  108958. var lastGroup = mediaType.lastGroup_;
  108959. if (activeGroup3 && lastGroup && activeGroup3.id === lastGroup.id) {
  108960. return;
  108961. }
  108962. mediaType.lastGroup_ = activeGroup3;
  108963. mediaType.lastTrack_ = activeTrack2;
  108964. stopLoaders(segmentLoader, mediaType);
  108965. if (!activeGroup3 || activeGroup3.isMasterPlaylist) {
  108966. return;
  108967. }
  108968. if (!activeGroup3.playlistLoader) {
  108969. if (previousActiveLoader) {
  108970. mainSegmentLoader.resetEverything();
  108971. }
  108972. return;
  108973. }
  108974. segmentLoader.resyncLoader();
  108975. startLoaders(activeGroup3.playlistLoader, mediaType);
  108976. };
  108977. };
  108978. var onGroupChanging = function onGroupChanging2(type2, settings) {
  108979. return function() {
  108980. var segmentLoader = settings.segmentLoaders[type2], mediaType = settings.mediaTypes[type2];
  108981. mediaType.lastGroup_ = null;
  108982. segmentLoader.abort();
  108983. segmentLoader.pause();
  108984. };
  108985. };
  108986. var onTrackChanged = function onTrackChanged2(type2, settings) {
  108987. return function() {
  108988. var masterPlaylistLoader = settings.masterPlaylistLoader, _settings$segmentLoad2 = settings.segmentLoaders, segmentLoader = _settings$segmentLoad2[type2], mainSegmentLoader = _settings$segmentLoad2.main, mediaType = settings.mediaTypes[type2];
  108989. var activeTrack2 = mediaType.activeTrack();
  108990. var activeGroup3 = mediaType.getActiveGroup();
  108991. var previousActiveLoader = mediaType.activePlaylistLoader;
  108992. var lastTrack = mediaType.lastTrack_;
  108993. if (lastTrack && activeTrack2 && lastTrack.id === activeTrack2.id) {
  108994. return;
  108995. }
  108996. mediaType.lastGroup_ = activeGroup3;
  108997. mediaType.lastTrack_ = activeTrack2;
  108998. stopLoaders(segmentLoader, mediaType);
  108999. if (!activeGroup3) {
  109000. return;
  109001. }
  109002. if (activeGroup3.isMasterPlaylist) {
  109003. if (!activeTrack2 || !lastTrack || activeTrack2.id === lastTrack.id) {
  109004. return;
  109005. }
  109006. var mpc = settings.vhs.masterPlaylistController_;
  109007. var newPlaylist = mpc.selectPlaylist();
  109008. if (mpc.media() === newPlaylist) {
  109009. return;
  109010. }
  109011. mediaType.logger_("track change. Switching master audio from " + lastTrack.id + " to " + activeTrack2.id);
  109012. masterPlaylistLoader.pause();
  109013. mainSegmentLoader.resetEverything();
  109014. mpc.fastQualityChange_(newPlaylist);
  109015. return;
  109016. }
  109017. if (type2 === "AUDIO") {
  109018. if (!activeGroup3.playlistLoader) {
  109019. mainSegmentLoader.setAudio(true);
  109020. mainSegmentLoader.resetEverything();
  109021. return;
  109022. }
  109023. segmentLoader.setAudio(true);
  109024. mainSegmentLoader.setAudio(false);
  109025. }
  109026. if (previousActiveLoader === activeGroup3.playlistLoader) {
  109027. startLoaders(activeGroup3.playlistLoader, mediaType);
  109028. return;
  109029. }
  109030. if (segmentLoader.track) {
  109031. segmentLoader.track(activeTrack2);
  109032. }
  109033. segmentLoader.resetEverything();
  109034. startLoaders(activeGroup3.playlistLoader, mediaType);
  109035. };
  109036. };
  109037. var onError = {
  109038. AUDIO: function AUDIO(type2, settings) {
  109039. return function() {
  109040. var segmentLoader = settings.segmentLoaders[type2], mediaType = settings.mediaTypes[type2], blacklistCurrentPlaylist = settings.blacklistCurrentPlaylist;
  109041. stopLoaders(segmentLoader, mediaType);
  109042. var activeTrack2 = mediaType.activeTrack();
  109043. var activeGroup3 = mediaType.activeGroup();
  109044. var id = (activeGroup3.filter(function(group) {
  109045. return group["default"];
  109046. })[0] || activeGroup3[0]).id;
  109047. var defaultTrack = mediaType.tracks[id];
  109048. if (activeTrack2 === defaultTrack) {
  109049. blacklistCurrentPlaylist({
  109050. message: "Problem encountered loading the default audio track."
  109051. });
  109052. return;
  109053. }
  109054. videojs.log.warn("Problem encountered loading the alternate audio track.Switching back to default.");
  109055. for (var trackId in mediaType.tracks) {
  109056. mediaType.tracks[trackId].enabled = mediaType.tracks[trackId] === defaultTrack;
  109057. }
  109058. mediaType.onTrackChanged();
  109059. };
  109060. },
  109061. SUBTITLES: function SUBTITLES(type2, settings) {
  109062. return function() {
  109063. var segmentLoader = settings.segmentLoaders[type2], mediaType = settings.mediaTypes[type2];
  109064. videojs.log.warn("Problem encountered loading the subtitle track.Disabling subtitle track.");
  109065. stopLoaders(segmentLoader, mediaType);
  109066. var track = mediaType.activeTrack();
  109067. if (track) {
  109068. track.mode = "disabled";
  109069. }
  109070. mediaType.onTrackChanged();
  109071. };
  109072. }
  109073. };
  109074. var setupListeners = {
  109075. AUDIO: function AUDIO2(type2, playlistLoader, settings) {
  109076. if (!playlistLoader) {
  109077. return;
  109078. }
  109079. var tech = settings.tech, requestOptions = settings.requestOptions, segmentLoader = settings.segmentLoaders[type2];
  109080. playlistLoader.on("loadedmetadata", function() {
  109081. var media = playlistLoader.media();
  109082. segmentLoader.playlist(media, requestOptions);
  109083. if (!tech.paused() || media.endList && tech.preload() !== "none") {
  109084. segmentLoader.load();
  109085. }
  109086. });
  109087. playlistLoader.on("loadedplaylist", function() {
  109088. segmentLoader.playlist(playlistLoader.media(), requestOptions);
  109089. if (!tech.paused()) {
  109090. segmentLoader.load();
  109091. }
  109092. });
  109093. playlistLoader.on("error", onError[type2](type2, settings));
  109094. },
  109095. SUBTITLES: function SUBTITLES2(type2, playlistLoader, settings) {
  109096. var tech = settings.tech, requestOptions = settings.requestOptions, segmentLoader = settings.segmentLoaders[type2], mediaType = settings.mediaTypes[type2];
  109097. playlistLoader.on("loadedmetadata", function() {
  109098. var media = playlistLoader.media();
  109099. segmentLoader.playlist(media, requestOptions);
  109100. segmentLoader.track(mediaType.activeTrack());
  109101. if (!tech.paused() || media.endList && tech.preload() !== "none") {
  109102. segmentLoader.load();
  109103. }
  109104. });
  109105. playlistLoader.on("loadedplaylist", function() {
  109106. segmentLoader.playlist(playlistLoader.media(), requestOptions);
  109107. if (!tech.paused()) {
  109108. segmentLoader.load();
  109109. }
  109110. });
  109111. playlistLoader.on("error", onError[type2](type2, settings));
  109112. }
  109113. };
  109114. var initialize = {
  109115. "AUDIO": function AUDIO3(type2, settings) {
  109116. var vhs = settings.vhs, sourceType = settings.sourceType, segmentLoader = settings.segmentLoaders[type2], requestOptions = settings.requestOptions, mediaGroups = settings.master.mediaGroups, _settings$mediaTypes$ = settings.mediaTypes[type2], groups = _settings$mediaTypes$.groups, tracks = _settings$mediaTypes$.tracks, logger_ = _settings$mediaTypes$.logger_, masterPlaylistLoader = settings.masterPlaylistLoader;
  109117. var audioOnlyMaster = isAudioOnly(masterPlaylistLoader.master);
  109118. if (!mediaGroups[type2] || Object.keys(mediaGroups[type2]).length === 0) {
  109119. mediaGroups[type2] = {
  109120. main: {
  109121. "default": {
  109122. "default": true
  109123. }
  109124. }
  109125. };
  109126. if (audioOnlyMaster) {
  109127. mediaGroups[type2].main["default"].playlists = masterPlaylistLoader.master.playlists;
  109128. }
  109129. }
  109130. for (var groupId in mediaGroups[type2]) {
  109131. if (!groups[groupId]) {
  109132. groups[groupId] = [];
  109133. }
  109134. for (var variantLabel in mediaGroups[type2][groupId]) {
  109135. var properties = mediaGroups[type2][groupId][variantLabel];
  109136. var playlistLoader = void 0;
  109137. if (audioOnlyMaster) {
  109138. logger_("AUDIO group '" + groupId + "' label '" + variantLabel + "' is a master playlist");
  109139. properties.isMasterPlaylist = true;
  109140. playlistLoader = null;
  109141. } else if (sourceType === "vhs-json" && properties.playlists) {
  109142. playlistLoader = new PlaylistLoader(properties.playlists[0], vhs, requestOptions);
  109143. } else if (properties.resolvedUri) {
  109144. playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions);
  109145. } else if (properties.playlists && sourceType === "dash") {
  109146. playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader);
  109147. } else {
  109148. playlistLoader = null;
  109149. }
  109150. properties = videojs.mergeOptions({
  109151. id: variantLabel,
  109152. playlistLoader
  109153. }, properties);
  109154. setupListeners[type2](type2, properties.playlistLoader, settings);
  109155. groups[groupId].push(properties);
  109156. if (typeof tracks[variantLabel] === "undefined") {
  109157. var track = new videojs.AudioTrack({
  109158. id: variantLabel,
  109159. kind: audioTrackKind_(properties),
  109160. enabled: false,
  109161. language: properties.language,
  109162. "default": properties["default"],
  109163. label: variantLabel
  109164. });
  109165. tracks[variantLabel] = track;
  109166. }
  109167. }
  109168. }
  109169. segmentLoader.on("error", onError[type2](type2, settings));
  109170. },
  109171. "SUBTITLES": function SUBTITLES3(type2, settings) {
  109172. var tech = settings.tech, vhs = settings.vhs, sourceType = settings.sourceType, segmentLoader = settings.segmentLoaders[type2], requestOptions = settings.requestOptions, mediaGroups = settings.master.mediaGroups, _settings$mediaTypes$2 = settings.mediaTypes[type2], groups = _settings$mediaTypes$2.groups, tracks = _settings$mediaTypes$2.tracks, masterPlaylistLoader = settings.masterPlaylistLoader;
  109173. for (var groupId in mediaGroups[type2]) {
  109174. if (!groups[groupId]) {
  109175. groups[groupId] = [];
  109176. }
  109177. for (var variantLabel in mediaGroups[type2][groupId]) {
  109178. if (mediaGroups[type2][groupId][variantLabel].forced) {
  109179. continue;
  109180. }
  109181. var properties = mediaGroups[type2][groupId][variantLabel];
  109182. var playlistLoader = void 0;
  109183. if (sourceType === "hls") {
  109184. playlistLoader = new PlaylistLoader(properties.resolvedUri, vhs, requestOptions);
  109185. } else if (sourceType === "dash") {
  109186. var playlists = properties.playlists.filter(function(p) {
  109187. return p.excludeUntil !== Infinity;
  109188. });
  109189. if (!playlists.length) {
  109190. return;
  109191. }
  109192. playlistLoader = new DashPlaylistLoader(properties.playlists[0], vhs, requestOptions, masterPlaylistLoader);
  109193. } else if (sourceType === "vhs-json") {
  109194. playlistLoader = new PlaylistLoader(
  109195. properties.playlists ? properties.playlists[0] : properties.resolvedUri,
  109196. vhs,
  109197. requestOptions
  109198. );
  109199. }
  109200. properties = videojs.mergeOptions({
  109201. id: variantLabel,
  109202. playlistLoader
  109203. }, properties);
  109204. setupListeners[type2](type2, properties.playlistLoader, settings);
  109205. groups[groupId].push(properties);
  109206. if (typeof tracks[variantLabel] === "undefined") {
  109207. var track = tech.addRemoteTextTrack({
  109208. id: variantLabel,
  109209. kind: "subtitles",
  109210. "default": properties["default"] && properties.autoselect,
  109211. language: properties.language,
  109212. label: variantLabel
  109213. }, false).track;
  109214. tracks[variantLabel] = track;
  109215. }
  109216. }
  109217. }
  109218. segmentLoader.on("error", onError[type2](type2, settings));
  109219. },
  109220. "CLOSED-CAPTIONS": function CLOSEDCAPTIONS(type2, settings) {
  109221. var tech = settings.tech, mediaGroups = settings.master.mediaGroups, _settings$mediaTypes$3 = settings.mediaTypes[type2], groups = _settings$mediaTypes$3.groups, tracks = _settings$mediaTypes$3.tracks;
  109222. for (var groupId in mediaGroups[type2]) {
  109223. if (!groups[groupId]) {
  109224. groups[groupId] = [];
  109225. }
  109226. for (var variantLabel in mediaGroups[type2][groupId]) {
  109227. var properties = mediaGroups[type2][groupId][variantLabel];
  109228. if (!/^(?:CC|SERVICE)/.test(properties.instreamId)) {
  109229. continue;
  109230. }
  109231. var captionServices = tech.options_.vhs && tech.options_.vhs.captionServices || {};
  109232. var newProps = {
  109233. label: variantLabel,
  109234. language: properties.language,
  109235. instreamId: properties.instreamId,
  109236. "default": properties["default"] && properties.autoselect
  109237. };
  109238. if (captionServices[newProps.instreamId]) {
  109239. newProps = videojs.mergeOptions(newProps, captionServices[newProps.instreamId]);
  109240. }
  109241. if (newProps["default"] === void 0) {
  109242. delete newProps["default"];
  109243. }
  109244. groups[groupId].push(videojs.mergeOptions({
  109245. id: variantLabel
  109246. }, properties));
  109247. if (typeof tracks[variantLabel] === "undefined") {
  109248. var track = tech.addRemoteTextTrack({
  109249. id: newProps.instreamId,
  109250. kind: "captions",
  109251. "default": newProps["default"],
  109252. language: newProps.language,
  109253. label: newProps.label
  109254. }, false).track;
  109255. tracks[variantLabel] = track;
  109256. }
  109257. }
  109258. }
  109259. }
  109260. };
  109261. var groupMatch = function groupMatch2(list, media) {
  109262. for (var i2 = 0; i2 < list.length; i2++) {
  109263. if (playlistMatch(media, list[i2])) {
  109264. return true;
  109265. }
  109266. if (list[i2].playlists && groupMatch2(list[i2].playlists, media)) {
  109267. return true;
  109268. }
  109269. }
  109270. return false;
  109271. };
  109272. var activeGroup = function activeGroup2(type2, settings) {
  109273. return function(track) {
  109274. var masterPlaylistLoader = settings.masterPlaylistLoader, groups = settings.mediaTypes[type2].groups;
  109275. var media = masterPlaylistLoader.media();
  109276. if (!media) {
  109277. return null;
  109278. }
  109279. var variants = null;
  109280. if (media.attributes[type2]) {
  109281. variants = groups[media.attributes[type2]];
  109282. }
  109283. var groupKeys = Object.keys(groups);
  109284. if (!variants) {
  109285. if (type2 === "AUDIO" && groupKeys.length > 1 && isAudioOnly(settings.master)) {
  109286. for (var i2 = 0; i2 < groupKeys.length; i2++) {
  109287. var groupPropertyList = groups[groupKeys[i2]];
  109288. if (groupMatch(groupPropertyList, media)) {
  109289. variants = groupPropertyList;
  109290. break;
  109291. }
  109292. }
  109293. } else if (groups.main) {
  109294. variants = groups.main;
  109295. } else if (groupKeys.length === 1) {
  109296. variants = groups[groupKeys[0]];
  109297. }
  109298. }
  109299. if (typeof track === "undefined") {
  109300. return variants;
  109301. }
  109302. if (track === null || !variants) {
  109303. return null;
  109304. }
  109305. return variants.filter(function(props) {
  109306. return props.id === track.id;
  109307. })[0] || null;
  109308. };
  109309. };
  109310. var activeTrack = {
  109311. AUDIO: function AUDIO4(type2, settings) {
  109312. return function() {
  109313. var tracks = settings.mediaTypes[type2].tracks;
  109314. for (var id in tracks) {
  109315. if (tracks[id].enabled) {
  109316. return tracks[id];
  109317. }
  109318. }
  109319. return null;
  109320. };
  109321. },
  109322. SUBTITLES: function SUBTITLES4(type2, settings) {
  109323. return function() {
  109324. var tracks = settings.mediaTypes[type2].tracks;
  109325. for (var id in tracks) {
  109326. if (tracks[id].mode === "showing" || tracks[id].mode === "hidden") {
  109327. return tracks[id];
  109328. }
  109329. }
  109330. return null;
  109331. };
  109332. }
  109333. };
  109334. var getActiveGroup = function getActiveGroup2(type2, _ref) {
  109335. var mediaTypes2 = _ref.mediaTypes;
  109336. return function() {
  109337. var activeTrack_ = mediaTypes2[type2].activeTrack();
  109338. if (!activeTrack_) {
  109339. return null;
  109340. }
  109341. return mediaTypes2[type2].activeGroup(activeTrack_);
  109342. };
  109343. };
  109344. var setupMediaGroups = function setupMediaGroups2(settings) {
  109345. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(type2) {
  109346. initialize[type2](type2, settings);
  109347. });
  109348. var mediaTypes2 = settings.mediaTypes, masterPlaylistLoader = settings.masterPlaylistLoader, tech = settings.tech, vhs = settings.vhs, _settings$segmentLoad3 = settings.segmentLoaders, audioSegmentLoader = _settings$segmentLoad3["AUDIO"], mainSegmentLoader = _settings$segmentLoad3.main;
  109349. ["AUDIO", "SUBTITLES"].forEach(function(type2) {
  109350. mediaTypes2[type2].activeGroup = activeGroup(type2, settings);
  109351. mediaTypes2[type2].activeTrack = activeTrack[type2](type2, settings);
  109352. mediaTypes2[type2].onGroupChanged = onGroupChanged(type2, settings);
  109353. mediaTypes2[type2].onGroupChanging = onGroupChanging(type2, settings);
  109354. mediaTypes2[type2].onTrackChanged = onTrackChanged(type2, settings);
  109355. mediaTypes2[type2].getActiveGroup = getActiveGroup(type2, settings);
  109356. });
  109357. var audioGroup = mediaTypes2.AUDIO.activeGroup();
  109358. if (audioGroup) {
  109359. var groupId = (audioGroup.filter(function(group) {
  109360. return group["default"];
  109361. })[0] || audioGroup[0]).id;
  109362. mediaTypes2.AUDIO.tracks[groupId].enabled = true;
  109363. mediaTypes2.AUDIO.onGroupChanged();
  109364. mediaTypes2.AUDIO.onTrackChanged();
  109365. var activeAudioGroup = mediaTypes2.AUDIO.getActiveGroup();
  109366. if (!activeAudioGroup.playlistLoader) {
  109367. mainSegmentLoader.setAudio(true);
  109368. } else {
  109369. mainSegmentLoader.setAudio(false);
  109370. audioSegmentLoader.setAudio(true);
  109371. }
  109372. }
  109373. masterPlaylistLoader.on("mediachange", function() {
  109374. ["AUDIO", "SUBTITLES"].forEach(function(type2) {
  109375. return mediaTypes2[type2].onGroupChanged();
  109376. });
  109377. });
  109378. masterPlaylistLoader.on("mediachanging", function() {
  109379. ["AUDIO", "SUBTITLES"].forEach(function(type2) {
  109380. return mediaTypes2[type2].onGroupChanging();
  109381. });
  109382. });
  109383. var onAudioTrackChanged = function onAudioTrackChanged2() {
  109384. mediaTypes2.AUDIO.onTrackChanged();
  109385. tech.trigger({
  109386. type: "usage",
  109387. name: "vhs-audio-change"
  109388. });
  109389. tech.trigger({
  109390. type: "usage",
  109391. name: "hls-audio-change"
  109392. });
  109393. };
  109394. tech.audioTracks().addEventListener("change", onAudioTrackChanged);
  109395. tech.remoteTextTracks().addEventListener("change", mediaTypes2.SUBTITLES.onTrackChanged);
  109396. vhs.on("dispose", function() {
  109397. tech.audioTracks().removeEventListener("change", onAudioTrackChanged);
  109398. tech.remoteTextTracks().removeEventListener("change", mediaTypes2.SUBTITLES.onTrackChanged);
  109399. });
  109400. tech.clearTracks("audio");
  109401. for (var id in mediaTypes2.AUDIO.tracks) {
  109402. tech.audioTracks().addTrack(mediaTypes2.AUDIO.tracks[id]);
  109403. }
  109404. };
  109405. var createMediaTypes = function createMediaTypes2() {
  109406. var mediaTypes2 = {};
  109407. ["AUDIO", "SUBTITLES", "CLOSED-CAPTIONS"].forEach(function(type2) {
  109408. mediaTypes2[type2] = {
  109409. groups: {},
  109410. tracks: {},
  109411. activePlaylistLoader: null,
  109412. activeGroup: noop,
  109413. activeTrack: noop,
  109414. getActiveGroup: noop,
  109415. onGroupChanged: noop,
  109416. onTrackChanged: noop,
  109417. lastTrack_: null,
  109418. logger_: logger("MediaGroups[" + type2 + "]")
  109419. };
  109420. });
  109421. return mediaTypes2;
  109422. };
  109423. var ABORT_EARLY_BLACKLIST_SECONDS = 60 * 2;
  109424. var Vhs$1;
  109425. var loaderStats = ["mediaRequests", "mediaRequestsAborted", "mediaRequestsTimedout", "mediaRequestsErrored", "mediaTransferDuration", "mediaBytesTransferred", "mediaAppends"];
  109426. var sumLoaderStat = function sumLoaderStat2(stat) {
  109427. return this.audioSegmentLoader_[stat] + this.mainSegmentLoader_[stat];
  109428. };
  109429. var shouldSwitchToMedia = function shouldSwitchToMedia2(_ref) {
  109430. var currentPlaylist = _ref.currentPlaylist, buffered = _ref.buffered, currentTime = _ref.currentTime, nextPlaylist = _ref.nextPlaylist, bufferLowWaterLine = _ref.bufferLowWaterLine, bufferHighWaterLine = _ref.bufferHighWaterLine, duration5 = _ref.duration, experimentalBufferBasedABR = _ref.experimentalBufferBasedABR, log2 = _ref.log;
  109431. if (!nextPlaylist) {
  109432. videojs.log.warn("We received no playlist to switch to. Please check your stream.");
  109433. return false;
  109434. }
  109435. var sharedLogLine = "allowing switch " + (currentPlaylist && currentPlaylist.id || "null") + " -> " + nextPlaylist.id;
  109436. if (!currentPlaylist) {
  109437. log2(sharedLogLine + " as current playlist is not set");
  109438. return true;
  109439. }
  109440. if (nextPlaylist.id === currentPlaylist.id) {
  109441. return false;
  109442. }
  109443. var isBuffered = Boolean(findRange(buffered, currentTime).length);
  109444. if (!currentPlaylist.endList) {
  109445. if (!isBuffered && typeof currentPlaylist.partTargetDuration === "number") {
  109446. log2("not " + sharedLogLine + " as current playlist is live llhls, but currentTime isn't in buffered.");
  109447. return false;
  109448. }
  109449. log2(sharedLogLine + " as current playlist is live");
  109450. return true;
  109451. }
  109452. var forwardBuffer = timeAheadOf(buffered, currentTime);
  109453. var maxBufferLowWaterLine = experimentalBufferBasedABR ? Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE : Config.MAX_BUFFER_LOW_WATER_LINE;
  109454. if (duration5 < maxBufferLowWaterLine) {
  109455. log2(sharedLogLine + " as duration < max low water line (" + duration5 + " < " + maxBufferLowWaterLine + ")");
  109456. return true;
  109457. }
  109458. var nextBandwidth = nextPlaylist.attributes.BANDWIDTH;
  109459. var currBandwidth = currentPlaylist.attributes.BANDWIDTH;
  109460. if (nextBandwidth < currBandwidth && (!experimentalBufferBasedABR || forwardBuffer < bufferHighWaterLine)) {
  109461. var logLine = sharedLogLine + " as next bandwidth < current bandwidth (" + nextBandwidth + " < " + currBandwidth + ")";
  109462. if (experimentalBufferBasedABR) {
  109463. logLine += " and forwardBuffer < bufferHighWaterLine (" + forwardBuffer + " < " + bufferHighWaterLine + ")";
  109464. }
  109465. log2(logLine);
  109466. return true;
  109467. }
  109468. if ((!experimentalBufferBasedABR || nextBandwidth > currBandwidth) && forwardBuffer >= bufferLowWaterLine) {
  109469. var _logLine = sharedLogLine + " as forwardBuffer >= bufferLowWaterLine (" + forwardBuffer + " >= " + bufferLowWaterLine + ")";
  109470. if (experimentalBufferBasedABR) {
  109471. _logLine += " and next bandwidth > current bandwidth (" + nextBandwidth + " > " + currBandwidth + ")";
  109472. }
  109473. log2(_logLine);
  109474. return true;
  109475. }
  109476. log2("not " + sharedLogLine + " as no switching criteria met");
  109477. return false;
  109478. };
  109479. var MasterPlaylistController = /* @__PURE__ */ function(_videojs$EventTarget) {
  109480. _inheritsLoose(MasterPlaylistController2, _videojs$EventTarget);
  109481. function MasterPlaylistController2(options2) {
  109482. var _this;
  109483. _this = _videojs$EventTarget.call(this) || this;
  109484. var src = options2.src, handleManifestRedirects = options2.handleManifestRedirects, withCredentials = options2.withCredentials, tech = options2.tech, bandwidth2 = options2.bandwidth, externVhs = options2.externVhs, useCueTags = options2.useCueTags, blacklistDuration = options2.blacklistDuration, enableLowInitialPlaylist = options2.enableLowInitialPlaylist, sourceType = options2.sourceType, cacheEncryptionKeys = options2.cacheEncryptionKeys, experimentalBufferBasedABR = options2.experimentalBufferBasedABR, experimentalLeastPixelDiffSelector = options2.experimentalLeastPixelDiffSelector, captionServices = options2.captionServices;
  109485. if (!src) {
  109486. throw new Error("A non-empty playlist URL or JSON manifest string is required");
  109487. }
  109488. var maxPlaylistRetries = options2.maxPlaylistRetries;
  109489. if (maxPlaylistRetries === null || typeof maxPlaylistRetries === "undefined") {
  109490. maxPlaylistRetries = Infinity;
  109491. }
  109492. Vhs$1 = externVhs;
  109493. _this.experimentalBufferBasedABR = Boolean(experimentalBufferBasedABR);
  109494. _this.experimentalLeastPixelDiffSelector = Boolean(experimentalLeastPixelDiffSelector);
  109495. _this.withCredentials = withCredentials;
  109496. _this.tech_ = tech;
  109497. _this.vhs_ = tech.vhs;
  109498. _this.sourceType_ = sourceType;
  109499. _this.useCueTags_ = useCueTags;
  109500. _this.blacklistDuration = blacklistDuration;
  109501. _this.maxPlaylistRetries = maxPlaylistRetries;
  109502. _this.enableLowInitialPlaylist = enableLowInitialPlaylist;
  109503. if (_this.useCueTags_) {
  109504. _this.cueTagsTrack_ = _this.tech_.addTextTrack("metadata", "ad-cues");
  109505. _this.cueTagsTrack_.inBandMetadataTrackDispatchType = "";
  109506. }
  109507. _this.requestOptions_ = {
  109508. withCredentials,
  109509. handleManifestRedirects,
  109510. maxPlaylistRetries,
  109511. timeout: null
  109512. };
  109513. _this.on("error", _this.pauseLoading);
  109514. _this.mediaTypes_ = createMediaTypes();
  109515. _this.mediaSource = new window_1.MediaSource();
  109516. _this.handleDurationChange_ = _this.handleDurationChange_.bind(_assertThisInitialized(_this));
  109517. _this.handleSourceOpen_ = _this.handleSourceOpen_.bind(_assertThisInitialized(_this));
  109518. _this.handleSourceEnded_ = _this.handleSourceEnded_.bind(_assertThisInitialized(_this));
  109519. _this.mediaSource.addEventListener("durationchange", _this.handleDurationChange_);
  109520. _this.mediaSource.addEventListener("sourceopen", _this.handleSourceOpen_);
  109521. _this.mediaSource.addEventListener("sourceended", _this.handleSourceEnded_);
  109522. _this.seekable_ = videojs.createTimeRanges();
  109523. _this.hasPlayed_ = false;
  109524. _this.syncController_ = new SyncController(options2);
  109525. _this.segmentMetadataTrack_ = tech.addRemoteTextTrack({
  109526. kind: "metadata",
  109527. label: "segment-metadata"
  109528. }, false).track;
  109529. _this.decrypter_ = new Decrypter();
  109530. _this.sourceUpdater_ = new SourceUpdater(_this.mediaSource);
  109531. _this.inbandTextTracks_ = {};
  109532. _this.timelineChangeController_ = new TimelineChangeController();
  109533. var segmentLoaderSettings = {
  109534. vhs: _this.vhs_,
  109535. parse708captions: options2.parse708captions,
  109536. useDtsForTimestampOffset: options2.useDtsForTimestampOffset,
  109537. captionServices,
  109538. mediaSource: _this.mediaSource,
  109539. currentTime: _this.tech_.currentTime.bind(_this.tech_),
  109540. seekable: function seekable3() {
  109541. return _this.seekable();
  109542. },
  109543. seeking: function seeking() {
  109544. return _this.tech_.seeking();
  109545. },
  109546. duration: function duration5() {
  109547. return _this.duration();
  109548. },
  109549. hasPlayed: function hasPlayed() {
  109550. return _this.hasPlayed_;
  109551. },
  109552. goalBufferLength: function goalBufferLength() {
  109553. return _this.goalBufferLength();
  109554. },
  109555. bandwidth: bandwidth2,
  109556. syncController: _this.syncController_,
  109557. decrypter: _this.decrypter_,
  109558. sourceType: _this.sourceType_,
  109559. inbandTextTracks: _this.inbandTextTracks_,
  109560. cacheEncryptionKeys,
  109561. sourceUpdater: _this.sourceUpdater_,
  109562. timelineChangeController: _this.timelineChangeController_,
  109563. experimentalExactManifestTimings: options2.experimentalExactManifestTimings
  109564. };
  109565. _this.masterPlaylistLoader_ = _this.sourceType_ === "dash" ? new DashPlaylistLoader(src, _this.vhs_, _this.requestOptions_) : new PlaylistLoader(src, _this.vhs_, _this.requestOptions_);
  109566. _this.setupMasterPlaylistLoaderListeners_();
  109567. _this.mainSegmentLoader_ = new SegmentLoader(videojs.mergeOptions(segmentLoaderSettings, {
  109568. segmentMetadataTrack: _this.segmentMetadataTrack_,
  109569. loaderType: "main"
  109570. }), options2);
  109571. _this.audioSegmentLoader_ = new SegmentLoader(videojs.mergeOptions(segmentLoaderSettings, {
  109572. loaderType: "audio"
  109573. }), options2);
  109574. _this.subtitleSegmentLoader_ = new VTTSegmentLoader(videojs.mergeOptions(segmentLoaderSettings, {
  109575. loaderType: "vtt",
  109576. featuresNativeTextTracks: _this.tech_.featuresNativeTextTracks,
  109577. loadVttJs: function loadVttJs() {
  109578. return new Promise(function(resolve2, reject2) {
  109579. function onLoad() {
  109580. tech.off("vttjserror", onError2);
  109581. resolve2();
  109582. }
  109583. function onError2() {
  109584. tech.off("vttjsloaded", onLoad);
  109585. reject2();
  109586. }
  109587. tech.one("vttjsloaded", onLoad);
  109588. tech.one("vttjserror", onError2);
  109589. tech.addWebVttScript_();
  109590. });
  109591. }
  109592. }), options2);
  109593. _this.setupSegmentLoaderListeners_();
  109594. if (_this.experimentalBufferBasedABR) {
  109595. _this.masterPlaylistLoader_.one("loadedplaylist", function() {
  109596. return _this.startABRTimer_();
  109597. });
  109598. _this.tech_.on("pause", function() {
  109599. return _this.stopABRTimer_();
  109600. });
  109601. _this.tech_.on("play", function() {
  109602. return _this.startABRTimer_();
  109603. });
  109604. }
  109605. loaderStats.forEach(function(stat) {
  109606. _this[stat + "_"] = sumLoaderStat.bind(_assertThisInitialized(_this), stat);
  109607. });
  109608. _this.logger_ = logger("MPC");
  109609. _this.triggeredFmp4Usage = false;
  109610. if (_this.tech_.preload() === "none") {
  109611. _this.loadOnPlay_ = function() {
  109612. _this.loadOnPlay_ = null;
  109613. _this.masterPlaylistLoader_.load();
  109614. };
  109615. _this.tech_.one("play", _this.loadOnPlay_);
  109616. } else {
  109617. _this.masterPlaylistLoader_.load();
  109618. }
  109619. _this.timeToLoadedData__ = -1;
  109620. _this.mainAppendsToLoadedData__ = -1;
  109621. _this.audioAppendsToLoadedData__ = -1;
  109622. var event2 = _this.tech_.preload() === "none" ? "play" : "loadstart";
  109623. _this.tech_.one(event2, function() {
  109624. var timeToLoadedDataStart = Date.now();
  109625. _this.tech_.one("loadeddata", function() {
  109626. _this.timeToLoadedData__ = Date.now() - timeToLoadedDataStart;
  109627. _this.mainAppendsToLoadedData__ = _this.mainSegmentLoader_.mediaAppends;
  109628. _this.audioAppendsToLoadedData__ = _this.audioSegmentLoader_.mediaAppends;
  109629. });
  109630. });
  109631. return _this;
  109632. }
  109633. var _proto = MasterPlaylistController2.prototype;
  109634. _proto.mainAppendsToLoadedData_ = function mainAppendsToLoadedData_() {
  109635. return this.mainAppendsToLoadedData__;
  109636. };
  109637. _proto.audioAppendsToLoadedData_ = function audioAppendsToLoadedData_() {
  109638. return this.audioAppendsToLoadedData__;
  109639. };
  109640. _proto.appendsToLoadedData_ = function appendsToLoadedData_() {
  109641. var main = this.mainAppendsToLoadedData_();
  109642. var audio = this.audioAppendsToLoadedData_();
  109643. if (main === -1 || audio === -1) {
  109644. return -1;
  109645. }
  109646. return main + audio;
  109647. };
  109648. _proto.timeToLoadedData_ = function timeToLoadedData_() {
  109649. return this.timeToLoadedData__;
  109650. };
  109651. _proto.checkABR_ = function checkABR_(reason) {
  109652. if (reason === void 0) {
  109653. reason = "abr";
  109654. }
  109655. var nextPlaylist = this.selectPlaylist();
  109656. if (nextPlaylist && this.shouldSwitchToMedia_(nextPlaylist)) {
  109657. this.switchMedia_(nextPlaylist, reason);
  109658. }
  109659. };
  109660. _proto.switchMedia_ = function switchMedia_(playlist, cause, delay) {
  109661. var oldMedia = this.media();
  109662. var oldId = oldMedia && (oldMedia.id || oldMedia.uri);
  109663. var newId = playlist.id || playlist.uri;
  109664. if (oldId && oldId !== newId) {
  109665. this.logger_("switch media " + oldId + " -> " + newId + " from " + cause);
  109666. this.tech_.trigger({
  109667. type: "usage",
  109668. name: "vhs-rendition-change-" + cause
  109669. });
  109670. }
  109671. this.masterPlaylistLoader_.media(playlist, delay);
  109672. };
  109673. _proto.startABRTimer_ = function startABRTimer_() {
  109674. var _this2 = this;
  109675. this.stopABRTimer_();
  109676. this.abrTimer_ = window_1.setInterval(function() {
  109677. return _this2.checkABR_();
  109678. }, 250);
  109679. };
  109680. _proto.stopABRTimer_ = function stopABRTimer_() {
  109681. if (this.tech_.scrubbing && this.tech_.scrubbing()) {
  109682. return;
  109683. }
  109684. window_1.clearInterval(this.abrTimer_);
  109685. this.abrTimer_ = null;
  109686. };
  109687. _proto.getAudioTrackPlaylists_ = function getAudioTrackPlaylists_() {
  109688. var master = this.master();
  109689. var defaultPlaylists = master && master.playlists || [];
  109690. if (!master || !master.mediaGroups || !master.mediaGroups.AUDIO) {
  109691. return defaultPlaylists;
  109692. }
  109693. var AUDIO5 = master.mediaGroups.AUDIO;
  109694. var groupKeys = Object.keys(AUDIO5);
  109695. var track;
  109696. if (Object.keys(this.mediaTypes_.AUDIO.groups).length) {
  109697. track = this.mediaTypes_.AUDIO.activeTrack();
  109698. } else {
  109699. var defaultGroup = AUDIO5.main || groupKeys.length && AUDIO5[groupKeys[0]];
  109700. for (var label in defaultGroup) {
  109701. if (defaultGroup[label]["default"]) {
  109702. track = {
  109703. label
  109704. };
  109705. break;
  109706. }
  109707. }
  109708. }
  109709. if (!track) {
  109710. return defaultPlaylists;
  109711. }
  109712. var playlists = [];
  109713. for (var group in AUDIO5) {
  109714. if (AUDIO5[group][track.label]) {
  109715. var properties = AUDIO5[group][track.label];
  109716. if (properties.playlists && properties.playlists.length) {
  109717. playlists.push.apply(playlists, properties.playlists);
  109718. } else if (properties.uri) {
  109719. playlists.push(properties);
  109720. } else if (master.playlists.length) {
  109721. for (var i2 = 0; i2 < master.playlists.length; i2++) {
  109722. var playlist = master.playlists[i2];
  109723. if (playlist.attributes && playlist.attributes.AUDIO && playlist.attributes.AUDIO === group) {
  109724. playlists.push(playlist);
  109725. }
  109726. }
  109727. }
  109728. }
  109729. }
  109730. if (!playlists.length) {
  109731. return defaultPlaylists;
  109732. }
  109733. return playlists;
  109734. };
  109735. _proto.setupMasterPlaylistLoaderListeners_ = function setupMasterPlaylistLoaderListeners_() {
  109736. var _this3 = this;
  109737. this.masterPlaylistLoader_.on("loadedmetadata", function() {
  109738. var media = _this3.masterPlaylistLoader_.media();
  109739. var requestTimeout = media.targetDuration * 1.5 * 1e3;
  109740. if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) {
  109741. _this3.requestOptions_.timeout = 0;
  109742. } else {
  109743. _this3.requestOptions_.timeout = requestTimeout;
  109744. }
  109745. if (media.endList && _this3.tech_.preload() !== "none") {
  109746. _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_);
  109747. _this3.mainSegmentLoader_.load();
  109748. }
  109749. setupMediaGroups({
  109750. sourceType: _this3.sourceType_,
  109751. segmentLoaders: {
  109752. AUDIO: _this3.audioSegmentLoader_,
  109753. SUBTITLES: _this3.subtitleSegmentLoader_,
  109754. main: _this3.mainSegmentLoader_
  109755. },
  109756. tech: _this3.tech_,
  109757. requestOptions: _this3.requestOptions_,
  109758. masterPlaylistLoader: _this3.masterPlaylistLoader_,
  109759. vhs: _this3.vhs_,
  109760. master: _this3.master(),
  109761. mediaTypes: _this3.mediaTypes_,
  109762. blacklistCurrentPlaylist: _this3.blacklistCurrentPlaylist.bind(_this3)
  109763. });
  109764. _this3.triggerPresenceUsage_(_this3.master(), media);
  109765. _this3.setupFirstPlay();
  109766. if (!_this3.mediaTypes_.AUDIO.activePlaylistLoader || _this3.mediaTypes_.AUDIO.activePlaylistLoader.media()) {
  109767. _this3.trigger("selectedinitialmedia");
  109768. } else {
  109769. _this3.mediaTypes_.AUDIO.activePlaylistLoader.one("loadedmetadata", function() {
  109770. _this3.trigger("selectedinitialmedia");
  109771. });
  109772. }
  109773. });
  109774. this.masterPlaylistLoader_.on("loadedplaylist", function() {
  109775. if (_this3.loadOnPlay_) {
  109776. _this3.tech_.off("play", _this3.loadOnPlay_);
  109777. }
  109778. var updatedPlaylist = _this3.masterPlaylistLoader_.media();
  109779. if (!updatedPlaylist) {
  109780. _this3.excludeUnsupportedVariants_();
  109781. var selectedMedia;
  109782. if (_this3.enableLowInitialPlaylist) {
  109783. selectedMedia = _this3.selectInitialPlaylist();
  109784. }
  109785. if (!selectedMedia) {
  109786. selectedMedia = _this3.selectPlaylist();
  109787. }
  109788. if (!selectedMedia || !_this3.shouldSwitchToMedia_(selectedMedia)) {
  109789. return;
  109790. }
  109791. _this3.initialMedia_ = selectedMedia;
  109792. _this3.switchMedia_(_this3.initialMedia_, "initial");
  109793. var haveJsonSource = _this3.sourceType_ === "vhs-json" && _this3.initialMedia_.segments;
  109794. if (!haveJsonSource) {
  109795. return;
  109796. }
  109797. updatedPlaylist = _this3.initialMedia_;
  109798. }
  109799. _this3.handleUpdatedMediaPlaylist(updatedPlaylist);
  109800. });
  109801. this.masterPlaylistLoader_.on("error", function() {
  109802. _this3.blacklistCurrentPlaylist(_this3.masterPlaylistLoader_.error);
  109803. });
  109804. this.masterPlaylistLoader_.on("mediachanging", function() {
  109805. _this3.mainSegmentLoader_.abort();
  109806. _this3.mainSegmentLoader_.pause();
  109807. });
  109808. this.masterPlaylistLoader_.on("mediachange", function() {
  109809. var media = _this3.masterPlaylistLoader_.media();
  109810. var requestTimeout = media.targetDuration * 1.5 * 1e3;
  109811. if (isLowestEnabledRendition(_this3.masterPlaylistLoader_.master, _this3.masterPlaylistLoader_.media())) {
  109812. _this3.requestOptions_.timeout = 0;
  109813. } else {
  109814. _this3.requestOptions_.timeout = requestTimeout;
  109815. }
  109816. _this3.masterPlaylistLoader_.load();
  109817. _this3.mainSegmentLoader_.playlist(media, _this3.requestOptions_);
  109818. _this3.mainSegmentLoader_.load();
  109819. _this3.tech_.trigger({
  109820. type: "mediachange",
  109821. bubbles: true
  109822. });
  109823. });
  109824. this.masterPlaylistLoader_.on("playlistunchanged", function() {
  109825. var updatedPlaylist = _this3.masterPlaylistLoader_.media();
  109826. if (updatedPlaylist.lastExcludeReason_ === "playlist-unchanged") {
  109827. return;
  109828. }
  109829. var playlistOutdated = _this3.stuckAtPlaylistEnd_(updatedPlaylist);
  109830. if (playlistOutdated) {
  109831. _this3.blacklistCurrentPlaylist({
  109832. message: "Playlist no longer updating.",
  109833. reason: "playlist-unchanged"
  109834. });
  109835. _this3.tech_.trigger("playliststuck");
  109836. }
  109837. });
  109838. this.masterPlaylistLoader_.on("renditiondisabled", function() {
  109839. _this3.tech_.trigger({
  109840. type: "usage",
  109841. name: "vhs-rendition-disabled"
  109842. });
  109843. _this3.tech_.trigger({
  109844. type: "usage",
  109845. name: "hls-rendition-disabled"
  109846. });
  109847. });
  109848. this.masterPlaylistLoader_.on("renditionenabled", function() {
  109849. _this3.tech_.trigger({
  109850. type: "usage",
  109851. name: "vhs-rendition-enabled"
  109852. });
  109853. _this3.tech_.trigger({
  109854. type: "usage",
  109855. name: "hls-rendition-enabled"
  109856. });
  109857. });
  109858. };
  109859. _proto.handleUpdatedMediaPlaylist = function handleUpdatedMediaPlaylist(updatedPlaylist) {
  109860. if (this.useCueTags_) {
  109861. this.updateAdCues_(updatedPlaylist);
  109862. }
  109863. this.mainSegmentLoader_.playlist(updatedPlaylist, this.requestOptions_);
  109864. this.updateDuration(!updatedPlaylist.endList);
  109865. if (!this.tech_.paused()) {
  109866. this.mainSegmentLoader_.load();
  109867. if (this.audioSegmentLoader_) {
  109868. this.audioSegmentLoader_.load();
  109869. }
  109870. }
  109871. };
  109872. _proto.triggerPresenceUsage_ = function triggerPresenceUsage_(master, media) {
  109873. var mediaGroups = master.mediaGroups || {};
  109874. var defaultDemuxed = true;
  109875. var audioGroupKeys = Object.keys(mediaGroups.AUDIO);
  109876. for (var mediaGroup in mediaGroups.AUDIO) {
  109877. for (var label in mediaGroups.AUDIO[mediaGroup]) {
  109878. var properties = mediaGroups.AUDIO[mediaGroup][label];
  109879. if (!properties.uri) {
  109880. defaultDemuxed = false;
  109881. }
  109882. }
  109883. }
  109884. if (defaultDemuxed) {
  109885. this.tech_.trigger({
  109886. type: "usage",
  109887. name: "vhs-demuxed"
  109888. });
  109889. this.tech_.trigger({
  109890. type: "usage",
  109891. name: "hls-demuxed"
  109892. });
  109893. }
  109894. if (Object.keys(mediaGroups.SUBTITLES).length) {
  109895. this.tech_.trigger({
  109896. type: "usage",
  109897. name: "vhs-webvtt"
  109898. });
  109899. this.tech_.trigger({
  109900. type: "usage",
  109901. name: "hls-webvtt"
  109902. });
  109903. }
  109904. if (Vhs$1.Playlist.isAes(media)) {
  109905. this.tech_.trigger({
  109906. type: "usage",
  109907. name: "vhs-aes"
  109908. });
  109909. this.tech_.trigger({
  109910. type: "usage",
  109911. name: "hls-aes"
  109912. });
  109913. }
  109914. if (audioGroupKeys.length && Object.keys(mediaGroups.AUDIO[audioGroupKeys[0]]).length > 1) {
  109915. this.tech_.trigger({
  109916. type: "usage",
  109917. name: "vhs-alternate-audio"
  109918. });
  109919. this.tech_.trigger({
  109920. type: "usage",
  109921. name: "hls-alternate-audio"
  109922. });
  109923. }
  109924. if (this.useCueTags_) {
  109925. this.tech_.trigger({
  109926. type: "usage",
  109927. name: "vhs-playlist-cue-tags"
  109928. });
  109929. this.tech_.trigger({
  109930. type: "usage",
  109931. name: "hls-playlist-cue-tags"
  109932. });
  109933. }
  109934. };
  109935. _proto.shouldSwitchToMedia_ = function shouldSwitchToMedia_(nextPlaylist) {
  109936. var currentPlaylist = this.masterPlaylistLoader_.media() || this.masterPlaylistLoader_.pendingMedia_;
  109937. var currentTime = this.tech_.currentTime();
  109938. var bufferLowWaterLine = this.bufferLowWaterLine();
  109939. var bufferHighWaterLine = this.bufferHighWaterLine();
  109940. var buffered = this.tech_.buffered();
  109941. return shouldSwitchToMedia({
  109942. buffered,
  109943. currentTime,
  109944. currentPlaylist,
  109945. nextPlaylist,
  109946. bufferLowWaterLine,
  109947. bufferHighWaterLine,
  109948. duration: this.duration(),
  109949. experimentalBufferBasedABR: this.experimentalBufferBasedABR,
  109950. log: this.logger_
  109951. });
  109952. };
  109953. _proto.setupSegmentLoaderListeners_ = function setupSegmentLoaderListeners_() {
  109954. var _this4 = this;
  109955. this.mainSegmentLoader_.on("bandwidthupdate", function() {
  109956. _this4.checkABR_("bandwidthupdate");
  109957. _this4.tech_.trigger("bandwidthupdate");
  109958. });
  109959. this.mainSegmentLoader_.on("timeout", function() {
  109960. if (_this4.experimentalBufferBasedABR) {
  109961. _this4.mainSegmentLoader_.load();
  109962. }
  109963. });
  109964. if (!this.experimentalBufferBasedABR) {
  109965. this.mainSegmentLoader_.on("progress", function() {
  109966. _this4.trigger("progress");
  109967. });
  109968. }
  109969. this.mainSegmentLoader_.on("error", function() {
  109970. _this4.blacklistCurrentPlaylist(_this4.mainSegmentLoader_.error());
  109971. });
  109972. this.mainSegmentLoader_.on("appenderror", function() {
  109973. _this4.error = _this4.mainSegmentLoader_.error_;
  109974. _this4.trigger("error");
  109975. });
  109976. this.mainSegmentLoader_.on("syncinfoupdate", function() {
  109977. _this4.onSyncInfoUpdate_();
  109978. });
  109979. this.mainSegmentLoader_.on("timestampoffset", function() {
  109980. _this4.tech_.trigger({
  109981. type: "usage",
  109982. name: "vhs-timestamp-offset"
  109983. });
  109984. _this4.tech_.trigger({
  109985. type: "usage",
  109986. name: "hls-timestamp-offset"
  109987. });
  109988. });
  109989. this.audioSegmentLoader_.on("syncinfoupdate", function() {
  109990. _this4.onSyncInfoUpdate_();
  109991. });
  109992. this.audioSegmentLoader_.on("appenderror", function() {
  109993. _this4.error = _this4.audioSegmentLoader_.error_;
  109994. _this4.trigger("error");
  109995. });
  109996. this.mainSegmentLoader_.on("ended", function() {
  109997. _this4.logger_("main segment loader ended");
  109998. _this4.onEndOfStream();
  109999. });
  110000. this.mainSegmentLoader_.on("earlyabort", function(event2) {
  110001. if (_this4.experimentalBufferBasedABR) {
  110002. return;
  110003. }
  110004. _this4.delegateLoaders_("all", ["abort"]);
  110005. _this4.blacklistCurrentPlaylist({
  110006. message: "Aborted early because there isn't enough bandwidth to complete the request without rebuffering."
  110007. }, ABORT_EARLY_BLACKLIST_SECONDS);
  110008. });
  110009. var updateCodecs = function updateCodecs2() {
  110010. if (!_this4.sourceUpdater_.hasCreatedSourceBuffers()) {
  110011. return _this4.tryToCreateSourceBuffers_();
  110012. }
  110013. var codecs = _this4.getCodecsOrExclude_();
  110014. if (!codecs) {
  110015. return;
  110016. }
  110017. _this4.sourceUpdater_.addOrChangeSourceBuffers(codecs);
  110018. };
  110019. this.mainSegmentLoader_.on("trackinfo", updateCodecs);
  110020. this.audioSegmentLoader_.on("trackinfo", updateCodecs);
  110021. this.mainSegmentLoader_.on("fmp4", function() {
  110022. if (!_this4.triggeredFmp4Usage) {
  110023. _this4.tech_.trigger({
  110024. type: "usage",
  110025. name: "vhs-fmp4"
  110026. });
  110027. _this4.tech_.trigger({
  110028. type: "usage",
  110029. name: "hls-fmp4"
  110030. });
  110031. _this4.triggeredFmp4Usage = true;
  110032. }
  110033. });
  110034. this.audioSegmentLoader_.on("fmp4", function() {
  110035. if (!_this4.triggeredFmp4Usage) {
  110036. _this4.tech_.trigger({
  110037. type: "usage",
  110038. name: "vhs-fmp4"
  110039. });
  110040. _this4.tech_.trigger({
  110041. type: "usage",
  110042. name: "hls-fmp4"
  110043. });
  110044. _this4.triggeredFmp4Usage = true;
  110045. }
  110046. });
  110047. this.audioSegmentLoader_.on("ended", function() {
  110048. _this4.logger_("audioSegmentLoader ended");
  110049. _this4.onEndOfStream();
  110050. });
  110051. };
  110052. _proto.mediaSecondsLoaded_ = function mediaSecondsLoaded_() {
  110053. return Math.max(this.audioSegmentLoader_.mediaSecondsLoaded + this.mainSegmentLoader_.mediaSecondsLoaded);
  110054. };
  110055. _proto.load = function load() {
  110056. this.mainSegmentLoader_.load();
  110057. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  110058. this.audioSegmentLoader_.load();
  110059. }
  110060. if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
  110061. this.subtitleSegmentLoader_.load();
  110062. }
  110063. };
  110064. _proto.smoothQualityChange_ = function smoothQualityChange_(media) {
  110065. if (media === void 0) {
  110066. media = this.selectPlaylist();
  110067. }
  110068. this.fastQualityChange_(media);
  110069. };
  110070. _proto.fastQualityChange_ = function fastQualityChange_(media) {
  110071. var _this5 = this;
  110072. if (media === void 0) {
  110073. media = this.selectPlaylist();
  110074. }
  110075. if (media === this.masterPlaylistLoader_.media()) {
  110076. this.logger_("skipping fastQualityChange because new media is same as old");
  110077. return;
  110078. }
  110079. this.switchMedia_(media, "fast-quality");
  110080. this.mainSegmentLoader_.resetEverything(function() {
  110081. if (videojs.browser.IE_VERSION || videojs.browser.IS_EDGE) {
  110082. _this5.tech_.setCurrentTime(_this5.tech_.currentTime() + 0.04);
  110083. } else {
  110084. _this5.tech_.setCurrentTime(_this5.tech_.currentTime());
  110085. }
  110086. });
  110087. };
  110088. _proto.play = function play() {
  110089. if (this.setupFirstPlay()) {
  110090. return;
  110091. }
  110092. if (this.tech_.ended()) {
  110093. this.tech_.setCurrentTime(0);
  110094. }
  110095. if (this.hasPlayed_) {
  110096. this.load();
  110097. }
  110098. var seekable3 = this.tech_.seekable();
  110099. if (this.tech_.duration() === Infinity) {
  110100. if (this.tech_.currentTime() < seekable3.start(0)) {
  110101. return this.tech_.setCurrentTime(seekable3.end(seekable3.length - 1));
  110102. }
  110103. }
  110104. };
  110105. _proto.setupFirstPlay = function setupFirstPlay() {
  110106. var _this6 = this;
  110107. var media = this.masterPlaylistLoader_.media();
  110108. if (!media || this.tech_.paused() || this.hasPlayed_) {
  110109. return false;
  110110. }
  110111. if (!media.endList) {
  110112. var seekable3 = this.seekable();
  110113. if (!seekable3.length) {
  110114. return false;
  110115. }
  110116. if (videojs.browser.IE_VERSION && this.tech_.readyState() === 0) {
  110117. this.tech_.one("loadedmetadata", function() {
  110118. _this6.trigger("firstplay");
  110119. _this6.tech_.setCurrentTime(seekable3.end(0));
  110120. _this6.hasPlayed_ = true;
  110121. });
  110122. return false;
  110123. }
  110124. this.trigger("firstplay");
  110125. this.tech_.setCurrentTime(seekable3.end(0));
  110126. }
  110127. this.hasPlayed_ = true;
  110128. this.load();
  110129. return true;
  110130. };
  110131. _proto.handleSourceOpen_ = function handleSourceOpen_() {
  110132. this.tryToCreateSourceBuffers_();
  110133. if (this.tech_.autoplay()) {
  110134. var playPromise = this.tech_.play();
  110135. if (typeof playPromise !== "undefined" && typeof playPromise.then === "function") {
  110136. playPromise.then(null, function(e) {
  110137. });
  110138. }
  110139. }
  110140. this.trigger("sourceopen");
  110141. };
  110142. _proto.handleSourceEnded_ = function handleSourceEnded_() {
  110143. if (!this.inbandTextTracks_.metadataTrack_) {
  110144. return;
  110145. }
  110146. var cues = this.inbandTextTracks_.metadataTrack_.cues;
  110147. if (!cues || !cues.length) {
  110148. return;
  110149. }
  110150. var duration5 = this.duration();
  110151. cues[cues.length - 1].endTime = isNaN(duration5) || Math.abs(duration5) === Infinity ? Number.MAX_VALUE : duration5;
  110152. };
  110153. _proto.handleDurationChange_ = function handleDurationChange_() {
  110154. this.tech_.trigger("durationchange");
  110155. };
  110156. _proto.onEndOfStream = function onEndOfStream() {
  110157. var isEndOfStream = this.mainSegmentLoader_.ended_;
  110158. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  110159. var mainMediaInfo = this.mainSegmentLoader_.getCurrentMediaInfo_();
  110160. if (!mainMediaInfo || mainMediaInfo.hasVideo) {
  110161. isEndOfStream = isEndOfStream && this.audioSegmentLoader_.ended_;
  110162. } else {
  110163. isEndOfStream = this.audioSegmentLoader_.ended_;
  110164. }
  110165. }
  110166. if (!isEndOfStream) {
  110167. return;
  110168. }
  110169. this.stopABRTimer_();
  110170. this.sourceUpdater_.endOfStream();
  110171. };
  110172. _proto.stuckAtPlaylistEnd_ = function stuckAtPlaylistEnd_(playlist) {
  110173. var seekable3 = this.seekable();
  110174. if (!seekable3.length) {
  110175. return false;
  110176. }
  110177. var expired = this.syncController_.getExpiredTime(playlist, this.duration());
  110178. if (expired === null) {
  110179. return false;
  110180. }
  110181. var absolutePlaylistEnd = Vhs$1.Playlist.playlistEnd(playlist, expired);
  110182. var currentTime = this.tech_.currentTime();
  110183. var buffered = this.tech_.buffered();
  110184. if (!buffered.length) {
  110185. return absolutePlaylistEnd - currentTime <= SAFE_TIME_DELTA;
  110186. }
  110187. var bufferedEnd = buffered.end(buffered.length - 1);
  110188. return bufferedEnd - currentTime <= SAFE_TIME_DELTA && absolutePlaylistEnd - bufferedEnd <= SAFE_TIME_DELTA;
  110189. };
  110190. _proto.blacklistCurrentPlaylist = function blacklistCurrentPlaylist(error, blacklistDuration) {
  110191. if (error === void 0) {
  110192. error = {};
  110193. }
  110194. var currentPlaylist = error.playlist || this.masterPlaylistLoader_.media();
  110195. blacklistDuration = blacklistDuration || error.blacklistDuration || this.blacklistDuration;
  110196. if (!currentPlaylist) {
  110197. this.error = error;
  110198. if (this.mediaSource.readyState !== "open") {
  110199. this.trigger("error");
  110200. } else {
  110201. this.sourceUpdater_.endOfStream("network");
  110202. }
  110203. return;
  110204. }
  110205. currentPlaylist.playlistErrors_++;
  110206. var playlists = this.masterPlaylistLoader_.master.playlists;
  110207. var enabledPlaylists = playlists.filter(isEnabled);
  110208. var isFinalRendition = enabledPlaylists.length === 1 && enabledPlaylists[0] === currentPlaylist;
  110209. if (playlists.length === 1 && blacklistDuration !== Infinity) {
  110210. videojs.log.warn("Problem encountered with playlist " + currentPlaylist.id + ". Trying again since it is the only playlist.");
  110211. this.tech_.trigger("retryplaylist");
  110212. return this.masterPlaylistLoader_.load(isFinalRendition);
  110213. }
  110214. if (isFinalRendition) {
  110215. var reincluded = false;
  110216. playlists.forEach(function(playlist) {
  110217. if (playlist === currentPlaylist) {
  110218. return;
  110219. }
  110220. var excludeUntil2 = playlist.excludeUntil;
  110221. if (typeof excludeUntil2 !== "undefined" && excludeUntil2 !== Infinity) {
  110222. reincluded = true;
  110223. delete playlist.excludeUntil;
  110224. }
  110225. });
  110226. if (reincluded) {
  110227. videojs.log.warn("Removing other playlists from the exclusion list because the last rendition is about to be excluded.");
  110228. this.tech_.trigger("retryplaylist");
  110229. }
  110230. }
  110231. var excludeUntil;
  110232. if (currentPlaylist.playlistErrors_ > this.maxPlaylistRetries) {
  110233. excludeUntil = Infinity;
  110234. } else {
  110235. excludeUntil = Date.now() + blacklistDuration * 1e3;
  110236. }
  110237. currentPlaylist.excludeUntil = excludeUntil;
  110238. if (error.reason) {
  110239. currentPlaylist.lastExcludeReason_ = error.reason;
  110240. }
  110241. this.tech_.trigger("blacklistplaylist");
  110242. this.tech_.trigger({
  110243. type: "usage",
  110244. name: "vhs-rendition-blacklisted"
  110245. });
  110246. this.tech_.trigger({
  110247. type: "usage",
  110248. name: "hls-rendition-blacklisted"
  110249. });
  110250. var nextPlaylist = this.selectPlaylist();
  110251. if (!nextPlaylist) {
  110252. this.error = "Playback cannot continue. No available working or supported playlists.";
  110253. this.trigger("error");
  110254. return;
  110255. }
  110256. var logFn2 = error.internal ? this.logger_ : videojs.log.warn;
  110257. var errorMessage = error.message ? " " + error.message : "";
  110258. logFn2((error.internal ? "Internal problem" : "Problem") + " encountered with playlist " + currentPlaylist.id + "." + (errorMessage + " Switching to playlist " + nextPlaylist.id + "."));
  110259. if (nextPlaylist.attributes.AUDIO !== currentPlaylist.attributes.AUDIO) {
  110260. this.delegateLoaders_("audio", ["abort", "pause"]);
  110261. }
  110262. if (nextPlaylist.attributes.SUBTITLES !== currentPlaylist.attributes.SUBTITLES) {
  110263. this.delegateLoaders_("subtitle", ["abort", "pause"]);
  110264. }
  110265. this.delegateLoaders_("main", ["abort", "pause"]);
  110266. var delayDuration = nextPlaylist.targetDuration / 2 * 1e3 || 5 * 1e3;
  110267. var shouldDelay = typeof nextPlaylist.lastRequest === "number" && Date.now() - nextPlaylist.lastRequest <= delayDuration;
  110268. return this.switchMedia_(nextPlaylist, "exclude", isFinalRendition || shouldDelay);
  110269. };
  110270. _proto.pauseLoading = function pauseLoading() {
  110271. this.delegateLoaders_("all", ["abort", "pause"]);
  110272. this.stopABRTimer_();
  110273. };
  110274. _proto.delegateLoaders_ = function delegateLoaders_(filter, fnNames) {
  110275. var _this7 = this;
  110276. var loaders = [];
  110277. var dontFilterPlaylist = filter === "all";
  110278. if (dontFilterPlaylist || filter === "main") {
  110279. loaders.push(this.masterPlaylistLoader_);
  110280. }
  110281. var mediaTypes2 = [];
  110282. if (dontFilterPlaylist || filter === "audio") {
  110283. mediaTypes2.push("AUDIO");
  110284. }
  110285. if (dontFilterPlaylist || filter === "subtitle") {
  110286. mediaTypes2.push("CLOSED-CAPTIONS");
  110287. mediaTypes2.push("SUBTITLES");
  110288. }
  110289. mediaTypes2.forEach(function(mediaType) {
  110290. var loader = _this7.mediaTypes_[mediaType] && _this7.mediaTypes_[mediaType].activePlaylistLoader;
  110291. if (loader) {
  110292. loaders.push(loader);
  110293. }
  110294. });
  110295. ["main", "audio", "subtitle"].forEach(function(name) {
  110296. var loader = _this7[name + "SegmentLoader_"];
  110297. if (loader && (filter === name || filter === "all")) {
  110298. loaders.push(loader);
  110299. }
  110300. });
  110301. loaders.forEach(function(loader) {
  110302. return fnNames.forEach(function(fnName) {
  110303. if (typeof loader[fnName] === "function") {
  110304. loader[fnName]();
  110305. }
  110306. });
  110307. });
  110308. };
  110309. _proto.setCurrentTime = function setCurrentTime(currentTime) {
  110310. var buffered = findRange(this.tech_.buffered(), currentTime);
  110311. if (!(this.masterPlaylistLoader_ && this.masterPlaylistLoader_.media())) {
  110312. return 0;
  110313. }
  110314. if (!this.masterPlaylistLoader_.media().segments) {
  110315. return 0;
  110316. }
  110317. if (buffered && buffered.length) {
  110318. return currentTime;
  110319. }
  110320. this.mainSegmentLoader_.resetEverything();
  110321. this.mainSegmentLoader_.abort();
  110322. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  110323. this.audioSegmentLoader_.resetEverything();
  110324. this.audioSegmentLoader_.abort();
  110325. }
  110326. if (this.mediaTypes_.SUBTITLES.activePlaylistLoader) {
  110327. this.subtitleSegmentLoader_.resetEverything();
  110328. this.subtitleSegmentLoader_.abort();
  110329. }
  110330. this.load();
  110331. };
  110332. _proto.duration = function duration5() {
  110333. if (!this.masterPlaylistLoader_) {
  110334. return 0;
  110335. }
  110336. var media = this.masterPlaylistLoader_.media();
  110337. if (!media) {
  110338. return 0;
  110339. }
  110340. if (!media.endList) {
  110341. return Infinity;
  110342. }
  110343. if (this.mediaSource) {
  110344. return this.mediaSource.duration;
  110345. }
  110346. return Vhs$1.Playlist.duration(media);
  110347. };
  110348. _proto.seekable = function seekable3() {
  110349. return this.seekable_;
  110350. };
  110351. _proto.onSyncInfoUpdate_ = function onSyncInfoUpdate_() {
  110352. var audioSeekable;
  110353. if (!this.masterPlaylistLoader_) {
  110354. return;
  110355. }
  110356. var media = this.masterPlaylistLoader_.media();
  110357. if (!media) {
  110358. return;
  110359. }
  110360. var expired = this.syncController_.getExpiredTime(media, this.duration());
  110361. if (expired === null) {
  110362. return;
  110363. }
  110364. var master = this.masterPlaylistLoader_.master;
  110365. var mainSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media));
  110366. if (mainSeekable.length === 0) {
  110367. return;
  110368. }
  110369. if (this.mediaTypes_.AUDIO.activePlaylistLoader) {
  110370. media = this.mediaTypes_.AUDIO.activePlaylistLoader.media();
  110371. expired = this.syncController_.getExpiredTime(media, this.duration());
  110372. if (expired === null) {
  110373. return;
  110374. }
  110375. audioSeekable = Vhs$1.Playlist.seekable(media, expired, Vhs$1.Playlist.liveEdgeDelay(master, media));
  110376. if (audioSeekable.length === 0) {
  110377. return;
  110378. }
  110379. }
  110380. var oldEnd;
  110381. var oldStart;
  110382. if (this.seekable_ && this.seekable_.length) {
  110383. oldEnd = this.seekable_.end(0);
  110384. oldStart = this.seekable_.start(0);
  110385. }
  110386. if (!audioSeekable) {
  110387. this.seekable_ = mainSeekable;
  110388. } else if (audioSeekable.start(0) > mainSeekable.end(0) || mainSeekable.start(0) > audioSeekable.end(0)) {
  110389. this.seekable_ = mainSeekable;
  110390. } else {
  110391. this.seekable_ = videojs.createTimeRanges([[audioSeekable.start(0) > mainSeekable.start(0) ? audioSeekable.start(0) : mainSeekable.start(0), audioSeekable.end(0) < mainSeekable.end(0) ? audioSeekable.end(0) : mainSeekable.end(0)]]);
  110392. }
  110393. if (this.seekable_ && this.seekable_.length) {
  110394. if (this.seekable_.end(0) === oldEnd && this.seekable_.start(0) === oldStart) {
  110395. return;
  110396. }
  110397. }
  110398. this.logger_("seekable updated [" + printableRange(this.seekable_) + "]");
  110399. this.tech_.trigger("seekablechanged");
  110400. };
  110401. _proto.updateDuration = function updateDuration(isLive) {
  110402. if (this.updateDuration_) {
  110403. this.mediaSource.removeEventListener("sourceopen", this.updateDuration_);
  110404. this.updateDuration_ = null;
  110405. }
  110406. if (this.mediaSource.readyState !== "open") {
  110407. this.updateDuration_ = this.updateDuration.bind(this, isLive);
  110408. this.mediaSource.addEventListener("sourceopen", this.updateDuration_);
  110409. return;
  110410. }
  110411. if (isLive) {
  110412. var seekable3 = this.seekable();
  110413. if (!seekable3.length) {
  110414. return;
  110415. }
  110416. if (isNaN(this.mediaSource.duration) || this.mediaSource.duration < seekable3.end(seekable3.length - 1)) {
  110417. this.sourceUpdater_.setDuration(seekable3.end(seekable3.length - 1));
  110418. }
  110419. return;
  110420. }
  110421. var buffered = this.tech_.buffered();
  110422. var duration5 = Vhs$1.Playlist.duration(this.masterPlaylistLoader_.media());
  110423. if (buffered.length > 0) {
  110424. duration5 = Math.max(duration5, buffered.end(buffered.length - 1));
  110425. }
  110426. if (this.mediaSource.duration !== duration5) {
  110427. this.sourceUpdater_.setDuration(duration5);
  110428. }
  110429. };
  110430. _proto.dispose = function dispose() {
  110431. var _this8 = this;
  110432. this.trigger("dispose");
  110433. this.decrypter_.terminate();
  110434. this.masterPlaylistLoader_.dispose();
  110435. this.mainSegmentLoader_.dispose();
  110436. if (this.loadOnPlay_) {
  110437. this.tech_.off("play", this.loadOnPlay_);
  110438. }
  110439. ["AUDIO", "SUBTITLES"].forEach(function(type2) {
  110440. var groups = _this8.mediaTypes_[type2].groups;
  110441. for (var id in groups) {
  110442. groups[id].forEach(function(group) {
  110443. if (group.playlistLoader) {
  110444. group.playlistLoader.dispose();
  110445. }
  110446. });
  110447. }
  110448. });
  110449. this.audioSegmentLoader_.dispose();
  110450. this.subtitleSegmentLoader_.dispose();
  110451. this.sourceUpdater_.dispose();
  110452. this.timelineChangeController_.dispose();
  110453. this.stopABRTimer_();
  110454. if (this.updateDuration_) {
  110455. this.mediaSource.removeEventListener("sourceopen", this.updateDuration_);
  110456. }
  110457. this.mediaSource.removeEventListener("durationchange", this.handleDurationChange_);
  110458. this.mediaSource.removeEventListener("sourceopen", this.handleSourceOpen_);
  110459. this.mediaSource.removeEventListener("sourceended", this.handleSourceEnded_);
  110460. this.off();
  110461. };
  110462. _proto.master = function master() {
  110463. return this.masterPlaylistLoader_.master;
  110464. };
  110465. _proto.media = function media() {
  110466. return this.masterPlaylistLoader_.media() || this.initialMedia_;
  110467. };
  110468. _proto.areMediaTypesKnown_ = function areMediaTypesKnown_() {
  110469. var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
  110470. var hasMainMediaInfo = !!this.mainSegmentLoader_.getCurrentMediaInfo_();
  110471. var hasAudioMediaInfo = !usingAudioLoader ? true : !!this.audioSegmentLoader_.getCurrentMediaInfo_();
  110472. if (!hasMainMediaInfo || !hasAudioMediaInfo) {
  110473. return false;
  110474. }
  110475. return true;
  110476. };
  110477. _proto.getCodecsOrExclude_ = function getCodecsOrExclude_() {
  110478. var _this9 = this;
  110479. var media = {
  110480. main: this.mainSegmentLoader_.getCurrentMediaInfo_() || {},
  110481. audio: this.audioSegmentLoader_.getCurrentMediaInfo_() || {}
  110482. };
  110483. var playlist = this.mainSegmentLoader_.getPendingSegmentPlaylist() || this.media();
  110484. media.video = media.main;
  110485. var playlistCodecs = codecsForPlaylist(this.master(), playlist);
  110486. var codecs = {};
  110487. var usingAudioLoader = !!this.mediaTypes_.AUDIO.activePlaylistLoader;
  110488. if (media.main.hasVideo) {
  110489. codecs.video = playlistCodecs.video || media.main.videoCodec || DEFAULT_VIDEO_CODEC;
  110490. }
  110491. if (media.main.isMuxed) {
  110492. codecs.video += "," + (playlistCodecs.audio || media.main.audioCodec || DEFAULT_AUDIO_CODEC);
  110493. }
  110494. if (media.main.hasAudio && !media.main.isMuxed || media.audio.hasAudio || usingAudioLoader) {
  110495. codecs.audio = playlistCodecs.audio || media.main.audioCodec || media.audio.audioCodec || DEFAULT_AUDIO_CODEC;
  110496. media.audio.isFmp4 = media.main.hasAudio && !media.main.isMuxed ? media.main.isFmp4 : media.audio.isFmp4;
  110497. }
  110498. if (!codecs.audio && !codecs.video) {
  110499. this.blacklistCurrentPlaylist({
  110500. playlist,
  110501. message: "Could not determine codecs for playlist.",
  110502. blacklistDuration: Infinity
  110503. });
  110504. return;
  110505. }
  110506. var supportFunction = function supportFunction2(isFmp4, codec) {
  110507. return isFmp4 ? browserSupportsCodec2(codec) : muxerSupportsCodec2(codec);
  110508. };
  110509. var unsupportedCodecs = {};
  110510. var unsupportedAudio;
  110511. ["video", "audio"].forEach(function(type2) {
  110512. if (codecs.hasOwnProperty(type2) && !supportFunction(media[type2].isFmp4, codecs[type2])) {
  110513. var supporter = media[type2].isFmp4 ? "browser" : "muxer";
  110514. unsupportedCodecs[supporter] = unsupportedCodecs[supporter] || [];
  110515. unsupportedCodecs[supporter].push(codecs[type2]);
  110516. if (type2 === "audio") {
  110517. unsupportedAudio = supporter;
  110518. }
  110519. }
  110520. });
  110521. if (usingAudioLoader && unsupportedAudio && playlist.attributes.AUDIO) {
  110522. var audioGroup = playlist.attributes.AUDIO;
  110523. this.master().playlists.forEach(function(variant) {
  110524. var variantAudioGroup = variant.attributes && variant.attributes.AUDIO;
  110525. if (variantAudioGroup === audioGroup && variant !== playlist) {
  110526. variant.excludeUntil = Infinity;
  110527. }
  110528. });
  110529. this.logger_("excluding audio group " + audioGroup + " as " + unsupportedAudio + ' does not support codec(s): "' + codecs.audio + '"');
  110530. }
  110531. if (Object.keys(unsupportedCodecs).length) {
  110532. var message = Object.keys(unsupportedCodecs).reduce(function(acc, supporter) {
  110533. if (acc) {
  110534. acc += ", ";
  110535. }
  110536. acc += supporter + ' does not support codec(s): "' + unsupportedCodecs[supporter].join(",") + '"';
  110537. return acc;
  110538. }, "") + ".";
  110539. this.blacklistCurrentPlaylist({
  110540. playlist,
  110541. internal: true,
  110542. message,
  110543. blacklistDuration: Infinity
  110544. });
  110545. return;
  110546. }
  110547. if (this.sourceUpdater_.hasCreatedSourceBuffers() && !this.sourceUpdater_.canChangeType()) {
  110548. var switchMessages = [];
  110549. ["video", "audio"].forEach(function(type2) {
  110550. var newCodec = (parseCodecs2(_this9.sourceUpdater_.codecs[type2] || "")[0] || {}).type;
  110551. var oldCodec = (parseCodecs2(codecs[type2] || "")[0] || {}).type;
  110552. if (newCodec && oldCodec && newCodec.toLowerCase() !== oldCodec.toLowerCase()) {
  110553. switchMessages.push('"' + _this9.sourceUpdater_.codecs[type2] + '" -> "' + codecs[type2] + '"');
  110554. }
  110555. });
  110556. if (switchMessages.length) {
  110557. this.blacklistCurrentPlaylist({
  110558. playlist,
  110559. message: "Codec switching not supported: " + switchMessages.join(", ") + ".",
  110560. blacklistDuration: Infinity,
  110561. internal: true
  110562. });
  110563. return;
  110564. }
  110565. }
  110566. return codecs;
  110567. };
  110568. _proto.tryToCreateSourceBuffers_ = function tryToCreateSourceBuffers_() {
  110569. if (this.mediaSource.readyState !== "open" || this.sourceUpdater_.hasCreatedSourceBuffers()) {
  110570. return;
  110571. }
  110572. if (!this.areMediaTypesKnown_()) {
  110573. return;
  110574. }
  110575. var codecs = this.getCodecsOrExclude_();
  110576. if (!codecs) {
  110577. return;
  110578. }
  110579. this.sourceUpdater_.createSourceBuffers(codecs);
  110580. var codecString = [codecs.video, codecs.audio].filter(Boolean).join(",");
  110581. this.excludeIncompatibleVariants_(codecString);
  110582. };
  110583. _proto.excludeUnsupportedVariants_ = function excludeUnsupportedVariants_() {
  110584. var _this10 = this;
  110585. var playlists = this.master().playlists;
  110586. var ids = [];
  110587. Object.keys(playlists).forEach(function(key) {
  110588. var variant = playlists[key];
  110589. if (ids.indexOf(variant.id) !== -1) {
  110590. return;
  110591. }
  110592. ids.push(variant.id);
  110593. var codecs = codecsForPlaylist(_this10.master, variant);
  110594. var unsupported = [];
  110595. if (codecs.audio && !muxerSupportsCodec2(codecs.audio) && !browserSupportsCodec2(codecs.audio)) {
  110596. unsupported.push("audio codec " + codecs.audio);
  110597. }
  110598. if (codecs.video && !muxerSupportsCodec2(codecs.video) && !browserSupportsCodec2(codecs.video)) {
  110599. unsupported.push("video codec " + codecs.video);
  110600. }
  110601. if (codecs.text && codecs.text === "stpp.ttml.im1t") {
  110602. unsupported.push("text codec " + codecs.text);
  110603. }
  110604. if (unsupported.length) {
  110605. variant.excludeUntil = Infinity;
  110606. _this10.logger_("excluding " + variant.id + " for unsupported: " + unsupported.join(", "));
  110607. }
  110608. });
  110609. };
  110610. _proto.excludeIncompatibleVariants_ = function excludeIncompatibleVariants_(codecString) {
  110611. var _this11 = this;
  110612. var ids = [];
  110613. var playlists = this.master().playlists;
  110614. var codecs = unwrapCodecList(parseCodecs2(codecString));
  110615. var codecCount_ = codecCount(codecs);
  110616. var videoDetails = codecs.video && parseCodecs2(codecs.video)[0] || null;
  110617. var audioDetails = codecs.audio && parseCodecs2(codecs.audio)[0] || null;
  110618. Object.keys(playlists).forEach(function(key) {
  110619. var variant = playlists[key];
  110620. if (ids.indexOf(variant.id) !== -1 || variant.excludeUntil === Infinity) {
  110621. return;
  110622. }
  110623. ids.push(variant.id);
  110624. var blacklistReasons = [];
  110625. var variantCodecs = codecsForPlaylist(_this11.masterPlaylistLoader_.master, variant);
  110626. var variantCodecCount = codecCount(variantCodecs);
  110627. if (!variantCodecs.audio && !variantCodecs.video) {
  110628. return;
  110629. }
  110630. if (variantCodecCount !== codecCount_) {
  110631. blacklistReasons.push('codec count "' + variantCodecCount + '" !== "' + codecCount_ + '"');
  110632. }
  110633. if (!_this11.sourceUpdater_.canChangeType()) {
  110634. var variantVideoDetails = variantCodecs.video && parseCodecs2(variantCodecs.video)[0] || null;
  110635. var variantAudioDetails = variantCodecs.audio && parseCodecs2(variantCodecs.audio)[0] || null;
  110636. if (variantVideoDetails && videoDetails && variantVideoDetails.type.toLowerCase() !== videoDetails.type.toLowerCase()) {
  110637. blacklistReasons.push('video codec "' + variantVideoDetails.type + '" !== "' + videoDetails.type + '"');
  110638. }
  110639. if (variantAudioDetails && audioDetails && variantAudioDetails.type.toLowerCase() !== audioDetails.type.toLowerCase()) {
  110640. blacklistReasons.push('audio codec "' + variantAudioDetails.type + '" !== "' + audioDetails.type + '"');
  110641. }
  110642. }
  110643. if (blacklistReasons.length) {
  110644. variant.excludeUntil = Infinity;
  110645. _this11.logger_("blacklisting " + variant.id + ": " + blacklistReasons.join(" && "));
  110646. }
  110647. });
  110648. };
  110649. _proto.updateAdCues_ = function updateAdCues_(media) {
  110650. var offset = 0;
  110651. var seekable3 = this.seekable();
  110652. if (seekable3.length) {
  110653. offset = seekable3.start(0);
  110654. }
  110655. updateAdCues(media, this.cueTagsTrack_, offset);
  110656. };
  110657. _proto.goalBufferLength = function goalBufferLength() {
  110658. var currentTime = this.tech_.currentTime();
  110659. var initial = Config.GOAL_BUFFER_LENGTH;
  110660. var rate = Config.GOAL_BUFFER_LENGTH_RATE;
  110661. var max2 = Math.max(initial, Config.MAX_GOAL_BUFFER_LENGTH);
  110662. return Math.min(initial + currentTime * rate, max2);
  110663. };
  110664. _proto.bufferLowWaterLine = function bufferLowWaterLine() {
  110665. var currentTime = this.tech_.currentTime();
  110666. var initial = Config.BUFFER_LOW_WATER_LINE;
  110667. var rate = Config.BUFFER_LOW_WATER_LINE_RATE;
  110668. var max2 = Math.max(initial, Config.MAX_BUFFER_LOW_WATER_LINE);
  110669. var newMax = Math.max(initial, Config.EXPERIMENTAL_MAX_BUFFER_LOW_WATER_LINE);
  110670. return Math.min(initial + currentTime * rate, this.experimentalBufferBasedABR ? newMax : max2);
  110671. };
  110672. _proto.bufferHighWaterLine = function bufferHighWaterLine() {
  110673. return Config.BUFFER_HIGH_WATER_LINE;
  110674. };
  110675. return MasterPlaylistController2;
  110676. }(videojs.EventTarget);
  110677. var enableFunction = function enableFunction2(loader, playlistID, changePlaylistFn) {
  110678. return function(enable) {
  110679. var playlist = loader.master.playlists[playlistID];
  110680. var incompatible = isIncompatible(playlist);
  110681. var currentlyEnabled = isEnabled(playlist);
  110682. if (typeof enable === "undefined") {
  110683. return currentlyEnabled;
  110684. }
  110685. if (enable) {
  110686. delete playlist.disabled;
  110687. } else {
  110688. playlist.disabled = true;
  110689. }
  110690. if (enable !== currentlyEnabled && !incompatible) {
  110691. changePlaylistFn();
  110692. if (enable) {
  110693. loader.trigger("renditionenabled");
  110694. } else {
  110695. loader.trigger("renditiondisabled");
  110696. }
  110697. }
  110698. return enable;
  110699. };
  110700. };
  110701. var Representation = function Representation2(vhsHandler, playlist, id) {
  110702. var mpc = vhsHandler.masterPlaylistController_, smoothQualityChange = vhsHandler.options_.smoothQualityChange;
  110703. var changeType2 = smoothQualityChange ? "smooth" : "fast";
  110704. var qualityChangeFunction = mpc[changeType2 + "QualityChange_"].bind(mpc);
  110705. if (playlist.attributes) {
  110706. var resolution = playlist.attributes.RESOLUTION;
  110707. this.width = resolution && resolution.width;
  110708. this.height = resolution && resolution.height;
  110709. this.bandwidth = playlist.attributes.BANDWIDTH;
  110710. this.frameRate = playlist.attributes["FRAME-RATE"];
  110711. }
  110712. this.codecs = codecsForPlaylist(mpc.master(), playlist);
  110713. this.playlist = playlist;
  110714. this.id = id;
  110715. this.enabled = enableFunction(vhsHandler.playlists, playlist.id, qualityChangeFunction);
  110716. };
  110717. var renditionSelectionMixin = function renditionSelectionMixin2(vhsHandler) {
  110718. vhsHandler.representations = function() {
  110719. var master = vhsHandler.masterPlaylistController_.master();
  110720. var playlists = isAudioOnly(master) ? vhsHandler.masterPlaylistController_.getAudioTrackPlaylists_() : master.playlists;
  110721. if (!playlists) {
  110722. return [];
  110723. }
  110724. return playlists.filter(function(media) {
  110725. return !isIncompatible(media);
  110726. }).map(function(e, i2) {
  110727. return new Representation(vhsHandler, e, e.id);
  110728. });
  110729. };
  110730. };
  110731. var timerCancelEvents = ["seeking", "seeked", "pause", "playing", "error"];
  110732. var PlaybackWatcher = /* @__PURE__ */ function() {
  110733. function PlaybackWatcher2(options2) {
  110734. var _this = this;
  110735. this.masterPlaylistController_ = options2.masterPlaylistController;
  110736. this.tech_ = options2.tech;
  110737. this.seekable = options2.seekable;
  110738. this.allowSeeksWithinUnsafeLiveWindow = options2.allowSeeksWithinUnsafeLiveWindow;
  110739. this.liveRangeSafeTimeDelta = options2.liveRangeSafeTimeDelta;
  110740. this.media = options2.media;
  110741. this.consecutiveUpdates = 0;
  110742. this.lastRecordedTime = null;
  110743. this.timer_ = null;
  110744. this.checkCurrentTimeTimeout_ = null;
  110745. this.logger_ = logger("PlaybackWatcher");
  110746. this.logger_("initialize");
  110747. var playHandler = function playHandler2() {
  110748. return _this.monitorCurrentTime_();
  110749. };
  110750. var canPlayHandler = function canPlayHandler2() {
  110751. return _this.monitorCurrentTime_();
  110752. };
  110753. var waitingHandler = function waitingHandler2() {
  110754. return _this.techWaiting_();
  110755. };
  110756. var cancelTimerHandler = function cancelTimerHandler2() {
  110757. return _this.cancelTimer_();
  110758. };
  110759. var mpc = this.masterPlaylistController_;
  110760. var loaderTypes = ["main", "subtitle", "audio"];
  110761. var loaderChecks = {};
  110762. loaderTypes.forEach(function(type2) {
  110763. loaderChecks[type2] = {
  110764. reset: function reset3() {
  110765. return _this.resetSegmentDownloads_(type2);
  110766. },
  110767. updateend: function updateend() {
  110768. return _this.checkSegmentDownloads_(type2);
  110769. }
  110770. };
  110771. mpc[type2 + "SegmentLoader_"].on("appendsdone", loaderChecks[type2].updateend);
  110772. mpc[type2 + "SegmentLoader_"].on("playlistupdate", loaderChecks[type2].reset);
  110773. _this.tech_.on(["seeked", "seeking"], loaderChecks[type2].reset);
  110774. });
  110775. var setSeekingHandlers = function setSeekingHandlers2(fn2) {
  110776. ["main", "audio"].forEach(function(type2) {
  110777. mpc[type2 + "SegmentLoader_"][fn2]("appended", _this.seekingAppendCheck_);
  110778. });
  110779. };
  110780. this.seekingAppendCheck_ = function() {
  110781. if (_this.fixesBadSeeks_()) {
  110782. _this.consecutiveUpdates = 0;
  110783. _this.lastRecordedTime = _this.tech_.currentTime();
  110784. setSeekingHandlers("off");
  110785. }
  110786. };
  110787. this.clearSeekingAppendCheck_ = function() {
  110788. return setSeekingHandlers("off");
  110789. };
  110790. this.watchForBadSeeking_ = function() {
  110791. _this.clearSeekingAppendCheck_();
  110792. setSeekingHandlers("on");
  110793. };
  110794. this.tech_.on("seeked", this.clearSeekingAppendCheck_);
  110795. this.tech_.on("seeking", this.watchForBadSeeking_);
  110796. this.tech_.on("waiting", waitingHandler);
  110797. this.tech_.on(timerCancelEvents, cancelTimerHandler);
  110798. this.tech_.on("canplay", canPlayHandler);
  110799. this.tech_.one("play", playHandler);
  110800. this.dispose = function() {
  110801. _this.clearSeekingAppendCheck_();
  110802. _this.logger_("dispose");
  110803. _this.tech_.off("waiting", waitingHandler);
  110804. _this.tech_.off(timerCancelEvents, cancelTimerHandler);
  110805. _this.tech_.off("canplay", canPlayHandler);
  110806. _this.tech_.off("play", playHandler);
  110807. _this.tech_.off("seeking", _this.watchForBadSeeking_);
  110808. _this.tech_.off("seeked", _this.clearSeekingAppendCheck_);
  110809. loaderTypes.forEach(function(type2) {
  110810. mpc[type2 + "SegmentLoader_"].off("appendsdone", loaderChecks[type2].updateend);
  110811. mpc[type2 + "SegmentLoader_"].off("playlistupdate", loaderChecks[type2].reset);
  110812. _this.tech_.off(["seeked", "seeking"], loaderChecks[type2].reset);
  110813. });
  110814. if (_this.checkCurrentTimeTimeout_) {
  110815. window_1.clearTimeout(_this.checkCurrentTimeTimeout_);
  110816. }
  110817. _this.cancelTimer_();
  110818. };
  110819. }
  110820. var _proto = PlaybackWatcher2.prototype;
  110821. _proto.monitorCurrentTime_ = function monitorCurrentTime_() {
  110822. this.checkCurrentTime_();
  110823. if (this.checkCurrentTimeTimeout_) {
  110824. window_1.clearTimeout(this.checkCurrentTimeTimeout_);
  110825. }
  110826. this.checkCurrentTimeTimeout_ = window_1.setTimeout(this.monitorCurrentTime_.bind(this), 250);
  110827. };
  110828. _proto.resetSegmentDownloads_ = function resetSegmentDownloads_(type2) {
  110829. var loader = this.masterPlaylistController_[type2 + "SegmentLoader_"];
  110830. if (this[type2 + "StalledDownloads_"] > 0) {
  110831. this.logger_("resetting possible stalled download count for " + type2 + " loader");
  110832. }
  110833. this[type2 + "StalledDownloads_"] = 0;
  110834. this[type2 + "Buffered_"] = loader.buffered_();
  110835. };
  110836. _proto.checkSegmentDownloads_ = function checkSegmentDownloads_(type2) {
  110837. var mpc = this.masterPlaylistController_;
  110838. var loader = mpc[type2 + "SegmentLoader_"];
  110839. var buffered = loader.buffered_();
  110840. var isBufferedDifferent = isRangeDifferent(this[type2 + "Buffered_"], buffered);
  110841. this[type2 + "Buffered_"] = buffered;
  110842. if (isBufferedDifferent) {
  110843. this.resetSegmentDownloads_(type2);
  110844. return;
  110845. }
  110846. this[type2 + "StalledDownloads_"]++;
  110847. this.logger_("found #" + this[type2 + "StalledDownloads_"] + " " + type2 + " appends that did not increase buffer (possible stalled download)", {
  110848. playlistId: loader.playlist_ && loader.playlist_.id,
  110849. buffered: timeRangesToArray(buffered)
  110850. });
  110851. if (this[type2 + "StalledDownloads_"] < 10) {
  110852. return;
  110853. }
  110854. this.logger_(type2 + " loader stalled download exclusion");
  110855. this.resetSegmentDownloads_(type2);
  110856. this.tech_.trigger({
  110857. type: "usage",
  110858. name: "vhs-" + type2 + "-download-exclusion"
  110859. });
  110860. if (type2 === "subtitle") {
  110861. return;
  110862. }
  110863. mpc.blacklistCurrentPlaylist({
  110864. message: "Excessive " + type2 + " segment downloading detected."
  110865. }, Infinity);
  110866. };
  110867. _proto.checkCurrentTime_ = function checkCurrentTime_() {
  110868. if (this.tech_.paused() || this.tech_.seeking()) {
  110869. return;
  110870. }
  110871. var currentTime = this.tech_.currentTime();
  110872. var buffered = this.tech_.buffered();
  110873. if (this.lastRecordedTime === currentTime && (!buffered.length || currentTime + SAFE_TIME_DELTA >= buffered.end(buffered.length - 1))) {
  110874. return this.techWaiting_();
  110875. }
  110876. if (this.consecutiveUpdates >= 5 && currentTime === this.lastRecordedTime) {
  110877. this.consecutiveUpdates++;
  110878. this.waiting_();
  110879. } else if (currentTime === this.lastRecordedTime) {
  110880. this.consecutiveUpdates++;
  110881. } else {
  110882. this.consecutiveUpdates = 0;
  110883. this.lastRecordedTime = currentTime;
  110884. }
  110885. };
  110886. _proto.cancelTimer_ = function cancelTimer_() {
  110887. this.consecutiveUpdates = 0;
  110888. if (this.timer_) {
  110889. this.logger_("cancelTimer_");
  110890. clearTimeout(this.timer_);
  110891. }
  110892. this.timer_ = null;
  110893. };
  110894. _proto.fixesBadSeeks_ = function fixesBadSeeks_() {
  110895. var seeking = this.tech_.seeking();
  110896. if (!seeking) {
  110897. return false;
  110898. }
  110899. var seekable3 = this.seekable();
  110900. var currentTime = this.tech_.currentTime();
  110901. var isAfterSeekableRange = this.afterSeekableWindow_(seekable3, currentTime, this.media(), this.allowSeeksWithinUnsafeLiveWindow);
  110902. var seekTo;
  110903. if (isAfterSeekableRange) {
  110904. var seekableEnd = seekable3.end(seekable3.length - 1);
  110905. seekTo = seekableEnd;
  110906. }
  110907. if (this.beforeSeekableWindow_(seekable3, currentTime)) {
  110908. var seekableStart = seekable3.start(0);
  110909. seekTo = seekableStart + (seekableStart === seekable3.end(0) ? 0 : SAFE_TIME_DELTA);
  110910. }
  110911. if (typeof seekTo !== "undefined") {
  110912. this.logger_("Trying to seek outside of seekable at time " + currentTime + " with " + ("seekable range " + printableRange(seekable3) + ". Seeking to ") + (seekTo + "."));
  110913. this.tech_.setCurrentTime(seekTo);
  110914. return true;
  110915. }
  110916. var sourceUpdater = this.masterPlaylistController_.sourceUpdater_;
  110917. var buffered = this.tech_.buffered();
  110918. var audioBuffered = sourceUpdater.audioBuffer ? sourceUpdater.audioBuffered() : null;
  110919. var videoBuffered = sourceUpdater.videoBuffer ? sourceUpdater.videoBuffered() : null;
  110920. var media = this.media();
  110921. var minAppendedDuration = media.partTargetDuration ? media.partTargetDuration : (media.targetDuration - TIME_FUDGE_FACTOR) * 2;
  110922. var bufferedToCheck = [audioBuffered, videoBuffered];
  110923. for (var i2 = 0; i2 < bufferedToCheck.length; i2++) {
  110924. if (!bufferedToCheck[i2]) {
  110925. continue;
  110926. }
  110927. var timeAhead = timeAheadOf(bufferedToCheck[i2], currentTime);
  110928. if (timeAhead < minAppendedDuration) {
  110929. return false;
  110930. }
  110931. }
  110932. var nextRange = findNextRange(buffered, currentTime);
  110933. if (nextRange.length === 0) {
  110934. return false;
  110935. }
  110936. seekTo = nextRange.start(0) + SAFE_TIME_DELTA;
  110937. this.logger_("Buffered region starts (" + nextRange.start(0) + ") " + (" just beyond seek point (" + currentTime + "). Seeking to " + seekTo + "."));
  110938. this.tech_.setCurrentTime(seekTo);
  110939. return true;
  110940. };
  110941. _proto.waiting_ = function waiting_() {
  110942. if (this.techWaiting_()) {
  110943. return;
  110944. }
  110945. var currentTime = this.tech_.currentTime();
  110946. var buffered = this.tech_.buffered();
  110947. var currentRange = findRange(buffered, currentTime);
  110948. if (currentRange.length && currentTime + 3 <= currentRange.end(0)) {
  110949. this.cancelTimer_();
  110950. this.tech_.setCurrentTime(currentTime);
  110951. this.logger_("Stopped at " + currentTime + " while inside a buffered region " + ("[" + currentRange.start(0) + " -> " + currentRange.end(0) + "]. Attempting to resume ") + "playback by seeking to the current time.");
  110952. this.tech_.trigger({
  110953. type: "usage",
  110954. name: "vhs-unknown-waiting"
  110955. });
  110956. this.tech_.trigger({
  110957. type: "usage",
  110958. name: "hls-unknown-waiting"
  110959. });
  110960. return;
  110961. }
  110962. };
  110963. _proto.techWaiting_ = function techWaiting_() {
  110964. var seekable3 = this.seekable();
  110965. var currentTime = this.tech_.currentTime();
  110966. if (this.tech_.seeking() || this.timer_ !== null) {
  110967. return true;
  110968. }
  110969. if (this.beforeSeekableWindow_(seekable3, currentTime)) {
  110970. var livePoint = seekable3.end(seekable3.length - 1);
  110971. this.logger_("Fell out of live window at time " + currentTime + ". Seeking to " + ("live point (seekable end) " + livePoint));
  110972. this.cancelTimer_();
  110973. this.tech_.setCurrentTime(livePoint);
  110974. this.tech_.trigger({
  110975. type: "usage",
  110976. name: "vhs-live-resync"
  110977. });
  110978. this.tech_.trigger({
  110979. type: "usage",
  110980. name: "hls-live-resync"
  110981. });
  110982. return true;
  110983. }
  110984. var sourceUpdater = this.tech_.vhs.masterPlaylistController_.sourceUpdater_;
  110985. var buffered = this.tech_.buffered();
  110986. var videoUnderflow = this.videoUnderflow_({
  110987. audioBuffered: sourceUpdater.audioBuffered(),
  110988. videoBuffered: sourceUpdater.videoBuffered(),
  110989. currentTime
  110990. });
  110991. if (videoUnderflow) {
  110992. this.cancelTimer_();
  110993. this.tech_.setCurrentTime(currentTime);
  110994. this.tech_.trigger({
  110995. type: "usage",
  110996. name: "vhs-video-underflow"
  110997. });
  110998. this.tech_.trigger({
  110999. type: "usage",
  111000. name: "hls-video-underflow"
  111001. });
  111002. return true;
  111003. }
  111004. var nextRange = findNextRange(buffered, currentTime);
  111005. if (nextRange.length > 0) {
  111006. var difference = nextRange.start(0) - currentTime;
  111007. this.logger_("Stopped at " + currentTime + ", setting timer for " + difference + ", seeking " + ("to " + nextRange.start(0)));
  111008. this.cancelTimer_();
  111009. this.timer_ = setTimeout(this.skipTheGap_.bind(this), difference * 1e3, currentTime);
  111010. return true;
  111011. }
  111012. return false;
  111013. };
  111014. _proto.afterSeekableWindow_ = function afterSeekableWindow_(seekable3, currentTime, playlist, allowSeeksWithinUnsafeLiveWindow) {
  111015. if (allowSeeksWithinUnsafeLiveWindow === void 0) {
  111016. allowSeeksWithinUnsafeLiveWindow = false;
  111017. }
  111018. if (!seekable3.length) {
  111019. return false;
  111020. }
  111021. var allowedEnd = seekable3.end(seekable3.length - 1) + SAFE_TIME_DELTA;
  111022. var isLive = !playlist.endList;
  111023. if (isLive && allowSeeksWithinUnsafeLiveWindow) {
  111024. allowedEnd = seekable3.end(seekable3.length - 1) + playlist.targetDuration * 3;
  111025. }
  111026. if (currentTime > allowedEnd) {
  111027. return true;
  111028. }
  111029. return false;
  111030. };
  111031. _proto.beforeSeekableWindow_ = function beforeSeekableWindow_(seekable3, currentTime) {
  111032. if (seekable3.length && seekable3.start(0) > 0 && currentTime < seekable3.start(0) - this.liveRangeSafeTimeDelta) {
  111033. return true;
  111034. }
  111035. return false;
  111036. };
  111037. _proto.videoUnderflow_ = function videoUnderflow_(_ref) {
  111038. var videoBuffered = _ref.videoBuffered, audioBuffered = _ref.audioBuffered, currentTime = _ref.currentTime;
  111039. if (!videoBuffered) {
  111040. return;
  111041. }
  111042. var gap;
  111043. if (videoBuffered.length && audioBuffered.length) {
  111044. var lastVideoRange = findRange(videoBuffered, currentTime - 3);
  111045. var videoRange = findRange(videoBuffered, currentTime);
  111046. var audioRange = findRange(audioBuffered, currentTime);
  111047. if (audioRange.length && !videoRange.length && lastVideoRange.length) {
  111048. gap = {
  111049. start: lastVideoRange.end(0),
  111050. end: audioRange.end(0)
  111051. };
  111052. }
  111053. } else {
  111054. var nextRange = findNextRange(videoBuffered, currentTime);
  111055. if (!nextRange.length) {
  111056. gap = this.gapFromVideoUnderflow_(videoBuffered, currentTime);
  111057. }
  111058. }
  111059. if (gap) {
  111060. this.logger_("Encountered a gap in video from " + gap.start + " to " + gap.end + ". " + ("Seeking to current time " + currentTime));
  111061. return true;
  111062. }
  111063. return false;
  111064. };
  111065. _proto.skipTheGap_ = function skipTheGap_(scheduledCurrentTime) {
  111066. var buffered = this.tech_.buffered();
  111067. var currentTime = this.tech_.currentTime();
  111068. var nextRange = findNextRange(buffered, currentTime);
  111069. this.cancelTimer_();
  111070. if (nextRange.length === 0 || currentTime !== scheduledCurrentTime) {
  111071. return;
  111072. }
  111073. this.logger_("skipTheGap_:", "currentTime:", currentTime, "scheduled currentTime:", scheduledCurrentTime, "nextRange start:", nextRange.start(0));
  111074. this.tech_.setCurrentTime(nextRange.start(0) + TIME_FUDGE_FACTOR);
  111075. this.tech_.trigger({
  111076. type: "usage",
  111077. name: "vhs-gap-skip"
  111078. });
  111079. this.tech_.trigger({
  111080. type: "usage",
  111081. name: "hls-gap-skip"
  111082. });
  111083. };
  111084. _proto.gapFromVideoUnderflow_ = function gapFromVideoUnderflow_(buffered, currentTime) {
  111085. var gaps = findGaps(buffered);
  111086. for (var i2 = 0; i2 < gaps.length; i2++) {
  111087. var start2 = gaps.start(i2);
  111088. var end = gaps.end(i2);
  111089. if (currentTime - start2 < 4 && currentTime - start2 > 2) {
  111090. return {
  111091. start: start2,
  111092. end
  111093. };
  111094. }
  111095. }
  111096. return null;
  111097. };
  111098. return PlaybackWatcher2;
  111099. }();
  111100. var defaultOptions = {
  111101. errorInterval: 30,
  111102. getSource: function getSource(next) {
  111103. var tech = this.tech({
  111104. IWillNotUseThisInPlugins: true
  111105. });
  111106. var sourceObj = tech.currentSource_ || this.currentSource();
  111107. return next(sourceObj);
  111108. }
  111109. };
  111110. var initPlugin = function initPlugin2(player, options2) {
  111111. var lastCalled = 0;
  111112. var seekTo = 0;
  111113. var localOptions = videojs.mergeOptions(defaultOptions, options2);
  111114. player.ready(function() {
  111115. player.trigger({
  111116. type: "usage",
  111117. name: "vhs-error-reload-initialized"
  111118. });
  111119. player.trigger({
  111120. type: "usage",
  111121. name: "hls-error-reload-initialized"
  111122. });
  111123. });
  111124. var loadedMetadataHandler = function loadedMetadataHandler2() {
  111125. if (seekTo) {
  111126. player.currentTime(seekTo);
  111127. }
  111128. };
  111129. var setSource2 = function setSource3(sourceObj) {
  111130. if (sourceObj === null || sourceObj === void 0) {
  111131. return;
  111132. }
  111133. seekTo = player.duration() !== Infinity && player.currentTime() || 0;
  111134. player.one("loadedmetadata", loadedMetadataHandler);
  111135. player.src(sourceObj);
  111136. player.trigger({
  111137. type: "usage",
  111138. name: "vhs-error-reload"
  111139. });
  111140. player.trigger({
  111141. type: "usage",
  111142. name: "hls-error-reload"
  111143. });
  111144. player.play();
  111145. };
  111146. var errorHandler = function errorHandler2() {
  111147. if (Date.now() - lastCalled < localOptions.errorInterval * 1e3) {
  111148. player.trigger({
  111149. type: "usage",
  111150. name: "vhs-error-reload-canceled"
  111151. });
  111152. player.trigger({
  111153. type: "usage",
  111154. name: "hls-error-reload-canceled"
  111155. });
  111156. return;
  111157. }
  111158. if (!localOptions.getSource || typeof localOptions.getSource !== "function") {
  111159. videojs.log.error("ERROR: reloadSourceOnError - The option getSource must be a function!");
  111160. return;
  111161. }
  111162. lastCalled = Date.now();
  111163. return localOptions.getSource.call(player, setSource2);
  111164. };
  111165. var cleanupEvents = function cleanupEvents2() {
  111166. player.off("loadedmetadata", loadedMetadataHandler);
  111167. player.off("error", errorHandler);
  111168. player.off("dispose", cleanupEvents2);
  111169. };
  111170. var reinitPlugin = function reinitPlugin2(newOptions) {
  111171. cleanupEvents();
  111172. initPlugin2(player, newOptions);
  111173. };
  111174. player.on("error", errorHandler);
  111175. player.on("dispose", cleanupEvents);
  111176. player.reloadSourceOnError = reinitPlugin;
  111177. };
  111178. var reloadSourceOnError = function reloadSourceOnError2(options2) {
  111179. initPlugin(this, options2);
  111180. };
  111181. var version$4 = "2.16.2";
  111182. var version$3 = "6.0.1";
  111183. var version$2 = "0.22.1";
  111184. var version$1$1 = "4.8.0";
  111185. var version$6 = "3.1.3";
  111186. var Vhs = {
  111187. PlaylistLoader,
  111188. Playlist,
  111189. utils,
  111190. STANDARD_PLAYLIST_SELECTOR: lastBandwidthSelector,
  111191. INITIAL_PLAYLIST_SELECTOR: lowestBitrateCompatibleVariantSelector,
  111192. lastBandwidthSelector,
  111193. movingAverageBandwidthSelector,
  111194. comparePlaylistBandwidth,
  111195. comparePlaylistResolution,
  111196. xhr: xhrFactory()
  111197. };
  111198. Object.keys(Config).forEach(function(prop) {
  111199. Object.defineProperty(Vhs, prop, {
  111200. get: function get7() {
  111201. videojs.log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing");
  111202. return Config[prop];
  111203. },
  111204. set: function set4(value) {
  111205. videojs.log.warn("using Vhs." + prop + " is UNSAFE be sure you know what you are doing");
  111206. if (typeof value !== "number" || value < 0) {
  111207. videojs.log.warn("value of Vhs." + prop + " must be greater than or equal to 0");
  111208. return;
  111209. }
  111210. Config[prop] = value;
  111211. }
  111212. });
  111213. });
  111214. var LOCAL_STORAGE_KEY = "videojs-vhs";
  111215. var handleVhsMediaChange = function handleVhsMediaChange2(qualityLevels2, playlistLoader) {
  111216. var newPlaylist = playlistLoader.media();
  111217. var selectedIndex = -1;
  111218. for (var i2 = 0; i2 < qualityLevels2.length; i2++) {
  111219. if (qualityLevels2[i2].id === newPlaylist.id) {
  111220. selectedIndex = i2;
  111221. break;
  111222. }
  111223. }
  111224. qualityLevels2.selectedIndex_ = selectedIndex;
  111225. qualityLevels2.trigger({
  111226. selectedIndex,
  111227. type: "change"
  111228. });
  111229. };
  111230. var handleVhsLoadedMetadata = function handleVhsLoadedMetadata2(qualityLevels2, vhs) {
  111231. vhs.representations().forEach(function(rep2) {
  111232. qualityLevels2.addQualityLevel(rep2);
  111233. });
  111234. handleVhsMediaChange(qualityLevels2, vhs.playlists);
  111235. };
  111236. Vhs.canPlaySource = function() {
  111237. return videojs.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.");
  111238. };
  111239. var emeKeySystems = function emeKeySystems2(keySystemOptions, mainPlaylist, audioPlaylist) {
  111240. if (!keySystemOptions) {
  111241. return keySystemOptions;
  111242. }
  111243. var codecs = {};
  111244. if (mainPlaylist && mainPlaylist.attributes && mainPlaylist.attributes.CODECS) {
  111245. codecs = unwrapCodecList(parseCodecs2(mainPlaylist.attributes.CODECS));
  111246. }
  111247. if (audioPlaylist && audioPlaylist.attributes && audioPlaylist.attributes.CODECS) {
  111248. codecs.audio = audioPlaylist.attributes.CODECS;
  111249. }
  111250. var videoContentType = getMimeForCodec2(codecs.video);
  111251. var audioContentType = getMimeForCodec2(codecs.audio);
  111252. var keySystemContentTypes = {};
  111253. for (var keySystem in keySystemOptions) {
  111254. keySystemContentTypes[keySystem] = {};
  111255. if (audioContentType) {
  111256. keySystemContentTypes[keySystem].audioContentType = audioContentType;
  111257. }
  111258. if (videoContentType) {
  111259. keySystemContentTypes[keySystem].videoContentType = videoContentType;
  111260. }
  111261. if (mainPlaylist.contentProtection && mainPlaylist.contentProtection[keySystem] && mainPlaylist.contentProtection[keySystem].pssh) {
  111262. keySystemContentTypes[keySystem].pssh = mainPlaylist.contentProtection[keySystem].pssh;
  111263. }
  111264. if (typeof keySystemOptions[keySystem] === "string") {
  111265. keySystemContentTypes[keySystem].url = keySystemOptions[keySystem];
  111266. }
  111267. }
  111268. return videojs.mergeOptions(keySystemOptions, keySystemContentTypes);
  111269. };
  111270. var getAllPsshKeySystemsOptions = function getAllPsshKeySystemsOptions2(playlists, keySystems) {
  111271. return playlists.reduce(function(keySystemsArr, playlist) {
  111272. if (!playlist.contentProtection) {
  111273. return keySystemsArr;
  111274. }
  111275. var keySystemsOptions = keySystems.reduce(function(keySystemsObj, keySystem) {
  111276. var keySystemOptions = playlist.contentProtection[keySystem];
  111277. if (keySystemOptions && keySystemOptions.pssh) {
  111278. keySystemsObj[keySystem] = {
  111279. pssh: keySystemOptions.pssh
  111280. };
  111281. }
  111282. return keySystemsObj;
  111283. }, {});
  111284. if (Object.keys(keySystemsOptions).length) {
  111285. keySystemsArr.push(keySystemsOptions);
  111286. }
  111287. return keySystemsArr;
  111288. }, []);
  111289. };
  111290. var waitForKeySessionCreation = function waitForKeySessionCreation2(_ref) {
  111291. var player = _ref.player, sourceKeySystems = _ref.sourceKeySystems, audioMedia = _ref.audioMedia, mainPlaylists = _ref.mainPlaylists;
  111292. if (!player.eme.initializeMediaKeys) {
  111293. return Promise.resolve();
  111294. }
  111295. var playlists = audioMedia ? mainPlaylists.concat([audioMedia]) : mainPlaylists;
  111296. var keySystemsOptionsArr = getAllPsshKeySystemsOptions(playlists, Object.keys(sourceKeySystems));
  111297. var initializationFinishedPromises = [];
  111298. var keySessionCreatedPromises = [];
  111299. keySystemsOptionsArr.forEach(function(keySystemsOptions) {
  111300. keySessionCreatedPromises.push(new Promise(function(resolve2, reject2) {
  111301. player.tech_.one("keysessioncreated", resolve2);
  111302. }));
  111303. initializationFinishedPromises.push(new Promise(function(resolve2, reject2) {
  111304. player.eme.initializeMediaKeys({
  111305. keySystems: keySystemsOptions
  111306. }, function(err) {
  111307. if (err) {
  111308. reject2(err);
  111309. return;
  111310. }
  111311. resolve2();
  111312. });
  111313. }));
  111314. });
  111315. return Promise.race([
  111316. Promise.all(initializationFinishedPromises),
  111317. Promise.race(keySessionCreatedPromises)
  111318. ]);
  111319. };
  111320. var setupEmeOptions = function setupEmeOptions2(_ref2) {
  111321. var player = _ref2.player, sourceKeySystems = _ref2.sourceKeySystems, media = _ref2.media, audioMedia = _ref2.audioMedia;
  111322. var sourceOptions = emeKeySystems(sourceKeySystems, media, audioMedia);
  111323. if (!sourceOptions) {
  111324. return false;
  111325. }
  111326. player.currentSource().keySystems = sourceOptions;
  111327. if (sourceOptions && !player.eme) {
  111328. videojs.log.warn("DRM encrypted source cannot be decrypted without a DRM plugin");
  111329. return false;
  111330. }
  111331. return true;
  111332. };
  111333. var getVhsLocalStorage = function getVhsLocalStorage2() {
  111334. if (!window_1.localStorage) {
  111335. return null;
  111336. }
  111337. var storedObject = window_1.localStorage.getItem(LOCAL_STORAGE_KEY);
  111338. if (!storedObject) {
  111339. return null;
  111340. }
  111341. try {
  111342. return JSON.parse(storedObject);
  111343. } catch (e) {
  111344. return null;
  111345. }
  111346. };
  111347. var updateVhsLocalStorage = function updateVhsLocalStorage2(options2) {
  111348. if (!window_1.localStorage) {
  111349. return false;
  111350. }
  111351. var objectToStore = getVhsLocalStorage();
  111352. objectToStore = objectToStore ? videojs.mergeOptions(objectToStore, options2) : options2;
  111353. try {
  111354. window_1.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(objectToStore));
  111355. } catch (e) {
  111356. return false;
  111357. }
  111358. return objectToStore;
  111359. };
  111360. var expandDataUri = function expandDataUri2(dataUri) {
  111361. if (dataUri.toLowerCase().indexOf("data:application/vnd.videojs.vhs+json,") === 0) {
  111362. return JSON.parse(dataUri.substring(dataUri.indexOf(",") + 1));
  111363. }
  111364. return dataUri;
  111365. };
  111366. Vhs.supportsNativeHls = function() {
  111367. if (!document_1 || !document_1.createElement) {
  111368. return false;
  111369. }
  111370. var video = document_1.createElement("video");
  111371. if (!videojs.getTech("Html5").isSupported()) {
  111372. return false;
  111373. }
  111374. var canPlay = [
  111375. "application/vnd.apple.mpegurl",
  111376. "audio/mpegurl",
  111377. "audio/x-mpegurl",
  111378. "application/x-mpegurl",
  111379. "video/x-mpegurl",
  111380. "video/mpegurl",
  111381. "application/mpegurl"
  111382. ];
  111383. return canPlay.some(function(canItPlay) {
  111384. return /maybe|probably/i.test(video.canPlayType(canItPlay));
  111385. });
  111386. }();
  111387. Vhs.supportsNativeDash = function() {
  111388. if (!document_1 || !document_1.createElement || !videojs.getTech("Html5").isSupported()) {
  111389. return false;
  111390. }
  111391. return /maybe|probably/i.test(document_1.createElement("video").canPlayType("application/dash+xml"));
  111392. }();
  111393. Vhs.supportsTypeNatively = function(type2) {
  111394. if (type2 === "hls") {
  111395. return Vhs.supportsNativeHls;
  111396. }
  111397. if (type2 === "dash") {
  111398. return Vhs.supportsNativeDash;
  111399. }
  111400. return false;
  111401. };
  111402. Vhs.isSupported = function() {
  111403. return videojs.log.warn("HLS is no longer a tech. Please remove it from your player's techOrder.");
  111404. };
  111405. var Component = videojs.getComponent("Component");
  111406. var VhsHandler = /* @__PURE__ */ function(_Component) {
  111407. _inheritsLoose(VhsHandler2, _Component);
  111408. function VhsHandler2(source, tech, options2) {
  111409. var _this;
  111410. _this = _Component.call(this, tech, videojs.mergeOptions(options2.hls, options2.vhs)) || this;
  111411. if (options2.hls && Object.keys(options2.hls).length) {
  111412. videojs.log.warn("Using hls options is deprecated. Please rename `hls` to `vhs` in your options object.");
  111413. }
  111414. if (typeof options2.initialBandwidth === "number") {
  111415. _this.options_.bandwidth = options2.initialBandwidth;
  111416. }
  111417. _this.logger_ = logger("VhsHandler");
  111418. if (tech.options_ && tech.options_.playerId) {
  111419. var _player = videojs(tech.options_.playerId);
  111420. if (!_player.hasOwnProperty("hls")) {
  111421. Object.defineProperty(_player, "hls", {
  111422. get: function get7() {
  111423. videojs.log.warn("player.hls is deprecated. Use player.tech().vhs instead.");
  111424. tech.trigger({
  111425. type: "usage",
  111426. name: "hls-player-access"
  111427. });
  111428. return _assertThisInitialized(_this);
  111429. },
  111430. configurable: true
  111431. });
  111432. }
  111433. if (!_player.hasOwnProperty("vhs")) {
  111434. Object.defineProperty(_player, "vhs", {
  111435. get: function get7() {
  111436. videojs.log.warn("player.vhs is deprecated. Use player.tech().vhs instead.");
  111437. tech.trigger({
  111438. type: "usage",
  111439. name: "vhs-player-access"
  111440. });
  111441. return _assertThisInitialized(_this);
  111442. },
  111443. configurable: true
  111444. });
  111445. }
  111446. if (!_player.hasOwnProperty("dash")) {
  111447. Object.defineProperty(_player, "dash", {
  111448. get: function get7() {
  111449. videojs.log.warn("player.dash is deprecated. Use player.tech().vhs instead.");
  111450. return _assertThisInitialized(_this);
  111451. },
  111452. configurable: true
  111453. });
  111454. }
  111455. _this.player_ = _player;
  111456. }
  111457. _this.tech_ = tech;
  111458. _this.source_ = source;
  111459. _this.stats = {};
  111460. _this.ignoreNextSeekingEvent_ = false;
  111461. _this.setOptions_();
  111462. if (_this.options_.overrideNative && tech.overrideNativeAudioTracks && tech.overrideNativeVideoTracks) {
  111463. tech.overrideNativeAudioTracks(true);
  111464. tech.overrideNativeVideoTracks(true);
  111465. } else if (_this.options_.overrideNative && (tech.featuresNativeVideoTracks || tech.featuresNativeAudioTracks)) {
  111466. throw new Error("Overriding native HLS requires emulated tracks. See https://git.io/vMpjB");
  111467. }
  111468. _this.on(document_1, ["fullscreenchange", "webkitfullscreenchange", "mozfullscreenchange", "MSFullscreenChange"], function(event2) {
  111469. var fullscreenElement = document_1.fullscreenElement || document_1.webkitFullscreenElement || document_1.mozFullScreenElement || document_1.msFullscreenElement;
  111470. if (fullscreenElement && fullscreenElement.contains(_this.tech_.el())) {
  111471. _this.masterPlaylistController_.fastQualityChange_();
  111472. } else {
  111473. _this.masterPlaylistController_.checkABR_();
  111474. }
  111475. });
  111476. _this.on(_this.tech_, "seeking", function() {
  111477. if (this.ignoreNextSeekingEvent_) {
  111478. this.ignoreNextSeekingEvent_ = false;
  111479. return;
  111480. }
  111481. this.setCurrentTime(this.tech_.currentTime());
  111482. });
  111483. _this.on(_this.tech_, "error", function() {
  111484. if (this.tech_.error() && this.masterPlaylistController_) {
  111485. this.masterPlaylistController_.pauseLoading();
  111486. }
  111487. });
  111488. _this.on(_this.tech_, "play", _this.play);
  111489. return _this;
  111490. }
  111491. var _proto = VhsHandler2.prototype;
  111492. _proto.setOptions_ = function setOptions_() {
  111493. var _this2 = this;
  111494. this.options_.withCredentials = this.options_.withCredentials || false;
  111495. this.options_.handleManifestRedirects = this.options_.handleManifestRedirects === false ? false : true;
  111496. this.options_.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions === false ? false : true;
  111497. this.options_.useDevicePixelRatio = this.options_.useDevicePixelRatio || false;
  111498. this.options_.smoothQualityChange = this.options_.smoothQualityChange || false;
  111499. this.options_.useBandwidthFromLocalStorage = typeof this.source_.useBandwidthFromLocalStorage !== "undefined" ? this.source_.useBandwidthFromLocalStorage : this.options_.useBandwidthFromLocalStorage || false;
  111500. this.options_.useNetworkInformationApi = this.options_.useNetworkInformationApi || false;
  111501. this.options_.useDtsForTimestampOffset = this.options_.useDtsForTimestampOffset || false;
  111502. this.options_.customTagParsers = this.options_.customTagParsers || [];
  111503. this.options_.customTagMappers = this.options_.customTagMappers || [];
  111504. this.options_.cacheEncryptionKeys = this.options_.cacheEncryptionKeys || false;
  111505. if (typeof this.options_.blacklistDuration !== "number") {
  111506. this.options_.blacklistDuration = 5 * 60;
  111507. }
  111508. if (typeof this.options_.bandwidth !== "number") {
  111509. if (this.options_.useBandwidthFromLocalStorage) {
  111510. var storedObject = getVhsLocalStorage();
  111511. if (storedObject && storedObject.bandwidth) {
  111512. this.options_.bandwidth = storedObject.bandwidth;
  111513. this.tech_.trigger({
  111514. type: "usage",
  111515. name: "vhs-bandwidth-from-local-storage"
  111516. });
  111517. this.tech_.trigger({
  111518. type: "usage",
  111519. name: "hls-bandwidth-from-local-storage"
  111520. });
  111521. }
  111522. if (storedObject && storedObject.throughput) {
  111523. this.options_.throughput = storedObject.throughput;
  111524. this.tech_.trigger({
  111525. type: "usage",
  111526. name: "vhs-throughput-from-local-storage"
  111527. });
  111528. this.tech_.trigger({
  111529. type: "usage",
  111530. name: "hls-throughput-from-local-storage"
  111531. });
  111532. }
  111533. }
  111534. }
  111535. if (typeof this.options_.bandwidth !== "number") {
  111536. this.options_.bandwidth = Config.INITIAL_BANDWIDTH;
  111537. }
  111538. this.options_.enableLowInitialPlaylist = this.options_.enableLowInitialPlaylist && this.options_.bandwidth === Config.INITIAL_BANDWIDTH;
  111539. ["withCredentials", "useDevicePixelRatio", "limitRenditionByPlayerDimensions", "bandwidth", "smoothQualityChange", "customTagParsers", "customTagMappers", "handleManifestRedirects", "cacheEncryptionKeys", "playlistSelector", "initialPlaylistSelector", "experimentalBufferBasedABR", "liveRangeSafeTimeDelta", "experimentalLLHLS", "useNetworkInformationApi", "useDtsForTimestampOffset", "experimentalExactManifestTimings", "experimentalLeastPixelDiffSelector"].forEach(function(option) {
  111540. if (typeof _this2.source_[option] !== "undefined") {
  111541. _this2.options_[option] = _this2.source_[option];
  111542. }
  111543. });
  111544. this.limitRenditionByPlayerDimensions = this.options_.limitRenditionByPlayerDimensions;
  111545. this.useDevicePixelRatio = this.options_.useDevicePixelRatio;
  111546. };
  111547. _proto.src = function src(_src, type2) {
  111548. var _this3 = this;
  111549. if (!_src) {
  111550. return;
  111551. }
  111552. this.setOptions_();
  111553. this.options_.src = expandDataUri(this.source_.src);
  111554. this.options_.tech = this.tech_;
  111555. this.options_.externVhs = Vhs;
  111556. this.options_.sourceType = simpleTypeFromSourceType2(type2);
  111557. this.options_.seekTo = function(time) {
  111558. _this3.tech_.setCurrentTime(time);
  111559. };
  111560. if (this.options_.smoothQualityChange) {
  111561. videojs.log.warn("smoothQualityChange is deprecated and will be removed in the next major version");
  111562. }
  111563. this.masterPlaylistController_ = new MasterPlaylistController(this.options_);
  111564. var playbackWatcherOptions = videojs.mergeOptions({
  111565. liveRangeSafeTimeDelta: SAFE_TIME_DELTA
  111566. }, this.options_, {
  111567. seekable: function seekable3() {
  111568. return _this3.seekable();
  111569. },
  111570. media: function media() {
  111571. return _this3.masterPlaylistController_.media();
  111572. },
  111573. masterPlaylistController: this.masterPlaylistController_
  111574. });
  111575. this.playbackWatcher_ = new PlaybackWatcher(playbackWatcherOptions);
  111576. this.masterPlaylistController_.on("error", function() {
  111577. var player = videojs.players[_this3.tech_.options_.playerId];
  111578. var error = _this3.masterPlaylistController_.error;
  111579. if (typeof error === "object" && !error.code) {
  111580. error.code = 3;
  111581. } else if (typeof error === "string") {
  111582. error = {
  111583. message: error,
  111584. code: 3
  111585. };
  111586. }
  111587. player.error(error);
  111588. });
  111589. var defaultSelector = this.options_.experimentalBufferBasedABR ? Vhs.movingAverageBandwidthSelector(0.55) : Vhs.STANDARD_PLAYLIST_SELECTOR;
  111590. this.masterPlaylistController_.selectPlaylist = this.selectPlaylist ? this.selectPlaylist.bind(this) : defaultSelector.bind(this);
  111591. this.masterPlaylistController_.selectInitialPlaylist = Vhs.INITIAL_PLAYLIST_SELECTOR.bind(this);
  111592. this.playlists = this.masterPlaylistController_.masterPlaylistLoader_;
  111593. this.mediaSource = this.masterPlaylistController_.mediaSource;
  111594. Object.defineProperties(this, {
  111595. selectPlaylist: {
  111596. get: function get7() {
  111597. return this.masterPlaylistController_.selectPlaylist;
  111598. },
  111599. set: function set4(selectPlaylist) {
  111600. this.masterPlaylistController_.selectPlaylist = selectPlaylist.bind(this);
  111601. }
  111602. },
  111603. throughput: {
  111604. get: function get7() {
  111605. return this.masterPlaylistController_.mainSegmentLoader_.throughput.rate;
  111606. },
  111607. set: function set4(throughput) {
  111608. this.masterPlaylistController_.mainSegmentLoader_.throughput.rate = throughput;
  111609. this.masterPlaylistController_.mainSegmentLoader_.throughput.count = 1;
  111610. }
  111611. },
  111612. bandwidth: {
  111613. get: function get7() {
  111614. var playerBandwidthEst = this.masterPlaylistController_.mainSegmentLoader_.bandwidth;
  111615. var networkInformation = window_1.navigator.connection || window_1.navigator.mozConnection || window_1.navigator.webkitConnection;
  111616. var tenMbpsAsBitsPerSecond = 1e7;
  111617. if (this.options_.useNetworkInformationApi && networkInformation) {
  111618. var networkInfoBandwidthEstBitsPerSec = networkInformation.downlink * 1e3 * 1e3;
  111619. if (networkInfoBandwidthEstBitsPerSec >= tenMbpsAsBitsPerSecond && playerBandwidthEst >= tenMbpsAsBitsPerSecond) {
  111620. playerBandwidthEst = Math.max(playerBandwidthEst, networkInfoBandwidthEstBitsPerSec);
  111621. } else {
  111622. playerBandwidthEst = networkInfoBandwidthEstBitsPerSec;
  111623. }
  111624. }
  111625. return playerBandwidthEst;
  111626. },
  111627. set: function set4(bandwidth2) {
  111628. this.masterPlaylistController_.mainSegmentLoader_.bandwidth = bandwidth2;
  111629. this.masterPlaylistController_.mainSegmentLoader_.throughput = {
  111630. rate: 0,
  111631. count: 0
  111632. };
  111633. }
  111634. },
  111635. systemBandwidth: {
  111636. get: function get7() {
  111637. var invBandwidth = 1 / (this.bandwidth || 1);
  111638. var invThroughput;
  111639. if (this.throughput > 0) {
  111640. invThroughput = 1 / this.throughput;
  111641. } else {
  111642. invThroughput = 0;
  111643. }
  111644. var systemBitrate = Math.floor(1 / (invBandwidth + invThroughput));
  111645. return systemBitrate;
  111646. },
  111647. set: function set4() {
  111648. videojs.log.error('The "systemBandwidth" property is read-only');
  111649. }
  111650. }
  111651. });
  111652. if (this.options_.bandwidth) {
  111653. this.bandwidth = this.options_.bandwidth;
  111654. }
  111655. if (this.options_.throughput) {
  111656. this.throughput = this.options_.throughput;
  111657. }
  111658. Object.defineProperties(this.stats, {
  111659. bandwidth: {
  111660. get: function get7() {
  111661. return _this3.bandwidth || 0;
  111662. },
  111663. enumerable: true
  111664. },
  111665. mediaRequests: {
  111666. get: function get7() {
  111667. return _this3.masterPlaylistController_.mediaRequests_() || 0;
  111668. },
  111669. enumerable: true
  111670. },
  111671. mediaRequestsAborted: {
  111672. get: function get7() {
  111673. return _this3.masterPlaylistController_.mediaRequestsAborted_() || 0;
  111674. },
  111675. enumerable: true
  111676. },
  111677. mediaRequestsTimedout: {
  111678. get: function get7() {
  111679. return _this3.masterPlaylistController_.mediaRequestsTimedout_() || 0;
  111680. },
  111681. enumerable: true
  111682. },
  111683. mediaRequestsErrored: {
  111684. get: function get7() {
  111685. return _this3.masterPlaylistController_.mediaRequestsErrored_() || 0;
  111686. },
  111687. enumerable: true
  111688. },
  111689. mediaTransferDuration: {
  111690. get: function get7() {
  111691. return _this3.masterPlaylistController_.mediaTransferDuration_() || 0;
  111692. },
  111693. enumerable: true
  111694. },
  111695. mediaBytesTransferred: {
  111696. get: function get7() {
  111697. return _this3.masterPlaylistController_.mediaBytesTransferred_() || 0;
  111698. },
  111699. enumerable: true
  111700. },
  111701. mediaSecondsLoaded: {
  111702. get: function get7() {
  111703. return _this3.masterPlaylistController_.mediaSecondsLoaded_() || 0;
  111704. },
  111705. enumerable: true
  111706. },
  111707. mediaAppends: {
  111708. get: function get7() {
  111709. return _this3.masterPlaylistController_.mediaAppends_() || 0;
  111710. },
  111711. enumerable: true
  111712. },
  111713. mainAppendsToLoadedData: {
  111714. get: function get7() {
  111715. return _this3.masterPlaylistController_.mainAppendsToLoadedData_() || 0;
  111716. },
  111717. enumerable: true
  111718. },
  111719. audioAppendsToLoadedData: {
  111720. get: function get7() {
  111721. return _this3.masterPlaylistController_.audioAppendsToLoadedData_() || 0;
  111722. },
  111723. enumerable: true
  111724. },
  111725. appendsToLoadedData: {
  111726. get: function get7() {
  111727. return _this3.masterPlaylistController_.appendsToLoadedData_() || 0;
  111728. },
  111729. enumerable: true
  111730. },
  111731. timeToLoadedData: {
  111732. get: function get7() {
  111733. return _this3.masterPlaylistController_.timeToLoadedData_() || 0;
  111734. },
  111735. enumerable: true
  111736. },
  111737. buffered: {
  111738. get: function get7() {
  111739. return timeRangesToArray(_this3.tech_.buffered());
  111740. },
  111741. enumerable: true
  111742. },
  111743. currentTime: {
  111744. get: function get7() {
  111745. return _this3.tech_.currentTime();
  111746. },
  111747. enumerable: true
  111748. },
  111749. currentSource: {
  111750. get: function get7() {
  111751. return _this3.tech_.currentSource_;
  111752. },
  111753. enumerable: true
  111754. },
  111755. currentTech: {
  111756. get: function get7() {
  111757. return _this3.tech_.name_;
  111758. },
  111759. enumerable: true
  111760. },
  111761. duration: {
  111762. get: function get7() {
  111763. return _this3.tech_.duration();
  111764. },
  111765. enumerable: true
  111766. },
  111767. master: {
  111768. get: function get7() {
  111769. return _this3.playlists.master;
  111770. },
  111771. enumerable: true
  111772. },
  111773. playerDimensions: {
  111774. get: function get7() {
  111775. return _this3.tech_.currentDimensions();
  111776. },
  111777. enumerable: true
  111778. },
  111779. seekable: {
  111780. get: function get7() {
  111781. return timeRangesToArray(_this3.tech_.seekable());
  111782. },
  111783. enumerable: true
  111784. },
  111785. timestamp: {
  111786. get: function get7() {
  111787. return Date.now();
  111788. },
  111789. enumerable: true
  111790. },
  111791. videoPlaybackQuality: {
  111792. get: function get7() {
  111793. return _this3.tech_.getVideoPlaybackQuality();
  111794. },
  111795. enumerable: true
  111796. }
  111797. });
  111798. this.tech_.one("canplay", this.masterPlaylistController_.setupFirstPlay.bind(this.masterPlaylistController_));
  111799. this.tech_.on("bandwidthupdate", function() {
  111800. if (_this3.options_.useBandwidthFromLocalStorage) {
  111801. updateVhsLocalStorage({
  111802. bandwidth: _this3.bandwidth,
  111803. throughput: Math.round(_this3.throughput)
  111804. });
  111805. }
  111806. });
  111807. this.masterPlaylistController_.on("selectedinitialmedia", function() {
  111808. renditionSelectionMixin(_this3);
  111809. });
  111810. this.masterPlaylistController_.sourceUpdater_.on("createdsourcebuffers", function() {
  111811. _this3.setupEme_();
  111812. });
  111813. this.on(this.masterPlaylistController_, "progress", function() {
  111814. this.tech_.trigger("progress");
  111815. });
  111816. this.on(this.masterPlaylistController_, "firstplay", function() {
  111817. this.ignoreNextSeekingEvent_ = true;
  111818. });
  111819. this.setupQualityLevels_();
  111820. if (!this.tech_.el()) {
  111821. return;
  111822. }
  111823. this.mediaSourceUrl_ = window_1.URL.createObjectURL(this.masterPlaylistController_.mediaSource);
  111824. this.tech_.src(this.mediaSourceUrl_);
  111825. };
  111826. _proto.createKeySessions_ = function createKeySessions_() {
  111827. var _this4 = this;
  111828. var audioPlaylistLoader = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;
  111829. this.logger_("waiting for EME key session creation");
  111830. waitForKeySessionCreation({
  111831. player: this.player_,
  111832. sourceKeySystems: this.source_.keySystems,
  111833. audioMedia: audioPlaylistLoader && audioPlaylistLoader.media(),
  111834. mainPlaylists: this.playlists.master.playlists
  111835. }).then(function() {
  111836. _this4.logger_("created EME key session");
  111837. _this4.masterPlaylistController_.sourceUpdater_.initializedEme();
  111838. })["catch"](function(err) {
  111839. _this4.logger_("error while creating EME key session", err);
  111840. _this4.player_.error({
  111841. message: "Failed to initialize media keys for EME",
  111842. code: 3
  111843. });
  111844. });
  111845. };
  111846. _proto.handleWaitingForKey_ = function handleWaitingForKey_() {
  111847. this.logger_("waitingforkey fired, attempting to create any new key sessions");
  111848. this.createKeySessions_();
  111849. };
  111850. _proto.setupEme_ = function setupEme_() {
  111851. var _this5 = this;
  111852. var audioPlaylistLoader = this.masterPlaylistController_.mediaTypes_.AUDIO.activePlaylistLoader;
  111853. var didSetupEmeOptions = setupEmeOptions({
  111854. player: this.player_,
  111855. sourceKeySystems: this.source_.keySystems,
  111856. media: this.playlists.media(),
  111857. audioMedia: audioPlaylistLoader && audioPlaylistLoader.media()
  111858. });
  111859. this.player_.tech_.on("keystatuschange", function(e) {
  111860. if (e.status !== "output-restricted") {
  111861. return;
  111862. }
  111863. var masterPlaylist = _this5.masterPlaylistController_.master();
  111864. if (!masterPlaylist || !masterPlaylist.playlists) {
  111865. return;
  111866. }
  111867. var excludedHDPlaylists = [];
  111868. masterPlaylist.playlists.forEach(function(playlist) {
  111869. if (playlist && playlist.attributes && playlist.attributes.RESOLUTION && playlist.attributes.RESOLUTION.height >= 720) {
  111870. if (!playlist.excludeUntil || playlist.excludeUntil < Infinity) {
  111871. playlist.excludeUntil = Infinity;
  111872. excludedHDPlaylists.push(playlist);
  111873. }
  111874. }
  111875. });
  111876. if (excludedHDPlaylists.length) {
  111877. var _videojs$log;
  111878. (_videojs$log = videojs.log).warn.apply(_videojs$log, ['DRM keystatus changed to "output-restricted." Removing the following HD playlists that will most likely fail to play and clearing the buffer. This may be due to HDCP restrictions on the stream and the capabilities of the current device.'].concat(excludedHDPlaylists));
  111879. _this5.masterPlaylistController_.fastQualityChange_();
  111880. }
  111881. });
  111882. this.handleWaitingForKey_ = this.handleWaitingForKey_.bind(this);
  111883. this.player_.tech_.on("waitingforkey", this.handleWaitingForKey_);
  111884. if (videojs.browser.IE_VERSION === 11 || !didSetupEmeOptions) {
  111885. this.masterPlaylistController_.sourceUpdater_.initializedEme();
  111886. return;
  111887. }
  111888. this.createKeySessions_();
  111889. };
  111890. _proto.setupQualityLevels_ = function setupQualityLevels_() {
  111891. var _this6 = this;
  111892. var player = videojs.players[this.tech_.options_.playerId];
  111893. if (!player || !player.qualityLevels || this.qualityLevels_) {
  111894. return;
  111895. }
  111896. this.qualityLevels_ = player.qualityLevels();
  111897. this.masterPlaylistController_.on("selectedinitialmedia", function() {
  111898. handleVhsLoadedMetadata(_this6.qualityLevels_, _this6);
  111899. });
  111900. this.playlists.on("mediachange", function() {
  111901. handleVhsMediaChange(_this6.qualityLevels_, _this6.playlists);
  111902. });
  111903. };
  111904. VhsHandler2.version = function version$52() {
  111905. return {
  111906. "@videojs/http-streaming": version$4,
  111907. "mux.js": version$3,
  111908. "mpd-parser": version$2,
  111909. "m3u8-parser": version$1$1,
  111910. "aes-decrypter": version$6
  111911. };
  111912. };
  111913. _proto.version = function version2() {
  111914. return this.constructor.version();
  111915. };
  111916. _proto.canChangeType = function canChangeType() {
  111917. return SourceUpdater.canChangeType();
  111918. };
  111919. _proto.play = function play() {
  111920. this.masterPlaylistController_.play();
  111921. };
  111922. _proto.setCurrentTime = function setCurrentTime(currentTime) {
  111923. this.masterPlaylistController_.setCurrentTime(currentTime);
  111924. };
  111925. _proto.duration = function duration5() {
  111926. return this.masterPlaylistController_.duration();
  111927. };
  111928. _proto.seekable = function seekable3() {
  111929. return this.masterPlaylistController_.seekable();
  111930. };
  111931. _proto.dispose = function dispose() {
  111932. if (this.playbackWatcher_) {
  111933. this.playbackWatcher_.dispose();
  111934. }
  111935. if (this.masterPlaylistController_) {
  111936. this.masterPlaylistController_.dispose();
  111937. }
  111938. if (this.qualityLevels_) {
  111939. this.qualityLevels_.dispose();
  111940. }
  111941. if (this.player_) {
  111942. delete this.player_.vhs;
  111943. delete this.player_.dash;
  111944. delete this.player_.hls;
  111945. }
  111946. if (this.tech_ && this.tech_.vhs) {
  111947. delete this.tech_.vhs;
  111948. }
  111949. if (this.tech_) {
  111950. delete this.tech_.hls;
  111951. }
  111952. if (this.mediaSourceUrl_ && window_1.URL.revokeObjectURL) {
  111953. window_1.URL.revokeObjectURL(this.mediaSourceUrl_);
  111954. this.mediaSourceUrl_ = null;
  111955. }
  111956. if (this.tech_) {
  111957. this.tech_.off("waitingforkey", this.handleWaitingForKey_);
  111958. }
  111959. _Component.prototype.dispose.call(this);
  111960. };
  111961. _proto.convertToProgramTime = function convertToProgramTime(time, callback2) {
  111962. return getProgramTime({
  111963. playlist: this.masterPlaylistController_.media(),
  111964. time,
  111965. callback: callback2
  111966. });
  111967. };
  111968. _proto.seekToProgramTime = function seekToProgramTime$12(programTime, callback2, pauseAfterSeek, retryCount) {
  111969. if (pauseAfterSeek === void 0) {
  111970. pauseAfterSeek = true;
  111971. }
  111972. if (retryCount === void 0) {
  111973. retryCount = 2;
  111974. }
  111975. return seekToProgramTime({
  111976. programTime,
  111977. playlist: this.masterPlaylistController_.media(),
  111978. retryCount,
  111979. pauseAfterSeek,
  111980. seekTo: this.options_.seekTo,
  111981. tech: this.options_.tech,
  111982. callback: callback2
  111983. });
  111984. };
  111985. return VhsHandler2;
  111986. }(Component);
  111987. var VhsSourceHandler = {
  111988. name: "videojs-http-streaming",
  111989. VERSION: version$4,
  111990. canHandleSource: function canHandleSource(srcObj, options2) {
  111991. if (options2 === void 0) {
  111992. options2 = {};
  111993. }
  111994. var localOptions = videojs.mergeOptions(videojs.options, options2);
  111995. return VhsSourceHandler.canPlayType(srcObj.type, localOptions);
  111996. },
  111997. handleSource: function handleSource(source, tech, options2) {
  111998. if (options2 === void 0) {
  111999. options2 = {};
  112000. }
  112001. var localOptions = videojs.mergeOptions(videojs.options, options2);
  112002. tech.vhs = new VhsHandler(source, tech, localOptions);
  112003. if (!videojs.hasOwnProperty("hls")) {
  112004. Object.defineProperty(tech, "hls", {
  112005. get: function get7() {
  112006. videojs.log.warn("player.tech().hls is deprecated. Use player.tech().vhs instead.");
  112007. return tech.vhs;
  112008. },
  112009. configurable: true
  112010. });
  112011. }
  112012. tech.vhs.xhr = xhrFactory();
  112013. tech.vhs.src(source.src, source.type);
  112014. return tech.vhs;
  112015. },
  112016. canPlayType: function canPlayType2(type2, options2) {
  112017. var simpleType = simpleTypeFromSourceType2(type2);
  112018. if (!simpleType) {
  112019. return "";
  112020. }
  112021. var overrideNative = VhsSourceHandler.getOverrideNative(options2);
  112022. var supportsTypeNatively = Vhs.supportsTypeNatively(simpleType);
  112023. var canUseMsePlayback = !supportsTypeNatively || overrideNative;
  112024. return canUseMsePlayback ? "maybe" : "";
  112025. },
  112026. getOverrideNative: function getOverrideNative(options2) {
  112027. if (options2 === void 0) {
  112028. options2 = {};
  112029. }
  112030. var _options = options2, _options$vhs = _options.vhs, vhs = _options$vhs === void 0 ? {} : _options$vhs, _options$hls = _options.hls, hls = _options$hls === void 0 ? {} : _options$hls;
  112031. var defaultOverrideNative = !(videojs.browser.IS_ANY_SAFARI || videojs.browser.IS_IOS);
  112032. var _vhs$overrideNative = vhs.overrideNative, overrideNative = _vhs$overrideNative === void 0 ? defaultOverrideNative : _vhs$overrideNative;
  112033. var _hls$overrideNative = hls.overrideNative, legacyOverrideNative = _hls$overrideNative === void 0 ? false : _hls$overrideNative;
  112034. return legacyOverrideNative || overrideNative;
  112035. }
  112036. };
  112037. var supportsNativeMediaSources = function supportsNativeMediaSources2() {
  112038. return browserSupportsCodec2("avc1.4d400d,mp4a.40.2");
  112039. };
  112040. if (supportsNativeMediaSources()) {
  112041. videojs.getTech("Html5").registerSourceHandler(VhsSourceHandler, 0);
  112042. }
  112043. videojs.VhsHandler = VhsHandler;
  112044. Object.defineProperty(videojs, "HlsHandler", {
  112045. get: function get4() {
  112046. videojs.log.warn("videojs.HlsHandler is deprecated. Use videojs.VhsHandler instead.");
  112047. return VhsHandler;
  112048. },
  112049. configurable: true
  112050. });
  112051. videojs.VhsSourceHandler = VhsSourceHandler;
  112052. Object.defineProperty(videojs, "HlsSourceHandler", {
  112053. get: function get5() {
  112054. videojs.log.warn("videojs.HlsSourceHandler is deprecated. Use videojs.VhsSourceHandler instead.");
  112055. return VhsSourceHandler;
  112056. },
  112057. configurable: true
  112058. });
  112059. videojs.Vhs = Vhs;
  112060. Object.defineProperty(videojs, "Hls", {
  112061. get: function get6() {
  112062. videojs.log.warn("videojs.Hls is deprecated. Use videojs.Vhs instead.");
  112063. return Vhs;
  112064. },
  112065. configurable: true
  112066. });
  112067. if (!videojs.use) {
  112068. videojs.registerComponent("Hls", Vhs);
  112069. videojs.registerComponent("Vhs", Vhs);
  112070. }
  112071. videojs.options.vhs = videojs.options.vhs || {};
  112072. videojs.options.hls = videojs.options.hls || {};
  112073. if (!videojs.getPlugin || !videojs.getPlugin("reloadSourceOnError")) {
  112074. var registerPlugin = videojs.registerPlugin || videojs.plugin;
  112075. registerPlugin("reloadSourceOnError", reloadSourceOnError);
  112076. }
  112077. const version = "5.4.2";
  112078. var version$1 = "2.2.1";
  112079. function FlashRtmpDecorator(Flash2) {
  112080. Flash2.streamingFormats = {
  112081. "rtmp/mp4": "MP4",
  112082. "rtmp/flv": "FLV"
  112083. };
  112084. Flash2.streamFromParts = function(connection, stream) {
  112085. return connection + "&" + stream;
  112086. };
  112087. Flash2.streamToParts = function(src) {
  112088. var parts = {
  112089. connection: "",
  112090. stream: ""
  112091. };
  112092. if (!src) {
  112093. return parts;
  112094. }
  112095. var connEnd = src.search(/&(?![\w-]+=)/);
  112096. var streamBegin = void 0;
  112097. if (connEnd !== -1) {
  112098. streamBegin = connEnd + 1;
  112099. } else {
  112100. connEnd = streamBegin = src.lastIndexOf("/") + 1;
  112101. if (connEnd === 0) {
  112102. connEnd = streamBegin = src.length;
  112103. }
  112104. }
  112105. parts.connection = src.substring(0, connEnd);
  112106. parts.stream = src.substring(streamBegin, src.length);
  112107. return parts;
  112108. };
  112109. Flash2.isStreamingType = function(srcType) {
  112110. return srcType in Flash2.streamingFormats;
  112111. };
  112112. Flash2.RTMP_RE = /^rtmp[set]?:\/\//i;
  112113. Flash2.isStreamingSrc = function(src) {
  112114. return Flash2.RTMP_RE.test(src);
  112115. };
  112116. Flash2.rtmpSourceHandler = {};
  112117. Flash2.rtmpSourceHandler.canPlayType = function(type2) {
  112118. if (Flash2.isStreamingType(type2)) {
  112119. return "maybe";
  112120. }
  112121. return "";
  112122. };
  112123. Flash2.rtmpSourceHandler.canHandleSource = function(source, options2) {
  112124. var can = Flash2.rtmpSourceHandler.canPlayType(source.type);
  112125. if (can) {
  112126. return can;
  112127. }
  112128. if (Flash2.isStreamingSrc(source.src)) {
  112129. return "maybe";
  112130. }
  112131. return "";
  112132. };
  112133. Flash2.rtmpSourceHandler.handleSource = function(source, tech, options2) {
  112134. var srcParts = Flash2.streamToParts(source.src);
  112135. tech.setRtmpConnection(srcParts.connection);
  112136. tech.setRtmpStream(srcParts.stream);
  112137. };
  112138. Flash2.registerSourceHandler(Flash2.rtmpSourceHandler);
  112139. return Flash2;
  112140. }
  112141. var classCallCheck = function(instance, Constructor) {
  112142. if (!(instance instanceof Constructor)) {
  112143. throw new TypeError("Cannot call a class as a function");
  112144. }
  112145. };
  112146. var inherits = function(subClass, superClass) {
  112147. if (typeof superClass !== "function" && superClass !== null) {
  112148. throw new TypeError("Super expression must either be null or a function, not " + typeof superClass);
  112149. }
  112150. subClass.prototype = Object.create(superClass && superClass.prototype, {
  112151. constructor: {
  112152. value: subClass,
  112153. enumerable: false,
  112154. writable: true,
  112155. configurable: true
  112156. }
  112157. });
  112158. if (superClass)
  112159. Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass;
  112160. };
  112161. var possibleConstructorReturn = function(self2, call) {
  112162. if (!self2) {
  112163. throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
  112164. }
  112165. return call && (typeof call === "object" || typeof call === "function") ? call : self2;
  112166. };
  112167. var Tech = videojs.getComponent("Tech");
  112168. var Dom = videojs.dom;
  112169. var Url = videojs.url;
  112170. var createTimeRange = videojs.createTimeRange;
  112171. var mergeOptions$1 = videojs.mergeOptions;
  112172. var navigator$1 = window_1 && window_1.navigator || {};
  112173. var Flash = function(_Tech) {
  112174. inherits(Flash2, _Tech);
  112175. function Flash2(options2, ready) {
  112176. classCallCheck(this, Flash2);
  112177. var _this = possibleConstructorReturn(this, _Tech.call(this, options2, ready));
  112178. if (options2.source) {
  112179. _this.ready(function() {
  112180. this.setSource(options2.source);
  112181. }, true);
  112182. }
  112183. if (options2.startTime) {
  112184. _this.ready(function() {
  112185. this.load();
  112186. this.play();
  112187. this.currentTime(options2.startTime);
  112188. }, true);
  112189. }
  112190. window_1.videojs = window_1.videojs || {};
  112191. window_1.videojs.Flash = window_1.videojs.Flash || {};
  112192. window_1.videojs.Flash.onReady = Flash2.onReady;
  112193. window_1.videojs.Flash.onEvent = Flash2.onEvent;
  112194. window_1.videojs.Flash.onError = Flash2.onError;
  112195. _this.on("seeked", function() {
  112196. this.lastSeekTarget_ = void 0;
  112197. });
  112198. return _this;
  112199. }
  112200. Flash2.prototype.createEl = function createEl2() {
  112201. var options2 = this.options_;
  112202. if (!options2.swf) {
  112203. options2.swf = "https://vjs.zencdn.net/swf/" + version + "/video-js.swf";
  112204. }
  112205. var objId = options2.techId;
  112206. var flashVars = mergeOptions$1({
  112207. readyFunction: "videojs.Flash.onReady",
  112208. eventProxyFunction: "videojs.Flash.onEvent",
  112209. errorEventProxyFunction: "videojs.Flash.onError",
  112210. autoplay: options2.autoplay,
  112211. preload: options2.preload,
  112212. loop: options2.loop,
  112213. muted: options2.muted
  112214. }, options2.flashVars);
  112215. var params = mergeOptions$1({
  112216. wmode: "opaque",
  112217. bgcolor: "#000000"
  112218. }, options2.params);
  112219. var attributes = mergeOptions$1({
  112220. id: objId,
  112221. name: objId,
  112222. "class": "vjs-tech"
  112223. }, options2.attributes);
  112224. this.el_ = Flash2.embed(options2.swf, flashVars, params, attributes);
  112225. this.el_.tech = this;
  112226. return this.el_;
  112227. };
  112228. Flash2.prototype.play = function play() {
  112229. if (this.ended()) {
  112230. this.setCurrentTime(0);
  112231. }
  112232. this.el_.vjs_play();
  112233. };
  112234. Flash2.prototype.pause = function pause() {
  112235. this.el_.vjs_pause();
  112236. };
  112237. Flash2.prototype.src = function src(_src) {
  112238. if (_src === void 0) {
  112239. return this.currentSrc();
  112240. }
  112241. return this.setSrc(_src);
  112242. };
  112243. Flash2.prototype.setSrc = function setSrc(src) {
  112244. var _this2 = this;
  112245. src = Url.getAbsoluteURL(src);
  112246. this.el_.vjs_src(src);
  112247. if (this.autoplay()) {
  112248. this.setTimeout(function() {
  112249. return _this2.play();
  112250. }, 0);
  112251. }
  112252. };
  112253. Flash2.prototype.seeking = function seeking() {
  112254. return this.lastSeekTarget_ !== void 0;
  112255. };
  112256. Flash2.prototype.setCurrentTime = function setCurrentTime(time) {
  112257. var seekable3 = this.seekable();
  112258. if (seekable3.length) {
  112259. time = time > seekable3.start(0) ? time : seekable3.start(0);
  112260. time = time < seekable3.end(seekable3.length - 1) ? time : seekable3.end(seekable3.length - 1);
  112261. this.lastSeekTarget_ = time;
  112262. this.trigger("seeking");
  112263. this.el_.vjs_setProperty("currentTime", time);
  112264. _Tech.prototype.setCurrentTime.call(this);
  112265. }
  112266. };
  112267. Flash2.prototype.currentTime = function currentTime() {
  112268. if (this.seeking()) {
  112269. return this.lastSeekTarget_ || 0;
  112270. }
  112271. return this.el_.vjs_getProperty("currentTime");
  112272. };
  112273. Flash2.prototype.currentSrc = function currentSrc() {
  112274. if (this.currentSource_) {
  112275. return this.currentSource_.src;
  112276. }
  112277. return this.el_.vjs_getProperty("currentSrc");
  112278. };
  112279. Flash2.prototype.duration = function duration5() {
  112280. if (this.readyState() === 0) {
  112281. return NaN;
  112282. }
  112283. var duration6 = this.el_.vjs_getProperty("duration");
  112284. return duration6 >= 0 ? duration6 : Infinity;
  112285. };
  112286. Flash2.prototype.load = function load() {
  112287. this.el_.vjs_load();
  112288. };
  112289. Flash2.prototype.poster = function poster() {
  112290. this.el_.vjs_getProperty("poster");
  112291. };
  112292. Flash2.prototype.setPoster = function setPoster() {
  112293. };
  112294. Flash2.prototype.seekable = function seekable3() {
  112295. var duration5 = this.duration();
  112296. if (duration5 === 0) {
  112297. return createTimeRange();
  112298. }
  112299. return createTimeRange(0, duration5);
  112300. };
  112301. Flash2.prototype.buffered = function buffered() {
  112302. var ranges = this.el_.vjs_getProperty("buffered");
  112303. if (ranges.length === 0) {
  112304. return createTimeRange();
  112305. }
  112306. return createTimeRange(ranges[0][0], ranges[0][1]);
  112307. };
  112308. Flash2.prototype.supportsFullScreen = function supportsFullScreen() {
  112309. return false;
  112310. };
  112311. Flash2.prototype.enterFullScreen = function enterFullScreen() {
  112312. return false;
  112313. };
  112314. Flash2.prototype.getVideoPlaybackQuality = function getVideoPlaybackQuality() {
  112315. var videoPlaybackQuality = this.el_.vjs_getProperty("getVideoPlaybackQuality");
  112316. if (window_1.performance && typeof window_1.performance.now === "function") {
  112317. videoPlaybackQuality.creationTime = window_1.performance.now();
  112318. } else if (window_1.performance && window_1.performance.timing && typeof window_1.performance.timing.navigationStart === "number") {
  112319. videoPlaybackQuality.creationTime = window_1.Date.now() - window_1.performance.timing.navigationStart;
  112320. }
  112321. return videoPlaybackQuality;
  112322. };
  112323. return Flash2;
  112324. }(Tech);
  112325. var _readWrite = ["rtmpConnection", "rtmpStream", "preload", "defaultPlaybackRate", "playbackRate", "autoplay", "loop", "controls", "volume", "muted", "defaultMuted"];
  112326. var _readOnly = ["networkState", "readyState", "initialTime", "startOffsetTime", "paused", "ended", "videoWidth", "videoHeight"];
  112327. var _api = Flash.prototype;
  112328. function _createSetter(attr) {
  112329. var attrUpper = attr.charAt(0).toUpperCase() + attr.slice(1);
  112330. _api["set" + attrUpper] = function(val) {
  112331. return this.el_.vjs_setProperty(attr, val);
  112332. };
  112333. }
  112334. function _createGetter(attr) {
  112335. _api[attr] = function() {
  112336. return this.el_.vjs_getProperty(attr);
  112337. };
  112338. }
  112339. for (var i$1 = 0; i$1 < _readWrite.length; i$1++) {
  112340. _createGetter(_readWrite[i$1]);
  112341. _createSetter(_readWrite[i$1]);
  112342. }
  112343. for (var _i = 0; _i < _readOnly.length; _i++) {
  112344. _createGetter(_readOnly[_i]);
  112345. }
  112346. Flash.isSupported = function() {
  112347. if (videojs.browser.IS_CHROME && (!videojs.browser.IS_ANDROID || !videojs.browser.IS_IOS) || videojs.browser.IS_SAFARI && !videojs.browser.IS_IOS || videojs.browser.IS_EDGE) {
  112348. return true;
  112349. }
  112350. return Flash.version()[0] >= 10;
  112351. };
  112352. Tech.withSourceHandlers(Flash);
  112353. Flash.nativeSourceHandler = {};
  112354. Flash.nativeSourceHandler.canPlayType = function(type2) {
  112355. if (type2 in Flash.formats) {
  112356. return "maybe";
  112357. }
  112358. return "";
  112359. };
  112360. Flash.nativeSourceHandler.canHandleSource = function(source, options2) {
  112361. var type2 = void 0;
  112362. function guessMimeType(src) {
  112363. var ext = Url.getFileExtension(src);
  112364. if (ext) {
  112365. return "video/" + ext;
  112366. }
  112367. return "";
  112368. }
  112369. if (!source.type) {
  112370. type2 = guessMimeType(source.src);
  112371. } else {
  112372. type2 = source.type.replace(/;.*/, "").toLowerCase();
  112373. }
  112374. return Flash.nativeSourceHandler.canPlayType(type2);
  112375. };
  112376. Flash.nativeSourceHandler.handleSource = function(source, tech, options2) {
  112377. tech.setSrc(source.src);
  112378. };
  112379. Flash.nativeSourceHandler.dispose = function() {
  112380. };
  112381. Flash.registerSourceHandler(Flash.nativeSourceHandler);
  112382. Flash.formats = {
  112383. "video/flv": "FLV",
  112384. "video/x-flv": "FLV",
  112385. "video/mp4": "MP4",
  112386. "video/m4v": "MP4"
  112387. };
  112388. Flash.onReady = function(currSwf) {
  112389. var el = Dom.$("#" + currSwf);
  112390. var tech = el && el.tech;
  112391. if (tech && tech.el()) {
  112392. Flash.checkReady(tech);
  112393. }
  112394. };
  112395. Flash.checkReady = function(tech) {
  112396. if (!tech.el()) {
  112397. return;
  112398. }
  112399. if (tech.el().vjs_getProperty) {
  112400. tech.triggerReady();
  112401. } else {
  112402. this.setTimeout(function() {
  112403. Flash.checkReady(tech);
  112404. }, 50);
  112405. }
  112406. };
  112407. Flash.onEvent = function(swfID, eventName) {
  112408. var tech = Dom.$("#" + swfID).tech;
  112409. var args = Array.prototype.slice.call(arguments, 2);
  112410. tech.setTimeout(function() {
  112411. tech.trigger(eventName, args);
  112412. }, 1);
  112413. };
  112414. Flash.onError = function(swfID, err) {
  112415. var tech = Dom.$("#" + swfID).tech;
  112416. if (err === "srcnotfound") {
  112417. return tech.error(4);
  112418. }
  112419. if (typeof err === "string") {
  112420. tech.error("FLASH: " + err);
  112421. } else {
  112422. err.origin = "flash";
  112423. tech.error(err);
  112424. }
  112425. };
  112426. Flash.version = function() {
  112427. var version$$1 = "0,0,0";
  112428. try {
  112429. version$$1 = new window_1.ActiveXObject("ShockwaveFlash.ShockwaveFlash").GetVariable("$version").replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
  112430. } catch (e) {
  112431. try {
  112432. if (navigator$1.mimeTypes["application/x-shockwave-flash"].enabledPlugin) {
  112433. version$$1 = (navigator$1.plugins["Shockwave Flash 2.0"] || navigator$1.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
  112434. }
  112435. } catch (err) {
  112436. }
  112437. }
  112438. return version$$1.split(",");
  112439. };
  112440. Flash.embed = function(swf, flashVars, params, attributes) {
  112441. var code = Flash.getEmbedCode(swf, flashVars, params, attributes);
  112442. var obj = Dom.createEl("div", { innerHTML: code }).childNodes[0];
  112443. return obj;
  112444. };
  112445. Flash.getEmbedCode = function(swf, flashVars, params, attributes) {
  112446. var objTag = '<object type="application/x-shockwave-flash" ';
  112447. var flashVarsString = "";
  112448. var paramsString = "";
  112449. var attrsString = "";
  112450. if (flashVars) {
  112451. Object.getOwnPropertyNames(flashVars).forEach(function(key) {
  112452. flashVarsString += key + "=" + flashVars[key] + "&amp;";
  112453. });
  112454. }
  112455. params = mergeOptions$1({
  112456. movie: swf,
  112457. flashvars: flashVarsString,
  112458. allowScriptAccess: "always",
  112459. allowNetworking: "all"
  112460. }, params);
  112461. Object.getOwnPropertyNames(params).forEach(function(key) {
  112462. paramsString += '<param name="' + key + '" value="' + params[key] + '" />';
  112463. });
  112464. attributes = mergeOptions$1({
  112465. data: swf,
  112466. width: "100%",
  112467. height: "100%"
  112468. }, attributes);
  112469. Object.getOwnPropertyNames(attributes).forEach(function(key) {
  112470. attrsString += key + '="' + attributes[key] + '" ';
  112471. });
  112472. return "" + objTag + attrsString + ">" + paramsString + "</object>";
  112473. };
  112474. FlashRtmpDecorator(Flash);
  112475. if (Tech.getTech("Flash")) {
  112476. videojs.log.warn("Not using videojs-flash as it appears to already be registered");
  112477. videojs.log.warn("videojs-flash should only be used with video.js@6 and above");
  112478. } else {
  112479. videojs.registerTech("Flash", Flash);
  112480. }
  112481. Flash.VERSION = version$1;
  112482. var flv = { exports: {} };
  112483. (function(module2, exports2) {
  112484. (function webpackUniversalModuleDefinition(root2, factory3) {
  112485. module2.exports = factory3();
  112486. })(self, function() {
  112487. return function() {
  112488. var __webpack_modules__ = {
  112489. "./node_modules/es6-promise/dist/es6-promise.js": function(module3, __unused_webpack_exports, __webpack_require__2) {
  112490. /*!
  112491. * @overview es6-promise - a tiny implementation of Promises/A+.
  112492. * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald)
  112493. * @license Licensed under MIT license
  112494. * See https://raw.githubusercontent.com/stefanpenner/es6-promise/master/LICENSE
  112495. * @version v4.2.8+1e68dce6
  112496. */
  112497. (function(global2, factory3) {
  112498. module3.exports = factory3();
  112499. })(this, function() {
  112500. function objectOrFunction(x) {
  112501. var type2 = typeof x;
  112502. return x !== null && (type2 === "object" || type2 === "function");
  112503. }
  112504. function isFunction2(x) {
  112505. return typeof x === "function";
  112506. }
  112507. var _isArray = void 0;
  112508. if (Array.isArray) {
  112509. _isArray = Array.isArray;
  112510. } else {
  112511. _isArray = function(x) {
  112512. return Object.prototype.toString.call(x) === "[object Array]";
  112513. };
  112514. }
  112515. var isArray2 = _isArray;
  112516. var len = 0;
  112517. var vertxNext = void 0;
  112518. var customSchedulerFn = void 0;
  112519. var asap = function asap2(callback2, arg) {
  112520. queue[len] = callback2;
  112521. queue[len + 1] = arg;
  112522. len += 2;
  112523. if (len === 2) {
  112524. if (customSchedulerFn) {
  112525. customSchedulerFn(flush);
  112526. } else {
  112527. scheduleFlush();
  112528. }
  112529. }
  112530. };
  112531. function setScheduler(scheduleFn) {
  112532. customSchedulerFn = scheduleFn;
  112533. }
  112534. function setAsap(asapFn) {
  112535. asap = asapFn;
  112536. }
  112537. var browserWindow = typeof window !== "undefined" ? window : void 0;
  112538. var browserGlobal = browserWindow || {};
  112539. var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver;
  112540. var isNode = typeof self === "undefined" && typeof process !== "undefined" && {}.toString.call(process) === "[object process]";
  112541. var isWorker = typeof Uint8ClampedArray !== "undefined" && typeof importScripts !== "undefined" && typeof MessageChannel !== "undefined";
  112542. function useNextTick() {
  112543. return function() {
  112544. return process.nextTick(flush);
  112545. };
  112546. }
  112547. function useVertxTimer() {
  112548. if (typeof vertxNext !== "undefined") {
  112549. return function() {
  112550. vertxNext(flush);
  112551. };
  112552. }
  112553. return useSetTimeout();
  112554. }
  112555. function useMutationObserver() {
  112556. var iterations = 0;
  112557. var observer = new BrowserMutationObserver(flush);
  112558. var node = document.createTextNode("");
  112559. observer.observe(node, { characterData: true });
  112560. return function() {
  112561. node.data = iterations = ++iterations % 2;
  112562. };
  112563. }
  112564. function useMessageChannel() {
  112565. var channel = new MessageChannel();
  112566. channel.port1.onmessage = flush;
  112567. return function() {
  112568. return channel.port2.postMessage(0);
  112569. };
  112570. }
  112571. function useSetTimeout() {
  112572. var globalSetTimeout = setTimeout;
  112573. return function() {
  112574. return globalSetTimeout(flush, 1);
  112575. };
  112576. }
  112577. var queue = new Array(1e3);
  112578. function flush() {
  112579. for (var i2 = 0; i2 < len; i2 += 2) {
  112580. var callback2 = queue[i2];
  112581. var arg = queue[i2 + 1];
  112582. callback2(arg);
  112583. queue[i2] = void 0;
  112584. queue[i2 + 1] = void 0;
  112585. }
  112586. len = 0;
  112587. }
  112588. function attemptVertx() {
  112589. try {
  112590. var vertx = Function("return this")().require("vertx");
  112591. vertxNext = vertx.runOnLoop || vertx.runOnContext;
  112592. return useVertxTimer();
  112593. } catch (e) {
  112594. return useSetTimeout();
  112595. }
  112596. }
  112597. var scheduleFlush = void 0;
  112598. if (isNode) {
  112599. scheduleFlush = useNextTick();
  112600. } else if (BrowserMutationObserver) {
  112601. scheduleFlush = useMutationObserver();
  112602. } else if (isWorker) {
  112603. scheduleFlush = useMessageChannel();
  112604. } else if (browserWindow === void 0 && true) {
  112605. scheduleFlush = attemptVertx();
  112606. } else {
  112607. scheduleFlush = useSetTimeout();
  112608. }
  112609. function then(onFulfillment, onRejection) {
  112610. var parent = this;
  112611. var child = new this.constructor(noop2);
  112612. if (child[PROMISE_ID] === void 0) {
  112613. makePromise(child);
  112614. }
  112615. var _state = parent._state;
  112616. if (_state) {
  112617. var callback2 = arguments[_state - 1];
  112618. asap(function() {
  112619. return invokeCallback(_state, child, callback2, parent._result);
  112620. });
  112621. } else {
  112622. subscribe(parent, child, onFulfillment, onRejection);
  112623. }
  112624. return child;
  112625. }
  112626. function resolve$1(object) {
  112627. var Constructor = this;
  112628. if (object && typeof object === "object" && object.constructor === Constructor) {
  112629. return object;
  112630. }
  112631. var promise = new Constructor(noop2);
  112632. resolve2(promise, object);
  112633. return promise;
  112634. }
  112635. var PROMISE_ID = Math.random().toString(36).substring(2);
  112636. function noop2() {
  112637. }
  112638. var PENDING = void 0;
  112639. var FULFILLED = 1;
  112640. var REJECTED = 2;
  112641. function selfFulfillment() {
  112642. return new TypeError("You cannot resolve a promise with itself");
  112643. }
  112644. function cannotReturnOwn() {
  112645. return new TypeError("A promises callback cannot return that same promise.");
  112646. }
  112647. function tryThen(then$$1, value, fulfillmentHandler, rejectionHandler) {
  112648. try {
  112649. then$$1.call(value, fulfillmentHandler, rejectionHandler);
  112650. } catch (e) {
  112651. return e;
  112652. }
  112653. }
  112654. function handleForeignThenable(promise, thenable, then$$1) {
  112655. asap(function(promise2) {
  112656. var sealed = false;
  112657. var error = tryThen(then$$1, thenable, function(value) {
  112658. if (sealed) {
  112659. return;
  112660. }
  112661. sealed = true;
  112662. if (thenable !== value) {
  112663. resolve2(promise2, value);
  112664. } else {
  112665. fulfill(promise2, value);
  112666. }
  112667. }, function(reason) {
  112668. if (sealed) {
  112669. return;
  112670. }
  112671. sealed = true;
  112672. reject2(promise2, reason);
  112673. }, "Settle: " + (promise2._label || " unknown promise"));
  112674. if (!sealed && error) {
  112675. sealed = true;
  112676. reject2(promise2, error);
  112677. }
  112678. }, promise);
  112679. }
  112680. function handleOwnThenable(promise, thenable) {
  112681. if (thenable._state === FULFILLED) {
  112682. fulfill(promise, thenable._result);
  112683. } else if (thenable._state === REJECTED) {
  112684. reject2(promise, thenable._result);
  112685. } else {
  112686. subscribe(thenable, void 0, function(value) {
  112687. return resolve2(promise, value);
  112688. }, function(reason) {
  112689. return reject2(promise, reason);
  112690. });
  112691. }
  112692. }
  112693. function handleMaybeThenable(promise, maybeThenable, then$$1) {
  112694. if (maybeThenable.constructor === promise.constructor && then$$1 === then && maybeThenable.constructor.resolve === resolve$1) {
  112695. handleOwnThenable(promise, maybeThenable);
  112696. } else {
  112697. if (then$$1 === void 0) {
  112698. fulfill(promise, maybeThenable);
  112699. } else if (isFunction2(then$$1)) {
  112700. handleForeignThenable(promise, maybeThenable, then$$1);
  112701. } else {
  112702. fulfill(promise, maybeThenable);
  112703. }
  112704. }
  112705. }
  112706. function resolve2(promise, value) {
  112707. if (promise === value) {
  112708. reject2(promise, selfFulfillment());
  112709. } else if (objectOrFunction(value)) {
  112710. var then$$1 = void 0;
  112711. try {
  112712. then$$1 = value.then;
  112713. } catch (error) {
  112714. reject2(promise, error);
  112715. return;
  112716. }
  112717. handleMaybeThenable(promise, value, then$$1);
  112718. } else {
  112719. fulfill(promise, value);
  112720. }
  112721. }
  112722. function publishRejection(promise) {
  112723. if (promise._onerror) {
  112724. promise._onerror(promise._result);
  112725. }
  112726. publish(promise);
  112727. }
  112728. function fulfill(promise, value) {
  112729. if (promise._state !== PENDING) {
  112730. return;
  112731. }
  112732. promise._result = value;
  112733. promise._state = FULFILLED;
  112734. if (promise._subscribers.length !== 0) {
  112735. asap(publish, promise);
  112736. }
  112737. }
  112738. function reject2(promise, reason) {
  112739. if (promise._state !== PENDING) {
  112740. return;
  112741. }
  112742. promise._state = REJECTED;
  112743. promise._result = reason;
  112744. asap(publishRejection, promise);
  112745. }
  112746. function subscribe(parent, child, onFulfillment, onRejection) {
  112747. var _subscribers = parent._subscribers;
  112748. var length = _subscribers.length;
  112749. parent._onerror = null;
  112750. _subscribers[length] = child;
  112751. _subscribers[length + FULFILLED] = onFulfillment;
  112752. _subscribers[length + REJECTED] = onRejection;
  112753. if (length === 0 && parent._state) {
  112754. asap(publish, parent);
  112755. }
  112756. }
  112757. function publish(promise) {
  112758. var subscribers = promise._subscribers;
  112759. var settled = promise._state;
  112760. if (subscribers.length === 0) {
  112761. return;
  112762. }
  112763. var child = void 0, callback2 = void 0, detail = promise._result;
  112764. for (var i2 = 0; i2 < subscribers.length; i2 += 3) {
  112765. child = subscribers[i2];
  112766. callback2 = subscribers[i2 + settled];
  112767. if (child) {
  112768. invokeCallback(settled, child, callback2, detail);
  112769. } else {
  112770. callback2(detail);
  112771. }
  112772. }
  112773. promise._subscribers.length = 0;
  112774. }
  112775. function invokeCallback(settled, promise, callback2, detail) {
  112776. var hasCallback = isFunction2(callback2), value = void 0, error = void 0, succeeded = true;
  112777. if (hasCallback) {
  112778. try {
  112779. value = callback2(detail);
  112780. } catch (e) {
  112781. succeeded = false;
  112782. error = e;
  112783. }
  112784. if (promise === value) {
  112785. reject2(promise, cannotReturnOwn());
  112786. return;
  112787. }
  112788. } else {
  112789. value = detail;
  112790. }
  112791. if (promise._state !== PENDING)
  112792. ;
  112793. else if (hasCallback && succeeded) {
  112794. resolve2(promise, value);
  112795. } else if (succeeded === false) {
  112796. reject2(promise, error);
  112797. } else if (settled === FULFILLED) {
  112798. fulfill(promise, value);
  112799. } else if (settled === REJECTED) {
  112800. reject2(promise, value);
  112801. }
  112802. }
  112803. function initializePromise(promise, resolver) {
  112804. try {
  112805. resolver(function resolvePromise(value) {
  112806. resolve2(promise, value);
  112807. }, function rejectPromise(reason) {
  112808. reject2(promise, reason);
  112809. });
  112810. } catch (e) {
  112811. reject2(promise, e);
  112812. }
  112813. }
  112814. var id = 0;
  112815. function nextId() {
  112816. return id++;
  112817. }
  112818. function makePromise(promise) {
  112819. promise[PROMISE_ID] = id++;
  112820. promise._state = void 0;
  112821. promise._result = void 0;
  112822. promise._subscribers = [];
  112823. }
  112824. function validationError() {
  112825. return new Error("Array Methods must be provided an Array");
  112826. }
  112827. var Enumerator = function() {
  112828. function Enumerator2(Constructor, input) {
  112829. this._instanceConstructor = Constructor;
  112830. this.promise = new Constructor(noop2);
  112831. if (!this.promise[PROMISE_ID]) {
  112832. makePromise(this.promise);
  112833. }
  112834. if (isArray2(input)) {
  112835. this.length = input.length;
  112836. this._remaining = input.length;
  112837. this._result = new Array(this.length);
  112838. if (this.length === 0) {
  112839. fulfill(this.promise, this._result);
  112840. } else {
  112841. this.length = this.length || 0;
  112842. this._enumerate(input);
  112843. if (this._remaining === 0) {
  112844. fulfill(this.promise, this._result);
  112845. }
  112846. }
  112847. } else {
  112848. reject2(this.promise, validationError());
  112849. }
  112850. }
  112851. Enumerator2.prototype._enumerate = function _enumerate(input) {
  112852. for (var i2 = 0; this._state === PENDING && i2 < input.length; i2++) {
  112853. this._eachEntry(input[i2], i2);
  112854. }
  112855. };
  112856. Enumerator2.prototype._eachEntry = function _eachEntry(entry, i2) {
  112857. var c = this._instanceConstructor;
  112858. var resolve$$1 = c.resolve;
  112859. if (resolve$$1 === resolve$1) {
  112860. var _then = void 0;
  112861. var error = void 0;
  112862. var didError = false;
  112863. try {
  112864. _then = entry.then;
  112865. } catch (e) {
  112866. didError = true;
  112867. error = e;
  112868. }
  112869. if (_then === then && entry._state !== PENDING) {
  112870. this._settledAt(entry._state, i2, entry._result);
  112871. } else if (typeof _then !== "function") {
  112872. this._remaining--;
  112873. this._result[i2] = entry;
  112874. } else if (c === Promise$12) {
  112875. var promise = new c(noop2);
  112876. if (didError) {
  112877. reject2(promise, error);
  112878. } else {
  112879. handleMaybeThenable(promise, entry, _then);
  112880. }
  112881. this._willSettleAt(promise, i2);
  112882. } else {
  112883. this._willSettleAt(new c(function(resolve$$12) {
  112884. return resolve$$12(entry);
  112885. }), i2);
  112886. }
  112887. } else {
  112888. this._willSettleAt(resolve$$1(entry), i2);
  112889. }
  112890. };
  112891. Enumerator2.prototype._settledAt = function _settledAt(state, i2, value) {
  112892. var promise = this.promise;
  112893. if (promise._state === PENDING) {
  112894. this._remaining--;
  112895. if (state === REJECTED) {
  112896. reject2(promise, value);
  112897. } else {
  112898. this._result[i2] = value;
  112899. }
  112900. }
  112901. if (this._remaining === 0) {
  112902. fulfill(promise, this._result);
  112903. }
  112904. };
  112905. Enumerator2.prototype._willSettleAt = function _willSettleAt(promise, i2) {
  112906. var enumerator = this;
  112907. subscribe(promise, void 0, function(value) {
  112908. return enumerator._settledAt(FULFILLED, i2, value);
  112909. }, function(reason) {
  112910. return enumerator._settledAt(REJECTED, i2, reason);
  112911. });
  112912. };
  112913. return Enumerator2;
  112914. }();
  112915. function all(entries) {
  112916. return new Enumerator(this, entries).promise;
  112917. }
  112918. function race(entries) {
  112919. var Constructor = this;
  112920. if (!isArray2(entries)) {
  112921. return new Constructor(function(_, reject3) {
  112922. return reject3(new TypeError("You must pass an array to race."));
  112923. });
  112924. } else {
  112925. return new Constructor(function(resolve3, reject3) {
  112926. var length = entries.length;
  112927. for (var i2 = 0; i2 < length; i2++) {
  112928. Constructor.resolve(entries[i2]).then(resolve3, reject3);
  112929. }
  112930. });
  112931. }
  112932. }
  112933. function reject$1(reason) {
  112934. var Constructor = this;
  112935. var promise = new Constructor(noop2);
  112936. reject2(promise, reason);
  112937. return promise;
  112938. }
  112939. function needsResolver() {
  112940. throw new TypeError("You must pass a resolver function as the first argument to the promise constructor");
  112941. }
  112942. function needsNew() {
  112943. throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function.");
  112944. }
  112945. var Promise$12 = function() {
  112946. function Promise2(resolver) {
  112947. this[PROMISE_ID] = nextId();
  112948. this._result = this._state = void 0;
  112949. this._subscribers = [];
  112950. if (noop2 !== resolver) {
  112951. typeof resolver !== "function" && needsResolver();
  112952. this instanceof Promise2 ? initializePromise(this, resolver) : needsNew();
  112953. }
  112954. }
  112955. Promise2.prototype.catch = function _catch(onRejection) {
  112956. return this.then(null, onRejection);
  112957. };
  112958. Promise2.prototype.finally = function _finally(callback2) {
  112959. var promise = this;
  112960. var constructor = promise.constructor;
  112961. if (isFunction2(callback2)) {
  112962. return promise.then(function(value) {
  112963. return constructor.resolve(callback2()).then(function() {
  112964. return value;
  112965. });
  112966. }, function(reason) {
  112967. return constructor.resolve(callback2()).then(function() {
  112968. throw reason;
  112969. });
  112970. });
  112971. }
  112972. return promise.then(callback2, callback2);
  112973. };
  112974. return Promise2;
  112975. }();
  112976. Promise$12.prototype.then = then;
  112977. Promise$12.all = all;
  112978. Promise$12.race = race;
  112979. Promise$12.resolve = resolve$1;
  112980. Promise$12.reject = reject$1;
  112981. Promise$12._setScheduler = setScheduler;
  112982. Promise$12._setAsap = setAsap;
  112983. Promise$12._asap = asap;
  112984. function polyfill() {
  112985. var local = void 0;
  112986. if (typeof __webpack_require__2.g !== "undefined") {
  112987. local = __webpack_require__2.g;
  112988. } else if (typeof self !== "undefined") {
  112989. local = self;
  112990. } else {
  112991. try {
  112992. local = Function("return this")();
  112993. } catch (e) {
  112994. throw new Error("polyfill failed because global object is unavailable in this environment");
  112995. }
  112996. }
  112997. var P2 = local.Promise;
  112998. if (P2) {
  112999. var promiseToString = null;
  113000. try {
  113001. promiseToString = Object.prototype.toString.call(P2.resolve());
  113002. } catch (e) {
  113003. }
  113004. if (promiseToString === "[object Promise]" && !P2.cast) {
  113005. return;
  113006. }
  113007. }
  113008. local.Promise = Promise$12;
  113009. }
  113010. Promise$12.polyfill = polyfill;
  113011. Promise$12.Promise = Promise$12;
  113012. return Promise$12;
  113013. });
  113014. },
  113015. "./node_modules/events/events.js": function(module3) {
  113016. var R2 = typeof Reflect === "object" ? Reflect : null;
  113017. var ReflectApply = R2 && typeof R2.apply === "function" ? R2.apply : function ReflectApply2(target, receiver, args) {
  113018. return Function.prototype.apply.call(target, receiver, args);
  113019. };
  113020. var ReflectOwnKeys;
  113021. if (R2 && typeof R2.ownKeys === "function") {
  113022. ReflectOwnKeys = R2.ownKeys;
  113023. } else if (Object.getOwnPropertySymbols) {
  113024. ReflectOwnKeys = function ReflectOwnKeys2(target) {
  113025. return Object.getOwnPropertyNames(target).concat(Object.getOwnPropertySymbols(target));
  113026. };
  113027. } else {
  113028. ReflectOwnKeys = function ReflectOwnKeys2(target) {
  113029. return Object.getOwnPropertyNames(target);
  113030. };
  113031. }
  113032. function ProcessEmitWarning(warning) {
  113033. if (console && console.warn)
  113034. console.warn(warning);
  113035. }
  113036. var NumberIsNaN = Number.isNaN || function NumberIsNaN2(value) {
  113037. return value !== value;
  113038. };
  113039. function EventEmitter() {
  113040. EventEmitter.init.call(this);
  113041. }
  113042. module3.exports = EventEmitter;
  113043. module3.exports.once = once;
  113044. EventEmitter.EventEmitter = EventEmitter;
  113045. EventEmitter.prototype._events = void 0;
  113046. EventEmitter.prototype._eventsCount = 0;
  113047. EventEmitter.prototype._maxListeners = void 0;
  113048. var defaultMaxListeners = 10;
  113049. function checkListener(listener) {
  113050. if (typeof listener !== "function") {
  113051. throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
  113052. }
  113053. }
  113054. Object.defineProperty(EventEmitter, "defaultMaxListeners", {
  113055. enumerable: true,
  113056. get: function() {
  113057. return defaultMaxListeners;
  113058. },
  113059. set: function(arg) {
  113060. if (typeof arg !== "number" || arg < 0 || NumberIsNaN(arg)) {
  113061. throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + ".");
  113062. }
  113063. defaultMaxListeners = arg;
  113064. }
  113065. });
  113066. EventEmitter.init = function() {
  113067. if (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) {
  113068. this._events = /* @__PURE__ */ Object.create(null);
  113069. this._eventsCount = 0;
  113070. }
  113071. this._maxListeners = this._maxListeners || void 0;
  113072. };
  113073. EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
  113074. if (typeof n !== "number" || n < 0 || NumberIsNaN(n)) {
  113075. throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + ".");
  113076. }
  113077. this._maxListeners = n;
  113078. return this;
  113079. };
  113080. function _getMaxListeners(that) {
  113081. if (that._maxListeners === void 0)
  113082. return EventEmitter.defaultMaxListeners;
  113083. return that._maxListeners;
  113084. }
  113085. EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
  113086. return _getMaxListeners(this);
  113087. };
  113088. EventEmitter.prototype.emit = function emit(type2) {
  113089. var args = [];
  113090. for (var i2 = 1; i2 < arguments.length; i2++)
  113091. args.push(arguments[i2]);
  113092. var doError = type2 === "error";
  113093. var events = this._events;
  113094. if (events !== void 0)
  113095. doError = doError && events.error === void 0;
  113096. else if (!doError)
  113097. return false;
  113098. if (doError) {
  113099. var er;
  113100. if (args.length > 0)
  113101. er = args[0];
  113102. if (er instanceof Error) {
  113103. throw er;
  113104. }
  113105. var err = new Error("Unhandled error." + (er ? " (" + er.message + ")" : ""));
  113106. err.context = er;
  113107. throw err;
  113108. }
  113109. var handler = events[type2];
  113110. if (handler === void 0)
  113111. return false;
  113112. if (typeof handler === "function") {
  113113. ReflectApply(handler, this, args);
  113114. } else {
  113115. var len = handler.length;
  113116. var listeners = arrayClone(handler, len);
  113117. for (var i2 = 0; i2 < len; ++i2)
  113118. ReflectApply(listeners[i2], this, args);
  113119. }
  113120. return true;
  113121. };
  113122. function _addListener(target, type2, listener, prepend) {
  113123. var m;
  113124. var events;
  113125. var existing;
  113126. checkListener(listener);
  113127. events = target._events;
  113128. if (events === void 0) {
  113129. events = target._events = /* @__PURE__ */ Object.create(null);
  113130. target._eventsCount = 0;
  113131. } else {
  113132. if (events.newListener !== void 0) {
  113133. target.emit("newListener", type2, listener.listener ? listener.listener : listener);
  113134. events = target._events;
  113135. }
  113136. existing = events[type2];
  113137. }
  113138. if (existing === void 0) {
  113139. existing = events[type2] = listener;
  113140. ++target._eventsCount;
  113141. } else {
  113142. if (typeof existing === "function") {
  113143. existing = events[type2] = prepend ? [listener, existing] : [existing, listener];
  113144. } else if (prepend) {
  113145. existing.unshift(listener);
  113146. } else {
  113147. existing.push(listener);
  113148. }
  113149. m = _getMaxListeners(target);
  113150. if (m > 0 && existing.length > m && !existing.warned) {
  113151. existing.warned = true;
  113152. var w = new Error("Possible EventEmitter memory leak detected. " + existing.length + " " + String(type2) + " listeners added. Use emitter.setMaxListeners() to increase limit");
  113153. w.name = "MaxListenersExceededWarning";
  113154. w.emitter = target;
  113155. w.type = type2;
  113156. w.count = existing.length;
  113157. ProcessEmitWarning(w);
  113158. }
  113159. }
  113160. return target;
  113161. }
  113162. EventEmitter.prototype.addListener = function addListener(type2, listener) {
  113163. return _addListener(this, type2, listener, false);
  113164. };
  113165. EventEmitter.prototype.on = EventEmitter.prototype.addListener;
  113166. EventEmitter.prototype.prependListener = function prependListener(type2, listener) {
  113167. return _addListener(this, type2, listener, true);
  113168. };
  113169. function onceWrapper() {
  113170. if (!this.fired) {
  113171. this.target.removeListener(this.type, this.wrapFn);
  113172. this.fired = true;
  113173. if (arguments.length === 0)
  113174. return this.listener.call(this.target);
  113175. return this.listener.apply(this.target, arguments);
  113176. }
  113177. }
  113178. function _onceWrap(target, type2, listener) {
  113179. var state = { fired: false, wrapFn: void 0, target, type: type2, listener };
  113180. var wrapped = onceWrapper.bind(state);
  113181. wrapped.listener = listener;
  113182. state.wrapFn = wrapped;
  113183. return wrapped;
  113184. }
  113185. EventEmitter.prototype.once = function once2(type2, listener) {
  113186. checkListener(listener);
  113187. this.on(type2, _onceWrap(this, type2, listener));
  113188. return this;
  113189. };
  113190. EventEmitter.prototype.prependOnceListener = function prependOnceListener(type2, listener) {
  113191. checkListener(listener);
  113192. this.prependListener(type2, _onceWrap(this, type2, listener));
  113193. return this;
  113194. };
  113195. EventEmitter.prototype.removeListener = function removeListener(type2, listener) {
  113196. var list, events, position2, i2, originalListener;
  113197. checkListener(listener);
  113198. events = this._events;
  113199. if (events === void 0)
  113200. return this;
  113201. list = events[type2];
  113202. if (list === void 0)
  113203. return this;
  113204. if (list === listener || list.listener === listener) {
  113205. if (--this._eventsCount === 0)
  113206. this._events = /* @__PURE__ */ Object.create(null);
  113207. else {
  113208. delete events[type2];
  113209. if (events.removeListener)
  113210. this.emit("removeListener", type2, list.listener || listener);
  113211. }
  113212. } else if (typeof list !== "function") {
  113213. position2 = -1;
  113214. for (i2 = list.length - 1; i2 >= 0; i2--) {
  113215. if (list[i2] === listener || list[i2].listener === listener) {
  113216. originalListener = list[i2].listener;
  113217. position2 = i2;
  113218. break;
  113219. }
  113220. }
  113221. if (position2 < 0)
  113222. return this;
  113223. if (position2 === 0)
  113224. list.shift();
  113225. else {
  113226. spliceOne(list, position2);
  113227. }
  113228. if (list.length === 1)
  113229. events[type2] = list[0];
  113230. if (events.removeListener !== void 0)
  113231. this.emit("removeListener", type2, originalListener || listener);
  113232. }
  113233. return this;
  113234. };
  113235. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  113236. EventEmitter.prototype.removeAllListeners = function removeAllListeners(type2) {
  113237. var listeners, events, i2;
  113238. events = this._events;
  113239. if (events === void 0)
  113240. return this;
  113241. if (events.removeListener === void 0) {
  113242. if (arguments.length === 0) {
  113243. this._events = /* @__PURE__ */ Object.create(null);
  113244. this._eventsCount = 0;
  113245. } else if (events[type2] !== void 0) {
  113246. if (--this._eventsCount === 0)
  113247. this._events = /* @__PURE__ */ Object.create(null);
  113248. else
  113249. delete events[type2];
  113250. }
  113251. return this;
  113252. }
  113253. if (arguments.length === 0) {
  113254. var keys3 = Object.keys(events);
  113255. var key;
  113256. for (i2 = 0; i2 < keys3.length; ++i2) {
  113257. key = keys3[i2];
  113258. if (key === "removeListener")
  113259. continue;
  113260. this.removeAllListeners(key);
  113261. }
  113262. this.removeAllListeners("removeListener");
  113263. this._events = /* @__PURE__ */ Object.create(null);
  113264. this._eventsCount = 0;
  113265. return this;
  113266. }
  113267. listeners = events[type2];
  113268. if (typeof listeners === "function") {
  113269. this.removeListener(type2, listeners);
  113270. } else if (listeners !== void 0) {
  113271. for (i2 = listeners.length - 1; i2 >= 0; i2--) {
  113272. this.removeListener(type2, listeners[i2]);
  113273. }
  113274. }
  113275. return this;
  113276. };
  113277. function _listeners(target, type2, unwrap) {
  113278. var events = target._events;
  113279. if (events === void 0)
  113280. return [];
  113281. var evlistener = events[type2];
  113282. if (evlistener === void 0)
  113283. return [];
  113284. if (typeof evlistener === "function")
  113285. return unwrap ? [evlistener.listener || evlistener] : [evlistener];
  113286. return unwrap ? unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
  113287. }
  113288. EventEmitter.prototype.listeners = function listeners(type2) {
  113289. return _listeners(this, type2, true);
  113290. };
  113291. EventEmitter.prototype.rawListeners = function rawListeners(type2) {
  113292. return _listeners(this, type2, false);
  113293. };
  113294. EventEmitter.listenerCount = function(emitter, type2) {
  113295. if (typeof emitter.listenerCount === "function") {
  113296. return emitter.listenerCount(type2);
  113297. } else {
  113298. return listenerCount.call(emitter, type2);
  113299. }
  113300. };
  113301. EventEmitter.prototype.listenerCount = listenerCount;
  113302. function listenerCount(type2) {
  113303. var events = this._events;
  113304. if (events !== void 0) {
  113305. var evlistener = events[type2];
  113306. if (typeof evlistener === "function") {
  113307. return 1;
  113308. } else if (evlistener !== void 0) {
  113309. return evlistener.length;
  113310. }
  113311. }
  113312. return 0;
  113313. }
  113314. EventEmitter.prototype.eventNames = function eventNames() {
  113315. return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
  113316. };
  113317. function arrayClone(arr, n) {
  113318. var copy2 = new Array(n);
  113319. for (var i2 = 0; i2 < n; ++i2)
  113320. copy2[i2] = arr[i2];
  113321. return copy2;
  113322. }
  113323. function spliceOne(list, index2) {
  113324. for (; index2 + 1 < list.length; index2++)
  113325. list[index2] = list[index2 + 1];
  113326. list.pop();
  113327. }
  113328. function unwrapListeners(arr) {
  113329. var ret = new Array(arr.length);
  113330. for (var i2 = 0; i2 < ret.length; ++i2) {
  113331. ret[i2] = arr[i2].listener || arr[i2];
  113332. }
  113333. return ret;
  113334. }
  113335. function once(emitter, name) {
  113336. return new Promise(function(resolve2, reject2) {
  113337. function errorListener(err) {
  113338. emitter.removeListener(name, resolver);
  113339. reject2(err);
  113340. }
  113341. function resolver() {
  113342. if (typeof emitter.removeListener === "function") {
  113343. emitter.removeListener("error", errorListener);
  113344. }
  113345. resolve2([].slice.call(arguments));
  113346. }
  113347. eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
  113348. if (name !== "error") {
  113349. addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
  113350. }
  113351. });
  113352. }
  113353. function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
  113354. if (typeof emitter.on === "function") {
  113355. eventTargetAgnosticAddListener(emitter, "error", handler, flags);
  113356. }
  113357. }
  113358. function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
  113359. if (typeof emitter.on === "function") {
  113360. if (flags.once) {
  113361. emitter.once(name, listener);
  113362. } else {
  113363. emitter.on(name, listener);
  113364. }
  113365. } else if (typeof emitter.addEventListener === "function") {
  113366. emitter.addEventListener(name, function wrapListener(arg) {
  113367. if (flags.once) {
  113368. emitter.removeEventListener(name, wrapListener);
  113369. }
  113370. listener(arg);
  113371. });
  113372. } else {
  113373. throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
  113374. }
  113375. }
  113376. },
  113377. "./node_modules/webworkify-webpack/index.js": function(module3, __unused_webpack_exports, __webpack_require__2) {
  113378. function webpackBootstrapFunc(modules) {
  113379. var installedModules = {};
  113380. function __nested_webpack_require_164__(moduleId) {
  113381. if (installedModules[moduleId])
  113382. return installedModules[moduleId].exports;
  113383. var module4 = installedModules[moduleId] = {
  113384. i: moduleId,
  113385. l: false,
  113386. exports: {}
  113387. };
  113388. modules[moduleId].call(module4.exports, module4, module4.exports, __nested_webpack_require_164__);
  113389. module4.l = true;
  113390. return module4.exports;
  113391. }
  113392. __nested_webpack_require_164__.m = modules;
  113393. __nested_webpack_require_164__.c = installedModules;
  113394. __nested_webpack_require_164__.i = function(value) {
  113395. return value;
  113396. };
  113397. __nested_webpack_require_164__.d = function(exports3, name, getter) {
  113398. if (!__nested_webpack_require_164__.o(exports3, name)) {
  113399. Object.defineProperty(exports3, name, {
  113400. configurable: false,
  113401. enumerable: true,
  113402. get: getter
  113403. });
  113404. }
  113405. };
  113406. __nested_webpack_require_164__.r = function(exports3) {
  113407. Object.defineProperty(exports3, "__esModule", { value: true });
  113408. };
  113409. __nested_webpack_require_164__.n = function(module4) {
  113410. var getter = module4 && module4.__esModule ? function getDefault() {
  113411. return module4["default"];
  113412. } : function getModuleExports() {
  113413. return module4;
  113414. };
  113415. __nested_webpack_require_164__.d(getter, "a", getter);
  113416. return getter;
  113417. };
  113418. __nested_webpack_require_164__.o = function(object, property) {
  113419. return Object.prototype.hasOwnProperty.call(object, property);
  113420. };
  113421. __nested_webpack_require_164__.p = "/";
  113422. __nested_webpack_require_164__.oe = function(err) {
  113423. console.error(err);
  113424. throw err;
  113425. };
  113426. var f = __nested_webpack_require_164__(__nested_webpack_require_164__.s = ENTRY_MODULE);
  113427. return f.default || f;
  113428. }
  113429. var moduleNameReqExp = "[\\.|\\-|\\+|\\w|/|@]+";
  113430. var dependencyRegExp = "\\(\\s*(/\\*.*?\\*/)?\\s*.*?(" + moduleNameReqExp + ").*?\\)";
  113431. function quoteRegExp(str) {
  113432. return (str + "").replace(/[.?*+^$[\]\\(){}|-]/g, "\\$&");
  113433. }
  113434. function isNumeric(n) {
  113435. return !isNaN(1 * n);
  113436. }
  113437. function getModuleDependencies(sources, module4, queueName) {
  113438. var retval = {};
  113439. retval[queueName] = [];
  113440. var fnString = module4.toString();
  113441. var wrapperSignature = fnString.match(/^function\s?\w*\(\w+,\s*\w+,\s*(\w+)\)/);
  113442. if (!wrapperSignature)
  113443. return retval;
  113444. var webpackRequireName = wrapperSignature[1];
  113445. var re = new RegExp("(\\\\n|\\W)" + quoteRegExp(webpackRequireName) + dependencyRegExp, "g");
  113446. var match;
  113447. while (match = re.exec(fnString)) {
  113448. if (match[3] === "dll-reference")
  113449. continue;
  113450. retval[queueName].push(match[3]);
  113451. }
  113452. re = new RegExp("\\(" + quoteRegExp(webpackRequireName) + '\\("(dll-reference\\s(' + moduleNameReqExp + '))"\\)\\)' + dependencyRegExp, "g");
  113453. while (match = re.exec(fnString)) {
  113454. if (!sources[match[2]]) {
  113455. retval[queueName].push(match[1]);
  113456. sources[match[2]] = __webpack_require__2(match[1]).m;
  113457. }
  113458. retval[match[2]] = retval[match[2]] || [];
  113459. retval[match[2]].push(match[4]);
  113460. }
  113461. var keys3 = Object.keys(retval);
  113462. for (var i2 = 0; i2 < keys3.length; i2++) {
  113463. for (var j = 0; j < retval[keys3[i2]].length; j++) {
  113464. if (isNumeric(retval[keys3[i2]][j])) {
  113465. retval[keys3[i2]][j] = 1 * retval[keys3[i2]][j];
  113466. }
  113467. }
  113468. }
  113469. return retval;
  113470. }
  113471. function hasValuesInQueues(queues) {
  113472. var keys3 = Object.keys(queues);
  113473. return keys3.reduce(function(hasValues, key) {
  113474. return hasValues || queues[key].length > 0;
  113475. }, false);
  113476. }
  113477. function getRequiredModules(sources, moduleId) {
  113478. var modulesQueue = {
  113479. main: [moduleId]
  113480. };
  113481. var requiredModules = {
  113482. main: []
  113483. };
  113484. var seenModules = {
  113485. main: {}
  113486. };
  113487. while (hasValuesInQueues(modulesQueue)) {
  113488. var queues = Object.keys(modulesQueue);
  113489. for (var i2 = 0; i2 < queues.length; i2++) {
  113490. var queueName = queues[i2];
  113491. var queue = modulesQueue[queueName];
  113492. var moduleToCheck = queue.pop();
  113493. seenModules[queueName] = seenModules[queueName] || {};
  113494. if (seenModules[queueName][moduleToCheck] || !sources[queueName][moduleToCheck])
  113495. continue;
  113496. seenModules[queueName][moduleToCheck] = true;
  113497. requiredModules[queueName] = requiredModules[queueName] || [];
  113498. requiredModules[queueName].push(moduleToCheck);
  113499. var newModules = getModuleDependencies(sources, sources[queueName][moduleToCheck], queueName);
  113500. var newModulesKeys = Object.keys(newModules);
  113501. for (var j = 0; j < newModulesKeys.length; j++) {
  113502. modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]] || [];
  113503. modulesQueue[newModulesKeys[j]] = modulesQueue[newModulesKeys[j]].concat(newModules[newModulesKeys[j]]);
  113504. }
  113505. }
  113506. }
  113507. return requiredModules;
  113508. }
  113509. module3.exports = function(moduleId, options2) {
  113510. options2 = options2 || {};
  113511. var sources = {
  113512. main: __webpack_require__2.m
  113513. };
  113514. var requiredModules = options2.all ? { main: Object.keys(sources.main) } : getRequiredModules(sources, moduleId);
  113515. var src = "";
  113516. Object.keys(requiredModules).filter(function(m) {
  113517. return m !== "main";
  113518. }).forEach(function(module4) {
  113519. var entryModule = 0;
  113520. while (requiredModules[module4][entryModule]) {
  113521. entryModule++;
  113522. }
  113523. requiredModules[module4].push(entryModule);
  113524. sources[module4][entryModule] = "(function(module, exports, __webpack_require__) { module.exports = __webpack_require__; })";
  113525. src = src + "var " + module4 + " = (" + webpackBootstrapFunc.toString().replace("ENTRY_MODULE", JSON.stringify(entryModule)) + ")({" + requiredModules[module4].map(function(id) {
  113526. return "" + JSON.stringify(id) + ": " + sources[module4][id].toString();
  113527. }).join(",") + "});\n";
  113528. });
  113529. src = src + "new ((" + webpackBootstrapFunc.toString().replace("ENTRY_MODULE", JSON.stringify(moduleId)) + ")({" + requiredModules.main.map(function(id) {
  113530. return "" + JSON.stringify(id) + ": " + sources.main[id].toString();
  113531. }).join(",") + "}))(self);";
  113532. var blob = new window.Blob([src], { type: "text/javascript" });
  113533. if (options2.bare) {
  113534. return blob;
  113535. }
  113536. var URL2 = window.URL || window.webkitURL || window.mozURL || window.msURL;
  113537. var workerUrl = URL2.createObjectURL(blob);
  113538. var worker = new window.Worker(workerUrl);
  113539. worker.objectURL = workerUrl;
  113540. return worker;
  113541. };
  113542. },
  113543. "./src/config.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113544. __webpack_require__2.r(__webpack_exports__2);
  113545. __webpack_require__2.d(__webpack_exports__2, {
  113546. "defaultConfig": function() {
  113547. return defaultConfig;
  113548. },
  113549. "createDefaultConfig": function() {
  113550. return createDefaultConfig;
  113551. }
  113552. });
  113553. var defaultConfig = {
  113554. enableWorker: false,
  113555. enableStashBuffer: true,
  113556. stashInitialSize: void 0,
  113557. isLive: false,
  113558. lazyLoad: true,
  113559. lazyLoadMaxDuration: 3 * 60,
  113560. lazyLoadRecoverDuration: 30,
  113561. deferLoadAfterSourceOpen: true,
  113562. autoCleanupMaxBackwardDuration: 3 * 60,
  113563. autoCleanupMinBackwardDuration: 2 * 60,
  113564. statisticsInfoReportInterval: 600,
  113565. fixAudioTimestampGap: true,
  113566. accurateSeek: false,
  113567. seekType: "range",
  113568. seekParamStart: "bstart",
  113569. seekParamEnd: "bend",
  113570. rangeLoadZeroStart: false,
  113571. customSeekHandler: void 0,
  113572. reuseRedirectedURL: false,
  113573. headers: void 0,
  113574. customLoader: void 0
  113575. };
  113576. function createDefaultConfig() {
  113577. return Object.assign({}, defaultConfig);
  113578. }
  113579. },
  113580. "./src/core/features.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113581. __webpack_require__2.r(__webpack_exports__2);
  113582. var _io_io_controller_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/io/io-controller.js");
  113583. var _config_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/config.js");
  113584. var Features = function() {
  113585. function Features2() {
  113586. }
  113587. Features2.supportMSEH264Playback = function() {
  113588. return window.MediaSource && window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"');
  113589. };
  113590. Features2.supportNetworkStreamIO = function() {
  113591. var ioctl = new _io_io_controller_js__WEBPACK_IMPORTED_MODULE_0__.default({}, (0, _config_js__WEBPACK_IMPORTED_MODULE_1__.createDefaultConfig)());
  113592. var loaderType = ioctl.loaderType;
  113593. ioctl.destroy();
  113594. return loaderType == "fetch-stream-loader" || loaderType == "xhr-moz-chunked-loader";
  113595. };
  113596. Features2.getNetworkLoaderTypeName = function() {
  113597. var ioctl = new _io_io_controller_js__WEBPACK_IMPORTED_MODULE_0__.default({}, (0, _config_js__WEBPACK_IMPORTED_MODULE_1__.createDefaultConfig)());
  113598. var loaderType = ioctl.loaderType;
  113599. ioctl.destroy();
  113600. return loaderType;
  113601. };
  113602. Features2.supportNativeMediaPlayback = function(mimeType) {
  113603. if (Features2.videoElement == void 0) {
  113604. Features2.videoElement = window.document.createElement("video");
  113605. }
  113606. var canPlay = Features2.videoElement.canPlayType(mimeType);
  113607. return canPlay === "probably" || canPlay == "maybe";
  113608. };
  113609. Features2.getFeatureList = function() {
  113610. var features = {
  113611. mseFlvPlayback: false,
  113612. mseLiveFlvPlayback: false,
  113613. networkStreamIO: false,
  113614. networkLoaderName: "",
  113615. nativeMP4H264Playback: false,
  113616. nativeWebmVP8Playback: false,
  113617. nativeWebmVP9Playback: false
  113618. };
  113619. features.mseFlvPlayback = Features2.supportMSEH264Playback();
  113620. features.networkStreamIO = Features2.supportNetworkStreamIO();
  113621. features.networkLoaderName = Features2.getNetworkLoaderTypeName();
  113622. features.mseLiveFlvPlayback = features.mseFlvPlayback && features.networkStreamIO;
  113623. features.nativeMP4H264Playback = Features2.supportNativeMediaPlayback('video/mp4; codecs="avc1.42001E, mp4a.40.2"');
  113624. features.nativeWebmVP8Playback = Features2.supportNativeMediaPlayback('video/webm; codecs="vp8.0, vorbis"');
  113625. features.nativeWebmVP9Playback = Features2.supportNativeMediaPlayback('video/webm; codecs="vp9"');
  113626. return features;
  113627. };
  113628. return Features2;
  113629. }();
  113630. __webpack_exports__2["default"] = Features;
  113631. },
  113632. "./src/core/media-info.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113633. __webpack_require__2.r(__webpack_exports__2);
  113634. var MediaInfo = function() {
  113635. function MediaInfo2() {
  113636. this.mimeType = null;
  113637. this.duration = null;
  113638. this.hasAudio = null;
  113639. this.hasVideo = null;
  113640. this.audioCodec = null;
  113641. this.videoCodec = null;
  113642. this.audioDataRate = null;
  113643. this.videoDataRate = null;
  113644. this.audioSampleRate = null;
  113645. this.audioChannelCount = null;
  113646. this.width = null;
  113647. this.height = null;
  113648. this.fps = null;
  113649. this.profile = null;
  113650. this.level = null;
  113651. this.refFrames = null;
  113652. this.chromaFormat = null;
  113653. this.sarNum = null;
  113654. this.sarDen = null;
  113655. this.metadata = null;
  113656. this.segments = null;
  113657. this.segmentCount = null;
  113658. this.hasKeyframesIndex = null;
  113659. this.keyframesIndex = null;
  113660. }
  113661. MediaInfo2.prototype.isComplete = function() {
  113662. var audioInfoComplete = this.hasAudio === false || this.hasAudio === true && this.audioCodec != null && this.audioSampleRate != null && this.audioChannelCount != null;
  113663. var videoInfoComplete = this.hasVideo === false || this.hasVideo === true && this.videoCodec != null && this.width != null && this.height != null && this.fps != null && this.profile != null && this.level != null && this.refFrames != null && this.chromaFormat != null && this.sarNum != null && this.sarDen != null;
  113664. return this.mimeType != null && this.duration != null && this.metadata != null && this.hasKeyframesIndex != null && audioInfoComplete && videoInfoComplete;
  113665. };
  113666. MediaInfo2.prototype.isSeekable = function() {
  113667. return this.hasKeyframesIndex === true;
  113668. };
  113669. MediaInfo2.prototype.getNearestKeyframe = function(milliseconds) {
  113670. if (this.keyframesIndex == null) {
  113671. return null;
  113672. }
  113673. var table = this.keyframesIndex;
  113674. var keyframeIdx = this._search(table.times, milliseconds);
  113675. return {
  113676. index: keyframeIdx,
  113677. milliseconds: table.times[keyframeIdx],
  113678. fileposition: table.filepositions[keyframeIdx]
  113679. };
  113680. };
  113681. MediaInfo2.prototype._search = function(list, value) {
  113682. var idx = 0;
  113683. var last = list.length - 1;
  113684. var mid = 0;
  113685. var lbound = 0;
  113686. var ubound = last;
  113687. if (value < list[0]) {
  113688. idx = 0;
  113689. lbound = ubound + 1;
  113690. }
  113691. while (lbound <= ubound) {
  113692. mid = lbound + Math.floor((ubound - lbound) / 2);
  113693. if (mid === last || value >= list[mid] && value < list[mid + 1]) {
  113694. idx = mid;
  113695. break;
  113696. } else if (list[mid] < value) {
  113697. lbound = mid + 1;
  113698. } else {
  113699. ubound = mid - 1;
  113700. }
  113701. }
  113702. return idx;
  113703. };
  113704. return MediaInfo2;
  113705. }();
  113706. __webpack_exports__2["default"] = MediaInfo;
  113707. },
  113708. "./src/core/media-segment-info.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113709. __webpack_require__2.r(__webpack_exports__2);
  113710. __webpack_require__2.d(__webpack_exports__2, {
  113711. "SampleInfo": function() {
  113712. return SampleInfo;
  113713. },
  113714. "MediaSegmentInfo": function() {
  113715. return MediaSegmentInfo;
  113716. },
  113717. "IDRSampleList": function() {
  113718. return IDRSampleList;
  113719. },
  113720. "MediaSegmentInfoList": function() {
  113721. return MediaSegmentInfoList;
  113722. }
  113723. });
  113724. var SampleInfo = function() {
  113725. function SampleInfo2(dts, pts, duration5, originalDts, isSync) {
  113726. this.dts = dts;
  113727. this.pts = pts;
  113728. this.duration = duration5;
  113729. this.originalDts = originalDts;
  113730. this.isSyncPoint = isSync;
  113731. this.fileposition = null;
  113732. }
  113733. return SampleInfo2;
  113734. }();
  113735. var MediaSegmentInfo = function() {
  113736. function MediaSegmentInfo2() {
  113737. this.beginDts = 0;
  113738. this.endDts = 0;
  113739. this.beginPts = 0;
  113740. this.endPts = 0;
  113741. this.originalBeginDts = 0;
  113742. this.originalEndDts = 0;
  113743. this.syncPoints = [];
  113744. this.firstSample = null;
  113745. this.lastSample = null;
  113746. }
  113747. MediaSegmentInfo2.prototype.appendSyncPoint = function(sampleInfo) {
  113748. sampleInfo.isSyncPoint = true;
  113749. this.syncPoints.push(sampleInfo);
  113750. };
  113751. return MediaSegmentInfo2;
  113752. }();
  113753. var IDRSampleList = function() {
  113754. function IDRSampleList2() {
  113755. this._list = [];
  113756. }
  113757. IDRSampleList2.prototype.clear = function() {
  113758. this._list = [];
  113759. };
  113760. IDRSampleList2.prototype.appendArray = function(syncPoints) {
  113761. var list = this._list;
  113762. if (syncPoints.length === 0) {
  113763. return;
  113764. }
  113765. if (list.length > 0 && syncPoints[0].originalDts < list[list.length - 1].originalDts) {
  113766. this.clear();
  113767. }
  113768. Array.prototype.push.apply(list, syncPoints);
  113769. };
  113770. IDRSampleList2.prototype.getLastSyncPointBeforeDts = function(dts) {
  113771. if (this._list.length == 0) {
  113772. return null;
  113773. }
  113774. var list = this._list;
  113775. var idx = 0;
  113776. var last = list.length - 1;
  113777. var mid = 0;
  113778. var lbound = 0;
  113779. var ubound = last;
  113780. if (dts < list[0].dts) {
  113781. idx = 0;
  113782. lbound = ubound + 1;
  113783. }
  113784. while (lbound <= ubound) {
  113785. mid = lbound + Math.floor((ubound - lbound) / 2);
  113786. if (mid === last || dts >= list[mid].dts && dts < list[mid + 1].dts) {
  113787. idx = mid;
  113788. break;
  113789. } else if (list[mid].dts < dts) {
  113790. lbound = mid + 1;
  113791. } else {
  113792. ubound = mid - 1;
  113793. }
  113794. }
  113795. return this._list[idx];
  113796. };
  113797. return IDRSampleList2;
  113798. }();
  113799. var MediaSegmentInfoList = function() {
  113800. function MediaSegmentInfoList2(type2) {
  113801. this._type = type2;
  113802. this._list = [];
  113803. this._lastAppendLocation = -1;
  113804. }
  113805. Object.defineProperty(MediaSegmentInfoList2.prototype, "type", {
  113806. get: function() {
  113807. return this._type;
  113808. },
  113809. enumerable: false,
  113810. configurable: true
  113811. });
  113812. Object.defineProperty(MediaSegmentInfoList2.prototype, "length", {
  113813. get: function() {
  113814. return this._list.length;
  113815. },
  113816. enumerable: false,
  113817. configurable: true
  113818. });
  113819. MediaSegmentInfoList2.prototype.isEmpty = function() {
  113820. return this._list.length === 0;
  113821. };
  113822. MediaSegmentInfoList2.prototype.clear = function() {
  113823. this._list = [];
  113824. this._lastAppendLocation = -1;
  113825. };
  113826. MediaSegmentInfoList2.prototype._searchNearestSegmentBefore = function(originalBeginDts) {
  113827. var list = this._list;
  113828. if (list.length === 0) {
  113829. return -2;
  113830. }
  113831. var last = list.length - 1;
  113832. var mid = 0;
  113833. var lbound = 0;
  113834. var ubound = last;
  113835. var idx = 0;
  113836. if (originalBeginDts < list[0].originalBeginDts) {
  113837. idx = -1;
  113838. return idx;
  113839. }
  113840. while (lbound <= ubound) {
  113841. mid = lbound + Math.floor((ubound - lbound) / 2);
  113842. if (mid === last || originalBeginDts > list[mid].lastSample.originalDts && originalBeginDts < list[mid + 1].originalBeginDts) {
  113843. idx = mid;
  113844. break;
  113845. } else if (list[mid].originalBeginDts < originalBeginDts) {
  113846. lbound = mid + 1;
  113847. } else {
  113848. ubound = mid - 1;
  113849. }
  113850. }
  113851. return idx;
  113852. };
  113853. MediaSegmentInfoList2.prototype._searchNearestSegmentAfter = function(originalBeginDts) {
  113854. return this._searchNearestSegmentBefore(originalBeginDts) + 1;
  113855. };
  113856. MediaSegmentInfoList2.prototype.append = function(mediaSegmentInfo) {
  113857. var list = this._list;
  113858. var msi = mediaSegmentInfo;
  113859. var lastAppendIdx = this._lastAppendLocation;
  113860. var insertIdx = 0;
  113861. if (lastAppendIdx !== -1 && lastAppendIdx < list.length && msi.originalBeginDts >= list[lastAppendIdx].lastSample.originalDts && (lastAppendIdx === list.length - 1 || lastAppendIdx < list.length - 1 && msi.originalBeginDts < list[lastAppendIdx + 1].originalBeginDts)) {
  113862. insertIdx = lastAppendIdx + 1;
  113863. } else {
  113864. if (list.length > 0) {
  113865. insertIdx = this._searchNearestSegmentBefore(msi.originalBeginDts) + 1;
  113866. }
  113867. }
  113868. this._lastAppendLocation = insertIdx;
  113869. this._list.splice(insertIdx, 0, msi);
  113870. };
  113871. MediaSegmentInfoList2.prototype.getLastSegmentBefore = function(originalBeginDts) {
  113872. var idx = this._searchNearestSegmentBefore(originalBeginDts);
  113873. if (idx >= 0) {
  113874. return this._list[idx];
  113875. } else {
  113876. return null;
  113877. }
  113878. };
  113879. MediaSegmentInfoList2.prototype.getLastSampleBefore = function(originalBeginDts) {
  113880. var segment = this.getLastSegmentBefore(originalBeginDts);
  113881. if (segment != null) {
  113882. return segment.lastSample;
  113883. } else {
  113884. return null;
  113885. }
  113886. };
  113887. MediaSegmentInfoList2.prototype.getLastSyncPointBefore = function(originalBeginDts) {
  113888. var segmentIdx = this._searchNearestSegmentBefore(originalBeginDts);
  113889. var syncPoints = this._list[segmentIdx].syncPoints;
  113890. while (syncPoints.length === 0 && segmentIdx > 0) {
  113891. segmentIdx--;
  113892. syncPoints = this._list[segmentIdx].syncPoints;
  113893. }
  113894. if (syncPoints.length > 0) {
  113895. return syncPoints[syncPoints.length - 1];
  113896. } else {
  113897. return null;
  113898. }
  113899. };
  113900. return MediaSegmentInfoList2;
  113901. }();
  113902. },
  113903. "./src/core/mse-controller.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  113904. __webpack_require__2.r(__webpack_exports__2);
  113905. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  113906. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  113907. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/logger.js");
  113908. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/browser.js");
  113909. var _mse_events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/core/mse-events.js");
  113910. var _media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/media-segment-info.js");
  113911. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/utils/exception.js");
  113912. var MSEController = function() {
  113913. function MSEController2(config) {
  113914. this.TAG = "MSEController";
  113915. this._config = config;
  113916. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  113917. if (this._config.isLive && this._config.autoCleanupSourceBuffer == void 0) {
  113918. this._config.autoCleanupSourceBuffer = true;
  113919. }
  113920. this.e = {
  113921. onSourceOpen: this._onSourceOpen.bind(this),
  113922. onSourceEnded: this._onSourceEnded.bind(this),
  113923. onSourceClose: this._onSourceClose.bind(this),
  113924. onSourceBufferError: this._onSourceBufferError.bind(this),
  113925. onSourceBufferUpdateEnd: this._onSourceBufferUpdateEnd.bind(this)
  113926. };
  113927. this._mediaSource = null;
  113928. this._mediaSourceObjectURL = null;
  113929. this._mediaElement = null;
  113930. this._isBufferFull = false;
  113931. this._hasPendingEos = false;
  113932. this._requireSetMediaDuration = false;
  113933. this._pendingMediaDuration = 0;
  113934. this._pendingSourceBufferInit = [];
  113935. this._mimeTypes = {
  113936. video: null,
  113937. audio: null
  113938. };
  113939. this._sourceBuffers = {
  113940. video: null,
  113941. audio: null
  113942. };
  113943. this._lastInitSegments = {
  113944. video: null,
  113945. audio: null
  113946. };
  113947. this._pendingSegments = {
  113948. video: [],
  113949. audio: []
  113950. };
  113951. this._pendingRemoveRanges = {
  113952. video: [],
  113953. audio: []
  113954. };
  113955. this._idrList = new _media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.IDRSampleList();
  113956. }
  113957. MSEController2.prototype.destroy = function() {
  113958. if (this._mediaElement || this._mediaSource) {
  113959. this.detachMediaElement();
  113960. }
  113961. this.e = null;
  113962. this._emitter.removeAllListeners();
  113963. this._emitter = null;
  113964. };
  113965. MSEController2.prototype.on = function(event2, listener) {
  113966. this._emitter.addListener(event2, listener);
  113967. };
  113968. MSEController2.prototype.off = function(event2, listener) {
  113969. this._emitter.removeListener(event2, listener);
  113970. };
  113971. MSEController2.prototype.attachMediaElement = function(mediaElement) {
  113972. if (this._mediaSource) {
  113973. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__.IllegalStateException("MediaSource has been attached to an HTMLMediaElement!");
  113974. }
  113975. var ms = this._mediaSource = new window.MediaSource();
  113976. ms.addEventListener("sourceopen", this.e.onSourceOpen);
  113977. ms.addEventListener("sourceended", this.e.onSourceEnded);
  113978. ms.addEventListener("sourceclose", this.e.onSourceClose);
  113979. this._mediaElement = mediaElement;
  113980. this._mediaSourceObjectURL = window.URL.createObjectURL(this._mediaSource);
  113981. mediaElement.src = this._mediaSourceObjectURL;
  113982. };
  113983. MSEController2.prototype.detachMediaElement = function() {
  113984. if (this._mediaSource) {
  113985. var ms = this._mediaSource;
  113986. for (var type2 in this._sourceBuffers) {
  113987. var ps = this._pendingSegments[type2];
  113988. ps.splice(0, ps.length);
  113989. this._pendingSegments[type2] = null;
  113990. this._pendingRemoveRanges[type2] = null;
  113991. this._lastInitSegments[type2] = null;
  113992. var sb = this._sourceBuffers[type2];
  113993. if (sb) {
  113994. if (ms.readyState !== "closed") {
  113995. try {
  113996. ms.removeSourceBuffer(sb);
  113997. } catch (error) {
  113998. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  113999. }
  114000. sb.removeEventListener("error", this.e.onSourceBufferError);
  114001. sb.removeEventListener("updateend", this.e.onSourceBufferUpdateEnd);
  114002. }
  114003. this._mimeTypes[type2] = null;
  114004. this._sourceBuffers[type2] = null;
  114005. }
  114006. }
  114007. if (ms.readyState === "open") {
  114008. try {
  114009. ms.endOfStream();
  114010. } catch (error) {
  114011. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114012. }
  114013. }
  114014. ms.removeEventListener("sourceopen", this.e.onSourceOpen);
  114015. ms.removeEventListener("sourceended", this.e.onSourceEnded);
  114016. ms.removeEventListener("sourceclose", this.e.onSourceClose);
  114017. this._pendingSourceBufferInit = [];
  114018. this._isBufferFull = false;
  114019. this._idrList.clear();
  114020. this._mediaSource = null;
  114021. }
  114022. if (this._mediaElement) {
  114023. this._mediaElement.src = "";
  114024. this._mediaElement.removeAttribute("src");
  114025. this._mediaElement = null;
  114026. }
  114027. if (this._mediaSourceObjectURL) {
  114028. window.URL.revokeObjectURL(this._mediaSourceObjectURL);
  114029. this._mediaSourceObjectURL = null;
  114030. }
  114031. };
  114032. MSEController2.prototype.appendInitSegment = function(initSegment, deferred) {
  114033. if (!this._mediaSource || this._mediaSource.readyState !== "open") {
  114034. this._pendingSourceBufferInit.push(initSegment);
  114035. this._pendingSegments[initSegment.type].push(initSegment);
  114036. return;
  114037. }
  114038. var is = initSegment;
  114039. var mimeType = "" + is.container;
  114040. if (is.codec && is.codec.length > 0) {
  114041. mimeType += ";codecs=" + is.codec;
  114042. }
  114043. var firstInitSegment = false;
  114044. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Received Initialization Segment, mimeType: " + mimeType);
  114045. this._lastInitSegments[is.type] = is;
  114046. if (mimeType !== this._mimeTypes[is.type]) {
  114047. if (!this._mimeTypes[is.type]) {
  114048. firstInitSegment = true;
  114049. try {
  114050. var sb = this._sourceBuffers[is.type] = this._mediaSource.addSourceBuffer(mimeType);
  114051. sb.addEventListener("error", this.e.onSourceBufferError);
  114052. sb.addEventListener("updateend", this.e.onSourceBufferUpdateEnd);
  114053. } catch (error) {
  114054. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114055. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, { code: error.code, msg: error.message });
  114056. return;
  114057. }
  114058. } else {
  114059. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Notice: " + is.type + " mimeType changed, origin: " + this._mimeTypes[is.type] + ", target: " + mimeType);
  114060. }
  114061. this._mimeTypes[is.type] = mimeType;
  114062. }
  114063. if (!deferred) {
  114064. this._pendingSegments[is.type].push(is);
  114065. }
  114066. if (!firstInitSegment) {
  114067. if (this._sourceBuffers[is.type] && !this._sourceBuffers[is.type].updating) {
  114068. this._doAppendSegments();
  114069. }
  114070. }
  114071. if (_utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari && is.container === "audio/mpeg" && is.mediaDuration > 0) {
  114072. this._requireSetMediaDuration = true;
  114073. this._pendingMediaDuration = is.mediaDuration / 1e3;
  114074. this._updateMediaSourceDuration();
  114075. }
  114076. };
  114077. MSEController2.prototype.appendMediaSegment = function(mediaSegment) {
  114078. var ms = mediaSegment;
  114079. this._pendingSegments[ms.type].push(ms);
  114080. if (this._config.autoCleanupSourceBuffer && this._needCleanupSourceBuffer()) {
  114081. this._doCleanupSourceBuffer();
  114082. }
  114083. var sb = this._sourceBuffers[ms.type];
  114084. if (sb && !sb.updating && !this._hasPendingRemoveRanges()) {
  114085. this._doAppendSegments();
  114086. }
  114087. };
  114088. MSEController2.prototype.seek = function(seconds) {
  114089. for (var type2 in this._sourceBuffers) {
  114090. if (!this._sourceBuffers[type2]) {
  114091. continue;
  114092. }
  114093. var sb = this._sourceBuffers[type2];
  114094. if (this._mediaSource.readyState === "open") {
  114095. try {
  114096. sb.abort();
  114097. } catch (error) {
  114098. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114099. }
  114100. }
  114101. this._idrList.clear();
  114102. var ps = this._pendingSegments[type2];
  114103. ps.splice(0, ps.length);
  114104. if (this._mediaSource.readyState === "closed") {
  114105. continue;
  114106. }
  114107. for (var i2 = 0; i2 < sb.buffered.length; i2++) {
  114108. var start2 = sb.buffered.start(i2);
  114109. var end = sb.buffered.end(i2);
  114110. this._pendingRemoveRanges[type2].push({ start: start2, end });
  114111. }
  114112. if (!sb.updating) {
  114113. this._doRemoveRanges();
  114114. }
  114115. if (_utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari) {
  114116. var lastInitSegment = this._lastInitSegments[type2];
  114117. if (lastInitSegment) {
  114118. this._pendingSegments[type2].push(lastInitSegment);
  114119. if (!sb.updating) {
  114120. this._doAppendSegments();
  114121. }
  114122. }
  114123. }
  114124. }
  114125. };
  114126. MSEController2.prototype.endOfStream = function() {
  114127. var ms = this._mediaSource;
  114128. var sb = this._sourceBuffers;
  114129. if (!ms || ms.readyState !== "open") {
  114130. if (ms && ms.readyState === "closed" && this._hasPendingSegments()) {
  114131. this._hasPendingEos = true;
  114132. }
  114133. return;
  114134. }
  114135. if (sb.video && sb.video.updating || sb.audio && sb.audio.updating) {
  114136. this._hasPendingEos = true;
  114137. } else {
  114138. this._hasPendingEos = false;
  114139. ms.endOfStream();
  114140. }
  114141. };
  114142. MSEController2.prototype.getNearestKeyframe = function(dts) {
  114143. return this._idrList.getLastSyncPointBeforeDts(dts);
  114144. };
  114145. MSEController2.prototype._needCleanupSourceBuffer = function() {
  114146. if (!this._config.autoCleanupSourceBuffer) {
  114147. return false;
  114148. }
  114149. var currentTime = this._mediaElement.currentTime;
  114150. for (var type2 in this._sourceBuffers) {
  114151. var sb = this._sourceBuffers[type2];
  114152. if (sb) {
  114153. var buffered = sb.buffered;
  114154. if (buffered.length >= 1) {
  114155. if (currentTime - buffered.start(0) >= this._config.autoCleanupMaxBackwardDuration) {
  114156. return true;
  114157. }
  114158. }
  114159. }
  114160. }
  114161. return false;
  114162. };
  114163. MSEController2.prototype._doCleanupSourceBuffer = function() {
  114164. var currentTime = this._mediaElement.currentTime;
  114165. for (var type2 in this._sourceBuffers) {
  114166. var sb = this._sourceBuffers[type2];
  114167. if (sb) {
  114168. var buffered = sb.buffered;
  114169. var doRemove = false;
  114170. for (var i2 = 0; i2 < buffered.length; i2++) {
  114171. var start2 = buffered.start(i2);
  114172. var end = buffered.end(i2);
  114173. if (start2 <= currentTime && currentTime < end + 3) {
  114174. if (currentTime - start2 >= this._config.autoCleanupMaxBackwardDuration) {
  114175. doRemove = true;
  114176. var removeEnd = currentTime - this._config.autoCleanupMinBackwardDuration;
  114177. this._pendingRemoveRanges[type2].push({ start: start2, end: removeEnd });
  114178. }
  114179. } else if (end < currentTime) {
  114180. doRemove = true;
  114181. this._pendingRemoveRanges[type2].push({ start: start2, end });
  114182. }
  114183. }
  114184. if (doRemove && !sb.updating) {
  114185. this._doRemoveRanges();
  114186. }
  114187. }
  114188. }
  114189. };
  114190. MSEController2.prototype._updateMediaSourceDuration = function() {
  114191. var sb = this._sourceBuffers;
  114192. if (this._mediaElement.readyState === 0 || this._mediaSource.readyState !== "open") {
  114193. return;
  114194. }
  114195. if (sb.video && sb.video.updating || sb.audio && sb.audio.updating) {
  114196. return;
  114197. }
  114198. var current = this._mediaSource.duration;
  114199. var target = this._pendingMediaDuration;
  114200. if (target > 0 && (isNaN(current) || target > current)) {
  114201. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Update MediaSource duration from " + current + " to " + target);
  114202. this._mediaSource.duration = target;
  114203. }
  114204. this._requireSetMediaDuration = false;
  114205. this._pendingMediaDuration = 0;
  114206. };
  114207. MSEController2.prototype._doRemoveRanges = function() {
  114208. for (var type2 in this._pendingRemoveRanges) {
  114209. if (!this._sourceBuffers[type2] || this._sourceBuffers[type2].updating) {
  114210. continue;
  114211. }
  114212. var sb = this._sourceBuffers[type2];
  114213. var ranges = this._pendingRemoveRanges[type2];
  114214. while (ranges.length && !sb.updating) {
  114215. var range3 = ranges.shift();
  114216. sb.remove(range3.start, range3.end);
  114217. }
  114218. }
  114219. };
  114220. MSEController2.prototype._doAppendSegments = function() {
  114221. var pendingSegments = this._pendingSegments;
  114222. for (var type2 in pendingSegments) {
  114223. if (!this._sourceBuffers[type2] || this._sourceBuffers[type2].updating) {
  114224. continue;
  114225. }
  114226. if (pendingSegments[type2].length > 0) {
  114227. var segment = pendingSegments[type2].shift();
  114228. if (segment.timestampOffset) {
  114229. var currentOffset = this._sourceBuffers[type2].timestampOffset;
  114230. var targetOffset = segment.timestampOffset / 1e3;
  114231. var delta = Math.abs(currentOffset - targetOffset);
  114232. if (delta > 0.1) {
  114233. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Update MPEG audio timestampOffset from " + currentOffset + " to " + targetOffset);
  114234. this._sourceBuffers[type2].timestampOffset = targetOffset;
  114235. }
  114236. delete segment.timestampOffset;
  114237. }
  114238. if (!segment.data || segment.data.byteLength === 0) {
  114239. continue;
  114240. }
  114241. try {
  114242. this._sourceBuffers[type2].appendBuffer(segment.data);
  114243. this._isBufferFull = false;
  114244. if (type2 === "video" && segment.hasOwnProperty("info")) {
  114245. this._idrList.appendArray(segment.info.syncPoints);
  114246. }
  114247. } catch (error) {
  114248. this._pendingSegments[type2].unshift(segment);
  114249. if (error.code === 22) {
  114250. if (!this._isBufferFull) {
  114251. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.BUFFER_FULL);
  114252. }
  114253. this._isBufferFull = true;
  114254. } else {
  114255. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, error.message);
  114256. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, { code: error.code, msg: error.message });
  114257. }
  114258. }
  114259. }
  114260. }
  114261. };
  114262. MSEController2.prototype._onSourceOpen = function() {
  114263. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "MediaSource onSourceOpen");
  114264. this._mediaSource.removeEventListener("sourceopen", this.e.onSourceOpen);
  114265. if (this._pendingSourceBufferInit.length > 0) {
  114266. var pendings = this._pendingSourceBufferInit;
  114267. while (pendings.length) {
  114268. var segment = pendings.shift();
  114269. this.appendInitSegment(segment, true);
  114270. }
  114271. }
  114272. if (this._hasPendingSegments()) {
  114273. this._doAppendSegments();
  114274. }
  114275. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.SOURCE_OPEN);
  114276. };
  114277. MSEController2.prototype._onSourceEnded = function() {
  114278. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "MediaSource onSourceEnded");
  114279. };
  114280. MSEController2.prototype._onSourceClose = function() {
  114281. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "MediaSource onSourceClose");
  114282. if (this._mediaSource && this.e != null) {
  114283. this._mediaSource.removeEventListener("sourceopen", this.e.onSourceOpen);
  114284. this._mediaSource.removeEventListener("sourceended", this.e.onSourceEnded);
  114285. this._mediaSource.removeEventListener("sourceclose", this.e.onSourceClose);
  114286. }
  114287. };
  114288. MSEController2.prototype._hasPendingSegments = function() {
  114289. var ps = this._pendingSegments;
  114290. return ps.video.length > 0 || ps.audio.length > 0;
  114291. };
  114292. MSEController2.prototype._hasPendingRemoveRanges = function() {
  114293. var prr = this._pendingRemoveRanges;
  114294. return prr.video.length > 0 || prr.audio.length > 0;
  114295. };
  114296. MSEController2.prototype._onSourceBufferUpdateEnd = function() {
  114297. if (this._requireSetMediaDuration) {
  114298. this._updateMediaSourceDuration();
  114299. } else if (this._hasPendingRemoveRanges()) {
  114300. this._doRemoveRanges();
  114301. } else if (this._hasPendingSegments()) {
  114302. this._doAppendSegments();
  114303. } else if (this._hasPendingEos) {
  114304. this.endOfStream();
  114305. }
  114306. this._emitter.emit(_mse_events_js__WEBPACK_IMPORTED_MODULE_3__.default.UPDATE_END);
  114307. };
  114308. MSEController2.prototype._onSourceBufferError = function(e) {
  114309. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, "SourceBuffer Error: " + e);
  114310. };
  114311. return MSEController2;
  114312. }();
  114313. __webpack_exports__2["default"] = MSEController;
  114314. },
  114315. "./src/core/mse-events.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114316. __webpack_require__2.r(__webpack_exports__2);
  114317. var MSEEvents = {
  114318. ERROR: "error",
  114319. SOURCE_OPEN: "source_open",
  114320. UPDATE_END: "update_end",
  114321. BUFFER_FULL: "buffer_full"
  114322. };
  114323. __webpack_exports__2["default"] = MSEEvents;
  114324. },
  114325. "./src/core/transmuxer.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114326. __webpack_require__2.r(__webpack_exports__2);
  114327. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  114328. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  114329. var webworkify_webpack__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./node_modules/webworkify-webpack/index.js");
  114330. var webworkify_webpack__WEBPACK_IMPORTED_MODULE_1___default = /* @__PURE__ */ __webpack_require__2.n(webworkify_webpack__WEBPACK_IMPORTED_MODULE_1__);
  114331. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/logger.js");
  114332. var _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/utils/logging-control.js");
  114333. var _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/transmuxing-controller.js");
  114334. var _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/core/transmuxing-events.js");
  114335. var _media_info_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/core/media-info.js");
  114336. var Transmuxer = function() {
  114337. function Transmuxer2(mediaDataSource, config) {
  114338. this.TAG = "Transmuxer";
  114339. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  114340. if (config.enableWorker && typeof Worker !== "undefined") {
  114341. try {
  114342. this._worker = webworkify_webpack__WEBPACK_IMPORTED_MODULE_1___default()("./src/core/transmuxing-worker.js");
  114343. this._workerDestroying = false;
  114344. this._worker.addEventListener("message", this._onWorkerMessage.bind(this));
  114345. this._worker.postMessage({ cmd: "init", param: [mediaDataSource, config] });
  114346. this.e = {
  114347. onLoggingConfigChanged: this._onLoggingConfigChanged.bind(this)
  114348. };
  114349. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_3__.default.registerListener(this.e.onLoggingConfigChanged);
  114350. this._worker.postMessage({ cmd: "logging_config", param: _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_3__.default.getConfig() });
  114351. } catch (error) {
  114352. _utils_logger_js__WEBPACK_IMPORTED_MODULE_2__.default.e(this.TAG, "Error while initialize transmuxing worker, fallback to inline transmuxing");
  114353. this._worker = null;
  114354. this._controller = new _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_4__.default(mediaDataSource, config);
  114355. }
  114356. } else {
  114357. this._controller = new _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_4__.default(mediaDataSource, config);
  114358. }
  114359. if (this._controller) {
  114360. var ctl = this._controller;
  114361. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.IO_ERROR, this._onIOError.bind(this));
  114362. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.DEMUX_ERROR, this._onDemuxError.bind(this));
  114363. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.INIT_SEGMENT, this._onInitSegment.bind(this));
  114364. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_SEGMENT, this._onMediaSegment.bind(this));
  114365. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.LOADING_COMPLETE, this._onLoadingComplete.bind(this));
  114366. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOVERED_EARLY_EOF, this._onRecoveredEarlyEof.bind(this));
  114367. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_INFO, this._onMediaInfo.bind(this));
  114368. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.METADATA_ARRIVED, this._onMetaDataArrived.bind(this));
  114369. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.SCRIPTDATA_ARRIVED, this._onScriptDataArrived.bind(this));
  114370. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.STATISTICS_INFO, this._onStatisticsInfo.bind(this));
  114371. ctl.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOMMEND_SEEKPOINT, this._onRecommendSeekpoint.bind(this));
  114372. }
  114373. }
  114374. Transmuxer2.prototype.destroy = function() {
  114375. if (this._worker) {
  114376. if (!this._workerDestroying) {
  114377. this._workerDestroying = true;
  114378. this._worker.postMessage({ cmd: "destroy" });
  114379. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_3__.default.removeListener(this.e.onLoggingConfigChanged);
  114380. this.e = null;
  114381. }
  114382. } else {
  114383. this._controller.destroy();
  114384. this._controller = null;
  114385. }
  114386. this._emitter.removeAllListeners();
  114387. this._emitter = null;
  114388. };
  114389. Transmuxer2.prototype.on = function(event2, listener) {
  114390. this._emitter.addListener(event2, listener);
  114391. };
  114392. Transmuxer2.prototype.off = function(event2, listener) {
  114393. this._emitter.removeListener(event2, listener);
  114394. };
  114395. Transmuxer2.prototype.hasWorker = function() {
  114396. return this._worker != null;
  114397. };
  114398. Transmuxer2.prototype.open = function() {
  114399. if (this._worker) {
  114400. this._worker.postMessage({ cmd: "start" });
  114401. } else {
  114402. this._controller.start();
  114403. }
  114404. };
  114405. Transmuxer2.prototype.close = function() {
  114406. if (this._worker) {
  114407. this._worker.postMessage({ cmd: "stop" });
  114408. } else {
  114409. this._controller.stop();
  114410. }
  114411. };
  114412. Transmuxer2.prototype.seek = function(milliseconds) {
  114413. if (this._worker) {
  114414. this._worker.postMessage({ cmd: "seek", param: milliseconds });
  114415. } else {
  114416. this._controller.seek(milliseconds);
  114417. }
  114418. };
  114419. Transmuxer2.prototype.pause = function() {
  114420. if (this._worker) {
  114421. this._worker.postMessage({ cmd: "pause" });
  114422. } else {
  114423. this._controller.pause();
  114424. }
  114425. };
  114426. Transmuxer2.prototype.resume = function() {
  114427. if (this._worker) {
  114428. this._worker.postMessage({ cmd: "resume" });
  114429. } else {
  114430. this._controller.resume();
  114431. }
  114432. };
  114433. Transmuxer2.prototype._onInitSegment = function(type2, initSegment) {
  114434. var _this = this;
  114435. Promise.resolve().then(function() {
  114436. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.INIT_SEGMENT, type2, initSegment);
  114437. });
  114438. };
  114439. Transmuxer2.prototype._onMediaSegment = function(type2, mediaSegment) {
  114440. var _this = this;
  114441. Promise.resolve().then(function() {
  114442. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_SEGMENT, type2, mediaSegment);
  114443. });
  114444. };
  114445. Transmuxer2.prototype._onLoadingComplete = function() {
  114446. var _this = this;
  114447. Promise.resolve().then(function() {
  114448. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.LOADING_COMPLETE);
  114449. });
  114450. };
  114451. Transmuxer2.prototype._onRecoveredEarlyEof = function() {
  114452. var _this = this;
  114453. Promise.resolve().then(function() {
  114454. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOVERED_EARLY_EOF);
  114455. });
  114456. };
  114457. Transmuxer2.prototype._onMediaInfo = function(mediaInfo) {
  114458. var _this = this;
  114459. Promise.resolve().then(function() {
  114460. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_INFO, mediaInfo);
  114461. });
  114462. };
  114463. Transmuxer2.prototype._onMetaDataArrived = function(metadata) {
  114464. var _this = this;
  114465. Promise.resolve().then(function() {
  114466. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.METADATA_ARRIVED, metadata);
  114467. });
  114468. };
  114469. Transmuxer2.prototype._onScriptDataArrived = function(data) {
  114470. var _this = this;
  114471. Promise.resolve().then(function() {
  114472. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.SCRIPTDATA_ARRIVED, data);
  114473. });
  114474. };
  114475. Transmuxer2.prototype._onStatisticsInfo = function(statisticsInfo) {
  114476. var _this = this;
  114477. Promise.resolve().then(function() {
  114478. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.STATISTICS_INFO, statisticsInfo);
  114479. });
  114480. };
  114481. Transmuxer2.prototype._onIOError = function(type2, info) {
  114482. var _this = this;
  114483. Promise.resolve().then(function() {
  114484. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.IO_ERROR, type2, info);
  114485. });
  114486. };
  114487. Transmuxer2.prototype._onDemuxError = function(type2, info) {
  114488. var _this = this;
  114489. Promise.resolve().then(function() {
  114490. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.DEMUX_ERROR, type2, info);
  114491. });
  114492. };
  114493. Transmuxer2.prototype._onRecommendSeekpoint = function(milliseconds) {
  114494. var _this = this;
  114495. Promise.resolve().then(function() {
  114496. _this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOMMEND_SEEKPOINT, milliseconds);
  114497. });
  114498. };
  114499. Transmuxer2.prototype._onLoggingConfigChanged = function(config) {
  114500. if (this._worker) {
  114501. this._worker.postMessage({ cmd: "logging_config", param: config });
  114502. }
  114503. };
  114504. Transmuxer2.prototype._onWorkerMessage = function(e) {
  114505. var message = e.data;
  114506. var data = message.data;
  114507. if (message.msg === "destroyed" || this._workerDestroying) {
  114508. this._workerDestroying = false;
  114509. this._worker.terminate();
  114510. this._worker = null;
  114511. return;
  114512. }
  114513. switch (message.msg) {
  114514. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.INIT_SEGMENT:
  114515. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_SEGMENT:
  114516. this._emitter.emit(message.msg, data.type, data.data);
  114517. break;
  114518. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.LOADING_COMPLETE:
  114519. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOVERED_EARLY_EOF:
  114520. this._emitter.emit(message.msg);
  114521. break;
  114522. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_INFO:
  114523. Object.setPrototypeOf(data, _media_info_js__WEBPACK_IMPORTED_MODULE_6__.default.prototype);
  114524. this._emitter.emit(message.msg, data);
  114525. break;
  114526. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.METADATA_ARRIVED:
  114527. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.SCRIPTDATA_ARRIVED:
  114528. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.STATISTICS_INFO:
  114529. this._emitter.emit(message.msg, data);
  114530. break;
  114531. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.IO_ERROR:
  114532. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.DEMUX_ERROR:
  114533. this._emitter.emit(message.msg, data.type, data.info);
  114534. break;
  114535. case _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOMMEND_SEEKPOINT:
  114536. this._emitter.emit(message.msg, data);
  114537. break;
  114538. case "logcat_callback":
  114539. _utils_logger_js__WEBPACK_IMPORTED_MODULE_2__.default.emitter.emit("log", data.type, data.logcat);
  114540. break;
  114541. }
  114542. };
  114543. return Transmuxer2;
  114544. }();
  114545. __webpack_exports__2["default"] = Transmuxer;
  114546. },
  114547. "./src/core/transmuxing-controller.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114548. __webpack_require__2.r(__webpack_exports__2);
  114549. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  114550. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  114551. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/logger.js");
  114552. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/browser.js");
  114553. var _media_info_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/core/media-info.js");
  114554. var _demux_flv_demuxer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/demux/flv-demuxer.js");
  114555. var _remux_mp4_remuxer_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/remux/mp4-remuxer.js");
  114556. var _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/demux/demux-errors.js");
  114557. var _io_io_controller_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__2("./src/io/io-controller.js");
  114558. var _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__2("./src/core/transmuxing-events.js");
  114559. var TransmuxingController = function() {
  114560. function TransmuxingController2(mediaDataSource, config) {
  114561. this.TAG = "TransmuxingController";
  114562. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  114563. this._config = config;
  114564. if (!mediaDataSource.segments) {
  114565. mediaDataSource.segments = [{
  114566. duration: mediaDataSource.duration,
  114567. filesize: mediaDataSource.filesize,
  114568. url: mediaDataSource.url
  114569. }];
  114570. }
  114571. if (typeof mediaDataSource.cors !== "boolean") {
  114572. mediaDataSource.cors = true;
  114573. }
  114574. if (typeof mediaDataSource.withCredentials !== "boolean") {
  114575. mediaDataSource.withCredentials = false;
  114576. }
  114577. this._mediaDataSource = mediaDataSource;
  114578. this._currentSegmentIndex = 0;
  114579. var totalDuration = 0;
  114580. this._mediaDataSource.segments.forEach(function(segment) {
  114581. segment.timestampBase = totalDuration;
  114582. totalDuration += segment.duration;
  114583. segment.cors = mediaDataSource.cors;
  114584. segment.withCredentials = mediaDataSource.withCredentials;
  114585. if (config.referrerPolicy) {
  114586. segment.referrerPolicy = config.referrerPolicy;
  114587. }
  114588. });
  114589. if (!isNaN(totalDuration) && this._mediaDataSource.duration !== totalDuration) {
  114590. this._mediaDataSource.duration = totalDuration;
  114591. }
  114592. this._mediaInfo = null;
  114593. this._demuxer = null;
  114594. this._remuxer = null;
  114595. this._ioctl = null;
  114596. this._pendingSeekTime = null;
  114597. this._pendingResolveSeekPoint = null;
  114598. this._statisticsReporter = null;
  114599. }
  114600. TransmuxingController2.prototype.destroy = function() {
  114601. this._mediaInfo = null;
  114602. this._mediaDataSource = null;
  114603. if (this._statisticsReporter) {
  114604. this._disableStatisticsReporter();
  114605. }
  114606. if (this._ioctl) {
  114607. this._ioctl.destroy();
  114608. this._ioctl = null;
  114609. }
  114610. if (this._demuxer) {
  114611. this._demuxer.destroy();
  114612. this._demuxer = null;
  114613. }
  114614. if (this._remuxer) {
  114615. this._remuxer.destroy();
  114616. this._remuxer = null;
  114617. }
  114618. this._emitter.removeAllListeners();
  114619. this._emitter = null;
  114620. };
  114621. TransmuxingController2.prototype.on = function(event2, listener) {
  114622. this._emitter.addListener(event2, listener);
  114623. };
  114624. TransmuxingController2.prototype.off = function(event2, listener) {
  114625. this._emitter.removeListener(event2, listener);
  114626. };
  114627. TransmuxingController2.prototype.start = function() {
  114628. this._loadSegment(0);
  114629. this._enableStatisticsReporter();
  114630. };
  114631. TransmuxingController2.prototype._loadSegment = function(segmentIndex, optionalFrom) {
  114632. this._currentSegmentIndex = segmentIndex;
  114633. var dataSource = this._mediaDataSource.segments[segmentIndex];
  114634. var ioctl = this._ioctl = new _io_io_controller_js__WEBPACK_IMPORTED_MODULE_7__.default(dataSource, this._config, segmentIndex);
  114635. ioctl.onError = this._onIOException.bind(this);
  114636. ioctl.onSeeked = this._onIOSeeked.bind(this);
  114637. ioctl.onComplete = this._onIOComplete.bind(this);
  114638. ioctl.onRedirect = this._onIORedirect.bind(this);
  114639. ioctl.onRecoveredEarlyEof = this._onIORecoveredEarlyEof.bind(this);
  114640. if (optionalFrom) {
  114641. this._demuxer.bindDataSource(this._ioctl);
  114642. } else {
  114643. ioctl.onDataArrival = this._onInitChunkArrival.bind(this);
  114644. }
  114645. ioctl.open(optionalFrom);
  114646. };
  114647. TransmuxingController2.prototype.stop = function() {
  114648. this._internalAbort();
  114649. this._disableStatisticsReporter();
  114650. };
  114651. TransmuxingController2.prototype._internalAbort = function() {
  114652. if (this._ioctl) {
  114653. this._ioctl.destroy();
  114654. this._ioctl = null;
  114655. }
  114656. };
  114657. TransmuxingController2.prototype.pause = function() {
  114658. if (this._ioctl && this._ioctl.isWorking()) {
  114659. this._ioctl.pause();
  114660. this._disableStatisticsReporter();
  114661. }
  114662. };
  114663. TransmuxingController2.prototype.resume = function() {
  114664. if (this._ioctl && this._ioctl.isPaused()) {
  114665. this._ioctl.resume();
  114666. this._enableStatisticsReporter();
  114667. }
  114668. };
  114669. TransmuxingController2.prototype.seek = function(milliseconds) {
  114670. if (this._mediaInfo == null || !this._mediaInfo.isSeekable()) {
  114671. return;
  114672. }
  114673. var targetSegmentIndex = this._searchSegmentIndexContains(milliseconds);
  114674. if (targetSegmentIndex === this._currentSegmentIndex) {
  114675. var segmentInfo = this._mediaInfo.segments[targetSegmentIndex];
  114676. if (segmentInfo == void 0) {
  114677. this._pendingSeekTime = milliseconds;
  114678. } else {
  114679. var keyframe = segmentInfo.getNearestKeyframe(milliseconds);
  114680. this._remuxer.seek(keyframe.milliseconds);
  114681. this._ioctl.seek(keyframe.fileposition);
  114682. this._pendingResolveSeekPoint = keyframe.milliseconds;
  114683. }
  114684. } else {
  114685. var targetSegmentInfo = this._mediaInfo.segments[targetSegmentIndex];
  114686. if (targetSegmentInfo == void 0) {
  114687. this._pendingSeekTime = milliseconds;
  114688. this._internalAbort();
  114689. this._remuxer.seek();
  114690. this._remuxer.insertDiscontinuity();
  114691. this._loadSegment(targetSegmentIndex);
  114692. } else {
  114693. var keyframe = targetSegmentInfo.getNearestKeyframe(milliseconds);
  114694. this._internalAbort();
  114695. this._remuxer.seek(milliseconds);
  114696. this._remuxer.insertDiscontinuity();
  114697. this._demuxer.resetMediaInfo();
  114698. this._demuxer.timestampBase = this._mediaDataSource.segments[targetSegmentIndex].timestampBase;
  114699. this._loadSegment(targetSegmentIndex, keyframe.fileposition);
  114700. this._pendingResolveSeekPoint = keyframe.milliseconds;
  114701. this._reportSegmentMediaInfo(targetSegmentIndex);
  114702. }
  114703. }
  114704. this._enableStatisticsReporter();
  114705. };
  114706. TransmuxingController2.prototype._searchSegmentIndexContains = function(milliseconds) {
  114707. var segments = this._mediaDataSource.segments;
  114708. var idx = segments.length - 1;
  114709. for (var i2 = 0; i2 < segments.length; i2++) {
  114710. if (milliseconds < segments[i2].timestampBase) {
  114711. idx = i2 - 1;
  114712. break;
  114713. }
  114714. }
  114715. return idx;
  114716. };
  114717. TransmuxingController2.prototype._onInitChunkArrival = function(data, byteStart) {
  114718. var _this = this;
  114719. var probeData = null;
  114720. var consumed = 0;
  114721. if (byteStart > 0) {
  114722. this._demuxer.bindDataSource(this._ioctl);
  114723. this._demuxer.timestampBase = this._mediaDataSource.segments[this._currentSegmentIndex].timestampBase;
  114724. consumed = this._demuxer.parseChunks(data, byteStart);
  114725. } else if ((probeData = _demux_flv_demuxer_js__WEBPACK_IMPORTED_MODULE_4__.default.probe(data)).match) {
  114726. this._demuxer = new _demux_flv_demuxer_js__WEBPACK_IMPORTED_MODULE_4__.default(probeData, this._config);
  114727. if (!this._remuxer) {
  114728. this._remuxer = new _remux_mp4_remuxer_js__WEBPACK_IMPORTED_MODULE_5__.default(this._config);
  114729. }
  114730. var mds = this._mediaDataSource;
  114731. if (mds.duration != void 0 && !isNaN(mds.duration)) {
  114732. this._demuxer.overridedDuration = mds.duration;
  114733. }
  114734. if (typeof mds.hasAudio === "boolean") {
  114735. this._demuxer.overridedHasAudio = mds.hasAudio;
  114736. }
  114737. if (typeof mds.hasVideo === "boolean") {
  114738. this._demuxer.overridedHasVideo = mds.hasVideo;
  114739. }
  114740. this._demuxer.timestampBase = mds.segments[this._currentSegmentIndex].timestampBase;
  114741. this._demuxer.onError = this._onDemuxException.bind(this);
  114742. this._demuxer.onMediaInfo = this._onMediaInfo.bind(this);
  114743. this._demuxer.onMetaDataArrived = this._onMetaDataArrived.bind(this);
  114744. this._demuxer.onScriptDataArrived = this._onScriptDataArrived.bind(this);
  114745. this._remuxer.bindDataSource(this._demuxer.bindDataSource(this._ioctl));
  114746. this._remuxer.onInitSegment = this._onRemuxerInitSegmentArrival.bind(this);
  114747. this._remuxer.onMediaSegment = this._onRemuxerMediaSegmentArrival.bind(this);
  114748. consumed = this._demuxer.parseChunks(data, byteStart);
  114749. } else {
  114750. probeData = null;
  114751. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, "Non-FLV, Unsupported media type!");
  114752. Promise.resolve().then(function() {
  114753. _this._internalAbort();
  114754. });
  114755. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.DEMUX_ERROR, _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_6__.default.FORMAT_UNSUPPORTED, "Non-FLV, Unsupported media type");
  114756. consumed = 0;
  114757. }
  114758. return consumed;
  114759. };
  114760. TransmuxingController2.prototype._onMediaInfo = function(mediaInfo) {
  114761. var _this = this;
  114762. if (this._mediaInfo == null) {
  114763. this._mediaInfo = Object.assign({}, mediaInfo);
  114764. this._mediaInfo.keyframesIndex = null;
  114765. this._mediaInfo.segments = [];
  114766. this._mediaInfo.segmentCount = this._mediaDataSource.segments.length;
  114767. Object.setPrototypeOf(this._mediaInfo, _media_info_js__WEBPACK_IMPORTED_MODULE_3__.default.prototype);
  114768. }
  114769. var segmentInfo = Object.assign({}, mediaInfo);
  114770. Object.setPrototypeOf(segmentInfo, _media_info_js__WEBPACK_IMPORTED_MODULE_3__.default.prototype);
  114771. this._mediaInfo.segments[this._currentSegmentIndex] = segmentInfo;
  114772. this._reportSegmentMediaInfo(this._currentSegmentIndex);
  114773. if (this._pendingSeekTime != null) {
  114774. Promise.resolve().then(function() {
  114775. var target = _this._pendingSeekTime;
  114776. _this._pendingSeekTime = null;
  114777. _this.seek(target);
  114778. });
  114779. }
  114780. };
  114781. TransmuxingController2.prototype._onMetaDataArrived = function(metadata) {
  114782. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.METADATA_ARRIVED, metadata);
  114783. };
  114784. TransmuxingController2.prototype._onScriptDataArrived = function(data) {
  114785. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.SCRIPTDATA_ARRIVED, data);
  114786. };
  114787. TransmuxingController2.prototype._onIOSeeked = function() {
  114788. this._remuxer.insertDiscontinuity();
  114789. };
  114790. TransmuxingController2.prototype._onIOComplete = function(extraData) {
  114791. var segmentIndex = extraData;
  114792. var nextSegmentIndex = segmentIndex + 1;
  114793. if (nextSegmentIndex < this._mediaDataSource.segments.length) {
  114794. this._internalAbort();
  114795. this._remuxer.flushStashedSamples();
  114796. this._loadSegment(nextSegmentIndex);
  114797. } else {
  114798. this._remuxer.flushStashedSamples();
  114799. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.LOADING_COMPLETE);
  114800. this._disableStatisticsReporter();
  114801. }
  114802. };
  114803. TransmuxingController2.prototype._onIORedirect = function(redirectedURL) {
  114804. var segmentIndex = this._ioctl.extraData;
  114805. this._mediaDataSource.segments[segmentIndex].redirectedURL = redirectedURL;
  114806. };
  114807. TransmuxingController2.prototype._onIORecoveredEarlyEof = function() {
  114808. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.RECOVERED_EARLY_EOF);
  114809. };
  114810. TransmuxingController2.prototype._onIOException = function(type2, info) {
  114811. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, "IOException: type = " + type2 + ", code = " + info.code + ", msg = " + info.msg);
  114812. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.IO_ERROR, type2, info);
  114813. this._disableStatisticsReporter();
  114814. };
  114815. TransmuxingController2.prototype._onDemuxException = function(type2, info) {
  114816. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.e(this.TAG, "DemuxException: type = " + type2 + ", info = " + info);
  114817. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.DEMUX_ERROR, type2, info);
  114818. };
  114819. TransmuxingController2.prototype._onRemuxerInitSegmentArrival = function(type2, initSegment) {
  114820. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.INIT_SEGMENT, type2, initSegment);
  114821. };
  114822. TransmuxingController2.prototype._onRemuxerMediaSegmentArrival = function(type2, mediaSegment) {
  114823. if (this._pendingSeekTime != null) {
  114824. return;
  114825. }
  114826. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.MEDIA_SEGMENT, type2, mediaSegment);
  114827. if (this._pendingResolveSeekPoint != null && type2 === "video") {
  114828. var syncPoints = mediaSegment.info.syncPoints;
  114829. var seekpoint = this._pendingResolveSeekPoint;
  114830. this._pendingResolveSeekPoint = null;
  114831. if (_utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari && syncPoints.length > 0 && syncPoints[0].originalDts === seekpoint) {
  114832. seekpoint = syncPoints[0].pts;
  114833. }
  114834. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.RECOMMEND_SEEKPOINT, seekpoint);
  114835. }
  114836. };
  114837. TransmuxingController2.prototype._enableStatisticsReporter = function() {
  114838. if (this._statisticsReporter == null) {
  114839. this._statisticsReporter = self.setInterval(this._reportStatisticsInfo.bind(this), this._config.statisticsInfoReportInterval);
  114840. }
  114841. };
  114842. TransmuxingController2.prototype._disableStatisticsReporter = function() {
  114843. if (this._statisticsReporter) {
  114844. self.clearInterval(this._statisticsReporter);
  114845. this._statisticsReporter = null;
  114846. }
  114847. };
  114848. TransmuxingController2.prototype._reportSegmentMediaInfo = function(segmentIndex) {
  114849. var segmentInfo = this._mediaInfo.segments[segmentIndex];
  114850. var exportInfo = Object.assign({}, segmentInfo);
  114851. exportInfo.duration = this._mediaInfo.duration;
  114852. exportInfo.segmentCount = this._mediaInfo.segmentCount;
  114853. delete exportInfo.segments;
  114854. delete exportInfo.keyframesIndex;
  114855. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.MEDIA_INFO, exportInfo);
  114856. };
  114857. TransmuxingController2.prototype._reportStatisticsInfo = function() {
  114858. var info = {};
  114859. info.url = this._ioctl.currentURL;
  114860. info.hasRedirect = this._ioctl.hasRedirect;
  114861. if (info.hasRedirect) {
  114862. info.redirectedURL = this._ioctl.currentRedirectedURL;
  114863. }
  114864. info.speed = this._ioctl.currentSpeed;
  114865. info.loaderType = this._ioctl.loaderType;
  114866. info.currentSegmentIndex = this._currentSegmentIndex;
  114867. info.totalSegmentCount = this._mediaDataSource.segments.length;
  114868. this._emitter.emit(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_8__.default.STATISTICS_INFO, info);
  114869. };
  114870. return TransmuxingController2;
  114871. }();
  114872. __webpack_exports__2["default"] = TransmuxingController;
  114873. },
  114874. "./src/core/transmuxing-events.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114875. __webpack_require__2.r(__webpack_exports__2);
  114876. var TransmuxingEvents = {
  114877. IO_ERROR: "io_error",
  114878. DEMUX_ERROR: "demux_error",
  114879. INIT_SEGMENT: "init_segment",
  114880. MEDIA_SEGMENT: "media_segment",
  114881. LOADING_COMPLETE: "loading_complete",
  114882. RECOVERED_EARLY_EOF: "recovered_early_eof",
  114883. MEDIA_INFO: "media_info",
  114884. METADATA_ARRIVED: "metadata_arrived",
  114885. SCRIPTDATA_ARRIVED: "scriptdata_arrived",
  114886. STATISTICS_INFO: "statistics_info",
  114887. RECOMMEND_SEEKPOINT: "recommend_seekpoint"
  114888. };
  114889. __webpack_exports__2["default"] = TransmuxingEvents;
  114890. },
  114891. "./src/core/transmuxing-worker.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  114892. __webpack_require__2.r(__webpack_exports__2);
  114893. var _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logging-control.js");
  114894. var _utils_polyfill_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/polyfill.js");
  114895. var _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/core/transmuxing-controller.js");
  114896. var _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/core/transmuxing-events.js");
  114897. var TransmuxingWorker = function(self2) {
  114898. var controller = null;
  114899. var logcatListener = onLogcatCallback.bind(this);
  114900. _utils_polyfill_js__WEBPACK_IMPORTED_MODULE_1__.default.install();
  114901. self2.addEventListener("message", function(e) {
  114902. switch (e.data.cmd) {
  114903. case "init":
  114904. controller = new _transmuxing_controller_js__WEBPACK_IMPORTED_MODULE_2__.default(e.data.param[0], e.data.param[1]);
  114905. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.IO_ERROR, onIOError.bind(this));
  114906. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.DEMUX_ERROR, onDemuxError.bind(this));
  114907. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.INIT_SEGMENT, onInitSegment.bind(this));
  114908. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_SEGMENT, onMediaSegment.bind(this));
  114909. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.LOADING_COMPLETE, onLoadingComplete.bind(this));
  114910. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOVERED_EARLY_EOF, onRecoveredEarlyEof.bind(this));
  114911. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO, onMediaInfo.bind(this));
  114912. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.METADATA_ARRIVED, onMetaDataArrived.bind(this));
  114913. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.SCRIPTDATA_ARRIVED, onScriptDataArrived.bind(this));
  114914. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO, onStatisticsInfo.bind(this));
  114915. controller.on(_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOMMEND_SEEKPOINT, onRecommendSeekpoint.bind(this));
  114916. break;
  114917. case "destroy":
  114918. if (controller) {
  114919. controller.destroy();
  114920. controller = null;
  114921. }
  114922. self2.postMessage({ msg: "destroyed" });
  114923. break;
  114924. case "start":
  114925. controller.start();
  114926. break;
  114927. case "stop":
  114928. controller.stop();
  114929. break;
  114930. case "seek":
  114931. controller.seek(e.data.param);
  114932. break;
  114933. case "pause":
  114934. controller.pause();
  114935. break;
  114936. case "resume":
  114937. controller.resume();
  114938. break;
  114939. case "logging_config": {
  114940. var config = e.data.param;
  114941. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_0__.default.applyConfig(config);
  114942. if (config.enableCallback === true) {
  114943. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_0__.default.addLogListener(logcatListener);
  114944. } else {
  114945. _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_0__.default.removeLogListener(logcatListener);
  114946. }
  114947. break;
  114948. }
  114949. }
  114950. });
  114951. function onInitSegment(type2, initSegment) {
  114952. var obj = {
  114953. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.INIT_SEGMENT,
  114954. data: {
  114955. type: type2,
  114956. data: initSegment
  114957. }
  114958. };
  114959. self2.postMessage(obj, [initSegment.data]);
  114960. }
  114961. function onMediaSegment(type2, mediaSegment) {
  114962. var obj = {
  114963. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_SEGMENT,
  114964. data: {
  114965. type: type2,
  114966. data: mediaSegment
  114967. }
  114968. };
  114969. self2.postMessage(obj, [mediaSegment.data]);
  114970. }
  114971. function onLoadingComplete() {
  114972. var obj = {
  114973. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.LOADING_COMPLETE
  114974. };
  114975. self2.postMessage(obj);
  114976. }
  114977. function onRecoveredEarlyEof() {
  114978. var obj = {
  114979. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOVERED_EARLY_EOF
  114980. };
  114981. self2.postMessage(obj);
  114982. }
  114983. function onMediaInfo(mediaInfo) {
  114984. var obj = {
  114985. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO,
  114986. data: mediaInfo
  114987. };
  114988. self2.postMessage(obj);
  114989. }
  114990. function onMetaDataArrived(metadata) {
  114991. var obj = {
  114992. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.METADATA_ARRIVED,
  114993. data: metadata
  114994. };
  114995. self2.postMessage(obj);
  114996. }
  114997. function onScriptDataArrived(data) {
  114998. var obj = {
  114999. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.SCRIPTDATA_ARRIVED,
  115000. data
  115001. };
  115002. self2.postMessage(obj);
  115003. }
  115004. function onStatisticsInfo(statInfo) {
  115005. var obj = {
  115006. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO,
  115007. data: statInfo
  115008. };
  115009. self2.postMessage(obj);
  115010. }
  115011. function onIOError(type2, info) {
  115012. self2.postMessage({
  115013. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.IO_ERROR,
  115014. data: {
  115015. type: type2,
  115016. info
  115017. }
  115018. });
  115019. }
  115020. function onDemuxError(type2, info) {
  115021. self2.postMessage({
  115022. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.DEMUX_ERROR,
  115023. data: {
  115024. type: type2,
  115025. info
  115026. }
  115027. });
  115028. }
  115029. function onRecommendSeekpoint(milliseconds) {
  115030. self2.postMessage({
  115031. msg: _transmuxing_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOMMEND_SEEKPOINT,
  115032. data: milliseconds
  115033. });
  115034. }
  115035. function onLogcatCallback(type2, str) {
  115036. self2.postMessage({
  115037. msg: "logcat_callback",
  115038. data: {
  115039. type: type2,
  115040. logcat: str
  115041. }
  115042. });
  115043. }
  115044. };
  115045. __webpack_exports__2["default"] = TransmuxingWorker;
  115046. },
  115047. "./src/demux/amf-parser.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115048. __webpack_require__2.r(__webpack_exports__2);
  115049. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  115050. var _utils_utf8_conv_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/utf8-conv.js");
  115051. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/exception.js");
  115052. var le = function() {
  115053. var buf = new ArrayBuffer(2);
  115054. new DataView(buf).setInt16(0, 256, true);
  115055. return new Int16Array(buf)[0] === 256;
  115056. }();
  115057. var AMF = function() {
  115058. function AMF2() {
  115059. }
  115060. AMF2.parseScriptData = function(arrayBuffer, dataOffset, dataSize) {
  115061. var data = {};
  115062. try {
  115063. var name_1 = AMF2.parseValue(arrayBuffer, dataOffset, dataSize);
  115064. var value = AMF2.parseValue(arrayBuffer, dataOffset + name_1.size, dataSize - name_1.size);
  115065. data[name_1.data] = value.data;
  115066. } catch (e) {
  115067. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.e("AMF", e.toString());
  115068. }
  115069. return data;
  115070. };
  115071. AMF2.parseObject = function(arrayBuffer, dataOffset, dataSize) {
  115072. if (dataSize < 3) {
  115073. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data not enough when parse ScriptDataObject");
  115074. }
  115075. var name = AMF2.parseString(arrayBuffer, dataOffset, dataSize);
  115076. var value = AMF2.parseValue(arrayBuffer, dataOffset + name.size, dataSize - name.size);
  115077. var isObjectEnd = value.objectEnd;
  115078. return {
  115079. data: {
  115080. name: name.data,
  115081. value: value.data
  115082. },
  115083. size: name.size + value.size,
  115084. objectEnd: isObjectEnd
  115085. };
  115086. };
  115087. AMF2.parseVariable = function(arrayBuffer, dataOffset, dataSize) {
  115088. return AMF2.parseObject(arrayBuffer, dataOffset, dataSize);
  115089. };
  115090. AMF2.parseString = function(arrayBuffer, dataOffset, dataSize) {
  115091. if (dataSize < 2) {
  115092. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data not enough when parse String");
  115093. }
  115094. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115095. var length = v.getUint16(0, !le);
  115096. var str;
  115097. if (length > 0) {
  115098. str = (0, _utils_utf8_conv_js__WEBPACK_IMPORTED_MODULE_1__.default)(new Uint8Array(arrayBuffer, dataOffset + 2, length));
  115099. } else {
  115100. str = "";
  115101. }
  115102. return {
  115103. data: str,
  115104. size: 2 + length
  115105. };
  115106. };
  115107. AMF2.parseLongString = function(arrayBuffer, dataOffset, dataSize) {
  115108. if (dataSize < 4) {
  115109. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data not enough when parse LongString");
  115110. }
  115111. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115112. var length = v.getUint32(0, !le);
  115113. var str;
  115114. if (length > 0) {
  115115. str = (0, _utils_utf8_conv_js__WEBPACK_IMPORTED_MODULE_1__.default)(new Uint8Array(arrayBuffer, dataOffset + 4, length));
  115116. } else {
  115117. str = "";
  115118. }
  115119. return {
  115120. data: str,
  115121. size: 4 + length
  115122. };
  115123. };
  115124. AMF2.parseDate = function(arrayBuffer, dataOffset, dataSize) {
  115125. if (dataSize < 10) {
  115126. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data size invalid when parse Date");
  115127. }
  115128. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115129. var timestamp = v.getFloat64(0, !le);
  115130. var localTimeOffset = v.getInt16(8, !le);
  115131. timestamp += localTimeOffset * 60 * 1e3;
  115132. return {
  115133. data: new Date(timestamp),
  115134. size: 8 + 2
  115135. };
  115136. };
  115137. AMF2.parseValue = function(arrayBuffer, dataOffset, dataSize) {
  115138. if (dataSize < 1) {
  115139. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.IllegalStateException("Data not enough when parse Value");
  115140. }
  115141. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115142. var offset = 1;
  115143. var type2 = v.getUint8(0);
  115144. var value;
  115145. var objectEnd = false;
  115146. try {
  115147. switch (type2) {
  115148. case 0:
  115149. value = v.getFloat64(1, !le);
  115150. offset += 8;
  115151. break;
  115152. case 1: {
  115153. var b = v.getUint8(1);
  115154. value = b ? true : false;
  115155. offset += 1;
  115156. break;
  115157. }
  115158. case 2: {
  115159. var amfstr = AMF2.parseString(arrayBuffer, dataOffset + 1, dataSize - 1);
  115160. value = amfstr.data;
  115161. offset += amfstr.size;
  115162. break;
  115163. }
  115164. case 3: {
  115165. value = {};
  115166. var terminal = 0;
  115167. if ((v.getUint32(dataSize - 4, !le) & 16777215) === 9) {
  115168. terminal = 3;
  115169. }
  115170. while (offset < dataSize - 4) {
  115171. var amfobj = AMF2.parseObject(arrayBuffer, dataOffset + offset, dataSize - offset - terminal);
  115172. if (amfobj.objectEnd)
  115173. break;
  115174. value[amfobj.data.name] = amfobj.data.value;
  115175. offset += amfobj.size;
  115176. }
  115177. if (offset <= dataSize - 3) {
  115178. var marker = v.getUint32(offset - 1, !le) & 16777215;
  115179. if (marker === 9) {
  115180. offset += 3;
  115181. }
  115182. }
  115183. break;
  115184. }
  115185. case 8: {
  115186. value = {};
  115187. offset += 4;
  115188. var terminal = 0;
  115189. if ((v.getUint32(dataSize - 4, !le) & 16777215) === 9) {
  115190. terminal = 3;
  115191. }
  115192. while (offset < dataSize - 8) {
  115193. var amfvar = AMF2.parseVariable(arrayBuffer, dataOffset + offset, dataSize - offset - terminal);
  115194. if (amfvar.objectEnd)
  115195. break;
  115196. value[amfvar.data.name] = amfvar.data.value;
  115197. offset += amfvar.size;
  115198. }
  115199. if (offset <= dataSize - 3) {
  115200. var marker = v.getUint32(offset - 1, !le) & 16777215;
  115201. if (marker === 9) {
  115202. offset += 3;
  115203. }
  115204. }
  115205. break;
  115206. }
  115207. case 9:
  115208. value = void 0;
  115209. offset = 1;
  115210. objectEnd = true;
  115211. break;
  115212. case 10: {
  115213. value = [];
  115214. var strictArrayLength = v.getUint32(1, !le);
  115215. offset += 4;
  115216. for (var i2 = 0; i2 < strictArrayLength; i2++) {
  115217. var val = AMF2.parseValue(arrayBuffer, dataOffset + offset, dataSize - offset);
  115218. value.push(val.data);
  115219. offset += val.size;
  115220. }
  115221. break;
  115222. }
  115223. case 11: {
  115224. var date = AMF2.parseDate(arrayBuffer, dataOffset + 1, dataSize - 1);
  115225. value = date.data;
  115226. offset += date.size;
  115227. break;
  115228. }
  115229. case 12: {
  115230. var amfLongStr = AMF2.parseString(arrayBuffer, dataOffset + 1, dataSize - 1);
  115231. value = amfLongStr.data;
  115232. offset += amfLongStr.size;
  115233. break;
  115234. }
  115235. default:
  115236. offset = dataSize;
  115237. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w("AMF", "Unsupported AMF value type " + type2);
  115238. }
  115239. } catch (e) {
  115240. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.e("AMF", e.toString());
  115241. }
  115242. return {
  115243. data: value,
  115244. size: offset,
  115245. objectEnd
  115246. };
  115247. };
  115248. return AMF2;
  115249. }();
  115250. __webpack_exports__2["default"] = AMF;
  115251. },
  115252. "./src/demux/demux-errors.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115253. __webpack_require__2.r(__webpack_exports__2);
  115254. var DemuxErrors = {
  115255. OK: "OK",
  115256. FORMAT_ERROR: "FormatError",
  115257. FORMAT_UNSUPPORTED: "FormatUnsupported",
  115258. CODEC_UNSUPPORTED: "CodecUnsupported"
  115259. };
  115260. __webpack_exports__2["default"] = DemuxErrors;
  115261. },
  115262. "./src/demux/exp-golomb.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115263. __webpack_require__2.r(__webpack_exports__2);
  115264. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/exception.js");
  115265. var ExpGolomb = function() {
  115266. function ExpGolomb2(uint8array) {
  115267. this.TAG = "ExpGolomb";
  115268. this._buffer = uint8array;
  115269. this._buffer_index = 0;
  115270. this._total_bytes = uint8array.byteLength;
  115271. this._total_bits = uint8array.byteLength * 8;
  115272. this._current_word = 0;
  115273. this._current_word_bits_left = 0;
  115274. }
  115275. ExpGolomb2.prototype.destroy = function() {
  115276. this._buffer = null;
  115277. };
  115278. ExpGolomb2.prototype._fillCurrentWord = function() {
  115279. var buffer_bytes_left = this._total_bytes - this._buffer_index;
  115280. if (buffer_bytes_left <= 0)
  115281. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__.IllegalStateException("ExpGolomb: _fillCurrentWord() but no bytes available");
  115282. var bytes_read = Math.min(4, buffer_bytes_left);
  115283. var word = new Uint8Array(4);
  115284. word.set(this._buffer.subarray(this._buffer_index, this._buffer_index + bytes_read));
  115285. this._current_word = new DataView(word.buffer).getUint32(0, false);
  115286. this._buffer_index += bytes_read;
  115287. this._current_word_bits_left = bytes_read * 8;
  115288. };
  115289. ExpGolomb2.prototype.readBits = function(bits) {
  115290. if (bits > 32)
  115291. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__.InvalidArgumentException("ExpGolomb: readBits() bits exceeded max 32bits!");
  115292. if (bits <= this._current_word_bits_left) {
  115293. var result_1 = this._current_word >>> 32 - bits;
  115294. this._current_word <<= bits;
  115295. this._current_word_bits_left -= bits;
  115296. return result_1;
  115297. }
  115298. var result = this._current_word_bits_left ? this._current_word : 0;
  115299. result = result >>> 32 - this._current_word_bits_left;
  115300. var bits_need_left = bits - this._current_word_bits_left;
  115301. this._fillCurrentWord();
  115302. var bits_read_next = Math.min(bits_need_left, this._current_word_bits_left);
  115303. var result2 = this._current_word >>> 32 - bits_read_next;
  115304. this._current_word <<= bits_read_next;
  115305. this._current_word_bits_left -= bits_read_next;
  115306. result = result << bits_read_next | result2;
  115307. return result;
  115308. };
  115309. ExpGolomb2.prototype.readBool = function() {
  115310. return this.readBits(1) === 1;
  115311. };
  115312. ExpGolomb2.prototype.readByte = function() {
  115313. return this.readBits(8);
  115314. };
  115315. ExpGolomb2.prototype._skipLeadingZero = function() {
  115316. var zero_count;
  115317. for (zero_count = 0; zero_count < this._current_word_bits_left; zero_count++) {
  115318. if (0 !== (this._current_word & 2147483648 >>> zero_count)) {
  115319. this._current_word <<= zero_count;
  115320. this._current_word_bits_left -= zero_count;
  115321. return zero_count;
  115322. }
  115323. }
  115324. this._fillCurrentWord();
  115325. return zero_count + this._skipLeadingZero();
  115326. };
  115327. ExpGolomb2.prototype.readUEG = function() {
  115328. var leading_zeros = this._skipLeadingZero();
  115329. return this.readBits(leading_zeros + 1) - 1;
  115330. };
  115331. ExpGolomb2.prototype.readSEG = function() {
  115332. var value = this.readUEG();
  115333. if (value & 1) {
  115334. return value + 1 >>> 1;
  115335. } else {
  115336. return -1 * (value >>> 1);
  115337. }
  115338. };
  115339. return ExpGolomb2;
  115340. }();
  115341. __webpack_exports__2["default"] = ExpGolomb;
  115342. },
  115343. "./src/demux/flv-demuxer.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  115344. __webpack_require__2.r(__webpack_exports__2);
  115345. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  115346. var _amf_parser_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/demux/amf-parser.js");
  115347. var _sps_parser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/demux/sps-parser.js");
  115348. var _demux_errors_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/demux/demux-errors.js");
  115349. var _core_media_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/media-info.js");
  115350. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/utils/exception.js");
  115351. function ReadBig32(array, index2) {
  115352. return array[index2] << 24 | array[index2 + 1] << 16 | array[index2 + 2] << 8 | array[index2 + 3];
  115353. }
  115354. var FLVDemuxer = function() {
  115355. function FLVDemuxer2(probeData, config) {
  115356. this.TAG = "FLVDemuxer";
  115357. this._config = config;
  115358. this._onError = null;
  115359. this._onMediaInfo = null;
  115360. this._onMetaDataArrived = null;
  115361. this._onScriptDataArrived = null;
  115362. this._onTrackMetadata = null;
  115363. this._onDataAvailable = null;
  115364. this._dataOffset = probeData.dataOffset;
  115365. this._firstParse = true;
  115366. this._dispatch = false;
  115367. this._hasAudio = probeData.hasAudioTrack;
  115368. this._hasVideo = probeData.hasVideoTrack;
  115369. this._hasAudioFlagOverrided = false;
  115370. this._hasVideoFlagOverrided = false;
  115371. this._audioInitialMetadataDispatched = false;
  115372. this._videoInitialMetadataDispatched = false;
  115373. this._mediaInfo = new _core_media_info_js__WEBPACK_IMPORTED_MODULE_4__.default();
  115374. this._mediaInfo.hasAudio = this._hasAudio;
  115375. this._mediaInfo.hasVideo = this._hasVideo;
  115376. this._metadata = null;
  115377. this._audioMetadata = null;
  115378. this._videoMetadata = null;
  115379. this._naluLengthSize = 4;
  115380. this._timestampBase = 0;
  115381. this._timescale = 1e3;
  115382. this._duration = 0;
  115383. this._durationOverrided = false;
  115384. this._referenceFrameRate = {
  115385. fixed: true,
  115386. fps: 23.976,
  115387. fps_num: 23976,
  115388. fps_den: 1e3
  115389. };
  115390. this._flvSoundRateTable = [5500, 11025, 22050, 44100, 48e3];
  115391. this._mpegSamplingRates = [
  115392. 96e3,
  115393. 88200,
  115394. 64e3,
  115395. 48e3,
  115396. 44100,
  115397. 32e3,
  115398. 24e3,
  115399. 22050,
  115400. 16e3,
  115401. 12e3,
  115402. 11025,
  115403. 8e3,
  115404. 7350
  115405. ];
  115406. this._mpegAudioV10SampleRateTable = [44100, 48e3, 32e3, 0];
  115407. this._mpegAudioV20SampleRateTable = [22050, 24e3, 16e3, 0];
  115408. this._mpegAudioV25SampleRateTable = [11025, 12e3, 8e3, 0];
  115409. this._mpegAudioL1BitRateTable = [0, 32, 64, 96, 128, 160, 192, 224, 256, 288, 320, 352, 384, 416, 448, -1];
  115410. this._mpegAudioL2BitRateTable = [0, 32, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, -1];
  115411. this._mpegAudioL3BitRateTable = [0, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, -1];
  115412. this._videoTrack = { type: "video", id: 1, sequenceNumber: 0, samples: [], length: 0 };
  115413. this._audioTrack = { type: "audio", id: 2, sequenceNumber: 0, samples: [], length: 0 };
  115414. this._littleEndian = function() {
  115415. var buf = new ArrayBuffer(2);
  115416. new DataView(buf).setInt16(0, 256, true);
  115417. return new Int16Array(buf)[0] === 256;
  115418. }();
  115419. }
  115420. FLVDemuxer2.prototype.destroy = function() {
  115421. this._mediaInfo = null;
  115422. this._metadata = null;
  115423. this._audioMetadata = null;
  115424. this._videoMetadata = null;
  115425. this._videoTrack = null;
  115426. this._audioTrack = null;
  115427. this._onError = null;
  115428. this._onMediaInfo = null;
  115429. this._onMetaDataArrived = null;
  115430. this._onScriptDataArrived = null;
  115431. this._onTrackMetadata = null;
  115432. this._onDataAvailable = null;
  115433. };
  115434. FLVDemuxer2.probe = function(buffer) {
  115435. var data = new Uint8Array(buffer);
  115436. var mismatch = { match: false };
  115437. if (data[0] !== 70 || data[1] !== 76 || data[2] !== 86 || data[3] !== 1) {
  115438. return mismatch;
  115439. }
  115440. var hasAudio = (data[4] & 4) >>> 2 !== 0;
  115441. var hasVideo = (data[4] & 1) !== 0;
  115442. var offset = ReadBig32(data, 5);
  115443. if (offset < 9) {
  115444. return mismatch;
  115445. }
  115446. return {
  115447. match: true,
  115448. consumed: offset,
  115449. dataOffset: offset,
  115450. hasAudioTrack: hasAudio,
  115451. hasVideoTrack: hasVideo
  115452. };
  115453. };
  115454. FLVDemuxer2.prototype.bindDataSource = function(loader) {
  115455. loader.onDataArrival = this.parseChunks.bind(this);
  115456. return this;
  115457. };
  115458. Object.defineProperty(FLVDemuxer2.prototype, "onTrackMetadata", {
  115459. get: function() {
  115460. return this._onTrackMetadata;
  115461. },
  115462. set: function(callback2) {
  115463. this._onTrackMetadata = callback2;
  115464. },
  115465. enumerable: false,
  115466. configurable: true
  115467. });
  115468. Object.defineProperty(FLVDemuxer2.prototype, "onMediaInfo", {
  115469. get: function() {
  115470. return this._onMediaInfo;
  115471. },
  115472. set: function(callback2) {
  115473. this._onMediaInfo = callback2;
  115474. },
  115475. enumerable: false,
  115476. configurable: true
  115477. });
  115478. Object.defineProperty(FLVDemuxer2.prototype, "onMetaDataArrived", {
  115479. get: function() {
  115480. return this._onMetaDataArrived;
  115481. },
  115482. set: function(callback2) {
  115483. this._onMetaDataArrived = callback2;
  115484. },
  115485. enumerable: false,
  115486. configurable: true
  115487. });
  115488. Object.defineProperty(FLVDemuxer2.prototype, "onScriptDataArrived", {
  115489. get: function() {
  115490. return this._onScriptDataArrived;
  115491. },
  115492. set: function(callback2) {
  115493. this._onScriptDataArrived = callback2;
  115494. },
  115495. enumerable: false,
  115496. configurable: true
  115497. });
  115498. Object.defineProperty(FLVDemuxer2.prototype, "onError", {
  115499. get: function() {
  115500. return this._onError;
  115501. },
  115502. set: function(callback2) {
  115503. this._onError = callback2;
  115504. },
  115505. enumerable: false,
  115506. configurable: true
  115507. });
  115508. Object.defineProperty(FLVDemuxer2.prototype, "onDataAvailable", {
  115509. get: function() {
  115510. return this._onDataAvailable;
  115511. },
  115512. set: function(callback2) {
  115513. this._onDataAvailable = callback2;
  115514. },
  115515. enumerable: false,
  115516. configurable: true
  115517. });
  115518. Object.defineProperty(FLVDemuxer2.prototype, "timestampBase", {
  115519. get: function() {
  115520. return this._timestampBase;
  115521. },
  115522. set: function(base2) {
  115523. this._timestampBase = base2;
  115524. },
  115525. enumerable: false,
  115526. configurable: true
  115527. });
  115528. Object.defineProperty(FLVDemuxer2.prototype, "overridedDuration", {
  115529. get: function() {
  115530. return this._duration;
  115531. },
  115532. set: function(duration5) {
  115533. this._durationOverrided = true;
  115534. this._duration = duration5;
  115535. this._mediaInfo.duration = duration5;
  115536. },
  115537. enumerable: false,
  115538. configurable: true
  115539. });
  115540. Object.defineProperty(FLVDemuxer2.prototype, "overridedHasAudio", {
  115541. set: function(hasAudio) {
  115542. this._hasAudioFlagOverrided = true;
  115543. this._hasAudio = hasAudio;
  115544. this._mediaInfo.hasAudio = hasAudio;
  115545. },
  115546. enumerable: false,
  115547. configurable: true
  115548. });
  115549. Object.defineProperty(FLVDemuxer2.prototype, "overridedHasVideo", {
  115550. set: function(hasVideo) {
  115551. this._hasVideoFlagOverrided = true;
  115552. this._hasVideo = hasVideo;
  115553. this._mediaInfo.hasVideo = hasVideo;
  115554. },
  115555. enumerable: false,
  115556. configurable: true
  115557. });
  115558. FLVDemuxer2.prototype.resetMediaInfo = function() {
  115559. this._mediaInfo = new _core_media_info_js__WEBPACK_IMPORTED_MODULE_4__.default();
  115560. };
  115561. FLVDemuxer2.prototype._isInitialMetadataDispatched = function() {
  115562. if (this._hasAudio && this._hasVideo) {
  115563. return this._audioInitialMetadataDispatched && this._videoInitialMetadataDispatched;
  115564. }
  115565. if (this._hasAudio && !this._hasVideo) {
  115566. return this._audioInitialMetadataDispatched;
  115567. }
  115568. if (!this._hasAudio && this._hasVideo) {
  115569. return this._videoInitialMetadataDispatched;
  115570. }
  115571. return false;
  115572. };
  115573. FLVDemuxer2.prototype.parseChunks = function(chunk, byteStart) {
  115574. if (!this._onError || !this._onMediaInfo || !this._onTrackMetadata || !this._onDataAvailable) {
  115575. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__.IllegalStateException("Flv: onError & onMediaInfo & onTrackMetadata & onDataAvailable callback must be specified");
  115576. }
  115577. var offset = 0;
  115578. var le = this._littleEndian;
  115579. if (byteStart === 0) {
  115580. if (chunk.byteLength > 13) {
  115581. var probeData = FLVDemuxer2.probe(chunk);
  115582. offset = probeData.dataOffset;
  115583. } else {
  115584. return 0;
  115585. }
  115586. }
  115587. if (this._firstParse) {
  115588. this._firstParse = false;
  115589. if (byteStart + offset !== this._dataOffset) {
  115590. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "First time parsing but chunk byteStart invalid!");
  115591. }
  115592. var v = new DataView(chunk, offset);
  115593. var prevTagSize0 = v.getUint32(0, !le);
  115594. if (prevTagSize0 !== 0) {
  115595. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "PrevTagSize0 !== 0 !!!");
  115596. }
  115597. offset += 4;
  115598. }
  115599. while (offset < chunk.byteLength) {
  115600. this._dispatch = true;
  115601. var v = new DataView(chunk, offset);
  115602. if (offset + 11 + 4 > chunk.byteLength) {
  115603. break;
  115604. }
  115605. var tagType = v.getUint8(0);
  115606. var dataSize = v.getUint32(0, !le) & 16777215;
  115607. if (offset + 11 + dataSize + 4 > chunk.byteLength) {
  115608. break;
  115609. }
  115610. if (tagType !== 8 && tagType !== 9 && tagType !== 18) {
  115611. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Unsupported tag type " + tagType + ", skipped");
  115612. offset += 11 + dataSize + 4;
  115613. continue;
  115614. }
  115615. var ts22 = v.getUint8(4);
  115616. var ts1 = v.getUint8(5);
  115617. var ts0 = v.getUint8(6);
  115618. var ts3 = v.getUint8(7);
  115619. var timestamp = ts0 | ts1 << 8 | ts22 << 16 | ts3 << 24;
  115620. var streamId = v.getUint32(7, !le) & 16777215;
  115621. if (streamId !== 0) {
  115622. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Meet tag which has StreamID != 0!");
  115623. }
  115624. var dataOffset = offset + 11;
  115625. switch (tagType) {
  115626. case 8:
  115627. this._parseAudioData(chunk, dataOffset, dataSize, timestamp);
  115628. break;
  115629. case 9:
  115630. this._parseVideoData(chunk, dataOffset, dataSize, timestamp, byteStart + offset);
  115631. break;
  115632. case 18:
  115633. this._parseScriptData(chunk, dataOffset, dataSize);
  115634. break;
  115635. }
  115636. var prevTagSize = v.getUint32(11 + dataSize, !le);
  115637. if (prevTagSize !== 11 + dataSize) {
  115638. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Invalid PrevTagSize " + prevTagSize);
  115639. }
  115640. offset += 11 + dataSize + 4;
  115641. }
  115642. if (this._isInitialMetadataDispatched()) {
  115643. if (this._dispatch && (this._audioTrack.length || this._videoTrack.length)) {
  115644. this._onDataAvailable(this._audioTrack, this._videoTrack);
  115645. }
  115646. }
  115647. return offset;
  115648. };
  115649. FLVDemuxer2.prototype._parseScriptData = function(arrayBuffer, dataOffset, dataSize) {
  115650. var scriptData = _amf_parser_js__WEBPACK_IMPORTED_MODULE_1__.default.parseScriptData(arrayBuffer, dataOffset, dataSize);
  115651. if (scriptData.hasOwnProperty("onMetaData")) {
  115652. if (scriptData.onMetaData == null || typeof scriptData.onMetaData !== "object") {
  115653. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Invalid onMetaData structure!");
  115654. return;
  115655. }
  115656. if (this._metadata) {
  115657. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Found another onMetaData tag!");
  115658. }
  115659. this._metadata = scriptData;
  115660. var onMetaData = this._metadata.onMetaData;
  115661. if (this._onMetaDataArrived) {
  115662. this._onMetaDataArrived(Object.assign({}, onMetaData));
  115663. }
  115664. if (typeof onMetaData.hasAudio === "boolean") {
  115665. if (this._hasAudioFlagOverrided === false) {
  115666. this._hasAudio = onMetaData.hasAudio;
  115667. this._mediaInfo.hasAudio = this._hasAudio;
  115668. }
  115669. }
  115670. if (typeof onMetaData.hasVideo === "boolean") {
  115671. if (this._hasVideoFlagOverrided === false) {
  115672. this._hasVideo = onMetaData.hasVideo;
  115673. this._mediaInfo.hasVideo = this._hasVideo;
  115674. }
  115675. }
  115676. if (typeof onMetaData.audiodatarate === "number") {
  115677. this._mediaInfo.audioDataRate = onMetaData.audiodatarate;
  115678. }
  115679. if (typeof onMetaData.videodatarate === "number") {
  115680. this._mediaInfo.videoDataRate = onMetaData.videodatarate;
  115681. }
  115682. if (typeof onMetaData.width === "number") {
  115683. this._mediaInfo.width = onMetaData.width;
  115684. }
  115685. if (typeof onMetaData.height === "number") {
  115686. this._mediaInfo.height = onMetaData.height;
  115687. }
  115688. if (typeof onMetaData.duration === "number") {
  115689. if (!this._durationOverrided) {
  115690. var duration5 = Math.floor(onMetaData.duration * this._timescale);
  115691. this._duration = duration5;
  115692. this._mediaInfo.duration = duration5;
  115693. }
  115694. } else {
  115695. this._mediaInfo.duration = 0;
  115696. }
  115697. if (typeof onMetaData.framerate === "number") {
  115698. var fps_num = Math.floor(onMetaData.framerate * 1e3);
  115699. if (fps_num > 0) {
  115700. var fps = fps_num / 1e3;
  115701. this._referenceFrameRate.fixed = true;
  115702. this._referenceFrameRate.fps = fps;
  115703. this._referenceFrameRate.fps_num = fps_num;
  115704. this._referenceFrameRate.fps_den = 1e3;
  115705. this._mediaInfo.fps = fps;
  115706. }
  115707. }
  115708. if (typeof onMetaData.keyframes === "object") {
  115709. this._mediaInfo.hasKeyframesIndex = true;
  115710. var keyframes = onMetaData.keyframes;
  115711. this._mediaInfo.keyframesIndex = this._parseKeyframesIndex(keyframes);
  115712. onMetaData.keyframes = null;
  115713. } else {
  115714. this._mediaInfo.hasKeyframesIndex = false;
  115715. }
  115716. this._dispatch = false;
  115717. this._mediaInfo.metadata = onMetaData;
  115718. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "Parsed onMetaData");
  115719. if (this._mediaInfo.isComplete()) {
  115720. this._onMediaInfo(this._mediaInfo);
  115721. }
  115722. }
  115723. if (Object.keys(scriptData).length > 0) {
  115724. if (this._onScriptDataArrived) {
  115725. this._onScriptDataArrived(Object.assign({}, scriptData));
  115726. }
  115727. }
  115728. };
  115729. FLVDemuxer2.prototype._parseKeyframesIndex = function(keyframes) {
  115730. var times = [];
  115731. var filepositions = [];
  115732. for (var i2 = 1; i2 < keyframes.times.length; i2++) {
  115733. var time = this._timestampBase + Math.floor(keyframes.times[i2] * 1e3);
  115734. times.push(time);
  115735. filepositions.push(keyframes.filepositions[i2]);
  115736. }
  115737. return {
  115738. times,
  115739. filepositions
  115740. };
  115741. };
  115742. FLVDemuxer2.prototype._parseAudioData = function(arrayBuffer, dataOffset, dataSize, tagTimestamp) {
  115743. if (dataSize <= 1) {
  115744. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid audio packet, missing SoundData payload!");
  115745. return;
  115746. }
  115747. if (this._hasAudioFlagOverrided === true && this._hasAudio === false) {
  115748. return;
  115749. }
  115750. this._littleEndian;
  115751. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  115752. var soundSpec = v.getUint8(0);
  115753. var soundFormat = soundSpec >>> 4;
  115754. if (soundFormat !== 2 && soundFormat !== 10) {
  115755. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.CODEC_UNSUPPORTED, "Flv: Unsupported audio codec idx: " + soundFormat);
  115756. return;
  115757. }
  115758. var soundRate = 0;
  115759. var soundRateIndex = (soundSpec & 12) >>> 2;
  115760. if (soundRateIndex >= 0 && soundRateIndex <= 4) {
  115761. soundRate = this._flvSoundRateTable[soundRateIndex];
  115762. } else {
  115763. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid audio sample rate idx: " + soundRateIndex);
  115764. return;
  115765. }
  115766. var soundType = soundSpec & 1;
  115767. var meta2 = this._audioMetadata;
  115768. var track = this._audioTrack;
  115769. if (!meta2) {
  115770. if (this._hasAudio === false && this._hasAudioFlagOverrided === false) {
  115771. this._hasAudio = true;
  115772. this._mediaInfo.hasAudio = true;
  115773. }
  115774. meta2 = this._audioMetadata = {};
  115775. meta2.type = "audio";
  115776. meta2.id = track.id;
  115777. meta2.timescale = this._timescale;
  115778. meta2.duration = this._duration;
  115779. meta2.audioSampleRate = soundRate;
  115780. meta2.channelCount = soundType === 0 ? 1 : 2;
  115781. }
  115782. if (soundFormat === 10) {
  115783. var aacData = this._parseAACAudioData(arrayBuffer, dataOffset + 1, dataSize - 1);
  115784. if (aacData == void 0) {
  115785. return;
  115786. }
  115787. if (aacData.packetType === 0) {
  115788. if (meta2.config) {
  115789. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Found another AudioSpecificConfig!");
  115790. }
  115791. var misc = aacData.data;
  115792. meta2.audioSampleRate = misc.samplingRate;
  115793. meta2.channelCount = misc.channelCount;
  115794. meta2.codec = misc.codec;
  115795. meta2.originalCodec = misc.originalCodec;
  115796. meta2.config = misc.config;
  115797. meta2.refSampleDuration = 1024 / meta2.audioSampleRate * meta2.timescale;
  115798. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "Parsed AudioSpecificConfig");
  115799. if (this._isInitialMetadataDispatched()) {
  115800. if (this._dispatch && (this._audioTrack.length || this._videoTrack.length)) {
  115801. this._onDataAvailable(this._audioTrack, this._videoTrack);
  115802. }
  115803. } else {
  115804. this._audioInitialMetadataDispatched = true;
  115805. }
  115806. this._dispatch = false;
  115807. this._onTrackMetadata("audio", meta2);
  115808. var mi = this._mediaInfo;
  115809. mi.audioCodec = meta2.originalCodec;
  115810. mi.audioSampleRate = meta2.audioSampleRate;
  115811. mi.audioChannelCount = meta2.channelCount;
  115812. if (mi.hasVideo) {
  115813. if (mi.videoCodec != null) {
  115814. mi.mimeType = 'video/x-flv; codecs="' + mi.videoCodec + "," + mi.audioCodec + '"';
  115815. }
  115816. } else {
  115817. mi.mimeType = 'video/x-flv; codecs="' + mi.audioCodec + '"';
  115818. }
  115819. if (mi.isComplete()) {
  115820. this._onMediaInfo(mi);
  115821. }
  115822. } else if (aacData.packetType === 1) {
  115823. var dts = this._timestampBase + tagTimestamp;
  115824. var aacSample = { unit: aacData.data, length: aacData.data.byteLength, dts, pts: dts };
  115825. track.samples.push(aacSample);
  115826. track.length += aacData.data.length;
  115827. } else {
  115828. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.e(this.TAG, "Flv: Unsupported AAC data type " + aacData.packetType);
  115829. }
  115830. } else if (soundFormat === 2) {
  115831. if (!meta2.codec) {
  115832. var misc = this._parseMP3AudioData(arrayBuffer, dataOffset + 1, dataSize - 1, true);
  115833. if (misc == void 0) {
  115834. return;
  115835. }
  115836. meta2.audioSampleRate = misc.samplingRate;
  115837. meta2.channelCount = misc.channelCount;
  115838. meta2.codec = misc.codec;
  115839. meta2.originalCodec = misc.originalCodec;
  115840. meta2.refSampleDuration = 1152 / meta2.audioSampleRate * meta2.timescale;
  115841. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "Parsed MPEG Audio Frame Header");
  115842. this._audioInitialMetadataDispatched = true;
  115843. this._onTrackMetadata("audio", meta2);
  115844. var mi = this._mediaInfo;
  115845. mi.audioCodec = meta2.codec;
  115846. mi.audioSampleRate = meta2.audioSampleRate;
  115847. mi.audioChannelCount = meta2.channelCount;
  115848. mi.audioDataRate = misc.bitRate;
  115849. if (mi.hasVideo) {
  115850. if (mi.videoCodec != null) {
  115851. mi.mimeType = 'video/x-flv; codecs="' + mi.videoCodec + "," + mi.audioCodec + '"';
  115852. }
  115853. } else {
  115854. mi.mimeType = 'video/x-flv; codecs="' + mi.audioCodec + '"';
  115855. }
  115856. if (mi.isComplete()) {
  115857. this._onMediaInfo(mi);
  115858. }
  115859. }
  115860. var data = this._parseMP3AudioData(arrayBuffer, dataOffset + 1, dataSize - 1, false);
  115861. if (data == void 0) {
  115862. return;
  115863. }
  115864. var dts = this._timestampBase + tagTimestamp;
  115865. var mp3Sample = { unit: data, length: data.byteLength, dts, pts: dts };
  115866. track.samples.push(mp3Sample);
  115867. track.length += data.length;
  115868. }
  115869. };
  115870. FLVDemuxer2.prototype._parseAACAudioData = function(arrayBuffer, dataOffset, dataSize) {
  115871. if (dataSize <= 1) {
  115872. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid AAC packet, missing AACPacketType or/and Data!");
  115873. return;
  115874. }
  115875. var result = {};
  115876. var array = new Uint8Array(arrayBuffer, dataOffset, dataSize);
  115877. result.packetType = array[0];
  115878. if (array[0] === 0) {
  115879. result.data = this._parseAACAudioSpecificConfig(arrayBuffer, dataOffset + 1, dataSize - 1);
  115880. } else {
  115881. result.data = array.subarray(1);
  115882. }
  115883. return result;
  115884. };
  115885. FLVDemuxer2.prototype._parseAACAudioSpecificConfig = function(arrayBuffer, dataOffset, dataSize) {
  115886. var array = new Uint8Array(arrayBuffer, dataOffset, dataSize);
  115887. var config = null;
  115888. var audioObjectType = 0;
  115889. var originalAudioObjectType = 0;
  115890. var samplingIndex = 0;
  115891. var extensionSamplingIndex = null;
  115892. audioObjectType = originalAudioObjectType = array[0] >>> 3;
  115893. samplingIndex = (array[0] & 7) << 1 | array[1] >>> 7;
  115894. if (samplingIndex < 0 || samplingIndex >= this._mpegSamplingRates.length) {
  115895. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: AAC invalid sampling frequency index!");
  115896. return;
  115897. }
  115898. var samplingFrequence = this._mpegSamplingRates[samplingIndex];
  115899. var channelConfig = (array[1] & 120) >>> 3;
  115900. if (channelConfig < 0 || channelConfig >= 8) {
  115901. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: AAC invalid channel configuration");
  115902. return;
  115903. }
  115904. if (audioObjectType === 5) {
  115905. extensionSamplingIndex = (array[1] & 7) << 1 | array[2] >>> 7;
  115906. (array[2] & 124) >>> 2;
  115907. }
  115908. var userAgent = self.navigator.userAgent.toLowerCase();
  115909. if (userAgent.indexOf("firefox") !== -1) {
  115910. if (samplingIndex >= 6) {
  115911. audioObjectType = 5;
  115912. config = new Array(4);
  115913. extensionSamplingIndex = samplingIndex - 3;
  115914. } else {
  115915. audioObjectType = 2;
  115916. config = new Array(2);
  115917. extensionSamplingIndex = samplingIndex;
  115918. }
  115919. } else if (userAgent.indexOf("android") !== -1) {
  115920. audioObjectType = 2;
  115921. config = new Array(2);
  115922. extensionSamplingIndex = samplingIndex;
  115923. } else {
  115924. audioObjectType = 5;
  115925. extensionSamplingIndex = samplingIndex;
  115926. config = new Array(4);
  115927. if (samplingIndex >= 6) {
  115928. extensionSamplingIndex = samplingIndex - 3;
  115929. } else if (channelConfig === 1) {
  115930. audioObjectType = 2;
  115931. config = new Array(2);
  115932. extensionSamplingIndex = samplingIndex;
  115933. }
  115934. }
  115935. config[0] = audioObjectType << 3;
  115936. config[0] |= (samplingIndex & 15) >>> 1;
  115937. config[1] = (samplingIndex & 15) << 7;
  115938. config[1] |= (channelConfig & 15) << 3;
  115939. if (audioObjectType === 5) {
  115940. config[1] |= (extensionSamplingIndex & 15) >>> 1;
  115941. config[2] = (extensionSamplingIndex & 1) << 7;
  115942. config[2] |= 2 << 2;
  115943. config[3] = 0;
  115944. }
  115945. return {
  115946. config,
  115947. samplingRate: samplingFrequence,
  115948. channelCount: channelConfig,
  115949. codec: "mp4a.40." + audioObjectType,
  115950. originalCodec: "mp4a.40." + originalAudioObjectType
  115951. };
  115952. };
  115953. FLVDemuxer2.prototype._parseMP3AudioData = function(arrayBuffer, dataOffset, dataSize, requestHeader) {
  115954. if (dataSize < 4) {
  115955. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid MP3 packet, header missing!");
  115956. return;
  115957. }
  115958. this._littleEndian;
  115959. var array = new Uint8Array(arrayBuffer, dataOffset, dataSize);
  115960. var result = null;
  115961. if (requestHeader) {
  115962. if (array[0] !== 255) {
  115963. return;
  115964. }
  115965. var ver = array[1] >>> 3 & 3;
  115966. var layer = (array[1] & 6) >> 1;
  115967. var bitrate_index = (array[2] & 240) >>> 4;
  115968. var sampling_freq_index = (array[2] & 12) >>> 2;
  115969. var channel_mode = array[3] >>> 6 & 3;
  115970. var channel_count = channel_mode !== 3 ? 2 : 1;
  115971. var sample_rate = 0;
  115972. var bit_rate = 0;
  115973. var codec = "mp3";
  115974. switch (ver) {
  115975. case 0:
  115976. sample_rate = this._mpegAudioV25SampleRateTable[sampling_freq_index];
  115977. break;
  115978. case 2:
  115979. sample_rate = this._mpegAudioV20SampleRateTable[sampling_freq_index];
  115980. break;
  115981. case 3:
  115982. sample_rate = this._mpegAudioV10SampleRateTable[sampling_freq_index];
  115983. break;
  115984. }
  115985. switch (layer) {
  115986. case 1:
  115987. if (bitrate_index < this._mpegAudioL3BitRateTable.length) {
  115988. bit_rate = this._mpegAudioL3BitRateTable[bitrate_index];
  115989. }
  115990. break;
  115991. case 2:
  115992. if (bitrate_index < this._mpegAudioL2BitRateTable.length) {
  115993. bit_rate = this._mpegAudioL2BitRateTable[bitrate_index];
  115994. }
  115995. break;
  115996. case 3:
  115997. if (bitrate_index < this._mpegAudioL1BitRateTable.length) {
  115998. bit_rate = this._mpegAudioL1BitRateTable[bitrate_index];
  115999. }
  116000. break;
  116001. }
  116002. result = {
  116003. bitRate: bit_rate,
  116004. samplingRate: sample_rate,
  116005. channelCount: channel_count,
  116006. codec,
  116007. originalCodec: codec
  116008. };
  116009. } else {
  116010. result = array;
  116011. }
  116012. return result;
  116013. };
  116014. FLVDemuxer2.prototype._parseVideoData = function(arrayBuffer, dataOffset, dataSize, tagTimestamp, tagPosition) {
  116015. if (dataSize <= 1) {
  116016. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid video packet, missing VideoData payload!");
  116017. return;
  116018. }
  116019. if (this._hasVideoFlagOverrided === true && this._hasVideo === false) {
  116020. return;
  116021. }
  116022. var spec = new Uint8Array(arrayBuffer, dataOffset, dataSize)[0];
  116023. var frameType = (spec & 240) >>> 4;
  116024. var codecId = spec & 15;
  116025. if (codecId !== 7) {
  116026. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.CODEC_UNSUPPORTED, "Flv: Unsupported codec in video frame: " + codecId);
  116027. return;
  116028. }
  116029. this._parseAVCVideoPacket(arrayBuffer, dataOffset + 1, dataSize - 1, tagTimestamp, tagPosition, frameType);
  116030. };
  116031. FLVDemuxer2.prototype._parseAVCVideoPacket = function(arrayBuffer, dataOffset, dataSize, tagTimestamp, tagPosition, frameType) {
  116032. if (dataSize < 4) {
  116033. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid AVC packet, missing AVCPacketType or/and CompositionTime");
  116034. return;
  116035. }
  116036. var le = this._littleEndian;
  116037. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  116038. var packetType = v.getUint8(0);
  116039. var cts_unsigned = v.getUint32(0, !le) & 16777215;
  116040. var cts = cts_unsigned << 8 >> 8;
  116041. if (packetType === 0) {
  116042. this._parseAVCDecoderConfigurationRecord(arrayBuffer, dataOffset + 4, dataSize - 4);
  116043. } else if (packetType === 1) {
  116044. this._parseAVCVideoData(arrayBuffer, dataOffset + 4, dataSize - 4, tagTimestamp, tagPosition, frameType, cts);
  116045. } else if (packetType === 2)
  116046. ;
  116047. else {
  116048. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid video packet type " + packetType);
  116049. return;
  116050. }
  116051. };
  116052. FLVDemuxer2.prototype._parseAVCDecoderConfigurationRecord = function(arrayBuffer, dataOffset, dataSize) {
  116053. if (dataSize < 7) {
  116054. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Invalid AVCDecoderConfigurationRecord, lack of data!");
  116055. return;
  116056. }
  116057. var meta2 = this._videoMetadata;
  116058. var track = this._videoTrack;
  116059. var le = this._littleEndian;
  116060. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  116061. if (!meta2) {
  116062. if (this._hasVideo === false && this._hasVideoFlagOverrided === false) {
  116063. this._hasVideo = true;
  116064. this._mediaInfo.hasVideo = true;
  116065. }
  116066. meta2 = this._videoMetadata = {};
  116067. meta2.type = "video";
  116068. meta2.id = track.id;
  116069. meta2.timescale = this._timescale;
  116070. meta2.duration = this._duration;
  116071. } else {
  116072. if (typeof meta2.avcc !== "undefined") {
  116073. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Found another AVCDecoderConfigurationRecord!");
  116074. }
  116075. }
  116076. var version2 = v.getUint8(0);
  116077. var avcProfile = v.getUint8(1);
  116078. v.getUint8(2);
  116079. v.getUint8(3);
  116080. if (version2 !== 1 || avcProfile === 0) {
  116081. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord");
  116082. return;
  116083. }
  116084. this._naluLengthSize = (v.getUint8(4) & 3) + 1;
  116085. if (this._naluLengthSize !== 3 && this._naluLengthSize !== 4) {
  116086. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Strange NaluLengthSizeMinusOne: " + (this._naluLengthSize - 1));
  116087. return;
  116088. }
  116089. var spsCount = v.getUint8(5) & 31;
  116090. if (spsCount === 0) {
  116091. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No SPS");
  116092. return;
  116093. } else if (spsCount > 1) {
  116094. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: SPS Count = " + spsCount);
  116095. }
  116096. var offset = 6;
  116097. for (var i2 = 0; i2 < spsCount; i2++) {
  116098. var len = v.getUint16(offset, !le);
  116099. offset += 2;
  116100. if (len === 0) {
  116101. continue;
  116102. }
  116103. var sps = new Uint8Array(arrayBuffer, dataOffset + offset, len);
  116104. offset += len;
  116105. var config = _sps_parser_js__WEBPACK_IMPORTED_MODULE_2__.default.parseSPS(sps);
  116106. if (i2 !== 0) {
  116107. continue;
  116108. }
  116109. meta2.codecWidth = config.codec_size.width;
  116110. meta2.codecHeight = config.codec_size.height;
  116111. meta2.presentWidth = config.present_size.width;
  116112. meta2.presentHeight = config.present_size.height;
  116113. meta2.profile = config.profile_string;
  116114. meta2.level = config.level_string;
  116115. meta2.bitDepth = config.bit_depth;
  116116. meta2.chromaFormat = config.chroma_format;
  116117. meta2.sarRatio = config.sar_ratio;
  116118. meta2.frameRate = config.frame_rate;
  116119. if (config.frame_rate.fixed === false || config.frame_rate.fps_num === 0 || config.frame_rate.fps_den === 0) {
  116120. meta2.frameRate = this._referenceFrameRate;
  116121. }
  116122. var fps_den = meta2.frameRate.fps_den;
  116123. var fps_num = meta2.frameRate.fps_num;
  116124. meta2.refSampleDuration = meta2.timescale * (fps_den / fps_num);
  116125. var codecArray = sps.subarray(1, 4);
  116126. var codecString = "avc1.";
  116127. for (var j = 0; j < 3; j++) {
  116128. var h2 = codecArray[j].toString(16);
  116129. if (h2.length < 2) {
  116130. h2 = "0" + h2;
  116131. }
  116132. codecString += h2;
  116133. }
  116134. meta2.codec = codecString;
  116135. var mi = this._mediaInfo;
  116136. mi.width = meta2.codecWidth;
  116137. mi.height = meta2.codecHeight;
  116138. mi.fps = meta2.frameRate.fps;
  116139. mi.profile = meta2.profile;
  116140. mi.level = meta2.level;
  116141. mi.refFrames = config.ref_frames;
  116142. mi.chromaFormat = config.chroma_format_string;
  116143. mi.sarNum = meta2.sarRatio.width;
  116144. mi.sarDen = meta2.sarRatio.height;
  116145. mi.videoCodec = codecString;
  116146. if (mi.hasAudio) {
  116147. if (mi.audioCodec != null) {
  116148. mi.mimeType = 'video/x-flv; codecs="' + mi.videoCodec + "," + mi.audioCodec + '"';
  116149. }
  116150. } else {
  116151. mi.mimeType = 'video/x-flv; codecs="' + mi.videoCodec + '"';
  116152. }
  116153. if (mi.isComplete()) {
  116154. this._onMediaInfo(mi);
  116155. }
  116156. }
  116157. var ppsCount = v.getUint8(offset);
  116158. if (ppsCount === 0) {
  116159. this._onError(_demux_errors_js__WEBPACK_IMPORTED_MODULE_3__.default.FORMAT_ERROR, "Flv: Invalid AVCDecoderConfigurationRecord: No PPS");
  116160. return;
  116161. } else if (ppsCount > 1) {
  116162. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Flv: Strange AVCDecoderConfigurationRecord: PPS Count = " + ppsCount);
  116163. }
  116164. offset++;
  116165. for (var i2 = 0; i2 < ppsCount; i2++) {
  116166. var len = v.getUint16(offset, !le);
  116167. offset += 2;
  116168. if (len === 0) {
  116169. continue;
  116170. }
  116171. offset += len;
  116172. }
  116173. meta2.avcc = new Uint8Array(dataSize);
  116174. meta2.avcc.set(new Uint8Array(arrayBuffer, dataOffset, dataSize), 0);
  116175. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "Parsed AVCDecoderConfigurationRecord");
  116176. if (this._isInitialMetadataDispatched()) {
  116177. if (this._dispatch && (this._audioTrack.length || this._videoTrack.length)) {
  116178. this._onDataAvailable(this._audioTrack, this._videoTrack);
  116179. }
  116180. } else {
  116181. this._videoInitialMetadataDispatched = true;
  116182. }
  116183. this._dispatch = false;
  116184. this._onTrackMetadata("video", meta2);
  116185. };
  116186. FLVDemuxer2.prototype._parseAVCVideoData = function(arrayBuffer, dataOffset, dataSize, tagTimestamp, tagPosition, frameType, cts) {
  116187. var le = this._littleEndian;
  116188. var v = new DataView(arrayBuffer, dataOffset, dataSize);
  116189. var units = [], length = 0;
  116190. var offset = 0;
  116191. var lengthSize = this._naluLengthSize;
  116192. var dts = this._timestampBase + tagTimestamp;
  116193. var keyframe = frameType === 1;
  116194. while (offset < dataSize) {
  116195. if (offset + 4 >= dataSize) {
  116196. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Malformed Nalu near timestamp " + dts + ", offset = " + offset + ", dataSize = " + dataSize);
  116197. break;
  116198. }
  116199. var naluSize = v.getUint32(offset, !le);
  116200. if (lengthSize === 3) {
  116201. naluSize >>>= 8;
  116202. }
  116203. if (naluSize > dataSize - lengthSize) {
  116204. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Malformed Nalus near timestamp " + dts + ", NaluSize > DataSize!");
  116205. return;
  116206. }
  116207. var unitType = v.getUint8(offset + lengthSize) & 31;
  116208. if (unitType === 5) {
  116209. keyframe = true;
  116210. }
  116211. var data = new Uint8Array(arrayBuffer, dataOffset + offset, lengthSize + naluSize);
  116212. var unit = { type: unitType, data };
  116213. units.push(unit);
  116214. length += data.byteLength;
  116215. offset += lengthSize + naluSize;
  116216. }
  116217. if (units.length) {
  116218. var track = this._videoTrack;
  116219. var avcSample = {
  116220. units,
  116221. length,
  116222. isKeyframe: keyframe,
  116223. dts,
  116224. cts,
  116225. pts: dts + cts
  116226. };
  116227. if (keyframe) {
  116228. avcSample.fileposition = tagPosition;
  116229. }
  116230. track.samples.push(avcSample);
  116231. track.length += length;
  116232. }
  116233. };
  116234. return FLVDemuxer2;
  116235. }();
  116236. __webpack_exports__2["default"] = FLVDemuxer;
  116237. },
  116238. "./src/demux/sps-parser.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  116239. __webpack_require__2.r(__webpack_exports__2);
  116240. var _exp_golomb_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/demux/exp-golomb.js");
  116241. var SPSParser = function() {
  116242. function SPSParser2() {
  116243. }
  116244. SPSParser2._ebsp2rbsp = function(uint8array) {
  116245. var src = uint8array;
  116246. var src_length = src.byteLength;
  116247. var dst = new Uint8Array(src_length);
  116248. var dst_idx = 0;
  116249. for (var i2 = 0; i2 < src_length; i2++) {
  116250. if (i2 >= 2) {
  116251. if (src[i2] === 3 && src[i2 - 1] === 0 && src[i2 - 2] === 0) {
  116252. continue;
  116253. }
  116254. }
  116255. dst[dst_idx] = src[i2];
  116256. dst_idx++;
  116257. }
  116258. return new Uint8Array(dst.buffer, 0, dst_idx);
  116259. };
  116260. SPSParser2.parseSPS = function(uint8array) {
  116261. var rbsp = SPSParser2._ebsp2rbsp(uint8array);
  116262. var gb = new _exp_golomb_js__WEBPACK_IMPORTED_MODULE_0__.default(rbsp);
  116263. gb.readByte();
  116264. var profile_idc = gb.readByte();
  116265. gb.readByte();
  116266. var level_idc = gb.readByte();
  116267. gb.readUEG();
  116268. var profile_string = SPSParser2.getProfileString(profile_idc);
  116269. var level_string = SPSParser2.getLevelString(level_idc);
  116270. var chroma_format_idc = 1;
  116271. var chroma_format = 420;
  116272. var chroma_format_table = [0, 420, 422, 444];
  116273. var bit_depth = 8;
  116274. if (profile_idc === 100 || profile_idc === 110 || profile_idc === 122 || profile_idc === 244 || profile_idc === 44 || profile_idc === 83 || profile_idc === 86 || profile_idc === 118 || profile_idc === 128 || profile_idc === 138 || profile_idc === 144) {
  116275. chroma_format_idc = gb.readUEG();
  116276. if (chroma_format_idc === 3) {
  116277. gb.readBits(1);
  116278. }
  116279. if (chroma_format_idc <= 3) {
  116280. chroma_format = chroma_format_table[chroma_format_idc];
  116281. }
  116282. bit_depth = gb.readUEG() + 8;
  116283. gb.readUEG();
  116284. gb.readBits(1);
  116285. if (gb.readBool()) {
  116286. var scaling_list_count = chroma_format_idc !== 3 ? 8 : 12;
  116287. for (var i2 = 0; i2 < scaling_list_count; i2++) {
  116288. if (gb.readBool()) {
  116289. if (i2 < 6) {
  116290. SPSParser2._skipScalingList(gb, 16);
  116291. } else {
  116292. SPSParser2._skipScalingList(gb, 64);
  116293. }
  116294. }
  116295. }
  116296. }
  116297. }
  116298. gb.readUEG();
  116299. var pic_order_cnt_type = gb.readUEG();
  116300. if (pic_order_cnt_type === 0) {
  116301. gb.readUEG();
  116302. } else if (pic_order_cnt_type === 1) {
  116303. gb.readBits(1);
  116304. gb.readSEG();
  116305. gb.readSEG();
  116306. var num_ref_frames_in_pic_order_cnt_cycle = gb.readUEG();
  116307. for (var i2 = 0; i2 < num_ref_frames_in_pic_order_cnt_cycle; i2++) {
  116308. gb.readSEG();
  116309. }
  116310. }
  116311. var ref_frames = gb.readUEG();
  116312. gb.readBits(1);
  116313. var pic_width_in_mbs_minus1 = gb.readUEG();
  116314. var pic_height_in_map_units_minus1 = gb.readUEG();
  116315. var frame_mbs_only_flag = gb.readBits(1);
  116316. if (frame_mbs_only_flag === 0) {
  116317. gb.readBits(1);
  116318. }
  116319. gb.readBits(1);
  116320. var frame_crop_left_offset = 0;
  116321. var frame_crop_right_offset = 0;
  116322. var frame_crop_top_offset = 0;
  116323. var frame_crop_bottom_offset = 0;
  116324. var frame_cropping_flag = gb.readBool();
  116325. if (frame_cropping_flag) {
  116326. frame_crop_left_offset = gb.readUEG();
  116327. frame_crop_right_offset = gb.readUEG();
  116328. frame_crop_top_offset = gb.readUEG();
  116329. frame_crop_bottom_offset = gb.readUEG();
  116330. }
  116331. var sar_width = 1, sar_height = 1;
  116332. var fps = 0, fps_fixed = true, fps_num = 0, fps_den = 0;
  116333. var vui_parameters_present_flag = gb.readBool();
  116334. if (vui_parameters_present_flag) {
  116335. if (gb.readBool()) {
  116336. var aspect_ratio_idc = gb.readByte();
  116337. var sar_w_table = [1, 12, 10, 16, 40, 24, 20, 32, 80, 18, 15, 64, 160, 4, 3, 2];
  116338. var sar_h_table = [1, 11, 11, 11, 33, 11, 11, 11, 33, 11, 11, 33, 99, 3, 2, 1];
  116339. if (aspect_ratio_idc > 0 && aspect_ratio_idc < 16) {
  116340. sar_width = sar_w_table[aspect_ratio_idc - 1];
  116341. sar_height = sar_h_table[aspect_ratio_idc - 1];
  116342. } else if (aspect_ratio_idc === 255) {
  116343. sar_width = gb.readByte() << 8 | gb.readByte();
  116344. sar_height = gb.readByte() << 8 | gb.readByte();
  116345. }
  116346. }
  116347. if (gb.readBool()) {
  116348. gb.readBool();
  116349. }
  116350. if (gb.readBool()) {
  116351. gb.readBits(4);
  116352. if (gb.readBool()) {
  116353. gb.readBits(24);
  116354. }
  116355. }
  116356. if (gb.readBool()) {
  116357. gb.readUEG();
  116358. gb.readUEG();
  116359. }
  116360. if (gb.readBool()) {
  116361. var num_units_in_tick = gb.readBits(32);
  116362. var time_scale = gb.readBits(32);
  116363. fps_fixed = gb.readBool();
  116364. fps_num = time_scale;
  116365. fps_den = num_units_in_tick * 2;
  116366. fps = fps_num / fps_den;
  116367. }
  116368. }
  116369. var sarScale = 1;
  116370. if (sar_width !== 1 || sar_height !== 1) {
  116371. sarScale = sar_width / sar_height;
  116372. }
  116373. var crop_unit_x = 0, crop_unit_y = 0;
  116374. if (chroma_format_idc === 0) {
  116375. crop_unit_x = 1;
  116376. crop_unit_y = 2 - frame_mbs_only_flag;
  116377. } else {
  116378. var sub_wc = chroma_format_idc === 3 ? 1 : 2;
  116379. var sub_hc = chroma_format_idc === 1 ? 2 : 1;
  116380. crop_unit_x = sub_wc;
  116381. crop_unit_y = sub_hc * (2 - frame_mbs_only_flag);
  116382. }
  116383. var codec_width = (pic_width_in_mbs_minus1 + 1) * 16;
  116384. var codec_height = (2 - frame_mbs_only_flag) * ((pic_height_in_map_units_minus1 + 1) * 16);
  116385. codec_width -= (frame_crop_left_offset + frame_crop_right_offset) * crop_unit_x;
  116386. codec_height -= (frame_crop_top_offset + frame_crop_bottom_offset) * crop_unit_y;
  116387. var present_width = Math.ceil(codec_width * sarScale);
  116388. gb.destroy();
  116389. gb = null;
  116390. return {
  116391. profile_string,
  116392. level_string,
  116393. bit_depth,
  116394. ref_frames,
  116395. chroma_format,
  116396. chroma_format_string: SPSParser2.getChromaFormatString(chroma_format),
  116397. frame_rate: {
  116398. fixed: fps_fixed,
  116399. fps,
  116400. fps_den,
  116401. fps_num
  116402. },
  116403. sar_ratio: {
  116404. width: sar_width,
  116405. height: sar_height
  116406. },
  116407. codec_size: {
  116408. width: codec_width,
  116409. height: codec_height
  116410. },
  116411. present_size: {
  116412. width: present_width,
  116413. height: codec_height
  116414. }
  116415. };
  116416. };
  116417. SPSParser2._skipScalingList = function(gb, count) {
  116418. var last_scale = 8, next_scale = 8;
  116419. var delta_scale = 0;
  116420. for (var i2 = 0; i2 < count; i2++) {
  116421. if (next_scale !== 0) {
  116422. delta_scale = gb.readSEG();
  116423. next_scale = (last_scale + delta_scale + 256) % 256;
  116424. }
  116425. last_scale = next_scale === 0 ? last_scale : next_scale;
  116426. }
  116427. };
  116428. SPSParser2.getProfileString = function(profile_idc) {
  116429. switch (profile_idc) {
  116430. case 66:
  116431. return "Baseline";
  116432. case 77:
  116433. return "Main";
  116434. case 88:
  116435. return "Extended";
  116436. case 100:
  116437. return "High";
  116438. case 110:
  116439. return "High10";
  116440. case 122:
  116441. return "High422";
  116442. case 244:
  116443. return "High444";
  116444. default:
  116445. return "Unknown";
  116446. }
  116447. };
  116448. SPSParser2.getLevelString = function(level_idc) {
  116449. return (level_idc / 10).toFixed(1);
  116450. };
  116451. SPSParser2.getChromaFormatString = function(chroma) {
  116452. switch (chroma) {
  116453. case 420:
  116454. return "4:2:0";
  116455. case 422:
  116456. return "4:2:2";
  116457. case 444:
  116458. return "4:4:4";
  116459. default:
  116460. return "Unknown";
  116461. }
  116462. };
  116463. return SPSParser2;
  116464. }();
  116465. __webpack_exports__2["default"] = SPSParser;
  116466. },
  116467. "./src/flv.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  116468. __webpack_require__2.r(__webpack_exports__2);
  116469. var _utils_polyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/polyfill.js");
  116470. var _core_features_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/core/features.js");
  116471. var _io_loader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/io/loader.js");
  116472. var _player_flv_player_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/player/flv-player.js");
  116473. var _player_native_player_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/player/native-player.js");
  116474. var _player_player_events_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/player/player-events.js");
  116475. var _player_player_errors_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/player/player-errors.js");
  116476. var _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__2("./src/utils/logging-control.js");
  116477. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__2("./src/utils/exception.js");
  116478. _utils_polyfill_js__WEBPACK_IMPORTED_MODULE_0__.default.install();
  116479. function createPlayer(mediaDataSource, optionalConfig) {
  116480. var mds = mediaDataSource;
  116481. if (mds == null || typeof mds !== "object") {
  116482. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_8__.InvalidArgumentException("MediaDataSource must be an javascript object!");
  116483. }
  116484. if (!mds.hasOwnProperty("type")) {
  116485. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_8__.InvalidArgumentException("MediaDataSource must has type field to indicate video file type!");
  116486. }
  116487. switch (mds.type) {
  116488. case "flv":
  116489. return new _player_flv_player_js__WEBPACK_IMPORTED_MODULE_3__.default(mds, optionalConfig);
  116490. default:
  116491. return new _player_native_player_js__WEBPACK_IMPORTED_MODULE_4__.default(mds, optionalConfig);
  116492. }
  116493. }
  116494. function isSupported() {
  116495. return _core_features_js__WEBPACK_IMPORTED_MODULE_1__.default.supportMSEH264Playback();
  116496. }
  116497. function getFeatureList() {
  116498. return _core_features_js__WEBPACK_IMPORTED_MODULE_1__.default.getFeatureList();
  116499. }
  116500. var flvjs2 = {};
  116501. flvjs2.createPlayer = createPlayer;
  116502. flvjs2.isSupported = isSupported;
  116503. flvjs2.getFeatureList = getFeatureList;
  116504. flvjs2.BaseLoader = _io_loader_js__WEBPACK_IMPORTED_MODULE_2__.BaseLoader;
  116505. flvjs2.LoaderStatus = _io_loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus;
  116506. flvjs2.LoaderErrors = _io_loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors;
  116507. flvjs2.Events = _player_player_events_js__WEBPACK_IMPORTED_MODULE_5__.default;
  116508. flvjs2.ErrorTypes = _player_player_errors_js__WEBPACK_IMPORTED_MODULE_6__.ErrorTypes;
  116509. flvjs2.ErrorDetails = _player_player_errors_js__WEBPACK_IMPORTED_MODULE_6__.ErrorDetails;
  116510. flvjs2.FlvPlayer = _player_flv_player_js__WEBPACK_IMPORTED_MODULE_3__.default;
  116511. flvjs2.NativePlayer = _player_native_player_js__WEBPACK_IMPORTED_MODULE_4__.default;
  116512. flvjs2.LoggingControl = _utils_logging_control_js__WEBPACK_IMPORTED_MODULE_7__.default;
  116513. Object.defineProperty(flvjs2, "version", {
  116514. enumerable: true,
  116515. get: function() {
  116516. return "1.6.2";
  116517. }
  116518. });
  116519. __webpack_exports__2["default"] = flvjs2;
  116520. },
  116521. "./src/index.js": function(module3, __unused_webpack_exports, __webpack_require__2) {
  116522. module3.exports = __webpack_require__2("./src/flv.js").default;
  116523. },
  116524. "./src/io/fetch-stream-loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  116525. __webpack_require__2.r(__webpack_exports__2);
  116526. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/browser.js");
  116527. var _loader_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/io/loader.js");
  116528. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/exception.js");
  116529. var __extends = function() {
  116530. var extendStatics = function(d2, b) {
  116531. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  116532. d3.__proto__ = b2;
  116533. } || function(d3, b2) {
  116534. for (var p in b2)
  116535. if (Object.prototype.hasOwnProperty.call(b2, p))
  116536. d3[p] = b2[p];
  116537. };
  116538. return extendStatics(d2, b);
  116539. };
  116540. return function(d2, b) {
  116541. if (typeof b !== "function" && b !== null)
  116542. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  116543. extendStatics(d2, b);
  116544. function __() {
  116545. this.constructor = d2;
  116546. }
  116547. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  116548. };
  116549. }();
  116550. var FetchStreamLoader = function(_super) {
  116551. __extends(FetchStreamLoader2, _super);
  116552. function FetchStreamLoader2(seekHandler, config) {
  116553. var _this = _super.call(this, "fetch-stream-loader") || this;
  116554. _this.TAG = "FetchStreamLoader";
  116555. _this._seekHandler = seekHandler;
  116556. _this._config = config;
  116557. _this._needStash = true;
  116558. _this._requestAbort = false;
  116559. _this._contentLength = null;
  116560. _this._receivedLength = 0;
  116561. return _this;
  116562. }
  116563. FetchStreamLoader2.isSupported = function() {
  116564. try {
  116565. var isWorkWellEdge = _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.msedge && _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.version.minor >= 15048;
  116566. var browserNotBlacklisted = _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.msedge ? isWorkWellEdge : true;
  116567. return self.fetch && self.ReadableStream && browserNotBlacklisted;
  116568. } catch (e) {
  116569. return false;
  116570. }
  116571. };
  116572. FetchStreamLoader2.prototype.destroy = function() {
  116573. if (this.isWorking()) {
  116574. this.abort();
  116575. }
  116576. _super.prototype.destroy.call(this);
  116577. };
  116578. FetchStreamLoader2.prototype.open = function(dataSource, range3) {
  116579. var _this = this;
  116580. this._dataSource = dataSource;
  116581. this._range = range3;
  116582. var sourceURL = dataSource.url;
  116583. if (this._config.reuseRedirectedURL && dataSource.redirectedURL != void 0) {
  116584. sourceURL = dataSource.redirectedURL;
  116585. }
  116586. var seekConfig = this._seekHandler.getConfig(sourceURL, range3);
  116587. var headers = new self.Headers();
  116588. if (typeof seekConfig.headers === "object") {
  116589. var configHeaders = seekConfig.headers;
  116590. for (var key in configHeaders) {
  116591. if (configHeaders.hasOwnProperty(key)) {
  116592. headers.append(key, configHeaders[key]);
  116593. }
  116594. }
  116595. }
  116596. var params = {
  116597. method: "GET",
  116598. headers,
  116599. mode: "cors",
  116600. cache: "default",
  116601. referrerPolicy: "no-referrer-when-downgrade"
  116602. };
  116603. if (typeof this._config.headers === "object") {
  116604. for (var key in this._config.headers) {
  116605. headers.append(key, this._config.headers[key]);
  116606. }
  116607. }
  116608. if (dataSource.cors === false) {
  116609. params.mode = "same-origin";
  116610. }
  116611. if (dataSource.withCredentials) {
  116612. params.credentials = "include";
  116613. }
  116614. if (dataSource.referrerPolicy) {
  116615. params.referrerPolicy = dataSource.referrerPolicy;
  116616. }
  116617. if (self.AbortController) {
  116618. this._abortController = new self.AbortController();
  116619. params.signal = this._abortController.signal;
  116620. }
  116621. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kConnecting;
  116622. self.fetch(seekConfig.url, params).then(function(res) {
  116623. if (_this._requestAbort) {
  116624. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kIdle;
  116625. res.body.cancel();
  116626. return;
  116627. }
  116628. if (res.ok && (res.status >= 200 && res.status <= 299)) {
  116629. if (res.url !== seekConfig.url) {
  116630. if (_this._onURLRedirect) {
  116631. var redirectedURL = _this._seekHandler.removeURLParameters(res.url);
  116632. _this._onURLRedirect(redirectedURL);
  116633. }
  116634. }
  116635. var lengthHeader = res.headers.get("Content-Length");
  116636. if (lengthHeader != null) {
  116637. _this._contentLength = parseInt(lengthHeader);
  116638. if (_this._contentLength !== 0) {
  116639. if (_this._onContentLengthKnown) {
  116640. _this._onContentLengthKnown(_this._contentLength);
  116641. }
  116642. }
  116643. }
  116644. return _this._pump.call(_this, res.body.getReader());
  116645. } else {
  116646. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  116647. if (_this._onError) {
  116648. _this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.HTTP_STATUS_CODE_INVALID, { code: res.status, msg: res.statusText });
  116649. } else {
  116650. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException("FetchStreamLoader: Http code invalid, " + res.status + " " + res.statusText);
  116651. }
  116652. }
  116653. }).catch(function(e) {
  116654. if (_this._abortController && _this._abortController.signal.aborted) {
  116655. return;
  116656. }
  116657. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  116658. if (_this._onError) {
  116659. _this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EXCEPTION, { code: -1, msg: e.message });
  116660. } else {
  116661. throw e;
  116662. }
  116663. });
  116664. };
  116665. FetchStreamLoader2.prototype.abort = function() {
  116666. this._requestAbort = true;
  116667. if (this._status !== _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kBuffering || !_utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.chrome) {
  116668. if (this._abortController) {
  116669. try {
  116670. this._abortController.abort();
  116671. } catch (e) {
  116672. }
  116673. }
  116674. }
  116675. };
  116676. FetchStreamLoader2.prototype._pump = function(reader) {
  116677. var _this = this;
  116678. return reader.read().then(function(result) {
  116679. if (result.done) {
  116680. if (_this._contentLength !== null && _this._receivedLength < _this._contentLength) {
  116681. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  116682. var type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EARLY_EOF;
  116683. var info = { code: -1, msg: "Fetch stream meet Early-EOF" };
  116684. if (_this._onError) {
  116685. _this._onError(type2, info);
  116686. } else {
  116687. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException(info.msg);
  116688. }
  116689. } else {
  116690. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  116691. if (_this._onComplete) {
  116692. _this._onComplete(_this._range.from, _this._range.from + _this._receivedLength - 1);
  116693. }
  116694. }
  116695. } else {
  116696. if (_this._abortController && _this._abortController.signal.aborted) {
  116697. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  116698. return;
  116699. } else if (_this._requestAbort === true) {
  116700. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  116701. return reader.cancel();
  116702. }
  116703. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kBuffering;
  116704. var chunk = result.value.buffer;
  116705. var byteStart = _this._range.from + _this._receivedLength;
  116706. _this._receivedLength += chunk.byteLength;
  116707. if (_this._onDataArrival) {
  116708. _this._onDataArrival(chunk, byteStart, _this._receivedLength);
  116709. }
  116710. _this._pump(reader);
  116711. }
  116712. }).catch(function(e) {
  116713. if (_this._abortController && _this._abortController.signal.aborted) {
  116714. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  116715. return;
  116716. }
  116717. if (e.code === 11 && _utils_browser_js__WEBPACK_IMPORTED_MODULE_0__.default.msedge) {
  116718. return;
  116719. }
  116720. _this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  116721. var type2 = 0;
  116722. var info = null;
  116723. if ((e.code === 19 || e.message === "network error") && (_this._contentLength === null || _this._contentLength !== null && _this._receivedLength < _this._contentLength)) {
  116724. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EARLY_EOF;
  116725. info = { code: e.code, msg: "Fetch stream meet Early-EOF" };
  116726. } else {
  116727. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EXCEPTION;
  116728. info = { code: e.code, msg: e.message };
  116729. }
  116730. if (_this._onError) {
  116731. _this._onError(type2, info);
  116732. } else {
  116733. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException(info.msg);
  116734. }
  116735. });
  116736. };
  116737. return FetchStreamLoader2;
  116738. }(_loader_js__WEBPACK_IMPORTED_MODULE_1__.BaseLoader);
  116739. __webpack_exports__2["default"] = FetchStreamLoader;
  116740. },
  116741. "./src/io/io-controller.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  116742. __webpack_require__2.r(__webpack_exports__2);
  116743. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  116744. var _speed_sampler_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/io/speed-sampler.js");
  116745. var _loader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/io/loader.js");
  116746. var _fetch_stream_loader_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/io/fetch-stream-loader.js");
  116747. var _xhr_moz_chunked_loader_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/io/xhr-moz-chunked-loader.js");
  116748. var _xhr_range_loader_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/io/xhr-range-loader.js");
  116749. var _websocket_loader_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/io/websocket-loader.js");
  116750. var _range_seek_handler_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__2("./src/io/range-seek-handler.js");
  116751. var _param_seek_handler_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__2("./src/io/param-seek-handler.js");
  116752. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__2("./src/utils/exception.js");
  116753. var IOController = function() {
  116754. function IOController2(dataSource, config, extraData) {
  116755. this.TAG = "IOController";
  116756. this._config = config;
  116757. this._extraData = extraData;
  116758. this._stashInitialSize = 1024 * 384;
  116759. if (config.stashInitialSize != void 0 && config.stashInitialSize > 0) {
  116760. this._stashInitialSize = config.stashInitialSize;
  116761. }
  116762. this._stashUsed = 0;
  116763. this._stashSize = this._stashInitialSize;
  116764. this._bufferSize = 1024 * 1024 * 3;
  116765. this._stashBuffer = new ArrayBuffer(this._bufferSize);
  116766. this._stashByteStart = 0;
  116767. this._enableStash = true;
  116768. if (config.enableStashBuffer === false) {
  116769. this._enableStash = false;
  116770. }
  116771. this._loader = null;
  116772. this._loaderClass = null;
  116773. this._seekHandler = null;
  116774. this._dataSource = dataSource;
  116775. this._isWebSocketURL = /wss?:\/\/(.+?)/.test(dataSource.url);
  116776. this._refTotalLength = dataSource.filesize ? dataSource.filesize : null;
  116777. this._totalLength = this._refTotalLength;
  116778. this._fullRequestFlag = false;
  116779. this._currentRange = null;
  116780. this._redirectedURL = null;
  116781. this._speedNormalized = 0;
  116782. this._speedSampler = new _speed_sampler_js__WEBPACK_IMPORTED_MODULE_1__.default();
  116783. this._speedNormalizeList = [64, 128, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096];
  116784. this._isEarlyEofReconnecting = false;
  116785. this._paused = false;
  116786. this._resumeFrom = 0;
  116787. this._onDataArrival = null;
  116788. this._onSeeked = null;
  116789. this._onError = null;
  116790. this._onComplete = null;
  116791. this._onRedirect = null;
  116792. this._onRecoveredEarlyEof = null;
  116793. this._selectSeekHandler();
  116794. this._selectLoader();
  116795. this._createLoader();
  116796. }
  116797. IOController2.prototype.destroy = function() {
  116798. if (this._loader.isWorking()) {
  116799. this._loader.abort();
  116800. }
  116801. this._loader.destroy();
  116802. this._loader = null;
  116803. this._loaderClass = null;
  116804. this._dataSource = null;
  116805. this._stashBuffer = null;
  116806. this._stashUsed = this._stashSize = this._bufferSize = this._stashByteStart = 0;
  116807. this._currentRange = null;
  116808. this._speedSampler = null;
  116809. this._isEarlyEofReconnecting = false;
  116810. this._onDataArrival = null;
  116811. this._onSeeked = null;
  116812. this._onError = null;
  116813. this._onComplete = null;
  116814. this._onRedirect = null;
  116815. this._onRecoveredEarlyEof = null;
  116816. this._extraData = null;
  116817. };
  116818. IOController2.prototype.isWorking = function() {
  116819. return this._loader && this._loader.isWorking() && !this._paused;
  116820. };
  116821. IOController2.prototype.isPaused = function() {
  116822. return this._paused;
  116823. };
  116824. Object.defineProperty(IOController2.prototype, "status", {
  116825. get: function() {
  116826. return this._loader.status;
  116827. },
  116828. enumerable: false,
  116829. configurable: true
  116830. });
  116831. Object.defineProperty(IOController2.prototype, "extraData", {
  116832. get: function() {
  116833. return this._extraData;
  116834. },
  116835. set: function(data) {
  116836. this._extraData = data;
  116837. },
  116838. enumerable: false,
  116839. configurable: true
  116840. });
  116841. Object.defineProperty(IOController2.prototype, "onDataArrival", {
  116842. get: function() {
  116843. return this._onDataArrival;
  116844. },
  116845. set: function(callback2) {
  116846. this._onDataArrival = callback2;
  116847. },
  116848. enumerable: false,
  116849. configurable: true
  116850. });
  116851. Object.defineProperty(IOController2.prototype, "onSeeked", {
  116852. get: function() {
  116853. return this._onSeeked;
  116854. },
  116855. set: function(callback2) {
  116856. this._onSeeked = callback2;
  116857. },
  116858. enumerable: false,
  116859. configurable: true
  116860. });
  116861. Object.defineProperty(IOController2.prototype, "onError", {
  116862. get: function() {
  116863. return this._onError;
  116864. },
  116865. set: function(callback2) {
  116866. this._onError = callback2;
  116867. },
  116868. enumerable: false,
  116869. configurable: true
  116870. });
  116871. Object.defineProperty(IOController2.prototype, "onComplete", {
  116872. get: function() {
  116873. return this._onComplete;
  116874. },
  116875. set: function(callback2) {
  116876. this._onComplete = callback2;
  116877. },
  116878. enumerable: false,
  116879. configurable: true
  116880. });
  116881. Object.defineProperty(IOController2.prototype, "onRedirect", {
  116882. get: function() {
  116883. return this._onRedirect;
  116884. },
  116885. set: function(callback2) {
  116886. this._onRedirect = callback2;
  116887. },
  116888. enumerable: false,
  116889. configurable: true
  116890. });
  116891. Object.defineProperty(IOController2.prototype, "onRecoveredEarlyEof", {
  116892. get: function() {
  116893. return this._onRecoveredEarlyEof;
  116894. },
  116895. set: function(callback2) {
  116896. this._onRecoveredEarlyEof = callback2;
  116897. },
  116898. enumerable: false,
  116899. configurable: true
  116900. });
  116901. Object.defineProperty(IOController2.prototype, "currentURL", {
  116902. get: function() {
  116903. return this._dataSource.url;
  116904. },
  116905. enumerable: false,
  116906. configurable: true
  116907. });
  116908. Object.defineProperty(IOController2.prototype, "hasRedirect", {
  116909. get: function() {
  116910. return this._redirectedURL != null || this._dataSource.redirectedURL != void 0;
  116911. },
  116912. enumerable: false,
  116913. configurable: true
  116914. });
  116915. Object.defineProperty(IOController2.prototype, "currentRedirectedURL", {
  116916. get: function() {
  116917. return this._redirectedURL || this._dataSource.redirectedURL;
  116918. },
  116919. enumerable: false,
  116920. configurable: true
  116921. });
  116922. Object.defineProperty(IOController2.prototype, "currentSpeed", {
  116923. get: function() {
  116924. if (this._loaderClass === _xhr_range_loader_js__WEBPACK_IMPORTED_MODULE_5__.default) {
  116925. return this._loader.currentSpeed;
  116926. }
  116927. return this._speedSampler.lastSecondKBps;
  116928. },
  116929. enumerable: false,
  116930. configurable: true
  116931. });
  116932. Object.defineProperty(IOController2.prototype, "loaderType", {
  116933. get: function() {
  116934. return this._loader.type;
  116935. },
  116936. enumerable: false,
  116937. configurable: true
  116938. });
  116939. IOController2.prototype._selectSeekHandler = function() {
  116940. var config = this._config;
  116941. if (config.seekType === "range") {
  116942. this._seekHandler = new _range_seek_handler_js__WEBPACK_IMPORTED_MODULE_7__.default(this._config.rangeLoadZeroStart);
  116943. } else if (config.seekType === "param") {
  116944. var paramStart = config.seekParamStart || "bstart";
  116945. var paramEnd = config.seekParamEnd || "bend";
  116946. this._seekHandler = new _param_seek_handler_js__WEBPACK_IMPORTED_MODULE_8__.default(paramStart, paramEnd);
  116947. } else if (config.seekType === "custom") {
  116948. if (typeof config.customSeekHandler !== "function") {
  116949. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.InvalidArgumentException("Custom seekType specified in config but invalid customSeekHandler!");
  116950. }
  116951. this._seekHandler = new config.customSeekHandler();
  116952. } else {
  116953. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.InvalidArgumentException("Invalid seekType in config: " + config.seekType);
  116954. }
  116955. };
  116956. IOController2.prototype._selectLoader = function() {
  116957. if (this._config.customLoader != null) {
  116958. this._loaderClass = this._config.customLoader;
  116959. } else if (this._isWebSocketURL) {
  116960. this._loaderClass = _websocket_loader_js__WEBPACK_IMPORTED_MODULE_6__.default;
  116961. } else if (_fetch_stream_loader_js__WEBPACK_IMPORTED_MODULE_3__.default.isSupported()) {
  116962. this._loaderClass = _fetch_stream_loader_js__WEBPACK_IMPORTED_MODULE_3__.default;
  116963. } else if (_xhr_moz_chunked_loader_js__WEBPACK_IMPORTED_MODULE_4__.default.isSupported()) {
  116964. this._loaderClass = _xhr_moz_chunked_loader_js__WEBPACK_IMPORTED_MODULE_4__.default;
  116965. } else if (_xhr_range_loader_js__WEBPACK_IMPORTED_MODULE_5__.default.isSupported()) {
  116966. this._loaderClass = _xhr_range_loader_js__WEBPACK_IMPORTED_MODULE_5__.default;
  116967. } else {
  116968. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.RuntimeException("Your browser doesn't support xhr with arraybuffer responseType!");
  116969. }
  116970. };
  116971. IOController2.prototype._createLoader = function() {
  116972. this._loader = new this._loaderClass(this._seekHandler, this._config);
  116973. if (this._loader.needStashBuffer === false) {
  116974. this._enableStash = false;
  116975. }
  116976. this._loader.onContentLengthKnown = this._onContentLengthKnown.bind(this);
  116977. this._loader.onURLRedirect = this._onURLRedirect.bind(this);
  116978. this._loader.onDataArrival = this._onLoaderChunkArrival.bind(this);
  116979. this._loader.onComplete = this._onLoaderComplete.bind(this);
  116980. this._loader.onError = this._onLoaderError.bind(this);
  116981. };
  116982. IOController2.prototype.open = function(optionalFrom) {
  116983. this._currentRange = { from: 0, to: -1 };
  116984. if (optionalFrom) {
  116985. this._currentRange.from = optionalFrom;
  116986. }
  116987. this._speedSampler.reset();
  116988. if (!optionalFrom) {
  116989. this._fullRequestFlag = true;
  116990. }
  116991. this._loader.open(this._dataSource, Object.assign({}, this._currentRange));
  116992. };
  116993. IOController2.prototype.abort = function() {
  116994. this._loader.abort();
  116995. if (this._paused) {
  116996. this._paused = false;
  116997. this._resumeFrom = 0;
  116998. }
  116999. };
  117000. IOController2.prototype.pause = function() {
  117001. if (this.isWorking()) {
  117002. this._loader.abort();
  117003. if (this._stashUsed !== 0) {
  117004. this._resumeFrom = this._stashByteStart;
  117005. this._currentRange.to = this._stashByteStart - 1;
  117006. } else {
  117007. this._resumeFrom = this._currentRange.to + 1;
  117008. }
  117009. this._stashUsed = 0;
  117010. this._stashByteStart = 0;
  117011. this._paused = true;
  117012. }
  117013. };
  117014. IOController2.prototype.resume = function() {
  117015. if (this._paused) {
  117016. this._paused = false;
  117017. var bytes = this._resumeFrom;
  117018. this._resumeFrom = 0;
  117019. this._internalSeek(bytes, true);
  117020. }
  117021. };
  117022. IOController2.prototype.seek = function(bytes) {
  117023. this._paused = false;
  117024. this._stashUsed = 0;
  117025. this._stashByteStart = 0;
  117026. this._internalSeek(bytes, true);
  117027. };
  117028. IOController2.prototype._internalSeek = function(bytes, dropUnconsumed) {
  117029. if (this._loader.isWorking()) {
  117030. this._loader.abort();
  117031. }
  117032. this._flushStashBuffer(dropUnconsumed);
  117033. this._loader.destroy();
  117034. this._loader = null;
  117035. var requestRange = { from: bytes, to: -1 };
  117036. this._currentRange = { from: requestRange.from, to: -1 };
  117037. this._speedSampler.reset();
  117038. this._stashSize = this._stashInitialSize;
  117039. this._createLoader();
  117040. this._loader.open(this._dataSource, requestRange);
  117041. if (this._onSeeked) {
  117042. this._onSeeked();
  117043. }
  117044. };
  117045. IOController2.prototype.updateUrl = function(url) {
  117046. if (!url || typeof url !== "string" || url.length === 0) {
  117047. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.InvalidArgumentException("Url must be a non-empty string!");
  117048. }
  117049. this._dataSource.url = url;
  117050. };
  117051. IOController2.prototype._expandBuffer = function(expectedBytes) {
  117052. var bufferNewSize = this._stashSize;
  117053. while (bufferNewSize + 1024 * 1024 * 1 < expectedBytes) {
  117054. bufferNewSize *= 2;
  117055. }
  117056. bufferNewSize += 1024 * 1024 * 1;
  117057. if (bufferNewSize === this._bufferSize) {
  117058. return;
  117059. }
  117060. var newBuffer = new ArrayBuffer(bufferNewSize);
  117061. if (this._stashUsed > 0) {
  117062. var stashOldArray = new Uint8Array(this._stashBuffer, 0, this._stashUsed);
  117063. var stashNewArray = new Uint8Array(newBuffer, 0, bufferNewSize);
  117064. stashNewArray.set(stashOldArray, 0);
  117065. }
  117066. this._stashBuffer = newBuffer;
  117067. this._bufferSize = bufferNewSize;
  117068. };
  117069. IOController2.prototype._normalizeSpeed = function(input) {
  117070. var list = this._speedNormalizeList;
  117071. var last = list.length - 1;
  117072. var mid = 0;
  117073. var lbound = 0;
  117074. var ubound = last;
  117075. if (input < list[0]) {
  117076. return list[0];
  117077. }
  117078. while (lbound <= ubound) {
  117079. mid = lbound + Math.floor((ubound - lbound) / 2);
  117080. if (mid === last || input >= list[mid] && input < list[mid + 1]) {
  117081. return list[mid];
  117082. } else if (list[mid] < input) {
  117083. lbound = mid + 1;
  117084. } else {
  117085. ubound = mid - 1;
  117086. }
  117087. }
  117088. };
  117089. IOController2.prototype._adjustStashSize = function(normalized) {
  117090. var stashSizeKB = 0;
  117091. if (this._config.isLive) {
  117092. stashSizeKB = normalized;
  117093. } else {
  117094. if (normalized < 512) {
  117095. stashSizeKB = normalized;
  117096. } else if (normalized >= 512 && normalized <= 1024) {
  117097. stashSizeKB = Math.floor(normalized * 1.5);
  117098. } else {
  117099. stashSizeKB = normalized * 2;
  117100. }
  117101. }
  117102. if (stashSizeKB > 8192) {
  117103. stashSizeKB = 8192;
  117104. }
  117105. var bufferSize = stashSizeKB * 1024 + 1024 * 1024 * 1;
  117106. if (this._bufferSize < bufferSize) {
  117107. this._expandBuffer(bufferSize);
  117108. }
  117109. this._stashSize = stashSizeKB * 1024;
  117110. };
  117111. IOController2.prototype._dispatchChunks = function(chunks, byteStart) {
  117112. this._currentRange.to = byteStart + chunks.byteLength - 1;
  117113. return this._onDataArrival(chunks, byteStart);
  117114. };
  117115. IOController2.prototype._onURLRedirect = function(redirectedURL) {
  117116. this._redirectedURL = redirectedURL;
  117117. if (this._onRedirect) {
  117118. this._onRedirect(redirectedURL);
  117119. }
  117120. };
  117121. IOController2.prototype._onContentLengthKnown = function(contentLength) {
  117122. if (contentLength && this._fullRequestFlag) {
  117123. this._totalLength = contentLength;
  117124. this._fullRequestFlag = false;
  117125. }
  117126. };
  117127. IOController2.prototype._onLoaderChunkArrival = function(chunk, byteStart, receivedLength) {
  117128. if (!this._onDataArrival) {
  117129. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.IllegalStateException("IOController: No existing consumer (onDataArrival) callback!");
  117130. }
  117131. if (this._paused) {
  117132. return;
  117133. }
  117134. if (this._isEarlyEofReconnecting) {
  117135. this._isEarlyEofReconnecting = false;
  117136. if (this._onRecoveredEarlyEof) {
  117137. this._onRecoveredEarlyEof();
  117138. }
  117139. }
  117140. this._speedSampler.addBytes(chunk.byteLength);
  117141. var KBps = this._speedSampler.lastSecondKBps;
  117142. if (KBps !== 0) {
  117143. var normalized = this._normalizeSpeed(KBps);
  117144. if (this._speedNormalized !== normalized) {
  117145. this._speedNormalized = normalized;
  117146. this._adjustStashSize(normalized);
  117147. }
  117148. }
  117149. if (!this._enableStash) {
  117150. if (this._stashUsed === 0) {
  117151. var consumed = this._dispatchChunks(chunk, byteStart);
  117152. if (consumed < chunk.byteLength) {
  117153. var remain = chunk.byteLength - consumed;
  117154. if (remain > this._bufferSize) {
  117155. this._expandBuffer(remain);
  117156. }
  117157. var stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117158. stashArray.set(new Uint8Array(chunk, consumed), 0);
  117159. this._stashUsed += remain;
  117160. this._stashByteStart = byteStart + consumed;
  117161. }
  117162. } else {
  117163. if (this._stashUsed + chunk.byteLength > this._bufferSize) {
  117164. this._expandBuffer(this._stashUsed + chunk.byteLength);
  117165. }
  117166. var stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117167. stashArray.set(new Uint8Array(chunk), this._stashUsed);
  117168. this._stashUsed += chunk.byteLength;
  117169. var consumed = this._dispatchChunks(this._stashBuffer.slice(0, this._stashUsed), this._stashByteStart);
  117170. if (consumed < this._stashUsed && consumed > 0) {
  117171. var remainArray = new Uint8Array(this._stashBuffer, consumed);
  117172. stashArray.set(remainArray, 0);
  117173. }
  117174. this._stashUsed -= consumed;
  117175. this._stashByteStart += consumed;
  117176. }
  117177. } else {
  117178. if (this._stashUsed === 0 && this._stashByteStart === 0) {
  117179. this._stashByteStart = byteStart;
  117180. }
  117181. if (this._stashUsed + chunk.byteLength <= this._stashSize) {
  117182. var stashArray = new Uint8Array(this._stashBuffer, 0, this._stashSize);
  117183. stashArray.set(new Uint8Array(chunk), this._stashUsed);
  117184. this._stashUsed += chunk.byteLength;
  117185. } else {
  117186. var stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117187. if (this._stashUsed > 0) {
  117188. var buffer = this._stashBuffer.slice(0, this._stashUsed);
  117189. var consumed = this._dispatchChunks(buffer, this._stashByteStart);
  117190. if (consumed < buffer.byteLength) {
  117191. if (consumed > 0) {
  117192. var remainArray = new Uint8Array(buffer, consumed);
  117193. stashArray.set(remainArray, 0);
  117194. this._stashUsed = remainArray.byteLength;
  117195. this._stashByteStart += consumed;
  117196. }
  117197. } else {
  117198. this._stashUsed = 0;
  117199. this._stashByteStart += consumed;
  117200. }
  117201. if (this._stashUsed + chunk.byteLength > this._bufferSize) {
  117202. this._expandBuffer(this._stashUsed + chunk.byteLength);
  117203. stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117204. }
  117205. stashArray.set(new Uint8Array(chunk), this._stashUsed);
  117206. this._stashUsed += chunk.byteLength;
  117207. } else {
  117208. var consumed = this._dispatchChunks(chunk, byteStart);
  117209. if (consumed < chunk.byteLength) {
  117210. var remain = chunk.byteLength - consumed;
  117211. if (remain > this._bufferSize) {
  117212. this._expandBuffer(remain);
  117213. stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117214. }
  117215. stashArray.set(new Uint8Array(chunk, consumed), 0);
  117216. this._stashUsed += remain;
  117217. this._stashByteStart = byteStart + consumed;
  117218. }
  117219. }
  117220. }
  117221. }
  117222. };
  117223. IOController2.prototype._flushStashBuffer = function(dropUnconsumed) {
  117224. if (this._stashUsed > 0) {
  117225. var buffer = this._stashBuffer.slice(0, this._stashUsed);
  117226. var consumed = this._dispatchChunks(buffer, this._stashByteStart);
  117227. var remain = buffer.byteLength - consumed;
  117228. if (consumed < buffer.byteLength) {
  117229. if (dropUnconsumed) {
  117230. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, remain + " bytes unconsumed data remain when flush buffer, dropped");
  117231. } else {
  117232. if (consumed > 0) {
  117233. var stashArray = new Uint8Array(this._stashBuffer, 0, this._bufferSize);
  117234. var remainArray = new Uint8Array(buffer, consumed);
  117235. stashArray.set(remainArray, 0);
  117236. this._stashUsed = remainArray.byteLength;
  117237. this._stashByteStart += consumed;
  117238. }
  117239. return 0;
  117240. }
  117241. }
  117242. this._stashUsed = 0;
  117243. this._stashByteStart = 0;
  117244. return remain;
  117245. }
  117246. return 0;
  117247. };
  117248. IOController2.prototype._onLoaderComplete = function(from3, to) {
  117249. this._flushStashBuffer(true);
  117250. if (this._onComplete) {
  117251. this._onComplete(this._extraData);
  117252. }
  117253. };
  117254. IOController2.prototype._onLoaderError = function(type2, data) {
  117255. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.e(this.TAG, "Loader error, code = " + data.code + ", msg = " + data.msg);
  117256. this._flushStashBuffer(false);
  117257. if (this._isEarlyEofReconnecting) {
  117258. this._isEarlyEofReconnecting = false;
  117259. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.UNRECOVERABLE_EARLY_EOF;
  117260. }
  117261. switch (type2) {
  117262. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.EARLY_EOF: {
  117263. if (!this._config.isLive) {
  117264. if (this._totalLength) {
  117265. var nextFrom = this._currentRange.to + 1;
  117266. if (nextFrom < this._totalLength) {
  117267. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Connection lost, trying reconnect...");
  117268. this._isEarlyEofReconnecting = true;
  117269. this._internalSeek(nextFrom, false);
  117270. }
  117271. return;
  117272. }
  117273. }
  117274. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.UNRECOVERABLE_EARLY_EOF;
  117275. break;
  117276. }
  117277. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.UNRECOVERABLE_EARLY_EOF:
  117278. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.CONNECTING_TIMEOUT:
  117279. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.HTTP_STATUS_CODE_INVALID:
  117280. case _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.EXCEPTION:
  117281. break;
  117282. }
  117283. if (this._onError) {
  117284. this._onError(type2, data);
  117285. } else {
  117286. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_9__.RuntimeException("IOException: " + data.msg);
  117287. }
  117288. };
  117289. return IOController2;
  117290. }();
  117291. __webpack_exports__2["default"] = IOController;
  117292. },
  117293. "./src/io/loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117294. __webpack_require__2.r(__webpack_exports__2);
  117295. __webpack_require__2.d(__webpack_exports__2, {
  117296. "LoaderStatus": function() {
  117297. return LoaderStatus;
  117298. },
  117299. "LoaderErrors": function() {
  117300. return LoaderErrors;
  117301. },
  117302. "BaseLoader": function() {
  117303. return BaseLoader;
  117304. }
  117305. });
  117306. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/exception.js");
  117307. var LoaderStatus = {
  117308. kIdle: 0,
  117309. kConnecting: 1,
  117310. kBuffering: 2,
  117311. kError: 3,
  117312. kComplete: 4
  117313. };
  117314. var LoaderErrors = {
  117315. OK: "OK",
  117316. EXCEPTION: "Exception",
  117317. HTTP_STATUS_CODE_INVALID: "HttpStatusCodeInvalid",
  117318. CONNECTING_TIMEOUT: "ConnectingTimeout",
  117319. EARLY_EOF: "EarlyEof",
  117320. UNRECOVERABLE_EARLY_EOF: "UnrecoverableEarlyEof"
  117321. };
  117322. var BaseLoader = function() {
  117323. function BaseLoader2(typeName) {
  117324. this._type = typeName || "undefined";
  117325. this._status = LoaderStatus.kIdle;
  117326. this._needStash = false;
  117327. this._onContentLengthKnown = null;
  117328. this._onURLRedirect = null;
  117329. this._onDataArrival = null;
  117330. this._onError = null;
  117331. this._onComplete = null;
  117332. }
  117333. BaseLoader2.prototype.destroy = function() {
  117334. this._status = LoaderStatus.kIdle;
  117335. this._onContentLengthKnown = null;
  117336. this._onURLRedirect = null;
  117337. this._onDataArrival = null;
  117338. this._onError = null;
  117339. this._onComplete = null;
  117340. };
  117341. BaseLoader2.prototype.isWorking = function() {
  117342. return this._status === LoaderStatus.kConnecting || this._status === LoaderStatus.kBuffering;
  117343. };
  117344. Object.defineProperty(BaseLoader2.prototype, "type", {
  117345. get: function() {
  117346. return this._type;
  117347. },
  117348. enumerable: false,
  117349. configurable: true
  117350. });
  117351. Object.defineProperty(BaseLoader2.prototype, "status", {
  117352. get: function() {
  117353. return this._status;
  117354. },
  117355. enumerable: false,
  117356. configurable: true
  117357. });
  117358. Object.defineProperty(BaseLoader2.prototype, "needStashBuffer", {
  117359. get: function() {
  117360. return this._needStash;
  117361. },
  117362. enumerable: false,
  117363. configurable: true
  117364. });
  117365. Object.defineProperty(BaseLoader2.prototype, "onContentLengthKnown", {
  117366. get: function() {
  117367. return this._onContentLengthKnown;
  117368. },
  117369. set: function(callback2) {
  117370. this._onContentLengthKnown = callback2;
  117371. },
  117372. enumerable: false,
  117373. configurable: true
  117374. });
  117375. Object.defineProperty(BaseLoader2.prototype, "onURLRedirect", {
  117376. get: function() {
  117377. return this._onURLRedirect;
  117378. },
  117379. set: function(callback2) {
  117380. this._onURLRedirect = callback2;
  117381. },
  117382. enumerable: false,
  117383. configurable: true
  117384. });
  117385. Object.defineProperty(BaseLoader2.prototype, "onDataArrival", {
  117386. get: function() {
  117387. return this._onDataArrival;
  117388. },
  117389. set: function(callback2) {
  117390. this._onDataArrival = callback2;
  117391. },
  117392. enumerable: false,
  117393. configurable: true
  117394. });
  117395. Object.defineProperty(BaseLoader2.prototype, "onError", {
  117396. get: function() {
  117397. return this._onError;
  117398. },
  117399. set: function(callback2) {
  117400. this._onError = callback2;
  117401. },
  117402. enumerable: false,
  117403. configurable: true
  117404. });
  117405. Object.defineProperty(BaseLoader2.prototype, "onComplete", {
  117406. get: function() {
  117407. return this._onComplete;
  117408. },
  117409. set: function(callback2) {
  117410. this._onComplete = callback2;
  117411. },
  117412. enumerable: false,
  117413. configurable: true
  117414. });
  117415. BaseLoader2.prototype.open = function(dataSource, range3) {
  117416. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__.NotImplementedException("Unimplemented abstract function!");
  117417. };
  117418. BaseLoader2.prototype.abort = function() {
  117419. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_0__.NotImplementedException("Unimplemented abstract function!");
  117420. };
  117421. return BaseLoader2;
  117422. }();
  117423. },
  117424. "./src/io/param-seek-handler.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117425. __webpack_require__2.r(__webpack_exports__2);
  117426. var ParamSeekHandler = function() {
  117427. function ParamSeekHandler2(paramStart, paramEnd) {
  117428. this._startName = paramStart;
  117429. this._endName = paramEnd;
  117430. }
  117431. ParamSeekHandler2.prototype.getConfig = function(baseUrl, range3) {
  117432. var url = baseUrl;
  117433. if (range3.from !== 0 || range3.to !== -1) {
  117434. var needAnd = true;
  117435. if (url.indexOf("?") === -1) {
  117436. url += "?";
  117437. needAnd = false;
  117438. }
  117439. if (needAnd) {
  117440. url += "&";
  117441. }
  117442. url += this._startName + "=" + range3.from.toString();
  117443. if (range3.to !== -1) {
  117444. url += "&" + this._endName + "=" + range3.to.toString();
  117445. }
  117446. }
  117447. return {
  117448. url,
  117449. headers: {}
  117450. };
  117451. };
  117452. ParamSeekHandler2.prototype.removeURLParameters = function(seekedURL) {
  117453. var baseURL = seekedURL.split("?")[0];
  117454. var params = void 0;
  117455. var queryIndex = seekedURL.indexOf("?");
  117456. if (queryIndex !== -1) {
  117457. params = seekedURL.substring(queryIndex + 1);
  117458. }
  117459. var resultParams = "";
  117460. if (params != void 0 && params.length > 0) {
  117461. var pairs = params.split("&");
  117462. for (var i2 = 0; i2 < pairs.length; i2++) {
  117463. var pair = pairs[i2].split("=");
  117464. var requireAnd = i2 > 0;
  117465. if (pair[0] !== this._startName && pair[0] !== this._endName) {
  117466. if (requireAnd) {
  117467. resultParams += "&";
  117468. }
  117469. resultParams += pairs[i2];
  117470. }
  117471. }
  117472. }
  117473. return resultParams.length === 0 ? baseURL : baseURL + "?" + resultParams;
  117474. };
  117475. return ParamSeekHandler2;
  117476. }();
  117477. __webpack_exports__2["default"] = ParamSeekHandler;
  117478. },
  117479. "./src/io/range-seek-handler.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117480. __webpack_require__2.r(__webpack_exports__2);
  117481. var RangeSeekHandler = function() {
  117482. function RangeSeekHandler2(zeroStart) {
  117483. this._zeroStart = zeroStart || false;
  117484. }
  117485. RangeSeekHandler2.prototype.getConfig = function(url, range3) {
  117486. var headers = {};
  117487. if (range3.from !== 0 || range3.to !== -1) {
  117488. var param = void 0;
  117489. if (range3.to !== -1) {
  117490. param = "bytes=" + range3.from.toString() + "-" + range3.to.toString();
  117491. } else {
  117492. param = "bytes=" + range3.from.toString() + "-";
  117493. }
  117494. headers["Range"] = param;
  117495. } else if (this._zeroStart) {
  117496. headers["Range"] = "bytes=0-";
  117497. }
  117498. return {
  117499. url,
  117500. headers
  117501. };
  117502. };
  117503. RangeSeekHandler2.prototype.removeURLParameters = function(seekedURL) {
  117504. return seekedURL;
  117505. };
  117506. return RangeSeekHandler2;
  117507. }();
  117508. __webpack_exports__2["default"] = RangeSeekHandler;
  117509. },
  117510. "./src/io/speed-sampler.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117511. __webpack_require__2.r(__webpack_exports__2);
  117512. var SpeedSampler = function() {
  117513. function SpeedSampler2() {
  117514. this._firstCheckpoint = 0;
  117515. this._lastCheckpoint = 0;
  117516. this._intervalBytes = 0;
  117517. this._totalBytes = 0;
  117518. this._lastSecondBytes = 0;
  117519. if (self.performance && self.performance.now) {
  117520. this._now = self.performance.now.bind(self.performance);
  117521. } else {
  117522. this._now = Date.now;
  117523. }
  117524. }
  117525. SpeedSampler2.prototype.reset = function() {
  117526. this._firstCheckpoint = this._lastCheckpoint = 0;
  117527. this._totalBytes = this._intervalBytes = 0;
  117528. this._lastSecondBytes = 0;
  117529. };
  117530. SpeedSampler2.prototype.addBytes = function(bytes) {
  117531. if (this._firstCheckpoint === 0) {
  117532. this._firstCheckpoint = this._now();
  117533. this._lastCheckpoint = this._firstCheckpoint;
  117534. this._intervalBytes += bytes;
  117535. this._totalBytes += bytes;
  117536. } else if (this._now() - this._lastCheckpoint < 1e3) {
  117537. this._intervalBytes += bytes;
  117538. this._totalBytes += bytes;
  117539. } else {
  117540. this._lastSecondBytes = this._intervalBytes;
  117541. this._intervalBytes = bytes;
  117542. this._totalBytes += bytes;
  117543. this._lastCheckpoint = this._now();
  117544. }
  117545. };
  117546. Object.defineProperty(SpeedSampler2.prototype, "currentKBps", {
  117547. get: function() {
  117548. this.addBytes(0);
  117549. var durationSeconds = (this._now() - this._lastCheckpoint) / 1e3;
  117550. if (durationSeconds == 0)
  117551. durationSeconds = 1;
  117552. return this._intervalBytes / durationSeconds / 1024;
  117553. },
  117554. enumerable: false,
  117555. configurable: true
  117556. });
  117557. Object.defineProperty(SpeedSampler2.prototype, "lastSecondKBps", {
  117558. get: function() {
  117559. this.addBytes(0);
  117560. if (this._lastSecondBytes !== 0) {
  117561. return this._lastSecondBytes / 1024;
  117562. } else {
  117563. if (this._now() - this._lastCheckpoint >= 500) {
  117564. return this.currentKBps;
  117565. } else {
  117566. return 0;
  117567. }
  117568. }
  117569. },
  117570. enumerable: false,
  117571. configurable: true
  117572. });
  117573. Object.defineProperty(SpeedSampler2.prototype, "averageKBps", {
  117574. get: function() {
  117575. var durationSeconds = (this._now() - this._firstCheckpoint) / 1e3;
  117576. return this._totalBytes / durationSeconds / 1024;
  117577. },
  117578. enumerable: false,
  117579. configurable: true
  117580. });
  117581. return SpeedSampler2;
  117582. }();
  117583. __webpack_exports__2["default"] = SpeedSampler;
  117584. },
  117585. "./src/io/websocket-loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117586. __webpack_require__2.r(__webpack_exports__2);
  117587. var _loader_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/io/loader.js");
  117588. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/exception.js");
  117589. var __extends = function() {
  117590. var extendStatics = function(d2, b) {
  117591. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  117592. d3.__proto__ = b2;
  117593. } || function(d3, b2) {
  117594. for (var p in b2)
  117595. if (Object.prototype.hasOwnProperty.call(b2, p))
  117596. d3[p] = b2[p];
  117597. };
  117598. return extendStatics(d2, b);
  117599. };
  117600. return function(d2, b) {
  117601. if (typeof b !== "function" && b !== null)
  117602. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  117603. extendStatics(d2, b);
  117604. function __() {
  117605. this.constructor = d2;
  117606. }
  117607. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  117608. };
  117609. }();
  117610. var WebSocketLoader = function(_super) {
  117611. __extends(WebSocketLoader2, _super);
  117612. function WebSocketLoader2() {
  117613. var _this = _super.call(this, "websocket-loader") || this;
  117614. _this.TAG = "WebSocketLoader";
  117615. _this._needStash = true;
  117616. _this._ws = null;
  117617. _this._requestAbort = false;
  117618. _this._receivedLength = 0;
  117619. return _this;
  117620. }
  117621. WebSocketLoader2.isSupported = function() {
  117622. try {
  117623. return typeof self.WebSocket !== "undefined";
  117624. } catch (e) {
  117625. return false;
  117626. }
  117627. };
  117628. WebSocketLoader2.prototype.destroy = function() {
  117629. if (this._ws) {
  117630. this.abort();
  117631. }
  117632. _super.prototype.destroy.call(this);
  117633. };
  117634. WebSocketLoader2.prototype.open = function(dataSource) {
  117635. try {
  117636. var ws = this._ws = new self.WebSocket(dataSource.url);
  117637. ws.binaryType = "arraybuffer";
  117638. ws.onopen = this._onWebSocketOpen.bind(this);
  117639. ws.onclose = this._onWebSocketClose.bind(this);
  117640. ws.onmessage = this._onWebSocketMessage.bind(this);
  117641. ws.onerror = this._onWebSocketError.bind(this);
  117642. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kConnecting;
  117643. } catch (e) {
  117644. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kError;
  117645. var info = { code: e.code, msg: e.message };
  117646. if (this._onError) {
  117647. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.EXCEPTION, info);
  117648. } else {
  117649. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_1__.RuntimeException(info.msg);
  117650. }
  117651. }
  117652. };
  117653. WebSocketLoader2.prototype.abort = function() {
  117654. var ws = this._ws;
  117655. if (ws && (ws.readyState === 0 || ws.readyState === 1)) {
  117656. this._requestAbort = true;
  117657. ws.close();
  117658. }
  117659. this._ws = null;
  117660. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kComplete;
  117661. };
  117662. WebSocketLoader2.prototype._onWebSocketOpen = function(e) {
  117663. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kBuffering;
  117664. };
  117665. WebSocketLoader2.prototype._onWebSocketClose = function(e) {
  117666. if (this._requestAbort === true) {
  117667. this._requestAbort = false;
  117668. return;
  117669. }
  117670. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kComplete;
  117671. if (this._onComplete) {
  117672. this._onComplete(0, this._receivedLength - 1);
  117673. }
  117674. };
  117675. WebSocketLoader2.prototype._onWebSocketMessage = function(e) {
  117676. var _this = this;
  117677. if (e.data instanceof ArrayBuffer) {
  117678. this._dispatchArrayBuffer(e.data);
  117679. } else if (e.data instanceof Blob) {
  117680. var reader_1 = new FileReader();
  117681. reader_1.onload = function() {
  117682. _this._dispatchArrayBuffer(reader_1.result);
  117683. };
  117684. reader_1.readAsArrayBuffer(e.data);
  117685. } else {
  117686. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kError;
  117687. var info = { code: -1, msg: "Unsupported WebSocket message type: " + e.data.constructor.name };
  117688. if (this._onError) {
  117689. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.EXCEPTION, info);
  117690. } else {
  117691. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_1__.RuntimeException(info.msg);
  117692. }
  117693. }
  117694. };
  117695. WebSocketLoader2.prototype._dispatchArrayBuffer = function(arraybuffer) {
  117696. var chunk = arraybuffer;
  117697. var byteStart = this._receivedLength;
  117698. this._receivedLength += chunk.byteLength;
  117699. if (this._onDataArrival) {
  117700. this._onDataArrival(chunk, byteStart, this._receivedLength);
  117701. }
  117702. };
  117703. WebSocketLoader2.prototype._onWebSocketError = function(e) {
  117704. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderStatus.kError;
  117705. var info = {
  117706. code: e.code,
  117707. msg: e.message
  117708. };
  117709. if (this._onError) {
  117710. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.EXCEPTION, info);
  117711. } else {
  117712. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_1__.RuntimeException(info.msg);
  117713. }
  117714. };
  117715. return WebSocketLoader2;
  117716. }(_loader_js__WEBPACK_IMPORTED_MODULE_0__.BaseLoader);
  117717. __webpack_exports__2["default"] = WebSocketLoader;
  117718. },
  117719. "./src/io/xhr-moz-chunked-loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117720. __webpack_require__2.r(__webpack_exports__2);
  117721. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  117722. var _loader_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/io/loader.js");
  117723. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/exception.js");
  117724. var __extends = function() {
  117725. var extendStatics = function(d2, b) {
  117726. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  117727. d3.__proto__ = b2;
  117728. } || function(d3, b2) {
  117729. for (var p in b2)
  117730. if (Object.prototype.hasOwnProperty.call(b2, p))
  117731. d3[p] = b2[p];
  117732. };
  117733. return extendStatics(d2, b);
  117734. };
  117735. return function(d2, b) {
  117736. if (typeof b !== "function" && b !== null)
  117737. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  117738. extendStatics(d2, b);
  117739. function __() {
  117740. this.constructor = d2;
  117741. }
  117742. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  117743. };
  117744. }();
  117745. var MozChunkedLoader = function(_super) {
  117746. __extends(MozChunkedLoader2, _super);
  117747. function MozChunkedLoader2(seekHandler, config) {
  117748. var _this = _super.call(this, "xhr-moz-chunked-loader") || this;
  117749. _this.TAG = "MozChunkedLoader";
  117750. _this._seekHandler = seekHandler;
  117751. _this._config = config;
  117752. _this._needStash = true;
  117753. _this._xhr = null;
  117754. _this._requestAbort = false;
  117755. _this._contentLength = null;
  117756. _this._receivedLength = 0;
  117757. return _this;
  117758. }
  117759. MozChunkedLoader2.isSupported = function() {
  117760. try {
  117761. var xhr = new XMLHttpRequest();
  117762. xhr.open("GET", "https://example.com", true);
  117763. xhr.responseType = "moz-chunked-arraybuffer";
  117764. return xhr.responseType === "moz-chunked-arraybuffer";
  117765. } catch (e) {
  117766. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w("MozChunkedLoader", e.message);
  117767. return false;
  117768. }
  117769. };
  117770. MozChunkedLoader2.prototype.destroy = function() {
  117771. if (this.isWorking()) {
  117772. this.abort();
  117773. }
  117774. if (this._xhr) {
  117775. this._xhr.onreadystatechange = null;
  117776. this._xhr.onprogress = null;
  117777. this._xhr.onloadend = null;
  117778. this._xhr.onerror = null;
  117779. this._xhr = null;
  117780. }
  117781. _super.prototype.destroy.call(this);
  117782. };
  117783. MozChunkedLoader2.prototype.open = function(dataSource, range3) {
  117784. this._dataSource = dataSource;
  117785. this._range = range3;
  117786. var sourceURL = dataSource.url;
  117787. if (this._config.reuseRedirectedURL && dataSource.redirectedURL != void 0) {
  117788. sourceURL = dataSource.redirectedURL;
  117789. }
  117790. var seekConfig = this._seekHandler.getConfig(sourceURL, range3);
  117791. this._requestURL = seekConfig.url;
  117792. var xhr = this._xhr = new XMLHttpRequest();
  117793. xhr.open("GET", seekConfig.url, true);
  117794. xhr.responseType = "moz-chunked-arraybuffer";
  117795. xhr.onreadystatechange = this._onReadyStateChange.bind(this);
  117796. xhr.onprogress = this._onProgress.bind(this);
  117797. xhr.onloadend = this._onLoadEnd.bind(this);
  117798. xhr.onerror = this._onXhrError.bind(this);
  117799. if (dataSource.withCredentials) {
  117800. xhr.withCredentials = true;
  117801. }
  117802. if (typeof seekConfig.headers === "object") {
  117803. var headers = seekConfig.headers;
  117804. for (var key in headers) {
  117805. if (headers.hasOwnProperty(key)) {
  117806. xhr.setRequestHeader(key, headers[key]);
  117807. }
  117808. }
  117809. }
  117810. if (typeof this._config.headers === "object") {
  117811. var headers = this._config.headers;
  117812. for (var key in headers) {
  117813. if (headers.hasOwnProperty(key)) {
  117814. xhr.setRequestHeader(key, headers[key]);
  117815. }
  117816. }
  117817. }
  117818. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kConnecting;
  117819. xhr.send();
  117820. };
  117821. MozChunkedLoader2.prototype.abort = function() {
  117822. this._requestAbort = true;
  117823. if (this._xhr) {
  117824. this._xhr.abort();
  117825. }
  117826. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  117827. };
  117828. MozChunkedLoader2.prototype._onReadyStateChange = function(e) {
  117829. var xhr = e.target;
  117830. if (xhr.readyState === 2) {
  117831. if (xhr.responseURL != void 0 && xhr.responseURL !== this._requestURL) {
  117832. if (this._onURLRedirect) {
  117833. var redirectedURL = this._seekHandler.removeURLParameters(xhr.responseURL);
  117834. this._onURLRedirect(redirectedURL);
  117835. }
  117836. }
  117837. if (xhr.status !== 0 && (xhr.status < 200 || xhr.status > 299)) {
  117838. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  117839. if (this._onError) {
  117840. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.HTTP_STATUS_CODE_INVALID, { code: xhr.status, msg: xhr.statusText });
  117841. } else {
  117842. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException("MozChunkedLoader: Http code invalid, " + xhr.status + " " + xhr.statusText);
  117843. }
  117844. } else {
  117845. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kBuffering;
  117846. }
  117847. }
  117848. };
  117849. MozChunkedLoader2.prototype._onProgress = function(e) {
  117850. if (this._status === _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError) {
  117851. return;
  117852. }
  117853. if (this._contentLength === null) {
  117854. if (e.total !== null && e.total !== 0) {
  117855. this._contentLength = e.total;
  117856. if (this._onContentLengthKnown) {
  117857. this._onContentLengthKnown(this._contentLength);
  117858. }
  117859. }
  117860. }
  117861. var chunk = e.target.response;
  117862. var byteStart = this._range.from + this._receivedLength;
  117863. this._receivedLength += chunk.byteLength;
  117864. if (this._onDataArrival) {
  117865. this._onDataArrival(chunk, byteStart, this._receivedLength);
  117866. }
  117867. };
  117868. MozChunkedLoader2.prototype._onLoadEnd = function(e) {
  117869. if (this._requestAbort === true) {
  117870. this._requestAbort = false;
  117871. return;
  117872. } else if (this._status === _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError) {
  117873. return;
  117874. }
  117875. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kComplete;
  117876. if (this._onComplete) {
  117877. this._onComplete(this._range.from, this._range.from + this._receivedLength - 1);
  117878. }
  117879. };
  117880. MozChunkedLoader2.prototype._onXhrError = function(e) {
  117881. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderStatus.kError;
  117882. var type2 = 0;
  117883. var info = null;
  117884. if (this._contentLength && e.loaded < this._contentLength) {
  117885. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EARLY_EOF;
  117886. info = { code: -1, msg: "Moz-Chunked stream meet Early-Eof" };
  117887. } else {
  117888. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_1__.LoaderErrors.EXCEPTION;
  117889. info = { code: -1, msg: e.constructor.name + " " + e.type };
  117890. }
  117891. if (this._onError) {
  117892. this._onError(type2, info);
  117893. } else {
  117894. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_2__.RuntimeException(info.msg);
  117895. }
  117896. };
  117897. return MozChunkedLoader2;
  117898. }(_loader_js__WEBPACK_IMPORTED_MODULE_1__.BaseLoader);
  117899. __webpack_exports__2["default"] = MozChunkedLoader;
  117900. },
  117901. "./src/io/xhr-range-loader.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  117902. __webpack_require__2.r(__webpack_exports__2);
  117903. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  117904. var _speed_sampler_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/io/speed-sampler.js");
  117905. var _loader_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/io/loader.js");
  117906. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/utils/exception.js");
  117907. var __extends = function() {
  117908. var extendStatics = function(d2, b) {
  117909. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  117910. d3.__proto__ = b2;
  117911. } || function(d3, b2) {
  117912. for (var p in b2)
  117913. if (Object.prototype.hasOwnProperty.call(b2, p))
  117914. d3[p] = b2[p];
  117915. };
  117916. return extendStatics(d2, b);
  117917. };
  117918. return function(d2, b) {
  117919. if (typeof b !== "function" && b !== null)
  117920. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  117921. extendStatics(d2, b);
  117922. function __() {
  117923. this.constructor = d2;
  117924. }
  117925. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  117926. };
  117927. }();
  117928. var RangeLoader = function(_super) {
  117929. __extends(RangeLoader2, _super);
  117930. function RangeLoader2(seekHandler, config) {
  117931. var _this = _super.call(this, "xhr-range-loader") || this;
  117932. _this.TAG = "RangeLoader";
  117933. _this._seekHandler = seekHandler;
  117934. _this._config = config;
  117935. _this._needStash = false;
  117936. _this._chunkSizeKBList = [
  117937. 128,
  117938. 256,
  117939. 384,
  117940. 512,
  117941. 768,
  117942. 1024,
  117943. 1536,
  117944. 2048,
  117945. 3072,
  117946. 4096,
  117947. 5120,
  117948. 6144,
  117949. 7168,
  117950. 8192
  117951. ];
  117952. _this._currentChunkSizeKB = 384;
  117953. _this._currentSpeedNormalized = 0;
  117954. _this._zeroSpeedChunkCount = 0;
  117955. _this._xhr = null;
  117956. _this._speedSampler = new _speed_sampler_js__WEBPACK_IMPORTED_MODULE_1__.default();
  117957. _this._requestAbort = false;
  117958. _this._waitForTotalLength = false;
  117959. _this._totalLengthReceived = false;
  117960. _this._currentRequestURL = null;
  117961. _this._currentRedirectedURL = null;
  117962. _this._currentRequestRange = null;
  117963. _this._totalLength = null;
  117964. _this._contentLength = null;
  117965. _this._receivedLength = 0;
  117966. _this._lastTimeLoaded = 0;
  117967. return _this;
  117968. }
  117969. RangeLoader2.isSupported = function() {
  117970. try {
  117971. var xhr = new XMLHttpRequest();
  117972. xhr.open("GET", "https://example.com", true);
  117973. xhr.responseType = "arraybuffer";
  117974. return xhr.responseType === "arraybuffer";
  117975. } catch (e) {
  117976. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w("RangeLoader", e.message);
  117977. return false;
  117978. }
  117979. };
  117980. RangeLoader2.prototype.destroy = function() {
  117981. if (this.isWorking()) {
  117982. this.abort();
  117983. }
  117984. if (this._xhr) {
  117985. this._xhr.onreadystatechange = null;
  117986. this._xhr.onprogress = null;
  117987. this._xhr.onload = null;
  117988. this._xhr.onerror = null;
  117989. this._xhr = null;
  117990. }
  117991. _super.prototype.destroy.call(this);
  117992. };
  117993. Object.defineProperty(RangeLoader2.prototype, "currentSpeed", {
  117994. get: function() {
  117995. return this._speedSampler.lastSecondKBps;
  117996. },
  117997. enumerable: false,
  117998. configurable: true
  117999. });
  118000. RangeLoader2.prototype.open = function(dataSource, range3) {
  118001. this._dataSource = dataSource;
  118002. this._range = range3;
  118003. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kConnecting;
  118004. var useRefTotalLength = false;
  118005. if (this._dataSource.filesize != void 0 && this._dataSource.filesize !== 0) {
  118006. useRefTotalLength = true;
  118007. this._totalLength = this._dataSource.filesize;
  118008. }
  118009. if (!this._totalLengthReceived && !useRefTotalLength) {
  118010. this._waitForTotalLength = true;
  118011. this._internalOpen(this._dataSource, { from: 0, to: -1 });
  118012. } else {
  118013. this._openSubRange();
  118014. }
  118015. };
  118016. RangeLoader2.prototype._openSubRange = function() {
  118017. var chunkSize = this._currentChunkSizeKB * 1024;
  118018. var from3 = this._range.from + this._receivedLength;
  118019. var to = from3 + chunkSize;
  118020. if (this._contentLength != null) {
  118021. if (to - this._range.from >= this._contentLength) {
  118022. to = this._range.from + this._contentLength - 1;
  118023. }
  118024. }
  118025. this._currentRequestRange = { from: from3, to };
  118026. this._internalOpen(this._dataSource, this._currentRequestRange);
  118027. };
  118028. RangeLoader2.prototype._internalOpen = function(dataSource, range3) {
  118029. this._lastTimeLoaded = 0;
  118030. var sourceURL = dataSource.url;
  118031. if (this._config.reuseRedirectedURL) {
  118032. if (this._currentRedirectedURL != void 0) {
  118033. sourceURL = this._currentRedirectedURL;
  118034. } else if (dataSource.redirectedURL != void 0) {
  118035. sourceURL = dataSource.redirectedURL;
  118036. }
  118037. }
  118038. var seekConfig = this._seekHandler.getConfig(sourceURL, range3);
  118039. this._currentRequestURL = seekConfig.url;
  118040. var xhr = this._xhr = new XMLHttpRequest();
  118041. xhr.open("GET", seekConfig.url, true);
  118042. xhr.responseType = "arraybuffer";
  118043. xhr.onreadystatechange = this._onReadyStateChange.bind(this);
  118044. xhr.onprogress = this._onProgress.bind(this);
  118045. xhr.onload = this._onLoad.bind(this);
  118046. xhr.onerror = this._onXhrError.bind(this);
  118047. if (dataSource.withCredentials) {
  118048. xhr.withCredentials = true;
  118049. }
  118050. if (typeof seekConfig.headers === "object") {
  118051. var headers = seekConfig.headers;
  118052. for (var key in headers) {
  118053. if (headers.hasOwnProperty(key)) {
  118054. xhr.setRequestHeader(key, headers[key]);
  118055. }
  118056. }
  118057. }
  118058. if (typeof this._config.headers === "object") {
  118059. var headers = this._config.headers;
  118060. for (var key in headers) {
  118061. if (headers.hasOwnProperty(key)) {
  118062. xhr.setRequestHeader(key, headers[key]);
  118063. }
  118064. }
  118065. }
  118066. xhr.send();
  118067. };
  118068. RangeLoader2.prototype.abort = function() {
  118069. this._requestAbort = true;
  118070. this._internalAbort();
  118071. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kComplete;
  118072. };
  118073. RangeLoader2.prototype._internalAbort = function() {
  118074. if (this._xhr) {
  118075. this._xhr.onreadystatechange = null;
  118076. this._xhr.onprogress = null;
  118077. this._xhr.onload = null;
  118078. this._xhr.onerror = null;
  118079. this._xhr.abort();
  118080. this._xhr = null;
  118081. }
  118082. };
  118083. RangeLoader2.prototype._onReadyStateChange = function(e) {
  118084. var xhr = e.target;
  118085. if (xhr.readyState === 2) {
  118086. if (xhr.responseURL != void 0) {
  118087. var redirectedURL = this._seekHandler.removeURLParameters(xhr.responseURL);
  118088. if (xhr.responseURL !== this._currentRequestURL && redirectedURL !== this._currentRedirectedURL) {
  118089. this._currentRedirectedURL = redirectedURL;
  118090. if (this._onURLRedirect) {
  118091. this._onURLRedirect(redirectedURL);
  118092. }
  118093. }
  118094. }
  118095. if (xhr.status >= 200 && xhr.status <= 299) {
  118096. if (this._waitForTotalLength) {
  118097. return;
  118098. }
  118099. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kBuffering;
  118100. } else {
  118101. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kError;
  118102. if (this._onError) {
  118103. this._onError(_loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.HTTP_STATUS_CODE_INVALID, { code: xhr.status, msg: xhr.statusText });
  118104. } else {
  118105. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.RuntimeException("RangeLoader: Http code invalid, " + xhr.status + " " + xhr.statusText);
  118106. }
  118107. }
  118108. }
  118109. };
  118110. RangeLoader2.prototype._onProgress = function(e) {
  118111. if (this._status === _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kError) {
  118112. return;
  118113. }
  118114. if (this._contentLength === null) {
  118115. var openNextRange = false;
  118116. if (this._waitForTotalLength) {
  118117. this._waitForTotalLength = false;
  118118. this._totalLengthReceived = true;
  118119. openNextRange = true;
  118120. var total = e.total;
  118121. this._internalAbort();
  118122. if (total != null & total !== 0) {
  118123. this._totalLength = total;
  118124. }
  118125. }
  118126. if (this._range.to === -1) {
  118127. this._contentLength = this._totalLength - this._range.from;
  118128. } else {
  118129. this._contentLength = this._range.to - this._range.from + 1;
  118130. }
  118131. if (openNextRange) {
  118132. this._openSubRange();
  118133. return;
  118134. }
  118135. if (this._onContentLengthKnown) {
  118136. this._onContentLengthKnown(this._contentLength);
  118137. }
  118138. }
  118139. var delta = e.loaded - this._lastTimeLoaded;
  118140. this._lastTimeLoaded = e.loaded;
  118141. this._speedSampler.addBytes(delta);
  118142. };
  118143. RangeLoader2.prototype._normalizeSpeed = function(input) {
  118144. var list = this._chunkSizeKBList;
  118145. var last = list.length - 1;
  118146. var mid = 0;
  118147. var lbound = 0;
  118148. var ubound = last;
  118149. if (input < list[0]) {
  118150. return list[0];
  118151. }
  118152. while (lbound <= ubound) {
  118153. mid = lbound + Math.floor((ubound - lbound) / 2);
  118154. if (mid === last || input >= list[mid] && input < list[mid + 1]) {
  118155. return list[mid];
  118156. } else if (list[mid] < input) {
  118157. lbound = mid + 1;
  118158. } else {
  118159. ubound = mid - 1;
  118160. }
  118161. }
  118162. };
  118163. RangeLoader2.prototype._onLoad = function(e) {
  118164. if (this._status === _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kError) {
  118165. return;
  118166. }
  118167. if (this._waitForTotalLength) {
  118168. this._waitForTotalLength = false;
  118169. return;
  118170. }
  118171. this._lastTimeLoaded = 0;
  118172. var KBps = this._speedSampler.lastSecondKBps;
  118173. if (KBps === 0) {
  118174. this._zeroSpeedChunkCount++;
  118175. if (this._zeroSpeedChunkCount >= 3) {
  118176. KBps = this._speedSampler.currentKBps;
  118177. }
  118178. }
  118179. if (KBps !== 0) {
  118180. var normalized = this._normalizeSpeed(KBps);
  118181. if (this._currentSpeedNormalized !== normalized) {
  118182. this._currentSpeedNormalized = normalized;
  118183. this._currentChunkSizeKB = normalized;
  118184. }
  118185. }
  118186. var chunk = e.target.response;
  118187. var byteStart = this._range.from + this._receivedLength;
  118188. this._receivedLength += chunk.byteLength;
  118189. var reportComplete = false;
  118190. if (this._contentLength != null && this._receivedLength < this._contentLength) {
  118191. this._openSubRange();
  118192. } else {
  118193. reportComplete = true;
  118194. }
  118195. if (this._onDataArrival) {
  118196. this._onDataArrival(chunk, byteStart, this._receivedLength);
  118197. }
  118198. if (reportComplete) {
  118199. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kComplete;
  118200. if (this._onComplete) {
  118201. this._onComplete(this._range.from, this._range.from + this._receivedLength - 1);
  118202. }
  118203. }
  118204. };
  118205. RangeLoader2.prototype._onXhrError = function(e) {
  118206. this._status = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderStatus.kError;
  118207. var type2 = 0;
  118208. var info = null;
  118209. if (this._contentLength && this._receivedLength > 0 && this._receivedLength < this._contentLength) {
  118210. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.EARLY_EOF;
  118211. info = { code: -1, msg: "RangeLoader meet Early-Eof" };
  118212. } else {
  118213. type2 = _loader_js__WEBPACK_IMPORTED_MODULE_2__.LoaderErrors.EXCEPTION;
  118214. info = { code: -1, msg: e.constructor.name + " " + e.type };
  118215. }
  118216. if (this._onError) {
  118217. this._onError(type2, info);
  118218. } else {
  118219. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.RuntimeException(info.msg);
  118220. }
  118221. };
  118222. return RangeLoader2;
  118223. }(_loader_js__WEBPACK_IMPORTED_MODULE_2__.BaseLoader);
  118224. __webpack_exports__2["default"] = RangeLoader;
  118225. },
  118226. "./src/player/flv-player.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  118227. __webpack_require__2.r(__webpack_exports__2);
  118228. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  118229. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  118230. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/logger.js");
  118231. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/utils/browser.js");
  118232. var _player_events_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/player/player-events.js");
  118233. var _core_transmuxer_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/transmuxer.js");
  118234. var _core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/core/transmuxing-events.js");
  118235. var _core_mse_controller_js__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__2("./src/core/mse-controller.js");
  118236. var _core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__2("./src/core/mse-events.js");
  118237. var _player_errors_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__2("./src/player/player-errors.js");
  118238. var _config_js__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__2("./src/config.js");
  118239. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__2("./src/utils/exception.js");
  118240. var FlvPlayer = function() {
  118241. function FlvPlayer2(mediaDataSource, config) {
  118242. this.TAG = "FlvPlayer";
  118243. this._type = "FlvPlayer";
  118244. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  118245. this._config = (0, _config_js__WEBPACK_IMPORTED_MODULE_9__.createDefaultConfig)();
  118246. if (typeof config === "object") {
  118247. Object.assign(this._config, config);
  118248. }
  118249. if (mediaDataSource.type.toLowerCase() !== "flv") {
  118250. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_10__.InvalidArgumentException("FlvPlayer requires an flv MediaDataSource input!");
  118251. }
  118252. if (mediaDataSource.isLive === true) {
  118253. this._config.isLive = true;
  118254. }
  118255. this.e = {
  118256. onvLoadedMetadata: this._onvLoadedMetadata.bind(this),
  118257. onvSeeking: this._onvSeeking.bind(this),
  118258. onvCanPlay: this._onvCanPlay.bind(this),
  118259. onvStalled: this._onvStalled.bind(this),
  118260. onvProgress: this._onvProgress.bind(this)
  118261. };
  118262. if (self.performance && self.performance.now) {
  118263. this._now = self.performance.now.bind(self.performance);
  118264. } else {
  118265. this._now = Date.now;
  118266. }
  118267. this._pendingSeekTime = null;
  118268. this._requestSetTime = false;
  118269. this._seekpointRecord = null;
  118270. this._progressChecker = null;
  118271. this._mediaDataSource = mediaDataSource;
  118272. this._mediaElement = null;
  118273. this._msectl = null;
  118274. this._transmuxer = null;
  118275. this._mseSourceOpened = false;
  118276. this._hasPendingLoad = false;
  118277. this._receivedCanPlay = false;
  118278. this._mediaInfo = null;
  118279. this._statisticsInfo = null;
  118280. var chromeNeedIDRFix = _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.chrome && (_utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.version.major < 50 || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.version.major === 50 && _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.version.build < 2661);
  118281. this._alwaysSeekKeyframe = chromeNeedIDRFix || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.msedge || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.msie ? true : false;
  118282. if (this._alwaysSeekKeyframe) {
  118283. this._config.accurateSeek = false;
  118284. }
  118285. }
  118286. FlvPlayer2.prototype.destroy = function() {
  118287. if (this._progressChecker != null) {
  118288. window.clearInterval(this._progressChecker);
  118289. this._progressChecker = null;
  118290. }
  118291. if (this._transmuxer) {
  118292. this.unload();
  118293. }
  118294. if (this._mediaElement) {
  118295. this.detachMediaElement();
  118296. }
  118297. this.e = null;
  118298. this._mediaDataSource = null;
  118299. this._emitter.removeAllListeners();
  118300. this._emitter = null;
  118301. };
  118302. FlvPlayer2.prototype.on = function(event2, listener) {
  118303. var _this = this;
  118304. if (event2 === _player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO) {
  118305. if (this._mediaInfo != null) {
  118306. Promise.resolve().then(function() {
  118307. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO, _this.mediaInfo);
  118308. });
  118309. }
  118310. } else if (event2 === _player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO) {
  118311. if (this._statisticsInfo != null) {
  118312. Promise.resolve().then(function() {
  118313. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO, _this.statisticsInfo);
  118314. });
  118315. }
  118316. }
  118317. this._emitter.addListener(event2, listener);
  118318. };
  118319. FlvPlayer2.prototype.off = function(event2, listener) {
  118320. this._emitter.removeListener(event2, listener);
  118321. };
  118322. FlvPlayer2.prototype.attachMediaElement = function(mediaElement) {
  118323. var _this = this;
  118324. this._mediaElement = mediaElement;
  118325. mediaElement.addEventListener("loadedmetadata", this.e.onvLoadedMetadata);
  118326. mediaElement.addEventListener("seeking", this.e.onvSeeking);
  118327. mediaElement.addEventListener("canplay", this.e.onvCanPlay);
  118328. mediaElement.addEventListener("stalled", this.e.onvStalled);
  118329. mediaElement.addEventListener("progress", this.e.onvProgress);
  118330. this._msectl = new _core_mse_controller_js__WEBPACK_IMPORTED_MODULE_6__.default(this._config);
  118331. this._msectl.on(_core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__.default.UPDATE_END, this._onmseUpdateEnd.bind(this));
  118332. this._msectl.on(_core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__.default.BUFFER_FULL, this._onmseBufferFull.bind(this));
  118333. this._msectl.on(_core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__.default.SOURCE_OPEN, function() {
  118334. _this._mseSourceOpened = true;
  118335. if (_this._hasPendingLoad) {
  118336. _this._hasPendingLoad = false;
  118337. _this.load();
  118338. }
  118339. });
  118340. this._msectl.on(_core_mse_events_js__WEBPACK_IMPORTED_MODULE_7__.default.ERROR, function(info) {
  118341. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, _player_errors_js__WEBPACK_IMPORTED_MODULE_8__.ErrorTypes.MEDIA_ERROR, _player_errors_js__WEBPACK_IMPORTED_MODULE_8__.ErrorDetails.MEDIA_MSE_ERROR, info);
  118342. });
  118343. this._msectl.attachMediaElement(mediaElement);
  118344. if (this._pendingSeekTime != null) {
  118345. try {
  118346. mediaElement.currentTime = this._pendingSeekTime;
  118347. this._pendingSeekTime = null;
  118348. } catch (e) {
  118349. }
  118350. }
  118351. };
  118352. FlvPlayer2.prototype.detachMediaElement = function() {
  118353. if (this._mediaElement) {
  118354. this._msectl.detachMediaElement();
  118355. this._mediaElement.removeEventListener("loadedmetadata", this.e.onvLoadedMetadata);
  118356. this._mediaElement.removeEventListener("seeking", this.e.onvSeeking);
  118357. this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay);
  118358. this._mediaElement.removeEventListener("stalled", this.e.onvStalled);
  118359. this._mediaElement.removeEventListener("progress", this.e.onvProgress);
  118360. this._mediaElement = null;
  118361. }
  118362. if (this._msectl) {
  118363. this._msectl.destroy();
  118364. this._msectl = null;
  118365. }
  118366. };
  118367. FlvPlayer2.prototype.load = function() {
  118368. var _this = this;
  118369. if (!this._mediaElement) {
  118370. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_10__.IllegalStateException("HTMLMediaElement must be attached before load()!");
  118371. }
  118372. if (this._transmuxer) {
  118373. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_10__.IllegalStateException("FlvPlayer.load() has been called, please call unload() first!");
  118374. }
  118375. if (this._hasPendingLoad) {
  118376. return;
  118377. }
  118378. if (this._config.deferLoadAfterSourceOpen && this._mseSourceOpened === false) {
  118379. this._hasPendingLoad = true;
  118380. return;
  118381. }
  118382. if (this._mediaElement.readyState > 0) {
  118383. this._requestSetTime = true;
  118384. this._mediaElement.currentTime = 0;
  118385. }
  118386. this._transmuxer = new _core_transmuxer_js__WEBPACK_IMPORTED_MODULE_4__.default(this._mediaDataSource, this._config);
  118387. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.INIT_SEGMENT, function(type2, is) {
  118388. _this._msectl.appendInitSegment(is);
  118389. });
  118390. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_SEGMENT, function(type2, ms) {
  118391. _this._msectl.appendMediaSegment(ms);
  118392. if (_this._config.lazyLoad && !_this._config.isLive) {
  118393. var currentTime = _this._mediaElement.currentTime;
  118394. if (ms.info.endDts >= (currentTime + _this._config.lazyLoadMaxDuration) * 1e3) {
  118395. if (_this._progressChecker == null) {
  118396. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(_this.TAG, "Maximum buffering duration exceeded, suspend transmuxing task");
  118397. _this._suspendTransmuxer();
  118398. }
  118399. }
  118400. }
  118401. });
  118402. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.LOADING_COMPLETE, function() {
  118403. _this._msectl.endOfStream();
  118404. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.LOADING_COMPLETE);
  118405. });
  118406. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOVERED_EARLY_EOF, function() {
  118407. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.RECOVERED_EARLY_EOF);
  118408. });
  118409. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.IO_ERROR, function(detail, info) {
  118410. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, _player_errors_js__WEBPACK_IMPORTED_MODULE_8__.ErrorTypes.NETWORK_ERROR, detail, info);
  118411. });
  118412. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.DEMUX_ERROR, function(detail, info) {
  118413. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.ERROR, _player_errors_js__WEBPACK_IMPORTED_MODULE_8__.ErrorTypes.MEDIA_ERROR, detail, { code: -1, msg: info });
  118414. });
  118415. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.MEDIA_INFO, function(mediaInfo) {
  118416. _this._mediaInfo = mediaInfo;
  118417. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.MEDIA_INFO, Object.assign({}, mediaInfo));
  118418. });
  118419. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.METADATA_ARRIVED, function(metadata) {
  118420. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.METADATA_ARRIVED, metadata);
  118421. });
  118422. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.SCRIPTDATA_ARRIVED, function(data) {
  118423. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.SCRIPTDATA_ARRIVED, data);
  118424. });
  118425. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.STATISTICS_INFO, function(statInfo) {
  118426. _this._statisticsInfo = _this._fillStatisticsInfo(statInfo);
  118427. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_3__.default.STATISTICS_INFO, Object.assign({}, _this._statisticsInfo));
  118428. });
  118429. this._transmuxer.on(_core_transmuxing_events_js__WEBPACK_IMPORTED_MODULE_5__.default.RECOMMEND_SEEKPOINT, function(milliseconds) {
  118430. if (_this._mediaElement && !_this._config.accurateSeek) {
  118431. _this._requestSetTime = true;
  118432. _this._mediaElement.currentTime = milliseconds / 1e3;
  118433. }
  118434. });
  118435. this._transmuxer.open();
  118436. };
  118437. FlvPlayer2.prototype.unload = function() {
  118438. if (this._mediaElement) {
  118439. this._mediaElement.pause();
  118440. }
  118441. if (this._msectl) {
  118442. this._msectl.seek(0);
  118443. }
  118444. if (this._transmuxer) {
  118445. this._transmuxer.close();
  118446. this._transmuxer.destroy();
  118447. this._transmuxer = null;
  118448. }
  118449. };
  118450. FlvPlayer2.prototype.play = function() {
  118451. return this._mediaElement.play();
  118452. };
  118453. FlvPlayer2.prototype.pause = function() {
  118454. this._mediaElement.pause();
  118455. };
  118456. Object.defineProperty(FlvPlayer2.prototype, "type", {
  118457. get: function() {
  118458. return this._type;
  118459. },
  118460. enumerable: false,
  118461. configurable: true
  118462. });
  118463. Object.defineProperty(FlvPlayer2.prototype, "buffered", {
  118464. get: function() {
  118465. return this._mediaElement.buffered;
  118466. },
  118467. enumerable: false,
  118468. configurable: true
  118469. });
  118470. Object.defineProperty(FlvPlayer2.prototype, "duration", {
  118471. get: function() {
  118472. return this._mediaElement.duration;
  118473. },
  118474. enumerable: false,
  118475. configurable: true
  118476. });
  118477. Object.defineProperty(FlvPlayer2.prototype, "volume", {
  118478. get: function() {
  118479. return this._mediaElement.volume;
  118480. },
  118481. set: function(value) {
  118482. this._mediaElement.volume = value;
  118483. },
  118484. enumerable: false,
  118485. configurable: true
  118486. });
  118487. Object.defineProperty(FlvPlayer2.prototype, "muted", {
  118488. get: function() {
  118489. return this._mediaElement.muted;
  118490. },
  118491. set: function(muted) {
  118492. this._mediaElement.muted = muted;
  118493. },
  118494. enumerable: false,
  118495. configurable: true
  118496. });
  118497. Object.defineProperty(FlvPlayer2.prototype, "currentTime", {
  118498. get: function() {
  118499. if (this._mediaElement) {
  118500. return this._mediaElement.currentTime;
  118501. }
  118502. return 0;
  118503. },
  118504. set: function(seconds) {
  118505. if (this._mediaElement) {
  118506. this._internalSeek(seconds);
  118507. } else {
  118508. this._pendingSeekTime = seconds;
  118509. }
  118510. },
  118511. enumerable: false,
  118512. configurable: true
  118513. });
  118514. Object.defineProperty(FlvPlayer2.prototype, "mediaInfo", {
  118515. get: function() {
  118516. return Object.assign({}, this._mediaInfo);
  118517. },
  118518. enumerable: false,
  118519. configurable: true
  118520. });
  118521. Object.defineProperty(FlvPlayer2.prototype, "statisticsInfo", {
  118522. get: function() {
  118523. if (this._statisticsInfo == null) {
  118524. this._statisticsInfo = {};
  118525. }
  118526. this._statisticsInfo = this._fillStatisticsInfo(this._statisticsInfo);
  118527. return Object.assign({}, this._statisticsInfo);
  118528. },
  118529. enumerable: false,
  118530. configurable: true
  118531. });
  118532. FlvPlayer2.prototype._fillStatisticsInfo = function(statInfo) {
  118533. statInfo.playerType = this._type;
  118534. if (!(this._mediaElement instanceof HTMLVideoElement)) {
  118535. return statInfo;
  118536. }
  118537. var hasQualityInfo = true;
  118538. var decoded = 0;
  118539. var dropped = 0;
  118540. if (this._mediaElement.getVideoPlaybackQuality) {
  118541. var quality = this._mediaElement.getVideoPlaybackQuality();
  118542. decoded = quality.totalVideoFrames;
  118543. dropped = quality.droppedVideoFrames;
  118544. } else if (this._mediaElement.webkitDecodedFrameCount != void 0) {
  118545. decoded = this._mediaElement.webkitDecodedFrameCount;
  118546. dropped = this._mediaElement.webkitDroppedFrameCount;
  118547. } else {
  118548. hasQualityInfo = false;
  118549. }
  118550. if (hasQualityInfo) {
  118551. statInfo.decodedFrames = decoded;
  118552. statInfo.droppedFrames = dropped;
  118553. }
  118554. return statInfo;
  118555. };
  118556. FlvPlayer2.prototype._onmseUpdateEnd = function() {
  118557. if (!this._config.lazyLoad || this._config.isLive) {
  118558. return;
  118559. }
  118560. var buffered = this._mediaElement.buffered;
  118561. var currentTime = this._mediaElement.currentTime;
  118562. var currentRangeEnd = 0;
  118563. for (var i2 = 0; i2 < buffered.length; i2++) {
  118564. var start2 = buffered.start(i2);
  118565. var end = buffered.end(i2);
  118566. if (start2 <= currentTime && currentTime < end) {
  118567. currentRangeEnd = end;
  118568. break;
  118569. }
  118570. }
  118571. if (currentRangeEnd >= currentTime + this._config.lazyLoadMaxDuration && this._progressChecker == null) {
  118572. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Maximum buffering duration exceeded, suspend transmuxing task");
  118573. this._suspendTransmuxer();
  118574. }
  118575. };
  118576. FlvPlayer2.prototype._onmseBufferFull = function() {
  118577. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "MSE SourceBuffer is full, suspend transmuxing task");
  118578. if (this._progressChecker == null) {
  118579. this._suspendTransmuxer();
  118580. }
  118581. };
  118582. FlvPlayer2.prototype._suspendTransmuxer = function() {
  118583. if (this._transmuxer) {
  118584. this._transmuxer.pause();
  118585. if (this._progressChecker == null) {
  118586. this._progressChecker = window.setInterval(this._checkProgressAndResume.bind(this), 1e3);
  118587. }
  118588. }
  118589. };
  118590. FlvPlayer2.prototype._checkProgressAndResume = function() {
  118591. var currentTime = this._mediaElement.currentTime;
  118592. var buffered = this._mediaElement.buffered;
  118593. var needResume = false;
  118594. for (var i2 = 0; i2 < buffered.length; i2++) {
  118595. var from3 = buffered.start(i2);
  118596. var to = buffered.end(i2);
  118597. if (currentTime >= from3 && currentTime < to) {
  118598. if (currentTime >= to - this._config.lazyLoadRecoverDuration) {
  118599. needResume = true;
  118600. }
  118601. break;
  118602. }
  118603. }
  118604. if (needResume) {
  118605. window.clearInterval(this._progressChecker);
  118606. this._progressChecker = null;
  118607. if (needResume) {
  118608. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.v(this.TAG, "Continue loading from paused position");
  118609. this._transmuxer.resume();
  118610. }
  118611. }
  118612. };
  118613. FlvPlayer2.prototype._isTimepointBuffered = function(seconds) {
  118614. var buffered = this._mediaElement.buffered;
  118615. for (var i2 = 0; i2 < buffered.length; i2++) {
  118616. var from3 = buffered.start(i2);
  118617. var to = buffered.end(i2);
  118618. if (seconds >= from3 && seconds < to) {
  118619. return true;
  118620. }
  118621. }
  118622. return false;
  118623. };
  118624. FlvPlayer2.prototype._internalSeek = function(seconds) {
  118625. var directSeek = this._isTimepointBuffered(seconds);
  118626. var directSeekBegin = false;
  118627. var directSeekBeginTime = 0;
  118628. if (seconds < 1 && this._mediaElement.buffered.length > 0) {
  118629. var videoBeginTime = this._mediaElement.buffered.start(0);
  118630. if (videoBeginTime < 1 && seconds < videoBeginTime || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari) {
  118631. directSeekBegin = true;
  118632. directSeekBeginTime = _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari ? 0.1 : videoBeginTime;
  118633. }
  118634. }
  118635. if (directSeekBegin) {
  118636. this._requestSetTime = true;
  118637. this._mediaElement.currentTime = directSeekBeginTime;
  118638. } else if (directSeek) {
  118639. if (!this._alwaysSeekKeyframe) {
  118640. this._requestSetTime = true;
  118641. this._mediaElement.currentTime = seconds;
  118642. } else {
  118643. var idr = this._msectl.getNearestKeyframe(Math.floor(seconds * 1e3));
  118644. this._requestSetTime = true;
  118645. if (idr != null) {
  118646. this._mediaElement.currentTime = idr.dts / 1e3;
  118647. } else {
  118648. this._mediaElement.currentTime = seconds;
  118649. }
  118650. }
  118651. if (this._progressChecker != null) {
  118652. this._checkProgressAndResume();
  118653. }
  118654. } else {
  118655. if (this._progressChecker != null) {
  118656. window.clearInterval(this._progressChecker);
  118657. this._progressChecker = null;
  118658. }
  118659. this._msectl.seek(seconds);
  118660. this._transmuxer.seek(Math.floor(seconds * 1e3));
  118661. if (this._config.accurateSeek) {
  118662. this._requestSetTime = true;
  118663. this._mediaElement.currentTime = seconds;
  118664. }
  118665. }
  118666. };
  118667. FlvPlayer2.prototype._checkAndApplyUnbufferedSeekpoint = function() {
  118668. if (this._seekpointRecord) {
  118669. if (this._seekpointRecord.recordTime <= this._now() - 100) {
  118670. var target = this._mediaElement.currentTime;
  118671. this._seekpointRecord = null;
  118672. if (!this._isTimepointBuffered(target)) {
  118673. if (this._progressChecker != null) {
  118674. window.clearTimeout(this._progressChecker);
  118675. this._progressChecker = null;
  118676. }
  118677. this._msectl.seek(target);
  118678. this._transmuxer.seek(Math.floor(target * 1e3));
  118679. if (this._config.accurateSeek) {
  118680. this._requestSetTime = true;
  118681. this._mediaElement.currentTime = target;
  118682. }
  118683. }
  118684. } else {
  118685. window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50);
  118686. }
  118687. }
  118688. };
  118689. FlvPlayer2.prototype._checkAndResumeStuckPlayback = function(stalled) {
  118690. var media = this._mediaElement;
  118691. if (stalled || !this._receivedCanPlay || media.readyState < 2) {
  118692. var buffered = media.buffered;
  118693. if (buffered.length > 0 && media.currentTime < buffered.start(0)) {
  118694. _utils_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.w(this.TAG, "Playback seems stuck at " + media.currentTime + ", seek to " + buffered.start(0));
  118695. this._requestSetTime = true;
  118696. this._mediaElement.currentTime = buffered.start(0);
  118697. this._mediaElement.removeEventListener("progress", this.e.onvProgress);
  118698. }
  118699. } else {
  118700. this._mediaElement.removeEventListener("progress", this.e.onvProgress);
  118701. }
  118702. };
  118703. FlvPlayer2.prototype._onvLoadedMetadata = function(e) {
  118704. if (this._pendingSeekTime != null) {
  118705. this._mediaElement.currentTime = this._pendingSeekTime;
  118706. this._pendingSeekTime = null;
  118707. }
  118708. };
  118709. FlvPlayer2.prototype._onvSeeking = function(e) {
  118710. var target = this._mediaElement.currentTime;
  118711. var buffered = this._mediaElement.buffered;
  118712. if (this._requestSetTime) {
  118713. this._requestSetTime = false;
  118714. return;
  118715. }
  118716. if (target < 1 && buffered.length > 0) {
  118717. var videoBeginTime = buffered.start(0);
  118718. if (videoBeginTime < 1 && target < videoBeginTime || _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari) {
  118719. this._requestSetTime = true;
  118720. this._mediaElement.currentTime = _utils_browser_js__WEBPACK_IMPORTED_MODULE_2__.default.safari ? 0.1 : videoBeginTime;
  118721. return;
  118722. }
  118723. }
  118724. if (this._isTimepointBuffered(target)) {
  118725. if (this._alwaysSeekKeyframe) {
  118726. var idr = this._msectl.getNearestKeyframe(Math.floor(target * 1e3));
  118727. if (idr != null) {
  118728. this._requestSetTime = true;
  118729. this._mediaElement.currentTime = idr.dts / 1e3;
  118730. }
  118731. }
  118732. if (this._progressChecker != null) {
  118733. this._checkProgressAndResume();
  118734. }
  118735. return;
  118736. }
  118737. this._seekpointRecord = {
  118738. seekPoint: target,
  118739. recordTime: this._now()
  118740. };
  118741. window.setTimeout(this._checkAndApplyUnbufferedSeekpoint.bind(this), 50);
  118742. };
  118743. FlvPlayer2.prototype._onvCanPlay = function(e) {
  118744. this._receivedCanPlay = true;
  118745. this._mediaElement.removeEventListener("canplay", this.e.onvCanPlay);
  118746. };
  118747. FlvPlayer2.prototype._onvStalled = function(e) {
  118748. this._checkAndResumeStuckPlayback(true);
  118749. };
  118750. FlvPlayer2.prototype._onvProgress = function(e) {
  118751. this._checkAndResumeStuckPlayback();
  118752. };
  118753. return FlvPlayer2;
  118754. }();
  118755. __webpack_exports__2["default"] = FlvPlayer;
  118756. },
  118757. "./src/player/native-player.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  118758. __webpack_require__2.r(__webpack_exports__2);
  118759. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  118760. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  118761. var _player_events_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/player/player-events.js");
  118762. var _config_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/config.js");
  118763. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/utils/exception.js");
  118764. var NativePlayer = function() {
  118765. function NativePlayer2(mediaDataSource, config) {
  118766. this.TAG = "NativePlayer";
  118767. this._type = "NativePlayer";
  118768. this._emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  118769. this._config = (0, _config_js__WEBPACK_IMPORTED_MODULE_2__.createDefaultConfig)();
  118770. if (typeof config === "object") {
  118771. Object.assign(this._config, config);
  118772. }
  118773. if (mediaDataSource.type.toLowerCase() === "flv") {
  118774. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.InvalidArgumentException("NativePlayer does't support flv MediaDataSource input!");
  118775. }
  118776. if (mediaDataSource.hasOwnProperty("segments")) {
  118777. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.InvalidArgumentException("NativePlayer(" + mediaDataSource.type + ") doesn't support multipart playback!");
  118778. }
  118779. this.e = {
  118780. onvLoadedMetadata: this._onvLoadedMetadata.bind(this)
  118781. };
  118782. this._pendingSeekTime = null;
  118783. this._statisticsReporter = null;
  118784. this._mediaDataSource = mediaDataSource;
  118785. this._mediaElement = null;
  118786. }
  118787. NativePlayer2.prototype.destroy = function() {
  118788. if (this._mediaElement) {
  118789. this.unload();
  118790. this.detachMediaElement();
  118791. }
  118792. this.e = null;
  118793. this._mediaDataSource = null;
  118794. this._emitter.removeAllListeners();
  118795. this._emitter = null;
  118796. };
  118797. NativePlayer2.prototype.on = function(event2, listener) {
  118798. var _this = this;
  118799. if (event2 === _player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.MEDIA_INFO) {
  118800. if (this._mediaElement != null && this._mediaElement.readyState !== 0) {
  118801. Promise.resolve().then(function() {
  118802. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.MEDIA_INFO, _this.mediaInfo);
  118803. });
  118804. }
  118805. } else if (event2 === _player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.STATISTICS_INFO) {
  118806. if (this._mediaElement != null && this._mediaElement.readyState !== 0) {
  118807. Promise.resolve().then(function() {
  118808. _this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.STATISTICS_INFO, _this.statisticsInfo);
  118809. });
  118810. }
  118811. }
  118812. this._emitter.addListener(event2, listener);
  118813. };
  118814. NativePlayer2.prototype.off = function(event2, listener) {
  118815. this._emitter.removeListener(event2, listener);
  118816. };
  118817. NativePlayer2.prototype.attachMediaElement = function(mediaElement) {
  118818. this._mediaElement = mediaElement;
  118819. mediaElement.addEventListener("loadedmetadata", this.e.onvLoadedMetadata);
  118820. if (this._pendingSeekTime != null) {
  118821. try {
  118822. mediaElement.currentTime = this._pendingSeekTime;
  118823. this._pendingSeekTime = null;
  118824. } catch (e) {
  118825. }
  118826. }
  118827. };
  118828. NativePlayer2.prototype.detachMediaElement = function() {
  118829. if (this._mediaElement) {
  118830. this._mediaElement.src = "";
  118831. this._mediaElement.removeAttribute("src");
  118832. this._mediaElement.removeEventListener("loadedmetadata", this.e.onvLoadedMetadata);
  118833. this._mediaElement = null;
  118834. }
  118835. if (this._statisticsReporter != null) {
  118836. window.clearInterval(this._statisticsReporter);
  118837. this._statisticsReporter = null;
  118838. }
  118839. };
  118840. NativePlayer2.prototype.load = function() {
  118841. if (!this._mediaElement) {
  118842. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_3__.IllegalStateException("HTMLMediaElement must be attached before load()!");
  118843. }
  118844. this._mediaElement.src = this._mediaDataSource.url;
  118845. if (this._mediaElement.readyState > 0) {
  118846. this._mediaElement.currentTime = 0;
  118847. }
  118848. this._mediaElement.preload = "auto";
  118849. this._mediaElement.load();
  118850. this._statisticsReporter = window.setInterval(this._reportStatisticsInfo.bind(this), this._config.statisticsInfoReportInterval);
  118851. };
  118852. NativePlayer2.prototype.unload = function() {
  118853. if (this._mediaElement) {
  118854. this._mediaElement.src = "";
  118855. this._mediaElement.removeAttribute("src");
  118856. }
  118857. if (this._statisticsReporter != null) {
  118858. window.clearInterval(this._statisticsReporter);
  118859. this._statisticsReporter = null;
  118860. }
  118861. };
  118862. NativePlayer2.prototype.play = function() {
  118863. return this._mediaElement.play();
  118864. };
  118865. NativePlayer2.prototype.pause = function() {
  118866. this._mediaElement.pause();
  118867. };
  118868. Object.defineProperty(NativePlayer2.prototype, "type", {
  118869. get: function() {
  118870. return this._type;
  118871. },
  118872. enumerable: false,
  118873. configurable: true
  118874. });
  118875. Object.defineProperty(NativePlayer2.prototype, "buffered", {
  118876. get: function() {
  118877. return this._mediaElement.buffered;
  118878. },
  118879. enumerable: false,
  118880. configurable: true
  118881. });
  118882. Object.defineProperty(NativePlayer2.prototype, "duration", {
  118883. get: function() {
  118884. return this._mediaElement.duration;
  118885. },
  118886. enumerable: false,
  118887. configurable: true
  118888. });
  118889. Object.defineProperty(NativePlayer2.prototype, "volume", {
  118890. get: function() {
  118891. return this._mediaElement.volume;
  118892. },
  118893. set: function(value) {
  118894. this._mediaElement.volume = value;
  118895. },
  118896. enumerable: false,
  118897. configurable: true
  118898. });
  118899. Object.defineProperty(NativePlayer2.prototype, "muted", {
  118900. get: function() {
  118901. return this._mediaElement.muted;
  118902. },
  118903. set: function(muted) {
  118904. this._mediaElement.muted = muted;
  118905. },
  118906. enumerable: false,
  118907. configurable: true
  118908. });
  118909. Object.defineProperty(NativePlayer2.prototype, "currentTime", {
  118910. get: function() {
  118911. if (this._mediaElement) {
  118912. return this._mediaElement.currentTime;
  118913. }
  118914. return 0;
  118915. },
  118916. set: function(seconds) {
  118917. if (this._mediaElement) {
  118918. this._mediaElement.currentTime = seconds;
  118919. } else {
  118920. this._pendingSeekTime = seconds;
  118921. }
  118922. },
  118923. enumerable: false,
  118924. configurable: true
  118925. });
  118926. Object.defineProperty(NativePlayer2.prototype, "mediaInfo", {
  118927. get: function() {
  118928. var mediaPrefix = this._mediaElement instanceof HTMLAudioElement ? "audio/" : "video/";
  118929. var info = {
  118930. mimeType: mediaPrefix + this._mediaDataSource.type
  118931. };
  118932. if (this._mediaElement) {
  118933. info.duration = Math.floor(this._mediaElement.duration * 1e3);
  118934. if (this._mediaElement instanceof HTMLVideoElement) {
  118935. info.width = this._mediaElement.videoWidth;
  118936. info.height = this._mediaElement.videoHeight;
  118937. }
  118938. }
  118939. return info;
  118940. },
  118941. enumerable: false,
  118942. configurable: true
  118943. });
  118944. Object.defineProperty(NativePlayer2.prototype, "statisticsInfo", {
  118945. get: function() {
  118946. var info = {
  118947. playerType: this._type,
  118948. url: this._mediaDataSource.url
  118949. };
  118950. if (!(this._mediaElement instanceof HTMLVideoElement)) {
  118951. return info;
  118952. }
  118953. var hasQualityInfo = true;
  118954. var decoded = 0;
  118955. var dropped = 0;
  118956. if (this._mediaElement.getVideoPlaybackQuality) {
  118957. var quality = this._mediaElement.getVideoPlaybackQuality();
  118958. decoded = quality.totalVideoFrames;
  118959. dropped = quality.droppedVideoFrames;
  118960. } else if (this._mediaElement.webkitDecodedFrameCount != void 0) {
  118961. decoded = this._mediaElement.webkitDecodedFrameCount;
  118962. dropped = this._mediaElement.webkitDroppedFrameCount;
  118963. } else {
  118964. hasQualityInfo = false;
  118965. }
  118966. if (hasQualityInfo) {
  118967. info.decodedFrames = decoded;
  118968. info.droppedFrames = dropped;
  118969. }
  118970. return info;
  118971. },
  118972. enumerable: false,
  118973. configurable: true
  118974. });
  118975. NativePlayer2.prototype._onvLoadedMetadata = function(e) {
  118976. if (this._pendingSeekTime != null) {
  118977. this._mediaElement.currentTime = this._pendingSeekTime;
  118978. this._pendingSeekTime = null;
  118979. }
  118980. this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.MEDIA_INFO, this.mediaInfo);
  118981. };
  118982. NativePlayer2.prototype._reportStatisticsInfo = function() {
  118983. this._emitter.emit(_player_events_js__WEBPACK_IMPORTED_MODULE_1__.default.STATISTICS_INFO, this.statisticsInfo);
  118984. };
  118985. return NativePlayer2;
  118986. }();
  118987. __webpack_exports__2["default"] = NativePlayer;
  118988. },
  118989. "./src/player/player-errors.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  118990. __webpack_require__2.r(__webpack_exports__2);
  118991. __webpack_require__2.d(__webpack_exports__2, {
  118992. "ErrorTypes": function() {
  118993. return ErrorTypes;
  118994. },
  118995. "ErrorDetails": function() {
  118996. return ErrorDetails;
  118997. }
  118998. });
  118999. var _io_loader_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/io/loader.js");
  119000. var _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/demux/demux-errors.js");
  119001. var ErrorTypes = {
  119002. NETWORK_ERROR: "NetworkError",
  119003. MEDIA_ERROR: "MediaError",
  119004. OTHER_ERROR: "OtherError"
  119005. };
  119006. var ErrorDetails = {
  119007. NETWORK_EXCEPTION: _io_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.EXCEPTION,
  119008. NETWORK_STATUS_CODE_INVALID: _io_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.HTTP_STATUS_CODE_INVALID,
  119009. NETWORK_TIMEOUT: _io_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.CONNECTING_TIMEOUT,
  119010. NETWORK_UNRECOVERABLE_EARLY_EOF: _io_loader_js__WEBPACK_IMPORTED_MODULE_0__.LoaderErrors.UNRECOVERABLE_EARLY_EOF,
  119011. MEDIA_MSE_ERROR: "MediaMSEError",
  119012. MEDIA_FORMAT_ERROR: _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_1__.default.FORMAT_ERROR,
  119013. MEDIA_FORMAT_UNSUPPORTED: _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_1__.default.FORMAT_UNSUPPORTED,
  119014. MEDIA_CODEC_UNSUPPORTED: _demux_demux_errors_js__WEBPACK_IMPORTED_MODULE_1__.default.CODEC_UNSUPPORTED
  119015. };
  119016. },
  119017. "./src/player/player-events.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  119018. __webpack_require__2.r(__webpack_exports__2);
  119019. var PlayerEvents = {
  119020. ERROR: "error",
  119021. LOADING_COMPLETE: "loading_complete",
  119022. RECOVERED_EARLY_EOF: "recovered_early_eof",
  119023. MEDIA_INFO: "media_info",
  119024. METADATA_ARRIVED: "metadata_arrived",
  119025. SCRIPTDATA_ARRIVED: "scriptdata_arrived",
  119026. STATISTICS_INFO: "statistics_info"
  119027. };
  119028. __webpack_exports__2["default"] = PlayerEvents;
  119029. },
  119030. "./src/remux/aac-silent.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  119031. __webpack_require__2.r(__webpack_exports__2);
  119032. var AAC = function() {
  119033. function AAC2() {
  119034. }
  119035. AAC2.getSilentFrame = function(codec, channelCount) {
  119036. if (codec === "mp4a.40.2") {
  119037. if (channelCount === 1) {
  119038. return new Uint8Array([0, 200, 0, 128, 35, 128]);
  119039. } else if (channelCount === 2) {
  119040. return new Uint8Array([33, 0, 73, 144, 2, 25, 0, 35, 128]);
  119041. } else if (channelCount === 3) {
  119042. return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 142]);
  119043. } else if (channelCount === 4) {
  119044. return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 128, 44, 128, 8, 2, 56]);
  119045. } else if (channelCount === 5) {
  119046. return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 56]);
  119047. } else if (channelCount === 6) {
  119048. return new Uint8Array([0, 200, 0, 128, 32, 132, 1, 38, 64, 8, 100, 0, 130, 48, 4, 153, 0, 33, 144, 2, 0, 178, 0, 32, 8, 224]);
  119049. }
  119050. } else {
  119051. if (channelCount === 1) {
  119052. return new Uint8Array([1, 64, 34, 128, 163, 78, 230, 128, 186, 8, 0, 0, 0, 28, 6, 241, 193, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
  119053. } else if (channelCount === 2) {
  119054. return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
  119055. } else if (channelCount === 3) {
  119056. return new Uint8Array([1, 64, 34, 128, 163, 94, 230, 128, 186, 8, 0, 0, 0, 0, 149, 0, 6, 241, 161, 10, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 94]);
  119057. }
  119058. }
  119059. return null;
  119060. };
  119061. return AAC2;
  119062. }();
  119063. __webpack_exports__2["default"] = AAC;
  119064. },
  119065. "./src/remux/mp4-generator.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  119066. __webpack_require__2.r(__webpack_exports__2);
  119067. var MP4 = function() {
  119068. function MP42() {
  119069. }
  119070. MP42.init = function() {
  119071. MP42.types = {
  119072. avc1: [],
  119073. avcC: [],
  119074. btrt: [],
  119075. dinf: [],
  119076. dref: [],
  119077. esds: [],
  119078. ftyp: [],
  119079. hdlr: [],
  119080. mdat: [],
  119081. mdhd: [],
  119082. mdia: [],
  119083. mfhd: [],
  119084. minf: [],
  119085. moof: [],
  119086. moov: [],
  119087. mp4a: [],
  119088. mvex: [],
  119089. mvhd: [],
  119090. sdtp: [],
  119091. stbl: [],
  119092. stco: [],
  119093. stsc: [],
  119094. stsd: [],
  119095. stsz: [],
  119096. stts: [],
  119097. tfdt: [],
  119098. tfhd: [],
  119099. traf: [],
  119100. trak: [],
  119101. trun: [],
  119102. trex: [],
  119103. tkhd: [],
  119104. vmhd: [],
  119105. smhd: [],
  119106. ".mp3": []
  119107. };
  119108. for (var name_1 in MP42.types) {
  119109. if (MP42.types.hasOwnProperty(name_1)) {
  119110. MP42.types[name_1] = [
  119111. name_1.charCodeAt(0),
  119112. name_1.charCodeAt(1),
  119113. name_1.charCodeAt(2),
  119114. name_1.charCodeAt(3)
  119115. ];
  119116. }
  119117. }
  119118. var constants = MP42.constants = {};
  119119. constants.FTYP = new Uint8Array([
  119120. 105,
  119121. 115,
  119122. 111,
  119123. 109,
  119124. 0,
  119125. 0,
  119126. 0,
  119127. 1,
  119128. 105,
  119129. 115,
  119130. 111,
  119131. 109,
  119132. 97,
  119133. 118,
  119134. 99,
  119135. 49
  119136. ]);
  119137. constants.STSD_PREFIX = new Uint8Array([
  119138. 0,
  119139. 0,
  119140. 0,
  119141. 0,
  119142. 0,
  119143. 0,
  119144. 0,
  119145. 1
  119146. ]);
  119147. constants.STTS = new Uint8Array([
  119148. 0,
  119149. 0,
  119150. 0,
  119151. 0,
  119152. 0,
  119153. 0,
  119154. 0,
  119155. 0
  119156. ]);
  119157. constants.STSC = constants.STCO = constants.STTS;
  119158. constants.STSZ = new Uint8Array([
  119159. 0,
  119160. 0,
  119161. 0,
  119162. 0,
  119163. 0,
  119164. 0,
  119165. 0,
  119166. 0,
  119167. 0,
  119168. 0,
  119169. 0,
  119170. 0
  119171. ]);
  119172. constants.HDLR_VIDEO = new Uint8Array([
  119173. 0,
  119174. 0,
  119175. 0,
  119176. 0,
  119177. 0,
  119178. 0,
  119179. 0,
  119180. 0,
  119181. 118,
  119182. 105,
  119183. 100,
  119184. 101,
  119185. 0,
  119186. 0,
  119187. 0,
  119188. 0,
  119189. 0,
  119190. 0,
  119191. 0,
  119192. 0,
  119193. 0,
  119194. 0,
  119195. 0,
  119196. 0,
  119197. 86,
  119198. 105,
  119199. 100,
  119200. 101,
  119201. 111,
  119202. 72,
  119203. 97,
  119204. 110,
  119205. 100,
  119206. 108,
  119207. 101,
  119208. 114,
  119209. 0
  119210. ]);
  119211. constants.HDLR_AUDIO = new Uint8Array([
  119212. 0,
  119213. 0,
  119214. 0,
  119215. 0,
  119216. 0,
  119217. 0,
  119218. 0,
  119219. 0,
  119220. 115,
  119221. 111,
  119222. 117,
  119223. 110,
  119224. 0,
  119225. 0,
  119226. 0,
  119227. 0,
  119228. 0,
  119229. 0,
  119230. 0,
  119231. 0,
  119232. 0,
  119233. 0,
  119234. 0,
  119235. 0,
  119236. 83,
  119237. 111,
  119238. 117,
  119239. 110,
  119240. 100,
  119241. 72,
  119242. 97,
  119243. 110,
  119244. 100,
  119245. 108,
  119246. 101,
  119247. 114,
  119248. 0
  119249. ]);
  119250. constants.DREF = new Uint8Array([
  119251. 0,
  119252. 0,
  119253. 0,
  119254. 0,
  119255. 0,
  119256. 0,
  119257. 0,
  119258. 1,
  119259. 0,
  119260. 0,
  119261. 0,
  119262. 12,
  119263. 117,
  119264. 114,
  119265. 108,
  119266. 32,
  119267. 0,
  119268. 0,
  119269. 0,
  119270. 1
  119271. ]);
  119272. constants.SMHD = new Uint8Array([
  119273. 0,
  119274. 0,
  119275. 0,
  119276. 0,
  119277. 0,
  119278. 0,
  119279. 0,
  119280. 0
  119281. ]);
  119282. constants.VMHD = new Uint8Array([
  119283. 0,
  119284. 0,
  119285. 0,
  119286. 1,
  119287. 0,
  119288. 0,
  119289. 0,
  119290. 0,
  119291. 0,
  119292. 0,
  119293. 0,
  119294. 0
  119295. ]);
  119296. };
  119297. MP42.box = function(type2) {
  119298. var size = 8;
  119299. var result = null;
  119300. var datas = Array.prototype.slice.call(arguments, 1);
  119301. var arrayCount = datas.length;
  119302. for (var i2 = 0; i2 < arrayCount; i2++) {
  119303. size += datas[i2].byteLength;
  119304. }
  119305. result = new Uint8Array(size);
  119306. result[0] = size >>> 24 & 255;
  119307. result[1] = size >>> 16 & 255;
  119308. result[2] = size >>> 8 & 255;
  119309. result[3] = size & 255;
  119310. result.set(type2, 4);
  119311. var offset = 8;
  119312. for (var i2 = 0; i2 < arrayCount; i2++) {
  119313. result.set(datas[i2], offset);
  119314. offset += datas[i2].byteLength;
  119315. }
  119316. return result;
  119317. };
  119318. MP42.generateInitSegment = function(meta2) {
  119319. var ftyp = MP42.box(MP42.types.ftyp, MP42.constants.FTYP);
  119320. var moov = MP42.moov(meta2);
  119321. var result = new Uint8Array(ftyp.byteLength + moov.byteLength);
  119322. result.set(ftyp, 0);
  119323. result.set(moov, ftyp.byteLength);
  119324. return result;
  119325. };
  119326. MP42.moov = function(meta2) {
  119327. var mvhd = MP42.mvhd(meta2.timescale, meta2.duration);
  119328. var trak = MP42.trak(meta2);
  119329. var mvex = MP42.mvex(meta2);
  119330. return MP42.box(MP42.types.moov, mvhd, trak, mvex);
  119331. };
  119332. MP42.mvhd = function(timescale2, duration5) {
  119333. return MP42.box(MP42.types.mvhd, new Uint8Array([
  119334. 0,
  119335. 0,
  119336. 0,
  119337. 0,
  119338. 0,
  119339. 0,
  119340. 0,
  119341. 0,
  119342. 0,
  119343. 0,
  119344. 0,
  119345. 0,
  119346. timescale2 >>> 24 & 255,
  119347. timescale2 >>> 16 & 255,
  119348. timescale2 >>> 8 & 255,
  119349. timescale2 & 255,
  119350. duration5 >>> 24 & 255,
  119351. duration5 >>> 16 & 255,
  119352. duration5 >>> 8 & 255,
  119353. duration5 & 255,
  119354. 0,
  119355. 1,
  119356. 0,
  119357. 0,
  119358. 1,
  119359. 0,
  119360. 0,
  119361. 0,
  119362. 0,
  119363. 0,
  119364. 0,
  119365. 0,
  119366. 0,
  119367. 0,
  119368. 0,
  119369. 0,
  119370. 0,
  119371. 1,
  119372. 0,
  119373. 0,
  119374. 0,
  119375. 0,
  119376. 0,
  119377. 0,
  119378. 0,
  119379. 0,
  119380. 0,
  119381. 0,
  119382. 0,
  119383. 0,
  119384. 0,
  119385. 0,
  119386. 0,
  119387. 1,
  119388. 0,
  119389. 0,
  119390. 0,
  119391. 0,
  119392. 0,
  119393. 0,
  119394. 0,
  119395. 0,
  119396. 0,
  119397. 0,
  119398. 0,
  119399. 0,
  119400. 0,
  119401. 0,
  119402. 64,
  119403. 0,
  119404. 0,
  119405. 0,
  119406. 0,
  119407. 0,
  119408. 0,
  119409. 0,
  119410. 0,
  119411. 0,
  119412. 0,
  119413. 0,
  119414. 0,
  119415. 0,
  119416. 0,
  119417. 0,
  119418. 0,
  119419. 0,
  119420. 0,
  119421. 0,
  119422. 0,
  119423. 0,
  119424. 0,
  119425. 0,
  119426. 0,
  119427. 0,
  119428. 0,
  119429. 0,
  119430. 255,
  119431. 255,
  119432. 255,
  119433. 255
  119434. ]));
  119435. };
  119436. MP42.trak = function(meta2) {
  119437. return MP42.box(MP42.types.trak, MP42.tkhd(meta2), MP42.mdia(meta2));
  119438. };
  119439. MP42.tkhd = function(meta2) {
  119440. var trackId = meta2.id, duration5 = meta2.duration;
  119441. var width2 = meta2.presentWidth, height2 = meta2.presentHeight;
  119442. return MP42.box(MP42.types.tkhd, new Uint8Array([
  119443. 0,
  119444. 0,
  119445. 0,
  119446. 7,
  119447. 0,
  119448. 0,
  119449. 0,
  119450. 0,
  119451. 0,
  119452. 0,
  119453. 0,
  119454. 0,
  119455. trackId >>> 24 & 255,
  119456. trackId >>> 16 & 255,
  119457. trackId >>> 8 & 255,
  119458. trackId & 255,
  119459. 0,
  119460. 0,
  119461. 0,
  119462. 0,
  119463. duration5 >>> 24 & 255,
  119464. duration5 >>> 16 & 255,
  119465. duration5 >>> 8 & 255,
  119466. duration5 & 255,
  119467. 0,
  119468. 0,
  119469. 0,
  119470. 0,
  119471. 0,
  119472. 0,
  119473. 0,
  119474. 0,
  119475. 0,
  119476. 0,
  119477. 0,
  119478. 0,
  119479. 0,
  119480. 0,
  119481. 0,
  119482. 0,
  119483. 0,
  119484. 1,
  119485. 0,
  119486. 0,
  119487. 0,
  119488. 0,
  119489. 0,
  119490. 0,
  119491. 0,
  119492. 0,
  119493. 0,
  119494. 0,
  119495. 0,
  119496. 0,
  119497. 0,
  119498. 0,
  119499. 0,
  119500. 1,
  119501. 0,
  119502. 0,
  119503. 0,
  119504. 0,
  119505. 0,
  119506. 0,
  119507. 0,
  119508. 0,
  119509. 0,
  119510. 0,
  119511. 0,
  119512. 0,
  119513. 0,
  119514. 0,
  119515. 64,
  119516. 0,
  119517. 0,
  119518. 0,
  119519. width2 >>> 8 & 255,
  119520. width2 & 255,
  119521. 0,
  119522. 0,
  119523. height2 >>> 8 & 255,
  119524. height2 & 255,
  119525. 0,
  119526. 0
  119527. ]));
  119528. };
  119529. MP42.mdia = function(meta2) {
  119530. return MP42.box(MP42.types.mdia, MP42.mdhd(meta2), MP42.hdlr(meta2), MP42.minf(meta2));
  119531. };
  119532. MP42.mdhd = function(meta2) {
  119533. var timescale2 = meta2.timescale;
  119534. var duration5 = meta2.duration;
  119535. return MP42.box(MP42.types.mdhd, new Uint8Array([
  119536. 0,
  119537. 0,
  119538. 0,
  119539. 0,
  119540. 0,
  119541. 0,
  119542. 0,
  119543. 0,
  119544. 0,
  119545. 0,
  119546. 0,
  119547. 0,
  119548. timescale2 >>> 24 & 255,
  119549. timescale2 >>> 16 & 255,
  119550. timescale2 >>> 8 & 255,
  119551. timescale2 & 255,
  119552. duration5 >>> 24 & 255,
  119553. duration5 >>> 16 & 255,
  119554. duration5 >>> 8 & 255,
  119555. duration5 & 255,
  119556. 85,
  119557. 196,
  119558. 0,
  119559. 0
  119560. ]));
  119561. };
  119562. MP42.hdlr = function(meta2) {
  119563. var data = null;
  119564. if (meta2.type === "audio") {
  119565. data = MP42.constants.HDLR_AUDIO;
  119566. } else {
  119567. data = MP42.constants.HDLR_VIDEO;
  119568. }
  119569. return MP42.box(MP42.types.hdlr, data);
  119570. };
  119571. MP42.minf = function(meta2) {
  119572. var xmhd = null;
  119573. if (meta2.type === "audio") {
  119574. xmhd = MP42.box(MP42.types.smhd, MP42.constants.SMHD);
  119575. } else {
  119576. xmhd = MP42.box(MP42.types.vmhd, MP42.constants.VMHD);
  119577. }
  119578. return MP42.box(MP42.types.minf, xmhd, MP42.dinf(), MP42.stbl(meta2));
  119579. };
  119580. MP42.dinf = function() {
  119581. var result = MP42.box(MP42.types.dinf, MP42.box(MP42.types.dref, MP42.constants.DREF));
  119582. return result;
  119583. };
  119584. MP42.stbl = function(meta2) {
  119585. var result = MP42.box(
  119586. MP42.types.stbl,
  119587. MP42.stsd(meta2),
  119588. MP42.box(MP42.types.stts, MP42.constants.STTS),
  119589. MP42.box(MP42.types.stsc, MP42.constants.STSC),
  119590. MP42.box(MP42.types.stsz, MP42.constants.STSZ),
  119591. MP42.box(MP42.types.stco, MP42.constants.STCO)
  119592. );
  119593. return result;
  119594. };
  119595. MP42.stsd = function(meta2) {
  119596. if (meta2.type === "audio") {
  119597. if (meta2.codec === "mp3") {
  119598. return MP42.box(MP42.types.stsd, MP42.constants.STSD_PREFIX, MP42.mp3(meta2));
  119599. }
  119600. return MP42.box(MP42.types.stsd, MP42.constants.STSD_PREFIX, MP42.mp4a(meta2));
  119601. } else {
  119602. return MP42.box(MP42.types.stsd, MP42.constants.STSD_PREFIX, MP42.avc1(meta2));
  119603. }
  119604. };
  119605. MP42.mp3 = function(meta2) {
  119606. var channelCount = meta2.channelCount;
  119607. var sampleRate = meta2.audioSampleRate;
  119608. var data = new Uint8Array([
  119609. 0,
  119610. 0,
  119611. 0,
  119612. 0,
  119613. 0,
  119614. 0,
  119615. 0,
  119616. 1,
  119617. 0,
  119618. 0,
  119619. 0,
  119620. 0,
  119621. 0,
  119622. 0,
  119623. 0,
  119624. 0,
  119625. 0,
  119626. channelCount,
  119627. 0,
  119628. 16,
  119629. 0,
  119630. 0,
  119631. 0,
  119632. 0,
  119633. sampleRate >>> 8 & 255,
  119634. sampleRate & 255,
  119635. 0,
  119636. 0
  119637. ]);
  119638. return MP42.box(MP42.types[".mp3"], data);
  119639. };
  119640. MP42.mp4a = function(meta2) {
  119641. var channelCount = meta2.channelCount;
  119642. var sampleRate = meta2.audioSampleRate;
  119643. var data = new Uint8Array([
  119644. 0,
  119645. 0,
  119646. 0,
  119647. 0,
  119648. 0,
  119649. 0,
  119650. 0,
  119651. 1,
  119652. 0,
  119653. 0,
  119654. 0,
  119655. 0,
  119656. 0,
  119657. 0,
  119658. 0,
  119659. 0,
  119660. 0,
  119661. channelCount,
  119662. 0,
  119663. 16,
  119664. 0,
  119665. 0,
  119666. 0,
  119667. 0,
  119668. sampleRate >>> 8 & 255,
  119669. sampleRate & 255,
  119670. 0,
  119671. 0
  119672. ]);
  119673. return MP42.box(MP42.types.mp4a, data, MP42.esds(meta2));
  119674. };
  119675. MP42.esds = function(meta2) {
  119676. var config = meta2.config || [];
  119677. var configSize = config.length;
  119678. var data = new Uint8Array([
  119679. 0,
  119680. 0,
  119681. 0,
  119682. 0,
  119683. 3,
  119684. 23 + configSize,
  119685. 0,
  119686. 1,
  119687. 0,
  119688. 4,
  119689. 15 + configSize,
  119690. 64,
  119691. 21,
  119692. 0,
  119693. 0,
  119694. 0,
  119695. 0,
  119696. 0,
  119697. 0,
  119698. 0,
  119699. 0,
  119700. 0,
  119701. 0,
  119702. 0,
  119703. 5
  119704. ].concat([
  119705. configSize
  119706. ]).concat(config).concat([
  119707. 6,
  119708. 1,
  119709. 2
  119710. ]));
  119711. return MP42.box(MP42.types.esds, data);
  119712. };
  119713. MP42.avc1 = function(meta2) {
  119714. var avcc = meta2.avcc;
  119715. var width2 = meta2.codecWidth, height2 = meta2.codecHeight;
  119716. var data = new Uint8Array([
  119717. 0,
  119718. 0,
  119719. 0,
  119720. 0,
  119721. 0,
  119722. 0,
  119723. 0,
  119724. 1,
  119725. 0,
  119726. 0,
  119727. 0,
  119728. 0,
  119729. 0,
  119730. 0,
  119731. 0,
  119732. 0,
  119733. 0,
  119734. 0,
  119735. 0,
  119736. 0,
  119737. 0,
  119738. 0,
  119739. 0,
  119740. 0,
  119741. width2 >>> 8 & 255,
  119742. width2 & 255,
  119743. height2 >>> 8 & 255,
  119744. height2 & 255,
  119745. 0,
  119746. 72,
  119747. 0,
  119748. 0,
  119749. 0,
  119750. 72,
  119751. 0,
  119752. 0,
  119753. 0,
  119754. 0,
  119755. 0,
  119756. 0,
  119757. 0,
  119758. 1,
  119759. 10,
  119760. 120,
  119761. 113,
  119762. 113,
  119763. 47,
  119764. 102,
  119765. 108,
  119766. 118,
  119767. 46,
  119768. 106,
  119769. 115,
  119770. 0,
  119771. 0,
  119772. 0,
  119773. 0,
  119774. 0,
  119775. 0,
  119776. 0,
  119777. 0,
  119778. 0,
  119779. 0,
  119780. 0,
  119781. 0,
  119782. 0,
  119783. 0,
  119784. 0,
  119785. 0,
  119786. 0,
  119787. 0,
  119788. 0,
  119789. 0,
  119790. 0,
  119791. 0,
  119792. 24,
  119793. 255,
  119794. 255
  119795. ]);
  119796. return MP42.box(MP42.types.avc1, data, MP42.box(MP42.types.avcC, avcc));
  119797. };
  119798. MP42.mvex = function(meta2) {
  119799. return MP42.box(MP42.types.mvex, MP42.trex(meta2));
  119800. };
  119801. MP42.trex = function(meta2) {
  119802. var trackId = meta2.id;
  119803. var data = new Uint8Array([
  119804. 0,
  119805. 0,
  119806. 0,
  119807. 0,
  119808. trackId >>> 24 & 255,
  119809. trackId >>> 16 & 255,
  119810. trackId >>> 8 & 255,
  119811. trackId & 255,
  119812. 0,
  119813. 0,
  119814. 0,
  119815. 1,
  119816. 0,
  119817. 0,
  119818. 0,
  119819. 0,
  119820. 0,
  119821. 0,
  119822. 0,
  119823. 0,
  119824. 0,
  119825. 1,
  119826. 0,
  119827. 1
  119828. ]);
  119829. return MP42.box(MP42.types.trex, data);
  119830. };
  119831. MP42.moof = function(track, baseMediaDecodeTime) {
  119832. return MP42.box(MP42.types.moof, MP42.mfhd(track.sequenceNumber), MP42.traf(track, baseMediaDecodeTime));
  119833. };
  119834. MP42.mfhd = function(sequenceNumber) {
  119835. var data = new Uint8Array([
  119836. 0,
  119837. 0,
  119838. 0,
  119839. 0,
  119840. sequenceNumber >>> 24 & 255,
  119841. sequenceNumber >>> 16 & 255,
  119842. sequenceNumber >>> 8 & 255,
  119843. sequenceNumber & 255
  119844. ]);
  119845. return MP42.box(MP42.types.mfhd, data);
  119846. };
  119847. MP42.traf = function(track, baseMediaDecodeTime) {
  119848. var trackId = track.id;
  119849. var tfhd = MP42.box(MP42.types.tfhd, new Uint8Array([
  119850. 0,
  119851. 0,
  119852. 0,
  119853. 0,
  119854. trackId >>> 24 & 255,
  119855. trackId >>> 16 & 255,
  119856. trackId >>> 8 & 255,
  119857. trackId & 255
  119858. ]));
  119859. var tfdt = MP42.box(MP42.types.tfdt, new Uint8Array([
  119860. 0,
  119861. 0,
  119862. 0,
  119863. 0,
  119864. baseMediaDecodeTime >>> 24 & 255,
  119865. baseMediaDecodeTime >>> 16 & 255,
  119866. baseMediaDecodeTime >>> 8 & 255,
  119867. baseMediaDecodeTime & 255
  119868. ]));
  119869. var sdtp = MP42.sdtp(track);
  119870. var trun = MP42.trun(track, sdtp.byteLength + 16 + 16 + 8 + 16 + 8 + 8);
  119871. return MP42.box(MP42.types.traf, tfhd, tfdt, trun, sdtp);
  119872. };
  119873. MP42.sdtp = function(track) {
  119874. var samples = track.samples || [];
  119875. var sampleCount = samples.length;
  119876. var data = new Uint8Array(4 + sampleCount);
  119877. for (var i2 = 0; i2 < sampleCount; i2++) {
  119878. var flags = samples[i2].flags;
  119879. data[i2 + 4] = flags.isLeading << 6 | flags.dependsOn << 4 | flags.isDependedOn << 2 | flags.hasRedundancy;
  119880. }
  119881. return MP42.box(MP42.types.sdtp, data);
  119882. };
  119883. MP42.trun = function(track, offset) {
  119884. var samples = track.samples || [];
  119885. var sampleCount = samples.length;
  119886. var dataSize = 12 + 16 * sampleCount;
  119887. var data = new Uint8Array(dataSize);
  119888. offset += 8 + dataSize;
  119889. data.set([
  119890. 0,
  119891. 0,
  119892. 15,
  119893. 1,
  119894. sampleCount >>> 24 & 255,
  119895. sampleCount >>> 16 & 255,
  119896. sampleCount >>> 8 & 255,
  119897. sampleCount & 255,
  119898. offset >>> 24 & 255,
  119899. offset >>> 16 & 255,
  119900. offset >>> 8 & 255,
  119901. offset & 255
  119902. ], 0);
  119903. for (var i2 = 0; i2 < sampleCount; i2++) {
  119904. var duration5 = samples[i2].duration;
  119905. var size = samples[i2].size;
  119906. var flags = samples[i2].flags;
  119907. var cts = samples[i2].cts;
  119908. data.set([
  119909. duration5 >>> 24 & 255,
  119910. duration5 >>> 16 & 255,
  119911. duration5 >>> 8 & 255,
  119912. duration5 & 255,
  119913. size >>> 24 & 255,
  119914. size >>> 16 & 255,
  119915. size >>> 8 & 255,
  119916. size & 255,
  119917. flags.isLeading << 2 | flags.dependsOn,
  119918. flags.isDependedOn << 6 | flags.hasRedundancy << 4 | flags.isNonSync,
  119919. 0,
  119920. 0,
  119921. cts >>> 24 & 255,
  119922. cts >>> 16 & 255,
  119923. cts >>> 8 & 255,
  119924. cts & 255
  119925. ], 12 + 16 * i2);
  119926. }
  119927. return MP42.box(MP42.types.trun, data);
  119928. };
  119929. MP42.mdat = function(data) {
  119930. return MP42.box(MP42.types.mdat, data);
  119931. };
  119932. return MP42;
  119933. }();
  119934. MP4.init();
  119935. __webpack_exports__2["default"] = MP4;
  119936. },
  119937. "./src/remux/mp4-remuxer.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  119938. __webpack_require__2.r(__webpack_exports__2);
  119939. var _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./src/utils/logger.js");
  119940. var _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/remux/mp4-generator.js");
  119941. var _aac_silent_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__2("./src/remux/aac-silent.js");
  119942. var _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__2("./src/utils/browser.js");
  119943. var _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__2("./src/core/media-segment-info.js");
  119944. var _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__2("./src/utils/exception.js");
  119945. var MP4Remuxer = function() {
  119946. function MP4Remuxer2(config) {
  119947. this.TAG = "MP4Remuxer";
  119948. this._config = config;
  119949. this._isLive = config.isLive === true ? true : false;
  119950. this._dtsBase = -1;
  119951. this._dtsBaseInited = false;
  119952. this._audioDtsBase = Infinity;
  119953. this._videoDtsBase = Infinity;
  119954. this._audioNextDts = void 0;
  119955. this._videoNextDts = void 0;
  119956. this._audioStashedLastSample = null;
  119957. this._videoStashedLastSample = null;
  119958. this._audioMeta = null;
  119959. this._videoMeta = null;
  119960. this._audioSegmentInfoList = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.MediaSegmentInfoList("audio");
  119961. this._videoSegmentInfoList = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.MediaSegmentInfoList("video");
  119962. this._onInitSegment = null;
  119963. this._onMediaSegment = null;
  119964. this._forceFirstIDR = _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.chrome && (_utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.version.major < 50 || _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.version.major === 50 && _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.version.build < 2661) ? true : false;
  119965. this._fillSilentAfterSeek = _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.msedge || _utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.msie;
  119966. this._mp3UseMpegAudio = !_utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.firefox;
  119967. this._fillAudioTimestampGap = this._config.fixAudioTimestampGap;
  119968. }
  119969. MP4Remuxer2.prototype.destroy = function() {
  119970. this._dtsBase = -1;
  119971. this._dtsBaseInited = false;
  119972. this._audioMeta = null;
  119973. this._videoMeta = null;
  119974. this._audioSegmentInfoList.clear();
  119975. this._audioSegmentInfoList = null;
  119976. this._videoSegmentInfoList.clear();
  119977. this._videoSegmentInfoList = null;
  119978. this._onInitSegment = null;
  119979. this._onMediaSegment = null;
  119980. };
  119981. MP4Remuxer2.prototype.bindDataSource = function(producer) {
  119982. producer.onDataAvailable = this.remux.bind(this);
  119983. producer.onTrackMetadata = this._onTrackMetadataReceived.bind(this);
  119984. return this;
  119985. };
  119986. Object.defineProperty(MP4Remuxer2.prototype, "onInitSegment", {
  119987. get: function() {
  119988. return this._onInitSegment;
  119989. },
  119990. set: function(callback2) {
  119991. this._onInitSegment = callback2;
  119992. },
  119993. enumerable: false,
  119994. configurable: true
  119995. });
  119996. Object.defineProperty(MP4Remuxer2.prototype, "onMediaSegment", {
  119997. get: function() {
  119998. return this._onMediaSegment;
  119999. },
  120000. set: function(callback2) {
  120001. this._onMediaSegment = callback2;
  120002. },
  120003. enumerable: false,
  120004. configurable: true
  120005. });
  120006. MP4Remuxer2.prototype.insertDiscontinuity = function() {
  120007. this._audioNextDts = this._videoNextDts = void 0;
  120008. };
  120009. MP4Remuxer2.prototype.seek = function(originalDts) {
  120010. this._audioStashedLastSample = null;
  120011. this._videoStashedLastSample = null;
  120012. this._videoSegmentInfoList.clear();
  120013. this._audioSegmentInfoList.clear();
  120014. };
  120015. MP4Remuxer2.prototype.remux = function(audioTrack, videoTrack) {
  120016. if (!this._onMediaSegment) {
  120017. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__.IllegalStateException("MP4Remuxer: onMediaSegment callback must be specificed!");
  120018. }
  120019. if (!this._dtsBaseInited) {
  120020. this._calculateDtsBase(audioTrack, videoTrack);
  120021. }
  120022. this._remuxVideo(videoTrack);
  120023. this._remuxAudio(audioTrack);
  120024. };
  120025. MP4Remuxer2.prototype._onTrackMetadataReceived = function(type2, metadata) {
  120026. var metabox = null;
  120027. var container = "mp4";
  120028. var codec = metadata.codec;
  120029. if (type2 === "audio") {
  120030. this._audioMeta = metadata;
  120031. if (metadata.codec === "mp3" && this._mp3UseMpegAudio) {
  120032. container = "mpeg";
  120033. codec = "";
  120034. metabox = new Uint8Array();
  120035. } else {
  120036. metabox = _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.generateInitSegment(metadata);
  120037. }
  120038. } else if (type2 === "video") {
  120039. this._videoMeta = metadata;
  120040. metabox = _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.generateInitSegment(metadata);
  120041. } else {
  120042. return;
  120043. }
  120044. if (!this._onInitSegment) {
  120045. throw new _utils_exception_js__WEBPACK_IMPORTED_MODULE_5__.IllegalStateException("MP4Remuxer: onInitSegment callback must be specified!");
  120046. }
  120047. this._onInitSegment(type2, {
  120048. type: type2,
  120049. data: metabox.buffer,
  120050. codec,
  120051. container: type2 + "/" + container,
  120052. mediaDuration: metadata.duration
  120053. });
  120054. };
  120055. MP4Remuxer2.prototype._calculateDtsBase = function(audioTrack, videoTrack) {
  120056. if (this._dtsBaseInited) {
  120057. return;
  120058. }
  120059. if (audioTrack.samples && audioTrack.samples.length) {
  120060. this._audioDtsBase = audioTrack.samples[0].dts;
  120061. }
  120062. if (videoTrack.samples && videoTrack.samples.length) {
  120063. this._videoDtsBase = videoTrack.samples[0].dts;
  120064. }
  120065. this._dtsBase = Math.min(this._audioDtsBase, this._videoDtsBase);
  120066. this._dtsBaseInited = true;
  120067. };
  120068. MP4Remuxer2.prototype.flushStashedSamples = function() {
  120069. var videoSample = this._videoStashedLastSample;
  120070. var audioSample = this._audioStashedLastSample;
  120071. var videoTrack = {
  120072. type: "video",
  120073. id: 1,
  120074. sequenceNumber: 0,
  120075. samples: [],
  120076. length: 0
  120077. };
  120078. if (videoSample != null) {
  120079. videoTrack.samples.push(videoSample);
  120080. videoTrack.length = videoSample.length;
  120081. }
  120082. var audioTrack = {
  120083. type: "audio",
  120084. id: 2,
  120085. sequenceNumber: 0,
  120086. samples: [],
  120087. length: 0
  120088. };
  120089. if (audioSample != null) {
  120090. audioTrack.samples.push(audioSample);
  120091. audioTrack.length = audioSample.length;
  120092. }
  120093. this._videoStashedLastSample = null;
  120094. this._audioStashedLastSample = null;
  120095. this._remuxVideo(videoTrack, true);
  120096. this._remuxAudio(audioTrack, true);
  120097. };
  120098. MP4Remuxer2.prototype._remuxAudio = function(audioTrack, force) {
  120099. if (this._audioMeta == null) {
  120100. return;
  120101. }
  120102. var track = audioTrack;
  120103. var samples = track.samples;
  120104. var dtsCorrection = void 0;
  120105. var firstDts = -1, lastDts = -1;
  120106. var refSampleDuration = this._audioMeta.refSampleDuration;
  120107. var mpegRawTrack = this._audioMeta.codec === "mp3" && this._mp3UseMpegAudio;
  120108. var firstSegmentAfterSeek = this._dtsBaseInited && this._audioNextDts === void 0;
  120109. var insertPrefixSilentFrame = false;
  120110. if (!samples || samples.length === 0) {
  120111. return;
  120112. }
  120113. if (samples.length === 1 && !force) {
  120114. return;
  120115. }
  120116. var offset = 0;
  120117. var mdatbox = null;
  120118. var mdatBytes = 0;
  120119. if (mpegRawTrack) {
  120120. offset = 0;
  120121. mdatBytes = track.length;
  120122. } else {
  120123. offset = 8;
  120124. mdatBytes = 8 + track.length;
  120125. }
  120126. var lastSample = null;
  120127. if (samples.length > 1) {
  120128. lastSample = samples.pop();
  120129. mdatBytes -= lastSample.length;
  120130. }
  120131. if (this._audioStashedLastSample != null) {
  120132. var sample = this._audioStashedLastSample;
  120133. this._audioStashedLastSample = null;
  120134. samples.unshift(sample);
  120135. mdatBytes += sample.length;
  120136. }
  120137. if (lastSample != null) {
  120138. this._audioStashedLastSample = lastSample;
  120139. }
  120140. var firstSampleOriginalDts = samples[0].dts - this._dtsBase;
  120141. if (this._audioNextDts) {
  120142. dtsCorrection = firstSampleOriginalDts - this._audioNextDts;
  120143. } else {
  120144. if (this._audioSegmentInfoList.isEmpty()) {
  120145. dtsCorrection = 0;
  120146. if (this._fillSilentAfterSeek && !this._videoSegmentInfoList.isEmpty()) {
  120147. if (this._audioMeta.originalCodec !== "mp3") {
  120148. insertPrefixSilentFrame = true;
  120149. }
  120150. }
  120151. } else {
  120152. var lastSample_1 = this._audioSegmentInfoList.getLastSampleBefore(firstSampleOriginalDts);
  120153. if (lastSample_1 != null) {
  120154. var distance2 = firstSampleOriginalDts - (lastSample_1.originalDts + lastSample_1.duration);
  120155. if (distance2 <= 3) {
  120156. distance2 = 0;
  120157. }
  120158. var expectedDts = lastSample_1.dts + lastSample_1.duration + distance2;
  120159. dtsCorrection = firstSampleOriginalDts - expectedDts;
  120160. } else {
  120161. dtsCorrection = 0;
  120162. }
  120163. }
  120164. }
  120165. if (insertPrefixSilentFrame) {
  120166. var firstSampleDts = firstSampleOriginalDts - dtsCorrection;
  120167. var videoSegment = this._videoSegmentInfoList.getLastSegmentBefore(firstSampleOriginalDts);
  120168. if (videoSegment != null && videoSegment.beginDts < firstSampleDts) {
  120169. var silentUnit = _aac_silent_js__WEBPACK_IMPORTED_MODULE_2__.default.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount);
  120170. if (silentUnit) {
  120171. var dts = videoSegment.beginDts;
  120172. var silentFrameDuration = firstSampleDts - videoSegment.beginDts;
  120173. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.v(this.TAG, "InsertPrefixSilentAudio: dts: " + dts + ", duration: " + silentFrameDuration);
  120174. samples.unshift({ unit: silentUnit, dts, pts: dts });
  120175. mdatBytes += silentUnit.byteLength;
  120176. }
  120177. } else {
  120178. insertPrefixSilentFrame = false;
  120179. }
  120180. }
  120181. var mp4Samples = [];
  120182. for (var i2 = 0; i2 < samples.length; i2++) {
  120183. var sample = samples[i2];
  120184. var unit = sample.unit;
  120185. var originalDts = sample.dts - this._dtsBase;
  120186. var dts = originalDts;
  120187. var needFillSilentFrames = false;
  120188. var silentFrames = null;
  120189. var sampleDuration = 0;
  120190. if (originalDts < -1e-3) {
  120191. continue;
  120192. }
  120193. if (this._audioMeta.codec !== "mp3") {
  120194. var curRefDts = originalDts;
  120195. var maxAudioFramesDrift = 3;
  120196. if (this._audioNextDts) {
  120197. curRefDts = this._audioNextDts;
  120198. }
  120199. dtsCorrection = originalDts - curRefDts;
  120200. if (dtsCorrection <= -maxAudioFramesDrift * refSampleDuration) {
  120201. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Dropping 1 audio frame (originalDts: " + originalDts + " ms ,curRefDts: " + curRefDts + " ms) due to dtsCorrection: " + dtsCorrection + " ms overlap.");
  120202. continue;
  120203. } else if (dtsCorrection >= maxAudioFramesDrift * refSampleDuration && this._fillAudioTimestampGap && !_utils_browser_js__WEBPACK_IMPORTED_MODULE_3__.default.safari) {
  120204. needFillSilentFrames = true;
  120205. var frameCount = Math.floor(dtsCorrection / refSampleDuration);
  120206. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Large audio timestamp gap detected, may cause AV sync to drift. Silent frames will be generated to avoid unsync.\n" + ("originalDts: " + originalDts + " ms, curRefDts: " + curRefDts + " ms, ") + ("dtsCorrection: " + Math.round(dtsCorrection) + " ms, generate: " + frameCount + " frames"));
  120207. dts = Math.floor(curRefDts);
  120208. sampleDuration = Math.floor(curRefDts + refSampleDuration) - dts;
  120209. var silentUnit = _aac_silent_js__WEBPACK_IMPORTED_MODULE_2__.default.getSilentFrame(this._audioMeta.originalCodec, this._audioMeta.channelCount);
  120210. if (silentUnit == null) {
  120211. _utils_logger_js__WEBPACK_IMPORTED_MODULE_0__.default.w(this.TAG, "Unable to generate silent frame for " + (this._audioMeta.originalCodec + " with " + this._audioMeta.channelCount + " channels, repeat last frame"));
  120212. silentUnit = unit;
  120213. }
  120214. silentFrames = [];
  120215. for (var j = 0; j < frameCount; j++) {
  120216. curRefDts = curRefDts + refSampleDuration;
  120217. var intDts = Math.floor(curRefDts);
  120218. var intDuration = Math.floor(curRefDts + refSampleDuration) - intDts;
  120219. var frame = {
  120220. dts: intDts,
  120221. pts: intDts,
  120222. cts: 0,
  120223. unit: silentUnit,
  120224. size: silentUnit.byteLength,
  120225. duration: intDuration,
  120226. originalDts,
  120227. flags: {
  120228. isLeading: 0,
  120229. dependsOn: 1,
  120230. isDependedOn: 0,
  120231. hasRedundancy: 0
  120232. }
  120233. };
  120234. silentFrames.push(frame);
  120235. mdatBytes += frame.size;
  120236. }
  120237. this._audioNextDts = curRefDts + refSampleDuration;
  120238. } else {
  120239. dts = Math.floor(curRefDts);
  120240. sampleDuration = Math.floor(curRefDts + refSampleDuration) - dts;
  120241. this._audioNextDts = curRefDts + refSampleDuration;
  120242. }
  120243. } else {
  120244. dts = originalDts - dtsCorrection;
  120245. if (i2 !== samples.length - 1) {
  120246. var nextDts = samples[i2 + 1].dts - this._dtsBase - dtsCorrection;
  120247. sampleDuration = nextDts - dts;
  120248. } else {
  120249. if (lastSample != null) {
  120250. var nextDts = lastSample.dts - this._dtsBase - dtsCorrection;
  120251. sampleDuration = nextDts - dts;
  120252. } else if (mp4Samples.length >= 1) {
  120253. sampleDuration = mp4Samples[mp4Samples.length - 1].duration;
  120254. } else {
  120255. sampleDuration = Math.floor(refSampleDuration);
  120256. }
  120257. }
  120258. this._audioNextDts = dts + sampleDuration;
  120259. }
  120260. if (firstDts === -1) {
  120261. firstDts = dts;
  120262. }
  120263. mp4Samples.push({
  120264. dts,
  120265. pts: dts,
  120266. cts: 0,
  120267. unit: sample.unit,
  120268. size: sample.unit.byteLength,
  120269. duration: sampleDuration,
  120270. originalDts,
  120271. flags: {
  120272. isLeading: 0,
  120273. dependsOn: 1,
  120274. isDependedOn: 0,
  120275. hasRedundancy: 0
  120276. }
  120277. });
  120278. if (needFillSilentFrames) {
  120279. mp4Samples.push.apply(mp4Samples, silentFrames);
  120280. }
  120281. }
  120282. if (mp4Samples.length === 0) {
  120283. track.samples = [];
  120284. track.length = 0;
  120285. return;
  120286. }
  120287. if (mpegRawTrack) {
  120288. mdatbox = new Uint8Array(mdatBytes);
  120289. } else {
  120290. mdatbox = new Uint8Array(mdatBytes);
  120291. mdatbox[0] = mdatBytes >>> 24 & 255;
  120292. mdatbox[1] = mdatBytes >>> 16 & 255;
  120293. mdatbox[2] = mdatBytes >>> 8 & 255;
  120294. mdatbox[3] = mdatBytes & 255;
  120295. mdatbox.set(_mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.types.mdat, 4);
  120296. }
  120297. for (var i2 = 0; i2 < mp4Samples.length; i2++) {
  120298. var unit = mp4Samples[i2].unit;
  120299. mdatbox.set(unit, offset);
  120300. offset += unit.byteLength;
  120301. }
  120302. var latest = mp4Samples[mp4Samples.length - 1];
  120303. lastDts = latest.dts + latest.duration;
  120304. var info = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.MediaSegmentInfo();
  120305. info.beginDts = firstDts;
  120306. info.endDts = lastDts;
  120307. info.beginPts = firstDts;
  120308. info.endPts = lastDts;
  120309. info.originalBeginDts = mp4Samples[0].originalDts;
  120310. info.originalEndDts = latest.originalDts + latest.duration;
  120311. info.firstSample = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(mp4Samples[0].dts, mp4Samples[0].pts, mp4Samples[0].duration, mp4Samples[0].originalDts, false);
  120312. info.lastSample = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(latest.dts, latest.pts, latest.duration, latest.originalDts, false);
  120313. if (!this._isLive) {
  120314. this._audioSegmentInfoList.append(info);
  120315. }
  120316. track.samples = mp4Samples;
  120317. track.sequenceNumber++;
  120318. var moofbox = null;
  120319. if (mpegRawTrack) {
  120320. moofbox = new Uint8Array();
  120321. } else {
  120322. moofbox = _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.moof(track, firstDts);
  120323. }
  120324. track.samples = [];
  120325. track.length = 0;
  120326. var segment = {
  120327. type: "audio",
  120328. data: this._mergeBoxes(moofbox, mdatbox).buffer,
  120329. sampleCount: mp4Samples.length,
  120330. info
  120331. };
  120332. if (mpegRawTrack && firstSegmentAfterSeek) {
  120333. segment.timestampOffset = firstDts;
  120334. }
  120335. this._onMediaSegment("audio", segment);
  120336. };
  120337. MP4Remuxer2.prototype._remuxVideo = function(videoTrack, force) {
  120338. if (this._videoMeta == null) {
  120339. return;
  120340. }
  120341. var track = videoTrack;
  120342. var samples = track.samples;
  120343. var dtsCorrection = void 0;
  120344. var firstDts = -1, lastDts = -1;
  120345. var firstPts = -1, lastPts = -1;
  120346. if (!samples || samples.length === 0) {
  120347. return;
  120348. }
  120349. if (samples.length === 1 && !force) {
  120350. return;
  120351. }
  120352. var offset = 8;
  120353. var mdatbox = null;
  120354. var mdatBytes = 8 + videoTrack.length;
  120355. var lastSample = null;
  120356. if (samples.length > 1) {
  120357. lastSample = samples.pop();
  120358. mdatBytes -= lastSample.length;
  120359. }
  120360. if (this._videoStashedLastSample != null) {
  120361. var sample = this._videoStashedLastSample;
  120362. this._videoStashedLastSample = null;
  120363. samples.unshift(sample);
  120364. mdatBytes += sample.length;
  120365. }
  120366. if (lastSample != null) {
  120367. this._videoStashedLastSample = lastSample;
  120368. }
  120369. var firstSampleOriginalDts = samples[0].dts - this._dtsBase;
  120370. if (this._videoNextDts) {
  120371. dtsCorrection = firstSampleOriginalDts - this._videoNextDts;
  120372. } else {
  120373. if (this._videoSegmentInfoList.isEmpty()) {
  120374. dtsCorrection = 0;
  120375. } else {
  120376. var lastSample_2 = this._videoSegmentInfoList.getLastSampleBefore(firstSampleOriginalDts);
  120377. if (lastSample_2 != null) {
  120378. var distance2 = firstSampleOriginalDts - (lastSample_2.originalDts + lastSample_2.duration);
  120379. if (distance2 <= 3) {
  120380. distance2 = 0;
  120381. }
  120382. var expectedDts = lastSample_2.dts + lastSample_2.duration + distance2;
  120383. dtsCorrection = firstSampleOriginalDts - expectedDts;
  120384. } else {
  120385. dtsCorrection = 0;
  120386. }
  120387. }
  120388. }
  120389. var info = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.MediaSegmentInfo();
  120390. var mp4Samples = [];
  120391. for (var i2 = 0; i2 < samples.length; i2++) {
  120392. var sample = samples[i2];
  120393. var originalDts = sample.dts - this._dtsBase;
  120394. var isKeyframe = sample.isKeyframe;
  120395. var dts = originalDts - dtsCorrection;
  120396. var cts = sample.cts;
  120397. var pts = dts + cts;
  120398. if (firstDts === -1) {
  120399. firstDts = dts;
  120400. firstPts = pts;
  120401. }
  120402. var sampleDuration = 0;
  120403. if (i2 !== samples.length - 1) {
  120404. var nextDts = samples[i2 + 1].dts - this._dtsBase - dtsCorrection;
  120405. sampleDuration = nextDts - dts;
  120406. } else {
  120407. if (lastSample != null) {
  120408. var nextDts = lastSample.dts - this._dtsBase - dtsCorrection;
  120409. sampleDuration = nextDts - dts;
  120410. } else if (mp4Samples.length >= 1) {
  120411. sampleDuration = mp4Samples[mp4Samples.length - 1].duration;
  120412. } else {
  120413. sampleDuration = Math.floor(this._videoMeta.refSampleDuration);
  120414. }
  120415. }
  120416. if (isKeyframe) {
  120417. var syncPoint = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(dts, pts, sampleDuration, sample.dts, true);
  120418. syncPoint.fileposition = sample.fileposition;
  120419. info.appendSyncPoint(syncPoint);
  120420. }
  120421. mp4Samples.push({
  120422. dts,
  120423. pts,
  120424. cts,
  120425. units: sample.units,
  120426. size: sample.length,
  120427. isKeyframe,
  120428. duration: sampleDuration,
  120429. originalDts,
  120430. flags: {
  120431. isLeading: 0,
  120432. dependsOn: isKeyframe ? 2 : 1,
  120433. isDependedOn: isKeyframe ? 1 : 0,
  120434. hasRedundancy: 0,
  120435. isNonSync: isKeyframe ? 0 : 1
  120436. }
  120437. });
  120438. }
  120439. mdatbox = new Uint8Array(mdatBytes);
  120440. mdatbox[0] = mdatBytes >>> 24 & 255;
  120441. mdatbox[1] = mdatBytes >>> 16 & 255;
  120442. mdatbox[2] = mdatBytes >>> 8 & 255;
  120443. mdatbox[3] = mdatBytes & 255;
  120444. mdatbox.set(_mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.types.mdat, 4);
  120445. for (var i2 = 0; i2 < mp4Samples.length; i2++) {
  120446. var units = mp4Samples[i2].units;
  120447. while (units.length) {
  120448. var unit = units.shift();
  120449. var data = unit.data;
  120450. mdatbox.set(data, offset);
  120451. offset += data.byteLength;
  120452. }
  120453. }
  120454. var latest = mp4Samples[mp4Samples.length - 1];
  120455. lastDts = latest.dts + latest.duration;
  120456. lastPts = latest.pts + latest.duration;
  120457. this._videoNextDts = lastDts;
  120458. info.beginDts = firstDts;
  120459. info.endDts = lastDts;
  120460. info.beginPts = firstPts;
  120461. info.endPts = lastPts;
  120462. info.originalBeginDts = mp4Samples[0].originalDts;
  120463. info.originalEndDts = latest.originalDts + latest.duration;
  120464. info.firstSample = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(mp4Samples[0].dts, mp4Samples[0].pts, mp4Samples[0].duration, mp4Samples[0].originalDts, mp4Samples[0].isKeyframe);
  120465. info.lastSample = new _core_media_segment_info_js__WEBPACK_IMPORTED_MODULE_4__.SampleInfo(latest.dts, latest.pts, latest.duration, latest.originalDts, latest.isKeyframe);
  120466. if (!this._isLive) {
  120467. this._videoSegmentInfoList.append(info);
  120468. }
  120469. track.samples = mp4Samples;
  120470. track.sequenceNumber++;
  120471. if (this._forceFirstIDR) {
  120472. var flags = mp4Samples[0].flags;
  120473. flags.dependsOn = 2;
  120474. flags.isNonSync = 0;
  120475. }
  120476. var moofbox = _mp4_generator_js__WEBPACK_IMPORTED_MODULE_1__.default.moof(track, firstDts);
  120477. track.samples = [];
  120478. track.length = 0;
  120479. this._onMediaSegment("video", {
  120480. type: "video",
  120481. data: this._mergeBoxes(moofbox, mdatbox).buffer,
  120482. sampleCount: mp4Samples.length,
  120483. info
  120484. });
  120485. };
  120486. MP4Remuxer2.prototype._mergeBoxes = function(moof, mdat) {
  120487. var result = new Uint8Array(moof.byteLength + mdat.byteLength);
  120488. result.set(moof, 0);
  120489. result.set(mdat, moof.byteLength);
  120490. return result;
  120491. };
  120492. return MP4Remuxer2;
  120493. }();
  120494. __webpack_exports__2["default"] = MP4Remuxer;
  120495. },
  120496. "./src/utils/browser.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120497. __webpack_require__2.r(__webpack_exports__2);
  120498. var Browser = {};
  120499. function detect() {
  120500. var ua = self.navigator.userAgent.toLowerCase();
  120501. var match = /(edge)\/([\w.]+)/.exec(ua) || /(opr)[\/]([\w.]+)/.exec(ua) || /(chrome)[ \/]([\w.]+)/.exec(ua) || /(iemobile)[\/]([\w.]+)/.exec(ua) || /(version)(applewebkit)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+).*(version)[ \/]([\w.]+).*(safari)[ \/]([\w.]+)/.exec(ua) || /(webkit)[ \/]([\w.]+)/.exec(ua) || /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || /(msie) ([\w.]+)/.exec(ua) || ua.indexOf("trident") >= 0 && /(rv)(?::| )([\w.]+)/.exec(ua) || ua.indexOf("compatible") < 0 && /(firefox)[ \/]([\w.]+)/.exec(ua) || [];
  120502. var platform_match = /(ipad)/.exec(ua) || /(ipod)/.exec(ua) || /(windows phone)/.exec(ua) || /(iphone)/.exec(ua) || /(kindle)/.exec(ua) || /(android)/.exec(ua) || /(windows)/.exec(ua) || /(mac)/.exec(ua) || /(linux)/.exec(ua) || /(cros)/.exec(ua) || [];
  120503. var matched = {
  120504. browser: match[5] || match[3] || match[1] || "",
  120505. version: match[2] || match[4] || "0",
  120506. majorVersion: match[4] || match[2] || "0",
  120507. platform: platform_match[0] || ""
  120508. };
  120509. var browser2 = {};
  120510. if (matched.browser) {
  120511. browser2[matched.browser] = true;
  120512. var versionArray = matched.majorVersion.split(".");
  120513. browser2.version = {
  120514. major: parseInt(matched.majorVersion, 10),
  120515. string: matched.version
  120516. };
  120517. if (versionArray.length > 1) {
  120518. browser2.version.minor = parseInt(versionArray[1], 10);
  120519. }
  120520. if (versionArray.length > 2) {
  120521. browser2.version.build = parseInt(versionArray[2], 10);
  120522. }
  120523. }
  120524. if (matched.platform) {
  120525. browser2[matched.platform] = true;
  120526. }
  120527. if (browser2.chrome || browser2.opr || browser2.safari) {
  120528. browser2.webkit = true;
  120529. }
  120530. if (browser2.rv || browser2.iemobile) {
  120531. if (browser2.rv) {
  120532. delete browser2.rv;
  120533. }
  120534. var msie = "msie";
  120535. matched.browser = msie;
  120536. browser2[msie] = true;
  120537. }
  120538. if (browser2.edge) {
  120539. delete browser2.edge;
  120540. var msedge = "msedge";
  120541. matched.browser = msedge;
  120542. browser2[msedge] = true;
  120543. }
  120544. if (browser2.opr) {
  120545. var opera = "opera";
  120546. matched.browser = opera;
  120547. browser2[opera] = true;
  120548. }
  120549. if (browser2.safari && browser2.android) {
  120550. var android = "android";
  120551. matched.browser = android;
  120552. browser2[android] = true;
  120553. }
  120554. browser2.name = matched.browser;
  120555. browser2.platform = matched.platform;
  120556. for (var key in Browser) {
  120557. if (Browser.hasOwnProperty(key)) {
  120558. delete Browser[key];
  120559. }
  120560. }
  120561. Object.assign(Browser, browser2);
  120562. }
  120563. detect();
  120564. __webpack_exports__2["default"] = Browser;
  120565. },
  120566. "./src/utils/exception.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120567. __webpack_require__2.r(__webpack_exports__2);
  120568. __webpack_require__2.d(__webpack_exports__2, {
  120569. "RuntimeException": function() {
  120570. return RuntimeException;
  120571. },
  120572. "IllegalStateException": function() {
  120573. return IllegalStateException;
  120574. },
  120575. "InvalidArgumentException": function() {
  120576. return InvalidArgumentException;
  120577. },
  120578. "NotImplementedException": function() {
  120579. return NotImplementedException;
  120580. }
  120581. });
  120582. var __extends = function() {
  120583. var extendStatics = function(d2, b) {
  120584. extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d3, b2) {
  120585. d3.__proto__ = b2;
  120586. } || function(d3, b2) {
  120587. for (var p in b2)
  120588. if (Object.prototype.hasOwnProperty.call(b2, p))
  120589. d3[p] = b2[p];
  120590. };
  120591. return extendStatics(d2, b);
  120592. };
  120593. return function(d2, b) {
  120594. if (typeof b !== "function" && b !== null)
  120595. throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
  120596. extendStatics(d2, b);
  120597. function __() {
  120598. this.constructor = d2;
  120599. }
  120600. d2.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  120601. };
  120602. }();
  120603. var RuntimeException = function() {
  120604. function RuntimeException2(message) {
  120605. this._message = message;
  120606. }
  120607. Object.defineProperty(RuntimeException2.prototype, "name", {
  120608. get: function() {
  120609. return "RuntimeException";
  120610. },
  120611. enumerable: false,
  120612. configurable: true
  120613. });
  120614. Object.defineProperty(RuntimeException2.prototype, "message", {
  120615. get: function() {
  120616. return this._message;
  120617. },
  120618. enumerable: false,
  120619. configurable: true
  120620. });
  120621. RuntimeException2.prototype.toString = function() {
  120622. return this.name + ": " + this.message;
  120623. };
  120624. return RuntimeException2;
  120625. }();
  120626. var IllegalStateException = function(_super) {
  120627. __extends(IllegalStateException2, _super);
  120628. function IllegalStateException2(message) {
  120629. return _super.call(this, message) || this;
  120630. }
  120631. Object.defineProperty(IllegalStateException2.prototype, "name", {
  120632. get: function() {
  120633. return "IllegalStateException";
  120634. },
  120635. enumerable: false,
  120636. configurable: true
  120637. });
  120638. return IllegalStateException2;
  120639. }(RuntimeException);
  120640. var InvalidArgumentException = function(_super) {
  120641. __extends(InvalidArgumentException2, _super);
  120642. function InvalidArgumentException2(message) {
  120643. return _super.call(this, message) || this;
  120644. }
  120645. Object.defineProperty(InvalidArgumentException2.prototype, "name", {
  120646. get: function() {
  120647. return "InvalidArgumentException";
  120648. },
  120649. enumerable: false,
  120650. configurable: true
  120651. });
  120652. return InvalidArgumentException2;
  120653. }(RuntimeException);
  120654. var NotImplementedException = function(_super) {
  120655. __extends(NotImplementedException2, _super);
  120656. function NotImplementedException2(message) {
  120657. return _super.call(this, message) || this;
  120658. }
  120659. Object.defineProperty(NotImplementedException2.prototype, "name", {
  120660. get: function() {
  120661. return "NotImplementedException";
  120662. },
  120663. enumerable: false,
  120664. configurable: true
  120665. });
  120666. return NotImplementedException2;
  120667. }(RuntimeException);
  120668. },
  120669. "./src/utils/logger.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120670. __webpack_require__2.r(__webpack_exports__2);
  120671. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  120672. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  120673. var Log = function() {
  120674. function Log2() {
  120675. }
  120676. Log2.e = function(tag, msg) {
  120677. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120678. tag = Log2.GLOBAL_TAG;
  120679. var str = "[" + tag + "] > " + msg;
  120680. if (Log2.ENABLE_CALLBACK) {
  120681. Log2.emitter.emit("log", "error", str);
  120682. }
  120683. if (!Log2.ENABLE_ERROR) {
  120684. return;
  120685. }
  120686. if (console.error) {
  120687. console.error(str);
  120688. } else if (console.warn) {
  120689. console.warn(str);
  120690. } else {
  120691. console.log(str);
  120692. }
  120693. };
  120694. Log2.i = function(tag, msg) {
  120695. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120696. tag = Log2.GLOBAL_TAG;
  120697. var str = "[" + tag + "] > " + msg;
  120698. if (Log2.ENABLE_CALLBACK) {
  120699. Log2.emitter.emit("log", "info", str);
  120700. }
  120701. if (!Log2.ENABLE_INFO) {
  120702. return;
  120703. }
  120704. if (console.info) {
  120705. console.info(str);
  120706. } else {
  120707. console.log(str);
  120708. }
  120709. };
  120710. Log2.w = function(tag, msg) {
  120711. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120712. tag = Log2.GLOBAL_TAG;
  120713. var str = "[" + tag + "] > " + msg;
  120714. if (Log2.ENABLE_CALLBACK) {
  120715. Log2.emitter.emit("log", "warn", str);
  120716. }
  120717. if (!Log2.ENABLE_WARN) {
  120718. return;
  120719. }
  120720. if (console.warn) {
  120721. console.warn(str);
  120722. } else {
  120723. console.log(str);
  120724. }
  120725. };
  120726. Log2.d = function(tag, msg) {
  120727. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120728. tag = Log2.GLOBAL_TAG;
  120729. var str = "[" + tag + "] > " + msg;
  120730. if (Log2.ENABLE_CALLBACK) {
  120731. Log2.emitter.emit("log", "debug", str);
  120732. }
  120733. if (!Log2.ENABLE_DEBUG) {
  120734. return;
  120735. }
  120736. if (console.debug) {
  120737. console.debug(str);
  120738. } else {
  120739. console.log(str);
  120740. }
  120741. };
  120742. Log2.v = function(tag, msg) {
  120743. if (!tag || Log2.FORCE_GLOBAL_TAG)
  120744. tag = Log2.GLOBAL_TAG;
  120745. var str = "[" + tag + "] > " + msg;
  120746. if (Log2.ENABLE_CALLBACK) {
  120747. Log2.emitter.emit("log", "verbose", str);
  120748. }
  120749. if (!Log2.ENABLE_VERBOSE) {
  120750. return;
  120751. }
  120752. console.log(str);
  120753. };
  120754. return Log2;
  120755. }();
  120756. Log.GLOBAL_TAG = "flv.js";
  120757. Log.FORCE_GLOBAL_TAG = false;
  120758. Log.ENABLE_ERROR = true;
  120759. Log.ENABLE_INFO = true;
  120760. Log.ENABLE_WARN = true;
  120761. Log.ENABLE_DEBUG = true;
  120762. Log.ENABLE_VERBOSE = true;
  120763. Log.ENABLE_CALLBACK = false;
  120764. Log.emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  120765. __webpack_exports__2["default"] = Log;
  120766. },
  120767. "./src/utils/logging-control.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120768. __webpack_require__2.r(__webpack_exports__2);
  120769. var events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__2("./node_modules/events/events.js");
  120770. var events__WEBPACK_IMPORTED_MODULE_0___default = /* @__PURE__ */ __webpack_require__2.n(events__WEBPACK_IMPORTED_MODULE_0__);
  120771. var _logger_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__2("./src/utils/logger.js");
  120772. var LoggingControl = function() {
  120773. function LoggingControl2() {
  120774. }
  120775. Object.defineProperty(LoggingControl2, "forceGlobalTag", {
  120776. get: function() {
  120777. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.FORCE_GLOBAL_TAG;
  120778. },
  120779. set: function(enable) {
  120780. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.FORCE_GLOBAL_TAG = enable;
  120781. LoggingControl2._notifyChange();
  120782. },
  120783. enumerable: false,
  120784. configurable: true
  120785. });
  120786. Object.defineProperty(LoggingControl2, "globalTag", {
  120787. get: function() {
  120788. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.GLOBAL_TAG;
  120789. },
  120790. set: function(tag) {
  120791. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.GLOBAL_TAG = tag;
  120792. LoggingControl2._notifyChange();
  120793. },
  120794. enumerable: false,
  120795. configurable: true
  120796. });
  120797. Object.defineProperty(LoggingControl2, "enableAll", {
  120798. get: function() {
  120799. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE && _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG && _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO && _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN && _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR;
  120800. },
  120801. set: function(enable) {
  120802. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE = enable;
  120803. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG = enable;
  120804. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO = enable;
  120805. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN = enable;
  120806. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR = enable;
  120807. LoggingControl2._notifyChange();
  120808. },
  120809. enumerable: false,
  120810. configurable: true
  120811. });
  120812. Object.defineProperty(LoggingControl2, "enableDebug", {
  120813. get: function() {
  120814. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG;
  120815. },
  120816. set: function(enable) {
  120817. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG = enable;
  120818. LoggingControl2._notifyChange();
  120819. },
  120820. enumerable: false,
  120821. configurable: true
  120822. });
  120823. Object.defineProperty(LoggingControl2, "enableVerbose", {
  120824. get: function() {
  120825. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE;
  120826. },
  120827. set: function(enable) {
  120828. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE = enable;
  120829. LoggingControl2._notifyChange();
  120830. },
  120831. enumerable: false,
  120832. configurable: true
  120833. });
  120834. Object.defineProperty(LoggingControl2, "enableInfo", {
  120835. get: function() {
  120836. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO;
  120837. },
  120838. set: function(enable) {
  120839. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO = enable;
  120840. LoggingControl2._notifyChange();
  120841. },
  120842. enumerable: false,
  120843. configurable: true
  120844. });
  120845. Object.defineProperty(LoggingControl2, "enableWarn", {
  120846. get: function() {
  120847. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN;
  120848. },
  120849. set: function(enable) {
  120850. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN = enable;
  120851. LoggingControl2._notifyChange();
  120852. },
  120853. enumerable: false,
  120854. configurable: true
  120855. });
  120856. Object.defineProperty(LoggingControl2, "enableError", {
  120857. get: function() {
  120858. return _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR;
  120859. },
  120860. set: function(enable) {
  120861. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR = enable;
  120862. LoggingControl2._notifyChange();
  120863. },
  120864. enumerable: false,
  120865. configurable: true
  120866. });
  120867. LoggingControl2.getConfig = function() {
  120868. return {
  120869. globalTag: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.GLOBAL_TAG,
  120870. forceGlobalTag: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.FORCE_GLOBAL_TAG,
  120871. enableVerbose: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE,
  120872. enableDebug: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG,
  120873. enableInfo: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO,
  120874. enableWarn: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN,
  120875. enableError: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR,
  120876. enableCallback: _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_CALLBACK
  120877. };
  120878. };
  120879. LoggingControl2.applyConfig = function(config) {
  120880. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.GLOBAL_TAG = config.globalTag;
  120881. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.FORCE_GLOBAL_TAG = config.forceGlobalTag;
  120882. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_VERBOSE = config.enableVerbose;
  120883. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_DEBUG = config.enableDebug;
  120884. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_INFO = config.enableInfo;
  120885. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_WARN = config.enableWarn;
  120886. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_ERROR = config.enableError;
  120887. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_CALLBACK = config.enableCallback;
  120888. };
  120889. LoggingControl2._notifyChange = function() {
  120890. var emitter = LoggingControl2.emitter;
  120891. if (emitter.listenerCount("change") > 0) {
  120892. var config = LoggingControl2.getConfig();
  120893. emitter.emit("change", config);
  120894. }
  120895. };
  120896. LoggingControl2.registerListener = function(listener) {
  120897. LoggingControl2.emitter.addListener("change", listener);
  120898. };
  120899. LoggingControl2.removeListener = function(listener) {
  120900. LoggingControl2.emitter.removeListener("change", listener);
  120901. };
  120902. LoggingControl2.addLogListener = function(listener) {
  120903. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.emitter.addListener("log", listener);
  120904. if (_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.emitter.listenerCount("log") > 0) {
  120905. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_CALLBACK = true;
  120906. LoggingControl2._notifyChange();
  120907. }
  120908. };
  120909. LoggingControl2.removeLogListener = function(listener) {
  120910. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.emitter.removeListener("log", listener);
  120911. if (_logger_js__WEBPACK_IMPORTED_MODULE_1__.default.emitter.listenerCount("log") === 0) {
  120912. _logger_js__WEBPACK_IMPORTED_MODULE_1__.default.ENABLE_CALLBACK = false;
  120913. LoggingControl2._notifyChange();
  120914. }
  120915. };
  120916. return LoggingControl2;
  120917. }();
  120918. LoggingControl.emitter = new (events__WEBPACK_IMPORTED_MODULE_0___default())();
  120919. __webpack_exports__2["default"] = LoggingControl;
  120920. },
  120921. "./src/utils/polyfill.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120922. __webpack_require__2.r(__webpack_exports__2);
  120923. var Polyfill = function() {
  120924. function Polyfill2() {
  120925. }
  120926. Polyfill2.install = function() {
  120927. Object.setPrototypeOf = Object.setPrototypeOf || function(obj, proto) {
  120928. obj.__proto__ = proto;
  120929. return obj;
  120930. };
  120931. Object.assign = Object.assign || function(target) {
  120932. if (target === void 0 || target === null) {
  120933. throw new TypeError("Cannot convert undefined or null to object");
  120934. }
  120935. var output = Object(target);
  120936. for (var i2 = 1; i2 < arguments.length; i2++) {
  120937. var source = arguments[i2];
  120938. if (source !== void 0 && source !== null) {
  120939. for (var key in source) {
  120940. if (source.hasOwnProperty(key)) {
  120941. output[key] = source[key];
  120942. }
  120943. }
  120944. }
  120945. }
  120946. return output;
  120947. };
  120948. if (typeof self.Promise !== "function") {
  120949. __webpack_require__2("./node_modules/es6-promise/dist/es6-promise.js").polyfill();
  120950. }
  120951. };
  120952. return Polyfill2;
  120953. }();
  120954. Polyfill.install();
  120955. __webpack_exports__2["default"] = Polyfill;
  120956. },
  120957. "./src/utils/utf8-conv.js": function(__unused_webpack_module, __webpack_exports__2, __webpack_require__2) {
  120958. __webpack_require__2.r(__webpack_exports__2);
  120959. function checkContinuation(uint8array, start2, checkLength) {
  120960. var array = uint8array;
  120961. if (start2 + checkLength < array.length) {
  120962. while (checkLength--) {
  120963. if ((array[++start2] & 192) !== 128)
  120964. return false;
  120965. }
  120966. return true;
  120967. } else {
  120968. return false;
  120969. }
  120970. }
  120971. function decodeUTF8(uint8array) {
  120972. var out = [];
  120973. var input = uint8array;
  120974. var i2 = 0;
  120975. var length = uint8array.length;
  120976. while (i2 < length) {
  120977. if (input[i2] < 128) {
  120978. out.push(String.fromCharCode(input[i2]));
  120979. ++i2;
  120980. continue;
  120981. } else if (input[i2] < 192)
  120982. ;
  120983. else if (input[i2] < 224) {
  120984. if (checkContinuation(input, i2, 1)) {
  120985. var ucs4 = (input[i2] & 31) << 6 | input[i2 + 1] & 63;
  120986. if (ucs4 >= 128) {
  120987. out.push(String.fromCharCode(ucs4 & 65535));
  120988. i2 += 2;
  120989. continue;
  120990. }
  120991. }
  120992. } else if (input[i2] < 240) {
  120993. if (checkContinuation(input, i2, 2)) {
  120994. var ucs4 = (input[i2] & 15) << 12 | (input[i2 + 1] & 63) << 6 | input[i2 + 2] & 63;
  120995. if (ucs4 >= 2048 && (ucs4 & 63488) !== 55296) {
  120996. out.push(String.fromCharCode(ucs4 & 65535));
  120997. i2 += 3;
  120998. continue;
  120999. }
  121000. }
  121001. } else if (input[i2] < 248) {
  121002. if (checkContinuation(input, i2, 3)) {
  121003. var ucs4 = (input[i2] & 7) << 18 | (input[i2 + 1] & 63) << 12 | (input[i2 + 2] & 63) << 6 | input[i2 + 3] & 63;
  121004. if (ucs4 > 65536 && ucs4 < 1114112) {
  121005. ucs4 -= 65536;
  121006. out.push(String.fromCharCode(ucs4 >>> 10 | 55296));
  121007. out.push(String.fromCharCode(ucs4 & 1023 | 56320));
  121008. i2 += 4;
  121009. continue;
  121010. }
  121011. }
  121012. }
  121013. out.push(String.fromCharCode(65533));
  121014. ++i2;
  121015. }
  121016. return out.join("");
  121017. }
  121018. __webpack_exports__2["default"] = decodeUTF8;
  121019. }
  121020. };
  121021. var __webpack_module_cache__ = {};
  121022. function __webpack_require__(moduleId) {
  121023. var cachedModule = __webpack_module_cache__[moduleId];
  121024. if (cachedModule !== void 0) {
  121025. return cachedModule.exports;
  121026. }
  121027. var module3 = __webpack_module_cache__[moduleId] = {
  121028. exports: {}
  121029. };
  121030. __webpack_modules__[moduleId].call(module3.exports, module3, module3.exports, __webpack_require__);
  121031. return module3.exports;
  121032. }
  121033. __webpack_require__.m = __webpack_modules__;
  121034. !function() {
  121035. __webpack_require__.n = function(module3) {
  121036. var getter = module3 && module3.__esModule ? function() {
  121037. return module3["default"];
  121038. } : function() {
  121039. return module3;
  121040. };
  121041. __webpack_require__.d(getter, { a: getter });
  121042. return getter;
  121043. };
  121044. }();
  121045. !function() {
  121046. __webpack_require__.d = function(exports3, definition) {
  121047. for (var key in definition) {
  121048. if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports3, key)) {
  121049. Object.defineProperty(exports3, key, { enumerable: true, get: definition[key] });
  121050. }
  121051. }
  121052. };
  121053. }();
  121054. !function() {
  121055. __webpack_require__.g = function() {
  121056. if (typeof globalThis === "object")
  121057. return globalThis;
  121058. try {
  121059. return this || new Function("return this")();
  121060. } catch (e) {
  121061. if (typeof window === "object")
  121062. return window;
  121063. }
  121064. }();
  121065. }();
  121066. !function() {
  121067. __webpack_require__.o = function(obj, prop) {
  121068. return Object.prototype.hasOwnProperty.call(obj, prop);
  121069. };
  121070. }();
  121071. !function() {
  121072. __webpack_require__.r = function(exports3) {
  121073. if (typeof Symbol !== "undefined" && Symbol.toStringTag) {
  121074. Object.defineProperty(exports3, Symbol.toStringTag, { value: "Module" });
  121075. }
  121076. Object.defineProperty(exports3, "__esModule", { value: true });
  121077. };
  121078. }();
  121079. var __webpack_exports__ = __webpack_require__("./src/index.js");
  121080. return __webpack_exports__;
  121081. }();
  121082. });
  121083. })(flv);
  121084. var flvjs = /* @__PURE__ */ getDefaultExportFromCjs(flv.exports);
  121085. const Html5 = videojs$2.getTech("Html5");
  121086. const mergeOptions = videojs$2.mergeOptions || videojs$2.util.mergeOptions;
  121087. const defaults = {
  121088. mediaDataSource: {},
  121089. config: {}
  121090. };
  121091. class Flvjs extends Html5 {
  121092. constructor(options2, ready) {
  121093. options2 = mergeOptions(defaults, options2);
  121094. super(options2, ready);
  121095. }
  121096. setSrc(src) {
  121097. if (this.flvPlayer) {
  121098. this.flvPlayer.detachMediaElement();
  121099. this.flvPlayer.destroy();
  121100. }
  121101. const mediaDataSource = this.options_.mediaDataSource;
  121102. const config = this.options_.config;
  121103. mediaDataSource.type = mediaDataSource.type === void 0 ? "flv" : mediaDataSource.type;
  121104. mediaDataSource.url = src;
  121105. this.flvPlayer = flvjs.createPlayer(mediaDataSource, config);
  121106. this.flvPlayer.attachMediaElement(this.el_);
  121107. this.flvPlayer.load();
  121108. }
  121109. dispose() {
  121110. if (this.flvPlayer) {
  121111. this.flvPlayer.detachMediaElement();
  121112. this.flvPlayer.destroy();
  121113. }
  121114. super.dispose();
  121115. }
  121116. }
  121117. Flvjs.isSupported = function() {
  121118. return flvjs && flvjs.isSupported();
  121119. };
  121120. Flvjs.formats = {
  121121. "video/flv": "FLV",
  121122. "video/x-flv": "FLV"
  121123. };
  121124. Flvjs.canPlayType = function(type2) {
  121125. if (Flvjs.isSupported() && type2 in Flvjs.formats) {
  121126. return "maybe";
  121127. }
  121128. return "";
  121129. };
  121130. Flvjs.canPlaySource = function(srcObj, options2) {
  121131. return Flvjs.canPlayType(srcObj.type);
  121132. };
  121133. Flvjs.VERSION = "__VERSION__";
  121134. videojs$2.registerTech("Flvjs", Flvjs);
  121135. var VideoWindow$1 = "";
  121136. class VideoWindow {
  121137. constructor(viewer2, position2, videoInfo, offsetHeight) {
  121138. if (!viewer2)
  121139. throw new Cesium.DeveloperError("no viewer object!");
  121140. if (!position2)
  121141. throw new Cesium.DeveloperError("no position object!");
  121142. this.viewer = viewer2;
  121143. this.position = position2;
  121144. this.offsetHeight = offsetHeight;
  121145. if (position2 instanceof Cesium.Cartesian3) {
  121146. this.position = position2;
  121147. } else {
  121148. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121149. }
  121150. if (document.getElementsByClassName("popup-video").length > 0) {
  121151. document.getElementsByClassName("popup-video")[0].remove();
  121152. viewer2.entities.remove(viewer2.entities.getById("videoPopupPoint"));
  121153. }
  121154. this.id = "popup_video_" + getGuid();
  121155. this.popupDiv = document.createElement("div");
  121156. this.popupDiv.classList.add("popup-video");
  121157. this.popupDiv.id = this.id;
  121158. this.viewer.container.append(this.popupDiv);
  121159. this.popupDiv.innerHTML = this._createHtml(videoInfo);
  121160. switch (videoInfo.type) {
  121161. case "hls":
  121162. this.videotype = "application/x-mpegURL";
  121163. break;
  121164. case "rtmp":
  121165. this.videotype = "rtmp/flv";
  121166. break;
  121167. case "flv":
  121168. this.videotype = "video/x-flv";
  121169. break;
  121170. case "mp4":
  121171. this.videotype = "video/mp4";
  121172. break;
  121173. }
  121174. this.videoPlayer = videojs$2(document.querySelector("#myvideo"), {
  121175. controls: true,
  121176. autoplay: "muted",
  121177. loop: true,
  121178. muted: false,
  121179. fluid: true,
  121180. aspectRatio: "16:9",
  121181. reload: "auto",
  121182. fullscreen: {
  121183. options: {
  121184. navigationUI: "hide"
  121185. }
  121186. },
  121187. sources: [{
  121188. src: videoInfo.url,
  121189. type: this.videotype
  121190. }]
  121191. }, function onPlayerReady() {
  121192. console.log("onPlayerReady", this);
  121193. });
  121194. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121195. this.initPoint();
  121196. document.getElementsByClassName("popup-video1-close-button")[0].onclick = () => {
  121197. this.close();
  121198. };
  121199. }
  121200. postRender() {
  121201. this.viewer.scene.canvas.height;
  121202. const windowPosition = new Cesium.Cartesian2();
  121203. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121204. this.viewer.scene,
  121205. this.position,
  121206. windowPosition
  121207. );
  121208. let elWidth = this.popupDiv.offsetWidth;
  121209. let elHeight = this.popupDiv.offsetHeight;
  121210. if (!!this.offsetHeight) {
  121211. elHeight += this.offsetHeight;
  121212. }
  121213. this.popupDiv.style.left = windowPosition.x - elWidth / 2 + "px";
  121214. this.popupDiv.style.top = windowPosition.y - elHeight + "px";
  121215. const camerPosition = this.viewer.camera.position;
  121216. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121217. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121218. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121219. this.popupDiv.style.display = "block";
  121220. } else {
  121221. this.popupDiv.style.display = "none";
  121222. }
  121223. }
  121224. _createHtml(videoInfo) {
  121225. let html = `
  121226. <div class="popup-video-header">
  121227. ${videoInfo.name}
  121228. <span class="popup-video1-close-button">\xD7</span>
  121229. </div>
  121230. <div class="popup-video-content">
  121231. <video id="myvideo" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" width="100%" height="100%"></video>
  121232. </div>
  121233. <div class="popup-video-tip">
  121234. </div>
  121235. `;
  121236. return html;
  121237. }
  121238. initPoint() {
  121239. this.billboard = new Cesium.Entity({
  121240. id: "videoPopupPoint",
  121241. name: "popupPoint",
  121242. position: this.position,
  121243. billboard: {
  121244. image: "jt3dSDK/imgs/point/point.png",
  121245. horizontalOrigin: Cesium.HorizontalOrigin.center,
  121246. verticalOrigin: Cesium.VerticalOrigin.bottom,
  121247. scale: 1,
  121248. pixelOffset: new Cesium.Cartesian2(0, 0),
  121249. disableDepthTestDistance: Number.POSITIVE_INFINITY
  121250. }
  121251. });
  121252. this.viewer.entities.add(this.billboard);
  121253. }
  121254. }
  121255. Object.assign(VideoWindow.prototype, {
  121256. close() {
  121257. this.popupDiv.remove();
  121258. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121259. this.viewer.entities.remove(this.billboard);
  121260. videojs$2("myvideo").dispose();
  121261. this.videoPlayer.dispose();
  121262. }
  121263. });
  121264. var VideoWindow2$1 = "";
  121265. class VideoWindow2 {
  121266. constructor(viewer2, position2, videoInfo) {
  121267. if (!viewer2)
  121268. throw new Cesium.DeveloperError("no viewer object!");
  121269. if (!position2)
  121270. throw new Cesium.DeveloperError("no position object!");
  121271. this.viewer = viewer2;
  121272. this.position = position2;
  121273. if (position2 instanceof Cesium.Cartesian3) {
  121274. this.position = position2;
  121275. } else {
  121276. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121277. }
  121278. if (document.getElementsByClassName("popup-video2").length > 0) {
  121279. document.getElementsByClassName("popup-video2")[0].remove();
  121280. }
  121281. this.id = "popup_video_" + getGuid();
  121282. this.popupDiv = document.createElement("div");
  121283. this.popupDiv.classList.add("popup-video2");
  121284. this.popupDiv.id = this.id;
  121285. this.viewer.container.append(this.popupDiv);
  121286. this.popupDiv.innerHTML = this._createHtml(videoInfo);
  121287. switch (videoInfo.type) {
  121288. case "hls":
  121289. this.videotype = "application/x-mpegURL";
  121290. break;
  121291. case "rtmp":
  121292. this.videotype = "rtmp/flv";
  121293. break;
  121294. case "flv":
  121295. this.videotype = "video/x-flv";
  121296. break;
  121297. case "mp4":
  121298. this.videotype = "video/mp4";
  121299. break;
  121300. }
  121301. this.videoPlayer = videojs$2(document.querySelector("#myvideo"), {
  121302. controls: true,
  121303. autoplay: "muted",
  121304. loop: true,
  121305. muted: false,
  121306. fluid: true,
  121307. aspectRatio: "16:9",
  121308. reload: "auto",
  121309. fullscreen: {
  121310. options: {
  121311. navigationUI: "hide"
  121312. }
  121313. },
  121314. sources: [{
  121315. src: videoInfo.url,
  121316. type: this.videotype
  121317. }]
  121318. }, function onPlayerReady() {
  121319. console.log("onPlayerReady", this);
  121320. });
  121321. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121322. document.getElementsByClassName("popup-video2-close-button")[0].onclick = () => {
  121323. this.close();
  121324. };
  121325. }
  121326. postRender() {
  121327. this.viewer.scene.canvas.height;
  121328. const windowPosition = new Cesium.Cartesian2();
  121329. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121330. this.viewer.scene,
  121331. this.position,
  121332. windowPosition
  121333. );
  121334. this.popupDiv.style.left = windowPosition.x - this.popupDiv.offsetWidth - 120 + "px";
  121335. this.popupDiv.style.top = windowPosition.y + "px";
  121336. const camerPosition = this.viewer.camera.position;
  121337. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121338. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121339. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121340. this.popupDiv.style.display = "block";
  121341. } else {
  121342. this.popupDiv.style.display = "none";
  121343. }
  121344. }
  121345. _createHtml(videoInfo) {
  121346. let html = `
  121347. <div class="rightLine-1"></div>
  121348. <div class="rightLine-2"></div>
  121349. <div class="rightLine-3"></div>
  121350. <div class="popup-header">
  121351. <span class="popup-title" >${videoInfo.name}</span>
  121352. <span class="popup-video2-close-button" title="\u5173\u95ED" >\xD7</span>
  121353. </div>
  121354. <div class="popup-content">
  121355. <video id="myvideo" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" width="100%" height="100%"></video>
  121356. </div>
  121357. `;
  121358. return html;
  121359. }
  121360. }
  121361. Object.assign(VideoWindow2.prototype, {
  121362. close() {
  121363. this.popupDiv.remove();
  121364. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121365. }
  121366. });
  121367. var VideoWindow3$1 = "";
  121368. class VideoWindow3 {
  121369. constructor(viewer2, position2, videoInfo) {
  121370. if (!viewer2)
  121371. throw new Cesium.DeveloperError("no viewer object!");
  121372. if (!position2)
  121373. throw new Cesium.DeveloperError("no position object!");
  121374. this.viewer = viewer2;
  121375. this.position = position2;
  121376. if (position2 instanceof Cesium.Cartesian3) {
  121377. this.position = position2;
  121378. } else {
  121379. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121380. }
  121381. if (document.getElementsByClassName("popup-video3").length > 0) {
  121382. document.getElementsByClassName("popup-video3")[0].remove();
  121383. }
  121384. this.id = "popup_video_" + getGuid();
  121385. this.popupDiv = document.createElement("div");
  121386. this.popupDiv.classList.add("popup-video3");
  121387. this.popupDiv.id = this.id;
  121388. this.viewer.container.append(this.popupDiv);
  121389. this.popupDiv.innerHTML = this._createHtml(videoInfo);
  121390. switch (videoInfo.type) {
  121391. case "hls":
  121392. this.videotype = "application/x-mpegURL";
  121393. break;
  121394. case "rtmp":
  121395. this.videotype = "rtmp/flv";
  121396. break;
  121397. case "flv":
  121398. this.videotype = "video/x-flv";
  121399. break;
  121400. case "mp4":
  121401. this.videotype = "video/mp4";
  121402. break;
  121403. }
  121404. this.videoPlayer = videojs$2(document.querySelector("#myvideo"), {
  121405. controls: true,
  121406. autoplay: "muted",
  121407. loop: true,
  121408. muted: false,
  121409. fluid: true,
  121410. aspectRatio: "16:9",
  121411. reload: "auto",
  121412. fullscreen: {
  121413. options: {
  121414. navigationUI: "hide"
  121415. }
  121416. },
  121417. sources: [{
  121418. src: videoInfo.url,
  121419. type: this.videotype
  121420. }]
  121421. }, function onPlayerReady() {
  121422. console.log("onPlayerReady", this);
  121423. });
  121424. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121425. document.getElementsByClassName("popup-video3-close-button")[0].onclick = () => {
  121426. this.close();
  121427. };
  121428. }
  121429. postRender() {
  121430. this.viewer.scene.canvas.height;
  121431. const windowPosition = new Cesium.Cartesian2();
  121432. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121433. this.viewer.scene,
  121434. this.position,
  121435. windowPosition
  121436. );
  121437. this.popupDiv.style.left = windowPosition.x + 70 + "px";
  121438. this.popupDiv.style.top = windowPosition.y - this.popupDiv.offsetHeight - 20 + "px";
  121439. const camerPosition = this.viewer.camera.position;
  121440. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121441. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121442. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121443. this.popupDiv.style.display = "block";
  121444. } else {
  121445. this.popupDiv.style.display = "none";
  121446. }
  121447. }
  121448. _createHtml(videoInfo) {
  121449. let html = `
  121450. <div class="leftLine-1"></div>
  121451. <div class="leftLine-2"></div>
  121452. <div class="popup-header">
  121453. <span class="popup-title" >${videoInfo.name}</span>
  121454. <span class="popup-video3-close-button" title="\u5173\u95ED" >\xD7</span>
  121455. </div>
  121456. <div class="popup-content">
  121457. <video id="myvideo" class="video-js vjs-big-play-centered vjs-fluid" controls preload="auto" width="100%" height="100%"></video>
  121458. </div>
  121459. `;
  121460. return html;
  121461. }
  121462. }
  121463. Object.assign(VideoWindow3.prototype, {
  121464. close() {
  121465. this.popupDiv.remove();
  121466. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121467. }
  121468. });
  121469. var HtmlWindow1 = "";
  121470. class HtmlWindow {
  121471. constructor(viewer2, position2, title, html, offsetHeight) {
  121472. if (!viewer2)
  121473. throw new Cesium.DeveloperError("no viewer object!");
  121474. if (!position2)
  121475. throw new Cesium.DeveloperError("no position object!");
  121476. this.viewer = viewer2;
  121477. this.offsetHeight = offsetHeight;
  121478. if (position2 instanceof Cesium.Cartesian3) {
  121479. this.position = position2;
  121480. } else {
  121481. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121482. }
  121483. if (document.getElementsByClassName("popup1").length > 0) {
  121484. document.getElementsByClassName("popup1")[0].remove();
  121485. viewer2.entities.remove(viewer2.entities.getById("popupPoint"));
  121486. }
  121487. this.id = "popup_" + getGuid();
  121488. this.popupDiv = document.createElement("div");
  121489. this.popupDiv.classList.add("popup1");
  121490. this.popupDiv.id = this.id;
  121491. this.viewer.container.append(this.popupDiv);
  121492. this.popupDiv.innerHTML = this._createHtml(title, html);
  121493. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121494. this.initPoint();
  121495. document.getElementsByClassName("popup1-close-button")[0].onclick = () => {
  121496. this.close();
  121497. };
  121498. }
  121499. postRender() {
  121500. this.viewer.scene.canvas.height;
  121501. const windowPosition = new Cesium.Cartesian2();
  121502. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121503. this.viewer.scene,
  121504. this.position,
  121505. windowPosition
  121506. );
  121507. let elWidth = this.popupDiv.offsetWidth;
  121508. let elHeight = this.popupDiv.offsetHeight;
  121509. if (!!this.offsetHeight) {
  121510. elHeight += this.offsetHeight;
  121511. }
  121512. this.popupDiv.style.left = windowPosition.x - elWidth / 2 + "px";
  121513. this.popupDiv.style.top = windowPosition.y - elHeight + "px";
  121514. const camerPosition = this.viewer.camera.position;
  121515. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121516. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121517. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121518. this.popupDiv.style.display = "block";
  121519. } else {
  121520. this.popupDiv.style.display = "none";
  121521. }
  121522. }
  121523. _createHtml(header, content) {
  121524. let html = `
  121525. <div class="popup-header">
  121526. ${header}
  121527. <span class="popup1-close-button">\xD7</span>
  121528. </div>
  121529. <div class="popup-content">
  121530. ${content}
  121531. </div>
  121532. <div class="popup-tip">
  121533. </div>
  121534. `;
  121535. return html;
  121536. }
  121537. initPoint() {
  121538. this.billboard = this.viewer.entities.add({
  121539. id: "popupPoint",
  121540. name: "popupPoint",
  121541. position: this.position,
  121542. billboard: {
  121543. image: "jt3dSDK/imgs/point/point.png",
  121544. horizontalOrigin: Cesium.HorizontalOrigin.center,
  121545. verticalOrigin: Cesium.VerticalOrigin.bottom,
  121546. scale: 1,
  121547. pixelOffset: new Cesium.Cartesian2(0, 0),
  121548. disableDepthTestDistance: Number.POSITIVE_INFINITY
  121549. }
  121550. });
  121551. }
  121552. }
  121553. Object.assign(HtmlWindow.prototype, {
  121554. close() {
  121555. this.popupDiv.remove();
  121556. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121557. this.viewer.entities.remove(this.billboard);
  121558. }
  121559. });
  121560. var HtmlWindow2$1 = "";
  121561. class HtmlWindow2 {
  121562. constructor(viewer2, position2, title, html) {
  121563. if (!viewer2)
  121564. throw new Cesium.DeveloperError("no viewer object!");
  121565. if (!position2)
  121566. throw new Cesium.DeveloperError("no position object!");
  121567. this.viewer = viewer2;
  121568. this.position = position2;
  121569. if (position2 instanceof Cesium.Cartesian3) {
  121570. this.position = position2;
  121571. } else {
  121572. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121573. }
  121574. if (document.getElementsByClassName("popup2").length > 0) {
  121575. document.getElementsByClassName("popup2")[0].remove();
  121576. }
  121577. this.id = "popup_" + getGuid();
  121578. this.popupDiv = document.createElement("div");
  121579. this.popupDiv.classList.add("popup2");
  121580. this.popupDiv.id = this.id;
  121581. this.viewer.container.append(this.popupDiv);
  121582. this.popupDiv.innerHTML = this._createHtml(title, html);
  121583. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121584. document.getElementsByClassName("popup2-close-button")[0].onclick = () => {
  121585. this.close();
  121586. };
  121587. }
  121588. postRender() {
  121589. this.viewer.scene.canvas.height;
  121590. const windowPosition = new Cesium.Cartesian2();
  121591. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121592. this.viewer.scene,
  121593. this.position,
  121594. windowPosition
  121595. );
  121596. this.popupDiv.style.left = windowPosition.x - this.popupDiv.offsetWidth - 120 + "px";
  121597. this.popupDiv.style.top = windowPosition.y + "px";
  121598. const camerPosition = this.viewer.camera.position;
  121599. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121600. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121601. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121602. this.popupDiv.style.display = "block";
  121603. } else {
  121604. this.popupDiv.style.display = "none";
  121605. }
  121606. }
  121607. _createHtml(title, content) {
  121608. let html = `
  121609. <div class="rightLine-1"></div>
  121610. <div class="rightLine-2"></div>
  121611. <div class="rightLine-3"></div>
  121612. <div class="popup-header">
  121613. <span class="popup-title" >${title}</span>
  121614. <span class="popup2-close-button" title="\u5173\u95ED" >\xD7</span>
  121615. </div>
  121616. <div class="popup-content">
  121617. ${content}
  121618. </div>
  121619. `;
  121620. return html;
  121621. }
  121622. }
  121623. Object.assign(HtmlWindow2.prototype, {
  121624. close() {
  121625. this.popupDiv.remove();
  121626. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121627. }
  121628. });
  121629. var HtmlWindow3$1 = "";
  121630. class HtmlWindow3 {
  121631. constructor(viewer2, position2, title, html) {
  121632. if (!viewer2)
  121633. throw new Cesium.DeveloperError("no viewer object!");
  121634. if (!position2)
  121635. throw new Cesium.DeveloperError("no position object!");
  121636. this.viewer = viewer2;
  121637. this.position = position2;
  121638. if (position2 instanceof Cesium.Cartesian3) {
  121639. this.position = position2;
  121640. } else {
  121641. this.position = Cesium.Cartesian3.fromDegrees(position2[0], position2[1], position2[2] || 0);
  121642. }
  121643. if (document.getElementsByClassName("popup3").length > 0) {
  121644. document.getElementsByClassName("popup3")[0].remove();
  121645. }
  121646. this.id = "popup_" + getGuid();
  121647. this.popupDiv = document.createElement("div");
  121648. this.popupDiv.classList.add("popup3");
  121649. this.popupDiv.id = this.id;
  121650. this.viewer.container.append(this.popupDiv);
  121651. this.popupDiv.innerHTML = this._createHtml(title, html);
  121652. this.viewer.scene.postRender.addEventListener(this.postRender, this);
  121653. document.getElementsByClassName("popup3-close-button")[0].onclick = () => {
  121654. this.close();
  121655. };
  121656. }
  121657. postRender() {
  121658. this.viewer.scene.canvas.height;
  121659. const windowPosition = new Cesium.Cartesian2();
  121660. Cesium.SceneTransforms.wgs84ToWindowCoordinates(
  121661. this.viewer.scene,
  121662. this.position,
  121663. windowPosition
  121664. );
  121665. this.popupDiv.style.left = windowPosition.x + 70 + "px";
  121666. this.popupDiv.style.top = windowPosition.y - this.popupDiv.offsetHeight - 20 + "px";
  121667. const camerPosition = this.viewer.camera.position;
  121668. let height2 = this.viewer.scene.globe.ellipsoid.cartesianToCartographic(camerPosition).height;
  121669. height2 += this.viewer.scene.globe.ellipsoid.maximumRadius;
  121670. if (!(Cesium.Cartesian3.distance(camerPosition, this.position) > height2) && this.viewer.camera.positionCartographic.height < 5e7) {
  121671. this.popupDiv.style.display = "block";
  121672. } else {
  121673. this.popupDiv.style.display = "none";
  121674. }
  121675. }
  121676. _createHtml(title, content) {
  121677. let html = `
  121678. <div class="leftLine-1"></div>
  121679. <div class="leftLine-2"></div>
  121680. <div class="popup-header">
  121681. <span class="popup-title" >${title}</span>
  121682. <span class="popup3-close-button" title="\u5173\u95ED" >\xD7</span>
  121683. </div>
  121684. <div class="popup-content">
  121685. ${content}
  121686. </div>
  121687. `;
  121688. return html;
  121689. }
  121690. }
  121691. Object.assign(HtmlWindow3.prototype, {
  121692. close() {
  121693. this.popupDiv.remove();
  121694. this.viewer.scene.postRender.removeEventListener(this.postRender, this);
  121695. }
  121696. });
  121697. let PopupWindow = {
  121698. MultiFieldAdaptWindow,
  121699. VideoWindow,
  121700. VideoWindow2,
  121701. VideoWindow3,
  121702. HtmlWindow,
  121703. HtmlWindow2,
  121704. HtmlWindow3
  121705. };
  121706. class AroundPoint {
  121707. constructor(viewer2, amount, position2) {
  121708. this._viewer = viewer2;
  121709. this._amount = amount;
  121710. this._position = position2;
  121711. this._range = this._viewer.camera.positionCartographic.height;
  121712. }
  121713. _bindEvent() {
  121714. let _self = this;
  121715. this._viewer.clock.onTick.addEventListener(this._aroundPoint, this);
  121716. var handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  121717. handler.setInputAction(function(click) {
  121718. _self.stop();
  121719. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  121720. }
  121721. _unbindEvent() {
  121722. this._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
  121723. this._viewer.clock.onTick.removeEventListener(this._aroundPoint, this);
  121724. }
  121725. start() {
  121726. this._viewer.clock.shouldAnimate = true;
  121727. this._unbindEvent();
  121728. this._bindEvent();
  121729. return this;
  121730. }
  121731. stop() {
  121732. this._unbindEvent();
  121733. return this;
  121734. }
  121735. _aroundPoint() {
  121736. let heading = this._viewer.camera.heading;
  121737. let pitch = this._viewer.camera.pitch;
  121738. let range3 = this._range;
  121739. heading += Cesium.Math.toRadians(this._amount);
  121740. if (heading >= Math.PI * 2 || heading <= -Math.PI * 2) {
  121741. heading = 0;
  121742. }
  121743. this._viewer.camera.lookAt(
  121744. this._position,
  121745. new Cesium.HeadingPitchRange(
  121746. heading,
  121747. pitch,
  121748. range3
  121749. )
  121750. );
  121751. }
  121752. }
  121753. class AroundView {
  121754. constructor(viewer2, amount) {
  121755. this._viewer = viewer2;
  121756. this._amount = amount;
  121757. }
  121758. _bindEvent() {
  121759. let _self = this;
  121760. this._viewer.clock.onTick.addEventListener(this._aroundView, this);
  121761. var handler = new Cesium.ScreenSpaceEventHandler(this._viewer.scene.canvas);
  121762. handler.setInputAction(function(click) {
  121763. _self.stop();
  121764. }, Cesium.ScreenSpaceEventType.LEFT_DOWN);
  121765. }
  121766. _unbindEvent() {
  121767. this._viewer.camera.lookAtTransform(Cesium.Matrix4.IDENTITY);
  121768. this._viewer.clock.onTick.removeEventListener(this._aroundView, this);
  121769. }
  121770. start() {
  121771. this._viewer.clock.shouldAnimate = true;
  121772. this._unbindEvent();
  121773. this._bindEvent();
  121774. return this;
  121775. }
  121776. stop() {
  121777. this._unbindEvent();
  121778. return this;
  121779. }
  121780. _aroundView() {
  121781. let heading = this._viewer.camera.heading;
  121782. let pitch = this._viewer.camera.pitch;
  121783. let roll = this._viewer.camera.roll;
  121784. heading += Cesium.Math.toRadians(this._amount);
  121785. if (heading >= Math.PI * 2 || heading <= -Math.PI * 2) {
  121786. heading = 0;
  121787. }
  121788. this._viewer.camera.setView({
  121789. orientation: {
  121790. heading,
  121791. pitch,
  121792. roll
  121793. }
  121794. });
  121795. }
  121796. }
  121797. export { AroundPoint, AroundView, CircleObject, CommonTools, CoordTransform, CrImageServerLayer, DrawMilitaryPlot, DrawPoint, DrawTools, LocateUtil, PointObject, PolygonObject, PolylineObject, PopupWindow, CreateRemindertip as ReminderTip, Roaming, RuntimeEnvironment, SceneControl, SceneEffects, SketchViewModel, SpatialAnalysis, StatusBar, TerrainAnalysis, TrackRoam, WallObject, common, jtMap3d, LoadMapData as layer };